Beispiel #1
0
 public static function init()
 {
     parent::init();
     add_action('wp_head', array(__CLASS__, 'wp_head'), 1);
     add_shortcode('mdf_gmap', array(__CLASS__, 'mdf_gmap_shortcode'));
     add_shortcode('mdf_gmap_const', array(__CLASS__, 'mdf_gmap_shortcode_const'));
 }
Beispiel #2
0
 public static function init()
 {
     parent::init();
     add_action('wp_ajax_meta_data_filter_add_item_to_data_group', array(__CLASS__, 'add_item_to_data_group'));
     self::$items_types = array('checkbox' => __("checkbox", 'meta-data-filter'), 'select' => __("drop-down", 'meta-data-filter'), 'slider' => __("range slider", 'meta-data-filter'), 'taxonomy' => __("taxonomy", 'meta-data-filter'), 'textinput' => __("textinput", 'meta-data-filter'), 'calendar' => __("calendar", 'meta-data-filter'), 'map' => __("map", 'meta-data-filter'));
     self::$tax_items_types = array('select' => __("drop-down", 'meta-data-filter'), 'checkbox' => __("checkbox", 'meta-data-filter'));
 }
Beispiel #3
0
 public static function init()
 {
     parent::init();
     $args = array('labels' => array('name' => __('MDTF Shortcodes', 'meta-data-filter'), 'singular_name' => __('Shortcodes Links', 'meta-data-filter'), 'add_new' => __('Add New Shortcode', 'meta-data-filter'), 'add_new_item' => __('Add New Shortcode', 'meta-data-filter'), 'edit_item' => __('Edit Shortcode', 'meta-data-filter'), 'new_item' => __('New Shortcode', 'meta-data-filter'), 'view_item' => __('View Shortcode', 'meta-data-filter'), 'search_items' => __('Search Shortcodes', 'meta-data-filter'), 'not_found' => __('No Shortcodes found', 'meta-data-filter'), 'not_found_in_trash' => __('No Shortcodes found in Trash', 'meta-data-filter'), 'parent_item_colon' => ''), 'public' => false, 'archive' => false, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => true, 'menu_position' => null, 'show_in_menu' => 'edit.php?post_type=' . self::$slug, 'supports' => array('title', 'excerpt'), 'rewrite' => array('slug' => self::$slug_shortcodes), 'show_in_admin_bar' => false, 'menu_icon' => '', 'taxonomies' => array());
     register_post_type(self::$slug_shortcodes, $args);
     //+++
     add_action('admin_init', array(__CLASS__, 'admin_init'), 1);
     //+++
     //add_filter('mce_buttons', array(__CLASS__, 'mce_buttons'));
     //add_filter('mce_external_plugins', array(__CLASS__, 'mce_add_rich_plugins'));
     add_shortcode('meta_data_filter_results', array(__CLASS__, 'do_meta_data_filter_shortcode'));
     add_shortcode('mdf_search_form', array(__CLASS__, 'do_mdf_search_form'));
     add_shortcode('mdf_search_button', array(__CLASS__, 'do_mdf_search_button'));
     add_shortcode('mdf_force_searching', array(__CLASS__, 'force_searching'));
     add_shortcode('mdf_value', array(__CLASS__, 'mdf_value'));
     add_shortcode('mdf_post_features_panel', array(__CLASS__, 'post_features_panel'));
     add_shortcode('mdf_results_tax_navigation', array(__CLASS__, 'results_tax_navigation'));
     add_shortcode('mdf_results_by_ajax', array(__CLASS__, 'results_by_ajax'));
     //woocommerce overloaded
     add_shortcode('mdf_products', array(__CLASS__, 'mdf_products'));
     add_shortcode('mdf_custom', array(__CLASS__, 'mdf_custom'));
     add_action('load-post.php', array(__CLASS__, "post_inits"));
     add_action('load-post-new.php', array(__CLASS__, "post_inits"));
     add_action('save_post', array(__CLASS__, 'save_post'), 1);
     add_action("manage_" . self::$slug_shortcodes . "_posts_custom_column", array(__CLASS__, "show_edit_columns_content"));
     add_filter("manage_" . self::$slug_shortcodes . "_posts_columns", array(__CLASS__, "show_edit_columns"));
     add_action('wp_ajax_mdf_draw_shortcode_html_items', array(__CLASS__, 'draw_shortcode_html_items_ajx'));
     //for woocommerce
     add_action('woocommerce_before_shop_loop', array(__CLASS__, 'woocommerce_before_shop_loop'));
     add_action('woocommerce_after_shop_loop', array(__CLASS__, 'woocommerce_after_shop_loop'));
     //***
     add_action('wp_ajax_mdf_search_button_get_content', array(__CLASS__, 'mdf_search_button_get_content'));
     add_action('wp_ajax_nopriv_mdf_search_button_get_content', array(__CLASS__, 'mdf_search_button_get_content'));
 }
Beispiel #4
0
 public static function init()
 {
     parent::init();
     $args = array('labels' => array('name' => __('MDTF Constant links', 'meta-data-filter'), 'singular_name' => __('Constant link', 'meta-data-filter'), 'add_new' => __('Add New Constant link', 'meta-data-filter'), 'add_new_item' => __('Add New Constant link', 'meta-data-filter'), 'edit_item' => __('Edit Constant link', 'meta-data-filter'), 'new_item' => __('New Constant link', 'meta-data-filter'), 'view_item' => __('View Constant link', 'meta-data-filter'), 'search_items' => __('Search Constant links', 'meta-data-filter'), 'not_found' => __('No Constant links found', 'meta-data-filter'), 'not_found_in_trash' => __('No Constant links found in Trash', 'meta-data-filter'), 'parent_item_colon' => ''), 'public' => false, 'archive' => false, 'exclude_from_search' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => true, 'menu_position' => null, 'supports' => array('title'), 'show_in_menu' => 'edit.php?post_type=' . self::$slug, 'rewrite' => array('slug' => self::$slug_const_links), 'show_in_admin_bar' => false, 'menu_icon' => '', 'taxonomies' => array());
     register_post_type(self::$slug_const_links, $args);
     add_action('admin_init', array(__CLASS__, 'admin_init'), 1);
     add_action('save_post', array(__CLASS__, 'save_post'), 1);
 }
Beispiel #5
0
 public static function init()
 {
     parent::init();
     add_action('wp_ajax_meta_data_filter_get_data_group_topage_items', array(__CLASS__, 'get_data_group_topage_items'));
     add_action('wp_ajax_mdf_encode_search_get_params', array(__CLASS__, 'encode_search_get_params'));
     add_action('wp_ajax_nopriv_mdf_encode_search_get_params', array(__CLASS__, 'encode_search_get_params'));
     //+++
     add_action('wp_ajax_mdf_get_ajax_auto_recount_data', array(__CLASS__, 'get_ajax_auto_recount_data'));
     add_action('wp_ajax_nopriv_mdf_get_ajax_auto_recount_data', array(__CLASS__, 'get_ajax_auto_recount_data'));
 }
Beispiel #6
0
 public static function init()
 {
     parent::init();
     $args = array('labels' => array('name' => __('MDTF Sort panels', 'meta-data-filter'), 'singular_name' => __('Sort panels', 'meta-data-filter'), 'add_new' => __('Add New Sort panel', 'meta-data-filter'), 'add_new_item' => __('Add New Sort panel', 'meta-data-filter'), 'edit_item' => __('Edit Sort panel', 'meta-data-filter'), 'new_item' => __('New Sort panel', 'meta-data-filter'), 'view_item' => __('View Sort panel', 'meta-data-filter'), 'search_items' => __('Search Sort panels', 'meta-data-filter'), 'not_found' => __('No Sort panels found', 'meta-data-filter'), 'not_found_in_trash' => __('No Sort panels found in Trash', 'meta-data-filter'), 'parent_item_colon' => ''), 'public' => false, 'archive' => false, 'exclude_from_search' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => true, 'menu_position' => null, 'supports' => array('title'), 'show_in_menu' => 'edit.php?post_type=' . self::$slug, 'rewrite' => array('slug' => self::$slug_woo_sort), 'show_in_admin_bar' => false, 'menu_icon' => '', 'taxonomies' => array());
     register_post_type(self::$slug_woo_sort, $args);
     add_action('admin_init', array(__CLASS__, 'admin_init'), 1);
     add_action('save_post', array(__CLASS__, 'save_post'), 1);
     add_action('woocommerce_before_shop_loop', array(__CLASS__, 'mdtf_catalog_ordering'));
     //add_action('woocommerce_before_main_content', array(__CLASS__, 'woocommerce_before_main_content'), 1);
     add_shortcode('mdf_sort_panel', array(__CLASS__, 'mdtf_catalog_ordering'));
 }
