Advanced AJAX Product Filters - Version 1.2.7

Version Description

  • Enhancement - Auto-selectors has "Stop" button
  • Enhancement - Feature request box
  • Enhancement - Feedback box
  • Fix - Reset button
Download this release

Release Info

Developer RazyRx
Plugin Icon wp plugin Advanced AJAX Product Filters
Version 1.2.7
Comparing to
See all releases

Code changes from version 1.2.6 to 1.2.7

css/admin.css CHANGED
@@ -15,3 +15,6 @@
15
  .admin-column-theme select{max-width: 100%;}
16
  .tab-item{display: none;}
17
  .tab-item.current{display: block;}
 
 
 
15
  .admin-column-theme select{max-width: 100%;}
16
  .tab-item{display: none;}
17
  .tab-item.current{display: block;}
18
+ #toplevel_page_berocket_account .wp-first-item {
19
+ display: none!important;
20
+ }
images/Feature-request-form-title.png ADDED
Binary file
images/Feature-request.png ADDED
Binary file
images/Thank-you.png ADDED
Binary file
includes/admin_notices.php CHANGED
@@ -20,6 +20,7 @@
20
  ));*/
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
@@ -778,4 +779,564 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
778
  add_action( 'wp_ajax_berocket_admin_close_notice', array('berocket_admin_notices', 'close_notice') );
779
  add_action( 'wp_ajax_berocket_subscribe_email', array('berocket_admin_notices', 'subscribe') );
780
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
  ?>
