Contact Form by BestWebSoft - Version 4.1.9

Version Description

  • 03.06.2020 =
  • Bugfix : We fixed the bug with Multi Attachment.
  • Bugfix : We fixed the bug with Captcha by BestWebSoft.
  • Bugfix : We fixed the bug with submit button on rtl sites.
  • Update : All functionality was updated for WordPress 5.4.1.
  • Update : BWS Panel section was updated.
Download this release

Release Info

Developer bestwebsoft
Plugin Icon 128x128 Contact Form by BestWebSoft
Version 4.1.9
Comparing to
See all releases

Code changes from version 4.1.8 to 4.1.9

bws_menu/bws_functions.php CHANGED
@@ -179,7 +179,55 @@ if ( ! function_exists ( 'bws_plugin_update_row' ) ) {
179
 
180
  if ( ! function_exists( 'bws_admin_notices' ) ) {
181
  function bws_admin_notices() {
182
- global $bws_versions_notice_array, $bws_plugin_banner_to_settings, $bstwbsftwppdtplgns_options;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  /* versions notice */
185
  if ( ! empty( $bws_versions_notice_array ) ) {
@@ -285,111 +333,51 @@ if ( ! function_exists( 'bws_admin_notices' ) ) {
285
  }
286
  }
287
 
288
- if ( ! function_exists( 'bws_plugin_banner' ) ) {
289
- function bws_plugin_banner( $plugin_info, $this_banner_prefix, $link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
290
- global $wp_version, $bstwbsftwppdtplgns_cookie_add, $bstwbsftwppdtplgns_banner_array;
291
 
292
- if ( empty( $bstwbsftwppdtplgns_banner_array ) ) {
293
- if ( ! function_exists( 'bws_get_banner_array' ) )
294
- require_once( dirname( __FILE__ ) . '/bws_menu.php' );
295
- bws_get_banner_array();
296
- }
297
 
298
  if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
299
- $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-128x128.png';
300
  }
301
 
302
- if ( ! function_exists( 'is_plugin_active' ) )
303
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
304
-
305
- $all_plugins = get_plugins();
306
-
307
- $this_banner = $this_banner_prefix . '_hide_banner_on_plugin_page';
308
- foreach ( $bstwbsftwppdtplgns_banner_array as $key => $value ) {
309
- if ( $this_banner == $value[0] ) {
310
- if ( ! isset( $bstwbsftwppdtplgns_cookie_add ) ) {
311
- echo '<script type="text/javascript" src="' . bws_menu_url( 'js/c_o_o_k_i_e.js' ) . '"></script>';
312
- $bstwbsftwppdtplgns_cookie_add = true;
313
- } ?>
314
- <script type="text/javascript">
315
- (function($) {
316
- $(document).ready( function() {
317
- var hide_message = $.cookie( '<?php echo $this_banner_prefix; ?>_hide_banner_on_plugin_page' );
318
- if ( hide_message == "true" ) {
319
- $( ".<?php echo $this_banner_prefix; ?>_message" ).css( "display", "none" );
320
- } else {
321
- $( ".<?php echo $this_banner_prefix; ?>_message" ).css( "display", "block" );
322
- };
323
- $( ".<?php echo $this_banner_prefix; ?>_close_icon" ).click( function() {
324
- $( ".<?php echo $this_banner_prefix; ?>_message" ).css( "display", "none" );
325
- $.cookie( "<?php echo $this_banner_prefix; ?>_hide_banner_on_plugin_page", "true", { expires: 32 } );
326
- });
327
- });
328
- })(jQuery);
329
- </script>
330
- <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
331
- <div class="<?php echo $this_banner_prefix; ?>_message bws_banner_on_plugin_page bws_go_pro_banner" style="display: none;">
332
- <button class="<?php echo $this_banner_prefix; ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button>
333
- <div class="icon">
334
- <img title="" src="<?php echo esc_attr( $banner_url_or_slug ); ?>" alt="" />
335
- </div>
336
- <div class="text">
337
- <?php _e( 'It’s time to upgrade your', 'bestwebsoft' ); ?> <strong><?php echo $plugin_info['Name']; ?> plugin</strong> <?php _e( 'to', 'bestwebsoft' ); ?> <strong>Pro</strong> <?php _e( 'version!', 'bestwebsoft' ); ?><br />
338
- <span><?php _e( 'Extend standard plugin functionality with new great options.', 'bestwebsoft' ); ?></span>
339
- </div>
340
- <div class="button_div">
341
- <a class="button" target="_blank" href="<?php echo esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $link_slug . '/?k=' . $link_key . '&pn=' . $link_pn . '&v=' . $plugin_info["Version"] . '&wp_v=' . $wp_version ); ?>"><?php _e( 'Learn More', 'bestwebsoft' ); ?></a>
342
- </div>
343
- </div>
344
- </div>
345
- <?php break;
346
- }
347
- if ( isset( $all_plugins[ $value[1] ] ) && $all_plugins[ $value[1] ]["Version"] >= $value[2] && is_plugin_active( $value[1] ) && ! isset( $_COOKIE[ $value[0] ] ) ) {
348
- break;
349
- }
350
  }
351
  }
352
  }
353
 
354
- if ( ! function_exists ( 'bws_plugin_banner_timeout' ) ) {
355
- function bws_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug = false ) {
356
- global $bstwbsftwppdtplgns_options, $bstwbsftwppdtplgns_cookie_add;
357
- if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( date("m/d/Y") . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( date("m/d/Y") ) ) ) {
 
358
 
359
- if ( $banner_url_or_slug && false == strrpos( $banner_url_or_slug, '/' ) ) {
360
- $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-128x128.png';
361
  }
362
 
363
- if ( ! isset( $bstwbsftwppdtplgns_cookie_add ) ) {
364
- echo '<script type="text/javascript" src="' . bws_menu_url( 'js/c_o_o_k_i_e.js' ) . '"></script>';
365
- $bstwbsftwppdtplgns_cookie_add = true;
366
- } ?>
367
- <script type="text/javascript">
368
- (function($) {
369
- $(document).ready( function() {
370
- var hide_message = $.cookie( "<?php echo $plugin_prefix; ?>_timeout_hide_banner_on_plugin_page" );
371
- if ( hide_message == "true" ) {
372
- $( ".<?php echo $plugin_prefix; ?>_message_timeout" ).css( "display", "none" );
373
- } else {
374
- $( ".<?php echo $plugin_prefix; ?>_message_timeout" ).css( "display", "block" );
375
- }
376
- $( ".<?php echo $plugin_prefix; ?>_close_icon" ).click( function() {
377
- $( ".<?php echo $plugin_prefix; ?>_message_timeout" ).css( "display", "none" );
378
- $.cookie( "<?php echo $plugin_prefix; ?>_timeout_hide_banner_on_plugin_page", "true", { expires: 30 } );
379
- });
380
- });
381
- })(jQuery);
382
- </script>
383
- <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
384
- <div class="<?php echo $plugin_prefix; ?>_message_timeout bws_banner_on_plugin_page bws_banner_timeout" style="display:none;">
385
- <button class="<?php echo $plugin_prefix; ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button>
386
- <div class="icon">
387
- <img title="" src="<?php echo esc_attr( $banner_url_or_slug ); ?>" alt="" />
388
- </div>
389
- <div class="text"><?php printf( __( "Your license key for %s expires on %s and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ), '<strong>' . $plugin_name . '</strong>', $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ); ?> <a target="_new" href="https://support.bestwebsoft.com/entries/53487136"><?php _e( "Learn more", 'bestwebsoft' ); ?></a></div>
390
- </div>
391
- </div>
392
- <?php }
393
  }
394
  }
395
 
@@ -414,7 +402,7 @@ if ( ! function_exists( 'bws_plugin_banner_to_settings' ) ) {
414
  }
415
 
416
  if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
417
- $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-128x128.png';
418
  }
419
 
420
  $bws_plugin_banner_to_settings[] = array(
@@ -471,7 +459,7 @@ if ( ! function_exists( 'bws_plugin_suggest_feature_banner' ) ) {
471
  }
472
 
473
  if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
474
- $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-128x128.png';
475
  } ?>
476
  <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
477
  <div class="bws_banner_on_plugin_page bws_suggest_feature_banner">
@@ -555,8 +543,8 @@ if ( ! function_exists ( 'bws_plugins_admin_init' ) ) {
555
  * @deprecated 1.9.8 (15.12.2016)
556
  */
557
  $is_main_page = in_array( $_GET['page'], array( 'bws_panel', 'bws_themes', 'bws_system_status' ) );
558
- $page = esc_attr( $_GET['page'] );
559
- $tab = isset( $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : '';
560
 
561
  if ( $is_main_page )
562
  $current_page = 'admin.php?page=' . $page;
@@ -564,7 +552,7 @@ if ( ! function_exists ( 'bws_plugins_admin_init' ) ) {
564
  $current_page = isset( $_GET['tab'] ) ? 'admin.php?page=' . $page . '&tab=' . $tab : 'admin.php?page=' . $page;
565
  /*end deprecated */
566
 
567
- wp_redirect( self_admin_url( $current_page . '&activate=true' ) );
568
  exit();
569
  }
570
 
@@ -579,7 +567,10 @@ if ( ! function_exists ( 'bws_plugins_admin_init' ) ) {
579
 
580
  if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) ) {
581
  function bws_admin_enqueue_scripts() {
582
- global $wp_scripts, $hook_suffix;
 
 
 
583
 
584
  $jquery_ui_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.12.1';
585
  wp_enqueue_style( 'jquery-ui-style', bws_menu_url( 'css/jquery-ui-styles/' . $jquery_ui_version . '/jquery-ui.css' ) );
@@ -594,8 +585,105 @@ if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) ) {
594
  wp_enqueue_script( 'plugin-install' );
595
  }
596
 
597
- if ( 'plugins.php' == $hook_suffix && ! defined( 'DOING_AJAX' ) ) {
598
- wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  }
600
  }
601
  }
