示例#1
0
 /**
  * Setup backend functionality in WordPress
  *
  * @return none
  * @since 0.0.2
  */
 function __construct()
 {
     CommentAvatars::__construct();
     $this->check_upgrade();
     // Full path to main file
     $this->plugin_file = dirname(dirname(__FILE__)) . '/comment_avatars.php';
     // Load localizations if available
     load_plugin_textdomain('custom-avatars-for-comments', false, 'custom-avatars-for-comments/translations');
     // Activation hook
     register_activation_hook($this->plugin_file, array(&$this, 'init'));
     // Whitelist options
     add_action('admin_init', array(&$this, 'register_settings'));
     // Activate the options page
     add_action('admin_menu', array(&$this, 'add_page'));
 }
示例#2
0
 /**
  * Setup frontend 
  *
  * @return none
  * @since 0.0.2
  */
 function __construct()
 {
     CommentAvatars::__construct();
     if (!empty($this->options)) {
         add_action('comment_post', array(&$this, 'add_meta_settings'), 1);
         add_filter('get_avatar', array(&$this, 'filter'), 10, 5);
         add_action('wp_head', array(&$this, 'styles'), 7);
         add_action('wp_head', array(&$this, 'scripts'), 8);
         if ($this->get_option('removeselect') !== '1') {
             add_action('comment_form', array(&$this, 'select'), 1);
         }
         if ($this->get_option('showhomelink') == '1') {
             add_action('wp_footer', array(&$this, 'homelink'), 8);
         }
         // turn off in admin bar
         add_action('admin_bar_menu', array(&$this, 'tmpdisable'));
         add_action('wp_after_admin_bar_render', array(&$this, 'tmpenable'));
     }
 }