20
  ));*/
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
+ //delete_option('berocket_admin_notices_rate_stars');
24
  if( ! class_exists( 'berocket_admin_notices' ) ) {
25
  /**
26
  * Class berocket_admin_notices
779
  add_action( 'wp_ajax_berocket_admin_close_notice', array('berocket_admin_notices', 'close_notice') );
780
  add_action( 'wp_ajax_berocket_subscribe_email', array('berocket_admin_notices', 'subscribe') );
781
  }
782
+ if( ! class_exists( 'berocket_admin_notices_rate_stars' ) ) {
783
+ class berocket_admin_notices_rate_stars {
784
+ public $first_time = '+7 days';
785
+ public $later_time = '+7 days';
786
+ function __construct() {
787
+ add_action( 'admin_notices', array($this, 'admin_notices') );
788
+ add_action( 'wp_ajax_berocket_rate_stars_close', array($this, 'disable_rate_notice') );
789
+ add_action( 'wp_ajax_berocket_feature_request_send', array($this, 'feature_request_send') );
790
+ add_action( 'berocket_rate_plugin_window', array($this, 'show_rate_window'), 10, 2 );
791
+ add_action( 'berocket_feature_request_window', array($this, 'show_feature_request_window'), 10, 2 );
792
+ }
793
+ function admin_notices() {
794
+ $display_one = false;
795
+ $disabled = get_option('berocket_admin_notices_rate_stars');
796
+ if( ! is_array($disabled) ) {
797
+ $disabled = array();
798
+ }
799
+ $plugins = apply_filters('berocket_admin_notices_rate_stars_plugins', array());
800
+ foreach($plugins as $plugin_id => $plugin) {
801
+ $display = false;
802
+ if( empty($disabled[$plugin['id']]) ) {
803
+ $disabled[$plugin['id']] = array(
804
+ 'time' => strtotime($this->first_time),
805
+ 'count' => 0
806
+ );
807
+ } elseif($disabled[$plugin['id']]['time'] != 0 && $disabled[$plugin['id']]['time'] < time()) {
808
+ $display = true;
809
+ }
810
+ if( $display ) {
811
+ $display_one = true;
812
+ ?>
813
+ <div class="notice notice-info berocket-rate-stars berocket-rate-stars-block berocket-rate-stars-<?php echo $plugin['id']; ?>">
814
+ <p><?php
815
+ $text = __( 'Awesome, you\'ve been using %plugin_name% Plugin for more than 1 week. May we ask you to give it a 5-star rating on WordPress?', 'BeRocket_domain' );
816
+ $text_mobile = __( 'May we ask you to give our plugin %plugin_name% a 5-star rating?', 'BeRocket_domain' );
817
+ $plugin['name'] = str_replace(' for WooCommerce', '', $plugin['name']);
818
+ $text = str_replace('%plugin_name%', '<a href="https://wordpress.org/support/plugin/'.$plugin['free_slug'].'/" target="_blank">'.$plugin['name'].'</a>', $text);
819
+ $text_mobile = str_replace('%plugin_name%', '<a href="https://wordpress.org/support/plugin/'.$plugin['free_slug'].'/" target="_blank">'.$plugin['name'].'</a>', $text_mobile);
820
+ $text = '<span class="brfeature_show_mobile">' . $text_mobile.'</span><span class="berocket-right-block">
821
+ <a class="berocket_rate_close brfirst"
822
+ data-plugin="'.$plugin['id'].'"
823
+ data-action="berocket_rate_stars_close"
824
+ data-prevent="0"
825
+ data-function="berocket_rate_star_close_notice"
826
+ data-later="0"
827
+ data-thanks_html=\'<img src="'.plugin_dir_url( __FILE__ ).'../images/Thank-you.png"><h3 class="berocket_thank_you_rate_us">'.__('Each good feedback is very important for plugin growth', 'BeRocket_domain').'</h3>\'
828
+ href="https://wordpress.org/support/plugin/'.$plugin['free_slug'].'/reviews/?filter=5#new-post"
829
+ target="_blank">'.__('Ok, you deserved it', 'BeRocket_domain').'</a>
830
+ <span class="brfirts"> | </span>
831
+ <a class="berocket_rate_close brsecond"
832
+ data-plugin="'.$plugin['id'].'"
833
+ data-action="berocket_rate_stars_close"
834
+ data-prevent="1"
835
+ data-later="1"
836
+ data-function="berocket_rate_star_close_notice"
837
+ href="#later">
838
+ <span class="brfeature_hide_mobile">'.__('Maybe later', 'BeRocket_domain').'</span>
839
+ <span class="brfeature_show_mobile">'.__('Later', 'BeRocket_domain').'</span>
840
+ </a>
841
+ <span class="brsecond"> | </span>
842
+ <a class="berocket_rate_close brthird"
843
+ data-plugin="'.$plugin['id'].'"
844
+ data-action="berocket_rate_stars_close"
845
+ data-prevent="1"
846
+ data-later="0"
847
+ data-function="berocket_rate_star_close_notice"
848
+ href="#close">
849
+ <span class="brfeature_hide_mobile">'.__('I already did', 'BeRocket_domain').'</span>
850
+ <span class="brfeature_show_mobile">'.__('Already', 'BeRocket_domain').'</span>
851
+ </a>
852
+ </span><span class="brfeature_hide_mobile">' . $text.'</span>';
853
+ echo $text;
854
+ ?></p>
855
+ </div>
856
+ <?php
857
+ }
858
+ }
859
+ if( $display_one ) {
860
+ add_action('admin_footer', array($this, 'wp_footer_js'));
861
+ ?>
862
+ <style>
863
+ .berocket-rate-stars span.brsecond,
864
+ .berocket-rate-stars a.brthird {
865
+ color: #999;
866
+ }
867
+ .berocket-rate-stars .berocket-right-block > span {
868
+ display: inline-block;
869
+ margin-left: 10px;
870
+ margin-right: 10px;
871
+ }
872
+ .berocket-rate-stars a.brthird:hover {
873
+ color: #00a0d2;
874
+ }
875
+ .berocket-rate-stars a {
876
+ text-decoration: none;
877
+ }
878
+ .berocket-rate-stars .berocket-right-block {
879
+ float: right;
880
+ padding-left: 20px;
881
+ display: inline-block;
882
+
883
+ }
884
+ .berocket-rate-stars .brfeature_show_mobile {
885
+ display: none;
886
+ }
887
+ @media screen and (min-width: 768px) and (max-width: 1024px) {
888
+ .berocket-rate-stars .berocket-right-block span.brfirts {
889
+ display: none;
890
+ }
891
+ .berocket-rate-stars .berocket-right-block .berocket_rate_close.brfirst {
892
+ display: block;
893
+ }
894
+ }
895
+ @media screen and (max-width: 768px) {
896
+ .berocket-rate-stars {
897
+ display: none;
898
+ }
899
+ .berocket-rate-stars .brfeature_show_mobile {
900
+ display: inline-block;
901
+ }
902
+ .berocket-rate-stars .brfeature_hide_mobile {
903
+ display: none;
904
+ }
905
+ .berocket-rate-stars .berocket-right-block {
906
+ float: none;
907
+ padding-left: 0;
908
+ }
909
+ .berocket-rate-stars .berocket-right-block > span {
910
+ margin-left: 5px;
911
+ margin-right: 5px;
912
+ }
913
+ }
914
+ </style>
915
+ <?php
916
+ }
917
+ update_option('berocket_admin_notices_rate_stars', $disabled);
918
+ }
919
+ function disable_rate_notice() {
920
+ $plugin = (empty($_GET['plugin']) ? (empty($_POST['plugin']) ? '' : $_POST['plugin']) : $_GET['plugin']);
921
+ $later = (empty($_GET['later']) ? (empty($_POST['later']) ? '' : $_POST['later']) : $_GET['later']);
922
+ $disabled = get_option('berocket_admin_notices_rate_stars');
923
+ if( isset($disabled[$plugin]) && is_array($disabled[$plugin]) && isset($disabled[$plugin]['time']) ) {
924
+ if( empty($later) ) {
925
+ $disabled[$plugin]['time'] = 0;
926
+ } else {
927
+ $disabled[$plugin]['time'] = strtotime($this->later_time);
928
+ }
929
+ }
930
+ update_option('berocket_admin_notices_rate_stars', $disabled);
931
+ wp_die();
932
+ }
933
+ function feature_request_send() {
934
+ $plugin = (empty($_GET['brfeature_plugin']) ? (empty($_POST['brfeature_plugin']) ? '' : $_POST['brfeature_plugin']) : $_GET['brfeature_plugin']);
935
+ $email = (empty($_GET['brfeature_email']) ? (empty($_POST['brfeature_email']) ? '' : $_POST['brfeature_email']) : $_GET['brfeature_email']);
936
+ $title = (empty($_GET['brfeature_title']) ? (empty($_POST['brfeature_title']) ? '' : $_POST['brfeature_title']) : $_GET['brfeature_title']);
937
+ $description = (empty($_GET['brfeature_description']) ? (empty($_POST['brfeature_description']) ? '' : $_POST['brfeature_description']) : $_GET['brfeature_description']);
938
+ if( ! empty($plugin) && ! empty($title) && ! empty($description) ) {
939
+ $response = wp_remote_post( 'https://berocket.com/api/data/add_feature_request', array(
940
+ 'body' => array(
941
+ 'plugin' => $plugin,
942
+ 'email' => $email,
943
+ 'title' => $title,
944
+ 'description' => $description
945
+ ),
946
+ 'method' => 'POST',
947
+ 'timeout' => 5,
948
+ 'redirection' => 5,
949
+ 'blocking' => true,
950
+ 'sslverify' => false
951
+ ) );
952
+ }
953
+ wp_die();
954
+ }
955
+ function show_rate_window($html, $plugin_id) {
956
+ $disabled = get_option('berocket_admin_notices_rate_stars');
957
+ if( empty($disabled[$plugin_id]) || $disabled[$plugin_id]['time'] != 0 ) {
958
+ $plugins = apply_filters('berocket_admin_notices_rate_stars_plugins', array());
959
+ foreach($plugins as $plugin) {
960
+ if( $plugin['id'] == $plugin_id ) {
961
+ $html = '<div class="berocket_rate_plugin berocket-rate-stars-block berocket-rate-stars-plugin-page-'.$plugin['id'].'">
962
+ <h3>'.__('May we ask you to give us a 5-star feedback?', 'BeRocket_domain').'</h3>
963
+ <a class="berocket_rate_close brfirst"
964
+ data-plugin="'.$plugin['id'].'"
965
+ data-action="berocket_rate_stars_close"
966
+ data-prevent="0"
967
+ data-later="0"
968
+ data-function="berocket_rate_star_close_notice"
969
+ data-thanks_html=\'<img src="'.plugin_dir_url( __FILE__ ).'../images/Thank-you.png"><h3 class="berocket_thank_you_rate_us">'.__('Each good feedback is very important for plugin growth', 'BeRocket_domain').'</h3>\'
970
+ href="https://wordpress.org/support/plugin/'.$plugin['free_slug'].'/reviews/?filter=5#new-post"
971
+ target="_blank">'.__('Ok, you deserved it', 'BeRocket_domain').'</a>
972
+ <p>'.__('Support the plugin by setting good feedback.<br>We really need this.', 'BeRocket_domain').'</p>
973
+ </div>
974
+ <style>
975
+ .berocket_rate_plugin {
976
+ border-radius: 3px;
977
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.06);
978
+ overflow: auto;
979
+ position: relative;
980
+ background-color: white;
981
+ color: rgba(0, 0, 0, 0.87);
982
+ padding: 0 25px;
983
+ margin-bottom: 30px;
984
+ box-sizing: border-box;
985
+ text-align: center;
986
+ float: right;
987
+ clear: right;
988
+ width: 28%;
989
+ }
990
+ .berocket_rate_plugin .berocket_rate_close {
991
+ margin-top: 30px;
992
+ margin-bottom: 20px;
993
+ color: #fff;
994
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
995
+ text-shadow: none;
996
+ border: 0 none;
997
+ min-width: 120px;
998
+ width: 90%;
999
+ -moz-user-select: none;
1000
+ background: #ff5252 none repeat scroll 0 0;
1001
+ box-sizing: border-box;
1002
+ cursor: pointer;
1003
+ display: inline-block;
1004
+ font-size: 14px;
1005
+ outline: 0 none;
1006
+ padding: 8px;
1007
+ position: relative;
1008
+ text-align: center;
1009
+ text-decoration: none;
1010
+ 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;
1011
+ white-space: nowrap;
1012
+ height: auto;
1013
+ vertical-align: top;
1014
+ line-height: 25px;
1015
+ border-radius: 3px;
1016
+ font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
1017
+ font-weight: bold;
1018
+
1019
+ margin: 5px 0;
1020
+ background: #97b9cf;
1021
+ border: 2px solid #97b9cf;
1022
+ color: white;
1023
+ }
1024
+ .berocket_rate_plugin img {
1025
+ margin-top: 20px;
1026
+ }
1027
+ .berocket_rate_plugin .berocket_thank_you_rate_us {
1028
+ color: #555;
1029
+ margin-bottom: 35px;
1030
+ }
1031
+ .berocket_rate_plugin .berocket_rate_close:hover,
1032
+ .berocket_rate_plugin .berocket_rate_close:focus,
1033
+ .berocket_rate_plugin .berocket_rate_close:active{
1034
+ color: white;
1035
+ background: #87a9bf;
1036
+ border: 2px solid #87a9bf;
1037
+ }
1038
+ @media screen and (min-width: 901px) and (max-width: 1200px) {
1039
+ .berocket_rate_plugin{
1040
+ padding-left: 10px;
1041
+ padding-right: 10px;
1042
+ }
1043
+ }
1044
+ @media screen and (max-width: 900px) {
1045
+ .berocket_rate_plugin {
1046
+ float: none;
1047
+ width: 100%;
1048
+ margin-top: 30px;
1049
+ margin-bottom: 0;
1050
+ }
1051
+ .berocket_rate_plugin .berocket_rate_close{
1052
+ float: none;
1053
+ width: 100%;
1054
+ }
1055
+ }
1056
+ </style>';
1057
+ add_action('admin_footer', array($this, 'wp_footer_js'));
1058
+ return $html;
1059
+ }
1060
+ }
1061
+ }
1062
+ return $html;
1063
+ }
1064
+ function show_feature_request_window($html, $plugin_id) {
1065
+ $disabled = get_option('berocket_admin_notices_rate_stars');
1066
+ $plugins = apply_filters('berocket_admin_notices_rate_stars_plugins', array());
1067
+ foreach($plugins as $plugin) {
1068
+ if( $plugin['id'] == $plugin_id ) {
1069
+ add_action('admin_footer', array($this, 'wp_footer_js'));
1070
+ $html .= '
1071
+ <div class="berocket_feature_request berocket-feature-request berocket-feature-request-'.$plugin['id'].'">
1072
+ <a class="berocket_feature_request_button" href="#feature_request"><img src="'.plugin_dir_url( __FILE__ ).'../images/Feature-request.png" alt="Feature Request"></a>
1073
+ <div class="berocket_feature_request_form" style="display: none;">
1074
+ <img src="'.plugin_dir_url( __FILE__ ).'../images/Feature-request-form-title.png" alt="Feature Request">
1075
+ <form class="berocket_feature_request_inside">
1076
+ <input name="brfeature_plugin" type="hidden" value="'.$plugin['id'].'">
1077
+ <input name="brfeature_title" placeholder="'.__('Feature Title', 'BeRocket_domain').'">
1078
+ <input name="brfeature_email" placeholder="'.__('Email (optional)', 'BeRocket_domain').'">
1079
+ <textarea name="brfeature_description" placeholder="'.__('Feature Description', 'BeRocket_domain').'"></textarea>
1080
+ <button class="berocket_feature_request_submit" type="submit">'.__('SEND FEATURE REQUEST', 'BeRocket_domain').'</button>
1081
+ </form>
1082
+ <div style="margin-bottom: 10px;">* <small>This form will be sended to <a target="_blank" href="https://berocket.com">berocket.com</a></small></div>
1083
+ </div>
1084
+ <div class="berocket_feature_request_thanks" style="display: none;">
1085
+ <img src="'.plugin_dir_url( __FILE__ ).'../images/Thank-you.png">';
1086
+ if( empty($disabled[$plugin_id]) || $disabled[$plugin_id]['time'] != 0 ) {
1087
+ $html .= '
1088
+ <div class="berocket_feature_request_rate berocket-rate-stars-plugin-feature-'.$plugin_id.'">
1089
+ <h3>'.__("While you're here, you could rate this plugin", 'BeRocket_domain').'</h3>
1090
+ <ul class="berocket-rate-stars-block">
1091
+ <li><a class="berocket_rate_close brfirst"
1092
+ data-plugin="'.$plugin['id'].'"
1093
+ data-action="berocket_rate_stars_close"
1094
+ data-prevent="0"
1095
+ data-later="0"
1096
+ data-function="berocket_rate_star_close_notice"
1097
+ data-thanks_html=\'<img src="'.plugin_dir_url( __FILE__ ).'../images/Thank-you.png"><h3 class="berocket_thank_you_rate_us">'.__('Each good feedback is very important for plugin growth', 'BeRocket_domain').'</h3>\'
1098
+ href="https://wordpress.org/support/plugin/'.$plugin['free_slug'].'/reviews/?filter=5#new-post"
1099
+ target="_blank">'.__('This plugin deserves 5 stars', 'BeRocket_domain').'</a></li>
1100
+ <li><a class="berocket_rate_next_time brsecond"
1101
+ href="#later">'.__("I'll rate it next time", 'BeRocket_domain').'</a></li>
1102
+ <li><a class="berocket_rate_close brthird"
1103
+ data-plugin="'.$plugin['id'].'"
1104
+ data-action="berocket_rate_stars_close"
1105
+ data-prevent="1"
1106
+ data-later="0"
1107
+ data-function="berocket_rate_star_close_notice"
1108
+ href="#close">'.__('I already rated it', 'BeRocket_domain').'</a></li>
1109
+ </ul>
1110
+ </div>';
1111
+ }
1112
+ $html .= '</div>
1113
+ </div>
1114
+ <style>
1115
+ .berocket_feature_request_inside input,
1116
+ .berocket_feature_request_inside textarea,
1117
+ .berocket_feature_request_submit {
1118
+ width: 90%;
1119
+ }
1120
+ .berocket_feature_request_submit {
1121
+ margin-top: 30px;
1122
+ margin-bottom: 20px;
1123
+ color: #fff;
1124
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
1125
+ text-shadow: none;
1126
+ border: 0 none;
1127
+ min-width: 120px;
1128
+ -moz-user-select: none;
1129
+ background: #ff5252 none repeat scroll 0 0;
1130
+ box-sizing: border-box;
1131
+ cursor: pointer;
1132
+ display: inline-block;
1133
+ font-size: 14px;
1134
+ outline: 0 none;
1135
+ padding: 8px;
1136
+ position: relative;
1137
+ text-align: center;
1138
+ text-decoration: none;
1139
+ 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;
1140
+ white-space: nowrap;
1141
+ height: auto;
1142
+ vertical-align: top;
1143
+ line-height: 25px;
1144
+ border-radius: 3px;
1145
+ font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
1146
+ font-weight: bold;
1147
+ margin: 5px 0 15px;
1148
+ padding: 10px;
1149
+ }
1150
+ .berocket_feature_request_submit:hover,
1151
+ .berocket_feature_request_submit:focus,
1152
+ .berocket_feature_request_submit:active {
1153
+ background: #ff6e68 none repeat scroll 0 0;
1154
+ color: white;
1155
+ }
1156
+ .berocket_feature_request_button {
1157
+ line-height: 0;
1158
+ overflow: hidden;
1159
+ display: inline-block;
1160
+ }
1161
+ .berocket_feature_request_form {
1162
+ overflow: auto;
1163
+ }
1164
+ .berocket_feature_request_button,
1165
+ .berocket_feature_request_form,
1166
+ .berocket_feature_request_thanks {
1167
+ border-radius: 3px;
1168
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.06);
1169
+ position: relative;
1170
+ background-color: white;
1171
+ color: rgba(0, 0, 0, 0.87);
1172
+ margin-bottom: 30px;
1173
+ box-sizing: border-box;
1174
+ text-align: center;
1175
+ float: right;
1176
+ clear: right;
1177
+ width: 28%;
1178
+ }
1179
+ .berocket_feature_request_inside {
1180
+ padding: 0 25px;
1181
+ }
1182
+ .berocket_feature_request_button img,
1183
+ .berocket_feature_request_form img {
1184
+ width: 100%;
1185
+ }
1186
+ .berocket_feature_request_inside input,
1187
+ .berocket_feature_request_inside textarea {
1188
+ outline: none;
1189
+ box-shadow: none;
1190
+ resize: none;
1191
+ margin-bottom: 10px;
1192
+ margin-top: 10px;
1193
+ box-shadow: 0px 0px 15px #aaa;
1194
+ border-radius: 3px;
1195
+ padding: 10px;
1196
+ border: 2px solid #FFFFFF;
1197
+ }
1198
+ .berocket_feature_request_inside textarea {
1199
+ height: 150px;
1200
+ overflow: auto;
1201
+ }
1202
+ @media screen and (min-width: 901px) and (max-width: 1200px) {
1203
+ .berocket_feature_request_inside{
1204
+ padding-left: 10px;
1205
+ padding-right: 10px;
1206
+ }
1207
+ }
1208
+ .berocket_feature_request_thanks .berocket_feature_request_rate ul {
1209
+ margin-left: 20%;
1210
+ list-style: disc;
1211
+ }
1212
+ @media screen and (max-width: 900px) {
1213
+ .berocket_feature_request_thanks .berocket_feature_request_rate ul {
1214
+ margin-left: -80px;
1215
+ padding-left: 50%;
1216
+ }
1217
+ .berocket_feature_request {
1218
+ margin-top: 30px;
1219
+ }
1220
+ .berocket_feature_request_button,
1221
+ .berocket_feature_request_form,
1222
+ .berocket_feature_request_thanks {
1223
+ float: none;
1224
+ width: 100%;
1225
+ margin-bottom: 0;
1226
+ }
1227
+ .berocket_feature_request_inside input,
1228
+ .berocket_feature_request_inside textarea,
1229
+ .berocket_feature_request_submit{
1230
+ float: none;
1231
+ width: 100%;
1232
+ }
1233
+ }
1234
+ .berocket_feature_request_inside input.brfeature_error,
1235
+ .berocket_feature_request_inside textarea.brfeature_error {
1236
+ box-shadow: 0px 0px 15px #f00;
1237
+ border-color: #ff0000;
1238
+ animation-name: brfeature_error;
1239
+ animation-duration: 2s;
1240
+ }
1241
+ @keyframes brfeature_error {
1242
+ 0% {border-color: #ffffff;}
1243
+ 10% {border-color: #ff0000;}
1244
+ 20% {border-color: #ff9999;}
1245
+ 30% {border-color: #ff0000;}
1246
+ 40% {border-color: #ff9999;}
1247
+ 50% {border-color: #ff0000;}
1248
+ 60% {border-color: #ff9999;}
1249
+ 70% {border-color: #ff0000;}
1250
+ 80% {border-color: #ff9999;}
1251
+ 100% {border-color: #ff0000;}
1252
+ }
1253
+ .berocket_feature_request_thanks {
1254
+ padding-top: 20px;
1255
+ padding-bottom: 20px;
1256
+ }
1257
+ .berocket_feature_request_thanks .berocket_feature_request_rate h3 {
1258
+ color: #555;
1259
+ }
1260
+ .berocket_feature_request_thanks .berocket_feature_request_rate ul li {
1261
+ text-align: left;
1262
+ }
1263
+ </style>';
1264
+ return $html;
1265
+ }
1266
+ }
1267
+ }
1268
+ function wp_footer_js() {
1269
+ ?>
1270
+ <script>
1271
+ jQuery(document).on('click', '.berocket-rate-stars-block .berocket_rate_close', function(event) {
1272
+ var $this = jQuery(this);
1273
+ if( $this.data('prevent') ) {
1274
+ event.preventDefault();
1275
+ }
1276
+ var data = $this.data();
1277
+ if( $this.data('function') ) {
1278
+ if( typeof(window[$this.data('function')]) == 'function' ) {
1279
+ window[$this.data('function')](data);
1280
+ }
1281
+ }
1282
+ jQuery.post(ajaxurl, data, function(result) {
1283
+ if( $this.data('function_after') ) {
1284
+ if( typeof(window[$this.data('function_after')]) == 'function' ) {
1285
+ window[$this.data('function_after')](result, data);
1286
+ }
1287
+ }
1288
+ });
1289
+ });
1290
+ function berocket_rate_star_close_notice(button_data) {
1291
+ jQuery('.berocket-rate-stars-'+button_data.plugin).slideUp('100');
1292
+ console.log(button_data);
1293
+ if( ! button_data.prevent ) {
1294
+ jQuery('.berocket-rate-stars-plugin-page-'+button_data.plugin).html(button_data.thanks_html);
1295
+ jQuery('.berocket-rate-stars-plugin-feature-'+button_data.plugin).slideUp(100);
1296
+ }
1297
+ if( button_data.prevent && ! button_data.later ) {
1298
+ jQuery('.berocket-rate-stars-plugin-page-'+button_data.plugin).slideUp(100);
1299
+ jQuery('.berocket-rate-stars-plugin-feature-'+button_data.plugin).slideUp(100);
1300
+ }
1301
+ }
1302
+ jQuery(document).on('click', '.berocket_feature_request_button', function(event) {
1303
+ event.preventDefault();
1304
+ var $this = jQuery(this);
1305
+ $this.hide();
1306
+ $this.parents('.berocket_feature_request').find('.berocket_feature_request_form').show();
1307
+ });
1308
+ jQuery(document).on('submit', '.berocket_feature_request_inside', function(event) {
1309
+ event.preventDefault();
1310
+ var form_data = jQuery(this).serialize();
1311
+ var send = true;
1312
+ if( ! jQuery(this).find('[name=brfeature_title]').val() ) {
1313
+ send = false;
1314
+ jQuery(this).find('[name=brfeature_title]').addClass('brfeature_error');
1315
+ }
1316
+ if( ! jQuery(this).find('[name=brfeature_description]').val() ) {
1317
+ send = false;
1318
+ jQuery(this).find('[name=brfeature_description]').addClass('brfeature_error');
1319
+ }
1320
+ if( send ) {
1321
+ form_data = form_data+'&action=berocket_feature_request_send';
1322
+ jQuery.post(ajaxurl, form_data);
1323
+ jQuery(this).parents('.berocket_feature_request_form').hide().parents('.berocket_feature_request').find('.berocket_feature_request_thanks').show();
1324
+ }
1325
+ });
1326
+ jQuery(document).on('change', '.brfeature_error', function() {
1327
+ jQuery(this).removeClass('brfeature_error');
1328
+ });
1329
+ jQuery(document).on('click', '.berocket_feature_request_rate .berocket_rate_close', function(event) {
1330
+ jQuery(this).parents('.berocket_feature_request_rate').slideUp(100);
1331
+ });
1332
+ jQuery(document).on('click', '.berocket_rate_next_time', function(event) {
1333
+ event.preventDefault();
1334
+ jQuery(this).parents('.berocket_feature_request_rate').slideUp(100);
1335
+ });
1336
+ </script>
1337
+ <?php
1338
+ }
1339
+ }
1340
+ new berocket_admin_notices_rate_stars;
1341
+ }
1342
  ?>
includes/error_notices.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( ! class_exists('BeRocket_error_notices') ) {
3
+ class BeRocket_error_notices {
4
+ public function __construct() {
5
+ add_action( "wp_ajax_berocket_error_notices_get", array ( __CLASS__, 'get_plugin_error_ajax' ) );
6
+ }
7
+ public static function add_plugin_error($plugin_id, $message, $data = array()) {
8
+ if( empty($message) || empty($plugin_id) ) return;
9
+ $errors = self::get_plugin_error($plugin_id);
10
+ array_push($errors, array(
11
+ 'message' => $message,
12
+ 'data' => $data,
13
+ 'time' => current_time('timestamp'),
14
+ ));
15
+ self::save_plugin_error($plugin_id, $errors);
16
+ }
17
+ public static function get_plugin_error($plugin_id) {
18
+ $errors = get_option('berocket_plugin_error_'.$plugin_id);
19
+ if( ! is_array($errors) ) $errors = array();
20
+ return $errors;
21
+ }
22
+ public static function save_plugin_error($plugin_id, $errors) {
23
+ if( count($errors) > 5000 ) {
24
+ $i = 0;
25
+ foreach($errors as $error_id => $error) {
26
+ if($i > 100) break;
27
+ $i++;
28
+ unset($errors[$error_id]);
29
+ }
30
+ }
31
+ update_option('berocket_plugin_error_'.$plugin_id, $errors);
32
+ }
33
+ public static function get_plugin_error_ajax() {
34
+ $plugin_id = br_get_value_from_array($_POST, 'plugin_id');
35
+ if( empty($plugin_id) ) {
36
+ $plugin_id = br_get_value_from_array($_GET, 'plugin_id');
37
+ }
38
+ if( ! empty($plugin_id) && ( ! empty($_POST['clear_errors']) || ! empty($_GET['clear_errors']) ) ) {
39
+ self::clear_plugin_errors($plugin_id);
40
+ }
41
+ echo self::get_plugin_error_html($plugin_id);
42
+ wp_die();
43
+ }
44
+ public static function clear_plugin_errors($plugin_id) {
45
+ self::save_plugin_error($plugin_id, array());
46
+ }
47
+ public static function get_plugin_error_html($plugin_id) {
48
+ if( empty($plugin_id) ) {
49
+ return '';
50
+ }
51
+ $block_id = rand();
52
+ $errors = self::get_plugin_error($plugin_id);
53
+ $errors = array_reverse($errors);
54
+ $html = '<h3>Error List</h3>';
55
+ $html .= '<div class="berocket_plugin_errors_list class_'.$block_id.'">';
56
+ if( count($errors) ) {
57
+ foreach($errors as $error) {
58
+ $html .= '<div class="berocket_plugin_error">
59
+ <h4><small>'.date('Y-m-d h:i:s',br_get_value_from_array($error, 'time', current_time('timestamp'))) .'</small>'.br_get_value_from_array($error, 'message', 'No error message').'</h4>
60
+ <div style="display:none;">';
61
+ if( ! empty($error['data']) ) {
62
+ $error_data = print_r($error['data'], true);
63
+ if( is_array($error['data']) ) {
64
+ $error_data = substr($error_data, 8);
65
+ $error_data = substr($error_data, 0, -2);
66
+ }
67
+ $html .= '<pre>'.$error_data.'</pre>';
68
+ }
69
+ $html .= '</div>
70
+ </div>';
71
+ }
72
+ $html .= '<button value="'.$plugin_id.'" type="button" class="button berocket_clear_errors_notices">Clear errors for plugin</button>';
73
+ } else {
74
+ $html .= '<div class="berocket_plugin_error"><h4>Plugin doesn\'t have any errors</h4></div>';
75
+ }
76
+ $html .= '</div><script>
77
+ jQuery(".berocket_plugin_errors_list.class_'.$block_id.' .berocket_plugin_error h4").on("click", function() {
78
+ jQuery(this).next().toggle();
79
+ });
80
+ jQuery(".berocket_plugin_errors_list.class_'.$block_id.' .berocket_clear_errors_notices").on("click", function() {
81
+ var plugin_id = jQuery(this).val();
82
+ var $this = jQuery(this);
83
+ jQuery.post(ajaxurl, {action:"berocket_error_notices_get", plugin_id:plugin_id, clear_errors: true}, function(data) {
84
+ $this.parents(".berocket_plugin_errors_list").first().html(jQuery("<div>"+data+"</div>").find(".berocket_plugin_errors_list").html());
85
+ });
86
+ });
87
+ </script>
88
+ <style>
89
+ .berocket_plugin_errors_list .berocket_plugin_error:first-child{
90
+ border-top: 2px solid rgb(153, 153, 153);
91
+ }
92
+ .berocket_plugin_errors_list .berocket_plugin_error {
93
+ border: 2px solid rgb(153, 153, 153);
94
+ border-top: 0;
95
+ background-color: rgb(238, 238, 238);
96
+ line-height: 1.1em;
97
+ }
98
+ .berocket_plugin_errors_list .berocket_plugin_error > h4 {
99
+ font-size: 18px;
100
+ cursor: pointer;
101
+ margin: 0;
102
+ padding: 5px;
103
+ background-color: white;
104
+ }
105
+ .berocket_plugin_errors_list .berocket_plugin_error > h4 small {
106
+ font-size: 12px;
107
+ margin-right: 1em;
108
+ }
109
+ .berocket_plugin_errors_list .berocket_plugin_error > div {
110
+ font-size: 12px;
111
+ line-height: 1.1em;
112
+ }
113
+ .berocket_clear_errors_notices {
114
+ margin-top: 1em!important;
115
+ }
116
+ </style>';
117
+ return $html;
118
+ }
119
+ }
120
+ new BeRocket_error_notices();
121
+ }
includes/ico.png ADDED
Binary file
includes/updater.php ADDED
@@ -0,0 +1,782 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'BeRocket_updater' ) ) {
3
+ define( "BeRocket_update_path", 'https://berocket.com/' );
4
+ define( "BeRocket_updater_log", true );
5
+ include_once( plugin_dir_path( __FILE__ ) . 'error_notices.php' );
6
+
7
+ class BeRocket_updater {
8
+ public static $plugin_info = array();
9
+ public static $slugs = array();
10
+ public static $key = '';
11
+ public static $error_log = array();
12
+ public static $debug_mode = false;
13
+
14
+ public static function init() {
15
+ $options = self::get_options();
16
+ self::$debug_mode = ! empty( $options[ 'debug_mode' ] );
17
+ }
18
+
19
+ public static function run() {
20
+ $options = self::get_options();
21
+ self::$debug_mode = ! empty( $options[ 'debug_mode' ] );
22
+ self::$key = ( empty( $options[ 'account_key' ] ) ? '' : $options[ 'account_key' ] );
23
+
24
+ add_action( 'admin_head', array( __CLASS__, 'scripts' ) );
25
+ add_action( 'admin_menu', array( __CLASS__, 'main_menu_item' ), 1 );
26
+ add_action( 'admin_menu', array( __CLASS__, 'account_page' ), 500 );
27
+ add_action( 'network_admin_menu', array( __CLASS__, 'network_account_page' ) );
28
+ add_action( 'admin_init', array( __CLASS__, 'account_option_register' ) );
29
+ add_filter( 'pre_set_site_transient_update_plugins', array( __CLASS__, 'update_check_set' ) );
30
+ add_action( 'install_plugins_pre_plugin-information', array( __CLASS__, 'plugin_info' ), 1 );
31
+ add_action( "wp_ajax_br_test_key", array( __CLASS__, 'test_key' ) );
32
+ add_filter( 'http_request_host_is_external', array( __CLASS__, 'allow_berocket_host' ), 10, 3 );
33
+
34
+ if ( BeRocket_updater_log ) {
35
+ add_action( 'admin_footer', array( __CLASS__, 'error_log' ) );
36
+ add_action( 'wp_footer', array( __CLASS__, 'error_log' ) );
37
+ }
38
+
39
+ $plugin = array();
40
+ $plugin = apply_filters( 'BeRocket_updater_add_plugin', $plugin );
41
+
42
+ if ( ! isset( $options[ 'plugin_key' ] ) || ! is_array( $options[ 'plugin_key' ] ) ) {
43
+ $options[ 'plugin_key' ] = array();
44
+ }
45
+
46
+ $update = false;
47
+ foreach ( $plugin as $plug_id => $plug ) {
48
+ self::$slugs[ $plug[ 'id' ] ] = $plug[ 'slug' ];
49
+
50
+ if ( isset( $options[ 'plugin_key' ][ $plug[ 'id' ] ] ) && $options[ 'plugin_key' ][ $plug[ 'id' ] ] != '' ) {
51
+ $plugin[ $plug_id ][ 'key' ] = $options[ 'plugin_key' ][ $plug[ 'id' ] ];
52
+ } elseif ( isset( $plugin[ $plug_id ][ 'key' ] ) && $plugin[ $plug_id ][ 'key' ] != '' ) {
53
+ $options[ 'plugin_key' ][ $plug[ 'id' ] ] = $plugin[ $plug_id ][ 'key' ];
54
+ $update = true;
55
+ }
56
+ }
57
+
58
+ self::$plugin_info = $plugin;
59
+
60
+ if ( $update ) {
61
+ self::set_options( $options );
62
+ }
63
+
64
+ add_filter( 'berocket_display_additional_notices', array(
65
+ __CLASS__,
66
+ 'berocket_display_additional_notices'
67
+ ) );
68
+
69
+ if( ! is_network_admin() ) {
70
+ add_filter( 'custom_menu_order', array( __CLASS__, 'wp_menu_order' ) );
71
+ }
72
+
73
+ //ADMIN NOTICE CHECK
74
+ add_filter( 'berocket_admin_notice_is_display_notice', array( __CLASS__, 'admin_notice_is_display_notice' ), 10, 3 );
75
+ add_filter( 'berocket_admin_notice_is_display_notice_priority', array( __CLASS__, 'admin_notice_is_display_notice' ), 10, 3 );
76
+ }
77
+
78
+ public static function error_log() {
79
+ if ( self::$debug_mode ) {
80
+ self::$error_log = apply_filters( 'BeRocket_updater_error_log', self::$error_log );
81
+ self::$error_log[ 'real_memory_usage' ] = memory_get_peak_usage( true );
82
+ self::$error_log[ 'script_memory_usage' ] = memory_get_peak_usage( false );
83
+ self::$error_log[ 'memory_limit' ] = ini_get( 'memory_limit' );
84
+ self::$error_log[ 'WP_DEBUG' ] = 'WP_DEBUG:' . ( defined( 'WP_DEBUG' ) ? ( WP_DEBUG ? 'true' : 'false' ) : 'false' ) . '; WP_DEBUG_DISPLAY:' . ( defined( 'WP_DEBUG_DISPLAY' ) ? ( WP_DEBUG_DISPLAY ? 'true' : 'false' ) : 'false' );
85
+
86
+ ?>
87
+ <script>
88
+ console.log(<?php echo json_encode( self::$error_log ); ?>);
89
+ </script>
90
+ <?php
91
+ }
92
+ }
93
+
94
+ public static function wp_menu_order( $menu_ord ) {
95
+ global $submenu;
96
+
97
+ if( empty($submenu[ 'berocket_account' ]) || ! is_array($submenu[ 'berocket_account' ]) || count($submenu[ 'berocket_account' ]) == 0 ) {
98
+ return $menu_ord;
99
+ }
100
+
101
+ $new_order_temp = array();
102
+ $new_sub_order = array();
103
+ $new_order_sort = array();
104
+
105
+ $compatibility_hack = apply_filters('BeRocket_updater_menu_order_custom_post', array());
106
+
107
+ foreach ( $submenu[ 'berocket_account' ] as $item ) {
108
+ if ( $item[ 0 ] == 'BeRocket' ) {
109
+ $new_order_temp[] = $item;
110
+ $new_order_sort[] = "AAA";
111
+ continue;
112
+ } elseif ( $item[ 0 ] == 'Account Keys' ) {
113
+ $new_order_temp[] = $item;
114
+ $new_order_sort[] = "ZZZ";
115
+ continue;
116
+ }
117
+
118
+ if ( false !== strpos( $item[ 2 ], 'edit.php' ) && ! empty($compatibility_hack[ str_replace( "edit.php?post_type=", "", $item[ 2 ] ) ]) ) {
119
+ $item[ 0 ] = "<span class='berocket_admin_menu_custom_post_submenu'>" . $item[ 0 ] . "</span>";
120
+ $new_sub_order[ $compatibility_hack[ str_replace( "edit.php?post_type=", "", $item[ 2 ] ) ] ][] = $item;
121
+ } else {
122
+ $new_order_temp[] = $item;
123
+ $new_order_sort[] = $item[ 0 ];
124
+ }
125
+ }
126
+ $new_sub_order = apply_filters('BeRocket_updater_menu_order_sub_order', $new_sub_order);
127
+
128
+ array_multisort( $new_order_sort, $new_order_temp );
129
+
130
+ $new_order = array();
131
+ foreach ( $new_order_temp as $item ) {
132
+ $new_order[] = $item;
133
+
134
+ if ( ! empty( $new_sub_order[ $item[ 2 ] ] ) ) {
135
+ foreach ( $new_sub_order[ $item[ 2 ] ] as $sub_item ) {
136
+ $new_order[] = $sub_item;
137
+ }
138
+ }
139
+ }
140
+
141
+ $submenu[ 'berocket_account' ] = $new_order;
142
+
143
+ return $menu_ord;
144
+ }
145
+
146
+ public static function add_to_debug( $data, $plugin, $keys = false ) {
147
+ if ( self::$debug_mode ) {
148
+ if ( $keys === false ) {
149
+ self::$error_log[ $plugin ][] = $data;
150
+ } elseif ( is_array( $keys ) ) {
151
+ if ( count( $keys ) > 0 ) {
152
+ $data_set = self::$error_log[ $plugin ];
153
+ $last_key = array_pop( $keys );
154
+
155
+ foreach ( $keys as $key ) {
156
+ if ( ! is_array( $data_set[ $key ] ) ) {
157
+ $data_set[ $key ] = array();
158
+ }
159
+
160
+ $new_set = &$data_set[ $key ];
161
+ unset( $data_set );
162
+
163
+ $data_set = &$new_set;
164
+ unset( $new_set );
165
+ }
166
+
167
+ if ( empty( $last_key ) ) {
168
+ $data_set[] = $data;
169
+ } else {
170
+ $data_set[ $last_key ] = $data;
171
+ }
172
+ } else {
173
+ self::$error_log[ $plugin ][] = $data;
174
+ }
175
+ } else {
176
+ self::$error_log[ $plugin ][ $keys ] = $data;
177
+ }
178
+ }
179
+ }
180
+
181
+ public static function berocket_display_additional_notices( $notices ) {
182
+ if ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'berocket_account' ) {
183
+ return $notices;
184
+ }
185
+
186
+ $plugin_count = get_option('berocket_updater_registered_plugins');
187
+ update_option('berocket_updater_registered_plugins', count(self::$plugin_info));
188
+ if( count(self::$plugin_info) != $plugin_count ) {
189
+ $not_activated_notices = false;
190
+ } else {
191
+ if ( is_network_admin() ) {
192
+ $not_activated_notices = get_site_transient( 'berocket_not_activated_notices_site' );
193
+ } else {
194
+ $not_activated_notices = get_transient( 'berocket_not_activated_notices' );
195
+ }
196
+ }
197
+
198
+ if ( $not_activated_notices == false ) {
199
+ $active_plugin = get_option( 'berocket_key_activated_plugins' );
200
+ $active_site_plugin = get_site_option( 'berocket_key_activated_plugins' );
201
+
202
+ if ( ! is_array( $active_plugin ) ) {
203
+ $active_plugin = array();
204
+ }
205
+
206
+ if ( ! is_array( $active_site_plugin ) ) {
207
+ $active_site_plugin = array();
208
+ }
209
+
210
+ $not_activated_notices = array();
211
+ foreach ( self::$plugin_info as $plugin ) {
212
+ if ( empty( $active_plugin[ $plugin[ 'id' ] ] ) && empty( $active_site_plugin[ $plugin[ 'id' ] ] ) ) {
213
+ if ( version_compare( $plugin[ 'version' ], '2.0', '>=' ) ) {
214
+ $not_activated_notices[] = array(
215
+ 'start' => 0,
216
+ 'end' => 0,
217
+ 'name' => $plugin[ 'name' ],
218
+ 'html' => '<strong>Please
219
+ <a class="berocket_button" href="' . ( is_network_admin() ? admin_url( 'network/admin.php?page=berocket_account' ) : admin_url( 'admin.php?page=berocket_account' ) ) . '">activate plugin</a> ' . $plugin[ 'name' ] . ' with help of Plugin/Account Key from
220
+ <a class="berocket_button" href="' . BeRocket_update_path . 'user" target="_blank">BeRocket account</a></strong>.
221
+ You can activate plugin in
222
+ <a class="berocket_button" href="' . ( is_network_admin() ? admin_url( 'network/admin.php?page=berocket_account' ) : admin_url( 'admin.php?page=berocket_account' ) ) . '">BeRocket Account settings</a>
223
+ ',
224
+ 'righthtml' => '',
225
+ 'rightwidth' => 0,
226
+ 'nothankswidth' => 0,
227
+ 'contentwidth' => 1600,
228
+ 'subscribe' => false,
229
+ 'priority' => 10,
230
+ 'height' => 50,
231
+ 'repeat' => false,
232
+ 'repeatcount' => 1,
233
+ 'image' => array(
234
+ 'local' => '',
235
+ 'width' => 0,
236
+ 'height' => 0,
237
+ 'scale' => 1,
238
+ )
239
+ );
240
+ }
241
+ }
242
+ }
243
+
244
+ if ( is_network_admin() ) {
245
+ set_site_transient( 'berocket_not_activated_notices_site', $not_activated_notices, 7200 );
246
+ } else {
247
+ set_transient( 'berocket_not_activated_notices', $not_activated_notices, 7200 );
248
+ }
249
+ }
250
+
251
+ $notices = array_merge( $notices, $not_activated_notices );
252
+
253
+ return $notices;
254
+ }
255
+
256
+ public static function get_plugin_count() {
257
+ $count = count( self::$plugin_info );
258
+
259
+ return $count;
260
+ }
261
+
262
+ public static function allow_berocket_host( $allow, $host, $url ) {
263
+ if ( $host == 'berocket.com' ) {
264
+ $allow = true;
265
+ }
266
+
267
+ return $allow;
268
+ }
269
+
270
+ public static function test_key() {
271
+ if ( ! isset( $_POST[ 'key' ] ) || ! isset( $_POST[ 'id' ] ) ) {
272
+ $data = array(
273
+ 'key_exist' => 0,
274
+ 'status' => 'Failed',
275
+ 'error' => 'Incorrect query for this function(ID and Key must be sended)'
276
+ );
277
+
278
+ $out = json_encode( $data );
279
+ } else {
280
+ $key = sanitize_text_field( $_POST[ 'key' ] );
281
+ $id = sanitize_text_field( $_POST[ 'id' ] );
282
+ $out = get_transient( 'brupdate_' . $id . '_' . $key );
283
+
284
+ if ( $out == false ) {
285
+ $site_url = get_site_url();
286
+ $plugins = self::$plugin_info;
287
+
288
+ if ( is_array( $plugins ) ) {
289
+ $plugins = array_keys( $plugins );
290
+ $plugins = implode( ',', $plugins );
291
+ } else {
292
+ $plugins = '';
293
+ }
294
+
295
+ $response = wp_remote_post( BeRocket_update_path . 'main/account_updater', array(
296
+ 'body' => array(
297
+ 'key' => $key,
298
+ 'id' => $id,
299
+ 'url' => $site_url,
300
+ 'plugins' => $plugins
301
+ ),
302
+ 'method' => 'POST',
303
+ 'timeout' => 30,
304
+ 'redirection' => 5,
305
+ 'blocking' => true,
306
+ 'sslverify' => false
307
+ ) );
308
+
309
+ if ( ! is_wp_error( $response ) ) {
310
+ $out = wp_remote_retrieve_body( $response );
311
+ $current_plugin = false;
312
+ $out = json_decode( $out, true );
313
+
314
+ if ( ! is_array( $out ) ) {
315
+ $out = array();
316
+ }
317
+
318
+ $out[ 'upgrade' ] = array();
319
+ $options = self::get_options();
320
+
321
+ if ( $id != 0 ) {
322
+ foreach ( self::$plugin_info as $plugin ) {
323
+ if ( $plugin[ 'id' ] == $id ) {
324
+ $current_plugin = $plugin;
325
+ break;
326
+ }
327
+ }
328
+
329
+ if ( $current_plugin !== false ) {
330
+ if ( empty( $out[ 'error' ] ) ) {
331
+ $options[ 'plugin_key' ][ $id ] = $key;
332
+
333
+ if ( isset( $out[ 'versions' ][ $id ] ) && version_compare( $current_plugin[ 'version' ], $out[ 'versions' ][ $id ], '<' ) ) {
334
+ $upgrade_button = '<a href="' . wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $current_plugin[ 'plugin' ], 'upgrade-plugin_' . $current_plugin[ 'plugin' ] ) . '" class="button-primary button">Upgrade plugin</a>';
335
+ $out[ 'plugin_table' ] = '<p>' . $upgrade_button . '</p>' . $out[ 'plugin_table' ];
336
+ $out[ 'upgrade' ][] = array( 'id' => $id, 'upgrade' => $upgrade_button );
337
+ }
338
+ }
339
+ }
340
+ } else {
341
+ foreach ( self::$plugin_info as $plugin ) {
342
+ if ( isset( $out[ 'versions' ][ $plugin[ 'id' ] ] ) && version_compare( $plugin[ 'version' ], $out[ 'versions' ][ $plugin[ 'id' ] ], '<' ) ) {
343
+ $upgrade_button = '<a href="' . wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $plugin[ 'plugin' ], 'upgrade-plugin_' . $plugin[ 'plugin' ] ) . '" class="button-primary button">Upgrade plugin</a>';
344
+ $out[ 'upgrade' ][] = array(
345
+ 'id' => $plugin[ 'id' ],
346
+ 'upgrade' => $upgrade_button
347
+ );
348
+ }
349
+ }
350
+ $options[ 'account_key' ] = $key;
351
+ }
352
+
353
+ self::set_options( $options );
354
+
355
+ delete_site_transient( 'update_plugins' );
356
+ $out = json_encode( $out );
357
+ set_transient( 'brupdate_' . $id . '_' . $key, $out, 600 );
358
+ } else {
359
+ $data = array(
360
+ 'key_exist' => 0,
361
+ 'status' => 'Failed',
362
+ 'error' => $response->get_error_message()
363
+ );
364
+
365
+ $out = json_encode( $data );
366
+ }
367
+ }
368
+ self::update_check_set('');
369
+ }
370
+ echo $out;
371
+ wp_die();
372
+ }
373
+
374
+ public static function scripts() {
375
+ ?>
376
+ <script>
377
+ function BeRocket_key_check(key, show_correct, product_id) {
378
+ if (typeof( product_id ) == 'undefined' || product_id == null) {
379
+ product_id = 0;
380
+ }
381
+ data = {action: 'br_test_key', key: key, id: product_id};
382
+ is_submit = false;
383
+ jQuery.ajax({
384
+ url: ajaxurl,
385
+ data: data,
386
+ type: 'POST',
387
+ success: function (data) {
388
+ jQuery('.berocket_test_result').html(data);
389
+ if (data.key_exist == 1) {
390
+ if (show_correct) {
391
+ html = '<h3>' + data.status + '</h3>';
392
+ html += '<p><b>UserName: </b>' + data.username + '</p>';
393
+ html += '<p><b>E-Mail: </b>' + data.email + '</p>';
394
+ html += data.plugin_table;
395
+ jQuery('.berocket_test_result').html(html);
396
+ data.upgrade.forEach(function (el, i, arr) {
397
+ jQuery('.berocket_product_key_' + el.id + '_status').html(el.upgrade);
398
+ });
399
+ }
400
+ is_submit = true;
401
+ } else {
402
+ html = '<h3>' + data.status + '</h3>';
403
+ html += '<p><b>Error message:</b>' + data.error + '</p>';
404
+ jQuery('.berocket_test_result').html(html);
405
+ }
406
+ jQuery('.berocket_product_key_' + product_id + '_status').text(data.status);
407
+ },
408
+ dataType: 'json',
409
+ async: false
410
+ });
411
+ return is_submit;
412
+ }
413
+ jQuery(document).on('click', '.berocket_test_account_product', function (event) {
414
+ event.preventDefault();
415
+ if (jQuery(this).data('product')) {
416
+ key = jQuery(jQuery(this).data('product')).val();
417
+ } else {
418
+ key = jQuery('#berocket_product_key').val();
419
+ }
420
+ BeRocket_key_check(key, true, jQuery(this).data('id'));
421
+ });
422
+ </script>
423
+ <style>
424
+ .toplevel_page_berocket_account .dashicons-before img {
425
+ max-width: 16px;
426
+ max-height: 16px;
427
+ }
428
+ </style>
429
+ <?php
430
+ }
431
+
432
+ public static function network_account_page() {
433
+ add_menu_page( 'BeRocket Account Settings', 'BeRocket Account', 'manage_options', 'berocket_account', array(
434
+ __CLASS__,
435
+ 'account_form_network'
436
+ ), plugin_dir_url( __FILE__ ) . 'ico.png', '55.55' );
437
+ }
438
+
439
+ public static function main_menu_item() {
440
+ add_menu_page( 'BeRocket Account', 'BeRocket', 'manage_woocommerce', 'berocket_account', array(
441
+ __CLASS__,
442
+ 'account_form'
443
+ ), plugin_dir_url( __FILE__ ) . 'ico.png', '55.55' );
444
+ }
445
+
446
+ public static function account_page() {
447
+ add_submenu_page( 'berocket_account', 'BeRocket Account Settings', 'Account Keys', 'manage_options', 'berocket_account', array(
448
+ __CLASS__,
449
+ 'account_form'
450
+ ) );
451
+ }
452
+
453
+ public static function account_option_register() {
454
+ register_setting( 'BeRocket_account_option_settings', 'BeRocket_account_option' );
455
+ }
456
+
457
+ public static function account_form() {
458
+ ?>
459
+ <div class="wrap">
460
+ <form method="post" action="options.php" class="account_key_send">
461
+ <?php
462
+ $options = get_option( 'BeRocket_account_option' );
463
+ self::inside_form( $options );
464
+ ?>
465
+ </form>
466
+ </div>
467
+ <?php
468
+ }
469
+
470
+ public static function account_form_network() {
471
+ ?>
472
+ <div class="wrap">
473
+ <form method="post" action="edit.php?page=berocket_account" class="account_key_send">
474
+ <?php
475
+ if ( isset( $_POST[ 'BeRocket_account_option' ] ) ) {
476
+ $option = berocket_sanitize_array( $_POST[ 'BeRocket_account_option' ] );
477
+ update_site_option( 'BeRocket_account_option', $option );
478
+ }
479
+
480
+ $options = get_site_option( 'BeRocket_account_option' );
481
+ self::inside_form( $options );
482
+ ?>
483
+ </form>
484
+ </div>
485
+ <?php
486
+ }
487
+
488
+ public static function inside_form( $options ) {
489
+ settings_fields( 'BeRocket_account_option_settings' );
490
+ if ( isset( $options[ 'plugin_key' ] ) && is_array( $options[ 'plugin_key' ] ) ) {
491
+ $plugins_key = $options[ 'plugin_key' ];
492
+ } else {
493
+ $plugins_key = array();
494
+ }
495
+ ?>
496
+ <h2>BeRocket Account Settings</h2>
497
+ <div>
498
+ <table>
499
+ <tr>
500
+ <td><h3>DEBUG MODE</h3></td>
501
+ <td colspan=3><label><input type="checkbox" name="BeRocket_account_option[debug_mode]"
502
+ value="1"<?php if ( ! empty( $options[ 'debug_mode' ] ) )
503
+ echo ' checked' ?>>Enable debug mode</label></td>
504
+ </tr>
505
+ <tr>
506
+ <td><h3>Account key</h3></td>
507
+ <td><input type="text" id="berocket_account_key" name="BeRocket_account_option[account_key]"
508
+ size="50"
509
+ value="<?php echo( empty( $options[ 'account_key' ] ) ? '' : $options[ 'account_key' ] ) ?>">
510
+ </td>
511
+ <td><input class="berocket_test_account button-secondary" type="button" value="Test"></td>
512
+ <td class="berocket_product_key_0_status"></td>
513
+ </tr>
514
+ <?php
515
+ foreach ( self::$plugin_info as $plugin ) {
516
+ echo '<tr class="berocket_updater_plugin_key" data-id="', $plugin[ 'id' ], '">';
517
+ echo '<td><h4>';
518
+ if ( isset( $plugin[ 'name' ] ) ) {
519
+ echo $plugin[ 'name' ];
520
+ } else {
521
+ echo $plugin[ 'slug' ];
522
+ }
523
+ echo '</h4></td>';
524
+ echo '<td><input id="berocket_product_key_', $plugin[ 'id' ], '" size="50" name="BeRocket_account_option[plugin_key][', $plugin[ 'id' ], ']" type="text" value="', ( empty( $options[ 'plugin_key' ][ $plugin[ 'id' ] ] ) ? '' : $options[ 'plugin_key' ][ $plugin[ 'id' ] ] ), '"></td>';
525
+ echo '<td><input class="berocket_test_account_product button-secondary" data-id="', $plugin[ 'id' ], '" data-product="#berocket_product_key_', $plugin[ 'id' ], '" type="button" value="Test"></td>';
526
+ echo '<td class="berocket_product_key_status berocket_product_key_', $plugin[ 'id' ], '_status"></td>';
527
+ echo '</tr>';
528
+ unset( $plugins_key[ $plugin[ 'id' ] ] );
529
+ }
530
+ foreach ( $plugins_key as $key_id => $key_val ) {
531
+ echo '<input name="BeRocket_account_option[plugin_key][', $key_id, ']" type="hidden" value="', $key_val, '">';
532
+ }
533
+ ?>
534
+ </table>
535
+ </div>
536
+ <div class="berocket_test_result"></div>
537
+ <input type="submit" class="button-primary" value="Save Changes"/>
538
+
539
+ <div class="berocket_debug_errors">
540
+ <h3>Errors</h3>
541
+ <div>
542
+ Select plugin
543
+ <select class="berocket_select_plugin_for_error">
544
+ <?php
545
+ foreach ( self::$plugin_info as $plugin ) {
546
+ echo '<option value="' . $plugin[ 'id' ] . '">' . $plugin[ 'name' ] . '</option>';
547
+ }
548
+ ?>
549
+ </select>
550
+ <button type="button" class="button berocket_get_plugin_for_error">Get errors</button>
551
+ <div class="berocket_html_plugin_for_error"></div>
552
+ </div>
553
+ </div>
554
+ <script>
555
+ jQuery('.berocket_get_plugin_for_error').click(function () {
556
+ var plugin_id = jQuery('.berocket_select_plugin_for_error').val();
557
+ jQuery.post(ajaxurl, {action: 'berocket_error_notices_get', plugin_id: plugin_id}, function (data) {
558
+ jQuery('.berocket_html_plugin_for_error').html(data);
559
+ });
560
+ });
561
+ jQuery('.berocket_test_account').click(function (event) {
562
+ event.preventDefault();
563
+ key = jQuery('#berocket_account_key').val();
564
+ BeRocket_key_check(key, true);
565
+ });
566
+ jQuery(document).on('submit', '.account_key_send', function (event) {
567
+ key = jQuery('#berocket_account_key').val();
568
+ if (key != '') {
569
+ result = BeRocket_key_check(key, false);
570
+ if (!result) {
571
+ event.preventDefault();
572
+ }
573
+ }
574
+ });
575
+ </script>
576
+ <?php
577
+ }
578
+
579
+ public static function update_check_set( $value ) {
580
+ if ( is_network_admin() ) {
581
+ $active_plugin = get_site_option( 'berocket_key_activated_plugins' );
582
+ } else {
583
+ $active_plugin = get_option( 'berocket_key_activated_plugins' );
584
+ }
585
+
586
+ $no_update_paid = array();
587
+
588
+ foreach ( self::$plugin_info as $plugin ) {
589
+ if ( ! empty( self::$key ) && strlen( self::$key ) == 40 ) {
590
+ $key = self::$key;
591
+ }
592
+
593
+ if ( ! empty( $plugin[ 'key' ] ) && strlen( $plugin[ 'key' ] ) == 40 ) {
594
+ $key = $plugin[ 'key' ];
595
+ }
596
+
597
+ $version = false;
598
+ if ( ! empty( $key ) ) {
599
+ $version = get_transient( 'brversion_' . $plugin[ 'id' ] . '_' . $key );
600
+ if ( $version == false ) {
601
+ $site_url = get_site_url();
602
+ $url = BeRocket_update_path . 'main/get_plugin_version/' . $plugin[ 'id' ] . '/' . $key;
603
+
604
+ $response = wp_remote_post( $url, array(
605
+ 'body' => array(
606
+ 'url' => $site_url
607
+ ),
608
+ 'method' => 'POST',
609
+ 'timeout' => 30,
610
+ 'redirection' => 5,
611
+ 'blocking' => true,
612
+ 'sslverify' => false
613
+ ) );
614
+
615
+ if ( ! is_wp_error( $response ) ) {
616
+ $out = wp_remote_retrieve_body( $response );
617
+ if ( ! empty( $out ) ) {
618
+ $out = json_decode( @ $out );
619
+ if ( ! empty( $out->status ) && $out->status == 'success' ) {
620
+ $version = $out->version;
621
+ }
622
+ }
623
+ }
624
+ set_transient( 'brversion_' . $plugin[ 'id' ] . '_' . $key, $version, 600 );
625
+ }
626
+ }
627
+
628
+ if ( ! is_array( $active_plugin ) ) {
629
+ $active_plugin = array();
630
+ }
631
+
632
+ $responsed = false;
633
+ if ( $version !== false ) {
634
+ $active_plugin[ $plugin[ 'id' ] ] = true;
635
+ if ( version_compare( $plugin[ 'version' ], $version, '<' ) && ! empty($value) ) {
636
+ $value->checked[ $plugin[ 'plugin' ] ] = $version;
637
+ $val = (object) array(
638
+ 'id' => 'br_' . $plugin[ 'id' ],
639
+ 'new_version' => $version,
640
+ 'package' => BeRocket_update_path . 'main/update_product/' . $plugin[ 'id' ] . '/' . $key,
641
+ 'url' => BeRocket_update_path . 'product/' . $plugin[ 'id' ],
642
+ 'plugin' => $plugin[ 'plugin' ],
643
+ 'slug' => $plugin[ 'slug' ]
644
+ );
645
+ $value->response[ $plugin[ 'plugin' ] ] = $val;
646
+ $responsed = true;
647
+ }
648
+ } else {
649
+ $active_plugin[ $plugin[ 'id' ] ] = false;
650
+ }
651
+ if( ! $responsed && isset($plugin[ 'version_capability' ]) && $plugin[ 'version_capability' ] >= 10 ) {
652
+ $val = (object) array(
653
+ 'id' => 'br_' . $plugin[ 'id' ],
654
+ 'new_version' => $plugin[ 'version' ],
655
+ 'package' => BeRocket_update_path . 'main/update_product/' . $plugin[ 'id' ] . '/' . ( empty($key) ? 'none' : $key ),
656
+ 'url' => BeRocket_update_path . 'product/' . $plugin[ 'id' ],
657
+ 'plugin' => $plugin[ 'plugin' ],
658
+ 'slug' => $plugin[ 'slug' ]
659
+ );
660
+ $no_update_paid[$plugin[ 'plugin' ]] = $val;
661
+ }
662
+ }
663
+
664
+ if ( is_network_admin() ) {
665
+ update_site_option( 'berocket_key_activated_plugins', $active_plugin );
666
+ } else {
667
+ update_option( 'berocket_key_activated_plugins', $active_plugin );
668
+ }
669
+
670
+ delete_site_transient( 'berocket_not_activated_notices_site' );
671
+ delete_transient( 'berocket_not_activated_notices' );
672
+ if ( is_multisite() ) {
673
+ global $wpdb;
674
+
675
+ $current_site = get_current_site();
676
+ $all_sites = get_sites(array('fields' => 'ids'));
677
+ if( is_array($all_sites) ) {
678
+ foreach($all_sites as $site_id) {
679
+ switch_to_blog($site_id);
680
+ delete_site_transient( 'berocket_not_activated_notices_site' );
681
+ delete_transient( 'berocket_not_activated_notices' );
682
+ restore_current_blog();
683
+ }
684
+ }
685
+ }
686
+ if ( ! empty($value) && isset( $value->no_update ) && is_array( $value->no_update ) ) {
687
+ $value->no_update = array_merge($value->no_update, $no_update_paid);
688
+ foreach ( $value->no_update as $key => $val ) {
689
+ if ( isset( $val->slug ) && in_array( $val->slug, self::$slugs ) ) {
690
+ if( ! array_key_exists($key, $no_update_paid) ) {
691
+ unset( $value->no_update[ $key ] );
692
+ }
693
+ }
694
+ }
695
+ }
696
+
697
+ return $value;
698
+ }
699
+
700
+ public static function plugin_info() {
701
+ $plugin = wp_unslash( $_REQUEST[ 'plugin' ] );
702
+
703
+ if ( in_array( $plugin, self::$slugs ) ) {
704
+ remove_action( 'install_plugins_pre_plugin-information', 'install_plugin_information' );
705
+
706
+ $plugin_id = array_search( $plugin, self::$slugs );
707
+ $plugin_info = get_transient( 'brplugin_info_' . $plugin_id );
708
+
709
+ if ( $plugin_info == false ) {
710
+ $url = BeRocket_update_path . 'main/update_info/' . $plugin_id;
711
+ $site_url = get_site_url();
712
+ $response = wp_remote_post( $url, array(
713
+ 'body' => array(
714
+ 'url' => $site_url
715
+ ),
716
+ 'method' => 'POST',
717
+ 'timeout' => 30,
718
+ 'redirection' => 5,
719
+ 'blocking' => true,
720
+ 'sslverify' => false
721
+ ) );
722
+
723
+ if ( ! is_wp_error( $response ) ) {
724
+ $plugin_info = wp_remote_retrieve_body( $response );
725
+ set_transient( 'brplugin_info_' . $plugin_id, $plugin_info, 600 );
726
+ }
727
+ }
728
+
729
+ echo $plugin_info;
730
+ die;
731
+ }
732
+ }
733
+
734
+ public static function get_options() {
735
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
736
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
737
+ }
738
+
739
+ if ( is_multisite() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
740
+ $options = get_site_option( 'BeRocket_account_option' );
741
+ } else {
742
+ $options = get_option( 'BeRocket_account_option' );
743
+ }
744
+
745
+ return $options;
746
+ }
747
+
748
+ public static function set_options( $options ) {
749
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
750
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
751
+ }
752
+
753
+ if ( is_multisite() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
754
+ update_site_option( 'BeRocket_account_option', $options );
755
+ } else {
756
+ update_option( 'BeRocket_account_option', $options );
757
+ }
758
+ self::update_check_set('');
759
+ }
760
+ public static function admin_notice_is_display_notice($display_notice, $item, $search_data) {
761
+ if( ! empty($item['for_plugin']) && is_array($item['for_plugin']) && ! empty($item['for_plugin']['id']) && ! empty($item['for_plugin']['version']) ) {
762
+ $has_free = false;
763
+ foreach ( self::$plugin_info as $plugin ) {
764
+ if( version_compare($plugin[ 'version' ], '2.0', '<') ) {
765
+ $has_free = true;
766
+ }
767
+ if ( $plugin[ 'id' ] == $item['for_plugin']['id'] && version_compare($plugin[ 'version' ], $item['for_plugin']['version'], '>=') ) {
768
+ $display_notice = false;
769
+ break;
770
+ }
771
+ }
772
+ if( ! $has_free && ! empty($item['for_plugin']['onlyfree']) ) {
773
+ $display_notice = false;
774
+ }
775
+ }
776
+ return $display_notice;
777
+ }
778
+ }
779
+
780
+ BeRocket_updater::init();
781
+ add_action( 'plugins_loaded', array( 'BeRocket_updater', 'run' ), 999 );
782
+ }
includes/wizard.php CHANGED
@@ -9,6 +9,8 @@ class BeRocket_AAPF_Wizard {
9
 
10
  public static function set_wizard_js_css() {
11
  wp_enqueue_script('common');
 
 
12
  do_action('BeRocket_wizard_javascript');
13
  }
14
 
@@ -64,15 +66,17 @@ class BeRocket_AAPF_Wizard {
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;">
9
 
10
  public static function set_wizard_js_css() {
11
  wp_enqueue_script('common');
12
+ wp_register_style( 'font-awesome', plugins_url( '../css/font-awesome.min.css', __FILE__ ) );
13
+ wp_enqueue_style( 'font-awesome' );
14
  do_action('BeRocket_wizard_javascript');
15
  }
16
 
66
  <table class="framework-form-table berocket_framework_menu_selectors">
67
  <tbody>
68
  <tr style="display: table-row;">
69
+ <th scope="row"><?php _e('Get selectors automatically', 'BeRocket_AJAX_domain') ?></th>
70
  <td>
71
  <?php echo BeRocket_wizard_generate_autoselectors(array(
72
  'products' => '.berocket_aapf_products_selector',
73
  'pagination' => '.berocket_aapf_pagination_selector',
74
  'result_count' => '.berocket_aapf_product_count_selector')); ?>
75
+ <ol>
76
+ <li><?php _e('Run Auto-selector', 'BeRocket_AJAX_domain') ?></li>
77
+ <li><?php _e('Wait until end <strong style="color:red;">do not close this page</strong>', 'BeRocket_AJAX_domain') ?></li>
78
+ <li><?php _e('Save settings with new selectors', 'BeRocket_AJAX_domain') ?></li>
79
+ </ol>
80
  </td>
81
  </tr>
82
  <tr style="display: table-row;">
js/widget.min.js CHANGED
@@ -762,7 +762,23 @@
762
  $('.berocket_aapf_widget input[type=checkbox], .berocket_aapf_widget input[type=radio]').each(function() {
763
  $(this).prop('checked', false);
764
  });
765
- updateProducts();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766
  });
767
  });
768
  })(jQuery);
762
  $('.berocket_aapf_widget input[type=checkbox], .berocket_aapf_widget input[type=radio]').each(function() {
763
  $(this).prop('checked', false);
764
  });
765
+ $('.berocket_filter_slider').each(function() {
766
+ $slider = $(this);
767
+
768
+ val1 = parseFloat($slider.data('min'));
769
+ val2 = parseFloat($slider.data('max'));
770
+
771
+ if( $slider.hasClass('berocket_filter_price_slider') ){
772
+ val1 = val1.toFixed(2);
773
+ val2 = val2.toFixed(2);
774
+ }
775
+
776
+ $( '#'+$slider.data('fields_1') ).val( val1 );
777
+ $( '#'+$slider.data('fields_2') ).val( val2 );
778
+
779
+ $slider.slider( "values", [ val1, val2 ] );
780
+ });
781
+ updateProducts(true);
782
  });
783
  });
784
  })(jQuery);
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.6
8
- Stable tag: 1.2.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -15,11 +15,6 @@ 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
- = &#128226; BeRocket Promotions - Summer Sale &#127774; : =
19
- *11/07 - 20/07*
20
- &#128181; [Premium WooCommerce Load More Products – Save $20](https://berocket.com/product/woocommerce-load-more-products)
21
-
22
-
23
  = New Feature in version 1.2.5 - Filter by Product Categories! =
24
 
25
  = Features: =
@@ -189,6 +184,12 @@ You can try this plugin's admin side [here](http://berocket.com/product/woocomme
189
 
190
  == Changelog ==
191
 
 
 
 
 
 
 
192
  = 1.2.6 =
193
  * Upgrade - better plugin menu items location
194
  * Upgrade - Categories filter
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
8
+ Stable tag: 1.2.7
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
  = New Feature in version 1.2.5 - Filter by Product Categories! =
19
 
20
  = Features: =
184
 
185
  == Changelog ==
186
 
187
+ = 1.2.7 =
188
+ * Enhancement - Auto-selectors has "Stop" button
189
+ * Enhancement - Feature request box
190
+ * Enhancement - Feedback box
191
+ * Fix - Reset button
192
+
193
  = 1.2.6 =
194
  * Upgrade - better plugin menu items location
195
  * Upgrade - Categories filter
templates/admin-settings.php CHANGED
@@ -91,12 +91,14 @@ $dplugin_desc = '';
91
  <div id="selectors" class="tab-item <?php if(@$options['br_opened_tab'] == 'selectors' ) echo 'current'; ?>">
92
  <table class="form-table">
93
  <tr>
94
- <th scope="row"><?php _e('Get selectors automatically (BETA)', 'BeRocket_AJAX_domain') ?></th>
95
  <td>
96
  <?php echo BeRocket_wizard_generate_autoselectors(array('products' => '.berocket_aapf_products_selector', 'pagination' => '.berocket_aapf_pagination_selector', 'result_count' => '.berocket_aapf_product_count_selector')); ?>
97
- <div>
98
- <?php _e('Please do not use it on live sites. If something went wrong write us.', 'BeRocket_AJAX_domain') ?>
99
- </div>
 
 
100
  </td>
101
  </tr>
102
  <tr>
91
  <div id="selectors" class="tab-item <?php if(@$options['br_opened_tab'] == 'selectors' ) echo 'current'; ?>">
92
  <table class="form-table">
93
  <tr>
94
+ <th scope="row"><?php _e('Get selectors automatically', 'BeRocket_AJAX_domain') ?></th>
95
  <td>
96
  <?php echo BeRocket_wizard_generate_autoselectors(array('products' => '.berocket_aapf_products_selector', 'pagination' => '.berocket_aapf_pagination_selector', 'result_count' => '.berocket_aapf_product_count_selector')); ?>
97
+ <ol>
98
+ <li><?php _e('Run Auto-selector', 'BeRocket_AJAX_domain') ?></li>
99
+ <li><?php _e('Wait until end <strong style="color:red;">do not close this page</strong>', 'BeRocket_AJAX_domain') ?></li>
100
+ <li><?php _e('Save settings with new selectors', 'BeRocket_AJAX_domain') ?></li>
101
+ </ol>
102
  </td>
103
  </tr>
104
  <tr>
templates/settings_footer.php CHANGED
@@ -1,4 +1,5 @@
1
- <?php if ( ! empty($feature_list) && count($feature_list) > 0 ) { ?>
 
2
  <div class="paid_features">
3
  <?php
4
  $feature_text = '';
@@ -18,8 +19,8 @@
18
  <a class="buy_premium_version" href="http://berocket.com/checkout/%licence%/promo/SAVE15" target="_blank">BUY NOW</a>
19
  <span>and get <b>%discount% discount</b></span>
20
  </div>
21
- <p>Support the plugin by purchasing paid version. This will provide faster growth,
22
- better support and much more functionality for the plugin</p>';
23
 
24
  $dpdiscount = '15%';
25
  if ( isset( $start_time ) and isset( $end_time ) and isset( $discount ) and time() > $start_time && time() < $end_time and (int) $discount > 15 ) {
@@ -242,6 +243,7 @@
242
  }
243
  </style>
244
  <?php
 
245
  $subscribed = get_option('berocket_email_subscribed');
246
  if ( ! $subscribed ) {
247
  $user_email = wp_get_current_user();
1
+ <?php if ( ! empty($feature_list) && count($feature_list) > 0 ) {
2
+ echo apply_filters('berocket_rate_plugin_window', '', $paid_plugin_info['id']); ?>
3
  <div class="paid_features">
4
  <?php
5
  $feature_text = '';
19
  <a class="buy_premium_version" href="http://berocket.com/checkout/%licence%/promo/SAVE15" target="_blank">BUY NOW</a>
20
  <span>and get <b>%discount% discount</b></span>
21
  </div>
22
+ <p>Support the plugin by purchasing paid version<br>
23
+ This will help us release next version</p>';
24
 
25
  $dpdiscount = '15%';
26
  if ( isset( $start_time ) and isset( $end_time ) and isset( $discount ) and time() > $start_time && time() < $end_time and (int) $discount > 15 ) {
243
  }
244
  </style>
245
  <?php
246
+ echo apply_filters('berocket_feature_request_window', '', $paid_plugin_info['id']);
247
  $subscribed = get_option('berocket_email_subscribed');
248
  if ( ! $subscribed ) {
249
  $user_email = wp_get_current_user();
wizard/main.php CHANGED
@@ -6,9 +6,11 @@ if( ! class_exists('BeRocket_selector_wizard_woocommerce') ) {
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 );
@@ -35,6 +37,8 @@ if( ! class_exists('BeRocket_selector_wizard_woocommerce') ) {
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
  )
@@ -130,9 +134,7 @@ if( ! class_exists('BeRocket_selector_wizard_woocommerce') ) {
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 );
@@ -143,13 +145,30 @@ if( ! class_exists('BeRocket_selector_wizard_woocommerce') ) {
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' => '',
@@ -167,12 +186,22 @@ if( ! class_exists('BeRocket_selector_wizard_woocommerce') ) {
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
  }
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_action('BeRocket_wizard_ended_check', array($this, 'remove_products_ended'));
10
  add_filter('BeRocket_wizard_category_link', array($this, 'category_link'));
11
  add_action( 'wp_ajax_berocket_wizard_selector_start', array( $this, 'wizard_selector_start' ) );
12
  add_action( 'wp_ajax_berocket_wizard_selector_end', array( $this, 'remove_products' ) );
13
+ add_action( 'wp_ajax_berocket_wizard_selector_ended', array( $this, 'remove_products_ended_check' ) );
14
  $status = get_option('BeRocket_selector_wizard_status');
15
  if( $status == 'started' ) {
16
  add_filter('loop_shop_per_page', array($this, 'loop_shop_per_page'), 999999999999999 );
37
  'creating_products' => __('Creating products', 'BeRocket_domain'),
38
  'getting_selectors' => __('Gettings selectors', 'BeRocket_domain'),
39
  'removing_products' => __('Removing products', 'BeRocket_domain'),
40
+ 'stopping_text' => __('Stopping. Wait', 'BeRocket_domain'),
41
+ 'stop_text' => __('Stop', 'BeRocket_domain'),
42
  'error' => __('Error:', 'BeRocket_domain'),
43
  'ajaxurl' => admin_url('admin-ajax.php')
44
  )
134
  }
135
  }
136
 
137
+ public function remove_products_ended() {
 
 
138
  add_action('pre_get_posts', array($this, 'products_per_page_more'), 999999999999999);
139
  $args = array("post_type" => "product", "s" => 'BeRocketSelectorsTest', 'posts_per_page' => 100);
140
  $query = get_posts( $args );
145
  }
146
  }
147
  $term = get_term_by('name', 'BeRocketSelectors', 'product_cat');
148
+ if( $term !== FALSE ) {
149
+ wp_delete_term($term->term_id, $term->taxonomy);
150
+ }
151
+ remove_action('pre_get_posts', array($this, 'products_per_page_more'), 999999999999999);
152
+ }
153
+ function remove_products_ended_check() {
154
+ $status = get_option('BeRocket_selector_wizard_status');
155
+ if( $status == 'ended' ) {
156
+ do_action('BeRocket_wizard_ended_check');
157
+ }
158
+ wp_die();
159
+ }
160
+ function remove_products() {
161
+ remove_filter('loop_shop_per_page', array($this, 'loop_shop_per_page'), 999999999999999 );
162
+ remove_action('pre_get_posts', array($this, 'products_per_page'), 999999999999999);
163
+ $this->remove_products_ended();
164
  update_option('BeRocket_selector_wizard_status', 'ended');
165
  wp_die();
166
  }
167
  }
168
  new BeRocket_selector_wizard_woocommerce();
169
  function BeRocket_wizard_generate_autoselectors($input_classes = array(), $js_functions = array()) {
170
+ $status = get_option('BeRocket_selector_wizard_status');
171
+ $status = $status == 'started';
172
  $js_functions = array_merge(
173
  array(
174
  'any' => '',
186
  'result_count' => '',
187
  ), $input_classes);
188
  $html = '<div class="berocket_wizard_autoselectors" data-functions=\'' . json_encode($js_functions) . '\' data-inputs=\'' . json_encode($input_classes) . '\'>
189
+ '.($status ? '<div class="berocket_selectors_was_runned"><strong style="color: red;">'.__('Script was runned, but page closed until end. Please stop it to prevent any problems on your site', 'BeRocket_domain').'</strong></div>' : '').'
190
+ <button class="berocket_autoselector button" type="button"'.($status ? ' disabled' : '').'>Auto-Selectors</button>
191
+ <span class="berocket_autoselect_spin"'.($status ? '' : 'style="display:none;').'"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i><button class="berocket_autoselector_stop button" type="button">Stop</button></span>
192
  <span class="berocket_autoselect_ready" style="display:none;"><i class="fa fa-check fa-3x fa-fw"></i></span>
193
  <span class="berocket_autoselect_error" style="display:none;"><i class="fa fa-times fa-3x fa-fw"></i></span>
194
  <div class="berocket_autoselector_load" style="display:none;"><div class="berocket_line"></div><div class="berocket_autoselector_action"></div></div>
195
+ <h4>' . __('Steps:', 'BeRocket_domain') . '</h4>
196
+ <ol>
197
+ <li><span>' . __('Creating products', 'BeRocket_domain') . '</span> <i class="fa"></i></li>
198
+ <li><span>' . __('Gettings selectors', 'BeRocket_domain') . '</span> <i class="fa"></i></li>
199
+ <li><span>' . __('Removing products', 'BeRocket_domain') . '</span> <i class="fa"></i></li>
200
+ </ol>
201
+ </div>
202
+ <script>jQuery(document).ready(function(){
203
+ jQuery.get(berocket_wizard_autoselect.ajaxurl, {action:"berocket_wizard_selector_ended"});
204
+ });</script>';
205
  return $html;
206
  }
207
  }
wizard/wizard.css CHANGED
@@ -30,3 +30,30 @@
30
  font-size: 16px;
31
  text-align: center;
32
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  font-size: 16px;
31
  text-align: center;
32
  }
33
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselector.button,
34
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselector_stop.button {
35
+ margin-top:0;
36
+ margin-bottom:0;
37
+ }
38
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselector_stop.button {
39
+ background-color: #ff5555;
40
+ }
41
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselector_stop.button:hover {
42
+ background-color: #ee0000;
43
+ }
44
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselect_spin,
45
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselect_ready,
46
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselect_error {
47
+ line-height: 42px;
48
+ }
49
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselect_spin .fa,
50
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselect_ready .fa,
51
+ .br_framework_submit_form .berocket_wizard_autoselectors .berocket_autoselect_error .fa {
52
+ vertical-align: middle;
53
+ }
54
+ .berocket_wizard_autoselectors ol li .fa-check {
55
+ color: #33bb33;
56
+ }
57
+ .berocket_wizard_autoselectors ol li .fa-times {
58
+ color: #bb3333;
59
+ }
wizard/wizard.js CHANGED
@@ -141,10 +141,16 @@ var BeRocket_wizard_check = function(category_page_url, input_data,execute_funct
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++;
@@ -276,6 +282,9 @@ var BeRocket_wizard_check = function(category_page_url, input_data,execute_funct
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);
@@ -308,6 +317,9 @@ var BeRocket_wizard_check = function(category_page_url, input_data,execute_funct
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 {
@@ -325,6 +337,10 @@ var BeRocket_wizard_check = function(category_page_url, input_data,execute_funct
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 ) {
@@ -351,6 +367,9 @@ var BeRocket_wizard_check = function(category_page_url, input_data,execute_funct
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 {
@@ -368,22 +387,48 @@ var BeRocket_wizard_check = function(category_page_url, input_data,execute_funct
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);
@@ -398,6 +443,8 @@ function BeRocket_set_autoselector_load_position(position, position_name, next_p
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();
@@ -412,6 +459,7 @@ function berocket_wizard_set_val_to_input(input_selector, 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');
@@ -440,30 +488,33 @@ function berocket_wizard_autoselector_end(function_after_end) {
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
  }
141
  i = 0;
142
  $has_elem = $elem;
143
  var result_classes = $elem.attr('class');
144
+ if( typeof(result_classes) == 'undefined' ) {
145
+ result_classes = '';
146
+ }
147
  result_classes = result_classes.split(/\s+/);
148
  while( has_product < 3 && i < 10 ) {
149
  if( $has_elem.is(':contains("BeRocketSelectorsTest")') ) {
150
  class1 = $has_elem.attr('class');
151
+ if( typeof(class1) == 'undefined' ) {
152
+ class1 = '';
153
+ }
154
  class1 = class1.split(/\s+/);
155
  result_classes = br_array_intersect(result_classes, class1);
156
  has_product++;
282
  }
283
  if( $products_count.length > 0 ) {
284
  checkClass = $products_count.attr('class');
285
+ if( typeof(checkClass) == 'undefined' ) {
286
+ checkClass = '';
287
+ }
288
  if( typeof checkClass == 'string' ) {
289
  checkClass = checkClass.split(/\s+/);
290
  checkClass = br_remove_empty_classes(checkClass);
317
  }
318
  if( $next.length > 0 ) {
319
  checkClass = $next.attr('class');
320
+ if( typeof(checkClass) == 'undefined' ) {
321
+ checkClass = '';
322
+ }
323
  if( checkClass == '' || typeof checkClass != 'string' ) {
324
  checkClass = $next.prop("tagName").toLowerCase()+':contains("'+$next.text()+'")';
325
  } else {
337
  current_url = current_url+'&paged=6';
338
  }
339
  jQuery.get(current_url, function(data) {
340
+ if( BeRocket_autoselector_stop ) {
341
+ berocket_wizard_autoselector(false);
342
+ return;
343
+ }
344
  var $data = jQuery('<div>'+data+'</div>');
345
  var $pagination6 = $data.find(BeRocket_wizard_selectors.pagination);
346
  if( $pagination6.length > 0 ) {
367
  }
368
  if( $prev.length > 0 ) {
369
  checkClass = $prev.attr('class');
370
+ if( typeof(checkClass) == 'undefined' ) {
371
+ checkClass = '';
372
+ }
373
  if( checkClass == '' || typeof checkClass != 'string' ) {
374
  checkClass = $prev.prop("tagName").toLowerCase()+':contains("'+$prev.text()+'")';
375
  } else {
387
  end_selectors(true);
388
  }
389
  }
390
+ var BeRocket_autoselector_stop = false;
391
  var BeRocket_current_autoselector_block = jQuery('<div></div>');
392
  jQuery(document).on('click', '.berocket_autoselector', function(event) {
393
  event.preventDefault();
394
+ BeRocket_autoselector_stop = false;
395
+ jQuery('.berocket_autoselector_stop').text(berocket_wizard_autoselect.stop_text);
396
  BeRocket_current_autoselector_block = jQuery(this).parents('.berocket_wizard_autoselectors');
397
  BeRocket_init_autoselectors();
398
  jQuery.get(berocket_wizard_autoselect.ajaxurl, {action:"berocket_wizard_selector_start"}, function(url) {
399
+ if( BeRocket_autoselector_stop ) {
400
+ berocket_wizard_autoselector(false);
401
+ return;
402
+ }
403
  BeRocket_set_autoselector_load_position(45, berocket_wizard_autoselect.getting_selectors, 60);
404
  jQuery.get(url, function(data) {
405
+ if( BeRocket_autoselector_stop ) {
406
+ berocket_wizard_autoselector(false);
407
+ return;
408
+ }
409
  BeRocket_set_autoselector_load_position(60, berocket_wizard_autoselect.getting_selectors, 75);
410
  BeRocket_wizard_check(url, data, berocket_wizard_autoselector);
411
  }).error(function() {berocket_wizard_autoselector_end(berocket_wizard_autoselector_end_error);});
412
  }).error(function() {berocket_wizard_autoselector_end(berocket_wizard_autoselector_end_error);});
413
  });
414
+ jQuery(document).on('click', '.berocket_autoselector_stop', function(event) {
415
+ event.preventDefault();
416
+ BeRocket_autoselector_stop = true;
417
+ jQuery('.berocket_autoselector_stop').text(berocket_wizard_autoselect.stopping_text);
418
+ if( jQuery('.berocket_selectors_was_runned').length ) {
419
+ jQuery('.berocket_selectors_was_runned').remove();
420
+ berocket_wizard_autoselector(false);
421
+ }
422
+ });
423
  function BeRocket_set_autoselector_load_position(position, position_name, next_position) {
424
+ if( jQuery('.berocket_wizard_autoselectors ol li .fa-spin').length ) {
425
+ jQuery('.berocket_wizard_autoselectors ol li .fa-spin').removeClass('fa-spinner').addClass('fa-check').removeClass('fa-spin');
426
+ }
427
+ if( position_name ) {
428
+ jQuery('.berocket_wizard_autoselectors ol li span:contains('+position_name+')').parent().find('.fa').addClass('fa-spinner').addClass('fa-spin');
429
+ }
430
  var functions = BeRocket_current_autoselector_block.data('functions');
431
+ if( typeof(functions) != 'undefined' && functions.percent != '' && typeof window[functions.percent] == 'function' ) {
432
  window[functions.percent](position, position_name, next_position);
433
  }
434
  var $block = jQuery(BeRocket_current_autoselector_block);
443
  function BeRocket_init_autoselectors() {
444
  var $block = jQuery(BeRocket_current_autoselector_block);
445
  jQuery('.berocket_wizard_autoselectors .berocket_autoselector').prop('disabled', true);
446
+ $block.find('ol li .fa').removeClass('fa-spin').removeClass('fa-check').removeClass('fa-spinner').removeClass('fa-times');
447
+ $block.find('ol').show();
448
  BeRocket_set_autoselector_load_position(0, berocket_wizard_autoselect.creating_products, 45);
449
  $block.find('.berocket_autoselector_load .berocket_line').css('background-color', '');
450
  $block.find('.berocket_autoselector_load').show();
459
  }
460
  }
461
  function berocket_wizard_autoselector(status) {
462
+ jQuery('.berocket_autoselector_stop').text(berocket_wizard_autoselect.stop_text);
463
  if( status ) {
464
  //SELECTORS READY TO USE
465
  var inputs = BeRocket_current_autoselector_block.data('inputs');
488
  });
489
  }
490
  function berocket_wizard_autoselector_end_success() {
491
+ var functions = BeRocket_current_autoselector_block.data('functions');
492
+ if( functions.any != '' && typeof window[functions.any] == 'function' ) {
493
+ window[functions.any]();
494
+ }
495
+ if( functions.success != '' && typeof window[functions.success] == 'function' ) {
496
+ window[functions.success]();
497
+ }
498
+ jQuery('.berocket_autoselector').prop('disabled', false);
499
+ BeRocket_set_autoselector_load_position(100, '');
500
+ jQuery('.berocket_autoselect_spin').hide();
501
+ jQuery('.berocket_autoselect_ready').show();
502
  }
503
  function berocket_wizard_autoselector_end_error() {
504
+ var functions = BeRocket_current_autoselector_block.data('functions');
505
+ if( typeof(functions) != 'undefined' && functions.any != '' && typeof window[functions.any] == 'function' ) {
506
+ window[functions.any]();
507
+ }
508
+ if( typeof(functions) != 'undefined' && functions.error != '' && typeof window[functions.error] == 'function' ) {
509
+ window[functions.error]();
510
+ }
511
+ jQuery('.berocket_autoselector').prop('disabled', false);
512
+ BeRocket_set_autoselector_load_position(100);
513
+ jQuery('.berocket_autoselector_load .berocket_autoselector_action').text('Error: '+$('.berocket_autoselector_load .berocket_autoselector_action').text());
514
+ jQuery('.berocket_autoselect_spin').hide();
515
+ jQuery('.berocket_autoselector_load .berocket_line').css('background-color', '#bb3333');
516
+ jQuery('.berocket_autoselect_error').show();
517
+ if( jQuery('.berocket_wizard_autoselectors ol li .fa-check').length ) {
518
+ jQuery('.berocket_wizard_autoselectors ol li .fa-check').last().removeClass('fa-spinner').addClass('fa-times').removeClass('fa-spin').removeClass('fa-check');
519
+ }
520
  }
woocommerce-filters.php CHANGED
@@ -3,16 +3,16 @@
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.6
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: http://berocket.com
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
- * WC tested up to: 3.4.3
13
  */
14
 
15
- define( "BeRocket_AJAX_filters_version", '1.2.6' );
16
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
17
 
18
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
@@ -22,6 +22,7 @@ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
22
 
23
  require_once dirname( __FILE__ ) . '/includes/admin_notices.php';
24
  require_once dirname( __FILE__ ) . '/includes/widget.php';
 
25
  require_once dirname( __FILE__ ) . '/includes/functions.php';
26
  require_once dirname( __FILE__ ) . '/includes/wizard.php';
27
  require_once dirname( __FILE__ ) . '/wizard/main.php';
@@ -79,12 +80,14 @@ class BeRocket_AAPF {
79
  'settings_name' => '',
80
  'option_page' => 'br-product-filters',
81
  'premium_slug' => 'woocommerce-ajax-products-filter',
 
82
  );
83
 
84
  function __construct(){
85
  register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
86
  register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
87
  add_filter( 'BeRocket_updater_add_plugin', array( __CLASS__, 'updater_info' ) );
 
88
 
89
  if ( ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) && br_get_woocommerce_version() >= 2.1 ) {
90
  $last_version = get_option('br_filters_version');
@@ -128,6 +131,18 @@ class BeRocket_AAPF {
128
  add_filter('berocket_admin_notices_subscribe_plugins', array(__CLASS__, 'admin_notices_subscribe_plugins'));
129
  }
130
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  public static function updater_info ( $plugins ) {
132
  self::$info['slug'] = basename( __DIR__ );
133
  self::$info['plugin'] = plugin_basename( __FILE__ );
@@ -239,7 +254,10 @@ class BeRocket_AAPF {
239
  }
240
 
241
  public static function br_add_options_page() {
242
- add_submenu_page( 'woocommerce', __( 'Product Filters Settings', 'BeRocket_AJAX_domain' ), __( 'Product Filters', 'BeRocket_AJAX_domain' ), 'manage_options', 'br-product-filters', array( __CLASS__, 'br_render_form' ) );
 
 
 
243
  }
244
 
245
  public static function shortcode( $atts = array() ) {
@@ -280,9 +298,9 @@ class BeRocket_AAPF {
280
  wp_enqueue_script( 'berocket_aapf_widget-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
281
 
282
  wp_register_style( 'berocket_aapf_widget-colorpicker-style', plugins_url( 'css/colpick.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
283
- wp_register_style( 'berocket_aapf_widget-admin-style', plugins_url( 'css/admin.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
284
  wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
285
- wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
286
 
287
  $plugin_info = get_plugin_data(__FILE__, false, true);
288
  $paid_plugin_info = self::$info;
@@ -514,6 +532,8 @@ class BeRocket_AAPF {
514
  }
515
 
516
  public static function register_br_options() {
 
 
517
  register_setting( 'br_filters_plugin_options', 'br_filters_options' );
518
  }
519
 
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.7
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: http://berocket.com
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
+ * WC tested up to: 3.4.5
13
  */
14
 
15
+ define( "BeRocket_AJAX_filters_version", '1.2.7' );
16
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
17
 
18
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
22
 
23
  require_once dirname( __FILE__ ) . '/includes/admin_notices.php';
24
  require_once dirname( __FILE__ ) . '/includes/widget.php';
25
+ require_once dirname( __FILE__ ) . '/includes/updater.php';
26
  require_once dirname( __FILE__ ) . '/includes/functions.php';
27
  require_once dirname( __FILE__ ) . '/includes/wizard.php';
28
  require_once dirname( __FILE__ ) . '/wizard/main.php';
80
  'settings_name' => '',
81
  'option_page' => 'br-product-filters',
82
  'premium_slug' => 'woocommerce-ajax-products-filter',
83
+ 'free_slug' => 'woocommerce-ajax-filters',
84
  );
85
 
86
  function __construct(){
87
  register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
88
  register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
89
  add_filter( 'BeRocket_updater_add_plugin', array( __CLASS__, 'updater_info' ) );
90
+ add_filter( 'berocket_admin_notices_rate_stars_plugins', array( __CLASS__, 'rate_stars_plugins' ) );
91
 
92
  if ( ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) && br_get_woocommerce_version() >= 2.1 ) {
93
  $last_version = get_option('br_filters_version');
131
  add_filter('berocket_admin_notices_subscribe_plugins', array(__CLASS__, 'admin_notices_subscribe_plugins'));
132
  }
133
 
134
+ public static function rate_stars_plugins($plugins) {
135
+ $info = get_plugin_data( __FILE__ );
136
+ self::$info['name'] = $info['Name'];
137
+ $plugin = array(
138
+ 'id' => self::$info['id'],
139
+ 'name' => self::$info['name'],
140
+ 'free_slug' => self::$values['free_slug'],
141
+ );
142
+ $plugins[self::$info['id']] = $plugin;
143
+ return $plugins;
144
+ }
145
+
146
  public static function updater_info ( $plugins ) {
147
  self::$info['slug'] = basename( __DIR__ );
148
  self::$info['plugin'] = plugin_basename( __FILE__ );
254
  }
255
 
256
  public static function br_add_options_page() {
257
+ add_submenu_page( 'berocket_account', __( 'Product Filters Settings', 'BeRocket_AJAX_domain' ), __( 'Product Filter', 'BeRocket_AJAX_domain' ), 'manage_options', 'br-product-filters', array(
258
+ __CLASS__,
259
+ 'br_render_form'
260
+ ) );
261
  }
262
 
263
  public static function shortcode( $atts = array() ) {
298
  wp_enqueue_script( 'berocket_aapf_widget-admin', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
299
 
300
  wp_register_style( 'berocket_aapf_widget-colorpicker-style', plugins_url( 'css/colpick.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
301
+ wp_register_style( 'font-awesome', plugins_url( 'css/font-awesome.min.css', __FILE__ ) );
302
  wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
303
+ wp_enqueue_style( 'font-awesome' );
304
 
305
  $plugin_info = get_plugin_data(__FILE__, false, true);
306
  $paid_plugin_info = self::$info;
532
  }
533
 
534
  public static function register_br_options() {
535
+ wp_register_style( 'berocket_aapf_widget-admin-style', plugins_url( 'css/admin.css', __FILE__ ), array(), BeRocket_AJAX_filters_version );
536
+ wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
537
  register_setting( 'br_filters_plugin_options', 'br_filters_options' );
538
  }
539