Advanced AJAX Product Filters - Version 1.3.6

Version Description

  • Critical Update! Vulnerability found! Please update the plugin to the version 1.3.6
Download this release

Release Info

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

Code changes from version 1.3.5 to 1.3.6

berocket/assets/css/admin.css CHANGED
@@ -1501,3 +1501,9 @@
1501
  .account_key_send.br_framework_settings .button.tiny-button {
1502
  margin: 0;
1503
  }
 
 
 
 
 
 
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
+ }
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">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));
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));
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.3';
38
  public static $settings_name = '';
39
  public $addons;
40
  public $libraries;
@@ -433,6 +433,14 @@ if( ! class_exists( 'BeRocket_Framework' ) ) {
433
  array( 'jquery' ),
434
  $this->cc->info[ 'version' ]
435
  );
 
 
 
 
 
 
 
 
436
 
437
  wp_register_style(
438
  '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.4';
38
  public static $settings_name = '';
39
  public $addons;
40
  public $libraries;
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',
berocket/framework_version.php CHANGED
@@ -1,5 +1,5 @@
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__;
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__;
berocket/includes/custom_post.php CHANGED
@@ -34,6 +34,7 @@ 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
  protected static $instance;
38
 
39
  public static function getInstance() {
@@ -50,21 +51,19 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
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,6 +98,11 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
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,6 +142,25 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
138
  if( isset($actions['inline hide-if-no-js']) ) {
139
  unset($actions['inline hide-if-no-js']);
140
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
  return $actions;
143
  }
@@ -357,140 +380,6 @@ if ( ! class_exists('BeRocket_custom_post_class') ) {
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();
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
  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
  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
  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
  }
381
  return $data;
382
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  public function init_user_capabilities($user_caps) {
384
  $cap_settings = $this->post_settings;
385
  $cap_settings['capabilities'] = array();
berocket/includes/custom_post/enable_disable.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_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) {
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) {
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' ) {
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 Account', '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', 'Account Keys', '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>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,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">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 ) {
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
  }
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
  }
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
  $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
  </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 ) {
includes/wizard.php DELETED
@@ -1,574 +0,0 @@
1
- <?php
2
- class BeRocket_AAPF_Wizard {
3
- function __construct() {
4
- require_once dirname( __FILE__ ) . '/../wizard/setup-wizard.php';
5
- add_filter('berocket_wizard_steps_br-aapf-setup', array( __CLASS__, 'setup_wizard_steps'));
6
- add_action( 'before_wizard_run_br-aapf-setup', array( __CLASS__, 'set_wizard_js_css'));
7
- berocket_add_setup_wizard('br-aapf-setup', array('title' => __( 'AJAX Product Filters Setup Wizard', 'BeRocket_products_label_domain' )));
8
- }
9
-
10
- public static function set_wizard_js_css() {
11
- wp_enqueue_script('common');
12
- do_action('BeRocket_wizard_javascript');
13
- }
14
-
15
- public static function setup_wizard_steps($steps) {
16
- $steps = array(
17
- 'wizard_selectors' => array(
18
- 'name' => __( 'Selectors', 'BeRocket_AJAX_domain' ),
19
- 'view' => array( __CLASS__, 'wizard_selectors' ),
20
- 'handler' => array( __CLASS__, 'wizard_selectors_save' ),
21
- 'fa_icon' => 'fa-circle-o',
22
- ),
23
- 'wizard_permalinks' => array(
24
- 'name' => __( 'URL', 'BeRocket_AJAX_domain' ),
25
- 'view' => array( __CLASS__, 'wizard_permalinks' ),
26
- 'handler' => array( __CLASS__, 'wizard_permalinks_save' ),
27
- 'fa_icon' => 'fa-link',
28
- ),
29
- 'wizard_count_reload' => array(
30
- 'name' => __( 'Attribute count', 'BeRocket_AJAX_domain' ),
31
- 'view' => array( __CLASS__, 'wizard_count_reload' ),
32
- 'handler' => array( __CLASS__, 'wizard_count_reload_save' ),
33
- 'fa_icon' => 'fa-eye',
34
- ),
35
- 'wizard_extra' => array(
36
- 'name' => __( 'Extra', 'BeRocket_AJAX_domain' ),
37
- 'view' => array( __CLASS__, 'wizard_extra' ),
38
- 'handler' => array( __CLASS__, 'wizard_extra_save' ),
39
- 'fa_icon' => 'fa-cogs',
40
- ),
41
- 'wizard_end' => array(
42
- 'name' => __( 'Ready!', 'BeRocket_AJAX_domain' ),
43
- 'view' => array( __CLASS__, 'wizard_ready' ),
44
- 'handler' => array( __CLASS__, 'wizard_ready_save' ),
45
- 'fa_icon' => 'fa-check',
46
- ),
47
- );
48
- return $steps;
49
- }
50
-
51
- public static function wizard_selectors($wizard) {
52
- $option = BeRocket_AAPF::get_aapf_option();
53
- ?>
54
- <form method="post" class="br_framework_submit_form">
55
- <div class="nav-block berocket_framework_menu_general-block nav-block-active">
56
- <div>
57
- <h3><?php _e('IMPORTANT', 'BeRocket_AJAX_domain') ?></h3>
58
- <p><?php _e('Selectors can be different for each theme. Please setup correct selectors, otherwise plugin can doesn\'t work or some features can work incorrect', 'BeRocket_AJAX_domain') ?></p>
59
- <p><?php _e('You can try to setup it via "Auto-selectors" and plugin will try get selectors for your theme, this take a while.', 'BeRocket_AJAX_domain') ?></p>
60
- <p><?php _e('Manually you can check selectors on your shop page or contact <strong>theme author</strong> with question about it.', 'BeRocket_AJAX_domain') ?></p>
61
- <p><?php _e('Also theme with Isotope/Masonry or any type of the image Lazy-Load required custom JavaScript. Please contact your <strong>theme author</strong> to get correct JavaScript code for it', 'BeRocket_AJAX_domain') ?></p>
62
- <p><?php _e('JavaScript for some theme you can find in <a href="http://berocket.com/docs/plugin/woocommerce-ajax-products-filter#theme_setup" target="_blank">BeRocket Documentation</a>', 'BeRocket_AJAX_domain') ?></p>
63
- </div>
64
- <table class="framework-form-table berocket_framework_menu_selectors">
65
- <tbody>
66
- <tr style="display: table-row;">
67
- <th scope="row"><?php _e('Get selectors automatically', 'BeRocket_AJAX_domain') ?></th>
68
- <td>
69
- <div>
70
- <h4><?php _e('How it work:', 'BeRocket_AJAX_domain'); ?></h4>
71
- <ol>
72
- <li><?php _e('Run Auto-selector', 'BeRocket_AJAX_domain') ?></li>
73
- <li><?php _e('Wait until end <strong style="color:red;">do not close this page</strong>', 'BeRocket_AJAX_domain') ?></li>
74
- <li><?php _e('Save settings with new selectors', 'BeRocket_AJAX_domain') ?></li>
75
- </ol>
76
- </div>
77
- <?php
78
- $output_text = array(
79
- 'important' => __('IMPORTANT: It will generate some products on your site. Please disable all SEO plugins and plugins, that doing anything on product creating.', 'BeRocket_AJAX_domain'),
80
- 'was_runned' => __('Script was runned, but page closed until end. Please stop it to prevent any problems on your site', 'BeRocket_AJAX_domain'),
81
- 'run_button' => __('Auto-Selectors', 'BeRocket_AJAX_domain'),
82
- 'was_runned_stop' => __('Stop', 'BeRocket_AJAX_domain'),
83
- 'steps' => __('Steps:', 'BeRocket_AJAX_domain'),
84
- 'step_create_products' => __('Creating products', 'BeRocket_AJAX_domain'),
85
- 'step_get_selectors' => __('Gettings selectors', 'BeRocket_AJAX_domain'),
86
- 'step_remove_product' => __('Removing products', 'BeRocket_AJAX_domain')
87
- );
88
- echo BeRocket_wizard_generate_autoselectors(array(
89
- 'products' => '.berocket_aapf_products_selector',
90
- 'pagination' => '.berocket_aapf_pagination_selector',
91
- 'result_count' => '.berocket_aapf_product_count_selector'),
92
- array(), $output_text); ?>
93
- </td>
94
- </tr>
95
- <tr style="display: table-row;">
96
- <th scope="row"><?php _e('Products Container Selector', 'BeRocket_AJAX_domain'); ?></th>
97
- <td><label>
98
- <input type="text" name="berocket_aapf_wizard_settings[products_holder_id]"
99
- value="<?php if( ! empty($option['products_holder_id']) ) echo $option['products_holder_id']; ?>"
100
- class="berocket_aapf_products_selector">
101
- </label></td>
102
- </tr>
103
- <tr style="display: table-row;">
104
- <th scope="row"><?php _e('Pagination Selector', 'BeRocket_AJAX_domain'); ?></th>
105
- <td><label>
106
- <input type="text" name="berocket_aapf_wizard_settings[woocommerce_pagination_class]"
107
- value="<?php if( ! empty($option['woocommerce_pagination_class']) ) echo $option['woocommerce_pagination_class']; ?>"
108
- class="berocket_aapf_pagination_selector">
109
- </label></td>
110
- </tr>
111
- <tr style="display: table-row;">
112
- <th scope="row"><?php _e('Product count selector', 'BeRocket_AJAX_domain') ?></th>
113
- <td><label>
114
- <input type="text" name="berocket_aapf_wizard_settings[woocommerce_result_count_class]"
115
- value="<?php if( ! empty($option['woocommerce_result_count_class']) ) echo $option['woocommerce_result_count_class']; ?>"
116
- class="berocket_aapf_product_count_selector">
117
- </label></td>
118
- </tr>
119
- <tr style="display: table-row;">
120
- <th scope="row"><?php _e('Product order by selector', 'BeRocket_AJAX_domain') ?></th>
121
- <td><label>
122
- <input type="text" name="berocket_aapf_wizard_settings[woocommerce_ordering_class]"
123
- value="<?php if( ! empty($option['woocommerce_ordering_class']) ) echo $option['woocommerce_ordering_class']; ?>"
124
- class="">
125
- </label></td>
126
- </tr>
127
- <tr style="display: table-row;">
128
- <th scope="row"><?php _e('Removed elements', 'BeRocket_AJAX_domain') ?></th>
129
- <td>
130
- <p><?php _e('Select elements that your shop page doesn\'t have to prevent any errors with it', 'BeRocket_AJAX_domain') ?></p>
131
- <div><label>
132
- <input type="checkbox" name="berocket_aapf_wizard_settings[woocommerce_removes][result_count]" value="1"
133
- <?php if( ! empty($option['woocommerce_removes']['result_count']) ) echo " checked"; ?>>
134
- <?php _e('Products count', 'BeRocket_AJAX_domain') ?>
135
- </label></div>
136
- <div><label>
137
- <input type="checkbox" name="berocket_aapf_wizard_settings[woocommerce_removes][ordering]" value="1"
138
- <?php if( ! empty($option['woocommerce_removes']['ordering']) ) echo " checked"; ?>>
139
- <?php _e('Products order by drop down', 'BeRocket_AJAX_domain') ?>
140
- </label></div>
141
- <div><label>
142
- <input type="checkbox" name="berocket_aapf_wizard_settings[woocommerce_removes][pagination]" value="1"
143
- <?php if( ! empty($option['woocommerce_removes']['pagination']) ) echo " checked"; ?>>
144
- <?php _e('Pagination', 'BeRocket_AJAX_domain') ?>
145
- </label></div>
146
- </td>
147
- </tr>
148
- <tr style="display: table-row;">
149
- <td colspan="2">
150
- <a href="#custom-js-css" class="wizard_custom_js_css_open"><?php _e('You need some custom JavaScript/CSS code?', 'BeRocket_AJAX_domain') ?></a>
151
- <div class="wizard_custom_js_css" style="display: none;">
152
- <h3><?php _e('User custom CSS style', 'BeRocket_AJAX_domain') ?></h3>
153
- <textarea name="berocket_aapf_wizard_settings[user_custom_css]"><?php echo br_get_value_from_array($option, array('user_custom_css')) ?></textarea>
154
- <h3><?php _e('JavaScript Before Products Update', 'BeRocket_AJAX_domain') ?></h3>
155
- <textarea name="berocket_aapf_wizard_settings[user_func][before_update]"><?php echo br_get_value_from_array($option, array('user_func', 'before_update')) ?></textarea>
156
- <h3><?php _e('JavaScript On Products Update', 'BeRocket_AJAX_domain') ?></h3>
157
- <textarea name="berocket_aapf_wizard_settings[user_func][on_update]"><?php echo br_get_value_from_array($option, array('user_func', 'on_update')) ?></textarea>
158
- <h3><?php _e('JavaScript After Products Update', 'BeRocket_AJAX_domain') ?></h3>
159
- <textarea name="berocket_aapf_wizard_settings[user_func][after_update]"><?php echo br_get_value_from_array($option, array('user_func', 'after_update')) ?></textarea>
160
- </div>
161
- </td>
162
- </tr>
163
- </tbody>
164
- </table>
165
- </div>
166
- <script>
167
- jQuery(document).on('click', '.wizard_custom_js_css_open', function(event) {
168
- event.preventDefault();
169
- jQuery(this).hide();
170
- jQuery('.wizard_custom_js_css').show();
171
- });
172
- </script>
173
- <?php wp_nonce_field( $wizard->page_id ); ?>
174
- <p class="next-step">
175
- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
176
- </p>
177
- </form>
178
- <?php
179
- }
180
-
181
- public static function wizard_selectors_save($wizard) {
182
- check_admin_referer( $wizard->page_id );
183
- $option = BeRocket_AAPF::get_aapf_option();
184
- if( ! empty($_POST['berocket_aapf_wizard_settings']) && is_array($_POST['berocket_aapf_wizard_settings']) ) {
185
- $new_option = array_merge(
186
- array('woocommerce_removes' => array('pagination' => '', 'result_count' => '', 'ordering' => '')),
187
- $_POST['berocket_aapf_wizard_settings']
188
- );
189
- $option = array_merge($option, $new_option);
190
- }
191
- $BeRocket_AAPF = BeRocket_AAPF::getInstance();
192
- $option = $BeRocket_AAPF->sanitize_option($option);
193
- update_option( 'br_filters_options', $option );
194
- $wizard->redirect_to_next_step();
195
- }
196
-
197
- public static function wizard_permalinks($wizard) {
198
- $option = BeRocket_AAPF::get_aapf_option();
199
- ?>
200
- <form method="post" class="br_framework_submit_form">
201
- <div class="nav-block berocket_framework_menu_general-block nav-block-active">
202
- <table class="framework-form-table berocket_framework_menu_selectors">
203
- <tbody>
204
- <tr style="display: table-row;">
205
- <th scope="row"><?php _e('SEO friendly URLs', 'BeRocket_AJAX_domain') ?></th>
206
- <td>
207
- <input class="berocket_wizard_seo_friendly" name="berocket_aapf_wizard_settings[seo_friendly_urls]" type="checkbox" value="1"<?php if( ! empty($option['seo_friendly_urls']) ) echo ' checked'?>>
208
- <?php _e('Page URL will be changed after filtering.', 'BeRocket_AJAX_domain') ?>
209
- </td>
210
- </tr>
211
- <tr style="display: table-row;">
212
- <td colspan="2">
213
- <p><?php _e('Without this option after page reload filter will be unselected', 'BeRocket_AJAX_domain') ?></p>
214
- <p><?php _e('Also back button doesn\'t load previous selected filters', 'BeRocket_AJAX_domain') ?></p>
215
- </td>
216
- </tr>
217
- <tr class="berocket_wizard_only_seo_friendly"<?php if( empty($option['seo_friendly_urls']) ) echo ' style="display:none;"'?>>
218
- <th scope="row"><?php _e('Use slug', 'BeRocket_AJAX_domain') ?></th>
219
- <td>
220
- <input name="berocket_aapf_wizard_settings[slug_urls]" type="checkbox" value="1"<?php if( ! empty($option['slug_urls']) ) echo ' checked'?>>
221
- <?php _e('Replace attribute values ID to Slug in SEO friendly URLs.', 'BeRocket_AJAX_domain') ?>
222
- </td>
223
- </tr>
224
- <tr class="berocket_wizard_only_seo_friendly"<?php if( empty($option['seo_friendly_urls']) ) echo ' style="display:none;"'?>>
225
- <td colspan="2">
226
- <p><?php _e('<strong>IMPORTANT</strong> Please check that Slug for all attribute values without those symbols - _ +', 'BeRocket_AJAX_domain') ?></p>
227
- </td>
228
- </tr>
229
- <tr class="berocket_wizard_only_seo_friendly"<?php if( empty($option['seo_friendly_urls']) ) echo ' style="display:none;"'?>>
230
- <th scope="row"><?php _e('Nice permalink URL', 'BeRocket_AJAX_domain') ?></th>
231
- <td>
232
- <input class="berocket_wizard_nice_urls" name="berocket_aapf_wizard_settings[nice_urls]" type="checkbox" value="1"<?php if( ! empty($option['nice_urls']) ) echo ' checked'?>>
233
- <?php _e('Use WordPress permalinks instead GET query', 'BeRocket_AJAX_domain') ?>
234
- </td>
235
- </tr>
236
- <tr class="berocket_wizard_only_seo_friendly"<?php if( empty($option['seo_friendly_urls']) ) echo ' style="display:none;"'?>>
237
- <td colspan="2">
238
- <p><?php _e('<strong>IMPORTANT</strong> WordPress permalinks must be set to Post name(Custom structure: /%postname%/ )', 'BeRocket_AJAX_domain') ?></p>
239
- <p><?php _e('Not working on any custom page(Generated with any page builder or with help of shortcodes)', 'BeRocket_AJAX_domain') ?></p>
240
- <p><?php _e('Not compatible with any other plugin that change WooCommerce permalinks', 'BeRocket_AJAX_domain') ?></p>
241
- </td>
242
- </tr>
243
- <tr class="berocket_wizard_only_seo_friendly"<?php if( empty($option['seo_friendly_urls']) ) echo ' style="display:none;"'?>>
244
- <td colspan="2" class="berocket_wizard_only_nice_urls"<?php if( empty($option['nice_urls']) ) echo ' style="display:none;"'?>>
245
- <?php
246
- $BeRocket_AAPF = BeRocket_AAPF::getInstance();
247
- $BeRocket_AAPF->br_get_template_part( 'permalink_option' );
248
- ?>
249
- </td>
250
- </tr>
251
- </tbody>
252
- </table>
253
- </div>
254
- <script>
255
- jQuery(document).on('change', '.berocket_wizard_seo_friendly', function() {
256
- if( jQuery(this).prop('checked') ) {
257
- jQuery('.berocket_wizard_only_seo_friendly').show();
258
- } else {
259
- jQuery('.berocket_wizard_only_seo_friendly').hide();
260
- }
261
- });
262
- jQuery(document).on('change', '.berocket_wizard_nice_urls', function() {
263
- if( jQuery(this).prop('checked') ) {
264
- jQuery('.berocket_wizard_only_nice_urls').show();
265
- } else {
266
- jQuery('.berocket_wizard_only_nice_urls').hide();
267
- }
268
- });
269
- </script>
270
- <?php wp_nonce_field( $wizard->page_id ); ?>
271
- <p class="next-step">
272
- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
273
- </p>
274
- </form>
275
- <?php
276
- }
277
-
278
- public static function wizard_permalinks_save($wizard) {
279
- check_admin_referer( $wizard->page_id );
280
- $option = BeRocket_AAPF::get_aapf_option();
281
- if( empty($_POST['berocket_aapf_wizard_settings']) || ! is_array($_POST['berocket_aapf_wizard_settings']) ) {
282
- $_POST['berocket_aapf_wizard_settings'] = array();
283
- }
284
- $option_new = array_merge(array('seo_friendly_urls' => '', 'slug_urls' => '', 'nice_urls' => ''), $_POST['berocket_aapf_wizard_settings']);
285
- if( empty($option_new['seo_friendly_urls']) ) {
286
- $option_new['slug_urls'] = '';
287
- $option_new['nice_urls'] = '';
288
- }
289
- $BeRocket_AAPF = BeRocket_AAPF::getInstance();
290
- if( ! empty($option_new['nice_urls']) ) {
291
- if( ! empty($_POST['berocket_permalink_option']) && is_array($_POST['berocket_permalink_option']) ) {
292
- $default_values = $BeRocket_AAPF->default_permalink;
293
- $BeRocket_AAPF->save_permalink_option($default_values);
294
- }
295
- }
296
- $option = array_merge($option, $option_new);
297
- $option = $BeRocket_AAPF->sanitize_option($option);
298
- update_option( 'br_filters_options', $option );
299
- $wizard->redirect_to_next_step();
300
- }
301
-
302
- public static function wizard_count_reload($wizard) {
303
- $option = BeRocket_AAPF::get_aapf_option();
304
- ?>
305
- <form method="post" class="br_framework_submit_form">
306
- <div class="nav-block berocket_framework_menu_general-block nav-block-active">
307
- <table class="framework-form-table berocket_framework_menu_selectors">
308
- <tbody>
309
- <tr style="display: table-row;">
310
- <th scope="row"><?php _e('Presets', 'BeRocket_AJAX_domain') ?></th>
311
- <td>
312
- <p><?php _e('You can select some preset or setup each settings manually', 'BeRocket_AJAX_domain') ?></p>
313
- <select class="attribute_count_preset">
314
- <option value="custom"><?php _e('Custom', 'BeRocket_AJAX_domain') ?></option>
315
- <option value="show_all"><?php _e('Show all attributes (very fast)', 'BeRocket_AJAX_domain') ?></option>
316
- <option value="hide_page"><?php _e('Hide empty attributes by page (fast)', 'BeRocket_AJAX_domain') ?></option>
317
- <option value="hide_empty"><?php _e('Hide empty attribute by filters (slow)', 'BeRocket_AJAX_domain') ?></option>
318
- </select>
319
- </td>
320
- </tr>
321
- <tr class="attribute_count_preset_info attribute_count_preset_info_show_all" style="display: none;" data-count="1">
322
- <td colspan="2">
323
- <h4><?php _e('Show all attributes', 'BeRocket_AJAX_domain') ?></h4>
324
- <p><?php _e('Display all attribute values, including attribute values without products, but work realy fast. If you have a lot of products(2000 and more) then it will be better solution. But check that all attribute values in your shop has attribute', 'BeRocket_AJAX_domain') ?></p>
325
- </td>
326
- </tr>
327
- <tr class="attribute_count_preset_info attribute_count_preset_info_hide_page" style="display: none;" data-count="26">
328
- <td colspan="2">
329
- <h4><?php _e('Hide empty attributes by page', 'BeRocket_AJAX_domain') ?></h4>
330
- <p><?php _e('Display only attribute values with products, but do not check selected filters. Any first selected filter will return products, but next filters can return "no products" message', 'BeRocket_AJAX_domain') ?></p>
331
- </td>
332
- </tr>
333
- <tr class="attribute_count_preset_info attribute_count_preset_info_hide_empty" style="display: none;" data-count="58">
334
- <td colspan="2">
335
- <h4><?php _e('Hide empty attribute by filters', 'BeRocket_AJAX_domain') ?></h4>
336
- <p><?php _e('Display only attribute values with products. Only attribute values with products will be used, also after any filtering. But it work slow, because recount products for each attribute. Can work slow on bad server and with a lot of products', 'BeRocket_AJAX_domain') ?></p>
337
- </td>
338
- </tr>
339
- <tr style="display: table-row;">
340
- <th scope="row"><?php _e('Show all values', 'BeRocket_AJAX_domain') ?></th>
341
- <td>
342
- <label><input name="berocket_aapf_wizard_settings[show_all_values]" class="attribute_count_preset_1" type="checkbox" value="1"
343
- <?php if( ! empty($option['show_all_values']) ) echo " checked"; ?>>
344
- <?php _e('Check if you want to show not used attribute values too', 'BeRocket_AJAX_domain') ?>
345
- </label>
346
- </td>
347
- </tr>
348
- <tr style="display: table-row;">
349
- <td colspan="2">
350
- <?php _e('Uses all attribute values in filters, uses also values without products for your shop. Can fix some problems with displaying filters on pages', 'BeRocket_AJAX_domain') ?>
351
- </td>
352
- </tr>
353
- <tr style="display: table-row;">
354
- <th scope="row"><?php _e('Hide values', 'BeRocket_AJAX_domain') ?></th>
355
- <td>
356
- <div><label><input name="berocket_aapf_wizard_settings[hide_value][o]" class="attribute_count_preset_2" type="checkbox" value="1"
357
- <?php if( ! empty($option['hide_value']['o']) ) echo " checked"; ?>>
358
- <?php _e('Hide values without products', 'BeRocket_AJAX_domain') ?>
359
- </label></div>
360
- <div><label><input name="berocket_aapf_wizard_settings[hide_value][sel]" class="attribute_count_preset_4" type="checkbox" value="1"
361
- <?php if( ! empty($option['hide_value']['sel']) ) echo " checked"; ?>>
362
- <?php _e('Hide selected values', 'BeRocket_AJAX_domain') ?>
363
- </label></div>
364
- <div><label><input name="berocket_aapf_wizard_settings[hide_value][empty]" class="attribute_count_preset_8" type="checkbox" value="1"
365
- <?php if( ! empty($option['hide_value']['empty']) ) echo " checked"; ?>>
366
- <?php _e('Hide empty widget', 'BeRocket_AJAX_domain') ?>
367
- </label></div>
368
- <?php do_action('berocket_aapf_wizard_attribute_count_hide_values', $option); ?>
369
- </td>
370
- </tr>
371
- <tr style="display: table-row;">
372
- <th scope="row"><?php _e('Reload amount of products', 'BeRocket_AJAX_domain') ?></th>
373
- <td>
374
- <label><input name="berocket_aapf_wizard_settings[recount_products]" class="attribute_count_preset_32" type="checkbox" value="1"
375
- <?php if( ! empty($option['recount_products']) ) echo " checked"; ?>>
376
- <?php _e('Use filters on products count display', 'BeRocket_AJAX_domain') ?>
377
- </label>
378
- </td>
379
- </tr>
380
- <tr style="display: table-row;">
381
- <td colspan="2">
382
- <?php _e('Slow down site load speed, because uses additional query for each filter. Replaces attribute values using selected filters to use correct count of products for each value. "Hide values without products" option do not work without this option. Also uses to display correct products count with attribute values after filtering', 'BeRocket_AJAX_domain') ?>
383
- </td>
384
- </tr>
385
- </tbody>
386
- </table>
387
- </div>
388
- <script>
389
- jQuery(document).on('change', '.attribute_count_preset', function() {
390
- jQuery('.attribute_count_preset_info').hide();
391
- jQuery('.attribute_count_preset_info_'+jQuery(this).val()).show();
392
- var data_count = jQuery('.attribute_count_preset_info_'+jQuery(this).val()).data('count');
393
- if( data_count ) {
394
- var data_counts = [32,16,8,4,2,1];
395
- data_counts.forEach(function( item, i, arr) {
396
- if( data_count >= item ) {
397
- jQuery('.attribute_count_preset_'+item).prop('checked', true);
398
- data_count = data_count - item;
399
- } else {
400
- jQuery('.attribute_count_preset_'+item).prop('checked', false);
401
- }
402
- });
403
- }
404
- });
405
- jQuery(document).on('change', '.attribute_count_preset_1, .attribute_count_preset_2, .attribute_count_preset_4, .attribute_count_preset_8, .attribute_count_preset_16, .attribute_count_preset_32', function() {
406
- jQuery('.attribute_count_preset').val('custom').trigger('change');
407
- });
408
- </script>
409
- <?php wp_nonce_field( $wizard->page_id ); ?>
410
- <p class="next-step">
411
- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
412
- </p>
413
- </form>
414
- <?php
415
- }
416
-
417
- public static function wizard_count_reload_save($wizard) {
418
- check_admin_referer( $wizard->page_id );
419
- $option = BeRocket_AAPF::get_aapf_option();
420
- if( empty($_POST['berocket_aapf_wizard_settings']) || ! is_array($_POST['berocket_aapf_wizard_settings']) ) {
421
- $_POST['berocket_aapf_wizard_settings'] = array();
422
- }
423
- $option_new = array_merge(array('show_all_values' => '', 'hide_value' => array('o' => '', 'sel' => '', 'empty' => '', 'button' => ''), 'recount_products' => ''), $_POST['berocket_aapf_wizard_settings']);
424
- $option = array_merge($option, $option_new);
425
- $BeRocket_AAPF = BeRocket_AAPF::getInstance();
426
- $option = $BeRocket_AAPF->sanitize_option($option);
427
- update_option( 'br_filters_options', $option );
428
- $wizard->redirect_to_next_step();
429
- }
430
-
431
- public static function wizard_extra($wizard) {
432
- $option = BeRocket_AAPF::get_aapf_option();
433
- ?>
434
- <form method="post" class="br_framework_submit_form">
435
- <div class="nav-block berocket_framework_menu_general-block nav-block-active">
436
- <table class="framework-form-table berocket_framework_menu_selectors">
437
- <tbody>
438
- <tr style="display: table-row;">
439
- <th scope="row"><?php _e('Jump to first page', 'BeRocket_AJAX_domain') ?></th>
440
- <td>
441
- <label><input name="berocket_aapf_wizard_settings[first_page_jump]" type="checkbox" value="1"
442
- <?php if( ! empty($option['first_page_jump']) ) echo " checked"; ?>>
443
- <?php _e('Load first page after any filter changes. Can fix some problem with "no products" message after filtering', 'BeRocket_AJAX_domain') ?>
444
- </label>
445
- </td>
446
- </tr>
447
- <tr style="display: table-row;">
448
- <th scope="row"><?php _e('Scroll page to the top', 'BeRocket_AJAX_domain') ?></th>
449
- <td>
450
- <label><input name="berocket_aapf_wizard_settings[scroll_shop_top]" type="checkbox" value="1"
451
- <?php if( ! empty($option['scroll_shop_top']) ) echo " checked"; ?>>
452
- <?php _e('Check if you want scroll page to the top of shop after filters change', 'BeRocket_AJAX_domain') ?>
453
- </label>
454
- </td>
455
- </tr>
456
- <tr style="display: table-row;">
457
- <th scope="row"><?php _e('Show selected filters', 'BeRocket_AJAX_domain') ?></th>
458
- <td>
459
- <label><input name="berocket_aapf_wizard_settings[selected_area_show]" type="checkbox" value="1"
460
- <?php if( ! empty($option['selected_area_show']) ) echo " checked"; ?>>
461
- <?php _e('Show selected filters above products. Also you can use widget to show selected filters', 'BeRocket_AJAX_domain') ?>
462
- </label>
463
- </td>
464
- </tr>
465
- <tr style="display: table-row;">
466
- <th scope="row"><?php _e('Display products', 'BeRocket_AJAX_domain') ?></th>
467
- <td>
468
- <label><input name="berocket_aapf_wizard_settings[products_only]" type="checkbox" value="1"
469
- <?php if( ! empty($option['products_only']) ) echo " checked"; ?>>
470
- <?php _e('Display always products when filters selected. Use this when you have categories and subcategories on shop pages, but you want to display products on filtering', 'BeRocket_AJAX_domain') ?>
471
- </label>
472
- </td>
473
- </tr>
474
- <tr style="display: table-row;">
475
- <th scope="row"><?php _e('Search page fix', 'BeRocket_AJAX_domain') ?></th>
476
- <td>
477
- <label><input name="berocket_aapf_wizard_settings[search_fix]" type="checkbox" value="1"
478
- <?php if( ! empty($option['search_fix']) ) echo " checked"; ?>>
479
- <?php _e('Disable redirection, when search page return only one product<br>Enable it only if you will use filters on search page', 'BeRocket_AJAX_domain') ?>
480
- </label>
481
- </td>
482
- </tr>
483
- </tbody>
484
- </table>
485
- </div>
486
- <script>
487
- </script>
488
- <?php wp_nonce_field( $wizard->page_id ); ?>
489
- <p class="next-step">
490
- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
491
- </p>
492
- </form>
493
- <?php
494
- }
495
-
496
- public static function wizard_extra_save($wizard) {
497
- check_admin_referer( $wizard->page_id );
498
- $option = BeRocket_AAPF::get_aapf_option();
499
- if( empty($_POST['berocket_aapf_wizard_settings']) || ! is_array($_POST['berocket_aapf_wizard_settings']) ) {
500
- $_POST['berocket_aapf_wizard_settings'] = array();
501
- }
502
- $option_new = array_merge(array('first_page_jump' => '', 'scroll_shop_top' => '', 'selected_area_show' => '', 'products_only' => '', 'search_fix' => ''), $_POST['berocket_aapf_wizard_settings']);
503
- $option = array_merge($option, $option_new);
504
- $BeRocket_AAPF = BeRocket_AAPF::getInstance();
505
- $option = $BeRocket_AAPF->sanitize_option($option);
506
- update_option( 'br_filters_options', $option );
507
- $wizard->redirect_to_next_step();
508
- }
509
-
510
- public static function wizard_ready($wizard) {
511
- $option = BeRocket_AAPF::get_aapf_option();
512
- ?>
513
- <form method="post" class="br_framework_submit_form">
514
- <div class="nav-block berocket_framework_menu_general-block nav-block-active">
515
- <h2><?php _e('Plugin ready to use', 'BeRocket_AJAX_domain') ?></h2>
516
- <div><iframe width="560" height="315" src="https://www.youtube.com/embed/8gaMj-IxUj0?rel=0&amp;showinfo=0" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe></div>
517
- <h4><?php _e('Widget', 'BeRocket_AJAX_domain') ?></h4>
518
- <p><?php _e('Now you can add widgets AJAX Product Filters to your side bar', 'BeRocket_AJAX_domain') ?></p>
519
- <p><?php _e('More information about widget options you can get on <a target="_blank" href="http://berocket.com/docs/plugin/woocommerce-ajax-products-filter#widget">BeRocket Documentation</a>', 'BeRocket_AJAX_domain') ?></p>
520
- <?php
521
- $old_filter_widgets = get_option('widget_berocket_aapf_widget');
522
- if( ! is_array($old_filter_widgets) ) {
523
- $old_filter_widgets = array();
524
- }
525
- foreach ($old_filter_widgets as $key => $value) {
526
- if (!is_numeric($key)) {
527
- unset($old_filter_widgets[$key]);
528
- }
529
- }
530
- $html = '';
531
- if( count($old_filter_widgets) ) {
532
- $html = '<h3>' . __('Replace old widgets', 'BeRocket_AJAX_domain') . '</h3>
533
- <div>';
534
- $html .= '<span
535
- class="button berocket_replace_deprecated_with_new"
536
- data-ready="' . __('Widget replaced', 'BeRocket_AJAX_domain') . '"
537
- data-loading="' . __('Replacing widgets... Please wait', 'BeRocket_AJAX_domain') . '"';
538
- $html .= '>' . __('Replace widgets', 'BeRocket_AJAX_domain');
539
- $html .= '</span>
540
- <p>' . __('Replace deprecated widgets with new single filter widgets', 'BeRocket_AJAX_domain') . '</p>
541
- <script>
542
- jQuery(".berocket_replace_deprecated_with_new").click(function() {
543
- var $this = jQuery(this);
544
- if( ! $this.is(".berocket_ajax_sending") ) {
545
- $this.data("text", $this.text());
546
- $this.attr("disabled", "disabled");
547
- $this.text($this.data("loading"));
548
- $this.addClass("berocket_ajax_sending");
549
- jQuery.post("'.admin_url('admin-ajax.php').'", {action:"replace_deprecated_with_new"}, function() {
550
- $this.text($this.data("ready"));
551
- });
552
- }
553
- });
554
- </script>
555
- </div>';
556
- }
557
- echo $html;
558
- ?>
559
- </div>
560
- <?php
561
- wp_nonce_field( $wizard->page_id ); ?>
562
- <p class="next-step">
563
- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Create new filter right now", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
564
- </p>
565
- </form>
566
- <?php
567
- }
568
-
569
- public static function wizard_ready_save($wizard) {
570
- check_admin_referer( $wizard->page_id );
571
- $BeRocket_AAPF = BeRocket_AAPF::getInstance();
572
- wp_redirect( admin_url( 'post-new.php?post_type=br_product_filter&aapf=singlewizard' ) );
573
- }
574
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
main.php CHANGED
@@ -168,10 +168,7 @@ class BeRocket_AAPF extends BeRocket_Framework {
168
  $this->feature_list = array();
169
  $this->framework_data['fontawesome_frontend'] = true;
170
  $this->active_libraries = array('addons', 'feature');
171
-
172
- if( is_admin() ) {
173
- require_once dirname( __FILE__ ) . '/includes/wizard.php';
174
- }
175
  if( method_exists($this, 'include_once_files') ) {
176
  $this->include_once_files();
177
  }
@@ -179,7 +176,6 @@ class BeRocket_AAPF extends BeRocket_Framework {
179
  //INIT ADITIONAL CLASSES
180
  BeRocket_AAPF_single_filter::getInstance();
181
  BeRocket_AAPF_group_filters::getInstance();
182
- new BeRocket_AAPF_Wizard();
183
  add_action('et_builder_modules_load', 'berocket_filter_et_builder_ready');
184
  add_action('vc_before_init', 'berocket_filter_vc_before_init', 100000);
185
  //----------------------
@@ -353,11 +349,6 @@ class BeRocket_AAPF extends BeRocket_Framework {
353
  wp_enqueue_style( 'font-awesome' );
354
  }
355
  public function admin_settings( $tabs_info = array(), $data = array() ) {
356
- $redirect_to_wizard = get_option('berocket_filter_open_wizard_on_settings');
357
- if( ! empty($redirect_to_wizard) ) {
358
- delete_option('berocket_filter_open_wizard_on_settings');
359
- wp_redirect(admin_url( 'admin.php?page=br-aapf-setup' ));
360
- }
361
  wp_enqueue_script( 'berocket_aapf_widget-admin' );
362
  add_filter('brfr_data_ajax_filters', array($this, 'admin_settings_additional'));
363
  parent::admin_settings(
168
  $this->feature_list = array();
169
  $this->framework_data['fontawesome_frontend'] = true;
170
  $this->active_libraries = array('addons', 'feature');
171
+
 
 
 
172
  if( method_exists($this, 'include_once_files') ) {
173
  $this->include_once_files();
174
  }
176
  //INIT ADITIONAL CLASSES
177
  BeRocket_AAPF_single_filter::getInstance();
178
  BeRocket_AAPF_group_filters::getInstance();
 
179
  add_action('et_builder_modules_load', 'berocket_filter_et_builder_ready');
180
  add_action('vc_before_init', 'berocket_filter_vc_before_init', 100000);
181
  //----------------------
349
  wp_enqueue_style( 'font-awesome' );
350
  }
351
  public function admin_settings( $tabs_info = array(), $data = array() ) {
 
 
 
 
 
352
  wp_enqueue_script( 'berocket_aapf_widget-admin' );
353
  add_filter('brfr_data_ajax_filters', array($this, 'admin_settings_additional'));
354
  parent::admin_settings(
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.5
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.5 =
188
  * Fix - hot fix for the issue with custom styles
189
 
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.6
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.6 =
188
+ * Critical Update! Vulnerability found! Please update the plugin to the version 1.3.6
189
+
190
  = 1.3.5 =
191
  * Fix - hot fix for the issue with custom styles
192
 
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.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
@@ -11,6 +11,6 @@
11
  * Domain Path: /languages/
12
  * WC tested up to: 3.7.0
13
  */
14
- define( "BeRocket_AJAX_filters_version", '1.3.4.2' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');
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.6
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
11
  * Domain Path: /languages/
12
  * WC tested up to: 3.7.0
13
  */
14
+ define( "BeRocket_AJAX_filters_version", '1.3.6' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');