Beispiel #7
0
 function form($instance)
 {
     //Defaults
     $defaults = array('title' => __('Single Post Meta Data', 'meta-data-filter'), 'show_absent_items' => 'false', 'meta_data_filter_slug' => 'post');
     $instance = wp_parse_args((array) $instance, $defaults);
     $args = array();
     $args['instance'] = $instance;
     $args['widget'] = $this;
     wp_enqueue_script('meta_data_filter_widget', MetaDataFilterCore::get_application_uri() . 'js/widget_back.js', array('jquery'));
     echo MetaDataFilterHtml::render_html(MetaDataFilterCore::get_application_path() . 'views/widgets/post_data_form.php', $args);
 }
Beispiel #8
0
?>
";
    var tab_slideout_icon_w = "<?php 
echo MetaDataFilterCore::get_setting('tab_slideout_icon_w') ? MetaDataFilterCore::get_setting('tab_slideout_icon_w') : 146;
?>
";
    var tab_slideout_icon_h = "<?php 
echo MetaDataFilterCore::get_setting('tab_slideout_icon_h') ? MetaDataFilterCore::get_setting('tab_slideout_icon_h') : 131;
?>
";
    var mdf_use_custom_icheck = <?php 
echo MetaDataFilterCore::get_setting('use_custom_icheck') ? 1 : 0;
?>
;
<?php 
$icheck_skin = MetaDataFilterCore::get_setting('icheck_skin');
$icheck_skin = explode('_', $icheck_skin);
?>
    var icheck_skin = {};
    icheck_skin.skin = "<?php 
echo $icheck_skin[0];
?>
";
    icheck_skin.color = "<?php 
echo $icheck_skin[1];
?>
";
<?php 
//endif;
?>
Beispiel #9
0
 function get_options()
 {
     $options = MetaDataFilterCore::get_setting('ajax_pagination');
     if (empty($options)) {
         $options = array();
     }
     //***
     if (!isset($options['css'])) {
         $options['css'] = 0;
     }
     if (!isset($options['empty'])) {
         $options['empty'] = 0;
     }
     //***
     if (empty($options)) {
         $options = array('title' => __('Pages:', 'meta-data-filter'), 'nextpage' => '&raquo;', 'previouspage' => '&laquo;', 'css' => 1, 'before' => '<div class="navigation">', 'after' => '</div>', 'empty' => 0, 'range' => 3, 'anchor' => 1, 'gap' => 3);
         //update_option($this->optionsName, $options);
     }
     $this->options = $options;
 }
Beispiel #10
0
        <div class="mdf_one_moment_txt" style="display: none;">
            <span><?php 
MetaDataFilterHtml::draw_tax_loader();
?>
</span>
        </div>

    </form>

    <?php 
//+++
if (isset($shortcode_options['options']['search_result_page']) and !empty($shortcode_options['options']['search_result_page'])) {
    $search_url = $shortcode_options['options']['search_result_page'];
} else {
    $search_url = MetaDataFilterCore::get_search_url_page();
}
//WPML compatibility
if (class_exists('SitePress')) {
    $search_url = str_replace(site_url(), site_url() . '/' . ICL_LANGUAGE_CODE, $search_url);
}
//+++
if (substr_count($search_url, 'page_id')) {
    $search_url = $search_url . '&';
} else {
    $search_url = $search_url . '?';
}
?>
    <script type="text/javascript">
        jQuery(function () {
            mdf_init_search_form("<?php 
<?php

if (!defined('ABSPATH')) {
    die('No direct access allowed');
}
/*
 Template Name: Template MetaData Filter
*/
if (class_exists('MetaDataFilterPage')) {
    wp_enqueue_style('meta_data_filter_front', MetaDataFilterCore::get_application_uri() . 'css/front.css');
    wp_enqueue_script('meta_data_filter_widget', MetaDataFilterCore::get_application_uri() . 'js/front.js', array('jquery'));
}
get_header();
?>

<!-- - - - - - - - - - - - Entry - - - - - - - - - - - - - - -->
<div id="mdf_output">
    <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
            <?php 
        the_content();
        wp_reset_query();
    }
}
?>
</div>
<!-- - - - - - - - - - - - end Entry - - - - - - - - - - - - - - -->
Beispiel #12
0
 public function __construct($query)
 {
     global $wpdb;
     $query = (array) $query;
     /*
      //creating key
      $tmp_query = $query;
      $tmp_meta = array();
      //+++
      if (isset($tmp_query['meta_query']) AND ! empty($tmp_query['meta_query']))
      {
     
      unset($tmp_query['meta_query']['relation']);
      foreach ($tmp_query['meta_query'] as $value)
      {
      $tmp_meta[$value['key']] = $value['value'];
      }
      krsort($tmp_meta);
      }
     
      //***
      $tmp_tax = array();
      if (isset($tmp_query['tax_query']) AND ! empty($tmp_query['tax_query']))
      {
      $tmp_tax = array();
      unset($tmp_query['tax_query']['relation']);
      foreach ($tmp_query['tax_query'] as $value)
      {
      $tmp_tax[$value['taxonomy']] = $value['terms'];
      }
      krsort($tmp_tax);
      }
      //***
      $key = json_encode(array_merge($tmp_meta, $tmp_tax));
     *
     */
     $key = md5(json_encode($query));
     $this->key_string = 'mdf_count_cache_' . $key;
     $this->table = MetaDataFilterCore::$mdf_query_cache_table;
     //***
     if (MetaDataFilterCore::get_setting('cache_count_data')) {
         $value = $this->get_value();
         if ($value != -1) {
             $this->post_count = $this->found_posts = $value;
         } else {
             $q = new WP_QueryMDFCounterIn($query);
             $this->post_count = $this->found_posts = $q->post_count;
             unset($q);
             $this->set_value();
         }
     } else {
         $q = new WP_QueryMDFCounterIn($query);
         $this->post_count = $this->found_posts = $q->post_count;
         unset($q);
     }
 }
Beispiel #13
0
    <form action="<?php 
echo admin_url('edit.php?post_type=' . MetaDataFilterCore::$slug . '&page=mdf_settings');
?>
" method="post">
        <table class="form-table">
            <tbody>

                <tr valign="top">
                    <th scope="row"><label><?php 
_e("Supported post types", 'meta-data-filter');
?>
</label></th>
                    <td>
                        <select name="mass_filter_slug">
                            <?php 
foreach (MetaDataFilterCore::get_post_types() as $post_type => $post_type_name) {
    ?>
                                <option value="<?php 
    echo $post_type_name;
    ?>
"><?php 
    echo $post_type_name;
    ?>
</option>
                            <?php 
}
?>
                        </select>
                        <p class="description"><?php 
_e("Check post types to which filter ID should be assign. Enter right data, do not joke with it!", 'meta-data-filter');
?>
Beispiel #14
0
 public function log($string)
 {
     $handle = fopen(MetaDataFilterCore::get_application_path() . 'log.txt', 'a+');
     $string .= PHP_EOL;
     fwrite($handle, $string);
     fclose($handle);
 }
Beispiel #15
0
 }
 //+++
 //Trick - how to hide post from search
 $meta_query_array[] = array('key' => 'mdf_hide_post', 'value' => 'out', 'compare' => 'NOT EXISTS');
 //***
 if (!empty($tax_query_array)) {
     $tax_query_array = array_merge(array('relation' => $mdf_tax_bool), $tax_query_array);
 }
 //***
 $paged = get_query_var('paged') ? get_query_var('paged') : 1;
 if (isset($_GET['mdf_page_num'])) {
     $paged = $_GET['mdf_page_num'];
 }
 $args = array('post_type' => $_GET['slg'], 'ignore_sticky_posts' => MetaDataFilterCore::get_setting('ignore_sticky_posts'), 'meta_query' => $meta_query_array, 'tax_query' => $tax_query_array, 'post_status' => array('publish'), 'paged' => $paged);
 if (MetaDataFilterCore::get_setting('results_per_page')) {
     $args['posts_per_page'] = MetaDataFilterCore::get_setting('results_per_page');
 }
 //WPML compatibility
 if (class_exists('SitePress')) {
     $args['lang'] = ICL_LANGUAGE_CODE;
 }
 //print_r($args);
 //***
 $order_by_array = MetaDataFilterCore::$allowed_order_by;
 if (isset($_REQUEST['order_by'])) {
     if (in_array($_REQUEST['order_by'], $order_by_array)) {
         $args['orderby'] = $_REQUEST['order_by'];
     } else {
         $args['meta_key'] = $_REQUEST['order_by'];
         $args['orderby'] = 'meta_value_num meta_value';
     }