@@ -614,7 +702,6 @@ if ( ! function_exists( 'bws_enqueue_settings_scripts' ) ) {
614
 
615
  if ( ! function_exists ( 'bws_plugins_admin_head' ) ) {
616
  function bws_plugins_admin_head() {
617
- global $bws_shortcode_list, $wp_version, $post_type;
618
  if ( isset( $_GET['page'] ) && $_GET['page'] == "bws_panel" ) { ?>
619
  <noscript>
620
  <style type="text/css">
@@ -624,81 +711,21 @@ if ( ! function_exists ( 'bws_plugins_admin_head' ) ) {
624
  </style>
625
  </noscript>
626
  <?php }
627
- if ( 4.2 > $wp_version ) { ?>
628
- <style type="text/css">
629
- .bws_hide_settings_notice,
630
- .bws_hide_premium_options {
631
- width: 11px;
632
- height: 11px;
633
- border: none;
634
- background: url("<?php echo bws_menu_url( 'images/close_banner.png' ); ?>") no-repeat center center;
635
- box-shadow: none;
636
- float: right;
637
- margin: 8px;
638
- }
639
- .bws_hide_settings_notice:hover,
640
- .bws_hide_premium_options:hover {
641
- cursor: pointer;
642
- }
643
- .bws_hide_premium_options {
644
- position: relative;
645
- }
646
- </style>
647
- <?php }
648
- if ( ! empty( $bws_shortcode_list ) ) { ?>
649
- <!-- TinyMCE Shortcode Plugin -->
650
- <script type='text/javascript'>
651
- var bws_shortcode_button = {
652
- 'label': '<?php esc_attr_e( "Add BWS Shortcode", "bestwebsoft" ); ?>',
653
- 'title': '<?php esc_attr_e( "Add BWS Plugins Shortcode", "bestwebsoft" ); ?>',
654
- 'function_name': [
655
- <?php foreach ( $bws_shortcode_list as $key => $value ) {
656
- if ( isset( $value['js_function'] ) )
657
- echo "'" . $value['js_function'] . "',";
658
- } ?>
659
- ],
660
- 'wp_version' : '<?php echo $wp_version; ?>'
661
- };
662
- </script>
663
- <!-- TinyMCE Shortcode Plugin -->
664
- <?php if ( isset( $post_type ) && in_array( $post_type, array( 'post', 'page' ) ) ) {
665
- $tooltip_args = array(
666
- 'tooltip_id' => 'bws_shortcode_button_tooltip',
667
- 'css_selector' => '.mce-bws_shortcode_button',
668
- 'actions' => array(
669
- 'click' => false,
670
- 'onload' => true
671
- ),
672
- 'content' => '<h3>' . __( 'Add shortcode', 'bestwebsoft' ) . '</h3><p>' . __( "Add BestWebSoft plugins' shortcodes using this button.", 'bestwebsoft' ) . '</p>',
673
- 'position' => array(
674
- 'edge' => 'right'
675
- ),
676
- 'set_timeout' => 2000
677
- );
678
- bws_add_tooltip_in_admin( $tooltip_args );
679
- }
680
- }
681
  }
682
  }
683
 
684
  if ( ! function_exists ( 'bws_plugins_admin_footer' ) ) {
685
  function bws_plugins_admin_footer() {
686
- global $hook_suffix;
687
-
688
  bws_shortcode_media_button_popup();
689
-
690
- if ( 'plugins.php' == $hook_suffix && ! defined( 'DOING_AJAX' ) ) {
691
- bws_add_deactivation_feedback_dialog_box();
692
- }
693
  }
694
  }
695
 
696
  if ( ! function_exists ( 'bws_plugins_include_codemirror' ) ) {
697
  function bws_plugins_include_codemirror() {
698
  global $wp_version;
699
- if ( version_compare( $wp_version,'4.9.0', '>=' ) ) {
700
- wp_enqueue_style('wp-codemirror');
701
- wp_enqueue_script('wp-codemirror');
702
  } else {
703
  wp_enqueue_style( 'codemirror.css', bws_menu_url( 'css/codemirror.css' ) );
704
  wp_enqueue_script( 'codemirror.js', bws_menu_url( 'js/codemirror.js' ), array( 'jquery' ) );
@@ -721,6 +748,8 @@ if ( ! class_exists( 'BWS_admin_tooltip' ) ) {
721
  private $tooltip_args;
722
 
723
  public function __construct( $tooltip_args ) {
 
 
724
  /* Default arguments */
725
  $tooltip_args_default = array(
726
  'tooltip_id' => false,
@@ -797,27 +826,21 @@ if ( ! class_exists( 'BWS_admin_tooltip' ) ) {
797
  wp_enqueue_style( 'wp-pointer' );
798
  wp_enqueue_script( 'wp-pointer' );
799
  /* add script that displays our tooltip */
800
- add_action( 'admin_print_footer_scripts', array( $this, 'add_scripts' ) );
801
- }
802
-
803
- /**
804
- * Display tooltip
805
- */
806
- public function add_scripts() {
807
- global $bstwbsftwppdtplgns_tooltip_script_add;
808
  if ( ! isset( $bstwbsftwppdtplgns_tooltip_script_add ) ) {
809
- echo '<script type="text/javascript" src="' . bws_menu_url( 'js/bws_tooltip.js' ) . '"></script>';
810
  $bstwbsftwppdtplgns_tooltip_script_add = true;
811
  }
812
- $tooltip_args = $this->tooltip_args; ?>
813
- <script type="text/javascript">
814
- (function($) {
815
  $(document).ready( function() {
816
- $.bwsTooltip( <?php echo json_encode( $tooltip_args ); ?> );
817
  })
818
- })(jQuery);
819
- </script>
820
- <?php }
 
 
821
  }
822
  }
823
 
@@ -864,7 +887,7 @@ if ( ! function_exists( 'bws_register_buttons' ) ) {
864
  /* Generate inline content for the popup window when the "bws shortcode" button is clicked */
865
  if ( ! function_exists( 'bws_shortcode_media_button_popup' ) ) {
866
  function bws_shortcode_media_button_popup() {
867
- global $bws_shortcode_list, $wp_version;
868
 
869
  if ( ! empty( $bws_shortcode_list ) ) { ?>
870
  <div id="bws_shortcode_popup" style="display:none;">
@@ -935,7 +958,7 @@ if ( ! function_exists( 'bws_help_tab' ) ) {
935
  $screen->set_help_sidebar(
936
  '<p><strong>' . __( 'For more information:', 'bestwebsoft' ) . '</strong></p>' .
937
  '<p><a href="https://drive.google.com/folderview?id=0B5l8lO-CaKt9VGh0a09vUjNFNjA&usp=sharing#list" target="_blank">' . __( 'Documentation', 'bestwebsoft' ) . '</a></p>' .
938
- '<p><a href="http://www.youtube.com/user/bestwebsoft/playlists?flow=grid&sort=da&view=1" target="_blank">' . __( 'Video Instructions', 'bestwebsoft' ) . '</a></p>' .
939
  '<p><a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . __( 'Submit a Request', 'bestwebsoft' ) . '</a></p>'
940
  );
941
  }
@@ -1072,4 +1095,4 @@ add_action( 'admin_notices', 'bws_admin_notices', 30 );
1072
 
1073
  add_action( 'wp_enqueue_scripts', 'bws_enqueue_custom_code_css_js', 20 );
1074
 
1075
- bws_enqueue_custom_code_php();
179
 
180
  if ( ! function_exists( 'bws_admin_notices' ) ) {
181
  function bws_admin_notices() {
182
+ global $bws_versions_notice_array, $bws_plugin_banner_to_settings, $bstwbsftwppdtplgns_options, $bws_plugin_banner_go_pro, $bstwbsftwppdtplgns_banner_array, $bws_plugin_banner_timeout;
183
+
184
+ /* bws_plugin_banner_go_pro */
185
+ if ( ! empty( $bws_plugin_banner_go_pro ) ) {
186
+ /* get $bws_plugins */
187
+ require( dirname( __FILE__ ) . '/product_list.php' );
188
+
189
+ foreach ( $bstwbsftwppdtplgns_banner_array as $value ) {
190
+ if ( isset( $bws_plugin_banner_go_pro[ $value[0] ] ) && ! isset( $_COOKIE[ $value[0] ] ) ) {
191
+
192
+ if ( isset( $bws_plugins[ $value[1] ]['pro_version'] ) && is_plugin_active( $bws_plugins[ $value[1] ]['pro_version'] ) ) {
193
+ continue;
194
+ }
195
+
196
+ $single_banner_value = $bws_plugin_banner_go_pro[ $value[0] ]; ?>
197
+ <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
198
+ <div class="<?php echo $single_banner_value['prefix']; ?>_message bws_banner_on_plugin_page bws_go_pro_banner" style="display: none;">
199
+ <button class="<?php echo $single_banner_value['prefix']; ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button>
200
+ <div class="icon">
201
+ <img title="" src="<?php echo esc_attr( $single_banner_value['banner_url'] ); ?>" alt="" />
202
+ </div>
203
+ <div class="text">
204
+ <?php _e( 'It’s time to upgrade your', 'bestwebsoft' ); ?> <strong><?php echo $single_banner_value['plugin_info']['Name']; ?> plugin</strong> <?php _e( 'to', 'bestwebsoft' ); ?> <strong>Pro</strong> <?php _e( 'version!', 'bestwebsoft' ); ?><br />
205
+ <span><?php _e( 'Extend standard plugin functionality with new great options.', 'bestwebsoft' ); ?></span>
206
+ </div>
207
+ <div class="button_div">
208
+ <a class="button" target="_blank" href="<?php echo $single_banner_value['bws_link']; ?>"><?php _e( 'Learn More', 'bestwebsoft' ); ?></a>
209
+ </div>
210
+ </div>
211
+ </div>
212
+ <?php break;
213
+ }
214
+ }
215
+ }
216
+
217
+ /* $bws_plugin_banner_timeout */
218
+ if ( ! empty( $bws_plugin_banner_timeout ) ) {
219
+ foreach ( $bws_plugin_banner_timeout as $banner_value ) { ?>
220
+ <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
221
+ <div class="<?php echo $banner_value['prefix']; ?>_message_timeout bws_banner_on_plugin_page bws_banner_timeout" style="display:none;">
222
+ <button class="<?php echo $banner_value['prefix']; ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php _e( 'Close notice', 'bestwebsoft' ); ?>"></button>
223
+ <div class="icon">
224
+ <img title="" src="<?php echo esc_attr( $banner_value['banner_url'] ); ?>" alt="" />
225
+ </div>
226
+ <div class="text"><?php printf( __( "Your license key for %s expires on %s and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ), '<strong>' . $banner_value['plugin_name'] . '</strong>', $bstwbsftwppdtplgns_options['time_out'][ $banner_value['plugin_key'] ] ); ?> <a target="_new" href="https://support.bestwebsoft.com/entries/53487136"><?php _e( "Learn more", 'bestwebsoft' ); ?></a></div>
227
+ </div>
228
+ </div>
229
+ <?php }
230
+ }
231
 
232
  /* versions notice */
233
  if ( ! empty( $bws_versions_notice_array ) ) {
333
  }
334
  }
335
 
336
+ if ( ! function_exists( 'bws_plugin_banner_go_pro' ) ) {
337
+ function bws_plugin_banner_go_pro( $plugin_options, $plugin_info, $this_banner_prefix, $bws_link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
338
+ global $bws_plugin_banner_go_pro, $wp_version, $bstwbsftwppdtplgns_banner_array;
339
 
340
+ if ( ! isset( $plugin_options['first_install'] ) || strtotime( '-1 week' ) < $plugin_options['first_install'] )
341
+ return;
342
+
343
+ $bws_link = esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $bws_link_slug . '/?k=' . $link_key . '&pn=' . $link_pn . '&v=' . $plugin_info["Version"] . '&wp_v=' . $wp_version );
 
344
 
345
  if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
346
+ $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png';
347
  }
348
 
349
+ $bws_plugin_banner_go_pro[ $this_banner_prefix . '_hide_banner_on_plugin_page' ] = array(
350
+ 'plugin_info' => $plugin_info,
351
+ 'prefix' => $this_banner_prefix,
352
+ 'bws_link' => $bws_link,
353
+ 'banner_url' => $banner_url_or_slug
354
+ );
355
+
356
+ if ( empty( $bstwbsftwppdtplgns_banner_array ) ) {
357
+ if ( ! function_exists( 'bws_get_banner_array' ) )
358
+ require_once( dirname( __FILE__ ) . '/bws_menu.php' );
359
+ bws_get_banner_array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  }
361
  }
362
  }
363
 
364
+ if ( ! function_exists( 'bws_add_plugin_banner_timeout' ) ) {
365
+ function bws_add_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug ) {
366
+ global $bws_plugin_banner_timeout;
367
+
368
+ if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( date("m/d/Y") . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( date("m/d/Y") ) ) ) {
369
 
370
+ if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
371
+ $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png';
372
  }
373
 
374
+ $bws_plugin_banner_timeout[] = array(
375
+ 'plugin_key' => $plugin_key,
376
+ 'prefix' => $plugin_prefix,
377
+ 'plugin_name' => $plugin_name,
378
+ 'banner_url' => $banner_url_or_slug
379
+ );
380
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  }
382
  }
383
 
402
  }
403
 
404
  if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
405
+ $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png';
406
  }
407
 
408
  $bws_plugin_banner_to_settings[] = array(
459
  }
460
 
461
  if ( false == strrpos( $banner_url_or_slug, '/' ) ) {
462
+ $banner_url_or_slug = '//ps.w.org/' . $banner_url_or_slug . '/assets/icon-256x256.png';
463
  } ?>
464
  <div class="updated" style="padding: 0; margin: 0; border: none; background: none;">
465
  <div class="bws_banner_on_plugin_page bws_suggest_feature_banner">
543
  * @deprecated 1.9.8 (15.12.2016)
544
  */
545
  $is_main_page = in_array( $_GET['page'], array( 'bws_panel', 'bws_themes', 'bws_system_status' ) );
546
+ $page = wp_unslash( $_GET['page'] );
547
+ $tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : '';
548
 
549
  if ( $is_main_page )
550
  $current_page = 'admin.php?page=' . $page;
552
  $current_page = isset( $_GET['tab'] ) ? 'admin.php?page=' . $page . '&tab=' . $tab : 'admin.php?page=' . $page;
553
  /*end deprecated */
554
 
555
+ wp_redirect( self_admin_url( esc_url( $current_page . '&activate=true' ) ) );
556
  exit();
557
  }
558
 
567
 
568
  if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) ) {
569
  function bws_admin_enqueue_scripts() {
570
+ global $wp_scripts, $hook_suffix,
571
+ $post_type,
572
+ $bws_plugin_banner_go_pro, $bws_plugin_banner_timeout, $bstwbsftwppdtplgns_banner_array,
573
+ $bws_shortcode_list;
574
 
575
  $jquery_ui_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.12.1';
576
  wp_enqueue_style( 'jquery-ui-style', bws_menu_url( 'css/jquery-ui-styles/' . $jquery_ui_version . '/jquery-ui.css' ) );
585
  wp_enqueue_script( 'plugin-install' );
586
  }
587
 
588
+ if ( 'plugins.php' == $hook_suffix ) {
589
+ if ( ! empty( $bws_plugin_banner_go_pro ) || ! empty( $bws_plugin_banner_timeout ) ) {
590
+ wp_enqueue_script( 'bws_menu_cookie', bws_menu_url( 'js/c_o_o_k_i_e.js' ) );
591
+
592
+ if ( ! empty( $bws_plugin_banner_go_pro ) ) {
593
+
594
+ foreach ( $bstwbsftwppdtplgns_banner_array as $value ) {
595
+ if ( isset( $bws_plugin_banner_go_pro[ $value[0] ] ) && ! isset( $_COOKIE[ $value[0] ] ) ) {
596
+ $prefix = $bws_plugin_banner_go_pro[ $value[0] ]['prefix'];
597
+
598
+ $script = "(function($) {
599
+ $(document).ready( function() {
600
+ var hide_message = $.cookie( '" . $prefix . "_hide_banner_on_plugin_page' );
601
+ if ( hide_message == 'true' ) {
602
+ $( '." . $prefix . "_message' ).css( 'display', 'none' );
603
+ } else {
604
+ $( '." . $prefix . "_message' ).css( 'display', 'block' );
605
+ };
606
+ $( '." . $prefix . "_close_icon' ).click( function() {
607
+ $( '." . $prefix . "_message' ).css( 'display', 'none' );
608
+ $.cookie( '" . $prefix . "_hide_banner_on_plugin_page', 'true', { expires: 32 } );
609
+ });
610
+ });
611
+ })(jQuery);";
612
+
613
+ wp_register_script( $prefix . '_hide_banner_on_plugin_page', '' );
614
+ wp_enqueue_script( $prefix . '_hide_banner_on_plugin_page' );
615
+ wp_add_inline_script( $prefix . '_hide_banner_on_plugin_page', sprintf( $script ) );
616
+ break;
617
+ }
618
+ }
619
+ }
620
+
621
+ if ( ! empty( $bws_plugin_banner_timeout ) ) {
622
+ $script = '(function($) {
623
+ $(document).ready( function() {';
624
+
625
+ foreach ( $bws_plugin_banner_timeout as $banner_value ) {
626
+ $script .= "var hide_message = $.cookie( '" . $banner_value['prefix'] . "_timeout_hide_banner_on_plugin_page' );
627
+ if ( hide_message == 'true' ) {
628
+ $( '." . $banner_value['prefix'] . "_message_timeout' ).css( 'display', 'none' );
629
+ } else {
630
+ $( '." . $banner_value['prefix'] . "_message_timeout' ).css( 'display', 'block' );
631
+ }
632
+ $( '." . $banner_value['prefix'] . "_close_icon' ).click( function() {
633
+ $( '." . $banner_value['prefix'] . "_message_timeout' ).css( 'display', 'none' );
634
+ $.cookie( '" . $banner_value['prefix'] . "_timeout_hide_banner_on_plugin_page', 'true', { expires: 30 } );
635
+ });";
636
+ }
637
+
638
+ $script .= "});
639
+ })(jQuery);";
640
+
641
+ wp_register_script( 'plugin_banner_timeout_hide', '' );
642
+ wp_enqueue_script( 'plugin_banner_timeout_hide' );
643
+ wp_add_inline_script( 'plugin_banner_timeout_hide', sprintf( $script ) );
644
+ }
645
+ }
646
+
647
+ if ( ! defined( 'DOING_AJAX' ) ) {
648
+ wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
649
+
650
+ bws_add_deactivation_feedback_dialog_box();
651
+ }
652
+ }
653
+
654
+ if ( ! empty( $bws_shortcode_list ) ) {
655
+ /* TinyMCE Shortcode Plugin */
656
+ $script = "var bws_shortcode_button = {
657
+ 'label': '" . esc_attr__( "Add BWS Shortcode", "bestwebsoft" ) . "',
658
+ 'title': '" . esc_attr__( "Add BWS Plugins Shortcode", "bestwebsoft" ) . "',
659
+ 'function_name': [";
660
+ foreach ( $bws_shortcode_list as $value ) {
661
+ if ( isset( $value['js_function'] ) )
662
+ $script .= "'" . $value['js_function'] . "',";
663
+ }
664
+ $script .= "]
665
+ };";
666
+ wp_register_script( 'bws_shortcode_button', '' );
667
+ wp_enqueue_script( 'bws_shortcode_button' );
668
+ wp_add_inline_script( 'bws_shortcode_button', sprintf( $script ) );
669
+
670
+ /* TinyMCE Shortcode Plugin */
671
+ if ( isset( $post_type ) && in_array( $post_type, array( 'post', 'page' ) ) ) {
672
+ $tooltip_args = array(
673
+ 'tooltip_id' => 'bws_shortcode_button_tooltip',
674
+ 'css_selector' => '.mce-bws_shortcode_button',
675
+ 'actions' => array(
676
+ 'click' => false,
677
+ 'onload' => true
678
+ ),
679
+ 'content' => '<h3>' . __( 'Add shortcode', 'bestwebsoft' ) . '</h3><p>' . __( "Add BestWebSoft plugins' shortcodes using this button.", 'bestwebsoft' ) . '</p>',
680
+ 'position' => array(
681
+ 'edge' => 'right'
682
+ ),
683
+ 'set_timeout' => 2000
684
+ );
685
+ bws_add_tooltip_in_admin( $tooltip_args );
686
+ }
687
  }
688
  }
689
  }
702
 
703
  if ( ! function_exists ( 'bws_plugins_admin_head' ) ) {
704
  function bws_plugins_admin_head() {
 
705
  if ( isset( $_GET['page'] ) && $_GET['page'] == "bws_panel" ) { ?>
706
  <noscript>
707
  <style type="text/css">
711
  </style>
712
  </noscript>
713
  <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
714
  }
715
  }
716
 
717
  if ( ! function_exists ( 'bws_plugins_admin_footer' ) ) {
718
  function bws_plugins_admin_footer() {
 
 
719
  bws_shortcode_media_button_popup();
 
 
 
 
720
  }
721
  }
722
 
723
  if ( ! function_exists ( 'bws_plugins_include_codemirror' ) ) {
724
  function bws_plugins_include_codemirror() {
725
  global $wp_version;
726
+ if ( version_compare( $wp_version, '4.9.0', '>=' ) ) {
727
+ wp_enqueue_style( 'wp-codemirror' );
728
+ wp_enqueue_script( 'wp-codemirror' );
729
  } else {
730
  wp_enqueue_style( 'codemirror.css', bws_menu_url( 'css/codemirror.css' ) );
731
  wp_enqueue_script( 'codemirror.js', bws_menu_url( 'js/codemirror.js' ), array( 'jquery' ) );
748
  private $tooltip_args;
749
 
750
  public function __construct( $tooltip_args ) {
751
+ global $bstwbsftwppdtplgns_tooltip_script_add;
752
+
753
  /* Default arguments */
754
  $tooltip_args_default = array(
755
  'tooltip_id' => false,
826
  wp_enqueue_style( 'wp-pointer' );
827
  wp_enqueue_script( 'wp-pointer' );
828
  /* add script that displays our tooltip */
 
 
 
 
 
 
 
 
829
  if ( ! isset( $bstwbsftwppdtplgns_tooltip_script_add ) ) {
830
+ wp_enqueue_script( 'bws-tooltip-script', bws_menu_url( 'js/bws_tooltip.js' ) );
831
  $bstwbsftwppdtplgns_tooltip_script_add = true;
832
  }
833
+ $tooltip_args = $this->tooltip_args;
834
+
835
+ $script = "(function($) {
836
  $(document).ready( function() {
837
+ $.bwsTooltip( " . json_encode( $tooltip_args ) . " );
838
  })
839
+ })(jQuery);";
840
+ wp_register_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'], '' );
841
+ wp_enqueue_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'] );
842
+ wp_add_inline_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'], sprintf( $script ) );
843
+ }
844
  }
845
  }
846
 
887
  /* Generate inline content for the popup window when the "bws shortcode" button is clicked */
888
  if ( ! function_exists( 'bws_shortcode_media_button_popup' ) ) {
889
  function bws_shortcode_media_button_popup() {
890
+ global $bws_shortcode_list;
891
 
892
  if ( ! empty( $bws_shortcode_list ) ) { ?>
893
  <div id="bws_shortcode_popup" style="display:none;">
958
  $screen->set_help_sidebar(
959
  '<p><strong>' . __( 'For more information:', 'bestwebsoft' ) . '</strong></p>' .
960
  '<p><a href="https://drive.google.com/folderview?id=0B5l8lO-CaKt9VGh0a09vUjNFNjA&usp=sharing#list" target="_blank">' . __( 'Documentation', 'bestwebsoft' ) . '</a></p>' .
961
+ '<p><a href="https://www.youtube.com/user/bestwebsoft/playlists?flow=grid&sort=da&view=1" target="_blank">' . __( 'Video Instructions', 'bestwebsoft' ) . '</a></p>' .
962
  '<p><a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . __( 'Submit a Request', 'bestwebsoft' ) . '</a></p>'
963
  );
964
  }
1095
 
1096
  add_action( 'wp_enqueue_scripts', 'bws_enqueue_custom_code_css_js', 20 );
1097
 
1098
+ bws_enqueue_custom_code_php();
bws_menu/bws_include.php CHANGED
@@ -3,7 +3,7 @@
3
  * Get latest version
4
  */
5
 
6
- if ( ! function_exists ( 'bws_include_init' ) ) {
7
  function bws_include_init( $base, $bws_menu_source = 'plugins' ) {
8
  global $bstwbsftwppdtplgns_options, $bstwbsftwppdtplgns_added_menu, $bstwbsftwppdtplgns_active_plugins;
9
  if ( ! function_exists( 'get_plugin_data' ) )
@@ -20,7 +20,9 @@ if ( ! function_exists ( 'bws_include_init' ) ) {
20
  }
21
 
22
  $bws_menu_info = get_plugin_data( $bws_menu_dir );
23
- $bws_menu_version = $bws_menu_info["Version"];
 
 
24
 
25
  if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
26
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
@@ -43,7 +45,8 @@ if ( ! function_exists ( 'bws_include_init' ) ) {
43
  update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
44
  require_once( dirname( __FILE__ ) . '/bws_menu.php' );
45
  require_once( dirname( __FILE__ ) . '/bws_functions.php' );
46
- } else if ( ! isset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] ) || $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] < $bws_menu_version ) {
 
47
  $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version;
48
  if ( function_exists( 'is_multisite' ) && is_multisite() )
49
  update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
@@ -51,25 +54,64 @@ if ( ! function_exists ( 'bws_include_init' ) ) {
51
  update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
52
  require_once( dirname( __FILE__ ) . '/bws_menu.php' );
53
  require_once( dirname( __FILE__ ) . '/bws_functions.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  } else if ( ! isset( $bstwbsftwppdtplgns_added_menu ) ) {
55
 
56
  $all_plugins = get_plugins();
57
  $all_themes = wp_get_themes();
58
 
59
- foreach ( $bstwbsftwppdtplgns_options['bws_menu']['version'] as $key => $value ) {
60
- if ( array_key_exists( $key, $all_plugins ) || array_key_exists( $key, $all_themes ) ) {
61
- if ( $bws_menu_version < $value && ( is_plugin_active( $key ) || preg_match( '|' . $key . '$|', get_template_directory() ) ) ) {
62
- if ( ! isset( $product_with_newer_menu ) )
63
- $product_with_newer_menu = $key;
64
- elseif ( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $product_with_newer_menu ] < $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] )
65
- $product_with_newer_menu = $key;
 
 
 
 
 
 
 
 
66
  }
 
 
 
 
 
 
67
  } else {
68
- unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] );
69
- if ( function_exists( 'is_multisite' ) && is_multisite() )
70
- update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
71
- else
72
- update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
  }
75
 
@@ -91,9 +133,11 @@ if ( ! function_exists ( 'bws_include_init' ) ) {
91
  if ( file_exists( $bws_menu_new_dir . '/bws_menu/bws_functions.php' ) ) {
92
  require_once( $bws_menu_new_dir . '/bws_menu/bws_functions.php' );
93
  require_once( $bws_menu_new_dir . '/bws_menu/bws_menu.php' );
 
94
  } else {
95
  require_once( dirname( __FILE__ ) . '/bws_menu.php' );
96
  require_once( dirname( __FILE__ ) . '/bws_functions.php' );
 
97
  }
98
 
99
  $bstwbsftwppdtplgns_added_menu = true;
3
  * Get latest version
4
  */
5
 
6
+ if ( ! function_exists( 'bws_include_init' ) ) {
7
  function bws_include_init( $base, $bws_menu_source = 'plugins' ) {
8
  global $bstwbsftwppdtplgns_options, $bstwbsftwppdtplgns_added_menu, $bstwbsftwppdtplgns_active_plugins;
9
  if ( ! function_exists( 'get_plugin_data' ) )
20
  }
21
 
22
  $bws_menu_info = get_plugin_data( $bws_menu_dir );
23
+
24
+ $is_pro_bws_menu = ( strpos( $bws_menu_info["Version"], 'pro' ) !== false );
25
+ $bws_menu_version = str_replace( '-pro', '', $bws_menu_info["Version"] );
26
 
27
  if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
28
  if ( function_exists( 'is_multisite' ) && is_multisite() ) {
45
  update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
46
  require_once( dirname( __FILE__ ) . '/bws_menu.php' );
47
  require_once( dirname( __FILE__ ) . '/bws_functions.php' );
48
+ require_once( dirname( __FILE__ ) . '/class-bws-settings.php' );
49
+ } else if ( ! $is_pro_bws_menu && ( ! isset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] ) || $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] != $bws_menu_version ) ) {
50
  $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] = $bws_menu_version;
51
  if ( function_exists( 'is_multisite' ) && is_multisite() )
52
  update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
54
  update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
55
  require_once( dirname( __FILE__ ) . '/bws_menu.php' );
56
  require_once( dirname( __FILE__ ) . '/bws_functions.php' );
57
+ require_once( dirname( __FILE__ ) . '/class-bws-settings.php' );
58
+ } else if ( $is_pro_bws_menu && ( ! isset( $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $base ] ) || $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $base ] != $bws_menu_version ) ) {
59
+ $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $base ] = $bws_menu_version;
60
+
61
+ if ( isset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] ) )
62
+ unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $base ] );
63
+
64
+ if ( function_exists( 'is_multisite' ) && is_multisite() )
65
+ update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
66
+ else
67
+ update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
68
+ require_once( dirname( __FILE__ ) . '/bws_menu.php' );
69
+ require_once( dirname( __FILE__ ) . '/bws_functions.php' );
70
+ require_once( dirname( __FILE__ ) . '/class-bws-settings.php' );
71
  } else if ( ! isset( $bstwbsftwppdtplgns_added_menu ) ) {
72
 
73
  $all_plugins = get_plugins();
74
  $all_themes = wp_get_themes();
75
 
76
+ if ( ! empty( $bstwbsftwppdtplgns_options['bws_menu']['version_pro'] ) ) {
77
+ foreach ( $bstwbsftwppdtplgns_options['bws_menu']['version_pro'] as $key => $value ) {
78
+ if ( array_key_exists( $key, $all_plugins ) || array_key_exists( $key, $all_themes ) ) {
79
+ if ( $bws_menu_version < $value && ( is_plugin_active( $key ) || preg_match( '|' . $key . '$|', get_template_directory() ) ) ) {
80
+ if ( ! isset( $product_with_newer_menu ) )
81
+ $product_with_newer_menu = $key;
82
+ elseif ( $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $product_with_newer_menu ] < $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $key ] )
83
+ $product_with_newer_menu = $key;
84
+ }
85
+ } else {
86
+ unset( $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $key ] );
87
+ if ( function_exists( 'is_multisite' ) && is_multisite() )
88
+ update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
89
+ else
90
+ update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
91
  }
