Advertisement
piers184

gdstarratings.php

Jun 27th, 2013
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.89 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Extension for GD Star Rating
  4.  *
  5.  * This file extends Achievements to support actions from GD Star Rating
  6.  *
  7.  * @package Achievements
  8.  * @subpackage ExtensionGDStarRating
  9.  */
  10.  
  11. // Exit if accessed directly
  12. if ( ! defined( 'ABSPATH' ) ) exit;
  13.  
  14. /**
  15.  * Extends Achievements to support actions from GD Star Rating.
  16.  *
  17.  * @since Achievements (3.0)
  18.  */
  19. function dpa_init_gdstarrating_extension() {
  20.     achievements()->extensions->gd_star_rating = new DPA_GD_Star_Rating_Extension;
  21.  
  22.     // Tell the world that the GD Star Rating extension is ready
  23.     do_action( 'dpa_init_gdstarrating_extension' );
  24. }
  25. add_action( 'dpa_ready', 'dpa_init_gdstarrating_extension' );
  26.  
  27. /**
  28.  * Extension to add GD Star Rating support to Achievements
  29.  *
  30.  * @since Achievements (3.0)
  31.  */
  32. class DPA_GD_Star_Rating_Extension extends DPA_Extension {
  33.     /**
  34.      * Constructor
  35.      *
  36.      * Sets up extension properties. See class phpdoc for details.
  37.      *
  38.      * @since Achievements (3.0)
  39.      */
  40.     public function __construct() {
  41.         $this->actions = array(
  42.             'gdsr_vote_rating_article' => __( 'User Posts Rating with GD Star Rating', 'dpa'),
  43.             'gdsr_vote_thumb_article' => __( 'Someone votes on something... I hope.', 'dpa'),
  44.             'gdsr_vote_rating_comment' => __( 'Someone rated a comment', 'dpa'),
  45.             'someone_voted' => __('Someone voted', 'dpa'),
  46.            
  47.             //'accepted_email_invite' => __( 'A new user activates their account.', 'dpa' ),
  48.             //'sent_email_invite'     => __( 'The user invites someone else to join the site.', 'dpa' ),
  49.         );
  50.  
  51.         $this->contributors = array(
  52.             array(
  53.                 'name'         => '',
  54.                 'gravatar_url' => '',
  55.                 'profile_url'  => '',
  56.             ),
  57.         );
  58.  
  59.        
  60.         $this->description     = __( "Allows users to rate things.", 'dpa' );
  61.         $this->id              = 'gd-star-rating';
  62.         $this->image_url       = trailingslashit( achievements()->includes_url ) . 'admin/images/logo.png';
  63.         $this->name            = __( 'GD Star Rating', 'dpa' );
  64.         $this->rss_url         = 'http://feeds.feedburner.com/gdstarrating';
  65.         $this->small_image_url = trailingslashit( achievements()->includes_url ) . 'admin/images/logo.png';
  66.         $this->version         = 1;
  67.         $this->wporg_url       = 'http://wordpress.org/plugins/achievements/';
  68.        
  69.  
  70.         add_filter( 'dpa_handle_event_user_id', array( $this, 'event_user_id' ), 10, 3 );
  71.     }
  72.  
  73.    
  74.    
  75.    
  76.    
  77.     /**
  78.      * For the accepted_email_invite action from Invite Anyone, get the user ID from the function
  79.      * arguments as the user isn't logged in yet.
  80.      *
  81.      * @param int $user_id
  82.      * @param string $action_name
  83.      * @param array $action_func_args The action's arguments from func_get_args().
  84.      * @return int|false New user ID or false to skip any further processing
  85.      * @since Achievements (3.0)
  86.      */
  87.     /*public function event_user_id( $user_id, $action_name, $action_func_args ) {
  88.         if ( 'accepted_email_invite' != $action_name )
  89.             return $user_id;
  90.  
  91.         return (int) $action_func_args[0];
  92.     }*/
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement