Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Extension for GD Star Rating
- *
- * This file extends Achievements to support actions from GD Star Rating
- *
- * @package Achievements
- * @subpackage ExtensionGDStarRating
- */
- // Exit if accessed directly
- if ( ! defined( 'ABSPATH' ) ) exit;
- /**
- * Extends Achievements to support actions from GD Star Rating.
- *
- * @since Achievements (3.0)
- */
- function dpa_init_gdstarrating_extension() {
- achievements()->extensions->gd_star_rating = new DPA_GD_Star_Rating_Extension;
- // Tell the world that the GD Star Rating extension is ready
- do_action( 'dpa_init_gdstarrating_extension' );
- }
- add_action( 'dpa_ready', 'dpa_init_gdstarrating_extension' );
- /**
- * Extension to add GD Star Rating support to Achievements
- *
- * @since Achievements (3.0)
- */
- class DPA_GD_Star_Rating_Extension extends DPA_Extension {
- /**
- * Constructor
- *
- * Sets up extension properties. See class phpdoc for details.
- *
- * @since Achievements (3.0)
- */
- public function __construct() {
- $this->actions = array(
- 'gdsr_vote_rating_article' => __( 'User Posts Rating with GD Star Rating', 'dpa'),
- 'gdsr_vote_thumb_article' => __( 'Someone votes on something... I hope.', 'dpa'),
- 'gdsr_vote_rating_comment' => __( 'Someone rated a comment', 'dpa'),
- 'someone_voted' => __('Someone voted', 'dpa'),
- //'accepted_email_invite' => __( 'A new user activates their account.', 'dpa' ),
- //'sent_email_invite' => __( 'The user invites someone else to join the site.', 'dpa' ),
- );
- $this->contributors = array(
- array(
- 'name' => '',
- 'gravatar_url' => '',
- 'profile_url' => '',
- ),
- );
- $this->description = __( "Allows users to rate things.", 'dpa' );
- $this->id = 'gd-star-rating';
- $this->image_url = trailingslashit( achievements()->includes_url ) . 'admin/images/logo.png';
- $this->name = __( 'GD Star Rating', 'dpa' );
- $this->rss_url = 'http://feeds.feedburner.com/gdstarrating';
- $this->small_image_url = trailingslashit( achievements()->includes_url ) . 'admin/images/logo.png';
- $this->version = 1;
- $this->wporg_url = 'http://wordpress.org/plugins/achievements/';
- add_filter( 'dpa_handle_event_user_id', array( $this, 'event_user_id' ), 10, 3 );
- }
- /**
- * For the accepted_email_invite action from Invite Anyone, get the user ID from the function
- * arguments as the user isn't logged in yet.
- *
- * @param int $user_id
- * @param string $action_name
- * @param array $action_func_args The action's arguments from func_get_args().
- * @return int|false New user ID or false to skip any further processing
- * @since Achievements (3.0)
- */
- /*public function event_user_id( $user_id, $action_name, $action_func_args ) {
- if ( 'accepted_email_invite' != $action_name )
- return $user_id;
- return (int) $action_func_args[0];
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement