Exemple #1
0
 private function __construct()
 {
     // get options
     self::$options = get_option('pixlikes_settings');
     $this->config = self::config();
     // Load plugin text domain
     add_action('init', array($this, 'load_plugin_textdomain'));
     add_action('admin_init', array($this, 'wpgrade_init_plugin'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Add an action link pointing to the options page.
     $plugin_basename = plugin_basename(plugin_dir_path(__FILE__) . 'pixlikes.php');
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links'));
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     // Load public-facing style sheet and JavaScript.
     add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
     /// think about including this in add_like_box_after_content() so the script fille to be included only when is needed
     add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     // when the user is publishing a post let's ensure he is creating a default likes meta
     add_action('publish_post', array($this, 'init_meta_likes'));
     // prepend the like box after the content
     add_filter('the_content', array(&$this, 'add_like_box_after_content'));
     add_action('wp_ajax_pixlikes', array(&$this, 'ajax_callback'));
     add_action('wp_ajax_nopriv_pixlikes', array(&$this, 'ajax_callback'));
     // prepend the display_likes after the excerpt
     //add_filter('the_excerpt', array(&$this, 'the_content'));
     // edit metabox
     if (isset(self::$options['edit_votes']) && self::$options['edit_votes']) {
         add_action('save_post', array(&$this, 'pixlikes_save_postdata'));
         add_action('add_meta_boxes', array(&$this, 'adding_pixlikes_custom_meta_boxes'), 10, 2);
     }
 }