Exemple #1
0
 public static function admin_init()
 {
     add_meta_box("meta_data_filter_options", __("Meta Data Filter Options", 'meta-data-filter'), array(__CLASS__, 'data_meta_box'), self::$slug, "normal", "high");
     add_meta_box("meta_data_filter_sequence", __("Filter sequence on front", 'meta-data-filter'), array(__CLASS__, 'data_meta_box_sequence'), self::$slug, "side", "high");
     add_meta_box("meta_data_filter_style", __("Meta Data Filter Style", 'meta-data-filter'), array(__CLASS__, 'data_meta_box_style'), self::$slug, "side", "high");
     MetaDataFilterPage::add_meta_box();
     //***
     global $pagenow;
     //if (is_admin() AND 'plugins.php' == $pagenow AND isset($_GET['activate'])) {
     //if ($_GET['activate'] == 'true') {
     if (!get_option('meta_data_filter_was_activated')) {
         $args = array('ID' => 0, 'post_status' => 'publish', 'post_title' => __("MDTF Results Page", 'meta-data-filter'), 'post_content' => '[meta_data_filter_results]', 'post_type' => 'page');
         $post_id = wp_insert_post($args);
         update_post_meta($post_id, '_wp_page_template', 'template-meta-data-filter.php');
         //set settings
         $data = array('search_url' => home_url(), 'reset_link' => home_url(), 'post_types' => array('post'), 'output_tpl' => 'search', 'tooltip_theme' => 'shadow', 'tooltip_icon' => '', 'tooltip_icon_w' => '', 'tooltip_icon_h' => '', 'tooltip_max_width' => 220, 'ajax_searching' => 0, 'marketing_short_links' => 1, 'use_chosen_js_w' => 0, 'use_chosen_js_s' => 0, 'use_custom_scroll_bar' => 1, 'use_custom_icheck' => 1, 'results_per_page' => 0, 'loading_text' => __("One Moment ...", 'meta-data-filter'), 'hide_search_button_shortcode' => 0, 'ignore_sticky_posts' => 1, 'icheck_skin' => 'flat_aero', 'try_make_shop_page_ajaxed' => 0, 'show_tax_all_childs' => 0);
         update_option('meta_data_filter_settings', $data);
         //***
         @copy(self::get_application_path() . 'views/to_theme/template-meta-data-filter.php', get_template_directory() . '/template-meta-data-filter.php');
         update_option('meta_data_filter_was_activated', 1);
     }
     //}
     //}
     add_action('admin_notices', array(__CLASS__, 'admin_notices'));
 }