Example #1
0
 function __construct()
 {
     parent::__construct();
     // configuration general
     global $yuzo_options;
     // get option plugin ;)
     $yuzo_options = IF_get_option($this->parameter['name_option']);
     $this->plugin_options = $yuzo_options;
     // ajax nonce for count visits in cache
     if (defined('WP_CACHE') && WP_CACHE) {
         add_action('wp_enqueue_scripts', array(&$this, 'wp_yuzo_postview_cache_count_enqueue'));
         add_action('wp_ajax_nopriv_yuzo-plus-views', array(&$this, 'hits_ajax'));
         add_action('wp_ajax_yuzo-plus-views', array(&$this, 'hits_ajax'));
     } else {
         add_action('wp_head', array(&$this, 'hits'), 12);
     }
     if (is_admin()) {
         add_action('admin_enqueue_scripts', array(&$this, 'script_and_style_admin'));
         if (isset($yuzo_options->show_columns_dashboard) && $yuzo_options->show_columns_dashboard) {
             //Hooks a function to a specific filter action.
             //applied to the list of columns to print on the manage posts screen.
             add_filter('manage_posts_columns', array(&$this, 'yuzo_post_column_views'));
             //Hooks a function to a specific action.
             //allows you to add custom columns to the list post/custom post type pages.
             //'10' default: specify the function's priority.
             //and '2' is the number of the functions' arguments.
             add_action('manage_posts_custom_column', array(&$this, 'yuzo_post_custom_column_views'), 10, 2);
         }
     } elseif (!is_admin()) {
         if (isset($yuzo_options->automatically_append) && $yuzo_options->automatically_append == '1') {
             add_action('the_content', array(&$this, 'create_post_related'), 10);
         }
         // add scripts & styles
         add_action('wp_enqueue_scripts', array(&$this, 'script_and_style_front'));
         // count hit post
         /*if(  !defined( 'WP_CACHE' ) || !WP_CACHE ){
             add_action('wp_head',array( &$this,'hits'), 12 );
           }*/
     }
 }
 function __construct()
 {
     parent::__construct();
     // configuration general
     global $yuzo_options;
     // get option plugin ;)
     $yuzo_options = $this->utils->IF_get_option($this->parameter['name_option']);
     $this->plugin_options = $yuzo_options;
     // if disabled hits
     if (isset($yuzo_options->disabled_counter) && $yuzo_options->disabled_counter) {
         null;
     } else {
         // ajax nonce for count visits in cache plugin
         if (defined('WP_CACHE') && WP_CACHE) {
             add_action('wp_enqueue_scripts', array(&$this, 'wp_yuzo_postview_cache_count_enqueue'));
             add_action('wp_ajax_nopriv_yuzo-plus-views', array(&$this, 'hits_ajax'));
             add_action('wp_ajax_yuzo-plus-views', array(&$this, 'hits_ajax'));
         } else {
             // count normal
             add_action('wp_head', array(&$this, 'hits'), 12);
         }
     }
     if (is_admin()) {
         // when active plugin refirect to page
         add_action('admin_menu', array(&$this, 'yuzo_menu_welcome'));
         add_action('admin_enqueue_scripts', array(&$this, 'script_and_style_admin'));
         if (isset($yuzo_options->disabled_counter) && $yuzo_options->disabled_counter) {
             null;
         } else {
             if (isset($yuzo_options->show_columns_dashboard) && $yuzo_options->show_columns_dashboard) {
                 //Hooks a function to a specific filter action.
                 //applied to the list of columns to print on the manage posts screen.
                 add_filter('manage_posts_columns', array(&$this, 'yuzo_post_column_views'));
                 //Hooks a function to a specific action.
                 //allows you to add custom columns to the list post/custom post type pages.
                 //'10' default: specify the function's priority.
                 //and '2' is the number of the functions' arguments.
                 add_action('manage_posts_custom_column', array(&$this, 'yuzo_post_custom_column_views'), 10, 2);
                 // Add labels of hits
                 add_action('admin_head', array(&$this, 'add_labes_hits_tablelist'));
             }
         }
         // when active plugin verify db
         //register_activation_hook( __FILE__ , array( &$this,'yuzo_install_db' ) );
         add_action('admin_head', array(&$this, 'yuzo_install_db'));
         add_action('admin_footer', array(&$this, 'show_popup_message'));
         // when active plugin redirect
         add_action('activated_plugin', array(&$this, 'yuzo_redirect_welcome'));
         //register_activation_hook( __FILE__ , array( &$this, 'yuzo_redirect_welcome' ));
         // load functions ajax in admin
         add_action('admin_enqueue_scripts', 'add_ajax_javascript_file');
         add_action('wp_ajax_ajax_delete_yuzo_data_admin', 'ajax_delete_yuzo_data_admin');
         // delete transient each 'save'
         if (isset($_POST["save_options"]) && $_POST["save_options"] == 1) {
             $this->delete_transient_for_save();
         }
     } elseif (!is_admin()) {
         if (isset($yuzo_options->disabled_counter) && $yuzo_options->disabled_counter) {
             null;
         } else {
             add_shortcode('yuzo_views', array(&$this, 'yuzo_shortcode'));
         }
         add_shortcode('yuzo_related', array(&$this, 'yuzo_shortcode_related'));
         if (isset($yuzo_options->automatically_append) && $yuzo_options->automatically_append == '1') {
             add_action('the_content', array(&$this, 'create_post_related'), 10);
         }
         // add scripts & styles
         add_action('wp_enqueue_scripts', array(&$this, 'script_and_style_front'));
         // add custom css
         add_action('wp_footer', array(&$this, 'add_custom_css'));
     }
 }