Esempio n. 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 );
           }*/
     }
 }
Esempio n. 2
0
 function save_options_for_tabs()
 {
     //code save options the theme
     if (isset($_POST) && (isset($_POST['save_options']) || isset($_POST['reset_options'])) && $_POST["name_options"] == $this->parameter["name_option"]) {
         $Myoptions = self::theme_definitions();
         $options_update = array();
         if (is_array($Myoptions)) {
             foreach ($Myoptions as $key2 => $value2) {
                 $data_f = array();
                 $tabs_save = isset($_GET['tabs']) && $_GET['tabs'] == $value2["tab"] ? true : false;
                 //if( (  isset($value2["tab"]) && isset($value2['default']) && $value2['default'] ) || $tabs_save ){
                 if ($tabs_save) {
                     if ($key2 != 'last_update') {
                         if ($data_f = self::fields_update($value2['options'], 1)) {
                             $options_update = array_merge($options_update, $data_f);
                         }
                     } else {
                         $options_update[$key2] = time();
                     }
                 }
             }
         }
         if (is_array($options_update)) {
             $options = IF_get_option($this->parameter['name_option']);
             $options_current = array();
             if (isset($options) && is_object($options)) {
                 foreach ($options as $key => $value) {
                     if ((!empty($value) || !isset($value)) && $key != 'last_update') {
                         $options_current[$this->parameter['name_option'] . '_' . $key] = $value;
                     }
                 }
                 $options_current['last_update'] = time();
             }
             // Parse incoming $args into an array and merge it with $defaults
             $args = wp_parse_args($options_update, $options_current);
             //var_dump( $options_update );
             //var_dump( $options_current );
             //var_dump( $args );
             if (update_option($this->parameter['name_option'] . "_options", $args)) {
                 $this->save_status = true;
             } else {
                 $this->save_status = false;
             }
         } else {
             $this->save_status = false;
         }
     }
 }