92
+ }
93
+ }
94
+
95
+ if ( ! isset( $product_with_newer_menu ) ) {
96
+ if ( $is_pro_bws_menu ) {
97
+ $product_with_newer_menu = $base;
98
  } else {
99
+ foreach ( $bstwbsftwppdtplgns_options['bws_menu']['version'] as $key => $value ) {
100
+ if ( array_key_exists( $key, $all_plugins ) || array_key_exists( $key, $all_themes ) ) {
101
+ if ( $bws_menu_version < $value && ( is_plugin_active( $key ) || preg_match( '|' . $key . '$|', get_template_directory() ) ) ) {
102
+ if ( ! isset( $product_with_newer_menu ) )
103
+ $product_with_newer_menu = $key;
104
+ elseif ( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $product_with_newer_menu ] < $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] )
105
+ $product_with_newer_menu = $key;
106
+ }
107
+ } else {
108
+ unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] );
109
+ if ( function_exists( 'is_multisite' ) && is_multisite() )
110
+ update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
111
+ else
112
+ update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
113
+ }
114
+ }
115
  }
116
  }
117
 
133
  if ( file_exists( $bws_menu_new_dir . '/bws_menu/bws_functions.php' ) ) {
134
  require_once( $bws_menu_new_dir . '/bws_menu/bws_functions.php' );
135
  require_once( $bws_menu_new_dir . '/bws_menu/bws_menu.php' );
136
+ require_once( $bws_menu_new_dir . '/bws_menu/class-bws-settings.php' );
137
  } else {
138
  require_once( dirname( __FILE__ ) . '/bws_menu.php' );
139
  require_once( dirname( __FILE__ ) . '/bws_functions.php' );
140
+ require_once( dirname( __FILE__ ) . '/class-bws-settings.php' );
141
  }
142
 
143
  $bstwbsftwppdtplgns_added_menu = true;
bws_menu/bws_menu.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * Function for displaying BestWebSoft menu
4
- * Version: 2.2.2
5
  */
6
 
7
  if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) )
@@ -9,15 +9,15 @@ if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) )
9
 
10
  if ( ! function_exists( 'bws_add_menu_render' ) ) {
11
  function bws_add_menu_render() {
12
- global $wpdb, $wp_version, $bws_plugin_info, $bstwbsftwppdtplgns_options;
13
  $error = $message = '';
14
 
15
  /**
16
  * @deprecated 1.9.8 (15.12.2016)
17
  */
18
  $is_main_page = in_array( $_GET['page'], array( 'bws_panel', 'bws_themes', 'bws_system_status' ) );
19
- $page = esc_attr( $_GET['page'] );
20
- $tab = isset( $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : '';
21
 
22
  if ( $is_main_page )
23
  $current_page = 'admin.php?page=' . $page;
@@ -116,12 +116,13 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
116
  'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
117
  'body' => array( 'plugins' => serialize( $to_send ) ),
118
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
119
- $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
120
 
121
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
122
  $error = __( "Something went wrong. Please try again later. If the error appears again, please contact us", 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com">BestWebSoft</a>. ' . __( "We are sorry for inconvenience.", 'bestwebsoft' );
123
  } else {
124
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
 
125
  if ( is_array( $response ) && !empty( $response ) ) {
126
  foreach ( $response as $key => $value ) {
127
  if ( "wrong_license_key" == $value->package ) {
@@ -179,7 +180,7 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
179
  $max_execution_time = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : __( 'N/A', 'bestwebsoft' );
180
  $memory_limit = ( ini_get( 'memory_limit' ) ) ? ini_get( 'memory_limit' ) : __( 'N/A', 'bestwebsoft' );
181
  $wp_memory_limit = ( defined( 'WP_MEMORY_LIMIT' ) ) ? WP_MEMORY_LIMIT : __( 'N/A', 'bestwebsoft' );
182
- $memory_usage = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . __( ' Mb', 'bestwebsoft' ) : __( 'N/A', 'bestwebsoft' );
183
  $exif_read_data = ( is_callable( 'exif_read_data' ) ) ? __( 'Yes', 'bestwebsoft' ) . " ( V" . substr( phpversion( 'exif' ), 0,4 ) . ")" : __( 'No', 'bestwebsoft' );
184
  $iptcparse = ( is_callable( 'iptcparse' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
185
  $xml_parser_create = ( is_callable( 'xml_parser_create' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
@@ -372,76 +373,45 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
372
 
373
  $bws_license_plugin = sanitize_text_field( $_POST['bws_install_plugin'] );
374
 
375
- echo '<h2>' . __( 'Installing Plugin', 'bestwebsoft' ) . ': ' . $plugins_array[ $bws_license_plugin ]['name'] . '</h2>';
376
-
377
  $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
 
 
 
 
378
 
379
- $url = $plugins_array[ $bws_license_plugin ]['link'] . '&download_from=5';
380
-
381
- echo '<p>' . __( "Downloading install package from", 'bestwebsoft' ) . ' ' . $url . '</p>';
382
-
383
- $uploadDir = wp_upload_dir();
384
- $zip_name = explode( '/', $bws_license_plugin );
385
-
386
- if ( !function_exists( 'curl_init' ) ) {
387
- $received_content = file_get_contents( $url );
388
- } else {
389
- $args = array(
390
- 'method' => 'POST',
391
- 'timeout' => 100
392
- );
393
- $received_content = wp_remote_post( $url, $args );
394
- }
395
-
396
- if ( ! $received_content['body'] ) {
397
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
398
- } else {
399
- if ( is_writable( $uploadDir["path"] ) ) {
400
- $file_put_contents = $uploadDir["path"] . "/" . $zip_name[0] . ".zip";
401
-
402
- if ( file_put_contents( $file_put_contents, $received_content['body'] ) ) {
403
- @chmod( $file_put_contents, octdec( 755 ) );
404
-
405
- echo '<p>' . __( 'Unpacking the package', 'bestwebsoft' ) . '...</p>';
406
-
407
- if ( class_exists( 'ZipArchive' ) ) {
408
- $zip = new ZipArchive();
409
- if ( $zip->open( $file_put_contents ) === TRUE ) {
410
- echo '<p>' . __( 'Installing the plugin', 'bestwebsoft' ) . '...</p>';
411
- $zip->extractTo( WP_PLUGIN_DIR );
412
- $zip->close();
413
- } else {
414
- $error = __( "Failed to open the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
415
- }
416
- } elseif ( class_exists( 'Phar' ) ) {
417
- $phar = new PharData( $file_put_contents );
418
- echo '<p>' . __( 'Installing the plugin', 'bestwebsoft' ) . '...</p>';
419
- $phar->extractTo( WP_PLUGIN_DIR );
420
- } else {
421
- $error = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually", 'bestwebsoft' );
422
- }
423
- if ( empty( $error ) )
424
- echo '<p>' . sprintf( __( 'The plugin %s is successfully installed.', 'bestwebsoft' ), '<strong>' . $plugins_array[ $bws_license_plugin ]['name'] . '</strong>' ) . '</p>';
425
-
426
- @unlink( $file_put_contents );
427
- } else {
428
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
429
- }
430
- } else {
431
- $error = __( "UploadDir is not writable. Please, upload the plugin manually", 'bestwebsoft' );
432
- }
433
- }
434
-
435
- if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) {
436
- echo '<p><a href="' . esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $bws_license_plugin ), 'bws_activate_plugin' . $bws_license_plugin ) ) . '" target="_parent">' . __( 'Activate Plugin', 'bestwebsoft' ) . '</a> | <a href="' . esc_url( self_admin_url( $current_page ) ) . '" target="_parent">' . __( 'Return to BestWebSoft Panel', 'bestwebsoft' ) . '</a></p>';
437
- } else {
438
- if ( empty( $error ) )
439
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually", 'bestwebsoft' );
440
-
441
- echo '<p class="error">' . $error . '</p>';
442
- echo '<p><a href="' . esc_url( self_admin_url( $current_page ) ) . '" target="_parent">' . __( 'Return to BestWebSoft Panel', 'bestwebsoft' ) . '</a></p>';
443
- }
444
- } else {
445
  $category_href = $current_page;
446
  if ( 'all' != $plugin_category )
447
  $category_href .= '&category=' . $plugin_category; ?>
@@ -490,7 +460,7 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
490
 
491
  $key_plugin_explode = explode( '/', $key_plugin );
492
 
493
- $icon = isset( $value_plugin['icon'] ) ? $value_plugin['icon'] : '//ps.w.org/' . $key_plugin_explode[0] . '/assets/icon-128x128.png';
494
  $is_pro_isset = isset( $value_plugin['pro_version'] );
495
  $is_installed = array_key_exists( $key_plugin, $all_plugins );
496
  $is_active = in_array( $key_plugin, $active_plugins ) || isset( $sitewide_active_plugins[ $key_plugin ] );
@@ -546,7 +516,7 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
546
  if ( ! $is_pro_installed ) {
547
  if ( ! empty( $plugins_array ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
548
  <form method="post" action="">
549
- <input type="submit" class="button button-secondary" value="<?php _e( 'Install Now', 'bestwebsoft' ); ?>" />
550
  <input type="hidden" name="bws_plugin_action_submit" value="submit" />
551
  <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
552
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
@@ -569,7 +539,7 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
569
  <a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $value_plugin['pro_version'] ), 'bws_activate_plugin' . $value_plugin['pro_version'] ) ); ?>" title="<?php _e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php _e( 'Activate', 'bestwebsoft' ); ?></a>
570
  <?php } elseif ( ! empty( $plugins_array ) && isset( $value_plugin['pro_version'] ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
571
  <form method="post" action="">
572
- <input type="submit" class="button button-secondary" value="<?php _e( 'Install Now', 'bestwebsoft' ); ?>" />
573
  <input type="hidden" name="bws_plugin_action_submit" value="submit" />
574
  <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
575
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
@@ -577,7 +547,7 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
577
  <?php } elseif ( $is_installed ) { ?>
578
  <a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $key_plugin ), 'bws_activate_plugin' . $key_plugin ) ); ?>" title="<?php _e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php _e( 'Activate', 'bestwebsoft' ); ?></a>
579
  <?php } else {
580
- $install_url = isset( $value_plugin['install_url'] ) ? $value_plugin['install_url'] : self_admin_url( 'plugin-install.php?tab=search&type=term&s=' . str_replace( ' ', '+', str_replace( '-', '', $value_plugin['name'] ) ) . '+BestWebSoft&plugin-search-input=Search+Plugins' ); ?>
581
  <a class="button button-secondary" href="<?php echo esc_url( $install_url ); ?>" title="<?php _e( 'Install this plugin', 'bestwebsoft' ); ?>" target="_blank"><?php _e( 'Install Now', 'bestwebsoft' ); ?></a>
582
  <?php }
583
  } ?>
@@ -724,7 +694,6 @@ if ( ! function_exists( 'bws_get_banner_array' ) ) {
724
  array( 'fcbkbttn_hide_banner_on_plugin_page', 'facebook-button-plugin/facebook-button-plugin.php', '2.29' ),
725
  array( 'twttr_hide_banner_on_plugin_page', 'twitter-plugin/twitter.php', '2.34' ),
726
  array( 'pdfprnt_hide_banner_on_plugin_page', 'pdf-print/pdf-print.php', '1.7.1' ),
727
- array( 'gglplsn_hide_banner_on_plugin_page', 'google-one/google-plus-one.php', '1.1.4' ),
728
  array( 'gglstmp_hide_banner_on_plugin_page', 'google-sitemap-plugin/google-sitemap-plugin.php', '2.8.4' ),
729
  array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ),
730
  array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ),
@@ -738,4 +707,4 @@ if ( ! function_exists( 'bws_get_banner_array' ) ) {
738
  array( 'cstmdmnpg_hide_banner_on_plugin_page', 'custom-admin-page/custom-admin-page.php', '1.0.0' )
739
  );
740
  }
741
- }
1
  <?php
2
  /*
3
  * Function for displaying BestWebSoft menu
4
+ * Version: 2.3.0
5
  */
6
 
7
  if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) )
9
 
10
  if ( ! function_exists( 'bws_add_menu_render' ) ) {
11
  function bws_add_menu_render() {
12
+ global $wpdb, $wp_version, $bstwbsftwppdtplgns_options;
13
  $error = $message = '';
14
 
15
  /**
16
  * @deprecated 1.9.8 (15.12.2016)
17
  */
18
  $is_main_page = in_array( $_GET['page'], array( 'bws_panel', 'bws_themes', 'bws_system_status' ) );
19
+ $page = wp_unslash( $_GET['page'] );
20
+ $tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : '';
21
 
22
  if ( $is_main_page )
23
  $current_page = 'admin.php?page=' . $page;
116
  'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
117
  'body' => array( 'plugins' => serialize( $to_send ) ),
118
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
119
+ $raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
120
 
121
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
122
  $error = __( "Something went wrong. Please try again later. If the error appears again, please contact us", 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com">BestWebSoft</a>. ' . __( "We are sorry for inconvenience.", 'bestwebsoft' );
123
  } else {
124
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
125
+
126
  if ( is_array( $response ) && !empty( $response ) ) {
127
  foreach ( $response as $key => $value ) {
128
  if ( "wrong_license_key" == $value->package ) {
180
  $max_execution_time = ( ini_get( 'max_execution_time' ) ) ? ini_get( 'max_execution_time' ) : __( 'N/A', 'bestwebsoft' );
181
  $memory_limit = ( ini_get( 'memory_limit' ) ) ? ini_get( 'memory_limit' ) : __( 'N/A', 'bestwebsoft' );
182
  $wp_memory_limit = ( defined( 'WP_MEMORY_LIMIT' ) ) ? WP_MEMORY_LIMIT : __( 'N/A', 'bestwebsoft' );
183
+ $memory_usage = ( function_exists( 'memory_get_usage' ) ) ? round( memory_get_usage() / 1024 / 1024, 2 ) . ' ' . __( 'Mb', 'bestwebsoft' ) : __( 'N/A', 'bestwebsoft' );
184
  $exif_read_data = ( is_callable( 'exif_read_data' ) ) ? __( 'Yes', 'bestwebsoft' ) . " ( V" . substr( phpversion( 'exif' ), 0,4 ) . ")" : __( 'No', 'bestwebsoft' );
185
  $iptcparse = ( is_callable( 'iptcparse' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
186
  $xml_parser_create = ( is_callable( 'xml_parser_create' ) ) ? __( 'Yes', 'bestwebsoft' ) : __( 'No', 'bestwebsoft' );
373
 
374
  $bws_license_plugin = sanitize_text_field( $_POST['bws_install_plugin'] );
375
 
 
 
376
  $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
377
+ if ( is_multisite() )
378
+ update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
379
+ else
380
+ update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
381
 
382
+ $url = $plugins_array[ $bws_license_plugin ]['link'] . '&download_from=5'; ?>
383
+ <h2><?php _e( 'Download Pro Plugin', 'bestwebsoft' ); ?></h2>
384
+ <p>
385
+ <strong><?php _e( 'Your Pro plugin is ready', 'bestwebsoft' ); ?></strong>
386
+ <br>
387
+ <?php _e( 'Your plugin has been zipped, and now is ready to download.', 'bestwebsoft' ); ?>
388
+ </p>
389
+ <p>
390
+ <a class="button button-secondary" target="_parent" href="<?php echo esc_url( $url ); ?>"><?php _e( 'Download Now', 'bestwebsoft' ); ?></a>
391
+ </p>
392
+ <br>
393
+ <p>
394
+ <strong><?php _e( 'Need help installing the plugin?', 'bestwebsoft' ); ?></strong>
395
+ <br>
396
+ <a target="_blank" href="https://docs.google.com/document/d/1-hvn6WRvWnOqj5v5pLUk7Awyu87lq5B_dO-Tv-MC9JQ/"><?php _e( 'How to install WordPress plugin from your admin Dashboard (ZIP archive)', 'bestwebsoft' ); ?></a>
397
+ </p>
398
+ <p>
399
+ <strong><?php _e( 'Get Started', 'bestwebsoft' ); ?></strong>
400
+ <br>
401
+ <a target="_blank" href="https://drive.google.com/drive/u/0/folders/0B5l8lO-CaKt9VGh0a09vUjNFNjA"><?php _e( 'Documentation', 'bestwebsoft' ); ?></a>
402
+ <br>
403
+ <a target="_blank" href="https://www.youtube.com/user/bestwebsoft"><?php _e( 'Video Instructions', 'bestwebsoft' ); ?></a>
404
+ <br>
405
+ <a target="_blank" href="https://support.bestwebsoft.com"><?php _e( 'Knowledge Base', 'bestwebsoft' ); ?></a>
406
+ </p>
407
+ <p>
408
+ <strong><?php _e( 'Licenses & Domains', 'bestwebsoft' ); ?></strong>
409
+ <br>
410
+ <?php printf( 'Manage your license(-s) and change domain names using the %s at BestWebSoft.',
411
+ '<a target="_blank" href="https://bestwebsoft.com/client-area">' . __( 'Client Area', 'bestwebsoft' ) . '</a>' ); ?>
412
+ </p>
413
+ <p><a href="<?php echo esc_url( self_admin_url( $current_page ) ); ?>" target="_parent"><?php _e( 'Return to BestWebSoft Panel', 'bestwebsoft' ); ?></a></p>
414
+ <?php } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  $category_href = $current_page;
416
  if ( 'all' != $plugin_category )
417
  $category_href .= '&category=' . $plugin_category; ?>
460
 
461
  $key_plugin_explode = explode( '/', $key_plugin );
462
 
463
+ $icon = isset( $value_plugin['icon'] ) ? $value_plugin['icon'] : '//ps.w.org/' . $key_plugin_explode[0] . '/assets/icon-256x256.png';
464
  $is_pro_isset = isset( $value_plugin['pro_version'] );
465
  $is_installed = array_key_exists( $key_plugin, $all_plugins );
466
  $is_active = in_array( $key_plugin, $active_plugins ) || isset( $sitewide_active_plugins[ $key_plugin ] );
516
  if ( ! $is_pro_installed ) {
517
  if ( ! empty( $plugins_array ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
518
  <form method="post" action="">
519
+ <input type="submit" class="button button-secondary" value="<?php _e( 'Get Pro', 'bestwebsoft' ); ?>" />
520
  <input type="hidden" name="bws_plugin_action_submit" value="submit" />
521
  <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
522
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
539
  <a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $value_plugin['pro_version'] ), 'bws_activate_plugin' . $value_plugin['pro_version'] ) ); ?>" title="<?php _e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php _e( 'Activate', 'bestwebsoft' ); ?></a>
540
  <?php } elseif ( ! empty( $plugins_array ) && isset( $value_plugin['pro_version'] ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
541
  <form method="post" action="">
542
+ <input type="submit" class="button button-secondary" value="<?php _e( 'Get Pro', 'bestwebsoft' ); ?>" />
543
  <input type="hidden" name="bws_plugin_action_submit" value="submit" />
544
  <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
545
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
547
  <?php } elseif ( $is_installed ) { ?>
548
  <a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( self_admin_url( $current_page . '&bws_activate_plugin=' . $key_plugin ), 'bws_activate_plugin' . $key_plugin ) ); ?>" title="<?php _e( 'Activate this plugin', 'bestwebsoft' ); ?>"><?php _e( 'Activate', 'bestwebsoft' ); ?></a>
549
  <?php } else {
550
+ $install_url = isset( $value_plugin['install_url'] ) ? $value_plugin['install_url'] : self_admin_url( 'plugin-install.php?tab=search&type=term&s=' . str_replace( array( ' ', '-' ), '+', str_replace( '&', '', $value_plugin['name'] ) ) . '+BestWebSoft&plugin-search-input=Search+Plugins' ); ?>
551
  <a class="button button-secondary" href="<?php echo esc_url( $install_url ); ?>" title="<?php _e( 'Install this plugin', 'bestwebsoft' ); ?>" target="_blank"><?php _e( 'Install Now', 'bestwebsoft' ); ?></a>
552
  <?php }
553
  } ?>
694
  array( 'fcbkbttn_hide_banner_on_plugin_page', 'facebook-button-plugin/facebook-button-plugin.php', '2.29' ),
695
  array( 'twttr_hide_banner_on_plugin_page', 'twitter-plugin/twitter.php', '2.34' ),
696
  array( 'pdfprnt_hide_banner_on_plugin_page', 'pdf-print/pdf-print.php', '1.7.1' ),
 
697
  array( 'gglstmp_hide_banner_on_plugin_page', 'google-sitemap-plugin/google-sitemap-plugin.php', '2.8.4' ),
698
  array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ),
699
  array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ),
707
  array( 'cstmdmnpg_hide_banner_on_plugin_page', 'custom-admin-page/custom-admin-page.php', '1.0.0' )
708
  );
709
  }
710
+ }
bws_menu/class-bws-settings.php CHANGED
@@ -156,7 +156,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
156
  <div id="minor-publishing">
157
  <div id="misc-publishing-actions">
