Advanced AJAX Product Filters - Version 1.3.5

Version Description

  • Fix - hot fix for the issue with custom styles
Download this release

Release Info

Developer dholovnia
Plugin Icon wp plugin Advanced AJAX Product Filters
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4.2 to 1.3.5

berocket/assets/css/admin.css CHANGED
@@ -1501,9 +1501,3 @@
1501
  .account_key_send.br_framework_settings .button.tiny-button {
1502
  margin: 0;
1503
  }
1504
- .wp-list-table .berocket_disabled_post {
1505
- opacity:0.5;
1506
- }
1507
- .wp-list-table .berocket_disabled_post:hover {
1508
- opacity: 0.8;
1509
- }
1501
  .account_key_send.br_framework_settings .button.tiny-button {
1502
  margin: 0;
1503
  }
 
 
 
 
 
 
berocket/assets/js/admin.js CHANGED
@@ -439,9 +439,9 @@ function berocket_display_block_messages(element, next_elements) {
439
  jQuery('body').append(jQuery(html));
440
  jQuery("html, body").stop().animate({scrollTop:top - 50}, 500, 'swing');
441
  //Button to next and close
442
- html = '<a href="#close" class="berocket_display_block_messages_close_button">'+berocket_framework_admin_text.wizard_close+'</a>';
443
  if( next_elements.length ) {
444
- html += '<a href="#next" class="berocket_display_block_messages_next_button">'+berocket_framework_admin_text.wizard_next+'</a>';
445
  }
446
  if( typeof(element.text) == 'undefined' ) {
447
  jQuery('.berocket_display_block_messages_hide.inside').last().append(jQuery(html));
439
  jQuery('body').append(jQuery(html));
440
  jQuery("html, body").stop().animate({scrollTop:top - 50}, 500, 'swing');
441
  //Button to next and close
442
+ html = '<a href="#close" class="berocket_display_block_messages_close_button">Close</a>';
443
  if( next_elements.length ) {
444
+ html += '<a href="#next" class="berocket_display_block_messages_next_button">Next</a>';
445
  }
446
  if( typeof(element.text) == 'undefined' ) {
447
  jQuery('.berocket_display_block_messages_hide.inside').last().append(jQuery(html));
berocket/framework.php CHANGED
@@ -34,7 +34,7 @@ if( ! class_exists( 'BeRocket_Framework' ) ) {
34
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
35
  load_plugin_textdomain('BeRocket_domain', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
36
  class BeRocket_Framework {
37
- public static $framework_version = '2.5.4';
38
  public static $settings_name = '';
39
  public $addons;
40
  public $libraries;
@@ -433,14 +433,6 @@ if( ! class_exists( 'BeRocket_Framework' ) ) {
433
  array( 'jquery' ),
434
  $this->cc->info[ 'version' ]
435
  );
436
- wp_localize_script(
437
- 'berocket_framework_admin',
438
- 'berocket_framework_admin_text',
439
- array(
440
- 'wizard_next' => __('Next', 'BeRocket_domain'),
441
- 'wizard_close' => __('Close', 'BeRocket_domain'),
442
- )
443
- );
444
 
445
  wp_register_style(
446
  'berocket_framework_admin_style',
34
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
35
  load_plugin_textdomain('BeRocket_domain', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
36
  class BeRocket_Framework {
37
+ public static $framework_version = '2.5.3';
38
  public static $settings_name = '';
39
  public $addons;
40
  public $libraries;
433
  array( 'jquery' ),
434
  $this->cc->info[ 'version' ]
435
  );
 
 
 
 
 
 
 
 
436
 
437
  wp_register_style(
438
  'berocket_framework_admin_style',
berocket/framework_version.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $framework_version_current = '2.5.4';
3
  if( version_compare($framework_version_current, $framework_version, '>') ) {
4
  $framework_version = $framework_version_current;
5
  $framework_dir = __DIR__;
1
  <?php
2
+ $framework_version_current = '2.5.3';
3
  if( version_compare($framework_version_current, $framework_version, '>') ) {
4
  $framework_version = $framework_version_current;
5
  $framework_dir = __DIR__;
berocket/includes/custom_post.php CHANGED
@@ -34,7 +34,6 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
34
  public $default_settings = array();
35
  public $post_settings, $post_name;
36
  public $post_type_parameters = array();
37
- public $addons = array();
38
  protected static $instance;
39
 
40
  public static function getInstance() {
@@ -51,19 +50,21 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
51
  static::$instance = $this;
52
  }
53
  $this->post_type_parameters = array_merge(array(
54
- 'sortable' => false,
55
- 'can_be_disabled' => false,
56
  ), $this->post_type_parameters);
57
  add_filter( 'init', array( $this, 'init' ) );
58
  add_filter( 'admin_init', array( $this, 'admin_init' ), 15 );
59
  add_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 30, 2 );
60
  if( $this->post_type_parameters['sortable'] ) {
61
- include_once('custom_post/sortable.php');
62
- $addons['sortable'] = new BeRocket_custom_post_sortable_addon_class($this);
63
- }
64
- if( $this->post_type_parameters['can_be_disabled'] ) {
65
- include_once('custom_post/enable_disable.php');
66
- $addons['can_be_disabled'] = new BeRocket_custom_post_enable_disable_addon_class($this);
 
 
 
67
  }
68
  if( ! empty($this->post_settings['capability_type']) && $this->post_settings['capability_type'] != 'product' ) {
69
  add_filter('BeRocket_admin_init_user_capabilities', array($this, 'init_user_capabilities'));
@@ -98,11 +99,6 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
98
  return $posts_array;
99
  }
100
 
101
- public function get_custom_posts_frontend($args = array(), $additional = array()) {
102
- $args = apply_filters('berocket_custom_post_'.$this->post_name.'_get_custom_posts_args_frontend', $args, $additional);
103
- return $this->get_custom_posts($args);
104
- }
105
-
106
  public function add_meta_box($slug, $name, $callback = false, $position = 'normal', $priority = 'high') {
107
  if( $callback === false ) {
108
  $callback = array($this, $slug);
@@ -142,25 +138,6 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
142
  if( isset($actions['inline hide-if-no-js']) ) {
143
  unset($actions['inline hide-if-no-js']);
144
  }
145
- if ( current_user_can( 'delete_post', $post->ID ) ) {
146
- if( $this->post_type_parameters['can_be_disabled'] ) {
147
- if( has_term('isdisabled', 'berocket_taxonomy_data', $post) ) {
148
- $actions['enable'] = sprintf(
149
- '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
150
- wp_nonce_url( "post.php?action=enable&amp;post=$post->ID", 'enable-post_' . $post->ID ),
151
- esc_attr( __( 'Enable', 'BeRocket_domain') ),
152
- _x( 'Enable', 'BeRocket_domain')
153
- );
154
- } else {
155
- $actions['disable'] = sprintf(
156
- '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
157
- wp_nonce_url( "post.php?action=disable&amp;post=$post->ID", 'disable-post_' . $post->ID ),
158
- esc_attr( __( 'Disable', 'BeRocket_domain') ),
159
- _x( 'Disable', 'BeRocket_domain')
160
- );
161
- }
162
- }
163
- }
164
  }
165
  return $actions;
166
  }
@@ -380,6 +357,140 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
380
  }
381
  return $data;
382
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  public function init_user_capabilities($user_caps) {
384
  $cap_settings = $this->post_settings;
385
  $cap_settings['capabilities'] = array();
34
  public $default_settings = array();
35
  public $post_settings, $post_name;
36
  public $post_type_parameters = array();
 
37
  protected static $instance;
38
 
39
  public static function getInstance() {
50
  static::$instance = $this;
51
  }
52
  $this->post_type_parameters = array_merge(array(
53
+ 'sortable' => false
 
54
  ), $this->post_type_parameters);
55
  add_filter( 'init', array( $this, 'init' ) );
56
  add_filter( 'admin_init', array( $this, 'admin_init' ), 15 );
57
  add_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 30, 2 );
58
  if( $this->post_type_parameters['sortable'] ) {
59
+ if( is_admin() ) {
60
+ add_action('berocket_custom_post_'.$this->post_name.'_admin_init', array($this, 'sortable_admin_init'));
61
+ add_action('berocket_custom_post_'.$this->post_name.'_wc_save_product_before', array($this, 'sortable_wc_save_product_before'), 10, 2);
62
+ add_action('berocket_custom_post_'.$this->post_name.'_wc_save_product_without_check_before', array($this, 'sortable_wc_save_product_before'), 10, 2);
63
+ add_action('berocket_custom_post_'.$this->post_name.'_columns_replace', array($this, 'sortable_columns_replace'), 10, 1);
64
+ add_filter('berocket_custom_post_'.$this->post_name.'_manage_edit_columns', array($this, 'sortable_manage_edit_columns'));
65
+ }
66
+ add_filter('berocket_custom_post_'.$this->post_name.'_get_custom_posts_args_default', array($this, 'sortable_get_custom_post'));
67
+ add_action('berocket_custom_post_'.$this->post_name.'_admin_init_only', array($this, 'jquery_sortable_for_posts'));
68
  }
69
  if( ! empty($this->post_settings['capability_type']) && $this->post_settings['capability_type'] != 'product' ) {
70
  add_filter('BeRocket_admin_init_user_capabilities', array($this, 'init_user_capabilities'));
99
  return $posts_array;
100
  }
101
 
 
 
 
 
 
102
  public function add_meta_box($slug, $name, $callback = false, $position = 'normal', $priority = 'high') {
103
  if( $callback === false ) {
104
  $callback = array($this, $slug);
138
  if( isset($actions['inline hide-if-no-js']) ) {
139
  unset($actions['inline hide-if-no-js']);
140
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
  return $actions;
143
  }
357
  }
358
  return $data;
359
  }
360
+ //SORTABLE CUSTOM POST
361
+ public function sortable_admin_init() {
362
+ $this->get_custom_posts();
363
+ add_action( 'pre_get_posts', array($this, 'sortable_get_posts') );
364
+ if( ! empty($_POST['braction']) && $_POST['braction'] == 'berocket_custom_post_sortable' ) {
365
+ $this->sortable_change();
366
+ }
367
+ }
368
+ public function sortable_change() {
369
+ if( ! empty($_POST['BRsortable_id']) && isset($_POST['BRorder']) ) {
370
+ $BRsortable_id = sanitize_key($_POST['BRsortable_id']);
371
+ $BRorder = sanitize_key($_POST['BRorder']);
372
+ $BRsortable_id = intval($BRsortable_id);
373
+ $BRorder = intval($BRorder);
374
+ if( current_user_can('edit_post', $BRsortable_id) ) {
375
+ update_post_meta($BRsortable_id, 'berocket_post_order', $BRorder);
376
+ }
377
+ }
378
+ if( ! empty($_POST['BRsortable']) ) {
379
+ $BRsortable = $_POST['BRsortable'];
380
+ if( ! is_array($BRsortable) ) {
381
+ $BRsortable = array();
382
+ }
383
+ foreach($BRsortable as $BRsortable_post) {
384
+ $BRsortable_id = sanitize_key($BRsortable_post['id']);
385
+ $BRorder = sanitize_key($BRsortable_post['order']);
386
+ $BRsortable_id = intval($BRsortable_id);
387
+ $BRorder = intval($BRorder);
388
+ if( current_user_can('edit_post', $BRsortable_id) ) {
389
+ update_post_meta($BRsortable_id, 'berocket_post_order', $BRorder);
390
+ }
391
+ }
392
+ }
393
+ }
394
+ public function sortable_get_posts( $query ){
395
+ global $pagenow;
396
+ if( 'edit.php' == $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] == $this->post_name ){
397
+ $query->set( 'meta_key', 'berocket_post_order' );
398
+ $query->set( 'orderby', 'meta_value_num' );
399
+ $query->set( 'order', 'ASC' );
400
+ }
401
+ }
402
+ public function sortable_get_custom_post($args) {
403
+ if( is_admin() ) {
404
+ $posts_not_ordered = new WP_Query($args);
405
+ $posts_not_ordered = $posts_not_ordered->posts;
406
+ }
407
+ $args = array_merge($args, array(
408
+ 'meta_key' => 'berocket_post_order',
409
+ 'orderby' => 'meta_value_num',
410
+ 'order' => 'ASC',
411
+ ));
412
+ if( is_admin() ) {
413
+ $posts_ordered = new WP_Query($args);
414
+ $posts_ordered = $posts_ordered->posts;
415
+ $posts_fix = array_diff($posts_not_ordered, $posts_ordered);
416
+ foreach($posts_fix as $post_fix_id) {
417
+ add_post_meta( $post_fix_id, 'berocket_post_order', '0', true );
418
+ }
419
+ }
420
+ return $args;
421
+ }
422
+ public function sortable_wc_save_product_before( $post_id, $post ) {
423
+ $order_position = get_post_meta( $post_id, 'berocket_post_order', true );
424
+ $order_position = intval($order_position);
425
+ update_post_meta( $post_id, 'berocket_post_order', $order_position );
426
+ }
427
+ public function sortable_columns_replace($column) {
428
+ global $post;
429
+ $post_id = $post->ID;
430
+ $order_position = get_post_meta( $post_id, 'berocket_post_order', true );
431
+ $order_position = intval($order_position);
432
+ switch ( $column ) {
433
+ case "berocket_sortable":
434
+ echo $this->sortable_html_position($post_id, $order_position);
435
+ break;
436
+ default:
437
+ break;
438
+ }
439
+ }
440
+ public function sortable_html_position($post_id, $order) {
441
+ $html = '';
442
+ if( $order > 0 ) {
443
+ $html .= '<a href="#order-up" class="berocket_post_set_new_sortable" data-post_id="'.$post_id.'" data-order="'.($order - 1).'"><i class="fa fa-arrow-up"></i></a>';
444
+ }
445
+ $html .= '<span class="berocket_post_set_new_sortable_input"><input type="number" min="0" value="'.$order.'"><a class="berocket_post_set_new_sortable_set fa fa-arrow-circle-right" data-post_id="'.$post_id.'" href="#order-set"></a></span>';
446
+ $html .= '<a href="#order-up" class="berocket_post_set_new_sortable" data-post_id="'.$post_id.'" data-order="'.($order + 1).'"><i class="fa fa-arrow-down"></i></a>';
447
+ return $html;
448
+ }
449
+ public function sortable_manage_edit_columns($columns) {
450
+ $columns["berocket_sortable"] = __( "Order", 'BeRocket_domain' );
451
+ return $columns;
452
+ }
453
+ public function jquery_sortable_for_posts() {
454
+ wp_enqueue_script('jquery-ui-sortable');
455
+ add_action('in_admin_footer', array($this, 'sortable_in_admin_footer'));
456
+ }
457
+ public function sortable_in_admin_footer() {
458
+ global $wp_query;
459
+ if( $wp_query->is_main_query() && $wp_query->max_num_pages == 1 ) {
460
+ ?>
461
+ <script>
462
+ jQuery(document).ready(function() {
463
+ var BRsortable_jquery_ui = function() {
464
+ if( ! jQuery("#the-list").is(".ui-sortable") ) {
465
+ jQuery("#the-list .column-name").prepend(jQuery("<i class='fa fa-bars'></i>"));
466
+ jQuery("#the-list").sortable({
467
+ handle:".fa-bars",
468
+ axis: "y",
469
+ stop: function() {
470
+ jQuery("#the-list .berocket_post_set_new_sortable_input input").each(function(i, o) {
471
+ jQuery(o).val(i);
472
+ });
473
+ var BRsortable = [];
474
+ jQuery("#the-list .berocket_post_set_new_sortable_input").each(function() {
475
+ BRsortable.push({id:jQuery(this).find(".berocket_post_set_new_sortable_set").data('post_id'), order:jQuery(this).find("input").val()});
476
+ });
477
+ jQuery.post(location.href, {braction:'berocket_custom_post_sortable', BRsortable:BRsortable}, function(html) {
478
+ var $html = jQuery(html);
479
+ var $tbody = $html.find('.berocket_post_set_new_sortable').first().parents('tbody').first();
480
+ jQuery('.berocket_post_set_new_sortable').first().parents('tbody').first().replaceWith($tbody);
481
+ jQuery(document).trigger('BRsortable_loaded_html');
482
+ });
483
+ }
484
+ });
485
+ }
486
+ }
487
+ BRsortable_jquery_ui();
488
+ jQuery(document).on("BRsortable_loaded_html", BRsortable_jquery_ui);
489
+ });
490
+ </script>
491
+ <?php
492
+ }
493
+ }
494
  public function init_user_capabilities($user_caps) {
495
  $cap_settings = $this->post_settings;
496
  $cap_settings['capabilities'] = array();
berocket/includes/custom_post/enable_disable.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
- if ( ! class_exists('BeRocket_custom_post_enable_disable_addon_class') ) {
3
- class BeRocket_custom_post_enable_disable_addon_class {
4
- public $post_name;
5
- public $custom_post;
6
- function __construct($custom_post) {
7
- $this->post_name = $custom_post->post_name;
8
- $this->custom_post = $custom_post;
9
- add_action('init', array($this, 'register_disabled_taxonomy'), 10);
10
- add_action('init', array($this, 'add_disabled_term'), 20);
11
- add_filter( 'bulk_actions-edit-'.$this->post_name, array($this, 'disable_bulk_action_dropdown') );
12
- add_action('handle_bulk_actions-edit-'.$this->post_name, array($this, 'disable_bulk_actions'), 10, 3);
13
- add_action('post_action_enable', array($this, 'post_action_enable'));
14
- add_action('post_action_disable', array($this, 'post_action_disable'));
15
- add_filter('views_edit-'.$this->post_name, array($this, 'post_filter_isdisabled_menu'));
16
- add_filter('post_class', array($this, 'disable_post_class'), 10, 3);
17
- if( isset($_GET['brdisabled']) && berocket_isset($_GET['post_type']) == $this->post_name ) {
18
- add_filter('pre_get_posts',array($this, 'post_filter_isdisabled'));
19
- }
20
- add_filter('berocket_custom_post_'.$this->post_name.'_get_custom_posts_args_frontend', array($this, 'get_custom_posts_frontend'), 10, 2);
21
- }
22
- public function register_disabled_taxonomy() {
23
- register_taxonomy( 'berocket_taxonomy_data', $this->post_name);
24
- }
25
- public function add_disabled_term() {
26
- wp_insert_term( 'isdisabled', 'berocket_taxonomy_data', array(
27
- 'description' => '',
28
- 'parent' => 0,
29
- 'slug' => 'isdisabled',
30
- ) );
31
- }
32
- public function disable_bulk_action_dropdown($actions) {
33
- if( ! isset($_GET['brdisabled']) || $_GET['brdisabled'] == 1 ) {
34
- $actions['enable'] = __( 'Enable', 'BeRocket_domain');
35
- }
36
- if( ! isset($_GET['brdisabled']) || $_GET['brdisabled'] == 0 ) {
37
- $actions['disable'] = __( 'Disable', 'BeRocket_domain');
38
- }
39
- return $actions;
40
- }
41
- public function change_post_isdisabled($post_id, $doaction) {
42
- $ischanged = false;
43
- if( $doaction == 'enable' && has_term('isdisabled', 'berocket_taxonomy_data', $post_id) ) {
44
- wp_remove_object_terms($post_id, 'isdisabled', 'berocket_taxonomy_data');
45
- $ischanged = true;
46
- }
47
- if( $doaction == 'disable' && ! has_term('isdisabled', 'berocket_taxonomy_data', $post_id) ) {
48
- wp_set_post_terms( $post_id, 'isdisabled', 'berocket_taxonomy_data', true );
49
- $ischanged = true;
50
- }
51
- return $ischanged;
52
- }
53
- public function disable_bulk_actions($sendback, $doaction, $post_ids) {
54
- if ( $doaction !== 'enable' && $doaction !== 'disable' ) {
55
- return $sendback;
56
- }
57
- $count = 0;
58
- foreach ( (array) $post_ids as $post_id ) {
59
- if ( ! current_user_can( 'delete_post', $post_id ) ) {
60
- wp_die( __( 'Sorry, you are not allowed to change this item status.', 'BeRocket_domain' ) );
61
- }
62
- if( $this->change_post_isdisabled($post_id, $doaction) ) {
63
- $count++;
64
- }
65
- }
66
- $sendback = add_query_arg(
67
- array(
68
- ($doaction == 'disable' ? 'disabled' : 'enabled') => $count,
69
- 'ids' => join( ',', $post_ids ),
70
- ),
71
- $sendback
72
- );
73
- return $sendback;
74
- }
75
- public function post_action_isdisabled_change($post_id, $doaction) {
76
- global $post_type, $post_type_object, $post;
77
- if( $post_type != $this->post_name ) return;
78
- check_admin_referer( $doaction.'-post_' . $post_id );
79
- $sendback = wp_get_referer();
80
- if ( ! $post ) {
81
- wp_die( __( 'The item you are trying to change status no longer exists.', 'BeRocket_domain' ) );
82
- }
83
- if ( ! $post_type_object ) {
84
- wp_die( __( 'Invalid post type.' ) );
85
- }
86
- if ( ! current_user_can( 'delete_post', $post_id ) ) {
87
- wp_die( __( 'Sorry, you are not allowed to change this item status.', 'BeRocket_domain' ) );
88
- }
89
- $this->change_post_isdisabled($post_id, $doaction);
90
-
91
- wp_redirect(
92
- add_query_arg(
93
- array(
94
- ($doaction == 'disable' ? 'disabled' : 'enabled') => 1,
95
- 'ids' => $post_id,
96
- ),
97
- $sendback
98
- )
99
- );
100
- exit();
101
- }
102
- public function disable_post_class($classes, $class, $post_id) {
103
- global $post_type;
104
- if( $post_type == $this->post_name ) {
105
- if( has_term('isdisabled', 'berocket_taxonomy_data', $post_id) ) {
106
- $classes[] = 'berocket_disabled_post';
107
- } else {
108
- $classes[] = 'berocket_enabled_post';
109
- }
110
- }
111
- return $classes;
112
- }
113
- public function post_action_enable($post_id) {
114
- $this->post_action_isdisabled_change($post_id, 'enable');
115
- }
116
- public function post_action_disable($post_id) {
117
- $this->post_action_isdisabled_change($post_id, 'disable');
118
- }
119
- public function post_filter_isdisabled_menu($views) {
120
- global $post_type;
121
- if( $post_type == $this->post_name ) {
122
- $url = add_query_arg( array('post_type' => $post_type, 'brdisabled' => 0), 'edit.php' );
123
- $class = (( isset($_GET['brdisabled']) && $_GET['brdisabled'] == 0 ) ? ' class="current"' : '');
124
- $views['enabled'] = sprintf(
125
- '<a href="%s"%s>%s</a>',
126
- esc_url( $url ),
127
- $class,
128
- __('Enabled', 'BeRocket_domain')
129
- );
130
- $url = add_query_arg( array('post_type' => $post_type, 'brdisabled' => 1), 'edit.php' );
131
- $class = (( isset($_GET['brdisabled']) && $_GET['brdisabled'] == 1 ) ? ' class="current"' : '');
132
- $views['disabled'] = sprintf(
133
- '<a href="%s"%s>%s</a>',
134
- esc_url( $url ),
135
- $class,
136
- __('Disabled', 'BeRocket_domain')
137
- );
138
- }
139
- return $views;
140
- }
141
- public function post_filter_isdisabled($query) {
142
- if( ! $query->is_main_query() ) return $query;
143
- $tax_query = $query->get('tax_query');
144
- if( ! is_array($tax_query) ) {
145
- $tax_query = array();
146
- }
147
- $tax_query[] = array(
148
- 'taxonomy' => 'berocket_taxonomy_data',
149
- 'field' => 'slug',
150
- 'terms' => 'isdisabled',
151
- 'operator' => (empty($_GET['brdisabled']) ? "NOT IN" : "IN")
152
- );
153
- $query->set('tax_query', $tax_query);
154
- return $query;
155
- }
156
- public function get_custom_posts_frontend($args = array(), $additional = array()) {
157
- $additional = array_merge(array(
158
- 'hide_disabled' => true
159
- ), $additional);
160
- if( ! empty($additional['hide_disabled']) ) {
161
- if( empty($args['tax_query']) ) {
162
- $args['tax_query'] = array();
163
- }
164
- $args['tax_query'][] = array(
165
- 'taxonomy' => 'berocket_taxonomy_data',
166
- 'field' => 'slug',
167
- 'terms' => 'isdisabled',
168
- 'operator' => "NOT IN"
169
- );
170
- }
171
- return $args;
172
- }
173
- }
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
berocket/includes/custom_post/sortable.php DELETED
@@ -1,153 +0,0 @@
1
- <?php
2
- if ( ! class_exists('BeRocket_custom_post_sortable_addon_class') ) {
3
- class BeRocket_custom_post_sortable_addon_class {
4
- public $post_name;
5
- public $custom_post;
6
- function __construct($custom_post) {
7
- $this->post_name = $custom_post->post_name;
8
- $this->custom_post = $custom_post;
9
- if( is_admin() ) {
10
- add_action('berocket_custom_post_'.$this->post_name.'_admin_init', array($this, 'sortable_admin_init'));
11
- add_action('berocket_custom_post_'.$this->post_name.'_wc_save_product_before', array($this, 'sortable_wc_save_product_before'), 10, 2);
12
- add_action('berocket_custom_post_'.$this->post_name.'_wc_save_product_without_check_before', array($this, 'sortable_wc_save_product_before'), 10, 2);
13
- add_action('berocket_custom_post_'.$this->post_name.'_columns_replace', array($this, 'sortable_columns_replace'), 10, 1);
14
- add_filter('berocket_custom_post_'.$this->post_name.'_manage_edit_columns', array($this, 'sortable_manage_edit_columns'));
15
- }
16
- add_filter('berocket_custom_post_'.$this->post_name.'_get_custom_posts_args_default', array($this, 'sortable_get_custom_post'));
17
- add_action('berocket_custom_post_'.$this->post_name.'_admin_init_only', array($this, 'jquery_sortable_for_posts'));
18
- }
19
- public function sortable_admin_init() {
20
- $this->custom_post->get_custom_posts();
21
- add_action( 'pre_get_posts', array($this, 'sortable_get_posts') );
22
- if( ! empty($_POST['braction']) && $_POST['braction'] == 'berocket_custom_post_sortable' ) {
23
- $this->sortable_change();
24
- }
25
- }
26
- public function sortable_change() {
27
- if( ! empty($_POST['BRsortable_id']) && isset($_POST['BRorder']) ) {
28
- $BRsortable_id = sanitize_key($_POST['BRsortable_id']);
29
- $BRorder = sanitize_key($_POST['BRorder']);
30
- $BRsortable_id = intval($BRsortable_id);
31
- $BRorder = intval($BRorder);
32
- if( current_user_can('edit_post', $BRsortable_id) ) {
33
- update_post_meta($BRsortable_id, 'berocket_post_order', $BRorder);
34
- }
35
- }
36
- if( ! empty($_POST['BRsortable']) ) {
37
- $BRsortable = $_POST['BRsortable'];
38
- if( ! is_array($BRsortable) ) {
39
- $BRsortable = array();
40
- }
41
- foreach($BRsortable as $BRsortable_post) {
42
- $BRsortable_id = sanitize_key($BRsortable_post['id']);
43
- $BRorder = sanitize_key($BRsortable_post['order']);
44
- $BRsortable_id = intval($BRsortable_id);
45
- $BRorder = intval($BRorder);
46
- if( current_user_can('edit_post', $BRsortable_id) ) {
47
- update_post_meta($BRsortable_id, 'berocket_post_order', $BRorder);
48
- }
49
- }
50
- }
51
- }
52
- public function sortable_get_posts( $query ){
53
- global $pagenow;
54
- if( 'edit.php' == $pagenow && isset( $_GET['post_type'] ) && $_GET['post_type'] == $this->post_name ){
55
- $query->set( 'meta_key', 'berocket_post_order' );
56
- $query->set( 'orderby', 'meta_value_num' );
57
- $query->set( 'order', 'ASC' );
58
- }
59
- }
60
- public function sortable_get_custom_post($args) {
61
- if( is_admin() ) {
62
- $posts_not_ordered = new WP_Query($args);
63
- $posts_not_ordered = $posts_not_ordered->posts;
64
- }
65
- $args = array_merge($args, array(
66
- 'meta_key' => 'berocket_post_order',
67
- 'orderby' => 'meta_value_num',
68
- 'order' => 'ASC',
69
- ));
70
- if( is_admin() ) {
71
- $posts_ordered = new WP_Query($args);
72
- $posts_ordered = $posts_ordered->posts;
73
- $posts_fix = array_diff($posts_not_ordered, $posts_ordered);
74
- foreach($posts_fix as $post_fix_id) {
75
- add_post_meta( $post_fix_id, 'berocket_post_order', '0', true );
76
- }
77
- }
78
- return $args;
79
- }
80
- public function sortable_wc_save_product_before( $post_id, $post ) {
81
- $order_position = get_post_meta( $post_id, 'berocket_post_order', true );
82
- $order_position = intval($order_position);
83
- update_post_meta( $post_id, 'berocket_post_order', $order_position );
84
- }
85
- public function sortable_columns_replace($column) {
86
- global $post;
87
- $post_id = $post->ID;
88
- $order_position = get_post_meta( $post_id, 'berocket_post_order', true );
89
- $order_position = intval($order_position);
90
- switch ( $column ) {
91
- case "berocket_sortable":
92
- echo $this->sortable_html_position($post_id, $order_position);
93
- break;
94
- default:
95
- break;
96
- }
97
- }
98
- public function sortable_html_position($post_id, $order) {
99
- $html = '';
100
- if( $order > 0 ) {
101
- $html .= '<a href="#order-up" class="berocket_post_set_new_sortable" data-post_id="'.$post_id.'" data-order="'.($order - 1).'"><i class="fa fa-arrow-up"></i></a>';
102
- }
103
- $html .= '<span class="berocket_post_set_new_sortable_input"><input type="number" min="0" value="'.$order.'"><a class="berocket_post_set_new_sortable_set fa fa-arrow-circle-right" data-post_id="'.$post_id.'" href="#order-set"></a></span>';
104
- $html .= '<a href="#order-up" class="berocket_post_set_new_sortable" data-post_id="'.$post_id.'" data-order="'.($order + 1).'"><i class="fa fa-arrow-down"></i></a>';
105
- return $html;
106
- }
107
- public function sortable_manage_edit_columns($columns) {
108
- $columns["berocket_sortable"] = __( "Order", 'BeRocket_domain' );
109
- return $columns;
110
- }
111
- public function jquery_sortable_for_posts() {
112
- wp_enqueue_script('jquery-ui-sortable');
113
- add_action('in_admin_footer', array($this, 'sortable_in_admin_footer'));
114
- }
115
- public function sortable_in_admin_footer() {
116
- global $wp_query;
117
- if( $wp_query->is_main_query() && $wp_query->max_num_pages == 1 ) {
118
- ?>
119
- <script>
120
- jQuery(document).ready(function() {
121
- var BRsortable_jquery_ui = function() {
122
- if( ! jQuery("#the-list").is(".ui-sortable") ) {
123
- jQuery("#the-list .column-name").prepend(jQuery("<i class='fa fa-bars'></i>"));
124
- jQuery("#the-list").sortable({
125
- handle:".fa-bars",
126
- axis: "y",
127
- stop: function() {
128
- jQuery("#the-list .berocket_post_set_new_sortable_input input").each(function(i, o) {
129
- jQuery(o).val(i);
130
- });
131
- var BRsortable = [];
132
- jQuery("#the-list .berocket_post_set_new_sortable_input").each(function() {
133
- BRsortable.push({id:jQuery(this).find(".berocket_post_set_new_sortable_set").data('post_id'), order:jQuery(this).find("input").val()});
134
- });
135
- jQuery.post(location.href, {braction:'berocket_custom_post_sortable', BRsortable:BRsortable}, function(html) {
136
- var $html = jQuery(html);
137
- var $tbody = $html.find('.berocket_post_set_new_sortable').first().parents('tbody').first();
138
- jQuery('.berocket_post_set_new_sortable').first().parents('tbody').first().replaceWith($tbody);
139
- jQuery(document).trigger('BRsortable_loaded_html');
140
- });
141
- }
142
- });
143
- }
144
- }
145
- BRsortable_jquery_ui();
146
- jQuery(document).on("BRsortable_loaded_html", BRsortable_jquery_ui);
147
- });
148
- </script>
149
- <?php
150
- }
151
- }
152
- }
153
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
berocket/includes/functions.php CHANGED
@@ -319,14 +319,14 @@ if( ! function_exists( 'br_condition_builder' ) ) {
319
  $equal = $options['equal'];
320
  }
321
  $equal_list = array(
322
- 'equal' => __('Equal', 'BeRocket_domain'),
323
- 'not_equal' => __('Not equal', 'BeRocket_domain'),
324
  );
325
  if( ! empty($extension['equal_less']) ) {
326
- $equal_list['equal_less'] = __('Equal or less', 'BeRocket_domain');
327
  }
328
  if( ! empty($extension['equal_more']) ) {
329
- $equal_list['equal_more'] = __('Equal or more', 'BeRocket_domain');
330
  }
331
  $html = '<select name="' . $name . '[equal]">';
332
  foreach($equal_list as $equal_slug => $equal_name) {
319
  $equal = $options['equal'];
320
  }
321
  $equal_list = array(
322
+ 'equal' => __('Equal', 'BeRocket_products_label_domain'),
323
+ 'not_equal' => __('Not equal', 'BeRocket_products_label_domain'),
324
  );
325
  if( ! empty($extension['equal_less']) ) {
326
+ $equal_list['equal_less'] = __('Equal or less', 'BeRocket_products_label_domain');
327
  }
328
  if( ! empty($extension['equal_more']) ) {
329
+ $equal_list['equal_more'] = __('Equal or more', 'BeRocket_products_label_domain');
330
  }
331
  $html = '<select name="' . $name . '[equal]">';
332
  foreach($equal_list as $equal_slug => $equal_name) {
berocket/includes/updater.php CHANGED
@@ -129,7 +129,7 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
129
  if ( $item[ 0 ] == 'BeRocket' ) {
130
  $BeRocket_item = $item;
131
  continue;
132
- } elseif ( $item[ 0 ] == __('Account Keys', 'BeRocket_domain') ) {
133
  $account_keys_item = $item;
134
  continue;
135
  }
@@ -450,7 +450,7 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
450
  }
451
 
452
  public static function network_account_page() {
453
- add_menu_page( __('BeRocket Account Settings', 'BeRocket_domain'), __('BeRocket Account', 'BeRocket_domain'), 'manage_berocket', 'berocket_account', array(
454
  __CLASS__,
455
  'account_form_network'
456
  ), plugin_dir_url( __FILE__ ) . 'ico.png', '55.55' );
@@ -464,7 +464,7 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
464
  }
465
 
466
  public static function account_page() {
467
- add_submenu_page( 'berocket_account', __('BeRocket Account Settings', 'BeRocket_domain'), __('Account Keys', 'BeRocket_domain'), 'manage_berocket_account', 'berocket_account', array(
468
  __CLASS__,
469
  'account_form'
470
  ) );
@@ -522,17 +522,17 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
522
  $plugins_key = array();
523
  }
524
  ?>
525
- <h2><?php _e('BeRocket Account Settings', 'BeRocket_domain'); ?></h2>
526
  <div>
527
  <table>
528
  <tr>
529
- <td><h3><?php _e('DEBUG MODE', 'BeRocket_domain'); ?></h3></td>
530
  <td colspan=3><label><input type="checkbox" name="BeRocket_account_option[debug_mode]"
531
  value="1"<?php if ( ! empty( $options[ 'debug_mode' ] ) )
532
- echo ' checked' ?>><?php _e('Enable debug mode', 'BeRocket_domain'); ?></label></td>
533
  </tr>
534
  <tr>
535
- <td><h3><?php _e('Account key', 'BeRocket_domain'); ?></h3></td>
536
  <td><input type="text" id="berocket_account_key" name="BeRocket_account_option[account_key]"
537
  size="50"
538
  value="<?php echo( empty( $options[ 'account_key' ] ) ? '' : $options[ 'account_key' ] ) ?>">
@@ -563,12 +563,12 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
563
  </table>
564
  </div>
565
  <div class="berocket_test_result"></div>
566
- <button type="submit" class="button"><?php _e('Save Changes', 'BeRocket_domain'); ?></button>
567
 
568
  <div class="berocket_debug_errors">
569
- <h3><?php _e('Errors', 'BeRocket_domain'); ?></h3>
570
  <div>
571
- <?php _e('Select plugin', 'BeRocket_domain'); ?>
572
  <select class="berocket_select_plugin_for_error">
573
  <?php
574
  foreach ( self::$plugin_info as $plugin ) {
129
  if ( $item[ 0 ] == 'BeRocket' ) {
130
  $BeRocket_item = $item;
131
  continue;
132
+ } elseif ( $item[ 0 ] == 'Account Keys' ) {
133
  $account_keys_item = $item;
134
  continue;
135
  }
450
  }
451
 
452
  public static function network_account_page() {
453
+ add_menu_page( 'BeRocket Account Settings', 'BeRocket Account', 'manage_berocket', 'berocket_account', array(
454
  __CLASS__,
455
  'account_form_network'
456
  ), plugin_dir_url( __FILE__ ) . 'ico.png', '55.55' );
464
  }
465
 
466
  public static function account_page() {
467
+ add_submenu_page( 'berocket_account', 'BeRocket Account Settings', 'Account Keys', 'manage_berocket_account', 'berocket_account', array(
468
  __CLASS__,
469
  'account_form'
470
  ) );
522
  $plugins_key = array();
523
  }
524
  ?>
525
+ <h2>BeRocket Account Settings</h2>
526
  <div>
527
  <table>
528
  <tr>
529
+ <td><h3>DEBUG MODE</h3></td>
530
  <td colspan=3><label><input type="checkbox" name="BeRocket_account_option[debug_mode]"
531
  value="1"<?php if ( ! empty( $options[ 'debug_mode' ] ) )
532
+ echo ' checked' ?>>Enable debug mode</label></td>
533
  </tr>
534
  <tr>
535
+ <td><h3>Account key</h3></td>
536
  <td><input type="text" id="berocket_account_key" name="BeRocket_account_option[account_key]"
537
  size="50"
538
  value="<?php echo( empty( $options[ 'account_key' ] ) ? '' : $options[ 'account_key' ] ) ?>">
563
  </table>
564
  </div>
565
  <div class="berocket_test_result"></div>
566
+ <button type="submit" class="button">Save Changes</button>
567
 
568
  <div class="berocket_debug_errors">
569
+ <h3>Errors</h3>
570
  <div>
571
+ Select plugin
572
  <select class="berocket_select_plugin_for_error">
573
  <?php
574
  foreach ( self::$plugin_info as $plugin ) {
main.php CHANGED
@@ -2115,7 +2115,12 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
2115
  '#widget#' => '.berocket_aapf_widget',
2116
  '#widget-title#' => '.berocket_aapf_widget-title'
2117
  );
2118
- $result_css = ( empty($options['user_custom_css']) ? '' : $options['user_custom_css'] );
 
 
 
 
 
2119
  foreach ( $replace_css as $key => $value ) {
2120
  $result_css = str_replace( $key, $value, $result_css );
2121
  }
2115
  '#widget#' => '.berocket_aapf_widget',
2116
  '#widget-title#' => '.berocket_aapf_widget-title'
2117
  );
2118
+ $result_css = "";
2119
+ if ( ! empty( $options['user_custom_css'] ) ) {
2120
+ if ( ! ( preg_match( "script", $options['user_custom_css'] ) or preg_match( "style", $options['user_custom_css'] ) or preg_match( "write", $options['user_custom_css'] ) or preg_match( "fromCharCode", $options['user_custom_css'] ) ) ) {
2121
+ $result_css = preg_replace( "script", "", $options['user_custom_css'] );
2122
+ }
2123
+ }
2124
  foreach ( $replace_css as $key => $value ) {
2125
  $result_css = str_replace( $key, $value, $result_css );
2126
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_s
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 4.0
7
  Tested up to: 5.2.3
8
- Stable tag: 1.3.4.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -184,6 +184,9 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
184
 
185
  == Changelog ==
186
 
 
 
 
187
  = 1.3.4.2 =
188
  * Fix - WPML incompatibility with new recount script
189
  * Fix - Purge cache after update
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 4.0
7
  Tested up to: 5.2.3
8
+ Stable tag: 1.3.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
184
 
185
  == Changelog ==
186
 
187
+ = 1.3.5 =
188
+ * Fix - hot fix for the issue with custom styles
189
+
190
  = 1.3.4.2 =
191
  * Fix - WPML incompatibility with new recount script
192
  * Fix - Purge cache after update
woocommerce-filters.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
- * Version: 1.3.4.2
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
+ * Version: 1.3.5
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters