Advanced AJAX Product Filters - Version 1.2.5

Version Description

  • Enhancement - Product categories filtering
  • Enhancement - Select2 script for dropdown menu in filters
  • Enhancement - Option to use GET request instead POST request(for better compatibility with some caching)
  • Enhancement - Setup Wizard
  • Enhancement - Auto selectors
  • Fix - Displaying categories and subcategories
  • Fix - Compatibility with new version of Load More plugin
  • Fix - Other fixes
Download this release

Release Info

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

Code changes from version 1.2.4 to 1.2.5

contributors.txt DELETED
@@ -1 +0,0 @@
1
- BeRocket
 
css/select2.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
includes/admin_notices.php CHANGED
@@ -21,6 +21,10 @@
21
  //delete_option('berocket_admin_notices'); //remove all notice information
22
  //delete_option('berocket_last_close_notices_time'); //remove wait time before next notice
23
  if( ! class_exists( 'berocket_admin_notices' ) ) {
 
 
 
 
24
  class berocket_admin_notices {
25
  public $find_names, $notice_exist = false;
26
  public static $last_time = '-24 hours';
@@ -30,24 +34,24 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
30
  public static $styles_exist = false;
31
  public static $notice_index = 0;
32
  public static $default_notice_options = array(
33
- 'start' => 0,
34
- 'end' => 0,
35
- 'name' => 'sale',
36
- 'html' => '',
37
- 'righthtml' => '<a class="berocket_no_thanks">No thanks</a>',
38
- 'rightwidth' => 80,
39
- 'nothankswidth' => 60,
40
- 'contentwidth' => 400,
41
- 'subscribe' => false,
42
- 'closed' => '0',
43
- 'priority' => 20,
44
- 'height' => 50,
45
- 'repeat' => false,
46
- 'repeatcount' => 1,
47
- 'image' => array(
48
- 'global' => 'http://berocket.com/images/logo-2.png'
49
- ),
50
- );
51
  function __construct($options = array()) {
52
  if( ! is_admin() ) return;
53
  $options = array_merge(self::$default_notice_options, $options);
@@ -173,14 +177,15 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
173
  file_put_contents($img_local, file_get_contents($url_global));
174
  }
175
  if( file_exists($img_local) ) {
176
- $file_exist = true;
177
  $options['image']['local'] = $url_local;
178
  $options['image']['pathlocal'] = $img_local;
179
  } else {
180
  $options['image']['local'] = $url_global;
 
181
  }
182
  }
183
- } else {
 
184
  if( ! empty($options['image']['local']) ) {
185
  $img_local = $options['image']['local'];
186
  $img_local = str_replace(site_url('/'), '', $img_local);
@@ -284,7 +289,7 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
284
  $notice = self::get_not_closed_notice($item, $end_soon, $closed, $count - 1);
285
  }
286
  } else {
287
- if( $item['closed'] <= $closed && ( ! self::$subscribed || ! $item['subscribe'] ) ) {
288
  return $item;
289
  }
290
  }
@@ -307,13 +312,12 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
307
  $notices = array_merge($notices, $notice);
308
  } else {
309
  if( ! self::$subscribed || ! $item['subscribe'] ) {
310
- if( $item['priority'] < 5 || ! $item['closed'] ) {
311
  $notices[] = $item;
312
  }
313
  }
314
  }
315
  }
316
-
317
  return $notices;
318
  }
319
  public static function display_admin_notice() {
@@ -326,9 +330,9 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
326
  if( ! empty($notice['original']) ) {
327
  $original_notice = self::get_notice_by_path($notice['original']);
328
  unset($original_notice['start'], $original_notice['closed'], $original_notice['repeatcount']);
329
- $notice = $original_notice;
330
  }
331
-
332
  if( $notice !== false ) {
333
  self::echo_notice($notice);
334
  }
@@ -336,13 +340,13 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
336
  if( is_array($additional_notice) && count($additional_notice) > 0 ) {
337
  foreach($additional_notice as $notice) {
338
  if( is_array($notice) ) {
339
- $notice = array_merge(self::$default_notice_options, $notice);
340
  self::echo_notice($notice);
341
  }
342
  }
343
  }
344
  }
345
  public static function echo_notice($notice) {
 
346
  $settings_page = apply_filters('is_berocket_settings_page', false);
347
  self::$notice_index++;
348
  $notice_data = array(
@@ -365,7 +369,7 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
365
  $time = $time%60;
366
  $time_left_str .= sprintf("%02d", $minutes) . ":";
367
  }
368
-
369
  $time_left_str .= sprintf("%02d", $time);
370
  $notice['rightwidth'] += 60;
371
  $notice['righthtml'] .= '<div class="berocket_time_left_block">Left<br><span class="berocket_time_left" data-time="' . $time_left . '">' . $time_left_str . '</span></div>';
@@ -377,8 +381,8 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
377
  } else {
378
  $user_email = '';
379
  }
380
- $notice['righthtml'] =
381
- '<form class="berocket_subscribe_form" method="POST" action="' . admin_url( 'admin-ajax.php' ) . '">
382
  <input type="hidden" name="action" value="berocket_subscribe_email">
383
  <input class="berocket_subscribe_email" type="email" name="email" value="' . $user_email . '">
384
  <input type="submit" class="button-primary button berocket_notice_submit" value="Subscribe">
@@ -387,13 +391,13 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
387
  }
388
  echo '
389
  <div class="notice berocket_admin_notice berocket_admin_notice_', self::$notice_index, '" data-notice=\'', json_encode($notice_data), '\'>',
390
- ( empty($notice['image']['local']) ? '' : '<img class="berocket_notice_img" src="' . $notice['image']['local'] . '">' ),
391
- ( empty($notice['righthtml']) ? '' :
392
- '<div class="berocket_notice_right_content">
393
  <div class="berocket_notice_content">' . $notice['righthtml'] . '</div>
394
  <div class="berocket_notice_after_content"></div>
395
  </div>' ),
396
- '<div class="berocket_notice_content_wrap">
397
  <div class="berocket_notice_content">', $notice['html'], '</div>
398
  <div class="berocket_notice_after_content"></div>
399
  </div></div>';
@@ -428,20 +432,20 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
428
  text-align: center;
429
  }
430
  .berocket_admin_notice.berocket_admin_notice_', self::$notice_index, ' .berocket_notice_right_content {',
431
- ( $notice['rightwidth'] <= 20 ? ' display: none' :
432
- 'height: ' . $notice['height'] . 'px;
433
  float: right;
434
  width: ' . $notice['rightwidth'] . 'px;
435
  -webkit-box-shadow: box-shadow: -1px 0 0 0 rgba(0, 0, 0, 0.1);
436
  box-shadow: -1px 0 0 0 rgba(0, 0, 0, 0.1);
437
  padding-left: 10px;' ),
438
- '}
439
  .berocket_admin_notice.berocket_admin_notice_', self::$notice_index, ' .berocket_no_thanks {',
440
- ( $settings_page && $notice['priority'] <= 5 ? 'display: none!important;' : 'cursor: pointer;
441
  color: #0073aa;
442
  opacity: 0.5;
443
  display: inline-block;' ),
444
- '}
445
  ', ( empty($notice['subscribe']) ? '' : '
446
  .berocket_admin_notice.berocket_admin_notice_' . self::$notice_index . ' .berocket_subscribe_form {
447
  display: inline-block;
@@ -685,16 +689,23 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
685
  event.preventDefault();
686
  jQuery(this).parents(".berocket_subscribe_form").trigger("berocket_subscribe_send");
687
  });
688
-
689
  </script>';
690
  }
691
  }
692
  public static function close_notice($notice = FALSE) {
693
  self::$subscribed = get_option('berocket_email_subscribed');
694
  if( ( $notice == FALSE || ! is_array($notice) ) && ! empty($_POST['notice']) ) {
695
- $notice = $_POST['notice'];
696
  }
697
- if( $notice == FALSE || ! is_array($notice) ) {
 
 
 
 
 
 
 
698
  wp_die();
699
  }
700
  $find_names = array($notice['priority'], $notice['end'], $notice['start'], $notice['name']);
@@ -725,7 +736,7 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
725
  if( $ch = curl_init() ) {
726
  $plugins = array();
727
  if( ! empty($_POST['plugin']) ) {
728
- $plugins[] = $_POST['plugin'];
729
  }
730
  $plugins = apply_filters('berocket_admin_notices_subscribe_plugins', $plugins);
731
  $plugins = array_unique($plugins);
@@ -733,7 +744,7 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
733
  update_option('berocket_email_subscribed', true);
734
  curl_setopt($ch, CURLOPT_URL,"http://berocket.com/main/subscribe");
735
  curl_setopt($ch, CURLOPT_POST, 1);
736
- curl_setopt($ch, CURLOPT_POSTFIELDS, "email=" . $_POST['email'] . "&plugins=" . $plugins);
737
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
738
  echo curl_exec ($ch);
739
  curl_close ($ch);
@@ -758,30 +769,4 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
758
  add_action( 'wp_ajax_berocket_admin_close_notice', array('berocket_admin_notices', 'close_notice') );
759
  add_action( 'wp_ajax_berocket_subscribe_email', array('berocket_admin_notices', 'subscribe') );
760
  }
761
-
762
- /**
763
- * Creating admin notice if it not added already
764
- */
765
- new berocket_admin_notices(array(
766
- 'start' => 1511281980, // timestamp when notice start
767
- 'end' => 1514764803, // timestamp when notice end
768
- 'name' => 'SALE_LOAD_MORE2', //notice name must be unique for this time period
769
- 'html' => 'Only <strong>$10</strong> for <strong>Premium</strong> WooCommerce Load More Products!
770
- <a class="berocket_button" href="http://berocket.com/product/woocommerce-load-more-products" target="_blank">Buy Now</a>
771
- &nbsp; <span>Get your <strong class="red">60% discount</strong> and save <strong>$15</strong> today</span>
772
- ', //text or html code as content of notice
773
- 'righthtml' => '<a class="berocket_no_thanks">No thanks</a>', //content in the right block, this is default value. This html code must be added to all notices
774
- 'rightwidth' => 80, //width of right content is static and will be as this value. berocket_no_thanks block is 60px and 20px is additional
775
- 'nothankswidth' => 60, //berocket_no_thanks width. set to 0 if block doesn't uses. Or set to any other value if uses other text inside berocket_no_thanks
776
- 'contentwidth' => 910, //width that uses for mediaquery is image + contentwidth + rightwidth + 210 other elements
777
- 'subscribe' => false, //add subscribe form to the righthtml
778
- 'priority' => 7, //priority of notice. 1-5 is main priority and displays on settings page always
779
- 'height' => 50, //height of notice. image will be scaled
780
- 'repeat' => '+1 week', //repeat notice after some time. time can use any values that accept function strtotime
781
- 'repeatcount' => 4, //repeat count. how many times notice will be displayed after close
782
- 'image' => array(
783
- 'local' => plugin_dir_url( __FILE__ ) . '../images/60p_sale.jpg', //notice will be used this image directly
784
- ),
785
- ));
786
-
787
  ?>
21
  //delete_option('berocket_admin_notices'); //remove all notice information
22
  //delete_option('berocket_last_close_notices_time'); //remove wait time before next notice
23
  if( ! class_exists( 'berocket_admin_notices' ) ) {
24
+ /**
25
+ * Class berocket_admin_notices
26
+ */
27
+
28
  class berocket_admin_notices {
29
  public $find_names, $notice_exist = false;
30
  public static $last_time = '-24 hours';
34
  public static $styles_exist = false;
35
  public static $notice_index = 0;
36
  public static $default_notice_options = array(
37
+ 'start' => 0,
38
+ 'end' => 0,
39
+ 'name' => 'sale',
40
+ 'html' => '',
41
+ 'righthtml' => '<a class="berocket_no_thanks">No thanks</a>',
42
+ 'rightwidth' => 80,
43
+ 'nothankswidth' => 60,
44
+ 'contentwidth' => 400,
45
+ 'subscribe' => false,
46
+ 'closed' => '0',
47
+ 'priority' => 20,
48
+ 'height' => 50,
49
+ 'repeat' => false,
50
+ 'repeatcount' => 1,
51
+ 'image' => array(
52
+ 'global' => 'http://berocket.com/images/logo-2.png'
53
+ ),
54
+ );
55
  function __construct($options = array()) {
56
  if( ! is_admin() ) return;
57
  $options = array_merge(self::$default_notice_options, $options);
177
  file_put_contents($img_local, file_get_contents($url_global));
178
  }
179
  if( file_exists($img_local) ) {
 
180
  $options['image']['local'] = $url_local;
181
  $options['image']['pathlocal'] = $img_local;
182
  } else {
183
  $options['image']['local'] = $url_global;
184
+ $file_exist = true;
185
  }
186
  }
187
+ }
188
+ if( ! $file_exist ) {
189
  if( ! empty($options['image']['local']) ) {
190
  $img_local = $options['image']['local'];
191
  $img_local = str_replace(site_url('/'), '', $img_local);
289
  $notice = self::get_not_closed_notice($item, $end_soon, $closed, $count - 1);
290
  }
291
  } else {
292
+ if( $item['closed'] <= $closed && ( ! self::$subscribed || ! $item['subscribe'] ) && ($item['start'] == 0 || $item['start'] < $time) && ($item['end'] == 0 || $item['end'] > $time) ) {
293
  return $item;
294
  }
295
  }
312
  $notices = array_merge($notices, $notice);
313
  } else {
314
  if( ! self::$subscribed || ! $item['subscribe'] ) {
315
+ if( $item['priority'] <= 5 || ! $item['closed'] ) {
316
  $notices[] = $item;
317
  }
318
  }
319
  }
320
  }
 
321
  return $notices;
322
  }
323
  public static function display_admin_notice() {
330
  if( ! empty($notice['original']) ) {
331
  $original_notice = self::get_notice_by_path($notice['original']);
332
  unset($original_notice['start'], $original_notice['closed'], $original_notice['repeatcount']);
333
+ $notice = array_merge($notice, $original_notice);
334
  }
335
+
336
  if( $notice !== false ) {
337
  self::echo_notice($notice);
338
  }
340
  if( is_array($additional_notice) && count($additional_notice) > 0 ) {
341
  foreach($additional_notice as $notice) {
342
  if( is_array($notice) ) {
 
343
  self::echo_notice($notice);
344
  }
345
  }
346
  }
347
  }
348
  public static function echo_notice($notice) {
349
+ $notice = array_merge(self::$default_notice_options, $notice);
350
  $settings_page = apply_filters('is_berocket_settings_page', false);
351
  self::$notice_index++;
352
  $notice_data = array(
369
  $time = $time%60;
370
  $time_left_str .= sprintf("%02d", $minutes) . ":";
371
  }
372
+
373
  $time_left_str .= sprintf("%02d", $time);
374
  $notice['rightwidth'] += 60;
375
  $notice['righthtml'] .= '<div class="berocket_time_left_block">Left<br><span class="berocket_time_left" data-time="' . $time_left . '">' . $time_left_str . '</span></div>';
381
  } else {
382
  $user_email = '';
383
  }
384
+ $notice['righthtml'] =
385
+ '<form class="berocket_subscribe_form" method="POST" action="' . admin_url( 'admin-ajax.php' ) . '">
386
  <input type="hidden" name="action" value="berocket_subscribe_email">
387
  <input class="berocket_subscribe_email" type="email" name="email" value="' . $user_email . '">
388
  <input type="submit" class="button-primary button berocket_notice_submit" value="Subscribe">
391
  }
392
  echo '
393
  <div class="notice berocket_admin_notice berocket_admin_notice_', self::$notice_index, '" data-notice=\'', json_encode($notice_data), '\'>',
394
+ ( empty($notice['image']['local']) ? '' : '<img class="berocket_notice_img" src="' . $notice['image']['local'] . '">' ),
395
+ ( empty($notice['righthtml']) ? '' :
396
+ '<div class="berocket_notice_right_content">
397
  <div class="berocket_notice_content">' . $notice['righthtml'] . '</div>
398
  <div class="berocket_notice_after_content"></div>
399
  </div>' ),
400
+ '<div class="berocket_notice_content_wrap">
401
  <div class="berocket_notice_content">', $notice['html'], '</div>
402
  <div class="berocket_notice_after_content"></div>
403
  </div></div>';
432
  text-align: center;
433
  }
434
  .berocket_admin_notice.berocket_admin_notice_', self::$notice_index, ' .berocket_notice_right_content {',
435
+ ( $notice['rightwidth'] <= 20 ? ' display: none' :
436
+ 'height: ' . $notice['height'] . 'px;
437
  float: right;
438
  width: ' . $notice['rightwidth'] . 'px;
439
  -webkit-box-shadow: box-shadow: -1px 0 0 0 rgba(0, 0, 0, 0.1);
440
  box-shadow: -1px 0 0 0 rgba(0, 0, 0, 0.1);
441
  padding-left: 10px;' ),
442
+ '}
443
  .berocket_admin_notice.berocket_admin_notice_', self::$notice_index, ' .berocket_no_thanks {',
444
+ ( $settings_page && $notice['priority'] <= 5 ? 'display: none!important;' : 'cursor: pointer;
445
  color: #0073aa;
446
  opacity: 0.5;
447
  display: inline-block;' ),
448
+ '}
449
  ', ( empty($notice['subscribe']) ? '' : '
450
  .berocket_admin_notice.berocket_admin_notice_' . self::$notice_index . ' .berocket_subscribe_form {
451
  display: inline-block;
689
  event.preventDefault();
690
  jQuery(this).parents(".berocket_subscribe_form").trigger("berocket_subscribe_send");
691
  });
692
+
693
  </script>';
694
  }
695
  }
696
  public static function close_notice($notice = FALSE) {
697
  self::$subscribed = get_option('berocket_email_subscribed');
698
  if( ( $notice == FALSE || ! is_array($notice) ) && ! empty($_POST['notice']) ) {
699
+ $notice = sanitize_textarea_field($_POST['notice']);
700
  }
701
+ if (empty($notice) || ! is_array($notice)
702
+ || (empty($notice['start']) && $notice['start'] !== '0')
703
+ || (empty($notice['end']) && $notice['end'] !== '0')
704
+ || (empty($notice['priority']) && $notice['priority'] !== '0')
705
+ || (empty($notice['name'])) ) {
706
+ $notice = self::get_notice();
707
+ }
708
+ if( empty($notice) || ! is_array($notice) ) {
709
  wp_die();
710
  }
711
  $find_names = array($notice['priority'], $notice['end'], $notice['start'], $notice['name']);
736
  if( $ch = curl_init() ) {
737
  $plugins = array();
738
  if( ! empty($_POST['plugin']) ) {
739
+ $plugins[] = sanitize_textarea_field($_POST['plugin']);
740
  }
741
  $plugins = apply_filters('berocket_admin_notices_subscribe_plugins', $plugins);
742
  $plugins = array_unique($plugins);
744
  update_option('berocket_email_subscribed', true);
745
  curl_setopt($ch, CURLOPT_URL,"http://berocket.com/main/subscribe");
746
  curl_setopt($ch, CURLOPT_POST, 1);
747
+ curl_setopt($ch, CURLOPT_POSTFIELDS, "email=" . sanitize_email($_POST['email']) . "&plugins=" . $plugins);
748
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
749
  echo curl_exec ($ch);
750
  curl_close ($ch);
769
  add_action( 'wp_ajax_berocket_admin_close_notice', array('berocket_admin_notices', 'close_notice') );
770
  add_action( 'wp_ajax_berocket_subscribe_email', array('berocket_admin_notices', 'subscribe') );
771
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
  ?>
includes/functions.php CHANGED
@@ -32,6 +32,34 @@ if( ! function_exists( 'br_woocommerce_version_check' ) ){
32
  }
33
  }
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  if( ! function_exists( 'br_get_template_part' ) ){
36
  /**
37
  * Public function to get plugin's template
@@ -55,6 +83,8 @@ if( ! function_exists( 'br_aapf_get_attributes' ) ) {
55
  $attribute_taxonomies = wc_get_attribute_taxonomies();
56
  $attributes = array();
57
 
 
 
58
  if ( $attribute_taxonomies ) {
59
  foreach ( $attribute_taxonomies as $tax ) {
60
  $attributes[ wc_attribute_taxonomy_name( $tax->attribute_name ) ] = $tax->attribute_label;
@@ -196,7 +226,6 @@ if( ! function_exists( 'br_aapf_args_parser' ) ){
196
  if ( ! empty($_POST['orderby']) ) {
197
  br_aapf_parse_order_by( $args );
198
  }
199
-
200
  return $args;
201
  }
202
  }
@@ -237,7 +266,7 @@ if( ! function_exists( 'br_aapf_args_converter' ) ) {
237
  } else {
238
  if ( $operator ) {
239
  foreach ( $value as $v ) {
240
- $_POST['terms'][] = array( "pa_" . $attribute, $v, $operator );
241
  }
242
  } else {
243
  $_POST['limits'][] = array( "pa_" . $attribute, $min, $max );
32
  }
33
  }
34
 
35
+ if( ! function_exists( 'br_get_value_from_array' ) ){
36
+ function br_get_value_from_array(&$arr, $index, $default = '') {
37
+ if( ! isset($arr) || ! is_array($arr) ) {
38
+ return $default;
39
+ }
40
+ $array = $arr;
41
+ if( ! is_array($index) ) {
42
+ $index = array($index);
43
+ }
44
+ foreach($index as $i) {
45
+ if( ! isset($array[$i]) ) {
46
+ return $default;
47
+ } else {
48
+ $array = $array[$i];
49
+ }
50
+ }
51
+ return $array;
52
+ }
53
+ }
54
+ if( ! function_exists( 'berocket_isset' ) ){
55
+ function berocket_isset(&$var, $property_name = false, $default = null) {
56
+ if( $property_name === false ) {
57
+ return ( isset($var) ? $var : $default );
58
+ } else {
59
+ return ( isset($var) ? ( property_exists($var, $property_name) ? $var->$property_name : $default ) : $default );
60
+ }
61
+ }
62
+ }
63
  if( ! function_exists( 'br_get_template_part' ) ){
64
  /**
65
  * Public function to get plugin's template
83
  $attribute_taxonomies = wc_get_attribute_taxonomies();
84
  $attributes = array();
85
 
86
+ $category = get_taxonomy('product_cat');
87
+ $attributes['product_cat'] = $category->label;
88
  if ( $attribute_taxonomies ) {
89
  foreach ( $attribute_taxonomies as $tax ) {
90
  $attributes[ wc_attribute_taxonomy_name( $tax->attribute_name ) ] = $tax->attribute_label;
226
  if ( ! empty($_POST['orderby']) ) {
227
  br_aapf_parse_order_by( $args );
228
  }
 
229
  return $args;
230
  }
231
  }
266
  } else {
267
  if ( $operator ) {
268
  foreach ( $value as $v ) {
269
+ $_POST['terms'][] = array( ($attribute == 'product_cat' ? $attribute : "pa_" . $attribute), $v, $operator );
270
  }
271
  } else {
272
  $_POST['limits'][] = array( "pa_" . $attribute, $min, $max );
includes/widget.php CHANGED
@@ -78,14 +78,18 @@ class BeRocket_AAPF_Widget extends WP_Widget {
78
  if ( is_product_taxonomy() ) {
79
  $product_taxonomy = $wp_query->query_vars['taxonomy'].'|'.$wp_query->query_vars['term'];
80
  }
81
-
 
 
 
 
82
  wp_localize_script(
83
  'berocket_aapf_widget-script',
84
  'the_ajax_script',
85
  array(
86
  'version' => BeRocket_AJAX_filters_version,
87
  'current_language' => $current_language,
88
- 'current_page_url' => preg_replace( "~paged?/[0-9]+/?~", "", home_url( $wp->request ) ),
89
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
90
  'product_cat' => $wp_query_product_cat,
91
  'product_taxonomy' => $product_taxonomy,
@@ -102,8 +106,10 @@ class BeRocket_AAPF_Widget extends WP_Widget {
102
  'default_sorting' => get_option('woocommerce_default_catalog_orderby'),
103
  'first_page' => ( isset($br_options['first_page_jump']) ? $br_options['first_page_jump'] : '' ),
104
  'scroll_shop_top' => ( isset($br_options['scroll_shop_top']) ? $br_options['scroll_shop_top'] : '' ),
105
- 'hide_sel_value' => ( isset($br_options['hide_value']['sel']) ? $br_options['hide_value']['sel'] : '' ),
 
106
  'ajax_request_load' => ( isset($br_options['ajax_request_load']) ? $br_options['ajax_request_load'] : '' ),
 
107
  'ajax_request_load_style' => ( isset($br_options['ajax_request_load_style']) ? $br_options['ajax_request_load_style'] : BeRocket_AAPF::$defaults['ajax_request_load_style'] ),
108
  's' => ( isset($_GET['s']) ? $_GET['s'] : '' ),
109
  )
@@ -130,10 +136,9 @@ class BeRocket_AAPF_Widget extends WP_Widget {
130
  $hide_widget = true;
131
 
132
  $cur_cat = get_term_by( 'slug', $wp_query_product_cat, 'product_cat' );
133
- $cur_cat_ancestors = get_ancestors( $cur_cat->term_id, 'product_cat' );
134
- $cur_cat_ancestors[] = $cur_cat->term_id;
135
-
136
- if( $product_cat ) {
137
  if ( $cat_propagation ) {
138
  foreach ( $product_cat as $cat ) {
139
  $cat = get_term_by( 'slug', $cat, 'product_cat' );
@@ -292,6 +297,13 @@ class BeRocket_AAPF_Widget extends WP_Widget {
292
  }
293
  set_query_var( 'first_page_jump', ( isset($first_page_jump) ? $first_page_jump : '' ) );
294
 
 
 
 
 
 
 
 
295
  br_get_template_part( $type );
296
 
297
  br_get_template_part('widget_end');
@@ -605,6 +617,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
605
  $instance['product_cat'] = ( $new_instance['product_cat'] ) ? json_encode( $new_instance['product_cat'] ) : '';
606
  $instance['scroll_theme'] = strip_tags( $new_instance['scroll_theme'] );
607
  $instance['cat_propagation'] = (int) $new_instance['cat_propagation'];
 
608
  $instance['css_class'] = strip_tags( $new_instance['css_class'] );
609
  $instance['text_before_price'] = strip_tags( $new_instance['text_before_price'] );
610
  $instance['text_after_price'] = strip_tags( $new_instance['text_after_price'] );
@@ -699,6 +712,9 @@ class BeRocket_AAPF_Widget extends WP_Widget {
699
  }
700
  if( isset($_POST['s']) && strlen($_POST['s']) > 0 ) {
701
  $args['s'] = $_POST['s'];
 
 
 
702
  }
703
  $wp_query = new WP_Query( $args );
704
 
@@ -707,6 +723,10 @@ class BeRocket_AAPF_Widget extends WP_Widget {
707
  $args['paged'] = min( $mathces[1], $wp_query->max_num_pages );
708
  $wp_query = new WP_Query( $args );
709
  }
 
 
 
 
710
  //echo '<pre>', print_r($wp_query, true), '</pre>';
711
  unset( $args );
712
 
@@ -714,11 +734,12 @@ class BeRocket_AAPF_Widget extends WP_Widget {
714
  ob_start();
715
 
716
  if ( $wp_query->have_posts() ) {
717
-
718
  do_action('woocommerce_before_shop_loop');
719
 
720
  woocommerce_product_loop_start();
721
- woocommerce_product_subcategories();
 
 
722
 
723
  while ( have_posts() ) {
724
  the_post();
78
  if ( is_product_taxonomy() ) {
79
  $product_taxonomy = $wp_query->query_vars['taxonomy'].'|'.$wp_query->query_vars['term'];
80
  }
81
+ $current_page_url = preg_replace( "~paged?/[0-9]+/?~", "", home_url( $wp->request ) );
82
+ if( strpos($current_page_url, '?') !== FALSE ) {
83
+ $current_page_url = explode('?', $current_page_url);
84
+ $current_page_url = $current_page_url[0];
85
+ }
86
  wp_localize_script(
87
  'berocket_aapf_widget-script',
88
  'the_ajax_script',
89
  array(
90
  'version' => BeRocket_AJAX_filters_version,
91
  'current_language' => $current_language,
92
+ 'current_page_url' => $current_page_url,
93
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
94
  'product_cat' => $wp_query_product_cat,
95
  'product_taxonomy' => $product_taxonomy,
106
  'default_sorting' => get_option('woocommerce_default_catalog_orderby'),
107
  'first_page' => ( isset($br_options['first_page_jump']) ? $br_options['first_page_jump'] : '' ),
108
  'scroll_shop_top' => ( isset($br_options['scroll_shop_top']) ? $br_options['scroll_shop_top'] : '' ),
109
+ 'hide_sel_value' => ! empty($br_options['hide_value']['sel']),
110
+ 'use_select2' => ! empty($br_options['use_select2']),
111
  'ajax_request_load' => ( isset($br_options['ajax_request_load']) ? $br_options['ajax_request_load'] : '' ),
112
+ 'use_request_method' => ( ! empty($br_options['ajax_request_load']) && ! empty($br_options['use_get_query']) ? 'get' : 'post' ),
113
  'ajax_request_load_style' => ( isset($br_options['ajax_request_load_style']) ? $br_options['ajax_request_load_style'] : BeRocket_AAPF::$defaults['ajax_request_load_style'] ),
114
  's' => ( isset($_GET['s']) ? $_GET['s'] : '' ),
115
  )
136
  $hide_widget = true;
137
 
138
  $cur_cat = get_term_by( 'slug', $wp_query_product_cat, 'product_cat' );
139
+ if( ! empty($cur_cat) ) {
140
+ $cur_cat_ancestors = get_ancestors( $cur_cat->term_id, 'product_cat' );
141
+ $cur_cat_ancestors[] = $cur_cat->term_id;
 
142
  if ( $cat_propagation ) {
143
  foreach ( $product_cat as $cat ) {
144
  $cat = get_term_by( 'slug', $cat, 'product_cat' );
297
  }
298
  set_query_var( 'first_page_jump', ( isset($first_page_jump) ? $first_page_jump : '' ) );
299
 
300
+ if( $type == 'select' ) {
301
+ if( ! empty($br_options['use_select2']) ) {
302
+ wp_enqueue_style( 'select2' );
303
+ wp_enqueue_script( 'select2' );
304
+ }
305
+ set_query_var('select_multiple', ! empty($select_multiple));
306
+ }
307
  br_get_template_part( $type );
308
 
309
  br_get_template_part('widget_end');
617
  $instance['product_cat'] = ( $new_instance['product_cat'] ) ? json_encode( $new_instance['product_cat'] ) : '';
618
  $instance['scroll_theme'] = strip_tags( $new_instance['scroll_theme'] );
619
  $instance['cat_propagation'] = (int) $new_instance['cat_propagation'];
620
+ $instance['select_multiple'] = (int) $new_instance['select_multiple'];
621
  $instance['css_class'] = strip_tags( $new_instance['css_class'] );
622
  $instance['text_before_price'] = strip_tags( $new_instance['text_before_price'] );
623
  $instance['text_after_price'] = strip_tags( $new_instance['text_after_price'] );
712
  }
713
  if( isset($_POST['s']) && strlen($_POST['s']) > 0 ) {
714
  $args['s'] = $_POST['s'];
715
+ if( function_exists('wc_set_loop_prop') ) {
716
+ wc_set_loop_prop( 'is_search', 1 );
717
+ }
718
  }
719
  $wp_query = new WP_Query( $args );
720
 
723
  $args['paged'] = min( $mathces[1], $wp_query->max_num_pages );
724
  $wp_query = new WP_Query( $args );
725
  }
726
+
727
+ if( class_exists('WC_Query') && method_exists('WC_Query', 'product_query') ) {
728
+ wc()->query->product_query($wp_query);
729
+ }
730
  //echo '<pre>', print_r($wp_query, true), '</pre>';
731
  unset( $args );
732
 
734
  ob_start();
735
 
736
  if ( $wp_query->have_posts() ) {
 
737
  do_action('woocommerce_before_shop_loop');
738
 
739
  woocommerce_product_loop_start();
740
+ if( ! function_exists('woocommerce_maybe_show_product_subcategories') ) {
741
+ woocommerce_product_subcategories();
742
+ }
743
 
744
  while ( have_posts() ) {
745
  the_post();
includes/wizard.php ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_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_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_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_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_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 (BETA)', 'BeRocket_AJAX_domain') ?></th>
68
+ <td>
69
+ <?php echo BeRocket_wizard_generate_autoselectors(array(
70
+ 'products' => '.berocket_aapf_products_selector',
71
+ 'pagination' => '.berocket_aapf_pagination_selector',
72
+ 'result_count' => '.berocket_aapf_product_count_selector')); ?>
73
+ <div>
74
+ <?php _e('Please do not use it on live sites. If something went wrong write us.', 'BeRocket_AJAX_domain') ?>
75
+ </div>
76
+ </td>
77
+ </tr>
78
+ <tr style="display: table-row;">
79
+ <th scope="row">Products Container Selector</th>
80
+ <td><label>
81
+ <input type="text" name="berocket_aapf_wizard_settings[products_holder_id]"
82
+ value="<?php if( ! empty($option['products_holder_id']) ) echo $option['products_holder_id']; ?>"
83
+ class="berocket_aapf_products_selector">
84
+ </label></td>
85
+ </tr>
86
+ <tr style="display: table-row;">
87
+ <th scope="row">Pagination Selector</th>
88
+ <td><label>
89
+ <input type="text" name="berocket_aapf_wizard_settings[woocommerce_pagination_class]"
90
+ value="<?php if( ! empty($option['woocommerce_pagination_class']) ) echo $option['woocommerce_pagination_class']; ?>"
91
+ class="berocket_aapf_pagination_selector">
92
+ </label></td>
93
+ </tr>
94
+ <tr style="display: table-row;">
95
+ <th scope="row"><?php _e('Product count selector', 'BeRocket_AJAX_domain') ?></th>
96
+ <td><label>
97
+ <input type="text" name="berocket_aapf_wizard_settings[woocommerce_result_count_class]"
98
+ value="<?php if( ! empty($option['woocommerce_result_count_class']) ) echo $option['woocommerce_result_count_class']; ?>"
99
+ class="berocket_aapf_product_count_selector">
100
+ </label></td>
101
+ </tr>
102
+ <tr style="display: table-row;">
103
+ <th scope="row"><?php _e('Product order by selector', 'BeRocket_AJAX_domain') ?></th>
104
+ <td><label>
105
+ <input type="text" name="berocket_aapf_wizard_settings[woocommerce_ordering_class]"
106
+ value="<?php if( ! empty($option['woocommerce_ordering_class']) ) echo $option['woocommerce_ordering_class']; ?>"
107
+ class="">
108
+ </label></td>
109
+ </tr>
110
+ <tr style="display: table-row;">
111
+ <td colspan="2">
112
+ <a href="#custom-js-css" class="wizard_custom_js_css_open"><?php _e('You need some custom JavaScript/CSS code?', 'BeRocket_AJAX_domain') ?></a>
113
+ <div class="wizard_custom_js_css" style="display: none;">
114
+ <h3><?php _e('User custom CSS style', 'BeRocket_AJAX_domain') ?></h3>
115
+ <textarea name="berocket_aapf_wizard_settings[user_custom_css]"><?php echo br_get_value_from_array($option, array('user_custom_css')) ?></textarea>
116
+ <h3><?php _e('JavaScript Before Products Update', 'BeRocket_AJAX_domain') ?></h3>
117
+ <textarea name="berocket_aapf_wizard_settings[user_func][before_update]"><?php echo br_get_value_from_array($option, array('user_func', 'before_update')) ?></textarea>
118
+ <h3><?php _e('JavaScript On Products Update', 'BeRocket_AJAX_domain') ?></h3>
119
+ <textarea name="berocket_aapf_wizard_settings[user_func][on_update]"><?php echo br_get_value_from_array($option, array('user_func', 'on_update')) ?></textarea>
120
+ <h3><?php _e('JavaScript After Products Update', 'BeRocket_AJAX_domain') ?></h3>
121
+ <textarea name="berocket_aapf_wizard_settings[user_func][after_update]"><?php echo br_get_value_from_array($option, array('user_func', 'after_update')) ?></textarea>
122
+ </div>
123
+ </td>
124
+ </tr>
125
+ </tbody>
126
+ </table>
127
+ </div>
128
+ <script>
129
+ jQuery(document).on('click', '.wizard_custom_js_css_open', function(event) {
130
+ event.preventDefault();
131
+ jQuery(this).hide();
132
+ jQuery('.wizard_custom_js_css').show();
133
+ });
134
+ </script>
135
+ <?php wp_nonce_field( $wizard->page_id ); ?>
136
+ <p class="next-step">
137
+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
138
+ </p>
139
+ </form>
140
+ <?php
141
+ }
142
+
143
+ public static function wizard_selectors_save($wizard) {
144
+ check_admin_referer( $wizard->page_id );
145
+ $option = BeRocket_AAPF::get_aapf_option();
146
+ if( ! empty($_POST['berocket_aapf_wizard_settings']) && is_array($_POST['berocket_aapf_wizard_settings']) ) {
147
+ $new_option = array_merge(
148
+ array('woocommerce_removes' => array('pagination' => '', 'result_count' => '', 'ordering' => '')),
149
+ $_POST['berocket_aapf_wizard_settings']
150
+ );
151
+ $option = array_merge($option, $new_option);
152
+ }
153
+ $option = BeRocket_AAPF::sanitize_aapf_option($option);
154
+ update_option( 'br_filters_options', $option );
155
+ $wizard->redirect_to_next_step();
156
+ }
157
+
158
+ public static function wizard_permalinks($wizard) {
159
+ $option = BeRocket_AAPF::get_aapf_option();
160
+ ?>
161
+ <form method="post" class="br_framework_submit_form">
162
+ <div class="nav-block berocket_framework_menu_general-block nav-block-active">
163
+ <table class="framework-form-table berocket_framework_menu_selectors">
164
+ <tbody>
165
+ <tr style="display: table-row;">
166
+ <th scope="row"><?php _e('SEO friendly URLs', 'BeRocket_AJAX_domain') ?></th>
167
+ <td>
168
+ <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'?>>
169
+ <?php _e('Page URL will be changed after filtering.', 'BeRocket_AJAX_domain') ?>
170
+ </td>
171
+ </tr>
172
+ <tr style="display: table-row;">
173
+ <td colspan="2">
174
+ <p><?php _e('Without this option after page reload filter will be unselected', 'BeRocket_AJAX_domain') ?></p>
175
+ <p><?php _e('Also back button doesn\'t load previous selected filters', 'BeRocket_AJAX_domain') ?></p>
176
+ </td>
177
+ </tr>
178
+ </tbody>
179
+ </table>
180
+ </div>
181
+ <?php wp_nonce_field( $wizard->page_id ); ?>
182
+ <p class="next-step">
183
+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
184
+ </p>
185
+ </form>
186
+ <?php
187
+ }
188
+
189
+ public static function wizard_permalinks_save($wizard) {
190
+ check_admin_referer( $wizard->page_id );
191
+ $option = BeRocket_AAPF::get_aapf_option();
192
+ if( empty($_POST['berocket_aapf_wizard_settings']) || ! is_array($_POST['berocket_aapf_wizard_settings']) ) {
193
+ $_POST['berocket_aapf_wizard_settings'] = array();
194
+ }
195
+ $option_new = array_merge(array('seo_friendly_urls' => ''), $_POST['berocket_aapf_wizard_settings']);
196
+ $option = array_merge($option, $option_new);
197
+ $option = BeRocket_AAPF::sanitize_aapf_option($option);
198
+ update_option( 'br_filters_options', $option );
199
+ $wizard->redirect_to_next_step();
200
+ }
201
+
202
+ public static function wizard_count_reload($wizard) {
203
+ $option = BeRocket_AAPF::get_aapf_option();
204
+ ?>
205
+ <form method="post" class="br_framework_submit_form">
206
+ <div class="nav-block berocket_framework_menu_general-block nav-block-active">
207
+ <table class="framework-form-table berocket_framework_menu_selectors">
208
+ <tbody>
209
+ <tr style="display: table-row;">
210
+ <th scope="row"><?php _e('Presets', 'BeRocket_AJAX_domain') ?></th>
211
+ <td>
212
+ <p><?php _e('You can select some preset or setup each settings manually', 'BeRocket_AJAX_domain') ?></p>
213
+ <select class="attribute_count_preset">
214
+ <option value="custom"><?php _e('Custom', 'BeRocket_AJAX_domain') ?></option>
215
+ <option value="show_all"><?php _e('Show all attributes (very fast)', 'BeRocket_AJAX_domain') ?></option>
216
+ <option value="hide_page"><?php _e('Hide empty attributes by page (fast)', 'BeRocket_AJAX_domain') ?></option>
217
+ </select>
218
+ </td>
219
+ </tr>
220
+ <tr class="attribute_count_preset_info attribute_count_preset_info_show_all" style="display: none;" data-count="1">
221
+ <td colspan="2">
222
+ <h4><?php _e('Show all attributes', 'BeRocket_AJAX_domain') ?></h4>
223
+ <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>
224
+ </td>
225
+ </tr>
226
+ <tr class="attribute_count_preset_info attribute_count_preset_info_hide_page" style="display: none;" data-count="26">
227
+ <td colspan="2">
228
+ <h4><?php _e('Hide empty attributes by page', 'BeRocket_AJAX_domain') ?></h4>
229
+ <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>
230
+ </td>
231
+ </tr>
232
+ <tr style="display: table-row;">
233
+ <th scope="row"><?php _e('Show all values', 'BeRocket_AJAX_domain') ?></th>
234
+ <td>
235
+ <label><input name="berocket_aapf_wizard_settings[show_all_values]" class="attribute_count_preset_1" type="checkbox" value="1"
236
+ <?php if( ! empty($option['show_all_values']) ) echo " checked"; ?>>
237
+ <?php _e('Check if you want to show not used attribute values too', 'BeRocket_AJAX_domain') ?>
238
+ </label>
239
+ </td>
240
+ </tr>
241
+ <tr style="display: table-row;">
242
+ <td colspan="2">
243
+ <?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') ?>
244
+ </td>
245
+ </tr>
246
+ <tr style="display: table-row;">
247
+ <th scope="row"><?php _e('Hide values', 'BeRocket_AJAX_domain') ?></th>
248
+ <td>
249
+ <div><label><input name="berocket_aapf_wizard_settings[hide_value][o]" class="attribute_count_preset_2" type="checkbox" value="1"
250
+ <?php if( ! empty($option['hide_value']['o']) ) echo " checked"; ?>>
251
+ <?php _e('Hide values without products', 'BeRocket_AJAX_domain') ?>
252
+ </label></div>
253
+ <div><label><input name="berocket_aapf_wizard_settings[hide_value][sel]" class="attribute_count_preset_4" type="checkbox" value="1"
254
+ <?php if( ! empty($option['hide_value']['sel']) ) echo " checked"; ?>>
255
+ <?php _e('Hide selected values', 'BeRocket_AJAX_domain') ?>
256
+ </label></div>
257
+ </td>
258
+ </tr>
259
+ </tbody>
260
+ </table>
261
+ </div>
262
+ <script>
263
+ jQuery(document).on('change', '.attribute_count_preset', function() {
264
+ jQuery('.attribute_count_preset_info').hide();
265
+ jQuery('.attribute_count_preset_info_'+jQuery(this).val()).show();
266
+ var data_count = jQuery('.attribute_count_preset_info_'+jQuery(this).val()).data('count');
267
+ if( data_count ) {
268
+ var data_counts = [32,16,8,4,2,1];
269
+ data_counts.forEach(function( item, i, arr) {
270
+ if( data_count >= item ) {
271
+ jQuery('.attribute_count_preset_'+item).prop('checked', true);
272
+ data_count = data_count - item;
273
+ } else {
274
+ jQuery('.attribute_count_preset_'+item).prop('checked', false);
275
+ }
276
+ });
277
+ }
278
+ });
279
+ 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() {
280
+ jQuery('.attribute_count_preset').val('custom').trigger('change');
281
+ });
282
+ </script>
283
+ <?php wp_nonce_field( $wizard->page_id ); ?>
284
+ <p class="next-step">
285
+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
286
+ </p>
287
+ </form>
288
+ <?php
289
+ }
290
+
291
+ public static function wizard_count_reload_save($wizard) {
292
+ check_admin_referer( $wizard->page_id );
293
+ $option = BeRocket_AAPF::get_aapf_option();
294
+ if( empty($_POST['berocket_aapf_wizard_settings']) || ! is_array($_POST['berocket_aapf_wizard_settings']) ) {
295
+ $_POST['berocket_aapf_wizard_settings'] = array();
296
+ }
297
+ $option_new = array_merge(array('show_all_values' => '', 'hide_value' => array('o' => '', 'sel' => '')), $_POST['berocket_aapf_wizard_settings']);
298
+ $option = array_merge($option, $option_new);
299
+ $option = BeRocket_AAPF::sanitize_aapf_option($option);
300
+ update_option( 'br_filters_options', $option );
301
+ $wizard->redirect_to_next_step();
302
+ }
303
+
304
+ public static function wizard_extra($wizard) {
305
+ $option = BeRocket_AAPF::get_aapf_option();
306
+ ?>
307
+ <form method="post" class="br_framework_submit_form">
308
+ <div class="nav-block berocket_framework_menu_general-block nav-block-active">
309
+ <table class="framework-form-table berocket_framework_menu_selectors">
310
+ <tbody>
311
+ <tr style="display: table-row;">
312
+ <th scope="row"><?php _e('Jump to first page', 'BeRocket_AJAX_domain') ?></th>
313
+ <td>
314
+ <label><input name="berocket_aapf_wizard_settings[first_page_jump]" type="checkbox" value="1"
315
+ <?php if( ! empty($option['first_page_jump']) ) echo " checked"; ?>>
316
+ <?php _e('Load first page after any filter changes. Can fix some problem with "no products" message after filtering', 'BeRocket_AJAX_domain') ?>
317
+ </label>
318
+ </td>
319
+ </tr>
320
+ <tr style="display: table-row;">
321
+ <th scope="row"><?php _e('Scroll page to the top', 'BeRocket_AJAX_domain') ?></th>
322
+ <td>
323
+ <label><input name="berocket_aapf_wizard_settings[scroll_shop_top]" type="checkbox" value="1"
324
+ <?php if( ! empty($option['scroll_shop_top']) ) echo " checked"; ?>>
325
+ <?php _e('Check if you want scroll page to the top of shop after filters change', 'BeRocket_AJAX_domain') ?>
326
+ </label>
327
+ </td>
328
+ </tr>
329
+ </tbody>
330
+ </table>
331
+ </div>
332
+ <script>
333
+ </script>
334
+ <?php wp_nonce_field( $wizard->page_id ); ?>
335
+ <p class="next-step">
336
+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Next Step", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
337
+ </p>
338
+ </form>
339
+ <?php
340
+ }
341
+
342
+ public static function wizard_extra_save($wizard) {
343
+ check_admin_referer( $wizard->page_id );
344
+ $option = BeRocket_AAPF::get_aapf_option();
345
+ if( empty($_POST['berocket_aapf_wizard_settings']) || ! is_array($_POST['berocket_aapf_wizard_settings']) ) {
346
+ $_POST['berocket_aapf_wizard_settings'] = array();
347
+ }
348
+ $option_new = array_merge(array('first_page_jump' => '', 'scroll_shop_top' => ''), $_POST['berocket_aapf_wizard_settings']);
349
+ $option = array_merge($option, $option_new);
350
+ $option = BeRocket_AAPF::sanitize_aapf_option($option);
351
+ update_option( 'br_filters_options', $option );
352
+ $wizard->redirect_to_next_step();
353
+ }
354
+
355
+ public static function wizard_ready($wizard) {
356
+ $option = BeRocket_AAPF::get_aapf_option();
357
+ ?>
358
+ <form method="post" class="br_framework_submit_form">
359
+ <div class="nav-block berocket_framework_menu_general-block nav-block-active">
360
+ <h2><?php _e('Plugin ready to use', 'BeRocket_AJAX_domain') ?></h2>
361
+ <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>
362
+ <h4><?php _e('Widget', 'BeRocket_AJAX_domain') ?></h4>
363
+ <p><?php _e('Now you can add widgets AJAX Product Filters to your side bar', 'BeRocket_AJAX_domain') ?></p>
364
+ <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>
365
+ </div>
366
+ <?php wp_nonce_field( $wizard->page_id ); ?>
367
+ <p class="next-step">
368
+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Open plugin settings", 'BeRocket_AJAX_domain' ); ?>" name="save_step" />
369
+ </p>
370
+ </form>
371
+ <?php
372
+ }
373
+
374
+ public static function wizard_ready_save($wizard) {
375
+ check_admin_referer( $wizard->page_id );
376
+ wp_redirect( admin_url( 'admin.php?page='.BeRocket_AAPF::$values['option_page'] ) );
377
+ }
378
+ }
379
+ new BeRocket_AAPF_Wizard();
js/admin.js CHANGED
@@ -12,6 +12,7 @@
12
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
13
  $('.berocket_aapf_widget_admin_price_attribute', $parent).hide(0);
14
  }
 
15
  });
16
 
17
  $(document).on('change', '.berocket_aapf_widget_admin_type_select', function () {
@@ -21,6 +22,11 @@
21
  } else {
22
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
23
  }
 
 
 
 
 
24
  });
25
 
26
  $(document).on('click', '.berocket_aapf_advanced_settings_pointer', function (event) {
@@ -63,4 +69,4 @@
63
  }
64
  });
65
  })
66
- })(jQuery);
12
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
13
  $('.berocket_aapf_widget_admin_price_attribute', $parent).hide(0);
14
  }
15
+ $('.berocket_aapf_widget_admin_type_select', $parent).trigger('change');
16
  });
17
 
18
  $(document).on('change', '.berocket_aapf_widget_admin_type_select', function () {
22
  } else {
23
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
24
  }
25
+ if ($(this).val() == 'select') {
26
+ $('.berocket_widget_multiple_select', $parent).show();
27
+ } else {
28
+ $('.berocket_widget_multiple_select', $parent).hide();
29
+ }
30
  });
31
 
32
  $(document).on('click', '.berocket_aapf_advanced_settings_pointer', function (event) {
69
  }
70
  });
71
  })
72
+ })(jQuery);
js/select2.min.js ADDED
@@ -0,0 +1 @@
 
1
+ /*! Select2 4.0.6-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k<a.length;k++)if("."===(m=a[k]))a.splice(k,1),k-=1;else if(".."===m){if(0===k||1===k&&".."===a[2]||".."===a[k-1])continue;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o<c.length;o+=1)if(n=p(c[o],t),"require"===(k=n.f))w[o]=q.require(a);else if("exports"===k)w[o]=q.exports(a),v=!0;else if("module"===k)h=w[o]=q.module(a);else if(e(r,k)||e(s,k)||e(u,k))w[o]=j(k);else{if(!n.p)throw new Error(a+" missing "+k);n.p.load(n.n,g(f,!0),i(k),{}),w[o]=r[k]}m=d?d.apply(r[a],w):void 0,a&&(h&&h.exports!==b&&h.exports!==r[a]?r[a]=h.exports:m===b&&v||(r[a]=m))}else a&&(r[a]=d)},a=c=o=function(a,c,d,e,f){if("string"==typeof a)return q[a]?q[a](c):j(p(a,l(c)).f);if(!a.splice){if(t=a,t.deps&&o(t.deps,t.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?n(b,a,c,d):setTimeout(function(){n(b,a,c,d)},4),o},o.config=function(a){return o(a)},a._defined=r,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(r,a)||e(s,a)||(s[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){"function"==typeof b[d]&&("constructor"!==d&&c.push(d))}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){return Array.prototype.unshift.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;c<d;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;c<a;c++){b+=Math.floor(36*Math.random()).toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c.__cache={};var e=0;return c.GetUniqueElementId=function(a){var b=a.getAttribute("data-select2-id");return null==b&&(a.id?(b=a.id,a.setAttribute("data-select2-id",b)):(a.setAttribute("data-select2-id",++e),b=e.toString())),b},c.StoreData=function(a,b,d){var e=c.GetUniqueElementId(a);c.__cache[e]||(c.__cache[e]={}),c.__cache[e][b]=d},c.GetData=function(b,d){var e=c.GetUniqueElementId(b);return d?c.__cache[e]&&null!=c.__cache[e][d]?c.__cache[e][d]:a(b).data(d):c.__cache[e]},c.RemoveData=function(a){var b=c.GetUniqueElementId(a);null!=c.__cache[b]&&delete c.__cache[b]},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){b.find(".select2-results").append(a)},c.prototype.sort=function(a){return this.options.get("sorter")(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var c=this;this.data.current(function(d){var e=a.map(d,function(a){return a.id.toString()});c.$results.find(".select2-results__option[aria-selected]").each(function(){var c=a(this),d=b.GetData(this,"data"),f=""+d.id;null!=d.element&&d.element.selected||null==d.element&&a.inArray(f,e)>-1?c.attr("aria-selected","true"):c.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(c){var d=document.createElement("li");d.className="select2-results__option";var e={role:"treeitem","aria-selected":"false"};c.disabled&&(delete e["aria-selected"],e["aria-disabled"]="true"),null==c.id&&delete e["aria-selected"],null!=c._resultId&&(d.id=c._resultId),c.title&&(d.title=c.title),c.children&&(e.role="group",e["aria-label"]=c.text,delete e["aria-selected"]);for(var f in e){var g=e[f];d.setAttribute(f,g)}if(c.children){var h=a(d),i=document.createElement("strong");i.className="select2-results__group";a(i);this.template(c,i);for(var j=[],k=0;k<c.children.length;k++){var l=c.children[k],m=this.option(l);j.push(m)}var n=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});n.append(j),h.append(i),h.append(n)}else this.template(c,d);return b.StoreData(d,"data",c),d},c.prototype.bind=function(c,d){var e=this,f=c.id+"-results";this.$results.attr("id",f),c.on("results:all",function(a){e.clear(),e.append(a.data),c.isOpen()&&(e.setClasses(),e.highlightFirstItem())}),c.on("results:append",function(a){e.append(a.data),c.isOpen()&&e.setClasses()}),c.on("query",function(a){e.hideMessages(),e.showLoading(a)}),c.on("select",function(){c.isOpen()&&(e.setClasses(),e.highlightFirstItem())}),c.on("unselect",function(){c.isOpen()&&(e.setClasses(),e.highlightFirstItem())}),c.on("open",function(){e.$results.attr("aria-expanded","true"),e.$results.attr("aria-hidden","false"),e.setClasses(),e.ensureHighlightVisible()}),c.on("close",function(){e.$results.attr("aria-expanded","false"),e.$results.attr("aria-hidden","true"),e.$results.removeAttr("aria-activedescendant")}),c.on("results:toggle",function(){var a=e.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),c.on("results:select",function(){var a=e.getHighlightedResults();if(0!==a.length){var c=b.GetData(a[0],"data");"true"==a.attr("aria-selected")?e.trigger("close",{}):e.trigger("select",{data:c})}}),c.on("results:previous",function(){var a=e.getHighlightedResults(),b=e.$results.find("[aria-selected]"),c=b.index(a);if(!(c<=0)){var d=c-1;0===a.length&&(d=0);var f=b.eq(d);f.trigger("mouseenter");var g=e.$results.offset().top,h=f.offset().top,i=e.$results.scrollTop()+(h-g);0===d?e.$results.scrollTop(0):h-g<0&&e.$results.scrollTop(i)}}),c.on("results:next",function(){var a=e.getHighlightedResults(),b=e.$results.find("[aria-selected]"),c=b.index(a),d=c+1;if(!(d>=b.length)){var f=b.eq(d);f.trigger("mouseenter");var g=e.$results.offset().top+e.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=e.$results.scrollTop()+h-g;0===d?e.$results.scrollTop(0):h>g&&e.$results.scrollTop(i)}}),c.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),c.on("results:message",function(a){e.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=e.$results.scrollTop(),c=e.$results.get(0).scrollHeight-b+a.deltaY,d=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=e.$results.height();d?(e.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(e.$results.scrollTop(e.$results.get(0).scrollHeight-e.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(c){var d=a(this),f=b.GetData(this,"data");if("true"===d.attr("aria-selected"))return void(e.options.get("multiple")?e.trigger("unselect",{originalEvent:c,data:f}):e.trigger("close",{}));e.trigger("select",{originalEvent:c,data:f})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(c){var d=b.GetData(this,"data");e.getHighlightedResults().removeClass("select2-results__option--highlighted"),e.trigger("results:focus",{data:d,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var c=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=b.GetData(this.$element[0],"old-tabindex")?this._tabindex=b.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),c.attr("title",this.$element.attr("title")),c.attr("tabindex",this._tabindex),this.$selection=c,c},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),window.setTimeout(function(){d.$selection.focus()},0),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(c){a(document.body).on("mousedown.select2."+c.id,function(c){var d=a(c.target),e=d.closest(".select2");a(".select2.select2-container--open").each(function(){a(this),this!=e[0]&&b.GetData(this,"element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()})},e.prototype.clear=function(){var a=this.$selection.find(".select2-selection__rendered");a.empty(),a.removeAttr("title")},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.attr("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,e){var f=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){f.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!f.options.get("disabled")){var d=a(this),e=d.parent(),g=c.GetData(e[0],"data");f.trigger("unselect",{originalEvent:b,data:g})}})},d.prototype.clear=function(){var a=this.$selection.find(".select2-selection__rendered");a.empty(),a.removeAttr("title")},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.attr("title",e.title||e.text),c.StoreData(f[0],"data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id;if(b.length>1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(a,b,c){function d(){}return d.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},d.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var d=this.$selection.find(".select2-selection__clear");if(0!==d.length){b.stopPropagation();var e=c.GetData(d[0],"data"),f=this.$element.val();this.$element.val(this.placeholder.id);var g={data:e};if(this.trigger("clear",g),g.prevented)return void this.$element.val(f);for(var h=0;h<e.length;h++)if(g={data:e[h]},this.trigger("unselect",g),g.prevented)return void this.$element.val(f);this.$element.trigger("change"),this.trigger("toggle",{})}}},d.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||c.which!=b.DELETE&&c.which!=b.BACKSPACE||this._handleClear(c)},d.prototype.update=function(b,d){if(b.call(this,d),!(this.$selection.find(".select2-selection__placeholder").length>0||0===d.length)){var e=a('<span class="select2-selection__clear">&times;</span>');c.StoreData(e[0],"data",d),this.$selection.find(".select2-selection__rendered").prepend(e)}},d}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,d,e){var f=this;a.call(this,d,e),d.on("open",function(){f.$search.trigger("focus")}),d.on("close",function(){f.$search.val(""),f.$search.removeAttr("aria-activedescendant"),f.$search.trigger("focus")}),d.on("enable",function(){f.$search.prop("disabled",!1),f._transferTabIndex()}),d.on("disable",function(){f.$search.prop("disabled",!0)}),d.on("focus",function(a){f.$search.trigger("focus")}),d.on("results:focus",function(a){f.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){f.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){f._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),f.trigger("keypress",a),f._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===f.$search.val()){var d=f.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var e=b.GetData(d[0],"data");f.searchRemoveChoice(e),a.preventDefault()}}});var g=document.documentMode,h=g&&g<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(h)return void f.$selection.off("input.search input.searchcheck");f.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(h&&"input"===a.type)return void f.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&f.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;if(this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c){this.$element.find("[data-select2-tag]").length?this.$element.focus():this.$search.focus()}},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],g=["opening","closing","selecting","unselecting","clearing"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple")){if(a.selected=!1,c(a.element).is("option"))return a.element.selected=!1,void this.$element.trigger("change");this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})}},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){b.RemoveData(this)})},d.prototype.query=function(a,b){var d=[],e=this;this.$element.children().each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var d;a.children?(d=document.createElement("optgroup"),d.label=a.text):(d=document.createElement("option"),void 0!==d.textContent?d.textContent=a.text:d.innerText=a.text),void 0!==a.id&&(d.value=a.id),a.disabled&&(d.disabled=!0),a.selected&&(d.selected=!0),a.title&&(d.title=a.title);var e=c(d),f=this._normalizeItem(a);return f.element=d,b.StoreData(d,"data",f),e},d.prototype.item=function(a){var d={};if(null!=(d=b.GetData(a[0],"data")))return d;if(a.is("option"))d={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){d={text:a.prop("label"),children:[],title:a.prop("title")};for(var e=a.children("option"),f=[],g=0;g<e.length;g++){var h=c(e[g]),i=this.item(h);f.push(i)}d.children=f}return d=this._normalizeItem(d),d.element=a[0],b.StoreData(a[0],"data",d),d},d.prototype._normalizeItem=function(a){a!==Object(a)&&(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){return this.options.get("matcher")(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){"status"in d&&(0===d.status||"0"===d.status)||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0);if((i.text||"").toUpperCase()===(b.term||"").toUpperCase()||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var k=e.createTag(b);if(null!=k){var l=e.option(k);l.attr("data-select2-tag",!0),e.addOptions([l]),e.insertTag(g,k)}a.results=g,c(a)}var e=this;if(this._removeOldTags(),null==b.term||null!=b.page)return void a.call(this,b,c);a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){this._lastTag;this.$element.find("option[data-select2-tag]").each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b);if(!g.$element.find("option").filter(function(){return a(this).val()===c.id}).length){var d=g.option(c);d.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([d])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",b.term.length<this.minimumInputLength)return void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val(""),e.$search.blur()}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){b.StoreData(this,"select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(c){var d=b.GetData(this,"select2-scroll-position");a(this).scrollTop(d.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",["../utils"],function(a){function b(){}return b.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},b.prototype._handleSelectOnClose=function(b,c){if(c&&null!=c.originalSelect2Event){var d=c.originalSelect2Event;if("select"===d._type||"unselect"===d._type)return}var e=this.getHighlightedResults();if(!(e.length<1)){var f=a.GetData(e[0],"data");null!=f.element&&f.element.selected||null==f.element&&f.selected||this.trigger("select",{data:f})}},b}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){return"Please enter "+(a.minimum-a.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}return D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(a){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(a){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var O=k.loadPath(this.defaults.amdLanguageBase+"en"),P=new k(l.language);P.extend(O),l.translations=P}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(!0,this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),d.GetData(a[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),d.StoreData(a[0],"data",d.GetData(a[0],"select2Tags")),d.StoreData(a[0],"tags",!0)),d.GetData(a[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",d.GetData(a[0],"ajaxUrl")),d.StoreData(a[0],"ajax-Url",d.GetData(a[0],"ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,d.GetData(a[0])):d.GetData(a[0]);var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,d){null!=c.GetData(a[0],"select2")&&c.GetData(a[0],"select2").destroy(),this.$element=a,this.id=this._generateId(a),d=d||{},this.options=new b(d,a),e.__super__.constructor.call(this);var f=a.attr("tabindex")||0;c.StoreData(a[0],"old-tabindex",f),a.attr("tabindex","-1");var g=this.options.get("dataAdapter");this.dataAdapter=new g(a,this.options);var h=this.render();this._placeContainer(h);var i=this.options.get("selectionAdapter");this.selection=new i(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,h);var j=this.options.get("dropdownAdapter");this.dropdown=new j(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,h);var k=this.options.get("resultsAdapter");this.results=new k(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){l.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),c.StoreData(a[0],"select2",this),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h<i;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",c.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),c.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),c.StoreData(b[0],"element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(a,b,c,d,e){if(null==a.fn.select2){var f=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,g=Array.prototype.slice.call(arguments,1);return this.each(function(){var a=e.GetData(this,"select2");null==a&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=a[b].apply(a,g)}),a.inArray(b,f)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
js/widget.min.js CHANGED
@@ -97,17 +97,26 @@
97
  $el = $(o);
98
 
99
  if ( $el.is("select") ) {
100
- el_data = $el.find("option:selected").data();
 
 
 
 
 
101
 
102
  var el_show = true;
103
  $(berocket_aapf_widget_product_filters).each(function (i, o) {
104
- if (o[0] == el_data.taxonomy) {
105
- el_show = false;
106
- }
 
 
107
  });
108
  if( el_show && $el.val() ){
109
- berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [el_data.taxonomy, el_data.term_id, el_data.operator];
110
- berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $el;
 
 
111
  }
112
  } else {
113
  el_data = $el.data();
@@ -157,6 +166,7 @@
157
  if ( typeof $force == 'undefined' ) $force = false;
158
  // if we have update_button on the page we must wait for it to be clicked
159
  if ( ! $force && berocket_aapf_widget_wait_for_button ) return false;
 
160
 
161
  // call user func before_update
162
  if( the_ajax_script.user_func != null )
@@ -255,7 +265,8 @@
255
  url = the_ajax_script.ajaxurl;
256
  new_args = args;
257
  }
258
- var berocket_this_ajax_request = berocket_last_ajax_request = $.post(url, new_args, function (data) {
 
259
  berocket_last_ajax_request = null;
260
  berocket_last_ajax_request_id = 1;
261
  if(! the_ajax_script.ajax_request_load || the_ajax_script.ajax_request_load_style != 'jquery' ) {
@@ -335,9 +346,13 @@
335
  aapf_action_init();
336
 
337
  // call user func after_update
 
 
338
  if( the_ajax_script.user_func != null )
339
  berocket_fire( the_ajax_script.user_func.after_update );
340
- }, return_type);
 
 
341
  }
342
 
343
  function updateLocation( args, pushstate, return_request ){
@@ -363,28 +378,38 @@
363
 
364
  if( args.limits ){
365
  $(args.limits).each(function (i,o){
366
- if( !in_array( o[0].substring(3), temp_terms ) ){
367
- temp_terms[temp_terms.length] = o[0].substring(3);
 
 
 
 
 
368
  }
369
- if( typeof uri_request_array[in_array( o[0].substring(3), temp_terms )] == 'undefined' ) {
370
- uri_request_array[in_array(o[0].substring(3), temp_terms)] = [];
371
  }
372
 
373
- uri_request_array[in_array( o[0].substring(3), temp_terms )]
374
- [uri_request_array[in_array( o[0].substring(3), temp_terms )].length] = [o[1],o[2]];
375
  });
376
  }
377
  if( args.terms ){
378
  $(args.terms).each(function (i,o){
379
- if( !in_array( o[0].substring(3), temp_terms ) ){
380
- temp_terms[temp_terms.length] = o[0].substring(3);
 
 
381
  }
382
- if( typeof uri_request_array[in_array( o[0].substring(3), temp_terms )] == 'undefined' ) {
383
- uri_request_array[in_array(o[0].substring(3), temp_terms)] = [];
 
 
 
384
  }
385
 
386
- uri_request_array[in_array( o[0].substring(3), temp_terms )]
387
- [uri_request_array[in_array( o[0].substring(3), temp_terms )].length] = [o[1],o[2]];
388
  });
389
  }
390
 
@@ -500,6 +525,9 @@
500
  }
501
 
502
  function aapf_action_init(){
 
 
 
503
  // Take control over (default) pagination and sorting, make it AJAXy and work with filters
504
  $(the_ajax_script.pagination_class).on('click', 'a', function (event) {
505
  event.preventDefault();
@@ -529,9 +557,24 @@
529
  }
530
 
531
  $('.berocket_aapf_widget').on("change", "input, select", function(){
532
- if($(this).attr('type') == 'checkbox' || $(this).attr('type') == 'radio')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  {
534
- $label = $(this).parents('li').first().find('.berocket_label_widgets');
535
  if( $label.parents('li').first().find('input').prop('checked')) {
536
  $('.'+$label.attr('for')).each(function( i2, o2 ) {
537
  $(o2).prop('checked', false);
@@ -557,15 +600,15 @@
557
  }
558
  $('.'+$label.attr('for')).parents('ul').find('input').trigger('refresh');
559
  if( the_ajax_script.hide_sel_value ) {
560
- $hiden_objects = $(this).parents('.berocket_aapf_widget').find('.berocket_hide_o_value, .berocket_hide_sel_value');
561
  if( $hiden_objects.length == 0 ) {
562
- $(this).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').hide();
563
  } else {
564
- $(this).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').show();
565
  }
566
  }
567
 
568
- if($(this).prop('checked'))
569
  {
570
  $('.'+$label.attr('for')).prop('checked', true).trigger('refresh');
571
  if( the_ajax_script.hide_sel_value ) {
@@ -580,12 +623,16 @@
580
  $(o2).parents('li').first().removeClass('berocket_hide_sel_value');
581
  });
582
  }
583
- } else if($(this).is('select'))
584
- {
585
- $('select.'+$(this).data('taxonomy')).val($(this).find('option:selected').val()).trigger('refresh');
 
 
 
 
586
  }
587
  updateProducts();
588
- });
589
 
590
  $( ".berocket_filter_slider" ).each(function (i,o){
591
  $(o).slider({
97
  $el = $(o);
98
 
99
  if ( $el.is("select") ) {
100
+ el_data = [];
101
+ $el.find("option:selected").each(function(i, o) {
102
+ if( $(o).val() ) {
103
+ el_data.push($(o).data());
104
+ }
105
+ });
106
 
107
  var el_show = true;
108
  $(berocket_aapf_widget_product_filters).each(function (i, o) {
109
+ el_data.forEach(function(element) {
110
+ if (o[0] == element.taxonomy) {
111
+ el_show = false;
112
+ }
113
+ });
114
  });
115
  if( el_show && $el.val() ){
116
+ el_data.forEach(function(element) {
117
+ berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [element.taxonomy, element.term_id, element.operator];
118
+ berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $el;
119
+ });
120
  }
121
  } else {
122
  el_data = $el.data();
166
  if ( typeof $force == 'undefined' ) $force = false;
167
  // if we have update_button on the page we must wait for it to be clicked
168
  if ( ! $force && berocket_aapf_widget_wait_for_button ) return false;
169
+ $(document).trigger('berocket_ajax_filtering_start');
170
 
171
  // call user func before_update
172
  if( the_ajax_script.user_func != null )
265
  url = the_ajax_script.ajaxurl;
266
  new_args = args;
267
  }
268
+ var send_type = the_ajax_script.use_request_method;
269
+ var berocket_this_ajax_request = berocket_last_ajax_request = $[send_type](url, new_args, function (data) {
270
  berocket_last_ajax_request = null;
271
  berocket_last_ajax_request_id = 1;
272
  if(! the_ajax_script.ajax_request_load || the_ajax_script.ajax_request_load_style != 'jquery' ) {
346
  aapf_action_init();
347
 
348
  // call user func after_update
349
+ $(document).trigger('berocket_ajax_products_loaded');
350
+ $(document).trigger('berocket_ajax_filtering_end');
351
  if( the_ajax_script.user_func != null )
352
  berocket_fire( the_ajax_script.user_func.after_update );
353
+ }, return_type).fail(function() {
354
+ $(document).trigger('berocket_ajax_filtering_end');
355
+ });
356
  }
357
 
358
  function updateLocation( args, pushstate, return_request ){
378
 
379
  if( args.limits ){
380
  $(args.limits).each(function (i,o){
381
+ if( o[0].substring(0, 3) == 'pa_' ) {
382
+ var attribute = o[0].substring(3);
383
+ } else {
384
+ var attribute = o[0];
385
+ }
386
+ if( !in_array( attribute, temp_terms ) ){
387
+ temp_terms[temp_terms.length] = attribute;
388
  }
389
+ if( typeof uri_request_array[in_array( attribute, temp_terms )] == 'undefined' ) {
390
+ uri_request_array[in_array(attribute, temp_terms)] = [];
391
  }
392
 
393
+ uri_request_array[in_array( attribute, temp_terms )]
394
+ [uri_request_array[in_array( attribute, temp_terms )].length] = [o[1],o[2]];
395
  });
396
  }
397
  if( args.terms ){
398
  $(args.terms).each(function (i,o){
399
+ if( o[0].substring(0, 3) == 'pa_' ) {
400
+ var attribute = o[0].substring(3);
401
+ } else {
402
+ var attribute = o[0];
403
  }
404
+ if( !in_array( attribute, temp_terms ) ){
405
+ temp_terms[temp_terms.length] = attribute;
406
+ }
407
+ if( typeof uri_request_array[in_array( attribute, temp_terms )] == 'undefined' ) {
408
+ uri_request_array[in_array(attribute, temp_terms)] = [];
409
  }
410
 
411
+ uri_request_array[in_array( attribute, temp_terms )]
412
+ [uri_request_array[in_array( attribute, temp_terms )].length] = [o[1],o[2]];
413
  });
414
  }
415
 
525
  }
526
 
527
  function aapf_action_init(){
528
+ if( the_ajax_script.use_select2 && $(".berocket_aapf_widget select").length && typeof $(".berocket_aapf_widget select").select2 == 'function' ) {
529
+ $(".berocket_aapf_widget select").select2({width:'100%'});
530
+ }
531
  // Take control over (default) pagination and sorting, make it AJAXy and work with filters
532
  $(the_ajax_script.pagination_class).on('click', 'a', function (event) {
533
  event.preventDefault();
557
  }
558
 
559
  $('.berocket_aapf_widget').on("change", "input, select", function(){
560
+ if( $(this).is('.select2-hidden-accessible') ) {
561
+ $(this).addClass('select2changed');
562
+ return 0;
563
+ }
564
+ berocket_on_change_inputs_selects($(this));
565
+ });
566
+
567
+ $('.berocket_aapf_widget').on("select2:close", "select", function(){
568
+ if( $(this).is('.select2changed') ) {
569
+ $(this).removeClass('select2changed');
570
+ berocket_on_change_inputs_selects($(this));
571
+ }
572
+ });
573
+
574
+ function berocket_on_change_inputs_selects(element) {
575
+ if($(element).attr('type') == 'checkbox' || $(element).attr('type') == 'radio')
576
  {
577
+ $label = $(element).parents('li').first().find('.berocket_label_widgets');
578
  if( $label.parents('li').first().find('input').prop('checked')) {
579
  $('.'+$label.attr('for')).each(function( i2, o2 ) {
580
  $(o2).prop('checked', false);
600
  }
601
  $('.'+$label.attr('for')).parents('ul').find('input').trigger('refresh');
602
  if( the_ajax_script.hide_sel_value ) {
603
+ $hiden_objects = $(element).parents('.berocket_aapf_widget').find('.berocket_hide_o_value, .berocket_hide_sel_value');
604
  if( $hiden_objects.length == 0 ) {
605
+ $(element).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').hide();
606
  } else {
607
+ $(element).parents('.berocket_aapf_widget').find('.berocket_widget_show_values').show();
608
  }
609
  }
610
 
611
+ if($(element).prop('checked'))
612
  {
613
  $('.'+$label.attr('for')).prop('checked', true).trigger('refresh');
614
  if( the_ajax_script.hide_sel_value ) {
623
  $(o2).parents('li').first().removeClass('berocket_hide_sel_value');
624
  });
625
  }
626
+ } else if($(element).is('select')) {
627
+ var selected_val = [];
628
+ $(element).find('option:selected').each(function(i, o) {
629
+ selected_val.push($(o).val());
630
+ });
631
+ var first = true;
632
+ $('select.'+$(element).data('taxonomy')).val(selected_val).trigger('refresh');
633
  }
634
  updateProducts();
635
+ }
636
 
637
  $( ".berocket_filter_slider" ).each(function (i,o){
638
  $(o).slider({
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
4
  Donate link: http://berocket.com/product/woocommerce-ajax-products-filter
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: 4.9
8
- Stable tag: 1.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -15,51 +15,64 @@ WooCommerce AJAX Product Filters - Advanced product filtering ability for your W
15
 
16
  WooCommerce AJAX Product Filters - Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
17
 
18
- = BeRocket Promotions: =
19
- [60% OFF – Premium WooCommerce Currency Exchange – ONLY $11 today!](https://berocket.com/product/woocommerce-currency-exchange)
20
- [Try FREE version of WooCommerce Currency Exchange here](https://wordpress.org/plugins/currency-exchange-for-woocommerce/)
 
 
 
 
 
 
 
 
 
21
 
22
  = Features: =
23
 
24
- * AJAX Filters, Pagination and Sorting!
25
- * Unlimited Filters
26
- * Multiple User Interface Elements
27
- * Great support for custom/premium themes
28
- * SEO Friendly Urls ( with HTML5 PushState )
29
- * Filter Visibility By Product Category And Globals.
30
- * Accessible through shortcode
31
- * Filter box height limit with scroll themes
32
- * Working great with custom widget area
33
- * Drag and Drop Filter Building
34
- * And More...
 
 
 
35
 
36
  = Additional Features in Paid Plugin: =
37
 
38
- * Filter by Attribute, Tag, Custom Taxonomy, Color, Image, Sale status, Sub-categories and Availability( in stock | out of stock | any )
39
- * Nice URLs for SEO Friendly URLs
40
- * Customize filters look through admin
41
- * Option to re-count products amount in values when some value selected
42
- * Tag Cloud for Tag filter
43
- * Description can be added for the attributes
44
- * Slider can use strings as a value
45
- * Filters can be collapsed by clicking on title, option to collapse filter on start
46
- * Price Filter Custom Min and Max values
47
- * Price as checkbox with min and max values
48
- * Add custom CSS on admin settings page
49
- * Show icons before/after widget title and/or before/after values
50
- * Option to upload "Loading..." gif image and set label after/before/above/under it
51
- * Scroll top position can be controlled by the admin
52
- * Option to hide on mobile devices
53
- * Enhancements of the free features
54
- * Shortcode Builder for Easy Shortcode Creation
55
- * Show amount of products before update with "Update button" widget
56
- * Optimization to Handle up to 5 000 Products Total
57
- * Option to Set Values for the Price Slider Manually
58
- * Selected Filters Area
59
- * Reset button and Search box widget
60
- * Cache for Widgets
61
- * Filters Visibility by Pages
62
- * Display only selected attribute values or hide selected attribute values
 
63
 
64
 
65
  = Plugin Links: =
@@ -67,7 +80,7 @@ WooCommerce AJAX Product Filters - Advanced product filtering ability for your W
67
  [Demo](http://woocommerce-products-filter.berocket.com/shop/)
68
  [Demo Description](http://woocommerce-products-filter.berocket.com/)
69
 
70
- = Wanna try admin side? =
71
  [Admin Demo](http://berocket.com/product/woocommerce-ajax-products-filter#try-admin) - Get access to this plugin's admin and try it from inside. Change things and watch how they work.
72
 
73
  = Premium plugin video =
@@ -79,13 +92,13 @@ WooCommerce AJAX Product Filters - Advanced product filtering ability for your W
79
  = Compatibility with WooCommerce plugins =
80
  Advanced AJAX Product Filters has been tested and compatibility is certain with the following WooCommerce plugins that you can add to your site:
81
 
82
- * [**Advanced Product Labels for WooCommerce**](https://wordpress.org/plugins/advanced-product-labels-for-woocommerce/)
83
- * [**Load More Products for WooCommerce**](https://wordpress.org/plugins/load-more-products-for-woocommerce/)
84
- * [**Brands for WooCommerce**](https://wordpress.org/plugins/brands-for-woocommerce/)
85
- * [**Grid/List View for WooCommerce**](https://wordpress.org/plugins/gridlist-view-for-woocommerce/)
86
- * [**Product Preview for WooCommerce**](https://wordpress.org/plugins/product-preview-for-woocommerce/)
87
- * [**Products Compare for WooCommerce**](https://wordpress.org/plugins/products-compare-for-woocommerce/)
88
- * [**Wishlist and Waitlist for WooCommerce**](https://wordpress.org/plugins/wish-wait-list-for-woocommerce/)
89
 
90
  Nevertheless, it could be compatible with many other WooCommerce plugins that have not been tested yet. If you want to inform us about compatibility with other plugins, please, [email to us](http://berocket.com/contact).
91
 
@@ -182,6 +195,16 @@ You can try this plugin's admin side [here](http://berocket.com/product/woocomme
182
 
183
  == Changelog ==
184
 
 
 
 
 
 
 
 
 
 
 
185
  = 1.2.4 =
186
  * Upgrade - WordPress 4.9 compatibility
187
 
4
  Donate link: http://berocket.com/product/woocommerce-ajax-products-filter
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: 4.9.5
8
+ Stable tag: 1.2.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
15
 
16
  WooCommerce AJAX Product Filters - Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
17
 
18
+ = &#128226; BeRocket Promotions - Summer Sale &#127774; : =
19
+ *21/06 - 30/06*
20
+ &#127775; [Premium WooCommerce Advanced Product Labels Save $20](https://berocket.com/product/woocommerce-advanced-product-labels)
21
+
22
+ *1/07 - 10/07*
23
+ &#128181; [Premium WooCommerce Min/Max Quantity – Save $20](https://berocket.com/product/woocommerce-minmax-quantity)
24
+
25
+ *11/07 - 20/07*
26
+ &#128181; [Premium WooCommerce Load More Products – Save $20](https://berocket.com/product/woocommerce-load-more-products)
27
+
28
+
29
+ = New Feature in version 1.2.5 - Filter by Product Categories! =
30
 
31
  = Features: =
32
 
33
+ &#9989; AJAX Filters, Pagination and Sorting!
34
+ &#9989; Filter by Price
35
+ &#9989; Filter by Product Category
36
+ &#9989; Filter by Attribute
37
+ &#9989; Unlimited Filters
38
+ &#9989; Multiple User Interface Elements
39
+ &#9989; Great support for custom/premium themes
40
+ &#9989; SEO Friendly Urls ( with HTML5 PushState )
41
+ &#9989; Filter Visibility By Product Category And Globals.
42
+ &#9989; Accessible through shortcode
43
+ &#9989; Filter box height limit with scroll themes
44
+ &#9989; Working great with custom widget area
45
+ &#9989; Drag and Drop Filter Building
46
+ &#9989; And More...
47
 
48
  = Additional Features in Paid Plugin: =
49
 
50
+ &#9989; Filter by Attribute, Tag, Custom Taxonomy, Color, Image, Price ranges, Sale status, Sub-categories, Date, Rating and Availability( in stock | out of stock | any )
51
+ &#9989; Nice URLs for SEO Friendly URLs
52
+ &#9989; Customize filters look through admin
53
+ &#9989; Option to re-count products amount in values when some value selected
54
+ &#9989; Tag Cloud for Tag filter
55
+ &#9989; Description can be added for the attributes
56
+ &#9989; Slider can use strings as a value
57
+ &#9989; Filters can be collapsed by clicking on title, option to collapse filter on start
58
+ &#9989; Price Filter Custom Min and Max values
59
+ &#9989; Price as checkbox with min and max values
60
+ &#9989; Add custom CSS on admin settings page
61
+ &#9989; Show icons before/after widget title and/or before/after values
62
+ &#9989; Option to upload "Loading..." gif image and set label after/before/above/under it
63
+ &#9989; Scroll top position can be controlled by the admin
64
+ &#9989; Option to hide on mobile devices
65
+ &#9989; Enhancements of the free features
66
+ &#9989; Shortcode Builder for Easy Shortcode Creation
67
+ &#9989; Show amount of products before update with "Update button" widget
68
+ &#9989; Optimization to Handle up to 5 000 Products Total
69
+ &#9989; Option to Set Values for the Price Slider Manually
70
+ &#9989; Selected Filters Area
71
+ &#9989; Working great with product variations
72
+ &#9989; Reset button and Search box widget
73
+ &#9989; Cache for Widgets
74
+ &#9989; Filters Visibility by Pages
75
+ &#9989; Display only selected attribute values or hide selected attribute values
76
 
77
 
78
  = Plugin Links: =
80
  [Demo](http://woocommerce-products-filter.berocket.com/shop/)
81
  [Demo Description](http://woocommerce-products-filter.berocket.com/)
82
 
83
+ = &#127852; Wanna try admin side? =
84
  [Admin Demo](http://berocket.com/product/woocommerce-ajax-products-filter#try-admin) - Get access to this plugin's admin and try it from inside. Change things and watch how they work.
85
 
86
  = Premium plugin video =
92
  = Compatibility with WooCommerce plugins =
93
  Advanced AJAX Product Filters has been tested and compatibility is certain with the following WooCommerce plugins that you can add to your site:
94
 
95
+ &#128312; [**Advanced Product Labels for WooCommerce**](https://wordpress.org/plugins/advanced-product-labels-for-woocommerce/)
96
+ &#128312; [**Load More Products for WooCommerce**](https://wordpress.org/plugins/load-more-products-for-woocommerce/)
97
+ &#128312; [**Brands for WooCommerce**](https://wordpress.org/plugins/brands-for-woocommerce/)
98
+ &#128312; [**Grid/List View for WooCommerce**](https://wordpress.org/plugins/gridlist-view-for-woocommerce/)
99
+ &#128312; [**Product Preview for WooCommerce**](https://wordpress.org/plugins/product-preview-for-woocommerce/)
100
+ &#128312; [**Products Compare for WooCommerce**](https://wordpress.org/plugins/products-compare-for-woocommerce/)
101
+ &#128312; [**Wishlist and Waitlist for WooCommerce**](https://wordpress.org/plugins/wish-wait-list-for-woocommerce/)
102
 
103
  Nevertheless, it could be compatible with many other WooCommerce plugins that have not been tested yet. If you want to inform us about compatibility with other plugins, please, [email to us](http://berocket.com/contact).
104
 
195
 
196
  == Changelog ==
197
 
198
+ = 1.2.5 =
199
+ * Enhancement - Product categories filtering
200
+ * Enhancement - Select2 script for dropdown menu in filters
201
+ * Enhancement - Option to use GET request instead POST request(for better compatibility with some caching)
202
+ * Enhancement - Setup Wizard
203
+ * Enhancement - Auto selectors
204
+ * Fix - Displaying categories and subcategories
205
+ * Fix - Compatibility with new version of Load More plugin
206
+ * Fix - Other fixes
207
+
208
  = 1.2.4 =
209
  * Upgrade - WordPress 4.9 compatibility
210
 
templates/admin-settings.php CHANGED
@@ -22,6 +22,15 @@ $dplugin_desc = '';
22
  </h2>
23
  <div id="general" class="tab-item <?php if(@$options['br_opened_tab'] == 'general' || !in_array( @$options['br_opened_tab'], $tabs_array ) ) echo 'current'; ?>">
24
  <table class="form-table">
 
 
 
 
 
 
 
 
 
25
  <tr>
26
  <th scope="row"><?php _e('"No Products" message', 'BeRocket_AJAX_domain') ?></th>
27
  <td>
@@ -38,10 +47,19 @@ $dplugin_desc = '';
38
  <span style="color:#666666;margin-left:2px;"><?php _e('Add class and use it to style "No Products" box', 'BeRocket_AJAX_domain') ?></span>
39
  </td>
40
  </tr>
 
 
 
 
 
 
 
 
 
41
  <tr>
42
  <th scope="row"><?php _e('Products selector', 'BeRocket_AJAX_domain') ?></th>
43
  <td>
44
- <input name="br_filters_options[products_holder_id]" type='text' value='<?php echo @$options['products_holder_id']?$options['products_holder_id']:'ul.products'?>'/>
45
  <br />
46
  <span style="color:#666666;margin-left:2px;"><?php _e("Selector for tag that is holding products. Don't change this if you don't know what it is", 'BeRocket_AJAX_domain') ?></span>
47
  </td>
@@ -49,7 +67,7 @@ $dplugin_desc = '';
49
  <tr>
50
  <th scope="row"><?php _e('Product count selector', 'BeRocket_AJAX_domain') ?></th>
51
  <td>
52
- <input size="30" name="br_filters_options[woocommerce_result_count_class]" type='text' value='<?php echo @$options['woocommerce_result_count_class']?$options['woocommerce_result_count_class']:BeRocket_AAPF::$defaults['woocommerce_result_count_class']?>'/>
53
  <br />
54
  <span style="color:#666666;margin-left:2px;"><?php _e('Selector for tag with product result count("Showing 1–8 of 61 results"). Don\'t change this if you don\'t know what it is', 'BeRocket_AJAX_domain') ?></span>
55
  </td>
@@ -65,7 +83,7 @@ $dplugin_desc = '';
65
  <tr>
66
  <th scope="row"><?php _e('Products pagination selector', 'BeRocket_AJAX_domain') ?></th>
67
  <td>
68
- <input size="30" name="br_filters_options[woocommerce_pagination_class]" type='text' value='<?php echo @$options['woocommerce_pagination_class']?$options['woocommerce_pagination_class']:BeRocket_AAPF::$defaults['woocommerce_pagination_class']?>'/>
69
  <br />
70
  <span style="color:#666666;margin-left:2px;"><?php _e("Selector for tag that is holding products. Don't change this if you don't know what it is", 'BeRocket_AJAX_domain') ?></span>
71
  </td>
@@ -122,11 +140,31 @@ $dplugin_desc = '';
122
  <span style="color:#666666;margin-left:2px;">Check if you want scroll page to the top of shop after filters change</span>
123
  </td>
124
  </tr>
 
 
 
 
 
 
 
125
  <tr>
126
  <th scope="row"><?php _e('Template ajax load fix', 'BeRocket_AJAX_domain') ?></th>
127
  <td>
128
- <input name="br_filters_options[ajax_request_load]" type='checkbox' value='1' <?php if( @$options['ajax_request_load'] ) echo "checked='checked'";?>/>
129
  <span style="color:#666666;margin-left:2px;"><?php _e('Use all plugins on ajax load(can slow down products loading)', 'BeRocket_AJAX_domain') ?></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  <div class="settings-sub-option">
131
  <span style="color:#666666;margin-left:2px;"><?php _e('Use', 'BeRocket_AJAX_domain') ?></span>
132
  <select name="br_filters_options[ajax_request_load_style]">
22
  </h2>
23
  <div id="general" class="tab-item <?php if(@$options['br_opened_tab'] == 'general' || !in_array( @$options['br_opened_tab'], $tabs_array ) ) echo 'current'; ?>">
24
  <table class="form-table">
25
+ <tr>
26
+ <th scope="row"><?php _e('SETUP WIZARD', 'BeRocket_AJAX_domain') ?></th>
27
+ <td>
28
+ <a class="button" href="<?php echo admin_url( 'admin.php?page=br-aapf-setup' ); ?>"><?php _e('RUN SETUP WIZARD', 'BeRocket_AJAX_domain') ?></a>
29
+ <div>
30
+ <?php _e('Run it to setup plugin options step by step', 'BeRocket_AJAX_domain') ?>
31
+ </div>
32
+ </td>
33
+ </tr>
34
  <tr>
35
  <th scope="row"><?php _e('"No Products" message', 'BeRocket_AJAX_domain') ?></th>
36
  <td>
47
  <span style="color:#666666;margin-left:2px;"><?php _e('Add class and use it to style "No Products" box', 'BeRocket_AJAX_domain') ?></span>
48
  </td>
49
  </tr>
50
+ <tr>
51
+ <th scope="row"><?php _e('Get selectors automatically (BETA)', 'BeRocket_AJAX_domain') ?></th>
52
+ <td>
53
+ <?php echo BeRocket_wizard_generate_autoselectors(array('products' => '.berocket_aapf_products_selector', 'pagination' => '.berocket_aapf_pagination_selector', 'result_count' => '.berocket_aapf_product_count_selector')); ?>
54
+ <div>
55
+ <?php _e('Please do not use it on live sites. If something went wrong write us.', 'BeRocket_AJAX_domain') ?>
56
+ </div>
57
+ </td>
58
+ </tr>
59
  <tr>
60
  <th scope="row"><?php _e('Products selector', 'BeRocket_AJAX_domain') ?></th>
61
  <td>
62
+ <input class="berocket_aapf_products_selector" name="br_filters_options[products_holder_id]" type='text' value='<?php echo @$options['products_holder_id']?$options['products_holder_id']:'ul.products'?>'/>
63
  <br />
64
  <span style="color:#666666;margin-left:2px;"><?php _e("Selector for tag that is holding products. Don't change this if you don't know what it is", 'BeRocket_AJAX_domain') ?></span>
65
  </td>
67
  <tr>
68
  <th scope="row"><?php _e('Product count selector', 'BeRocket_AJAX_domain') ?></th>
69
  <td>
70
+ <input class="berocket_aapf_product_count_selector" size="30" name="br_filters_options[woocommerce_result_count_class]" type='text' value='<?php echo @$options['woocommerce_result_count_class']?$options['woocommerce_result_count_class']:BeRocket_AAPF::$defaults['woocommerce_result_count_class']?>'/>
71
  <br />
72
  <span style="color:#666666;margin-left:2px;"><?php _e('Selector for tag with product result count("Showing 1–8 of 61 results"). Don\'t change this if you don\'t know what it is', 'BeRocket_AJAX_domain') ?></span>
73
  </td>
83
  <tr>
84
  <th scope="row"><?php _e('Products pagination selector', 'BeRocket_AJAX_domain') ?></th>
85
  <td>
86
+ <input class="berocket_aapf_pagination_selector" size="30" name="br_filters_options[woocommerce_pagination_class]" type='text' value='<?php echo @$options['woocommerce_pagination_class']?$options['woocommerce_pagination_class']:BeRocket_AAPF::$defaults['woocommerce_pagination_class']?>'/>
87
  <br />
88
  <span style="color:#666666;margin-left:2px;"><?php _e("Selector for tag that is holding products. Don't change this if you don't know what it is", 'BeRocket_AJAX_domain') ?></span>
89
  </td>
140
  <span style="color:#666666;margin-left:2px;">Check if you want scroll page to the top of shop after filters change</span>
141
  </td>
142
  </tr>
143
+ <tr>
144
+ <th scope="row"><?php _e('Select2', 'BeRocket_AJAX_domain') ?></th>
145
+ <td>
146
+ <input name="br_filters_options[use_select2]" type='checkbox' value='1' <?php if( ! empty($options['use_select2']) ) echo "checked='checked'";?>/>
147
+ <span style="color:#666666;margin-left:2px;"><?php _e('Use Select2 script for dropdown menu', 'BeRocket_AJAX_domain') ?></span>
148
+ </td>
149
+ </tr>
150
  <tr>
151
  <th scope="row"><?php _e('Template ajax load fix', 'BeRocket_AJAX_domain') ?></th>
152
  <td>
153
+ <input class="load_fix_ajax_request_load" name="br_filters_options[ajax_request_load]" type='checkbox' value='1' <?php if( @$options['ajax_request_load'] ) echo "checked='checked'";?>/>
154
  <span style="color:#666666;margin-left:2px;"><?php _e('Use all plugins on ajax load(can slow down products loading)', 'BeRocket_AJAX_domain') ?></span>
155
+ <p class="load_fix_use_get_query"<?php if( empty($options['ajax_request_load']) ) echo ' style="display:none;"'; ?>>
156
+ <input name="br_filters_options[use_get_query]" type='checkbox' value='1' <?php if( ! empty($options['use_get_query']) ) echo "checked='checked'";?>/>
157
+ <span style="color:#666666;margin-left:2px;"><?php _e('Use GET query instead POST for filtering', 'BeRocket_AJAX_domain') ?></span>
158
+ <script>
159
+ jQuery(document).on('change', '.load_fix_ajax_request_load', function() {
160
+ if( $(this).prop('checked') ) {
161
+ jQuery('.load_fix_use_get_query').show();
162
+ } else {
163
+ jQuery('.load_fix_use_get_query').hide();
164
+ }
165
+ });
166
+ </script>
167
+ </p>
168
  <div class="settings-sub-option">
169
  <span style="color:#666666;margin-left:2px;"><?php _e('Use', 'BeRocket_AJAX_domain') ?></span>
170
  <select name="br_filters_options[ajax_request_load_style]">
templates/admin.php CHANGED
@@ -46,6 +46,12 @@
46
  </select>
47
  </label>
48
  </p>
 
 
 
 
 
 
49
  <p <?php if ( $instance['attribute'] != 'price' ) echo " style='display: none;'"; ?> class="berocket_aapf_widget_admin_price_attribute" >
50
  <label for="<?php echo $this->get_field_id( 'text_before_price' ); ?>">Text before price: </label>
51
  <input id="<?php echo $this->get_field_id( 'text_before_price' ); ?>" type="text" name="<?php echo $this->get_field_name( 'text_before_price' ); ?>" value="<?php echo $instance['text_before_price']; ?>" />
@@ -63,36 +69,39 @@
63
  <input id="<?php echo $this->get_field_id( 'css_class' ); ?>" type="text" name="<?php echo $this->get_field_name( 'css_class' ); ?>" value="<?php echo @ $instance['css_class']; ?>" class="berocket_aapf_widget_admin_css_class_input" />
64
  <small>(use white space for multiple classes)</small>
65
  </p>
66
- <p>
67
- <label><?php _e('Product Category:', 'BeRocket_AJAX_domain') ?>
68
- <label class="berocket_aapf_advanced_settings_subcategory">
69
- <input type="checkbox" name="<?php echo $this->get_field_name( 'cat_propagation' ); ?>" <?php if ( @ $instance['cat_propagation'] ) echo 'checked'; ?> value="1" class="berocket_aapf_widget_admin_height_input" />
70
- <?php _e('include subcats?', 'BeRocket_AJAX_domain') ?>
 
 
71
  </label>
72
- </label>
73
- <ul class="berocket_aapf_advanced_settings_categories_list">
74
- <?php
75
- $p_cat = @json_decode( $instance['product_cat'] );
76
-
77
- foreach( $categories as $category ){
78
- $selected_category = false;
79
-
80
- if( $p_cat )
81
- foreach( $p_cat as $cat ){
82
- if( $cat == $category->slug )
83
- $selected_category = true;
84
- }
85
- ?>
86
- <li>
87
  <?php
88
- if ( @ (int)$category->depth ) for ( $depth_i = 0; $depth_i < $category->depth*3; $depth_i++ ) echo "&nbsp;";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  ?>
90
- <input type="checkbox" name="<?php echo $this->get_field_name( 'product_cat' ); ?>[]" <?php if ( $selected_category ) echo 'checked'; ?> value="<?php echo $category->slug ?>" class="berocket_aapf_widget_admin_height_input" />
91
- <?php echo $category->name ?>
92
- </li>
93
- <?php } ?>
94
- </ul>
95
- </p>
96
  <p>
97
  <label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e('Filter Box Height:', 'BeRocket_AJAX_domain') ?> </label>
98
  <input id="<?php echo $this->get_field_id( 'height' ); ?>" type="text" name="<?php echo $this->get_field_name( 'height' ); ?>" value="<?php echo $instance['height']; ?>" class="berocket_aapf_widget_admin_height_input" />px
@@ -110,4 +119,4 @@
110
  </select>
111
  </p>
112
  </div>
113
- </div>
46
  </select>
47
  </label>
48
  </p>
49
+ <p class="berocket_widget_multiple_select" <?php if ( $instance['type'] != 'select' ) echo " style='display: none;'"; ?> >
50
+ <label>
51
+ <input type="checkbox" name="<?php echo $this->get_field_name( 'select_multiple' ); ?>" <?php if ( ! empty($instance['select_multiple']) ) echo 'checked'; ?> value="1" />
52
+ <?php _e('Multiplde select', 'BeRocket_AJAX_domain') ?>
53
+ </label>
54
+ </p>
55
  <p <?php if ( $instance['attribute'] != 'price' ) echo " style='display: none;'"; ?> class="berocket_aapf_widget_admin_price_attribute" >
56
  <label for="<?php echo $this->get_field_id( 'text_before_price' ); ?>">Text before price: </label>
57
  <input id="<?php echo $this->get_field_id( 'text_before_price' ); ?>" type="text" name="<?php echo $this->get_field_name( 'text_before_price' ); ?>" value="<?php echo $instance['text_before_price']; ?>" />
69
  <input id="<?php echo $this->get_field_id( 'css_class' ); ?>" type="text" name="<?php echo $this->get_field_name( 'css_class' ); ?>" value="<?php echo @ $instance['css_class']; ?>" class="berocket_aapf_widget_admin_css_class_input" />
70
  <small>(use white space for multiple classes)</small>
71
  </p>
72
+ <?php if ( isset( $categories ) and $categories ) { ?>
73
+ <p>
74
+ <label><?php _e('Product Category Visibility:', 'BeRocket_AJAX_domain') ?>
75
+ <label class="berocket_aapf_advanced_settings_subcategory">
76
+ <input type="checkbox" name="<?php echo $this->get_field_name( 'cat_propagation' ); ?>" <?php if ( @ $instance['cat_propagation'] ) echo 'checked'; ?> value="1" class="berocket_aapf_widget_admin_height_input" />
77
+ <?php _e('include subcats?', 'BeRocket_AJAX_domain') ?>
78
+ </label>
79
  </label>
80
+ <ul class="berocket_aapf_advanced_settings_categories_list">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  <?php
82
+ $p_cat = @json_decode( $instance['product_cat'] );
83
+ foreach( $categories as $category ){
84
+ $selected_category = false;
85
+
86
+ if( $p_cat )
87
+ foreach( $p_cat as $cat ){
88
+ if( $cat == $category->slug )
89
+ $selected_category = true;
90
+ }
91
+ ?>
92
+ <li>
93
+ <?php
94
+ if ( @ (int)$category->depth ) for ( $depth_i = 0; $depth_i < $category->depth*3; $depth_i++ ) echo "&nbsp;";
95
+ ?>
96
+ <input type="checkbox" name="<?php echo $this->get_field_name( 'product_cat' ); ?>[]" <?php if ( $selected_category ) echo 'checked'; ?> value="<?php echo $category->slug ?>" class="berocket_aapf_widget_admin_height_input" />
97
+ <?php echo $category->name ?>
98
+ </li>
99
+ <?php
100
+ }
101
  ?>
102
+ </ul>
103
+ </p>
104
+ <?php } ?>
 
 
 
105
  <p>
106
  <label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e('Filter Box Height:', 'BeRocket_AJAX_domain') ?> </label>
107
  <input id="<?php echo $this->get_field_id( 'height' ); ?>" type="text" name="<?php echo $this->get_field_name( 'height' ); ?>" value="<?php echo $instance['height']; ?>" class="berocket_aapf_widget_admin_height_input" />px
119
  </select>
120
  </p>
121
  </div>
122
+ </div>
templates/select.php CHANGED
@@ -1,8 +1,9 @@
1
  <li>
2
  <span>
3
- <select class="<?php echo @ $uo['class']['selectbox'] ?> <?php echo $terms[0]->taxonomy?>" data-taxonomy='<?php echo $terms[0]->taxonomy ?>'>
 
4
  <option data-taxonomy='<?php echo $terms[0]->taxonomy ?>' value=''><?php _e( 'Any', 'BeRocket_AJAX_domain' ) ?></option>
5
- <?php foreach( $terms as $term ): ?>
6
  <option value='<?php echo $term->term_id?>' data-term_id='<?php echo $term->term_id ?>' data-taxonomy='<?php echo $term->taxonomy ?>'
7
  data-operator='<?php echo $operator ?>'
8
  <?php
@@ -19,4 +20,4 @@
19
  <?php endforeach; ?>
20
  </select>
21
  </span>
22
- </li>
1
  <li>
2
  <span>
3
+ <select<?php if( ! empty($select_multiple) ) echo ' multiple="multiple" data-placeholder="'.__( 'Any', 'BeRocket_AJAX_domain' ).'"'?> class="<?php echo @ $uo['class']['selectbox'] ?> <?php echo $terms[0]->taxonomy?>" data-taxonomy='<?php echo $terms[0]->taxonomy ?>'>
4
+ <?php if( empty($select_multiple) ) { ?>
5
  <option data-taxonomy='<?php echo $terms[0]->taxonomy ?>' value=''><?php _e( 'Any', 'BeRocket_AJAX_domain' ) ?></option>
6
+ <?php } foreach( $terms as $term ): ?>
7
  <option value='<?php echo $term->term_id?>' data-term_id='<?php echo $term->term_id ?>' data-taxonomy='<?php echo $term->taxonomy ?>'
8
  data-operator='<?php echo $operator ?>'
9
  <?php
20
  <?php endforeach; ?>
21
  </select>
22
  </span>
23
+ </li>
wizard/admin.css ADDED
@@ -0,0 +1,811 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .br_framework_settings{
2
+ position: relative;
3
+ padding-bottom: 30px;
4
+ }
5
+ .br_framework_settings .nav-block{
6
+ display: none;
7
+ }
8
+ .br_framework_settings .nav-block.nav-block-active{
9
+ display: block;
10
+ }
11
+ .br_framework_settings textarea{
12
+ width: 100%;
13
+ resize: vertical;
14
+ min-height: 200px;
15
+ }
16
+ .br_framework_settings textarea.small {
17
+ min-height: 100px;
18
+ }
19
+ .br_framework_settings .br_line_delimiter {
20
+ display: inline-block;
21
+ width: 2em;
22
+ }
23
+ .br_saved,
24
+ .br_not_saved{
25
+ position: fixed;
26
+ top: 50px;
27
+ right: 50px;
28
+ z-index: 9999999;
29
+ color: #333333;
30
+ display: block;
31
+ width: 50px;
32
+ height: 50px;
33
+ border-radius: 50%;
34
+ animation-name: br_saved_anim;
35
+ animation-duration: 0.2s;
36
+ transition: background-color 0.6s;
37
+ transition: box-shadow 0.6s;
38
+ }
39
+ @keyframes br_saved_anim {
40
+ from {
41
+ right: -50px;
42
+ }
43
+
44
+ to {
45
+ right: 50px;
46
+ }
47
+ }
48
+ .br_saved_remove {
49
+ animation-name: br_saved_remove_anim;
50
+ animation-duration: 0.2s;
51
+ }
52
+ @keyframes br_saved_remove_anim {
53
+ from {
54
+ right: 50px;
55
+ }
56
+
57
+ to {
58
+ right: -50px;
59
+ }
60
+ }
61
+ .br_saved{
62
+ box-shadow: 1px 1px 3px 1px #55ff55 inset, 0 0 5px 0;
63
+ background-color: #33bb33;
64
+ }
65
+ .br_not_saved{
66
+ box-shadow: 1px 1px 3px 1px #ff5555 inset, 0 0 5px 0;
67
+ background-color: #bb3333!important;
68
+ }
69
+ .br_saving {
70
+ box-shadow: 1px 1px 3px 1px #cfcfcf inset, 0 0 5px 0;
71
+ background-color: #bbbbbb!important;
72
+ }
73
+ .br_saved .fa,
74
+ .br_not_saved .fa{
75
+ width: 50px;
76
+ display: block;
77
+ line-height: 50px;
78
+ vertical-align: middle;
79
+ text-align: center;
80
+ font-size: 32px;
81
+ }
82
+ .br_saved .fa-check,
83
+ .br_not_saved .fa-times{
84
+ animation-name: br_saved_anim_fa;
85
+ animation-duration: 0.4s;
86
+ }
87
+ @keyframes br_saved_anim_fa {
88
+ 0% {
89
+ font-size: 0px;
90
+ }
91
+
92
+ 50% {
93
+ font-size: 0px;
94
+ }
95
+
96
+ 100% {
97
+ font-size: 32px;
98
+ }
99
+ }
100
+
101
+
102
+
103
+
104
+ /* New Design */
105
+
106
+ .br_framework_settings h2 {
107
+ padding: 20px 0 30px!important;
108
+ }
109
+
110
+ .br_framework_settings header {
111
+ background-color: #2c3b48;
112
+ height: 80px;
113
+ position: relative;
114
+ z-index: 1000;
115
+ }
116
+
117
+ .br_framework_settings header .br_logo_white {
118
+ width: 130px;
119
+ height: 60px;
120
+ position: absolute;
121
+ top: 0;
122
+ left: 0;
123
+ padding: 10px;
124
+ text-align: center;
125
+ }
126
+
127
+ .br_framework_settings header .br_logo_white img {
128
+ max-width: 100%;
129
+ max-height: 100%;
130
+ }
131
+
132
+ .br_framework_settings header .br_plugin_name {
133
+ box-sizing: border-box;
134
+ font-size: 20px;
135
+ line-height: 20px;
136
+ overflow: hidden;
137
+ padding: 14px 40px 14px 150px;
138
+ }
139
+
140
+ .br_framework_settings header .br_plugin_name h1,
141
+ .br_framework_settings header .br_plugin_name h3 {
142
+ color: white;
143
+ margin: 0;
144
+ padding: 0;
145
+ font-size: 18px;
146
+ overflow: hidden;
147
+ text-overflow: ellipsis;
148
+ white-space: nowrap;
149
+ }
150
+
151
+ .br_framework_settings header .br_plugin_name h3 {
152
+ font-size: 13px;
153
+ font-weight: normal;
154
+ color: #B8B8B8;
155
+ }
156
+
157
+ .br_framework_settings header nav.premium {
158
+ float: right;
159
+ }
160
+
161
+ .br_framework_settings header nav.premium a {
162
+ color: white;
163
+ font-size: 42px;
164
+ line-height: 80px;
165
+ margin-right: 30px;
166
+ text-decoration: none;
167
+ }
168
+
169
+ .br_framework_settings .body {
170
+ position: relative;
171
+ background-color: #f0f0f0;
172
+ display: table;
173
+ width: 100%;
174
+ }
175
+
176
+ .br_framework_settings .body ul.side {
177
+ width: 150px;
178
+ display: table-cell;
179
+ background-color: #2c3b48;
180
+ box-shadow: 4px 0 6px #ddd;
181
+ margin: 0;
182
+ padding: 0 0 60px;
183
+ list-style-type: none;
184
+ }
185
+
186
+ .br_framework_settings .body .content {
187
+ box-sizing: border-box;
188
+ display: table-cell;
189
+ min-height: 400px;
190
+ padding: 0 30px 20px 30px;
191
+ width: 90%;
192
+ }
193
+
194
+ .br_framework_settings .body ul.side li {
195
+ list-style-type: none;
196
+ display: block;
197
+ text-align: center;
198
+ margin: 0;
199
+ position: relative;
200
+ z-index: 100;
201
+ background-color: #2c3b48;
202
+ }
203
+
204
+ .br_framework_settings .body ul.side li a {
205
+ display: block;
206
+ color: #B8B8B8;
207
+ text-decoration: none;
208
+ font-size: 14px;
209
+ padding: 20px 5px;
210
+ transition: 0.5s background;
211
+ }
212
+ .br_framework_settings .body ul.side li a.redirect_link.default {
213
+ background-color: #0085ba;
214
+ }
215
+
216
+ .br_framework_settings .body ul.side li a,
217
+ .br_framework_settings .body ul.side li a:hover,
218
+ .br_framework_settings .body ul.side li a:active,
219
+ .br_framework_settings .body ul.side li a:focus {
220
+ outline: none;
221
+ box-shadow: none;
222
+ }
223
+
224
+ .br_framework_settings .body ul.side li:hover a {
225
+ color: white;
226
+ }
227
+
228
+ .br_framework_settings .body ul.side li a.active {
229
+ background: rgba(0, 0, 0, 0.2) none repeat scroll 0 0;
230
+ border-left: 3px solid #009688;
231
+ border-right: 3px solid #2c3b48;
232
+ color: white;
233
+ }
234
+
235
+ .br_framework_settings .body ul.side li span {
236
+ display: block;
237
+ color: white;
238
+ font-size: 32px;
239
+ padding-bottom: 6px;
240
+ }
241
+
242
+ .br_framework_settings .body .content .title {
243
+ margin-left: -30px;
244
+ margin-right: -30px;
245
+ padding-left: 40px;
246
+ height: 50px;
247
+ line-height: 50px;
248
+ background: white;
249
+ color: #777;
250
+ font-size: 18px;
251
+ position: relative;
252
+ box-shadow: -5px 0 8px #ddd;
253
+ box-sizing: border-box;
254
+ }
255
+
256
+ .br_framework_settings .body .content .title:after {
257
+ content: "\f105";
258
+ font-family: FontAwesome;
259
+ left: 20px;
260
+ position: absolute;
261
+ }
262
+
263
+ .br_framework_settings .body .content .title span {
264
+ padding-right: 5px;
265
+ }
266
+
267
+ .br_framework_settings .body .content .framework-form-table {
268
+ margin-top: 0;
269
+ width: 100%;
270
+ }
271
+
272
+ .br_framework_settings .framework-form-table h2{
273
+ padding: 0 !important
274
+ }
275
+
276
+ .br_framework_settings .body .content form {
277
+ margin-top: 30px;
278
+ }
279
+
280
+ .br_framework_settings form.show_premium .nav-block {
281
+ float: left;
282
+ width: 60%;
283
+ box-sizing: border-box;
284
+ }
285
+
286
+ .br_framework_settings form.show_premium .paid_features,
287
+ .br_framework_settings form.show_premium .berocket_subscribe {
288
+ float: right;
289
+ clear: right;
290
+ width: 38%;
291
+ box-sizing: border-box;
292
+ text-align: center;
293
+ margin-bottom: 30px;
294
+ }
295
+
296
+ .br_framework_settings form.show_premium .paid_features ul li {
297
+ text-align: left;
298
+ }
299
+
300
+ .br_framework_settings .button {
301
+ margin-top: 30px;
302
+ margin-bottom: 20px;
303
+ color: #fff;
304
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
305
+ text-shadow: none;
306
+ border: 0 none;
307
+ min-width: 120px;
308
+ -moz-user-select: none;
309
+ background: #009688 none repeat scroll 0 0;
310
+ box-sizing: border-box;
311
+ cursor: pointer;
312
+ display: inline-block;
313
+ font-size: 14px;
314
+ outline: 0 none;
315
+ padding: 8px 32px;
316
+ position: relative;
317
+ text-align: center;
318
+ text-decoration: none;
319
+ transition: box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0s, background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0s;
320
+ white-space: nowrap;
321
+ height: auto;
322
+ }
323
+
324
+ .br_framework_settings .br_colorpicker {
325
+ width: 2em;
326
+ height: 2em;
327
+ border: 2px solid #009688;
328
+ position: relative;
329
+ display: inline-block;
330
+ padding: 6px;
331
+ cursor: pointer;
332
+ }
333
+
334
+ .br_framework_settings .berocket_color {
335
+ display: inline-block;
336
+ }
337
+
338
+ .br_framework_settings .br_colorpicker:hover {
339
+ border: 2px solid #00beb0;
340
+ }
341
+
342
+ .br_framework_settings .br_colorpicker ~ .br_colorpicker_default {
343
+ margin: 0;
344
+ margin-left: 10px;
345
+ }
346
+
347
+ .berocket_selected_image {
348
+ height: 90px;
349
+ width: 90px;
350
+ display: inline-block;
351
+ line-height: 85px;
352
+ padding: 5px;
353
+ vertical-align: bottom;
354
+ }
355
+ .berocket_selected_image img {
356
+ max-width: 90px;
357
+ max-height: 90px;
358
+ vertical-align: middle;
359
+ }
360
+
361
+ /* FONT AWESOME SELECTOR */
362
+
363
+ .berocket_select_fontawesome {
364
+ margin: 0.5em 0;
365
+ }
366
+
367
+ .br_framework_settings .berocket_select_fontawesome .button {
368
+ margin-top: 10px;
369
+ margin-bottom: 10px;
370
+ }
371
+
372
+ .br_framework_settings .berocket_select_fontawesome .berocket_selected_fa {
373
+ font-size: 32px;
374
+ line-height: 62px;
375
+ width: 50px;
376
+ display: inline-block;
377
+ text-align: center;
378
+ }
379
+
380
+ .br_framework_settings .berocket_select_fontawesome .berocket_selected_image.berocket_selected_fa {
381
+ font-size: 62px;
382
+ line-height: 90px;
383
+ height: 90px;
384
+ width: 90px;
385
+ display: inline-block;
386
+ text-align: center;
387
+ }
388
+
389
+ .br_framework_settings .berocket_select_fontawesome.berocket_select_image .button {
390
+ margin: 29px 0.5em 29px 0;
391
+ }
392
+
393
+ .berocket_select_fontawesome .berocket_fa_dark {
394
+ display: none;
395
+ position: fixed;
396
+ top: 0;
397
+ bottom: 0;
398
+ left: 0;
399
+ right: 0;
400
+ z-index: 50000;
401
+ background-color: rgba(0, 0, 0, 0.5);
402
+ }
403
+ .berocket_select_fontawesome .berocket_fa_popup {
404
+ position: fixed;
405
+ top: 10%;
406
+ bottom: 10%;
407
+ left: 10%;
408
+ right: 10%;
409
+ z-index: 50100;
410
+ background-color: rgb(241, 241, 241);
411
+ border-radius: 5px;
412
+ }
413
+
414
+ .berocket_select_fontawesome .berocket_fa_search {
415
+ height: 30px;
416
+ box-sizing: border-box;
417
+ margin: 5px 15%;
418
+ width: 70%;
419
+ }
420
+
421
+ .berocket_select_fontawesome .berocket_fa_close {
422
+ font-size: 32px;
423
+ color: #555;
424
+ cursor: pointer;
425
+ position: absolute;
426
+ top: 5px;
427
+ right: 5px;
428
+ z-index: 500;
429
+ }
430
+
431
+ .berocket_select_fontawesome .berocket_fa_close:hover {
432
+ color: #338;
433
+ }
434
+
435
+ .berocket_select_fontawesome .berocket_fa_list {
436
+ position: absolute;
437
+ top: 40px;
438
+ bottom: 0;
439
+ left: 0;
440
+ right: 0;
441
+ overflow: auto;
442
+ padding: 0.5em;
443
+ }
444
+
445
+ .berocket_select_fontawesome .berocket_fa_list .berocket_fa_icon {
446
+ font-size: 32px;
447
+ display: inline-block;
448
+ line-height: 50px;
449
+ width: 50px;
450
+ height: 50px;
451
+ text-align: center;
452
+ vertical-align: middle;
453
+ position: relative;
454
+ margin: 0 0.5em;
455
+ }
456
+
457
+ .berocket_select_fontawesome .berocket_fa_list .berocket_fa_icon .fa {
458
+ font-size: 32px;
459
+ line-height: 50px;
460
+ width: 50px;
461
+ height: 50px;
462
+ color: #555;
463
+ }
464
+
465
+ .berocket_select_fontawesome .berocket_fa_list .berocket_fa_icon .berocket_fa_preview {
466
+ position: absolute;
467
+ height: 50px;
468
+ top: 0;
469
+ left: 0;
470
+ white-space: nowrap;
471
+ border-radius: 5px;
472
+ }
473
+
474
+ .berocket_select_fontawesome .berocket_fa_list .berocket_fa_icon .berocket_fa_hover {
475
+ position: absolute;
476
+ top: 0;
477
+ bottom: 0;
478
+ left: 0;
479
+ right: 0;
480
+ z-index: 100;
481
+ cursor: pointer;
482
+ }
483
+
484
+ .berocket_select_fontawesome .berocket_fa_list .berocket_fa_icon .berocket_fa_hover:hover ~ .berocket_fa_preview {
485
+ background-color: #CCC;
486
+ z-index: 50;
487
+ }
488
+
489
+ .berocket_select_fontawesome .berocket_fa_list .berocket_fa_icon .berocket_fa_preview span {
490
+ display: none;
491
+ font-size: 18px;
492
+ white-space: nowrap;
493
+ padding-right: 10px;
494
+ padding-left: 10px;
495
+ line-height: 50px;
496
+ vertical-align: top;
497
+ color: #555;
498
+ }
499
+
500
+ .berocket_select_fontawesome .berocket_fa_list .berocket_fa_icon .berocket_fa_hover:hover ~ .berocket_fa_preview span {
501
+ display: inline-block;
502
+ }
503
+
504
+ /* PRODUCTS SELECTOR */
505
+
506
+ .br_framework_settings .berocket_search_box {
507
+ position: relative;
508
+ }
509
+ .br_framework_settings .berocket_products_search {
510
+ border: 1px solid #777;
511
+ background: #ffffff;
512
+ padding: 0.3em 0.3em 0 0.3em;
513
+ cursor: text;
514
+ margin: 0;
515
+ position: relative;
516
+ top: 1px;
517
+ }
518
+ .br_framework_settings .berocket_products_search * {
519
+ font-size: 1em;
520
+ }
521
+ .br_framework_settings .berocket_products_search li {
522
+ display: inline-block;
523
+ font-size: 1em;
524
+ line-height: 1em;
525
+ padding: 0;
526
+ margin: 0;
527
+ margin-right: 0.3em!important;
528
+ margin-bottom: 0.3em!important;
529
+ }
530
+ .br_framework_settings .berocket_products_search li .berocket_loads {
531
+ position: absolute;
532
+ right: 0.3em;
533
+ bottom: 0.3em;
534
+ font-size: 28px;
535
+ }
536
+ .br_framework_settings .berocket_products_search .berocket_search_input {
537
+ font-size: 1em;
538
+ line-height: 1em;
539
+ padding: 0.1em;
540
+ border: 0;
541
+ outline: 0;
542
+ min-width: 250px;
543
+ height: 28px;
544
+ box-shadow: none;
545
+ }
546
+ .br_framework_settings .berocket_products_search .berocket_search_input:focus {
547
+ outline: 0;
548
+ box-shadow: none;
549
+ }
550
+ .berocket_search_result {
551
+ border: 1px solid #999;
552
+ border-top: 0;
553
+ background: #f7f7f7;
554
+ margin: 0;
555
+ position: absolute;
556
+ left: 0;
557
+ right: 0;
558
+ top: 100%;
559
+ max-height: 200px;
560
+ overflow: auto;
561
+ padding: 0.3em;
562
+ z-index: 1000;
563
+ }
564
+ .berocket_search_result li {
565
+ cursor: pointer;
566
+ padding: 0.3em;
567
+ }
568
+ .berocket_search_result li:hover {
569
+ background: #efefef;
570
+ }
571
+
572
+ .br_framework_settings .berocket_products_search li.button {
573
+ line-height: 26px;
574
+ padding: 0 10px;
575
+ max-width: 600px;
576
+ overflow: hidden;
577
+ }
578
+ .br_framework_settings .single_product .berocket_products_search li.button {
579
+ max-width: initial;
580
+ width: 100%;
581
+ }
582
+
583
+ /* ----------------- */
584
+
585
+ .br_framework_settings .button:hover,
586
+ .br_framework_settings .button:focus,
587
+ .br_framework_settings .button:active{
588
+ background: #00beb0 none repeat scroll 0 0;
589
+ color: white;
590
+ }
591
+
592
+ .br_framework_settings form .framework-form-table > tbody > tr > th,
593
+ .br_framework_settings form .framework-form-table > thead > tr > th,
594
+ .br_framework_settings form .framework-form-table > tfoot > tr > th,
595
+ .br_framework_settings form .framework-form-table > tr > th {
596
+ width: 210px;
597
+ padding: 10px 10px 10px 0;
598
+ font-size: 15px;
599
+ text-align: left;
600
+ }
601
+
602
+
603
+ .br_framework_settings .framework-form-table > tbody > tr > td,
604
+ .br_framework_settings .framework-form-table > thead > tr > td,
605
+ .br_framework_settings .framework-form-table > tfoot > tr > td,
606
+ .br_framework_settings .framework-form-table > tr > td {
607
+ padding: 10px;
608
+ }
609
+
610
+ .br_framework_settings form .nav-block,
611
+ .br_framework_settings form .paid_features,
612
+ .br_framework_settings form .berocket_subscribe {
613
+ border-radius: 3px;
614
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.06);
615
+ overflow: auto;
616
+ position: relative;
617
+ background-color: rgb(255, 255, 255);
618
+ color: rgba(0, 0, 0, 0.87);
619
+ padding: 0 25px;
620
+ }
621
+ .br_framework_settings form .berocket_subscribe {
622
+ background-color: #2c3644;
623
+ background-image: url(mail.png);
624
+ background-position: right top;
625
+ background-repeat: no-repeat;
626
+ color: #aaa;
627
+ font-size: 16px;
628
+ overflow: hidden;
629
+ }
630
+ .br_framework_settings form .berocket_subscribe h3 {
631
+ color: white;
632
+ }
633
+ .br_framework_settings form .berocket_subscribe p {
634
+ font-size: 16px;
635
+ text-align: left;
636
+ }
637
+ .br_framework_settings form .berocket_subscribe .error {
638
+ color: #d02c21;
639
+ }
640
+ .br_framework_settings form .berocket_subscribe .berocket_subscribe_email {
641
+ background-color: #404c5d;
642
+ border: 0;
643
+ outline: 0;
644
+ color: #aaa;
645
+ width: 100%;
646
+ line-height: 2em;
647
+ font-size: 16px;
648
+ }
649
+
650
+ .br_framework_settings form .nav-block {
651
+ padding-top: 15px;
652
+ padding-bottom: 15px;
653
+ }
654
+
655
+ #berocket_product_key {
656
+ width: 80%;
657
+ min-width: 100px;
658
+ }
659
+
660
+ .br_settings_footer {
661
+ margin-right: 20px;
662
+ }
663
+
664
+ .br_settings_footer a {
665
+ color: #009688;
666
+ text-decoration: none;
667
+ }
668
+
669
+ .br_framework_settings .button.accent {
670
+ background: #ff5252 none repeat scroll 0 0;
671
+ }
672
+
673
+ .br_framework_settings .button.accent:hover,
674
+ .br_framework_settings .button.accent:focus,
675
+ .br_framework_settings .button.accent:active {
676
+ background: #ff6e68 none repeat scroll 0 0;
677
+ color: white;
678
+ }
679
+
680
+ .paid_features ul li{
681
+ list-style: initial;
682
+ margin-left: 2em;
683
+ }
684
+
685
+ #footer-thankyou, #footer-upgrade{
686
+ display: none;
687
+ }
688
+
689
+ .clear-both {
690
+ clear: both;
691
+ }
692
+
693
+
694
+
695
+
696
+ /* Responsive styles */
697
+
698
+ @media screen and (max-width: 900px) {
699
+ .br_framework_settings form.show_premium .nav-block,
700
+ .br_framework_settings form.show_premium .paid_features,
701
+ .br_framework_settings form.show_premium .berocket_subscribe {
702
+ float: none;
703
+ width: 100%;
704
+ }
705
+
706
+ .br_framework_settings form.show_premium .paid_features,
707
+ .br_framework_settings form.show_premium .berocket_subscribe {
708
+ margin-top: 30px;
709
+ margin-bottom: 0;
710
+ }
711
+ }
712
+
713
+ @media screen and (max-width: 782px) {
714
+ .br_framework_settings header .br_logo_white {
715
+ width: 60px;
716
+ }
717
+
718
+ .br_framework_settings header .br_plugin_name {
719
+ padding-left: 80px;
720
+ }
721
+
722
+ .br_framework_settings .body ul.side {
723
+ width: 100px;
724
+ }
725
+
726
+ .br_framework_settings .body .content {
727
+ padding-left: 20px;
728
+ }
729
+
730
+ .br_framework_settings .body .content .title {
731
+ margin-left: -20px;
732
+ }
733
+
734
+ .br_framework_settings .framework-form-table > tbody > tr > td,
735
+ .br_framework_settings .framework-form-table > thead > tr > td,
736
+ .br_framework_settings .framework-form-table > tfoot > tr > td,
737
+ .br_framework_settings .framework-form-table > tr > td,
738
+ .br_framework_settings .framework-form-table > tbody > tr > th,
739
+ .br_framework_settings .framework-form-table > thead > tr > th,
740
+ .br_framework_settings .framework-form-table > tfoot > tr > th,
741
+ .br_framework_settings .framework-form-table > tr > th {
742
+ display: table-cell;
743
+ padding: 5px 10px;
744
+ }
745
+
746
+ .br_framework_settings .framework-form-table > tbody > tr > td,
747
+ .br_framework_settings .framework-form-table > thead > tr > td,
748
+ .br_framework_settings .framework-form-table > tfoot > tr > td,
749
+ .br_framework_settings .framework-form-table > tr > td {
750
+ padding: 10px 10px 10px 0;
751
+ }
752
+
753
+ .br_framework_settings header nav.premium a {
754
+ font-size: 32px;
755
+ }
756
+
757
+ .br_framework_settings header .br_plugin_name h1 {
758
+ font-size: 14px;
759
+ }
760
+
761
+ .br_framework_settings header .br_plugin_name h3 {
762
+ font-size: 12px;
763
+ }
764
+ }
765
+
766
+ @media screen and (max-width: 600px) {
767
+ .br_framework_settings header .br_plugin_name {
768
+ display: none;
769
+ }
770
+
771
+ .br_framework_settings .body .content .title {
772
+ padding-left: 20px;
773
+ }
774
+
775
+ .br_framework_settings .framework-form-table > tbody > tr > td,
776
+ .br_framework_settings .framework-form-table > thead > tr > td,
777
+ .br_framework_settings .framework-form-table > tfoot > tr > td,
778
+ .br_framework_settings .framework-form-table > tr > td,
779
+ .br_framework_settings .framework-form-table > tbody > tr > th,
780
+ .br_framework_settings .framework-form-table > thead > tr > th,
781
+ .br_framework_settings .framework-form-table > tfoot > tr > th,
782
+ .br_framework_settings .framework-form-table > tr > th {
783
+ display: block;
784
+ padding: 10px 10px 0 0;
785
+ }
786
+
787
+ .br_framework_settings .framework-form-table > tbody > tr > td,
788
+ .br_framework_settings .framework-form-table > thead > tr > td,
789
+ .br_framework_settings .framework-form-table > tfoot > tr > td,
790
+ .br_framework_settings .framework-form-table > tr > td {
791
+ margin-bottom: 0;
792
+ padding: 4px 10px 6px 0;
793
+ }
794
+ }
795
+
796
+ .br_framework_settings.br_setup_wizard .body ul.side li a.close {
797
+ opacity: 0.3;
798
+ }
799
+ .br_framework_settings.br_setup_wizard {
800
+ max-width: 900px;
801
+ margin: auto;
802
+ }
803
+ .br_framework_settings.br_setup_wizard .br_setup_wizard_bottom_links {
804
+ text-align: center;
805
+ }
806
+ .br_framework_settings.br_setup_wizard .br_setup_wizard_bottom_links a {
807
+ margin: 5px;
808
+ }
809
+ .br_framework_settings.br_setup_wizard .body {
810
+ min-height: 100vh;
811
+ }
wizard/main.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if( ! class_exists('BeRocket_selector_wizard_woocommerce') ) {
4
+ class BeRocket_selector_wizard_woocommerce{
5
+ function __construct() {
6
+ add_action('BeRocket_wizard_start', array($this, 'import_products'));
7
+ add_action('BeRocket_wizard_javascript', array($this, 'javascript'));
8
+ add_action('BeRocket_wizard_end', array($this, 'remove_products'));
9
+ add_filter('BeRocket_wizard_category_link', array($this, 'category_link'));
10
+ add_action( 'wp_ajax_berocket_wizard_selector_start', array( $this, 'wizard_selector_start' ) );
11
+ add_action( 'wp_ajax_berocket_wizard_selector_end', array( $this, 'remove_products' ) );
12
+ $status = get_option('BeRocket_selector_wizard_status');
13
+ if( $status == 'started' ) {
14
+ add_filter('loop_shop_per_page', array($this, 'loop_shop_per_page'), 999999999999999 );
15
+ add_action('pre_get_posts', array($this, 'products_per_page'), 999999999999999);
16
+ }
17
+ }
18
+
19
+ public function products_per_page($query) {
20
+ $query->set( 'posts_per_page', 3 );
21
+ }
22
+ public function products_per_page_more($query) {
23
+ $query->set( 'posts_per_page', 100 );
24
+ }
25
+ function loop_shop_per_page($cols) {
26
+ return 3;
27
+ }
28
+ public function javascript() {
29
+ wp_enqueue_script( 'jquery' );
30
+ wp_enqueue_script( 'berocket_wizard_autoselect', plugins_url( 'wizard.js', __FILE__ ), array( 'jquery' ) );
31
+ wp_localize_script(
32
+ 'berocket_wizard_autoselect',
33
+ 'berocket_wizard_autoselect',
34
+ array(
35
+ 'creating_products' => __('Creating products', 'BeRocket_domain'),
36
+ 'getting_selectors' => __('Gettings selectors', 'BeRocket_domain'),
37
+ 'removing_products' => __('Removing products', 'BeRocket_domain'),
38
+ 'error' => __('Error:', 'BeRocket_domain'),
39
+ 'ajaxurl' => admin_url('admin-ajax.php')
40
+ )
41
+ );
42
+ wp_register_style( 'berocket_wizard_autoselect', plugins_url( 'wizard.css', __FILE__ ) );
43
+ wp_enqueue_style( 'berocket_wizard_autoselect' );
44
+ }
45
+
46
+ public function category_link($link) {
47
+ $term = get_term_by('name', 'BeRocketSelectors', 'product_cat');
48
+ return get_term_link($term);
49
+ }
50
+
51
+ public function wizard_selector_start() {
52
+ $this->import_products();
53
+ echo $this->category_link('');
54
+ wp_die();
55
+ }
56
+
57
+ public function import_products($position = 0) {
58
+ $status = get_option('BeRocket_selector_wizard_status');
59
+ if( $status != 'started' ) {
60
+ update_option('BeRocket_selector_wizard_status', 'started');
61
+ global $wpdb;
62
+ include_once( WC_ABSPATH . 'includes/admin/importers/class-wc-product-csv-importer-controller.php' );
63
+ include_once( WC_ABSPATH . 'includes/import/class-wc-product-csv-importer.php' );
64
+ $file = dirname( __FILE__ ) . '/products.csv';
65
+ $params = array(
66
+ 'delimiter' => ',',
67
+ 'mapping' => array(
68
+ "ID" => "id",
69
+ "Type" => "type",
70
+ "SKU" => "sku",
71
+ "Name" => "name",
72
+ "Published" => "published",
73
+ "Is featured?" => "featured",
74
+ "Visibility in catalog" => "catalog_visibility",
75
+ "Short description" => "short_description",
76
+ "Description" => "description",
77
+ "Date sale price starts" => "date_on_sale_from",
78
+ "Date sale price ends" => "date_on_sale_to",
79
+ "Tax status" => "tax_status",
80
+ "Tax class" => "tax_class",
81
+ "In stock?" => "stock_status",
82
+ "Stock" => "stock_quantity",
83
+ "Backorders allowed?" => "backorders",
84
+ "Sold individually?" => "sold_individually",
85
+ "Weight (kg)" => "weight",
86
+ "Length (cm)" => "length",
87
+ "Width (cm)" => "width",
88
+ "Height (cm)" => "height",
89
+ "Allow customer reviews?" => "reviews_allowed",
90
+ "Purchase note" => "purchase_note",
91
+ "Sale price" => "sale_price",
92
+ "Regular price" => "regular_price",
93
+ "Categories" => "category_ids",
94
+ "Tags" => "tag_ids",
95
+ "Shipping class" => "shipping_class_id",
96
+ "Images" => "images",
97
+ "Download limit" => "download_limit",
98
+ "Download expiry days" => "download_expiry",
99
+ "Parent" => "parent_id",
100
+ "Grouped products" => "grouped_products",
101
+ "Upsells" => "upsell_ids",
102
+ "Cross-sells" => "cross_sell_ids",
103
+ "External URL" => "product_url",
104
+ "Button text" => "button_text",
105
+ "Position" => "menu_order"
106
+ ),
107
+ 'update_existing' => false,
108
+ 'lines' => 100,
109
+ 'parse' => true,
110
+ );
111
+
112
+ $importer = WC_Product_CSV_Importer_Controller::get_importer( $file, $params );
113
+ $results = $importer->import();
114
+ $percent_complete = $importer->get_percent_complete();
115
+
116
+ if ( 100 === $percent_complete ) {
117
+ // Clear temp meta.
118
+ $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_original_id' ) );
119
+ $wpdb->delete( $wpdb->posts, array( 'post_status' => 'importing', 'post_type' => 'product' ) );
120
+ $wpdb->delete( $wpdb->posts, array( 'post_status' => 'importing', 'post_type' => 'product_variation' ) );
121
+
122
+ $blog_id_var = get_current_blog_id();
123
+ do_action('berocket_multisite_import_done', $blog_id_var);
124
+ update_option('berocket_multisite_import_ready', '1');
125
+ // Send success.
126
+ return 'done';
127
+ } else {
128
+ return $this->import_products($importer->get_file_position());
129
+ }
130
+ }
131
+ }
132
+
133
+ function remove_products() {
134
+ remove_filter('loop_shop_per_page', array($this, 'loop_shop_per_page'), 999999999999999 );
135
+ remove_action('pre_get_posts', array($this, 'products_per_page'), 999999999999999);
136
+ add_action('pre_get_posts', array($this, 'products_per_page_more'), 999999999999999);
137
+ $args = array("post_type" => "product", "s" => 'BeRocketSelectorsTest', 'posts_per_page' => 100);
138
+ $query = get_posts( $args );
139
+ if( is_array($query) ) {
140
+ echo count($query);
141
+ foreach($query as $product) {
142
+ wp_delete_post($product->ID, true);
143
+ }
144
+ }
145
+ $term = get_term_by('name', 'BeRocketSelectors', 'product_cat');
146
+ wp_delete_term($term->term_id, $term->taxonomy);
147
+ update_option('BeRocket_selector_wizard_status', 'ended');
148
+ wp_die();
149
+ }
150
+ }
151
+ new BeRocket_selector_wizard_woocommerce();
152
+ function BeRocket_wizard_generate_autoselectors($input_classes = array(), $js_functions = array()) {
153
+ $js_functions = array_merge(
154
+ array(
155
+ 'any' => '',
156
+ 'success' => '',
157
+ 'error' => '',
158
+ 'percent' => '',
159
+ ), $js_functions);
160
+ $input_classes = array_merge(
161
+ array(
162
+ 'products' => '',
163
+ 'product' => '',
164
+ 'pagination' => '',
165
+ 'next_page' => '',
166
+ 'prev_page' => '',
167
+ 'result_count' => '',
168
+ ), $input_classes);
169
+ $html = '<div class="berocket_wizard_autoselectors" data-functions=\'' . json_encode($js_functions) . '\' data-inputs=\'' . json_encode($input_classes) . '\'>
170
+ <button class="berocket_autoselector button" type="button">Auto-Selectors</button>
171
+ <span class="berocket_autoselect_spin" style="display:none;"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></span>
172
+ <span class="berocket_autoselect_ready" style="display:none;"><i class="fa fa-check fa-3x fa-fw"></i></span>
173
+ <span class="berocket_autoselect_error" style="display:none;"><i class="fa fa-times fa-3x fa-fw"></i></span>
174
+ <div class="berocket_autoselector_load" style="display:none;"><div class="berocket_line"></div><div class="berocket_autoselector_action"></div></div>
175
+ </div>';
176
+ return $html;
177
+ }
178
+ }
wizard/products.csv ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ID,Type,SKU,Name,Published,"Is featured?","Visibility in catalog","Short description",Description,"Date sale price starts","Date sale price ends","Tax status","Tax class","In stock?",Stock,"Backorders allowed?","Sold individually?","Weight (kg)","Length (cm)","Width (cm)","Height (cm)","Allow customer reviews?","Purchase note","Sale price","Regular price",Categories,Tags,"Shipping class",Images,"Download limit","Download expiry days",Parent,"Grouped products",Upsells,Cross-sells,"External URL","Button text",Position
2
+ 1,"simple, downloadable, virtual",,BeRocketSelectorsTest10,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
3
+ 2,"simple, downloadable",,BeRocketSelectorsTest11,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
4
+ 3,"simple",,BeRocketSelectorsTest12,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
5
+ 4,"simple, downloadable, virtual",,BeRocketSelectorsTest13,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
6
+ 5,"simple, downloadable",,BeRocketSelectorsTest14,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
7
+ 6,"simple",,BeRocketSelectorsTest15,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
8
+ 7,"simple, downloadable, virtual",,BeRocketSelectorsTest16,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
9
+ 8,"simple, downloadable",,BeRocketSelectorsTest17,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
10
+ 9,"simple",,BeRocketSelectorsTest18,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
11
+ 10,"simple, downloadable, virtual",,BeRocketSelectorsTest19,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
12
+ 11,"simple, downloadable",,BeRocketSelectorsTest20,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
13
+ 12,"simple",,BeRocketSelectorsTest21,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
14
+ 13,"simple, downloadable, virtual",,BeRocketSelectorsTest22,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
15
+ 14,"simple, downloadable",,BeRocketSelectorsTest23,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
16
+ 15,"simple",,BeRocketSelectorsTest24,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
17
+ 16,"simple, downloadable, virtual",,BeRocketSelectorsTest25,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
18
+ 17,"simple, downloadable",,BeRocketSelectorsTest26,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
19
+ 18,"simple",,BeRocketSelectorsTest27,1,0,visible,,,,,taxable,,1,,0,0,,,,,1,,,1,BeRocketSelectors,,,,'-1,'-1,,,,,,,0
wizard/setup-wizard.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( ! class_exists('BeRocket_Setup_Wizard') ) {
3
+ class BeRocket_Setup_Wizard {
4
+ public $step = '';
5
+ public $steps = array();
6
+ public $page_id = '';
7
+ public $options = '';
8
+ public function __construct($page_id, $options = array()) {
9
+ if( empty($page_id) ) {
10
+ $page_id = 'berocket-setup';
11
+ }
12
+ $this->options = array_merge(array(
13
+ 'title' => __( 'Setup Wizard', 'BeRocket_domain' )
14
+ ), $options);
15
+ $this->page_id = $page_id;
16
+ if ( ! empty( $_GET['page'] ) && $_GET['page'] == $this->page_id ) {
17
+ $this->steps = apply_filters('berocket_wizard_steps_'.$this->page_id,
18
+ array(
19
+ 'start' => array(
20
+ 'name' => __( 'Start', 'BeRocket_domain' ),
21
+ 'view' => array( $this, 'start_step' ),
22
+ 'handler' => array( $this, 'start_step_save' ),
23
+ 'fa_icon' => 'fa-cog',
24
+ ),
25
+ 'end' => array(
26
+ 'name' => __( 'End', 'BeRocket_domain' ),
27
+ 'view' => array( $this, 'end_step' ),
28
+ 'handler' => '',
29
+ 'fa_icon' => 'fa-cog',
30
+ ),
31
+ )
32
+ );
33
+ add_action( 'admin_menu', array( $this, 'admin_menus' ) );
34
+ add_action( 'admin_init', array( $this, 'setup_wizard' ) );
35
+ }
36
+ }
37
+ public function admin_menus() {
38
+ add_dashboard_page( '', '', 'manage_options', $this->page_id, '' );
39
+ }
40
+ public function setup_wizard() {
41
+ if ( empty( $_GET['page'] ) || $this->page_id !== $_GET['page'] ) {
42
+ return;
43
+ }
44
+ do_action('before_wizard_run_'.$this->page_id, $this);
45
+ $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
46
+
47
+ if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
48
+ call_user_func( $this->steps[ $this->step ]['handler'], $this );
49
+ }
50
+ wp_admin_css();
51
+ wp_register_style( 'wizard-setup', plugins_url( 'admin.css', __FILE__ ) );
52
+ wp_enqueue_style( 'wizard-setup' );
53
+ wp_enqueue_style( 'font-awesome' );
54
+
55
+ ob_start();
56
+ $this->setup_wizard_header();
57
+ $this->setup_wizard_steps();
58
+ $this->setup_wizard_content();
59
+ $this->setup_wizard_footer();
60
+ exit;
61
+ }
62
+ public function get_next_step_link( $step = '' ) {
63
+ if ( ! $step ) {
64
+ $step = $this->step;
65
+ }
66
+ $keys = array_keys( $this->steps );
67
+ if ( end( $keys ) === $step ) {
68
+ return admin_url();
69
+ }
70
+ $step_index = array_search( $step, $keys );
71
+ if ( false === $step_index ) {
72
+ return '';
73
+ }
74
+ return add_query_arg( 'step', $keys[ $step_index + 1 ], remove_query_arg( 'activate_error' ) );
75
+ }
76
+ public function redirect_to_next_step() {
77
+ wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
78
+ }
79
+
80
+ /**
81
+ * Setup Wizard Header.
82
+ */
83
+ public function setup_wizard_header() {
84
+ ?>
85
+ <!DOCTYPE html>
86
+ <html <?php language_attributes(); ?>>
87
+ <head>
88
+ <meta name="viewport" content="width=device-width" />
89
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
90
+ <title><?php esc_html_e( 'WooCommerce &rsaquo; Setup Wizard', 'woocommerce' ); ?></title>
91
+ <?php do_action( 'admin_print_scripts' ); ?>
92
+ <?php do_action( 'admin_print_styles' ); ?>
93
+ <?php do_action( 'admin_head' ); ?>
94
+ </head>
95
+ <body class="wp-admin wp-core-ui js">
96
+ <div class="br_framework_settings br_setup_wizard">
97
+ <div class="body">
98
+ <?php
99
+ }
100
+
101
+ /**
102
+ * Setup Wizard Footer.
103
+ */
104
+ public function setup_wizard_footer() {
105
+ ?>
106
+ </div>
107
+ <div class="br_setup_wizard_bottom_links">
108
+ <a class="wc-return-to-dashboard" href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to your dashboard', 'woocommerce' ); ?></a>
109
+ <a class="wc-return-to-dashboard" href="<?php echo esc_url( $this->get_next_step_link() ); ?>"><?php esc_html_e( 'Skip this step', 'woocommerce' ); ?></a>
110
+ </div>
111
+ </div>
112
+ </body>
113
+ </html>
114
+ <?php
115
+ }
116
+
117
+ /**
118
+ * Output the steps.
119
+ */
120
+ public function setup_wizard_steps() {
121
+ $output_steps = $this->steps;
122
+ ?>
123
+ <ul class="side">
124
+ <?php foreach ( $output_steps as $step_key => $step ) : ?>
125
+ <li><a class="<?php
126
+ if ( $step_key === $this->step ) {
127
+ echo 'active';
128
+ } elseif ( array_search( $this->step, array_keys( $this->steps ) ) < array_search( $step_key, array_keys( $this->steps ) ) ) {
129
+ echo 'close';
130
+ }
131
+ ?>" href="<?php
132
+ if ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
133
+ echo add_query_arg( 'step', $step_key, remove_query_arg( 'activate_error' ) );
134
+ } else {
135
+ echo '#'.$step_key;
136
+ }
137
+ ?>"><?php if( ! empty($step['fa_icon']) ) echo '<span class="fa '.$step['fa_icon'].'"></span>'; ?><?php echo esc_html( $step['name'] ); ?></a></li>
138
+ <?php endforeach; ?>
139
+ </ul>
140
+ <?php
141
+ }
142
+ public function setup_wizard_content() {
143
+ echo '<div class="content">';
144
+ echo '<div class="title">'.(! empty($this->steps[ $this->step ]['fa_icon']) ? '<span class="fa '.$this->steps[ $this->step ]['fa_icon'].'"></span>' : '').$this->steps[ $this->step ]['name'].'</div>';
145
+ call_user_func( $this->steps[ $this->step ]['view'], $this, $this->step, $this->steps );
146
+ echo '</div>';
147
+ }
148
+ public function start_step() {
149
+ ?>
150
+ <form method="post" class="br_framework_submit_form">
151
+ <div class="nav-block berocket_framework_menu_general-block nav-block-active">
152
+ </div>
153
+ <?php wp_nonce_field( 'br-ajax-filters-setup' ); ?>
154
+ <p class="wc-setup-actions step">
155
+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Let's go!", 'woocommerce' ); ?>" name="save_step" />
156
+ </p>
157
+ </form>
158
+ <?php
159
+ }
160
+ public function start_step_save() {
161
+ check_admin_referer( 'br-ajax-filters-setup' );
162
+ wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
163
+ exit;
164
+ }
165
+ public function end_step() {
166
+ }
167
+ }
168
+ function berocket_add_setup_wizard($page_id, $options = array()) {
169
+ new BeRocket_Setup_Wizard($page_id, $options);
170
+ }
171
+ }
wizard/wizard.css ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .berocket_wizard_autoselectors .berocket_autoselect_spin,
2
+ .berocket_wizard_autoselectors .berocket_autoselect_ready,
3
+ .berocket_wizard_autoselectors .berocket_autoselect_error {
4
+ font-size: 9px;
5
+ }
6
+ .berocket_wizard_autoselectors .berocket_autoselect_ready {
7
+ color: #33bb33;
8
+ }
9
+ .berocket_wizard_autoselectors .berocket_autoselect_error {
10
+ color: #bb3333;
11
+ }
12
+ .berocket_wizard_autoselectors .berocket_autoselector_load {
13
+ border: 1px solid #777;
14
+ height: 22px;
15
+ width: 300px;
16
+ margin-top: 10px;
17
+ position: relative;
18
+ }
19
+ .berocket_wizard_autoselectors .berocket_autoselector_load .berocket_line {
20
+ height: 100%;
21
+ background-color: #FF8800;
22
+ }
23
+ .berocket_wizard_autoselectors .berocket_autoselector_action {
24
+ position: absolute;
25
+ top: 0;
26
+ left: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ line-height: 22px;
30
+ font-size: 16px;
31
+ text-align: center;
32
+ }
wizard/wizard.js ADDED
@@ -0,0 +1,469 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var BeRocket_wizard_selectors = {product:'', products:'',pagination:'', pagination_next:'', pagination_prev:'',products_count:''};
2
+ var BeRocket_wizard_check = function(category_page_url, input_data,execute_function) {
3
+ var $input_data = jQuery('<div>'+input_data+'</div>');
4
+ function end_selectors(status) {
5
+ if( typeof execute_function == 'function' ) {
6
+ execute_function(status);
7
+ }
8
+ }
9
+ function br_array_intersect(array1, array2) {
10
+ var return_array = [];
11
+ array1.forEach(function callback(cur1, i1, arr1) {
12
+ array2.some(function callback(cur2, i2, arr2) {
13
+ if( cur1 == cur2 ) {
14
+ return_array.push(cur1);
15
+ return true;
16
+ }
17
+ return false;
18
+ });
19
+ });
20
+ return return_array;
21
+ }
22
+ function br_remove_empty_classes(array) {
23
+ var return_arr = [];
24
+ array.forEach(function( item, i, arr) {
25
+ if( item ) {
26
+ return_arr.push(item);
27
+ }
28
+ });
29
+ return return_arr;
30
+ }
31
+ function br_remove_products_classes(array) {
32
+ var return_arr = [];
33
+ array.forEach(function( item, i, arr) {
34
+ if( item != 'type-product' && item != 'status-publish' && item != 'product_cat-berocketselectors' && item != 'instock'
35
+ && item != 'taxable' && item != 'shipping-taxable' && item != 'purchasable' && item != 'product-type-simple' ) {
36
+ return_arr.push(item);
37
+ }
38
+ });
39
+ return return_arr;
40
+ }
41
+ function br_find_like_product(array) {
42
+ var return_arr = [];
43
+ array.forEach(function( item, i, arr) {
44
+ if( item.search('product') != -1 ) {
45
+ return_arr.push(item);
46
+ }
47
+ });
48
+ return return_arr;
49
+ }
50
+ var products = ['BeRocketSelectorsTest10', 'BeRocketSelectorsTest11', 'BeRocketSelectorsTest12', 'BeRocketSelectorsTest13', 'BeRocketSelectorsTest14',
51
+ 'BeRocketSelectorsTest15', 'BeRocketSelectorsTest16', 'BeRocketSelectorsTest17', 'BeRocketSelectorsTest18', 'BeRocketSelectorsTest19',
52
+ 'BeRocketSelectorsTest20', 'BeRocketSelectorsTest21', 'BeRocketSelectorsTest22', 'BeRocketSelectorsTest23', 'BeRocketSelectorsTest24',
53
+ 'BeRocketSelectorsTest25', 'BeRocketSelectorsTest26', 'BeRocketSelectorsTest27'];
54
+ var search_next_product = '';
55
+ products.forEach(function( item, i, arr) {
56
+ if( $input_data.find(':contains("'+item+'")').length > 0 ) {
57
+ search_next_product += ':contains("'+item+'")';
58
+ }
59
+ });
60
+ var $elem = $input_data.find(search_next_product);
61
+ while($elem.length > 1) {
62
+ $elem = $elem.first().find(search_next_product);
63
+ }
64
+
65
+ var $elem = $elem.find(':contains("BeRocketSelectorsTest")');
66
+ while($elem.length > 1) {
67
+ $elem = $elem.first().find(':contains("BeRocketSelectorsTest")');
68
+ }
69
+ var current_product = '';
70
+ search_next_product = '';
71
+ products.forEach(function( item, i, arr) {
72
+ if( $elem.is(':contains("'+item+'")') ) {
73
+ current_product = item;
74
+ } else {
75
+ if( search_next_product != '' ) {
76
+ search_next_product += ',';
77
+ }
78
+ search_next_product += ':contains("'+item+'")';
79
+ }
80
+ });
81
+ i = 0;
82
+ while( $elem.next().find(search_next_product).length == 0
83
+ && $elem.next().next().find(search_next_product).length == 0
84
+ && $elem.next().next().next().find(search_next_product).length == 0
85
+ && i < 40) {
86
+ $elem = $elem.parent();
87
+ i++;
88
+ }
89
+ i = 0;
90
+ var has_product = 0;
91
+ var $has_elem = $elem;
92
+ do {
93
+ if( $has_elem.is(':contains("BeRocketSelectorsTest")') ) {
94
+ has_product++;
95
+ }
96
+ $has_elem = $has_elem.next();
97
+ i++;
98
+ } while( i < 10 );
99
+ if( has_product < 3 ) {
100
+ search_next_product = ''
101
+ products.some(function( item, i, arr) {
102
+ if( search_next_product != '' ) {
103
+ search_next_product += ',';
104
+ }
105
+ search_next_product += '[href*="'+item.toLowerCase()+'"]'
106
+ });
107
+ $elem = $input_data.find(search_next_product).first();
108
+ if( $elem.length == 0 ) {
109
+ end_selectors(false);
110
+ return false;
111
+ }
112
+ current_product = '';
113
+ search_next_product = '';
114
+ products.forEach(function( item, i, arr) {
115
+ if( $elem.is('[href*="'+item.toLowerCase()+'"]') ) {
116
+ current_product = item;
117
+ } else {
118
+ if( search_next_product != '' ) {
119
+ search_next_product += ',';
120
+ }
121
+ search_next_product += '[href*="'+item.toLowerCase()+'"]';
122
+ }
123
+ });
124
+ i = 0;
125
+ while($elem.next().find(search_next_product).length == 0
126
+ && $elem.next().next().find(search_next_product).length == 0
127
+ && $elem.next().next().next().find(search_next_product).length == 0
128
+ && i < 40) {
129
+ $elem = $elem.parent();
130
+ i++;
131
+ }
132
+ }
133
+ if( $elem.length == 0 || $elem.next().length == 0 || $elem.next().next().length == 0 ) {
134
+ end_selectors(false);
135
+ return false;
136
+ }
137
+ if( $elem.hasClass('product')) {
138
+ var result_classes = ['product'];
139
+ } else {
140
+ has_product = 1;
141
+ i = 0;
142
+ $has_elem = $elem;
143
+ var result_classes = $elem.attr('class');
144
+ result_classes = result_classes.split(/\s+/);
145
+ while( has_product < 3 && i < 10 ) {
146
+ if( $has_elem.is(':contains("BeRocketSelectorsTest")') ) {
147
+ class1 = $has_elem.attr('class');
148
+ class1 = class1.split(/\s+/);
149
+ result_classes = br_array_intersect(result_classes, class1);
150
+ has_product++;
151
+ }
152
+ $has_elem = $has_elem.next();
153
+ i++;
154
+ }
155
+ result_classes_new = br_find_like_product(result_classes);
156
+ if( result_classes_new.length > 0 ) {
157
+ result_classes = result_classes_new;
158
+ }
159
+ result_classes = result_classes.slice(0, 3);
160
+ result_classes = br_remove_empty_classes(result_classes);
161
+ }
162
+ BeRocket_wizard_selectors.product = $elem.prop("tagName").toLowerCase()+'.'+result_classes.join('.');
163
+ var $products = $elem.parent();
164
+ $products2 = $products;
165
+ class1 = $products2.attr('class');
166
+ if( typeof class1 == 'undefined' ) {
167
+ class1 = '';
168
+ }
169
+ class1 = class1.split(/\s+/);
170
+ class1 = br_remove_empty_classes(class1);
171
+ class1 = br_find_like_product(class1);
172
+ i = 0;
173
+ while( class1.length == 0 && i < 2 ) {
174
+ $products2 = $products.parent();
175
+ class1 = $products2.attr('class');
176
+ if( typeof class1 == 'undefined' ) {
177
+ class1 = '';
178
+ }
179
+ class1 = class1.split(/\s+/);
180
+ class1 = br_remove_empty_classes(class1);
181
+ class1 = br_find_like_product(class1);
182
+ i++;
183
+ }
184
+ if( class1.length == 0 ) {
185
+ $products2 = $products;
186
+ class1 = $products2.attr('class');
187
+ if( typeof class1 == 'undefined' ) {
188
+ class1 = '';
189
+ }
190
+ class1 = class1.split(/\s+/);
191
+ class1 = br_remove_empty_classes(class1);
192
+ i = 0;
193
+ while( class1.length == 0 && i < 4 ) {
194
+ $products2 = $products.parent();
195
+ class1 = $products2.attr('class');
196
+ if( typeof class1 == 'undefined' ) {
197
+ class1 = '';
198
+ }
199
+ class1 = class1.split(/\s+/);
200
+ class1 = br_remove_empty_classes(class1);
201
+ i++;
202
+ }
203
+ }
204
+ i = 0;
205
+ do {
206
+ i++;
207
+ var checkClass = class1.slice(0, i);
208
+ checkClass = $products2.prop("tagName").toLowerCase()+'.'+checkClass.join('.');
209
+ } while( $input_data.find(checkClass).length != 1 && i < 5 );
210
+ BeRocket_wizard_selectors.products = checkClass;
211
+ $products2.css('border', '3px solid Blue');
212
+ var pagination = ['.woocommerce-pagination', '.pagination', 'ul.page-numbers', "[class*='pagination']", "nav[class*='page']", "nav[class*='pagi']",
213
+ 'nav:contains("2")', "[class*='pagi']", "[class*='page']"];
214
+ var is_pagination = false;
215
+ var class_item = '';
216
+ pagination.some(function( item, i, arr) {
217
+ $pagination = $input_data.find(item);
218
+ if( $pagination.length > 0 ) {
219
+ class_item = item;
220
+ is_pagination = true;
221
+ return true;
222
+ }
223
+ return false;
224
+ });
225
+ if( ! is_pagination ) {
226
+ $pagination = $products2.nextAll(':contains("2")');
227
+ if( $pagination.length == 0 ) {
228
+ $pagination = $products2.parent().nextAll(':contains("2")');
229
+ }
230
+ if( $pagination.length > 0 ) {
231
+ is_pagination = true;
232
+ }
233
+ }
234
+ if( is_pagination ) {
235
+ $pagination = $pagination.first();
236
+ checkClass = $pagination.attr('class');
237
+ if( typeof checkClass == 'undefined' ) {
238
+ checkClass = '';
239
+ }
240
+ checkClass = checkClass.split(/\s+/);
241
+ checkClass = br_remove_empty_classes(checkClass);
242
+ if( checkClass.length > 0 ) {
243
+ checkClass = $pagination.prop("tagName").toLowerCase()+'.'+checkClass.join('.');
244
+ } else if( $pagination.attr('id') ) {
245
+ checkClass = $pagination.prop("tagName").toLowerCase()+'#'+$pagination.attr('id');
246
+ } else {
247
+ checkClass = $pagination.prop("tagName").toLowerCase();
248
+ }
249
+ $pagination = $input_data.find(checkClass).first();
250
+ if( $input_data.find(checkClass).length > 0 ) {
251
+ BeRocket_wizard_selectors.pagination = checkClass;
252
+ $pagination.css('border', '3px solid Green');
253
+ } else {
254
+ is_pagination = false;
255
+ }
256
+ }
257
+ if( $input_data.find('.woocommerce-result-count').length ) {
258
+ BeRocket_wizard_selectors.products_count = '.woocommerce-result-count';
259
+ } else {
260
+ var products_count = ['.woocommerce-result-count', ':contains("Showing 1–3 of 18 results")', ':contains("3 results"), :contains("3results")',
261
+ ':contains("3 products"), :contains("3products")', ':contains("18 Product"), :contains("18Product")'];
262
+ var is_products_count = false;
263
+ var class_products_count = '';
264
+ products_count.some(function( item, i, arr) {
265
+ $products_count = $input_data.find(item);
266
+ if( $products_count.length > 0 ) {
267
+ class_products_count = item;
268
+ is_products_count = true;
269
+ return true;
270
+ }
271
+ return false;
272
+ });
273
+ if( is_products_count ) {
274
+ while($products_count.length > 1) {
275
+ $products_count = $products_count.find(class_products_count);
276
+ }
277
+ if( $products_count.length > 0 ) {
278
+ checkClass = $products_count.attr('class');
279
+ if( typeof checkClass == 'string' ) {
280
+ checkClass = checkClass.split(/\s+/);
281
+ checkClass = br_remove_empty_classes(checkClass);
282
+ checkClass = $products_count.prop("tagName").toLowerCase()+'.'+checkClass.join('.');
283
+ BeRocket_wizard_selectors.products_count = checkClass;
284
+ }
285
+ }
286
+ }
287
+ }
288
+ if( is_pagination ) {
289
+ $next = $pagination.find("[class*='next']");
290
+ if( $next.length == 0 ) {
291
+ do {
292
+ $second_page = $pagination.find(':contains("2")');
293
+ } while(! $second_page.is('a') && $second_page.length > 0);
294
+ if( $second_page.length > 0 ) {
295
+ var second_href = $second_page.attr('href');
296
+ $next = $pagination.find('[href*="'+second_href+'"]:not(:contains("2"))');
297
+ }
298
+ }
299
+ if( $next.length == 0 ) {
300
+ var next_page = ['[href*="/page/2"]', '[href*="paged=2"]'];
301
+ next_page.some(function( item, i, arr) {
302
+ $next = $pagination.find(item).last();
303
+ if( $next.length > 0 ) {
304
+ return true;
305
+ }
306
+ return false;
307
+ });
308
+ }
309
+ if( $next.length > 0 ) {
310
+ checkClass = $next.attr('class');
311
+ if( checkClass == '' || typeof checkClass != 'string' ) {
312
+ checkClass = $next.prop("tagName").toLowerCase()+':contains("'+$next.text()+'")';
313
+ } else {
314
+ checkClass = checkClass.split(/\s+/);
315
+ checkClass = br_remove_empty_classes(checkClass);
316
+ checkClass = $next.prop("tagName").toLowerCase()+'.'+checkClass.join('.');
317
+ }
318
+ BeRocket_wizard_selectors.pagination_next = checkClass;
319
+ $next.css('border', '3px solid Yellow');
320
+ }
321
+ var current_url = category_page_url;
322
+ if( current_url.search(/\?/) == -1 ) {
323
+ current_url = current_url+'?paged=6';
324
+ } else {
325
+ current_url = current_url+'&paged=6';
326
+ }
327
+ jQuery.get(current_url, function(data) {
328
+ var $data = jQuery('<div>'+data+'</div>');
329
+ var $pagination6 = $data.find(BeRocket_wizard_selectors.pagination);
330
+ if( $pagination6.length > 0 ) {
331
+ $prev = $pagination6.find("[class*='prev']");
332
+ if( $prev.length == 0 ) {
333
+ $second_page = $pagination6
334
+ do {
335
+ $second_page = $second_page.find(':contains("5")').first();
336
+ } while(! $second_page.is('a') && $second_page.length > 0);
337
+ if( $second_page.length > 0 ) {
338
+ var second_href = $second_page.attr('href');
339
+ $prev = $pagination6.find('[href*="'+second_href+'"]:not(:contains("5"))');
340
+ }
341
+ }
342
+ if( $prev.length == 0 ) {
343
+ var prev_page = ['[href*="/page/5"]', '[href*="paged=5"]'];
344
+ prev_page.some(function( item, i, arr) {
345
+ $prev = $pagination6.find(item).last();
346
+ if( $prev.length > 0 ) {
347
+ return true;
348
+ }
349
+ return false;
350
+ });
351
+ }
352
+ if( $prev.length > 0 ) {
353
+ checkClass = $prev.attr('class');
354
+ if( checkClass == '' || typeof checkClass != 'string' ) {
355
+ checkClass = $prev.prop("tagName").toLowerCase()+':contains("'+$prev.text()+'")';
356
+ } else {
357
+ checkClass = checkClass.split(/\s+/);
358
+ checkClass = br_remove_empty_classes(checkClass);
359
+ checkClass = $prev.prop("tagName").toLowerCase()+'.'+checkClass.join('.');
360
+ }
361
+ BeRocket_wizard_selectors.pagination_prev = checkClass;
362
+ $prev.css('border', '3px solid Orange');
363
+ }
364
+ }
365
+ end_selectors(true);
366
+ }).error(function() {end_selectors(true);});
367
+ } else {
368
+ end_selectors(true);
369
+ }
370
+ }
371
+ var BeRocket_current_autoselector_block = jQuery('<div></div>');
372
+ jQuery(document).on('click', '.berocket_autoselector', function(event) {
373
+ event.preventDefault();
374
+ BeRocket_current_autoselector_block = jQuery(this).parents('.berocket_wizard_autoselectors');
375
+ BeRocket_init_autoselectors();
376
+ jQuery.get(berocket_wizard_autoselect.ajaxurl, {action:"berocket_wizard_selector_start"}, function(url) {
377
+ BeRocket_set_autoselector_load_position(45, berocket_wizard_autoselect.getting_selectors, 60);
378
+ jQuery.get(url, function(data) {
379
+ BeRocket_set_autoselector_load_position(60, berocket_wizard_autoselect.getting_selectors, 75);
380
+ BeRocket_wizard_check(url, data, berocket_wizard_autoselector);
381
+ }).error(function() {berocket_wizard_autoselector_end(berocket_wizard_autoselector_end_error);});
382
+ }).error(function() {berocket_wizard_autoselector_end(berocket_wizard_autoselector_end_error);});
383
+ });
384
+ function BeRocket_set_autoselector_load_position(position, position_name, next_position) {
385
+ var functions = BeRocket_current_autoselector_block.data('functions');
386
+ if( functions.percent != '' && typeof window[functions.percent] == 'function' ) {
387
+ window[functions.percent](position, position_name, next_position);
388
+ }
389
+ var $block = jQuery(BeRocket_current_autoselector_block);
390
+ $block.find('.berocket_autoselector_load .berocket_line').finish().css('width', position+'%');
391
+ if( typeof position_name != 'undefined' ) {
392
+ $block.find('.berocket_autoselector_load .berocket_autoselector_action').text(position_name);
393
+ }
394
+ if( typeof next_position != 'undefined' ) {
395
+ $block.find('.berocket_autoselector_load .berocket_line').animate({width:next_position+'%'}, 30000);
396
+ }
397
+ }
398
+ function BeRocket_init_autoselectors() {
399
+ var $block = jQuery(BeRocket_current_autoselector_block);
400
+ jQuery('.berocket_wizard_autoselectors .berocket_autoselector').prop('disabled', true);
401
+ BeRocket_set_autoselector_load_position(0, berocket_wizard_autoselect.creating_products, 45);
402
+ $block.find('.berocket_autoselector_load .berocket_line').css('background-color', '');
403
+ $block.find('.berocket_autoselector_load').show();
404
+ $block.find('.berocket_autoselect_spin').show();
405
+ $block.find('.berocket_autoselect_ready').hide();
406
+ $block.find('.berocket_autoselect_error').hide();
407
+ }
408
+
409
+ function berocket_wizard_set_val_to_input(input_selector, input_val) {
410
+ if( input_selector != "" && jQuery(input_selector).length ) {
411
+ jQuery(input_selector).val(input_val);
412
+ }
413
+ }
414
+ function berocket_wizard_autoselector(status) {
415
+ if( status ) {
416
+ //SELECTORS READY TO USE
417
+ var inputs = BeRocket_current_autoselector_block.data('inputs');
418
+ berocket_wizard_set_val_to_input(inputs.products, BeRocket_wizard_selectors.products);
419
+ berocket_wizard_set_val_to_input(inputs.product, BeRocket_wizard_selectors.product);
420
+ berocket_wizard_set_val_to_input(inputs.pagination, BeRocket_wizard_selectors.pagination);
421
+ berocket_wizard_set_val_to_input(inputs.next_page, BeRocket_wizard_selectors.pagination_next);
422
+ berocket_wizard_set_val_to_input(inputs.prev_page, BeRocket_wizard_selectors.pagination_prev);
423
+ berocket_wizard_set_val_to_input(inputs.result_count, BeRocket_wizard_selectors.products_count);
424
+ BeRocket_set_autoselector_load_position(75, berocket_wizard_autoselect.removing_products, 100);
425
+ berocket_wizard_autoselector_end(berocket_wizard_autoselector_end_success);
426
+ } else {
427
+ BeRocket_set_autoselector_load_position(75);
428
+ berocket_wizard_autoselector_end(berocket_wizard_autoselector_end_error);
429
+ }
430
+ }
431
+ function berocket_wizard_autoselector_end(function_after_end) {
432
+ jQuery.get(berocket_wizard_autoselect.ajaxurl, {action:"berocket_wizard_selector_end"}, function() {
433
+ function_after_end();
434
+ }).error(function(){
435
+ jQuery.get(berocket_wizard_autoselect.ajaxurl, {action:"berocket_wizard_selector_end"}, function() {
436
+ function_after_end();
437
+ }).error(function(){
438
+ berocket_wizard_autoselector_end_error();
439
+ });
440
+ });
441
+ }
442
+ function berocket_wizard_autoselector_end_success() {
443
+ var functions = BeRocket_current_autoselector_block.data('functions');
444
+ if( functions.any != '' && typeof window[functions.any] == 'function' ) {
445
+ window[functions.any]();
446
+ }
447
+ if( functions.success != '' && typeof window[functions.success] == 'function' ) {
448
+ window[functions.success]();
449
+ }
450
+ jQuery('.berocket_autoselector').prop('disabled', false);
451
+ BeRocket_set_autoselector_load_position(100, '');
452
+ jQuery('.berocket_autoselect_spin').hide();
453
+ jQuery('.berocket_autoselect_ready').show();
454
+ }
455
+ function berocket_wizard_autoselector_end_error() {
456
+ var functions = BeRocket_current_autoselector_block.data('functions');
457
+ if( functions.any != '' && typeof window[functions.any] == 'function' ) {
458
+ window[functions.any]();
459
+ }
460
+ if( functions.error != '' && typeof window[functions.error] == 'function' ) {
461
+ window[functions.error]();
462
+ }
463
+ jQuery('.berocket_autoselector').prop('disabled', false);
464
+ BeRocket_set_autoselector_load_position(100);
465
+ jQuery('.berocket_autoselector_load .berocket_autoselector_action').text('Error: '+$('.berocket_autoselector_load .berocket_autoselector_action').text());
466
+ jQuery('.berocket_autoselect_spin').hide();
467
+ jQuery('.berocket_autoselector_load .berocket_line').css('background-color', '#bb3333');
468
+ jQuery('.berocket_autoselect_error').show();
469
+ }
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/
5
  * Description: Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
6
- * Version: 1.2.4
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: http://berocket.com
@@ -11,7 +11,7 @@
11
  * Domain Path: /languages/
12
  */
13
 
14
- define( "BeRocket_AJAX_filters_version", '1.2.4' );
15
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
16
 
17
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
@@ -22,6 +22,9 @@ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
22
  require_once dirname( __FILE__ ) . '/includes/admin_notices.php';
23
  require_once dirname( __FILE__ ) . '/includes/widget.php';
24
  require_once dirname( __FILE__ ) . '/includes/functions.php';
 
 
 
25
  /**
26
  * Class BeRocket_AAPF
27
  */
@@ -59,8 +62,10 @@ class BeRocket_AAPF {
59
  'sel' => '0',
60
  ),
61
  'first_page_jump' => '0',
 
62
  'scroll_shop_top' => '0',
63
  'ajax_request_load' => '1',
 
64
  'ajax_request_load_style' => 'jquery',
65
  'user_func' => array(
66
  'before_update' => '',
@@ -79,6 +84,11 @@ class BeRocket_AAPF {
79
  register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
80
 
81
  if ( ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) && br_get_woocommerce_version() >= 2.1 ) {
 
 
 
 
 
82
  if ( defined('DOING_AJAX') && DOING_AJAX ) {
83
  add_action( 'setup_theme', array( __CLASS__, 'WPML_fix' ) );
84
  }
@@ -102,6 +112,7 @@ class BeRocket_AAPF {
102
  $plugin_base_slug = plugin_basename( __FILE__ );
103
  add_filter( 'plugin_action_links_' . $plugin_base_slug, array( __CLASS__, 'plugin_action_links' ) );
104
  add_filter( 'is_berocket_settings_page', array( __CLASS__, 'is_settings_page' ) );
 
105
  } else {
106
  if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
107
  add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
@@ -111,6 +122,30 @@ class BeRocket_AAPF {
111
  }
112
  add_filter('berocket_admin_notices_subscribe_plugins', array(__CLASS__, 'admin_notices_subscribe_plugins'));
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  public static function admin_notices_subscribe_plugins($plugins) {
115
  $plugins[] = self::$info['id'];
116
  return $plugins;
@@ -141,7 +176,10 @@ class BeRocket_AAPF {
141
  }
142
 
143
  public static function init() {
144
-
 
 
 
145
  wp_register_style( 'berocket_aapf_widget-style', plugins_url( 'css/widget.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
146
  wp_enqueue_style( 'berocket_aapf_widget-style' );
147
 
@@ -197,6 +235,14 @@ class BeRocket_AAPF {
197
  }
198
 
199
  public static function br_render_form() {
 
 
 
 
 
 
 
 
200
  wp_enqueue_script( 'berocket_aapf_widget-colorpicker', plugins_url( 'js/colpick.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
201
  wp_enqueue_script( 'berocket_aapf_widget-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
202
 
@@ -475,6 +521,47 @@ class BeRocket_AAPF {
475
  $args['groupby'] = "$wpdb->posts.ID";
476
  return $args;
477
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
  }
479
 
480
  new BeRocket_AAPF;
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/
5
  * Description: Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
6
+ * Version: 1.2.5
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: http://berocket.com
11
  * Domain Path: /languages/
12
  */
13
 
14
+ define( "BeRocket_AJAX_filters_version", '1.2.5' );
15
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
16
 
17
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
22
  require_once dirname( __FILE__ ) . '/includes/admin_notices.php';
23
  require_once dirname( __FILE__ ) . '/includes/widget.php';
24
  require_once dirname( __FILE__ ) . '/includes/functions.php';
25
+ require_once dirname( __FILE__ ) . '/includes/wizard.php';
26
+ require_once dirname( __FILE__ ) . '/wizard/main.php';
27
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
28
  /**
29
  * Class BeRocket_AAPF
30
  */
62
  'sel' => '0',
63
  ),
64
  'first_page_jump' => '0',
65
+ 'use_select2' => '0',
66
  'scroll_shop_top' => '0',
67
  'ajax_request_load' => '1',
68
+ 'use_get_query' => '',
69
  'ajax_request_load_style' => 'jquery',
70
  'user_func' => array(
71
  'before_update' => '',
84
  register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
85
 
86
  if ( ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) && br_get_woocommerce_version() >= 2.1 ) {
87
+ $last_version = get_option('br_filters_version');
88
+ if( $last_version === FALSE ) $last_version = 0;
89
+ if ( version_compare($last_version, BeRocket_AJAX_filters_version, '<') ) {
90
+ self::update_from_older ( $last_version );
91
+ }
92
  if ( defined('DOING_AJAX') && DOING_AJAX ) {
93
  add_action( 'setup_theme', array( __CLASS__, 'WPML_fix' ) );
94
  }
112
  $plugin_base_slug = plugin_basename( __FILE__ );
113
  add_filter( 'plugin_action_links_' . $plugin_base_slug, array( __CLASS__, 'plugin_action_links' ) );
114
  add_filter( 'is_berocket_settings_page', array( __CLASS__, 'is_settings_page' ) );
115
+ add_filter('woocommerce_product_loop_start', array(__CLASS__, 'fix_categories_on_filtering'));
116
  } else {
117
  if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
118
  add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
122
  }
123
  add_filter('berocket_admin_notices_subscribe_plugins', array(__CLASS__, 'admin_notices_subscribe_plugins'));
124
  }
125
+
126
+ public static function update_from_older( $version ) {
127
+ $option = self::get_aapf_option();
128
+ if ( version_compare($version, '1.2.4', '<') ) {
129
+ $version_index = 1;
130
+ } else {
131
+ $version_index = 2;
132
+ }
133
+
134
+ switch ( $version_index ) {
135
+ case 1:
136
+ update_option('berocket_filter_open_wizard_on_settings', true);
137
+ break;
138
+ }
139
+
140
+ update_option( 'br_filters_options', $option );
141
+ update_option( 'br_filters_version', BeRocket_AJAX_filters_version );
142
+ }
143
+ public static function fix_categories_on_filtering($content) {
144
+ if( function_exists('wc_set_loop_prop') && ! empty($_GET['filters']) ) {
145
+ wc_set_loop_prop( 'is_filtered', 1 );
146
+ }
147
+ return $content;
148
+ }
149
  public static function admin_notices_subscribe_plugins($plugins) {
150
  $plugins[] = self::$info['id'];
151
  return $plugins;
176
  }
177
 
178
  public static function init() {
179
+ //CHOSEN
180
+ wp_register_style( 'select2', plugins_url( 'css/select2.min.css', __FILE__ ) );
181
+ wp_register_script( 'select2', plugins_url( 'js/select2.min.js', __FILE__ ), array( 'jquery' ) );
182
+
183
  wp_register_style( 'berocket_aapf_widget-style', plugins_url( 'css/widget.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
184
  wp_enqueue_style( 'berocket_aapf_widget-style' );
185
 
235
  }
236
 
237
  public static function br_render_form() {
238
+ do_action('BeRocket_wizard_javascript');
239
+
240
+ $plugin_info = get_plugin_data(__FILE__, false, true);
241
+ $redirect_to_wizard = get_option('berocket_filter_open_wizard_on_settings');
242
+ if( ! empty($redirect_to_wizard) ) {
243
+ delete_option('berocket_filter_open_wizard_on_settings');
244
+ wp_redirect(admin_url( 'admin.php?page=br-aapf-setup' ));
245
+ }
246
  wp_enqueue_script( 'berocket_aapf_widget-colorpicker', plugins_url( 'js/colpick.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
247
  wp_enqueue_script( 'berocket_aapf_widget-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
248
 
521
  $args['groupby'] = "$wpdb->posts.ID";
522
  return $args;
523
  }
524
+ public static function get_aapf_option() {
525
+ $options = get_option( 'br_filters_options' );
526
+ if ( ! empty($options) && is_array ( $options ) ) {
527
+ $options = array_merge( BeRocket_AAPF::$defaults, $options );
528
+ } else {
529
+ $options = BeRocket_AAPF::$defaults;
530
+ }
531
+ return $options;
532
+ }
533
+ public static function sanitize_aapf_option( $input ) {
534
+ $default = BeRocket_AAPF::$defaults;
535
+ $result = self::recursive_array_set( $default, $input );
536
+ return $result;
537
+ }
538
+ public static function recursive_array_set( $default, $options ) {
539
+ foreach( $default as $key => $value ) {
540
+ if( array_key_exists( $key, $options ) ) {
541
+ if( is_array( $value ) ) {
542
+ if( is_array( $options[$key] ) ) {
543
+ $result[$key] = self::recursive_array_set( $value, $options[$key] );
544
+ } else {
545
+ $result[$key] = self::recursive_array_set( $value, array() );
546
+ }
547
+ } else {
548
+ $result[$key] = $options[$key];
549
+ }
550
+ } else {
551
+ if( is_array( $value ) ) {
552
+ $result[$key] = self::recursive_array_set( $value, array() );
553
+ } else {
554
+ $result[$key] = '';
555
+ }
556
+ }
557
+ }
558
+ foreach( $options as $key => $value ) {
559
+ if( ! array_key_exists( $key, $result ) ) {
560
+ $result[$key] = $value;
561
+ }
562
+ }
563
+ return $result;
564
+ }
565
  }
566
 
567
  new BeRocket_AAPF;