158
  <?php if ( $this->is_pro ) {
159
- if ( ! isset( $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] ) || isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $this->plugin_basename ] ) ) {
160
  $license_type = 'Pro';
161
  $license_status = __( 'Inactive', 'bestwebsoft' ) . ' <a href="#' . $this->prefix . '_license_tab" class="bws_trigger_tab_click">' . __( 'Learn More', 'bestwebsoft' ) . '</a>';
162
  } else {
@@ -174,7 +174,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
174
  $license_status .= '. <a target="_blank" href="' . esc_url( $this->plugins_info['PluginURI'] ) . '">' . __( 'Upgrade to Pro', 'bestwebsoft' ) . '</a>';
175
  } else {
176
  $license_type = isset( $bstwbsftwppdtplgns_options['nonprofit'][ $this->plugin_basename ] ) ? 'Nonprofit Pro' : 'Pro';
177
- if ( $finish < $today ) {
178
  $license_status = sprintf( __( 'Expired on %s', 'bestwebsoft' ), $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] ) . '. <a target="_blank" href="https://support.bestwebsoft.com/entries/53487136">' . __( 'Renew Now', 'bestwebsoft' ) . '</a>';
179
  } else {
180
  $license_status = __( 'Active', 'bestwebsoft' );
@@ -236,7 +236,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
236
  */
237
  public function display_tabs() {
238
  global $wp_version; ?>
239
- <div id="bws_settings_tabs_wrapper"<?php if ( version_compare( $wp_version, '4.0', '<' ) ) echo ' class="edit-form-section"'; ?>>
240
  <ul id="bws_settings_tabs">
241
  <?php $this->display_tabs_list(); ?>
242
  </ul>
@@ -452,7 +452,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
452
  'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started'
453
  ),
454
  'php' => array( 'description' => sprintf( __( 'This PHP code will be hooked to the %s action and will be printed on front end only.', 'bestwebsoft' ), '<a href="https://codex.wordpress.org/Plugin_API/Action_Reference/init" target="_blank"><code>init</code></a>' ),
455
- 'learn_more_link' => 'http://php.net/'
456
  ),
457
  'js' => array( 'description' => __( 'These code will be added to the header on all pages of your site.', 'bestwebsoft' ),
458
  'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/JavaScript'
@@ -631,6 +631,8 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
631
  */
632
  private function save_options_misc() {
633
  global $bstwbsftwppdtplgns_options, $wp_version;
 
 
634
  /* hide premium options */
635
  if ( ! empty( $this->pro_page ) ) {
636
  if ( isset( $_POST['bws_hide_premium_options'] ) ) {
@@ -692,7 +694,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
692
  ),
693
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
694
  );
695
- $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/products-statistics/track-usage/', $options );
696
 
697
  if ( ! is_wp_error( $raw_response ) && 200 == wp_remote_retrieve_response_code( $raw_response ) ) {
698
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
@@ -722,29 +724,43 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
722
  <?php $this->help_phrase(); ?>
723
  <hr>
724
  <?php
725
- foreach ( $this->licenses as $single_license) {
726
  $pro_plugin_name = ( strpos( $single_license['name'], 'Pro' ) ) ? $single_license['name'] : $single_license['name'] . ' ' . 'Pro';
727
  if ( ! empty( $this->pro_page ) || ! empty( $single_license['pro_basename'] ) ) {
728
 
729
  if ( $this->pro_plugin_is_activated && ( empty( $single_license['pro_basename'] ) || isset( $this->bws_license_plugin ) ) ) {
730
- deactivate_plugins( $single_license['basename'] ); ?>
731
- <script type="text/javascript">
732
- (function($) {
733
- var i = 7;
734
- function bws_set_timeout() {
735
- i--;
736
- if ( 0 == i ) {
737
- window.location.href = '<?php echo esc_url( self_admin_url( $this->pro_page ) ); ?>';
738
- } else {
739
- $( '#bws_timeout_counter' ).text( i );
740
- window.setTimeout( bws_set_timeout, 1000 );
741
- }
742
- }
743
- window.setTimeout( bws_set_timeout, 1000 );
744
- })(jQuery);
745
- </script>
746
- <p><strong><?php printf( __( 'Congratulations! %s license is activated successfully.', 'bestwebsoft' ), $pro_plugin_name ); ?></strong></p>
747
- <p><?php printf( __( 'You will be automatically redirected to the %s in %s seconds.', 'bestwebsoft' ), '<a href="' . esc_url( self_admin_url( $this->pro_page ) ) . '">' . __( 'Settings page', 'bestwebsoft' ) . '</a>', '<span id="bws_timeout_counter">7</span>' ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
  <?php } else {
749
  $attr = '';
750
  if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] ) &&
@@ -817,7 +833,9 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
817
  private function save_options_license_key() {
818
  global $wp_version, $bstwbsftwppdtplgns_options;
819
  /*$empty_field_error - added to avoid error when 1 field is empty while another field contains license key*/
820
- $empty_field_error = '';
 
 
821
  foreach ( $this->licenses as $single_license) {
822
  $bws_license_key = ( isset( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) ? stripslashes( sanitize_text_field( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) : '';
823
  if ( '' != $bws_license_key ) {
@@ -838,15 +856,15 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
838
 
839
  if ( ! empty( $this->all_plugins ) && ! empty( $current ) && isset( $current->response ) && is_array( $current->response ) ) {
840
  $to_send = array();
841
- $to_send["plugins"][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] = $this->all_plugins[ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ];
842
- $to_send["plugins"][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ]["bws_license_key"] = $bws_license_key;
843
- $to_send["plugins"][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ]["bws_illegal_client"] = true;
844
  $options = array(
845
  'timeout' => ( ( defined( 'DOING_CRON' ) && DOING_CRON ) ? 30 : 3 ),
846
  'body' => array( 'plugins' => serialize( $to_send ) ),
847
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
848
  );
849
- $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
850
 
851
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
852
  $error = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ': <a href=https://support.bestwebsoft.com>BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
@@ -875,6 +893,9 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
875
 
876
  if ( ! empty( $single_response->time_out ) ) {
877
  $message .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $single_response->time_out . '.';
 
 
 
878
  }
879
 
880
  if ( isset( $single_response->trial ) && $this->is_trial ) {
@@ -883,19 +904,19 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
883
  }
884
 
885
  if ( isset( $single_response->trial ) ) {
886
- $bstwbsftwppdtplgns_options['trial'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] = 1;
887
  } else {
888
- unset( $bstwbsftwppdtplgns_options['trial'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] );
889
  }
890
 
891
  if ( isset( $single_response->nonprofit ) ) {
892
- $bstwbsftwppdtplgns_options['nonprofit'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] = 1;
893
  } else {
894
- unset( $bstwbsftwppdtplgns_options['nonprofit'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] );
895
  }
896
 
897
- if ( ! isset( $bstwbsftwppdtplgns_options[ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] ) || $bstwbsftwppdtplgns_options[ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] != $bws_license_key ) {
898
- $bstwbsftwppdtplgns_options[ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] = $bws_license_key;
899
 
900
  $file = @fopen( dirname( dirname( __FILE__ ) ) . "/license_key.txt", "w+" );
901
  if ( $file ) {
@@ -905,9 +926,14 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
905
  $update_option = true;
906
  }
907
 
908
- if ( ! isset( $bstwbsftwppdtplgns_options['time_out'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] ) || $bstwbsftwppdtplgns_options['time_out'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] != $single_response->time_out ) {
909
- $bstwbsftwppdtplgns_options['time_out'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] = $single_response->time_out;
910
- $update_option = true;
 
 
 
 
 
911
  }
912
 
913
  if ( isset( $update_option ) ) {
@@ -955,7 +981,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
955
  'body' => array( 'plugins' => serialize( $to_send ) ),
956
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
957
  );
958
- $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
959
 
960
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
961
  $error = __( "Something went wrong. Please try again later. If the error appears again, please contact us", 'bestwebsoft' ) . ': <a href="https://support.bestwebsoft.com">BestWebSoft</a>. ' . __( "We are sorry for inconvenience.", 'bestwebsoft' );
@@ -979,71 +1005,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
979
  $bws_license_plugin = ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'];
980
 
981
  $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
982
-
983
- $url = 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/downloads/?bws_first_download=' . $bws_license_plugin . '&bws_license_key=' . $bws_license_key . '&download_from=5';
984
-
985
- if ( ! $this->upload_dir ) {
986
- $this->upload_dir = wp_upload_dir();
987
- }
988
-
989
- $zip_name = explode( '/', $bws_license_plugin );
990
-
991
- if ( ! function_exists( 'curl_init' ) ) {
992
- $received_content = file_get_contents( $url );
993
- } else {
994
- $args = array(
995
- 'method' => 'POST',
996
- 'timeout' => 100
997
- );
998
- $received_content = wp_remote_post( $url, $args );
999
- }
1000
- if ( ! $received_content['body'] ) {
1001
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
1002
- } else {
1003
- if ( is_writable( $this->upload_dir["path"] ) ) {
1004
- $file_put_contents = $this->upload_dir["path"] . "/" . $zip_name[0] . ".zip";
1005
- if ( file_put_contents( $file_put_contents, $received_content['body'] ) ) {
1006
- @chmod( $file_put_contents, octdec( 755 ) );
1007
- if ( class_exists( 'ZipArchive' ) ) {
1008
- $zip = new ZipArchive();
1009
- if ( $zip->open( $file_put_contents ) === true ) {
1010
- $zip->extractTo( WP_PLUGIN_DIR );
1011
- $zip->close();
1012
- } else {
1013
- $error = __( "Failed to open the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
1014
- }
1015
- } elseif ( class_exists( 'Phar' ) ) {
1016
- $phar = new PharData( $file_put_contents );
1017
- $phar->extractTo( WP_PLUGIN_DIR );
1018
- } else {
1019
- $error = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually.", 'bestwebsoft' );
1020
- }
1021
- @unlink( $file_put_contents );
1022
- } else {
1023
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
1024
- }
1025
- } else {
1026
- $error = __( "UploadDir is not writable. Please, upload the plugin manually.", 'bestwebsoft' );
1027
- }
1028
- }
1029
-
1030
- /* activate Pro */
1031
- if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) {
1032
- if ( $this->is_multisite && is_plugin_active_for_network( ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ) ) {
1033
- /* if multisite and free plugin is network activated */
1034
- $active_plugins = get_site_option( 'active_sitewide_plugins' );
1035
- $active_plugins[ $bws_license_plugin ] = time();
1036
- update_site_option( 'active_sitewide_plugins', $active_plugins );
1037
- } else {
1038
- /* activate on a single blog */
1039
- $active_plugins = get_option( 'active_plugins' );
1040
- array_push( $active_plugins, $bws_license_plugin );
1041
- update_option( 'active_plugins', $active_plugins );
1042
- }
1043
- $this->pro_plugin_is_activated = true;
1044
- } elseif ( empty( $error ) ) {
1045
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
1046
- }
1047
  }
1048
  } else {
1049
  $error = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.", 'bestwebsoft' );
@@ -1146,4 +1108,4 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
1146
  }
1147
  }
1148
  }
1149
- }
156
  <div id="minor-publishing">
157
  <div id="misc-publishing-actions">
158
  <?php if ( $this->is_pro ) {
159
+ if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $this->plugin_basename ] ) || empty( $bstwbsftwppdtplgns_options['time_out'] ) || ! array_key_exists( $this->plugin_basename, $bstwbsftwppdtplgns_options['time_out'] ) ) {
160
  $license_type = 'Pro';
161
  $license_status = __( 'Inactive', 'bestwebsoft' ) . ' <a href="#' . $this->prefix . '_license_tab" class="bws_trigger_tab_click">' . __( 'Learn More', 'bestwebsoft' ) . '</a>';
162
  } else {
174
  $license_status .= '. <a target="_blank" href="' . esc_url( $this->plugins_info['PluginURI'] ) . '">' . __( 'Upgrade to Pro', 'bestwebsoft' ) . '</a>';
175
  } else {
176
  $license_type = isset( $bstwbsftwppdtplgns_options['nonprofit'][ $this->plugin_basename ] ) ? 'Nonprofit Pro' : 'Pro';
177
+ if ( ! empty( $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] ) && $finish < $today ) {
178
  $license_status = sprintf( __( 'Expired on %s', 'bestwebsoft' ), $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] ) . '. <a target="_blank" href="https://support.bestwebsoft.com/entries/53487136">' . __( 'Renew Now', 'bestwebsoft' ) . '</a>';
179
  } else {
180
  $license_status = __( 'Active', 'bestwebsoft' );
236
  */
237
  public function display_tabs() {
238
  global $wp_version; ?>
239
+ <div id="bws_settings_tabs_wrapper">
240
  <ul id="bws_settings_tabs">
241
  <?php $this->display_tabs_list(); ?>
242
  </ul>
452
  'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started'
453
  ),
454
  'php' => array( 'description' => sprintf( __( 'This PHP code will be hooked to the %s action and will be printed on front end only.', 'bestwebsoft' ), '<a href="https://codex.wordpress.org/Plugin_API/Action_Reference/init" target="_blank"><code>init</code></a>' ),
455
+ 'learn_more_link' => 'https://php.net/'
456
  ),
457
  'js' => array( 'description' => __( 'These code will be added to the header on all pages of your site.', 'bestwebsoft' ),
458
  'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/JavaScript'
631
  */
632
  private function save_options_misc() {
633
  global $bstwbsftwppdtplgns_options, $wp_version;
634
+ $notice = '';
635
+
636
  /* hide premium options */
637
  if ( ! empty( $this->pro_page ) ) {
638
  if ( isset( $_POST['bws_hide_premium_options'] ) ) {
694
  ),
695
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
696
  );
697
+ $raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/products-statistics/track-usage/', $options );
698
 
699
  if ( ! is_wp_error( $raw_response ) && 200 == wp_remote_retrieve_response_code( $raw_response ) ) {
700
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
724
  <?php $this->help_phrase(); ?>
725
  <hr>
726
  <?php
727
+ foreach ( $this->licenses as $single_license ) {
728
  $pro_plugin_name = ( strpos( $single_license['name'], 'Pro' ) ) ? $single_license['name'] : $single_license['name'] . ' ' . 'Pro';
729
  if ( ! empty( $this->pro_page ) || ! empty( $single_license['pro_basename'] ) ) {
730
 
731
  if ( $this->pro_plugin_is_activated && ( empty( $single_license['pro_basename'] ) || isset( $this->bws_license_plugin ) ) ) {
732
+ $url = 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/downloads/?bws_first_download=' . $this->bws_license_plugin . '&bws_license_key=' . $bstwbsftwppdtplgns_options[ $this->bws_license_plugin ] . '&download_from=5'; ?>
733
+ <table class="form-table">
734
+ <tr>
735
+ <th scope="row"><?php echo $pro_plugin_name . ' License'; ?></th>
736
+ <td>
737
+ <p>
738
+ <strong><?php _e( 'Your Pro plugin is ready', 'bestwebsoft' ); ?></strong>
739
+ <br>
740
+ <?php _e( 'Your plugin has been zipped, and now is ready to download.', 'bestwebsoft' ); ?>
741
+ </p>
742
+ <p>
743
+ <a class="button button-secondary" target="_parent" href="<?php echo esc_url( $url ); ?>"><?php _e( 'Download Now', 'bestwebsoft' ); ?></a>
744
+ </p>
745
+ <br>
746
+ <p>
747
+ <strong><?php _e( 'Need help installing the plugin?', 'bestwebsoft' ); ?></strong>
748
+ <br>
749
+ <a target="_blank" href="https://docs.google.com/document/d/1-hvn6WRvWnOqj5v5pLUk7Awyu87lq5B_dO-Tv-MC9JQ/"><?php _e( 'How to install WordPress plugin from your admin Dashboard (ZIP archive)', 'bestwebsoft' ); ?></a>
750
+ </p>
751
+ <br>
752
+ <p>
753
+ <strong><?php _e( 'Get Started', 'bestwebsoft' ); ?></strong>
754
+ <br>
755
+ <a target="_blank" href="https://drive.google.com/drive/u/0/folders/0B5l8lO-CaKt9VGh0a09vUjNFNjA"><?php _e( 'Documentation', 'bestwebsoft' ); ?></a>
756
+ <br>
757
+ <a target="_blank" href="https://www.youtube.com/user/bestwebsoft"><?php _e( 'Video Instructions', 'bestwebsoft' ); ?></a>
758
+ <br>
759
+ <a target="_blank" href="https://support.bestwebsoft.com"><?php _e( 'Knowledge Base', 'bestwebsoft' ); ?></a>
760
+ </p>
761
+ </td>
762
+ </tr>
763
+ </table>
764
  <?php } else {
765
  $attr = '';
766
  if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] ) &&
833
  private function save_options_license_key() {
834
  global $wp_version, $bstwbsftwppdtplgns_options;
835
  /*$empty_field_error - added to avoid error when 1 field is empty while another field contains license key*/
836
+
837
+ $error = $message = $empty_field_error = '';
838
+
839
  foreach ( $this->licenses as $single_license) {
840
  $bws_license_key = ( isset( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) ? stripslashes( sanitize_text_field( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) : '';
841
  if ( '' != $bws_license_key ) {
856
 
857
  if ( ! empty( $this->all_plugins ) && ! empty( $current ) && isset( $current->response ) && is_array( $current->response ) ) {
858
  $to_send = array();
859
+ $to_send["plugins"][ $single_license['basename'] ] = $this->all_plugins[ $single_license['basename'] ];
860
+ $to_send["plugins"][ $single_license['basename'] ]["bws_license_key"] = $bws_license_key;
861
+ $to_send["plugins"][ $single_license['basename'] ]["bws_illegal_client"] = true;
862
  $options = array(
863
  'timeout' => ( ( defined( 'DOING_CRON' ) && DOING_CRON ) ? 30 : 3 ),
864
  'body' => array( 'plugins' => serialize( $to_send ) ),
865
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
866
  );
867
+ $raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
868
 
869
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
870
  $error = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ': <a href=https://support.bestwebsoft.com>BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
893
 
894
  if ( ! empty( $single_response->time_out ) ) {
895
  $message .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $single_response->time_out . '.';
896
+ } else {
897
+ /* lifetime */
898
+ $single_response->time_out = NULL;
899
  }
900
 
901
  if ( isset( $single_response->trial ) && $this->is_trial ) {
904
  }
905
 
906
  if ( isset( $single_response->trial ) ) {
907
+ $bstwbsftwppdtplgns_options['trial'][ $single_license['basename'] ] = 1;
908
  } else {
909
+ unset( $bstwbsftwppdtplgns_options['trial'][ $single_license['basename'] ] );
910
  }
911
 
912
  if ( isset( $single_response->nonprofit ) ) {
913
+ $bstwbsftwppdtplgns_options['nonprofit'][ $single_license['basename'] ] = 1;
914
  } else {
915
+ unset( $bstwbsftwppdtplgns_options['nonprofit'][ $single_license['basename'] ] );
916
  }
917
 
918
+ if ( ! isset( $bstwbsftwppdtplgns_options[ $single_license['basename'] ] ) || $bstwbsftwppdtplgns_options[ $single_license['basename'] ] != $bws_license_key ) {
919
+ $bstwbsftwppdtplgns_options[ $single_license['basename'] ] = $bws_license_key;
920
 
921
  $file = @fopen( dirname( dirname( __FILE__ ) ) . "/license_key.txt", "w+" );
922
  if ( $file ) {
926
  $update_option = true;
927
  }
928
 
929
+ if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $single_license['basename'] ] ) ) {
930
+ unset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $single_license['basename'] ] );
931
+ $update_option = true;
932
+ }
933
+
934
+ if ( ! isset( $bstwbsftwppdtplgns_options['time_out'][ $single_license['basename'] ] ) || $bstwbsftwppdtplgns_options['time_out'][ $single_license['basename'] ] != $single_response->time_out ) {
935
+ $bstwbsftwppdtplgns_options['time_out'][ $single_license['basename'] ] = $single_response->time_out;
936
+ $update_option = true;
937
  }
938
 
939
  if ( isset( $update_option ) ) {
981
  'body' => array( 'plugins' => serialize( $to_send ) ),
982
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
983
  );
984
+ $raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
985
 
986
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
987
  $error = __( "Something went wrong. Please try again later. If the error appears again, please contact us", 'bestwebsoft' ) . ': <a href="https://support.bestwebsoft.com">BestWebSoft</a>. ' . __( "We are sorry for inconvenience.", 'bestwebsoft' );
1005
  $bws_license_plugin = ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'];
1006
 
1007
  $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
1008
+ $this->pro_plugin_is_activated = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1009
  }
1010
  } else {
1011
  $error = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.", 'bestwebsoft' );
1108
  }
1109
  }
1110
  }
1111
+ }
bws_menu/css/general_style.css CHANGED
@@ -61,9 +61,12 @@ div.bws_info {
61
  .bws_info_small {
62
  font-size: 11px !important;
63
  }
64
- div.updated.bws-notice {
65
  border-left: 4px solid #ffba00;
66
  }
 
 
 
67
  /*
68
  * styles for rate-support div on the settings page
69
  */
@@ -327,7 +330,7 @@ div.bws_banner_on_plugin_page .icon {
327
  margin: 12px 8px 8px 12px;
328
  }
329
  .bws_banner_on_plugin_page .icon img {
330
- max-width: 60px;
331
  }
332
  .bws_go_pro_banner .icon:before {
333
  content: 'PRO';
@@ -810,4 +813,4 @@ span.bws_code {
810
  padding-left: 0;
811
  padding-right: 0;
812
  }
813
- }
61
  .bws_info_small {
62
  font-size: 11px !important;
63
  }
64
+ body:not(.rtl) div.updated.bws-notice {
65
  border-left: 4px solid #ffba00;
66
  }
67
+ .rtl div.updated.bws-notice {
68
+ border-right: 4px solid #ffba00;
69
+ }
70
  /*
71
  * styles for rate-support div on the settings page
72
  */
330
  margin: 12px 8px 8px 12px;
331
  }
332
  .bws_banner_on_plugin_page .icon img {
333
+ max-width: 64px;
334
  }
335
  .bws_go_pro_banner .icon:before {
336
  content: 'PRO';
813
  padding-left: 0;
814
  padding-right: 0;
815
  }
816
+ }
bws_menu/css/modal.css CHANGED
@@ -46,10 +46,22 @@
46
  }
47
  .bws-modal .bws-modal-footer {
48
  border-top: #eeeeee solid 1px;
49
- text-align: right;
 
 
 
 
 
50
  }
51
  .bws-modal .bws-modal-footer .button {
52
  margin: 0 7px;
 
 
 
 
 
 
 
53
  }
54
  .bws-modal .bws-modal-footer .button:first-child {
55
  margin: 0;
46
  }
47
  .bws-modal .bws-modal-footer {
48
  border-top: #eeeeee solid 1px;
49
+ }
50
+ .bws-modal .bws-modal-footer .bws-modal-skip-link {
51
+ text-decoration: none;
52
+ float: right;
53
+ display: inline-block;
54
+ padding: 7px;
55
  }
56
  .bws-modal .bws-modal-footer .button {
57
  margin: 0 7px;
58
+ float: left;
59
+ }
60
+ .rtl .bws-modal .bws-modal-footer .bws-modal-skip-link {
61
+ float: left;
62
+ }
63
+ .rtl .bws-modal .bws-modal-footer .button {
64
+ float: right;
65
  }
66
  .bws-modal .bws-modal-footer .button:first-child {
67
  margin: 0;
bws_menu/css/style.css CHANGED
@@ -150,6 +150,7 @@ body[class*="-bws-panel"] .update-nag {
150
  font-size: 13px;
151
  padding: 8px 19px 8px 9px;
152
  text-align: left;
 
153
  }
154
  .bws-membership .bws-button {
155
  background: #dd6930;
@@ -259,7 +260,7 @@ table.bws-system-info tbody tr:nth-child(odd) {
259
  box-shadow: none;
260
  }
261
  .bws_product_image img {
262
- height: 60px;
263
  }
264
  .bws_product_content {
265
  max-width: 200px;
@@ -483,4 +484,4 @@ a.bws_donate {
483
  max-width: 160px;
484
  padding-right: 10px;
485
  }
486
- }
150
  font-size: 13px;
151
  padding: 8px 19px 8px 9px;
152
  text-align: left;
153
+ line-height: 1;
154
  }
155
  .bws-membership .bws-button {
156
  background: #dd6930;
260
  box-shadow: none;
261
  }
262
  .bws_product_image img {
263
+ height: 64px;
264
  }
265
  .bws_product_content {
266
  max-width: 200px;
484
  max-width: 160px;
485
  padding-right: 10px;
486
  }
487
+ }
bws_menu/deactivation-form.php CHANGED
@@ -17,147 +17,152 @@ if ( ! function_exists( 'bws_add_deactivation_feedback_dialog_box' ) ) {
17
  function bws_add_deactivation_feedback_dialog_box() {
18
  global $bstwbsftwppdtplgns_active_plugins;
19
  if ( empty( $bstwbsftwppdtplgns_active_plugins ) )
20
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  foreach ( $bstwbsftwppdtplgns_active_plugins as $basename => $plugin_data ) {
23
 
24
  $slug = dirname( $basename );
25
  $plugin_id = sanitize_title( $plugin_data['Name'] );
26
 
27
- $contact_support_template = __( 'Need help? We are ready to answer your questions.', 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . __( 'Contact Support', 'bestwebsoft' ) . '</a>';
28
-
29
- $reasons = array(
30
- array(
31
- 'id' => 'NOT_WORKING',
32
- 'text' => __( 'The plugin is not working', 'bestwebsoft' ),
33
- 'input_type' => 'textarea',
34
- 'input_placeholder' => __( "Kindly share what didn't work so we can fix it in future updates...", 'bestwebsoft' )
35
- ),
36
- array(
37
- 'id' => 'DIDNT_WORK_AS_EXPECTED',
38
- 'text' => __( "The plugin didn't work as expected", 'bestwebsoft' ),
39
- 'input_type' => 'textarea',
40
- 'input_placeholder' => __( 'What did you expect?', 'bestwebsoft' )
41
- ),
42
- array(
43
- 'id' => 'SUDDENLY_STOPPED_WORKING',
44
- 'text' => __( 'The plugin suddenly stopped working', 'bestwebsoft' ),
45
- 'input_type' => '',
46
- 'input_placeholder' => '',
47
- 'internal_message' => $contact_support_template
48
- ),
49
- array(
50
- 'id' => 'BROKE_MY_SITE',
51
- 'text' => __( 'The plugin broke my site', 'bestwebsoft' ),
52
- 'input_type' => '',
53
- 'input_placeholder' => '',
54
- 'internal_message' => $contact_support_template
55
- ),
56
- array(
57
- 'id' => 'COULDNT_MAKE_IT_WORK',
58
- 'text' => __( "I couldn't understand how to get it work", 'bestwebsoft' ),
59
- 'input_type' => '',
60
- 'input_placeholder' => '',
61
- 'internal_message' => $contact_support_template
62
- ),
63
- array(
64
- 'id' => 'FOUND_A_BETTER_PLUGIN',
65
- 'text' => __( 'I found a better plugin', 'bestwebsoft' ),
66
- 'input_type' => 'textfield',
67
- 'input_placeholder' => __( "What's the plugin name?", 'bestwebsoft' )
68
- ),
69
- array(
70
- 'id' => 'GREAT_BUT_NEED_SPECIFIC_FEATURE',
71
- 'text' => __( "The plugin is great, but I need specific feature that you don't support", 'bestwebsoft' ),
72
- 'input_type' => 'textarea',
73
- 'input_placeholder' => __( 'What feature?', 'bestwebsoft' )
74
- ),
75
- array(
76
- 'id' => 'NO_LONGER_NEEDED',
77
- 'text' => __( 'I no longer need the plugin', 'bestwebsoft' ),
78
- 'input_type' => '',
79
- 'input_placeholder' => ''
80
- ),
81
- array(
82
- 'id' => 'TEMPORARY_DEACTIVATION',
83
- 'text' => __( "It's a temporary deactivation, I'm just debugging an issue", 'bestwebsoft' ),
84
- 'input_type' => '',
85
- 'input_placeholder' => ''
86
- ),
87
- array(
88
- 'id' => 'OTHER',
89
- 'text' => __( 'Other', 'bestwebsoft' ),
90
- 'input_type' => 'textfield',
91
- 'input_placeholder' => ''
92
- )
93
- );
94
-
95
- $reasons_list_items_html = '';
96
-
97
- foreach ( $reasons as $reason ) {
98
- $list_item_classes = 'bws-modal-reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' );
99
-
100
- if ( ! empty( $reason['internal_message'] ) ) {
101
- $list_item_classes .= ' has-internal-message';
102
- $reason_internal_message = $reason['internal_message'];
103
- } else {
104
- $reason_internal_message = '';
105
- }
106
-
107
- $reasons_list_items_html .= '<li class="' . $list_item_classes . '" data-input-type="' . $reason['input_type'] . '" data-input-placeholder="' . $reason['input_placeholder'] . '">
108
- <label>
109
- <span>
110
- <input type="radio" name="selected-reason" value="' . $reason['id'] . '"/>
111
- </span>
112
- <span>' . $reason['text'] . '</span>
113
- </label>
114
- <div class="bws-modal-internal-message">' . $reason_internal_message . '</div>
115
- </li>';
116
- } ?>
117
- <script type="text/javascript">
118
- (function($) {
119
- var modalHtml =
120
- '<div class="bws-modal bws-modal-deactivation-feedback">'
121
- + ' <div class="bws-modal-dialog">'
122
- + ' <div class="bws-modal-body">'
123
- + ' <h2><?php _e( 'Quick Feedback', 'bestwebsoft' ); ?></h2>'
124
- + ' <div class="bws-modal-panel active"><p><?php _e( 'If you have a moment, please let us know why you are deactivating', 'bestwebsoft' ); ?>:</p><ul>' + <?php echo json_encode( $reasons_list_items_html ); ?> + '</ul>'
125
- + ' <label class="bws-modal-anonymous-label">'
126
- + ' <input type="checkbox" />'
127
- + ' <?php _e( 'Send website data and allow to contact me back', 'bestwebsoft' ); ?>'
128
- + ' </label>'
129
- + ' </div>'
130
- + ' </div>'
131
- + ' <div class="bws-modal-footer">'
132
- + ' <a href="#" class="button button-primary bws-modal-button-deactivate"></a>'
133
- + ' <div class="clear"></div>'
134
- + ' </div>'
135
- + ' </div>'
136
- + '</div>',
137
- $modal = $( modalHtml ),
138
- $deactivateLink = $( '#the-list .active[data-plugin="<?php echo $basename; ?>"] .deactivate a' ),
139
- $anonymousFeedback = $modal.find( '.bws-modal-anonymous-label' ),
140
  selectedReasonID = false;
141
 
142
  /* WP added data-plugin attr after 4.5 version/ In prev version was id attr */
143
- if ( 0 == $deactivateLink.length )
144
- $deactivateLink = $( '#the-list .active#<?php echo $plugin_id; ?> .deactivate a' );
145
 
146
- $modal.appendTo( $( 'body' ) );
147
 
148
  BwsModalRegisterEventHandlers();
149
 
150
  function BwsModalRegisterEventHandlers() {
151
- $deactivateLink.click( function( evt ) {
152
  evt.preventDefault();
153
 
154
  /* Display the dialog box.*/
155
  BwsModalReset();
156
- $modal.addClass( 'active' );
157
  $( 'body' ).addClass( 'has-bws-modal' );
158
  });
159
 
160
- $modal.on( 'input propertychange', '.bws-modal-reason-input input', function() {
161
  if ( ! BwsModalIsReasonSelected( 'OTHER' ) ) {
162
  return;
163
  }
@@ -166,13 +171,13 @@ if ( ! function_exists( 'bws_add_deactivation_feedback_dialog_box' ) ) {
166
 
167
  /* If reason is not empty, remove the error-message class of the message container to change the message color back to default. */
168
  if ( reason.length > 0 ) {
169
- $modal.find( '.message' ).removeClass( 'error-message' );
170
  BwsModalEnableDeactivateButton();
171
  }
172
  });
173
 
174
- $modal.on( 'blur', '.bws-modal-reason-input input', function() {
175
- var $userReason = $( this );
176
 
177
  setTimeout( function() {
178
  if ( ! BwsModalIsReasonSelected( 'OTHER' ) ) {
@@ -181,7 +186,15 @@ if ( ! function_exists( 'bws_add_deactivation_feedback_dialog_box' ) ) {
181
  }, 150 );
182
  });
183
 
184
- $modal.on( 'click', '.bws-modal-footer .button', function( evt ) {
 
 
 
 
 
 
 
 
185
  evt.preventDefault();
186
 
187
  if ( $( this ).hasClass( 'disabled' ) ) {
@@ -189,66 +202,59 @@ if ( ! function_exists( 'bws_add_deactivation_feedback_dialog_box' ) ) {
189
  }
190
 
191
  var _parent = $( this ).parents( '.bws-modal:first' ),
192
- _this = $( this );
193
-
194
- if ( _this.hasClass( 'allow-deactivate' ) ) {
195
- var $radio = $modal.find( 'input[type="radio"]:checked' );
196
 
197
- if ( 0 === $radio.length ) {
198
- /* If no selected reason, just deactivate the plugin. */
199
- window.location.href = $deactivateLink.attr( 'href' );
200
- return;
201
- }
202
 
203
- var $selected_reason = $radio.parents( 'li:first' ),
204
- $input = $selected_reason.find( 'textarea, input[type="text"]' ),
205
- userReason = ( 0 !== $input.length ) ? $input.val().trim() : '';
206
-
207
- var is_anonymous = ( $anonymousFeedback.find( 'input' ).is( ':checked' ) ) ? 0 : 1;
208
-
209
- $.ajax({
210
- url : ajaxurl,
211
- method : 'POST',
212
- data : {
213
- 'action' : 'bws_submit_uninstall_reason_action',
214
- 'plugin' : '<?php echo $basename; ?>',
215
- 'reason_id' : $radio.val(),
216
- 'reason_info' : userReason,
217
- 'is_anonymous' : is_anonymous,
218
- 'bws_ajax_nonce' : '<?php echo wp_create_nonce( 'bws_ajax_nonce' ); ?>'
219
- },
220
- beforeSend: function() {
221
- _parent.find( '.bws-modal-footer .button' ).addClass( 'disabled' );
222
- _parent.find( '.bws-modal-footer .button-secondary' ).text( '<?php _e( 'Processing', 'bestwebsoft' ); ?>' + '...' );
223
- },
224
- complete : function( message ) {
225
- /* Do not show the dialog box, deactivate the plugin. */
226
- window.location.href = $deactivateLink.attr( 'href' );
227
- }
228
- });
229
- } else if ( _this.hasClass( 'bws-modal-button-deactivate' ) ) {
230
- /* Change the Deactivate button's text and show the reasons panel. */
231
- _parent.find( '.bws-modal-button-deactivate' ).addClass( 'allow-deactivate' );
232
- BwsModalShowPanel();
233
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  });
235
 
236
- $modal.on( 'click', 'input[type="radio"]', function() {
237
- var $selectedReasonOption = $( this );
238
 
239
  /* If the selection has not changed, do not proceed. */
240
- if ( selectedReasonID === $selectedReasonOption.val() )
241
  return;
242
 
243
- selectedReasonID = $selectedReasonOption.val();
244
 
245
- $anonymousFeedback.show();
246
 
247
  var _parent = $( this ).parents( 'li:first' );
248
 
249
- $modal.find( '.bws-modal-reason-input' ).remove();
250
- $modal.find( '.bws-modal-internal-message' ).hide();
251
- $modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Submit and Deactivate', 'bestwebsoft' ); ?>' );
252
 
253
  BwsModalEnableDeactivateButton();
254
 
@@ -257,33 +263,33 @@ if ( ! function_exists( 'bws_add_deactivation_feedback_dialog_box' ) ) {
257
  }
258
 
259
  if (_parent.hasClass('has-input')) {
260
- var reasonInputHtml = '<div class="bws-modal-reason-input"><span class="message"></span>' + ( ( 'textfield' === _parent.data( 'input-type' ) ) ? '<input type="text" />' : '<textarea rows="5" maxlength="200"></textarea>' ) + '</div>';
261
 
262
  _parent.append( $( reasonInputHtml ) );
263
  _parent.find( 'input, textarea' ).attr( 'placeholder', _parent.data( 'input-placeholder' ) ).focus();
264
 
265
  if ( BwsModalIsReasonSelected( 'OTHER' ) ) {
266
- $modal.find( '.message' ).text( '<?php _e( 'Please tell us the reason so we can improve it.', 'bestwebsoft' ); ?>' ).show();
267
  }
268
  }
269
  });
270
 
271
  /* If the user has clicked outside the window, cancel it. */
272
- $modal.on( 'click', function( evt ) {
273
- var $target = $( evt.target );
274
 
275
  /* If the user has clicked anywhere in the modal dialog, just return. */
276
- if ( $target.hasClass( 'bws-modal-body' ) || $target.hasClass( 'bws-modal-footer' ) ) {
277
  return;
278
  }
279
 
280
  /* If the user has not clicked the close button and the clicked element is inside the modal dialog, just return. */
281
- if ( ! $target.hasClass( 'bws-modal-button-close' ) && ( $target.parents( '.bws-modal-body' ).length > 0 || $target.parents( '.bws-modal-footer' ).length > 0 ) ) {
282
  return;
283
  }
284
 
285
  /* Close the modal dialog */
286
- $modal.removeClass( 'active' );
287
  $( 'body' ).removeClass( 'has-bws-modal' );
288
 
289
  return false;
@@ -292,47 +298,47 @@ if ( ! function_exists( 'bws_add_deactivation_feedback_dialog_box' ) ) {
292
 
293
  function BwsModalIsReasonSelected( reasonID ) {
294
  /* Get the selected radio input element.*/
295
- return ( reasonID == $modal.find('input[type="radio"]:checked').val() );
296
  }
297
 
298
  function BwsModalReset() {
299
- selectedReasonID = false;
300
-
301
- BwsModalEnableDeactivateButton();
302
 
303
  /* Uncheck all radio buttons.*/
304
- $modal.find( 'input[type="radio"]' ).prop( 'checked', false );
305
 
306
  /* Remove all input fields ( textfield, textarea ).*/
307
- $modal.find( '.bws-modal-reason-input' ).remove();
308
 
309
- $modal.find( '.message' ).hide();
310
 
311
  /* Hide, since by default there is no selected reason.*/
312
- $anonymousFeedback.hide();
313
 
314
- var $deactivateButton = $modal.find( '.bws-modal-button-deactivate' );
315
 
316
- $deactivateButton.addClass( 'allow-deactivate' );
317
  BwsModalShowPanel();
318
  }
319
 
320
  function BwsModalEnableDeactivateButton() {
321
- $modal.find( '.bws-modal-button-deactivate' ).removeClass( 'disabled' );
 
322
  }
323
 
324
  function BwsModalDisableDeactivateButton() {
325
- $modal.find( '.bws-modal-button-deactivate' ).addClass( 'disabled' );
326
  }
327
 
328
  function BwsModalShowPanel() {
329
- $modal.find( '.bws-modal-panel' ).addClass( 'active' );
330
- /* Update the deactivate button's text */
331
- $modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Skip and Deactivate', 'bestwebsoft' ); ?>' );
332
  }
333
- })(jQuery);
334
- </script>
335
- <?php }
 
 
 
 
336
  }
337
  }
338
 
@@ -347,14 +353,14 @@ if ( ! function_exists( 'bws_submit_uninstall_reason_action' ) ) {
347
 
348
  wp_verify_nonce( $_REQUEST['bws_ajax_nonce'], 'bws_ajax_nonce' );
349
 
350
- $reason_id = isset( $_REQUEST['reason_id'] ) ? stripcslashes( esc_html( $_REQUEST['reason_id'] ) ) : '';
351
- $basename = isset( $_REQUEST['plugin'] ) ? stripcslashes( esc_html( $_REQUEST['plugin'] ) ) : '';
352
 
353
  if ( empty( $reason_id ) || empty( $basename ) ) {
354
  exit;
355
  }
356
 
357
- $reason_info = isset( $_REQUEST['reason_info'] ) ? stripcslashes( esc_html( $_REQUEST['reason_info'] ) ) : '';
358
  if ( ! empty( $reason_info ) ) {
359
  $reason_info = substr( $reason_info, 0, 255 );
360
  }
@@ -384,7 +390,7 @@ if ( ! function_exists( 'bws_submit_uninstall_reason_action' ) ) {
384
  }
385
 
386
  /* send data */
387
- $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/products-statistics/deactivation-feedback/', array(
388
  'method' => 'POST',
389
  'body' => $options,
390
  'timeout' => 15,
17
  function bws_add_deactivation_feedback_dialog_box() {
18
  global $bstwbsftwppdtplgns_active_plugins;
19
  if ( empty( $bstwbsftwppdtplgns_active_plugins ) )
20
+ return;
21
+
22
+ $contact_support_template = __( 'Need help? We are ready to answer your questions.', 'bestwebsoft' ) . ' <a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . __( 'Contact Support', 'bestwebsoft' ) . '</a>';
23
+
24
+ $reasons = array(
25
+ array(
26
+ 'id' => 'NOT_WORKING',
27
+ 'text' => __( 'The plugin is not working', 'bestwebsoft' ),
28
+ 'input_type' => 'textarea',
29
+ 'input_placeholder' => esc_attr__( "Kindly share what didn't work so we can fix it in future updates...", 'bestwebsoft' )
30
+ ),
31
+ array(
32
+ 'id' => 'DIDNT_WORK_AS_EXPECTED',
33
+ 'text' => __( "The plugin didn't work as expected", 'bestwebsoft' ),
34
+ 'input_type' => 'textarea',
35
+ 'input_placeholder' => esc_attr__( 'What did you expect?', 'bestwebsoft' )
36
+ ),
37
+ array(
38
+ 'id' => 'SUDDENLY_STOPPED_WORKING',
39
+ 'text' => __( 'The plugin suddenly stopped working', 'bestwebsoft' ),
40
+ 'input_type' => '',
41
+ 'input_placeholder' => '',
42
+ 'internal_message' => $contact_support_template
43
+ ),
44
+ array(
45
+ 'id' => 'BROKE_MY_SITE',
46
+ 'text' => __( 'The plugin broke my site', 'bestwebsoft' ),
47
+ 'input_type' => '',
48
+ 'input_placeholder' => '',
49
+ 'internal_message' => $contact_support_template
50
+ ),
51
+ array(
52
+ 'id' => 'COULDNT_MAKE_IT_WORK',
53
+ 'text' => __( "I couldn't understand how to get it work", 'bestwebsoft' ),
54
+ 'input_type' => '',
55
+ 'input_placeholder' => '',
56
+ 'internal_message' => $contact_support_template
57
+ ),
58
+ array(
59
+ 'id' => 'FOUND_A_BETTER_PLUGIN',
60
+ 'text' => __( 'I found a better plugin', 'bestwebsoft' ),
61
+ 'input_type' => 'textfield',
62
+ 'input_placeholder' => esc_attr__( "What's the plugin name?", 'bestwebsoft' )
63
+ ),
64
+ array(
65
+ 'id' => 'GREAT_BUT_NEED_SPECIFIC_FEATURE',
66
+ 'text' => __( "The plugin is great, but I need specific feature that you don't support", 'bestwebsoft' ),
67
+ 'input_type' => 'textarea',
68
+ 'input_placeholder' => esc_attr__( 'What feature?', 'bestwebsoft' )
69
+ ),
70
+ array(
71
+ 'id' => 'NO_LONGER_NEEDED',
72
+ 'text' => __( 'I no longer need the plugin', 'bestwebsoft' ),
73
+ 'input_type' => '',
74
+ 'input_placeholder' => ''
75
+ ),
76
+ array(
77
+ 'id' => 'TEMPORARY_DEACTIVATION',
78
+ 'text' => __( "It's a temporary deactivation, I'm just debugging an issue", 'bestwebsoft' ),
79
+ 'input_type' => '',
80
+ 'input_placeholder' => ''
81
+ ),
82
+ array(
83
+ 'id' => 'OTHER',
84
+ 'text' => __( 'Other', 'bestwebsoft' ),
85
+ 'input_type' => 'textfield',
86
+ 'input_placeholder' => ''
87
+ )
88
+ );
89
+
90
+ $modal_html = '<div class="bws-modal bws-modal-deactivation-feedback">
91
+ <div class="bws-modal-dialog">
92
+ <div class="bws-modal-body">
93
+ <h2>' . __( 'Quick Feedback', 'bestwebsoft' ) . '</h2>
94
+ <div class="bws-modal-panel active">
95
+ <p>' . __( 'If you have a moment, please let us know why you are deactivating', 'bestwebsoft' ) . ":</p><ul>";
96
+
97
+ foreach ( $reasons as $reason ) {
98
+ $list_item_classes = 'bws-modal-reason' . ( ! empty( $reason['input_type'] ) ? ' has-input' : '' );
99
+
100
+ if ( ! empty( $reason['internal_message'] ) ) {
101
+ $list_item_classes .= ' has-internal-message';
102
+ $reason_internal_message = $reason['internal_message'];
103
+ } else {
104
+ $reason_internal_message = '';
105
+ }
106
+
107
+ $modal_html .= '<li class="' . $list_item_classes . '" data-input-type="' . $reason['input_type'] . '" data-input-placeholder="' . $reason['input_placeholder'] . '">
108
+ <label>
109
+ <span>
110
+ <input type="radio" name="selected-reason" value="' . $reason['id'] . '"/>
111
+ </span>
112
+ <span>' . $reason['text'] . '</span>
113
+ </label>
114
+ <div class="bws-modal-internal-message">' . $reason_internal_message . '</div>
115
+ </li>';
116
+ }
117
+ $modal_html .= '</ul>
118
+ <label class="bws-modal-anonymous-label">
119
+ <input type="checkbox" />' .
120
+ __( 'Send website data and allow to contact me back', 'bestwebsoft' ) .
121
+ '</label>
122
+ </div>
123
+ </div>
124
+ <div class="bws-modal-footer">
125
+ <a href="#" class="button button-primary bws-modal-button-deactivate disabled">' . __( 'Submit and Deactivate', 'bestwebsoft' ) . '</a>
126
+ <a href="#" class="bws-modal-skip-link">' . __( 'Skip and Deactivate', 'bestwebsoft' ) . '</a>
127
+ <span class="bws-modal-processing hidden">' . __( 'Processing', 'bestwebsoft' ) . '...</span>
128
+ <div class="clear"></div>
129
+ </div>
130
+ </div>