Contact Form by BestWebSoft - Version 4.1.2

Version Description

  • 26.02.2019 =
  • Update : The plugin settings page has been changed.
Download this release

Release Info

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

Code changes from version 4.1.1 to 4.1.2

Files changed (41) hide show
  1. bws_menu/bws_functions.php +8 -8
  2. bws_menu/bws_menu.php +219 -216
  3. bws_menu/class-bws-settings.php +511 -465
  4. bws_menu/js/bws_menu.js +1 -1
  5. bws_menu/languages/bestwebsoft-cs_CZ.mo +0 -0
  6. bws_menu/languages/bestwebsoft-cs_CZ.po +43 -107
  7. bws_menu/languages/bestwebsoft-fr_FR.mo +0 -0
  8. bws_menu/languages/bestwebsoft-fr_FR.po +259 -1169
  9. bws_menu/languages/bestwebsoft-ru_RU.mo +0 -0
  10. bws_menu/languages/bestwebsoft-ru_RU.po +1 -1
  11. bws_menu/product_list.php +20 -2
  12. contact_form.php +83 -1809
  13. css/icon_style.css +8 -0
  14. css/style.css +29 -16
  15. includes/class-cntctfrm-settings.php +1782 -0
  16. includes/pro_banners.php +0 -0
  17. js/script.js +6 -6
  18. languages/contact-form-plugin-af_ZA.mo +0 -0
  19. languages/contact-form-plugin-af_ZA.po +494 -410
  20. languages/contact-form-plugin-ca.mo +0 -0
  21. languages/contact-form-plugin-ca.po +485 -411
  22. languages/contact-form-plugin-cs_CZ.mo +0 -0
  23. languages/contact-form-plugin-cs_CZ.po +549 -429
  24. languages/contact-form-plugin-da_DK.mo +0 -0
  25. languages/contact-form-plugin-da_DK.po +560 -443
  26. languages/contact-form-plugin-de_DE.mo +0 -0
  27. languages/contact-form-plugin-de_DE.po +493 -409
  28. languages/contact-form-plugin-el.mo +0 -0
  29. languages/contact-form-plugin-el.po +536 -444
  30. languages/contact-form-plugin-es_ES.mo +0 -0
  31. languages/contact-form-plugin-es_ES.po +536 -421
  32. languages/contact-form-plugin-et.mo +0 -0
  33. languages/contact-form-plugin-et.po +493 -410
  34. languages/contact-form-plugin-fr_FR.mo +0 -0
  35. languages/contact-form-plugin-fr_FR.po +541 -426
  36. languages/contact-form-plugin-id_ID.mo +0 -0
  37. languages/contact-form-plugin-id_ID.po +543 -424
  38. languages/contact-form-plugin-ja.mo +0 -0
  39. languages/contact-form-plugin-ja.po +505 -413
  40. languages/contact-form-plugin-nb_NO.mo +0 -0
  41. languages/contact-form-plugin-nb_NO.po +263 -108
bws_menu/bws_functions.php CHANGED
@@ -91,7 +91,7 @@ if ( ! function_exists( 'bws_plugin_reviews_block' ) ) {
91
  <div class="bws-plugin-reviews-rate">
92
  <?php _e( 'Like the plugin?', 'bestwebsoft' ); ?>
93
  <a href="https://wordpress.org/support/view/plugin-reviews/<?php echo esc_attr( $plugin_slug ); ?>?filter=5" target="_blank" title="<?php printf( __( '%s reviews', 'bestwebsoft' ), sanitize_text_field( $plugin_name ) ); ?>">
94
- <?php _e( 'Rate it', 'bestwebsoft' ); ?>
95
  <span class="dashicons dashicons-star-filled"></span>
96
  <span class="dashicons dashicons-star-filled"></span>
97
  <span class="dashicons dashicons-star-filled"></span>
@@ -261,8 +261,8 @@ if ( ! function_exists( 'bws_admin_notices' ) ) {
261
  */
262
  if ( ! empty( $bstwbsftwppdtplgns_options['deprecated_function'] ) ) { ?>
263
  <div class="update-nag">
264
- <strong><?php _e( 'Deprecated function(-s) is used on the site here:', 'bestwebsoft' ); ?></strong>
265
- <?php $i = 1;
266
  foreach ( $bstwbsftwppdtplgns_options['deprecated_function'] as $function_name => $attr ) {
267
  if ( 1 != $i )
268
  echo ' ,';
@@ -275,8 +275,8 @@ if ( ! function_exists( 'bws_admin_notices' ) ) {
275
  $i++;
276
  } ?>.
277
  <br/>
278
- <?php _e( 'This function(-s) will be removed over time. Please update the product(-s).', 'bestwebsoft' ); ?>
279
- </div>
280
  <?php if ( is_multisite() )
281
  update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
282
  else
@@ -594,7 +594,7 @@ if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) ) {
594
  add_thickbox();
595
  wp_enqueue_script( 'plugin-install' );
596
  }
597
-
598
  if ( 'plugins.php' == $hook_suffix && ! defined( 'DOING_AJAX' ) ) {
599
  wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
600
  }
@@ -887,7 +887,7 @@ if ( ! function_exists( 'bws_shortcode_media_button_popup' ) ) {
887
  }
888
  }
889
 
890
- /**
891
  * output shortcode in a special block
892
  * @since 1.9.8
893
  */
@@ -897,7 +897,7 @@ if ( ! function_exists( 'bws_shortcode_output' ) ) {
897
  <?php }
898
  }
899
 
900
- /**
901
  * output tooltip
902
  * @since 1.9.8
903
  * @param string $content - HTML content for the tooltip
91
  <div class="bws-plugin-reviews-rate">
92
  <?php _e( 'Like the plugin?', 'bestwebsoft' ); ?>
93
  <a href="https://wordpress.org/support/view/plugin-reviews/<?php echo esc_attr( $plugin_slug ); ?>?filter=5" target="_blank" title="<?php printf( __( '%s reviews', 'bestwebsoft' ), sanitize_text_field( $plugin_name ) ); ?>">
94
+ <?php _e( 'Rate it', 'bestwebsoft' ); ?>
95
  <span class="dashicons dashicons-star-filled"></span>
96
  <span class="dashicons dashicons-star-filled"></span>
97
  <span class="dashicons dashicons-star-filled"></span>
261
  */
262
  if ( ! empty( $bstwbsftwppdtplgns_options['deprecated_function'] ) ) { ?>
263
  <div class="update-nag">
264
+ <strong><?php _e( 'Deprecated function(-s) is used on the site here:', 'bestwebsoft' ); ?></strong>
265
+ <?php $i = 1;
266
  foreach ( $bstwbsftwppdtplgns_options['deprecated_function'] as $function_name => $attr ) {
267
  if ( 1 != $i )
268
  echo ' ,';
275
  $i++;
276
  } ?>.
277
  <br/>
278
+ <?php _e( 'This function(-s) will be removed over time. Please update the product(-s).', 'bestwebsoft' ); ?>
279
+ </div>
280
  <?php if ( is_multisite() )
281
  update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
282
  else
594
  add_thickbox();
595
  wp_enqueue_script( 'plugin-install' );
596
  }
597
+
598
  if ( 'plugins.php' == $hook_suffix && ! defined( 'DOING_AJAX' ) ) {
599
  wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
600
  }
887
  }
888
  }
889
 
890
+ /**
891
  * output shortcode in a special block
892
  * @since 1.9.8
893
  */
897
  <?php }
898
  }
899
 
900
+ /**
901
  * output tooltip
902
  * @since 1.9.8
903
  * @param string $content - HTML content for the tooltip
bws_menu/bws_menu.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * Function for displaying BestWebSoft menu
4
- * Version: 2.1.5
5
  */
6
 
7
  if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) )
@@ -13,8 +13,8 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
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'] ) : '';
@@ -66,7 +66,7 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
66
  }
67
  /* check expired */
68
  if ( $is_pro_installed && isset( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) &&
69
- strtotime( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) < strtotime( date( "m/d/Y" ) ) ) {
70
  unset( $bws_plugins[ $key_plugin ] );
71
  $value_plugin['expired'] = $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ];
72
  $bws_plugins_expired[ $key_plugin ] = $value_plugin;
@@ -157,7 +157,7 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
157
  if ( is_multisite() )
158
  update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
159
  else
160
- update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
161
  }
162
  } else {
163
  $error = __( "Please enter your license key.", 'bestwebsoft' );
@@ -167,11 +167,11 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
167
 
168
  $all_plugins = get_plugins();
169
  $active_plugins = get_option( 'active_plugins' );
170
- $mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
171
- if ( is_array( $mysql_info ) )
172
- $sql_mode = $mysql_info[0]->Value;
173
- if ( empty( $sql_mode ) )
174
- $sql_mode = __( 'Not set', 'bestwebsoft' );
175
 
176
  $allow_url_fopen = ( ini_get( 'allow_url_fopen' ) ) ? __( 'On', 'bestwebsoft' ) : __( 'Off', 'bestwebsoft' );
177
  $upload_max_filesize = ( ini_get( 'upload_max_filesize' ) )? ini_get( 'upload_max_filesize' ) : __( 'N/A', 'bestwebsoft' );
@@ -290,82 +290,82 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
290
  }
291
  }
292
  } ?>
293
- <div class="bws-wrap">
294
- <div class="bws-header">
295
- <div class="bws-title">
296
- <a href="<?php echo ( $is_main_page ) ? self_admin_url( 'admin.php?page=bws_panel' ) : esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>">
297
- <span class="bws-logo bwsicons bwsicons-bws-logo"></span>
298
- BestWebSoft
299
- <span>panel</span>
300
- </a>
301
- </div>
302
- <div class="bws-menu-item-icon">&#8226;&#8226;&#8226;</div>
303
- <div class="bws-nav-tab-wrapper">
304
  <?php if ( $is_main_page ) { ?>
305
- <a class="bws-nav-tab<?php if ( 'bws_panel' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_panel' ); ?>"><?php _e( 'Plugins', 'bestwebsoft' ); ?></a>
306
- <a class="bws-nav-tab<?php if ( 'bws_themes' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_themes' ); ?>"><?php _e( 'Themes', 'bestwebsoft' ); ?></a>
307
- <a class="bws-nav-tab<?php if ( 'bws_system_status' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_system_status' ); ?>"><?php _e( 'System status', 'bestwebsoft' ); ?></a>
308
  <?php } else { ?>
309
- <a class="bws-nav-tab<?php if ( ! isset( $_GET['tab'] ) ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>"><?php _e( 'Plugins', 'bestwebsoft' ); ?></a>
310
- <a class="bws-nav-tab<?php if ( 'themes' == $tab ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=themes' ) ); ?>"><?php _e( 'Themes', 'bestwebsoft' ); ?></a>
311
- <a class="bws-nav-tab<?php if ( 'system-status' == $tab ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=system-status' ) ); ?>"><?php _e( 'System status', 'bestwebsoft' ); ?></a>
312
  <?php } ?>
313
- </div>
314
- <div class="bws-help-links-wrapper">
315
- <a href="https://support.bestwebsoft.com" target="_blank"><?php _e( 'Support', 'bestwebsoft' ); ?></a>
316
- <a href="https://bestwebsoft.com/client-area" target="_blank" title="<?php _e( 'Manage purchased licenses & subscriptions', 'bestwebsoft' ); ?>">Client Area</a>
317
- </div>
318
- <div class="clear"></div>
319
- </div>
320
  <?php if ( ( 'bws_panel' == $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) && ! isset( $_POST['bws_plugin_action_submit'] ) ) { ?>
321
- <div class="bws-membership-wrap">
322
- <div class="bws-membership-backround"></div>
323
- <div class="bws-membership">
324
- <div class="bws-membership-title"><?php printf( __( 'Get Access to %s+ Premium Plugins', 'bestwebsoft' ), '30' ); ?></div>
325
- <form class="bws-membership-form" method="post" action="">
326
- <span class="bws-membership-link"><a target="_blank" href="https://bestwebsoft.com/membership/"><?php _e( 'Subscribe to Pro Membership', 'bestwebsoft' ); ?></a> <?php _e( 'or', 'bestwebsoft' ); ?></span>
327
  <?php if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) &&
328
- '5' < $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] &&
329
- $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) { ?>
330
- <div class="bws_form_input_wrap">
331
- <input disabled="disabled" type="text" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key); ?>" />
332
- <div class="bws_error"><?php _e( "Unfortunately, you have exceeded the number of available tries per day.", 'bestwebsoft' ); ?></div>
333
- </div>
334
- <input disabled="disabled" type="submit" class="bws-button" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
335
  <?php } else { ?>
336
- <div class="bws_form_input_wrap">
337
- <input <?php if ( "" != $error ) echo 'class="bws_input_error"'; ?> type="text" placeholder="<?php _e( 'Enter your license key', 'bestwebsoft' ); ?>" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
338
- <div class="bws_error" <?php if ( "" == $error ) echo 'style="display:none"'; ?>><?php echo $error; ?></div>
339
- </div>
340
- <input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $bws_license_plugin ); ?>" />
341
- <input type="hidden" name="bws_license_submit" value="submit" />
342
  <?php if ( empty( $plugins_array ) ) { ?>
343
- <input type="submit" class="bws-button" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
344
  <?php } else { ?>
345
- <input type="submit" class="bws-button" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
346
  <?php } ?>
347
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_nonce_name' ); ?>
348
  <?php } ?>
349
- </form>
350
- <div class="clear"></div>
351
- </div>
352
- </div>
353
  <?php } ?>
354
- <div class="bws-wrap-content wrap">
355
  <?php if ( 'bws_panel' == $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) { ?>
356
- <div class="updated notice is-dismissible inline" <?php if ( '' == $message || '' != $error ) echo 'style="display:none"'; ?>><p><?php echo $message; ?></p></div>
357
- <h1>
358
  <?php _e( 'Plugins', 'bestwebsoft' ); ?>
359
- <a href="<?php echo self_admin_url( 'plugin-install.php?tab=upload' ); ?>" class="upload page-title-action add-new-h2"><?php _e( 'Upload Plugin', 'bestwebsoft' ); ?></a>
360
- </h1>
361
  <?php if ( isset( $_GET['error'] ) ) {
362
  if ( isset( $_GET['charsout'] ) )
363
  $errmsg = sprintf( __( 'The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ), $_GET['charsout'] );
364
  else
365
  $errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' ); ?>
366
- <div id="message" class="error is-dismissible"><p><?php echo $errmsg; ?></p></div>
367
  <?php } elseif ( isset( $_GET['activate'] ) ) { ?>
368
- <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>activated</strong>.' ) ?></p></div>
369
  <?php }
370
 
371
  if ( isset( $_POST['bws_plugin_action_submit'] ) && isset( $_POST['bws_install_plugin'] ) && check_admin_referer( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ) ) {
@@ -442,47 +442,47 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
442
  echo '<p class="error">' . $error . '</p>';
443
  echo '<p><a href="' . esc_url( self_admin_url( $current_page ) ) . '" target="_parent">' . __( 'Return to BestWebSoft Panel', 'bestwebsoft' ) . '</a></p>';
444
  }
445
- } else {
446
  $category_href = $current_page;
447
  if ( 'all' != $plugin_category )
448
  $category_href .= '&category=' . $plugin_category; ?>
449
- <ul class="subsubsub">
450
- <li>
451
- <a <?php if ( ! isset( $_GET['sub'] ) ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?></a>
452
- </li> |
453
- <li>
454
- <a <?php if ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href . '&sub=installed' ) ); ?>"><?php _e( 'Installed', 'bestwebsoft' ); ?></a>
455
- </li> |
456
- <li>
457
- <a <?php if ( isset( $_GET['sub'] ) && 'not_installed' == $_GET['sub'] ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href . '&sub=not_installed' ) ); ?>"><?php _e( 'Not Installed', 'bestwebsoft' ); ?></a>
458
- </li>
459
- </ul>
460
- <div class="clear"></div>
461
- <div class="bws-filter-top">
462
- <h2>
463
- <span class="bws-toggle-indicator"></span>
464
  <?php _e( 'Filter results', 'bestwebsoft' ); ?>
465
- </h2>
466
- <div class="bws-filter-top-inside">
467
- <div class="bws-filter-title"><?php _e( 'Category', 'bestwebsoft' ); ?></div>
468
- <ul class="bws-category">
469
- <li>
470
  <?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( $_GET['sub'], array( 'installed', 'not_installed' ) ) ) ? '&sub=' . $_GET['sub'] : ''; ?>
471
- <a <?php if ( 'all' == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url(self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?>
472
- <span>(<?php echo count( $bws_plugins ); ?>)</span>
473
- </a>
474
- </li>
475
  <?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
476
- <li>
477
- <a <?php if ( $category_key == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo $category_value['name']; ?>
478
- <span>(<?php echo $category_value['count']; ?>)</span>
479
- </a>
480
- </li>
481
  <?php } ?>
482
- </ul>
483
- </div>
484
- </div>
485
- <div class="bws-products">
486
  <?php $nothing_found = true;
487
  foreach ( $bws_plugins as $key_plugin => $value_plugin ) {
488
 
@@ -503,19 +503,19 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
503
  }
504
 
505
  if ( ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] && ! $is_pro_installed && ! $is_installed ) ||
506
- ( isset( $_GET['sub'] ) && 'not_installed' == $_GET['sub'] && ( $is_pro_installed || $is_installed ) ) )
507
  continue;
508
 
509
  $link_attr = isset( $value_plugin['install_url'] ) ? 'href="' . esc_url( $value_plugin['install_url'] ) . '" target="_blank"' : 'href="' . esc_url( self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $key_plugin_explode[0] . '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal"';
510
 
511
  $nothing_found = false; ?>
512
- <div class="bws_product_box<?php if ( $is_active || $is_pro_active ) echo ' bws_product_active'; ?>">
513
- <div class="bws_product_image">
514
- <a <?php echo $link_attr; ?>><img src="<?php echo $icon; ?>"/></a>
515
- </div>
516
- <div class="bws_product_content">
517
- <div class="bws_product_title"><a <?php echo $link_attr; ?>><?php echo $value_plugin['name']; ?></a></div>
518
- <div class="bws-version">
519
  <?php
520
  if ( $is_pro_installed ) {
521
  echo '<span';
@@ -537,158 +537,158 @@ if ( ! function_exists( 'bws_add_menu_render' ) ) {
537
  $r = $update_availible_all->response[ $value_plugin['update_availible'] ];
538
  echo ' - <a class="bws-update-now" href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $value_plugin['update_availible'] ), 'upgrade-plugin_' . $value_plugin['update_availible'] ) ) . '" class="update-link" aria-label="' . sprintf( __( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . '">' . sprintf( __( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . '</a>';
539
  } ?>
540
- </div>
541
- <div class="bws_product_description">
542
  <?php echo ( strlen( $value_plugin['description'] ) > 100 ) ? mb_substr( $value_plugin['description'], 0, 100 ) . '...' : $value_plugin['description']; ?>
543
- </div>
544
- <div class="bws_product_links">
545
  <?php if ( $is_active || $is_pro_active ) {
546
- if ( $is_pro_isset ) {
547
  if ( ! $is_pro_installed ) {
548
  if ( ! empty( $plugins_array ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
549
- <form method="post" action="">
550
- <input type="submit" class="button button-secondary" value="<?php _e( 'Install Now', 'bestwebsoft' ); ?>" />
551
- <input type="hidden" name="bws_plugin_action_submit" value="submit" />
552
- <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
553
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
554
- </form>
555
  <?php } else { ?>
556
- <a class="button button-secondary bws_upgrade_button" href="<?php echo esc_url( $bws_plugins[ $key_plugin ]['purchase'] ); ?>" target="_blank"><?php _e( 'Upgrade to Pro', 'bestwebsoft' ); ?></a>
557
  <?php }
558
  }
559
  } else { ?>
560
- <a class="bws_donate" href="https://bestwebsoft.com/donate/" target="_blank"><?php _e( 'Donate', 'bestwebsoft' ); ?></a> <span>|</span>
561
  <?php }
562
 
563
  if ( $is_pro_active ) { ?>
564
- <a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]["pro_settings"] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a>
565
  <?php } else { ?>
566
- <a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]["settings"] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a>
567
  <?php }
568
  } else {
569
  if ( $is_pro_installed ) { ?>
570
- <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>
571
  <?php } elseif ( ! empty( $plugins_array ) && isset( $value_plugin['pro_version'] ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
572
- <form method="post" action="">
573
- <input type="submit" class="button button-secondary" value="<?php _e( 'Install Now', 'bestwebsoft' ); ?>" />
574
- <input type="hidden" name="bws_plugin_action_submit" value="submit" />
575
- <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
576
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
577
- </form>
578
  <?php } elseif ( $is_installed ) { ?>
579
- <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>
580
  <?php } else {
581
  $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' ); ?>
582
- <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>
583
  <?php }
584
  } ?>
585
- </div>
586
- </div>
587
- <div class="clear"></div>
588
- </div>
589
  <?php }
590
  if ( $nothing_found ) { ?>
591
- <p class="description"><?php _e( 'Nothing found. Try another criteria.', 'bestwebsoft' ); ?></p>
592
  <?php } ?>
593
- </div>
594
- <div id="bws-filter-wrapper">
595
- <div class="bws-filter">
596
- <div class="bws-filter-title"><?php _e( 'Category', 'bestwebsoft' ); ?></div>
597
- <ul class="bws-category">
598
- <li>
599
  <?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( $_GET['sub'], array( 'installed', 'not_installed' ) ) ) ? '&sub=' . $_GET['sub'] : ''; ?>
600
- <a <?php if ( 'all' == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?>
601
- <span>(<?php echo count( $bws_plugins ); ?>)</span>
602
- </a>
603
- </li>
604
  <?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
605
- <li>
606
- <a <?php if ( $category_key == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo $category_value['name']; ?>
607
- <span>(<?php echo $category_value['count']; ?>)</span>
608
- </a>
609
- </li>
610
  <?php } ?>
611
- </ul>
612
- </div>
613
- </div><!-- #bws-filter-wrapper -->
614
- <div class="clear"></div>
615
  <?php }
616
  } elseif ( 'bws_themes' == $page || 'themes' == $tab ) {
617
  require( dirname( __FILE__ ) . '/product_list.php' ); ?>
618
- <h1><?php _e( 'Themes', 'bestwebsoft' ); ?></h1>
619
- <div id="availablethemes" class="bws-availablethemes">
620
- <div class="theme-browser content-filterable rendered">
621
- <div class="themes wp-clearfix">
622
  <?php foreach ( $themes as $key => $theme ) {
623
  $installed_theme = wp_get_theme( $theme->slug ); ?>
624
- <div class="theme" tabindex="0">
625
- <div class="theme-screenshot">
626
- <img src="<?php echo bws_menu_url( "icons/themes/" ) . $theme->slug . '.png'; ?>" alt="" />
627
- </div>
628
- <div class="theme-author"><?php printf( __( 'By %s', 'bestwebsoft' ), 'BestWebSoft' ); ?></div>
629
- <h3 class="theme-name"><?php echo $theme->name; ?></h3>
630
- <div class="theme-actions">
631
- <a class="button button-secondary preview install-theme-preview" href="<?php echo esc_url( $theme->href ); ?>" target="_blank"><?php _e( 'Learn More', 'bestwebsoft' ); ?></a>
632
- </div>
633
  <?php if ( $installed_theme->exists() ) {
634
  if ( $wp_version < '4.6' ) { ?>
635
- <div class="theme-installed"><?php _e( 'Already Installed', 'bestwebsoft' ); ?></div>
636
  <?php } else { ?>
637
- <div class="notice notice-success notice-alt inline"><p><?php _e( 'Installed', 'bestwebsoft' ); ?></p></div>
638
  <?php }
639
  } ?>
640
- </div>
641
  <?php } ?>
642
- <br class="clear" />
643
- </div>
644
- </div>
645
- <p><a class="bws_browse_link" href="https://bestwebsoft.com/products/wordpress/themes/" target="_blank"><?php _e( 'Browse More WordPress Themes', 'bestwebsoft' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a></p>
646
- </div>
647
  <?php } elseif ( 'bws_system_status' == $page || 'system-status' == $tab ) { ?>
648
- <h1><?php _e( 'System status', 'bestwebsoft' ); ?></h1>
649
- <div class="updated fade notice is-dismissible inline" <?php if ( ! ( isset( $_REQUEST['bwsmn_form_submit'] ) || isset( $_REQUEST['bwsmn_form_submit_custom_email'] ) ) || $error != "" ) echo 'style="display:none"'; ?>><p><strong><?php echo $message; ?></strong></p></div>
650
- <div class="error" <?php if ( "" == $error ) echo 'style="display:none"'; ?>><p><strong><?php echo $error; ?></strong></p></div>
651
- <form method="post" action="">
652
- <p>
653
- <input type="hidden" name="bwsmn_form_submit" value="submit" />
654
- <input type="submit" class="button-primary" value="<?php _e( 'Send to support', 'bestwebsoft' ) ?>" />
655
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bwsmn_nonce_submit' ); ?>
656
- </p>
657
- </form>
658
- <form method="post" action="">
659
- <p>
660
- <input type="hidden" name="bwsmn_form_submit_custom_email" value="submit" />
661
- <input type="submit" class="button" value="<?php _e( 'Send to custom email &#187;', 'bestwebsoft' ) ?>" />
662
- <input type="text" maxlength="250" value="" name="bwsmn_form_email" />
663
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bwsmn_nonce_submit_custom_email' ); ?>
664
- </p>
665
- </form>
666
  <?php foreach ( $system_info as $info ) { ?>
667
- <table class="widefat bws-system-info" cellspacing="0">
668
- <thead>
669
- <tr>
670
- <th colspan="2">
671
- <strong>
672
- <?php echo $info['name'];
673
- if ( isset( $info['count'] ) )
674
- echo ' (' . $info['count'] . ')'; ?>
675
- </strong>
676
- </th>
677
- </tr>
678
- </thead>
679
- <tbody>
680
- <?php foreach ( $info['data'] as $key => $value ) { ?>
681
- <tr>
682
- <td scope="row"><?php echo $key; ?></td>
683
- <td scope="row"><?php echo $value; ?></td>
684
- </tr>
685
- <?php } ?>
686
- </tbody>
687
- </table>
688
  <?php }
689
  } ?>
690
- </div>
691
- </div>
692
  <?php }
693
  }
694
 
@@ -729,9 +729,12 @@ if ( ! function_exists( 'bws_get_banner_array' ) ) {
729
  array( 'gglstmp_hide_banner_on_plugin_page', 'google-sitemap-plugin/google-sitemap-plugin.php', '2.8.4' ),
730
  array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ),
731
  array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ),
732
- array( 'cptch_hide_banner_on_plugin_page', 'captcha/captcha.php', '3.8.4' ),
733
  array( 'gllr_hide_banner_on_plugin_page', 'gallery-plugin/gallery-plugin.php', '3.9.1' ),
734
- array( 'cntctfrm_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.62' )
 
 
 
735
  );
736
  }
737
  }
1
  <?php
2
  /*
3
  * Function for displaying BestWebSoft menu
4
+ * Version: 2.1.7
5
  */
6
 
7
  if ( ! function_exists ( 'bws_admin_enqueue_scripts' ) )
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'] ) : '';
66
  }
67
  /* check expired */
68
  if ( $is_pro_installed && isset( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) &&
69
+ strtotime( $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ] ) < strtotime( date( "m/d/Y" ) ) ) {
70
  unset( $bws_plugins[ $key_plugin ] );
71
  $value_plugin['expired'] = $bstwbsftwppdtplgns_options['time_out'][ $value_plugin['pro_version'] ];
72
  $bws_plugins_expired[ $key_plugin ] = $value_plugin;
157
  if ( is_multisite() )
158
  update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
159
  else
160
+ update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
161
  }
162
  } else {
163
  $error = __( "Please enter your license key.", 'bestwebsoft' );
167
 
168
  $all_plugins = get_plugins();
169
  $active_plugins = get_option( 'active_plugins' );
170
+ $mysql_info = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
171
+ if ( is_array( $mysql_info ) )
172
+ $sql_mode = $mysql_info[0]->Value;
173
+ if ( empty( $sql_mode ) )
174
+ $sql_mode = __( 'Not set', 'bestwebsoft' );
175
 
176
  $allow_url_fopen = ( ini_get( 'allow_url_fopen' ) ) ? __( 'On', 'bestwebsoft' ) : __( 'Off', 'bestwebsoft' );
177
  $upload_max_filesize = ( ini_get( 'upload_max_filesize' ) )? ini_get( 'upload_max_filesize' ) : __( 'N/A', 'bestwebsoft' );
290
  }
291
  }
292
  } ?>
293
+ <div class="bws-wrap">
294
+ <div class="bws-header">
295
+ <div class="bws-title">
296
+ <a href="<?php echo ( $is_main_page ) ? self_admin_url( 'admin.php?page=bws_panel' ) : esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>">
297
+ <span class="bws-logo bwsicons bwsicons-bws-logo"></span>
298
+ BestWebSoft
299
+ <span>panel</span>
300
+ </a>
301
+ </div>
302
+ <div class="bws-menu-item-icon">&#8226;&#8226;&#8226;</div>
303
+ <div class="bws-nav-tab-wrapper">
304
  <?php if ( $is_main_page ) { ?>
305
+ <a class="bws-nav-tab<?php if ( 'bws_panel' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_panel' ); ?>"><?php _e( 'Plugins', 'bestwebsoft' ); ?></a>
306
+ <a class="bws-nav-tab<?php if ( 'bws_themes' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_themes' ); ?>"><?php _e( 'Themes', 'bestwebsoft' ); ?></a>
307
+ <a class="bws-nav-tab<?php if ( 'bws_system_status' == $page ) echo ' bws-nav-tab-active'; ?>" href="<?php echo self_admin_url( 'admin.php?page=bws_system_status' ); ?>"><?php _e( 'System status', 'bestwebsoft' ); ?></a>
308
  <?php } else { ?>
309
+ <a class="bws-nav-tab<?php if ( ! isset( $_GET['tab'] ) ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>"><?php _e( 'Plugins', 'bestwebsoft' ); ?></a>
310
+ <a class="bws-nav-tab<?php if ( 'themes' == $tab ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=themes' ) ); ?>"><?php _e( 'Themes', 'bestwebsoft' ); ?></a>
311
+ <a class="bws-nav-tab<?php if ( 'system-status' == $tab ) echo ' bws-nav-tab-active'; ?>" href="<?php echo esc_url( self_admin_url( 'admin.php?page=' . $page . '&tab=system-status' ) ); ?>"><?php _e( 'System status', 'bestwebsoft' ); ?></a>
312
  <?php } ?>
313
+ </div>
314
+ <div class="bws-help-links-wrapper">
315
+ <a href="https://support.bestwebsoft.com" target="_blank"><?php _e( 'Support', 'bestwebsoft' ); ?></a>
316
+ <a href="https://bestwebsoft.com/client-area" target="_blank" title="<?php _e( 'Manage purchased licenses & subscriptions', 'bestwebsoft' ); ?>">Client Area</a>
317
+ </div>
318
+ <div class="clear"></div>
319
+ </div>
320
  <?php if ( ( 'bws_panel' == $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) && ! isset( $_POST['bws_plugin_action_submit'] ) ) { ?>
321
+ <div class="bws-membership-wrap">
322
+ <div class="bws-membership-backround"></div>
323
+ <div class="bws-membership">
324
+ <div class="bws-membership-title"><?php printf( __( 'Get Access to %s+ Premium Plugins', 'bestwebsoft' ), '30' ); ?></div>
325
+ <form class="bws-membership-form" method="post" action="">
326
+ <span class="bws-membership-link"><a target="_blank" href="https://bestwebsoft.com/membership/"><?php _e( 'Subscribe to Pro Membership', 'bestwebsoft' ); ?></a> <?php _e( 'or', 'bestwebsoft' ); ?></span>
327
  <?php if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) &&
328
+ '5' < $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] &&
329
+ $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) { ?>
330
+ <div class="bws_form_input_wrap">
331
+ <input disabled="disabled" type="text" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key); ?>" />
332
+ <div class="bws_error"><?php _e( "Unfortunately, you have exceeded the number of available tries per day.", 'bestwebsoft' ); ?></div>
333
+ </div>
334
+ <input disabled="disabled" type="submit" class="bws-button" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
335
  <?php } else { ?>
336
+ <div class="bws_form_input_wrap">
337
+ <input <?php if ( "" != $error ) echo 'class="bws_input_error"'; ?> type="text" placeholder="<?php _e( 'Enter your license key', 'bestwebsoft' ); ?>" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
338
+ <div class="bws_error" <?php if ( "" == $error ) echo 'style="display:none"'; ?>><?php echo $error; ?></div>
339
+ </div>
340
+ <input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $bws_license_plugin ); ?>" />
341
+ <input type="hidden" name="bws_license_submit" value="submit" />
342
  <?php if ( empty( $plugins_array ) ) { ?>
343
+ <input type="submit" class="bws-button" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
344
  <?php } else { ?>
345
+ <input type="submit" class="bws-button" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
346
  <?php } ?>
347
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_nonce_name' ); ?>
348
  <?php } ?>
349
+ </form>
350
+ <div class="clear"></div>
351
+ </div>
352
+ </div>
353
  <?php } ?>
354
+ <div class="bws-wrap-content wrap">
355
  <?php if ( 'bws_panel' == $page || ( ! isset( $_GET['tab'] ) && ! $is_main_page ) ) { ?>
356
+ <div class="updated notice is-dismissible inline" <?php if ( '' == $message || '' != $error ) echo 'style="display:none"'; ?>><p><?php echo $message; ?></p></div>
357
+ <h1>
358
  <?php _e( 'Plugins', 'bestwebsoft' ); ?>
359
+ <a href="<?php echo self_admin_url( 'plugin-install.php?tab=upload' ); ?>" class="upload page-title-action add-new-h2"><?php _e( 'Upload Plugin', 'bestwebsoft' ); ?></a>
360
+ </h1>
361
  <?php if ( isset( $_GET['error'] ) ) {
362
  if ( isset( $_GET['charsout'] ) )
363
  $errmsg = sprintf( __( 'The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.' ), $_GET['charsout'] );
364
  else
365
  $errmsg = __( 'Plugin could not be activated because it triggered a <strong>fatal error</strong>.' ); ?>
366
+ <div id="message" class="error is-dismissible"><p><?php echo $errmsg; ?></p></div>
367
  <?php } elseif ( isset( $_GET['activate'] ) ) { ?>
368
+ <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Plugin <strong>activated</strong>.' ) ?></p></div>
369
  <?php }
370
 
371
  if ( isset( $_POST['bws_plugin_action_submit'] ) && isset( $_POST['bws_install_plugin'] ) && check_admin_referer( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ) ) {
442
  echo '<p class="error">' . $error . '</p>';
443
  echo '<p><a href="' . esc_url( self_admin_url( $current_page ) ) . '" target="_parent">' . __( 'Return to BestWebSoft Panel', 'bestwebsoft' ) . '</a></p>';
444
  }
445
+ } else {
446
  $category_href = $current_page;
447
  if ( 'all' != $plugin_category )
448
  $category_href .= '&category=' . $plugin_category; ?>
449
+ <ul class="subsubsub">
450
+ <li>
451
+ <a <?php if ( ! isset( $_GET['sub'] ) ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?></a>
452
+ </li> |
453
+ <li>
454
+ <a <?php if ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href . '&sub=installed' ) ); ?>"><?php _e( 'Installed', 'bestwebsoft' ); ?></a>
455
+ </li> |
456
+ <li>
457
+ <a <?php if ( isset( $_GET['sub'] ) && 'not_installed' == $_GET['sub'] ) echo 'class="current" '; ?>href="<?php echo esc_url( self_admin_url( $category_href . '&sub=not_installed' ) ); ?>"><?php _e( 'Not Installed', 'bestwebsoft' ); ?></a>
458
+ </li>
459
+ </ul>
460
+ <div class="clear"></div>
461
+ <div class="bws-filter-top">
462
+ <h2>
463
+ <span class="bws-toggle-indicator"></span>
464
  <?php _e( 'Filter results', 'bestwebsoft' ); ?>
465
+ </h2>
466
+ <div class="bws-filter-top-inside">
467
+ <div class="bws-filter-title"><?php _e( 'Category', 'bestwebsoft' ); ?></div>
468
+ <ul class="bws-category">
469
+ <li>
470
  <?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( $_GET['sub'], array( 'installed', 'not_installed' ) ) ) ? '&sub=' . $_GET['sub'] : ''; ?>
471
+ <a <?php if ( 'all' == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url(self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?>
472
+ <span>(<?php echo count( $bws_plugins ); ?>)</span>
473
+ </a>
474
+ </li>
475
  <?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
476
+ <li>
477
+ <a <?php if ( $category_key == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo $category_value['name']; ?>
478
+ <span>(<?php echo $category_value['count']; ?>)</span>
479
+ </a>
480
+ </li>
481
  <?php } ?>
482
+ </ul>
483
+ </div>
484
+ </div>
485
+ <div class="bws-products">
486
  <?php $nothing_found = true;
487
  foreach ( $bws_plugins as $key_plugin => $value_plugin ) {
488
 
503
  }
504
 
505
  if ( ( isset( $_GET['sub'] ) && 'installed' == $_GET['sub'] && ! $is_pro_installed && ! $is_installed ) ||
506
+ ( isset( $_GET['sub'] ) && 'not_installed' == $_GET['sub'] && ( $is_pro_installed || $is_installed ) ) )
507
  continue;
508
 
509
  $link_attr = isset( $value_plugin['install_url'] ) ? 'href="' . esc_url( $value_plugin['install_url'] ) . '" target="_blank"' : 'href="' . esc_url( self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $key_plugin_explode[0] . '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal"';
510
 
511
  $nothing_found = false; ?>
512
+ <div class="bws_product_box<?php if ( $is_active || $is_pro_active ) echo ' bws_product_active'; ?>">
513
+ <div class="bws_product_image">
514
+ <a <?php echo $link_attr; ?>><img src="<?php echo $icon; ?>"/></a>
515
+ </div>
516
+ <div class="bws_product_content">
517
+ <div class="bws_product_title"><a <?php echo $link_attr; ?>><?php echo $value_plugin['name']; ?></a></div>
518
+ <div class="bws-version">
519
  <?php
520
  if ( $is_pro_installed ) {
521
  echo '<span';
537
  $r = $update_availible_all->response[ $value_plugin['update_availible'] ];
538
  echo ' - <a class="bws-update-now" href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $value_plugin['update_availible'] ), 'upgrade-plugin_' . $value_plugin['update_availible'] ) ) . '" class="update-link" aria-label="' . sprintf( __( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . '">' . sprintf( __( 'Update to v %s', 'bestwebsoft' ), $r->new_version ) . '</a>';
539
  } ?>
540
+ </div>
541
+ <div class="bws_product_description">
542
  <?php echo ( strlen( $value_plugin['description'] ) > 100 ) ? mb_substr( $value_plugin['description'], 0, 100 ) . '...' : $value_plugin['description']; ?>
543
+ </div>
544
+ <div class="bws_product_links">
545
  <?php if ( $is_active || $is_pro_active ) {
546
+ if ( $is_pro_isset ) {
547
  if ( ! $is_pro_installed ) {
548
  if ( ! empty( $plugins_array ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
549
+ <form method="post" action="">
550
+ <input type="submit" class="button button-secondary" value="<?php _e( 'Install Now', 'bestwebsoft' ); ?>" />
551
+ <input type="hidden" name="bws_plugin_action_submit" value="submit" />
552
+ <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
553
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
554
+ </form>
555
  <?php } else { ?>
556
+ <a class="button button-secondary bws_upgrade_button" href="<?php echo esc_url( $bws_plugins[ $key_plugin ]['purchase'] ); ?>" target="_blank"><?php _e( 'Upgrade to Pro', 'bestwebsoft' ); ?></a>
557
  <?php }
558
  }
559
  } else { ?>
560
+ <a class="bws_donate" href="https://bestwebsoft.com/donate/" target="_blank"><?php _e( 'Donate', 'bestwebsoft' ); ?></a> <span>|</span>
561
  <?php }
562
 
563
  if ( $is_pro_active ) { ?>
564
+ <a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]["pro_settings"] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a>
565
  <?php } else { ?>
566
+ <a class="bws_settings" href="<?php echo esc_url( self_admin_url( $bws_plugins[ $key_plugin ]["settings"] ) ); ?>"><?php _e( 'Settings', 'bestwebsoft' ); ?></a>
567
  <?php }
568
  } else {
569
  if ( $is_pro_installed ) { ?>
570
+ <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>
571
  <?php } elseif ( ! empty( $plugins_array ) && isset( $value_plugin['pro_version'] ) && array_key_exists( $value_plugin['pro_version'], $plugins_array ) ) { ?>
572
+ <form method="post" action="">
573
+ <input type="submit" class="button button-secondary" value="<?php _e( 'Install Now', 'bestwebsoft' ); ?>" />
574
+ <input type="hidden" name="bws_plugin_action_submit" value="submit" />
575
+ <input type="hidden" name="bws_install_plugin" value="<?php echo $value_plugin['pro_version']; ?>" />
576
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bws_license_install_nonce_name' ); ?>
577
+ </form>
578
  <?php } elseif ( $is_installed ) { ?>
579
+ <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>
580
  <?php } else {
581
  $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' ); ?>
582
+ <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>
583
  <?php }
584
  } ?>
585
+ </div>
586
+ </div>
587
+ <div class="clear"></div>
588
+ </div>
589
  <?php }
590
  if ( $nothing_found ) { ?>
591
+ <p class="description"><?php _e( 'Nothing found. Try another criteria.', 'bestwebsoft' ); ?></p>
592
  <?php } ?>
593
+ </div>
594
+ <div id="bws-filter-wrapper">
595
+ <div class="bws-filter">
596
+ <div class="bws-filter-title"><?php _e( 'Category', 'bestwebsoft' ); ?></div>
597
+ <ul class="bws-category">
598
+ <li>
599
  <?php $sub_in_url = ( isset( $_GET['sub'] ) && in_array( $_GET['sub'], array( 'installed', 'not_installed' ) ) ) ? '&sub=' . $_GET['sub'] : ''; ?>
600
+ <a <?php if ( 'all' == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url ) ); ?>"><?php _e( 'All', 'bestwebsoft' ); ?>
601
+ <span>(<?php echo count( $bws_plugins ); ?>)</span>
602
+ </a>
603
+ </li>
604
  <?php foreach ( $bws_plugins_category as $category_key => $category_value ) { ?>
605
+ <li>
606
+ <a <?php if ( $category_key == $plugin_category ) echo ' class="bws-active"'; ?> href="<?php echo esc_url( self_admin_url( $current_page . $sub_in_url . '&category=' . $category_key ) ); ?>"><?php echo $category_value['name']; ?>
607
+ <span>(<?php echo $category_value['count']; ?>)</span>
608
+ </a>
609
+ </li>
610
  <?php } ?>
611
+ </ul>
612
+ </div>
613
+ </div><!-- #bws-filter-wrapper -->
614
+ <div class="clear"></div>
615
  <?php }
616
  } elseif ( 'bws_themes' == $page || 'themes' == $tab ) {
617
  require( dirname( __FILE__ ) . '/product_list.php' ); ?>
618
+ <h1><?php _e( 'Themes', 'bestwebsoft' ); ?></h1>
619
+ <div id="availablethemes" class="bws-availablethemes">
620
+ <div class="theme-browser content-filterable rendered">
621
+ <div class="themes wp-clearfix">
622
  <?php foreach ( $themes as $key => $theme ) {
623
  $installed_theme = wp_get_theme( $theme->slug ); ?>
624
+ <div class="theme" tabindex="0">
625
+ <div class="theme-screenshot">
626
+ <img src="<?php echo bws_menu_url( "icons/themes/" ) . $theme->slug . '.png'; ?>" alt="" />
627
+ </div>
628
+ <div class="theme-author"><?php printf( __( 'By %s', 'bestwebsoft' ), 'BestWebSoft' ); ?></div>
629
+ <h3 class="theme-name"><?php echo $theme->name; ?></h3>
630
+ <div class="theme-actions">
631
+ <a class="button button-secondary preview install-theme-preview" href="<?php echo esc_url( $theme->href ); ?>" target="_blank"><?php _e( 'Learn More', 'bestwebsoft' ); ?></a>
632
+ </div>
633
  <?php if ( $installed_theme->exists() ) {
634
  if ( $wp_version < '4.6' ) { ?>
635
+ <div class="theme-installed"><?php _e( 'Already Installed', 'bestwebsoft' ); ?></div>
636
  <?php } else { ?>
637
+ <div class="notice notice-success notice-alt inline"><p><?php _e( 'Installed', 'bestwebsoft' ); ?></p></div>
638
  <?php }
639
  } ?>
640
+ </div>
641
  <?php } ?>
642
+ <br class="clear" />
643
+ </div>
644
+ </div>
645
+ <p><a class="bws_browse_link" href="https://bestwebsoft.com/products/wordpress/themes/" target="_blank"><?php _e( 'Browse More WordPress Themes', 'bestwebsoft' ); ?> <span class="dashicons dashicons-arrow-right-alt2"></span></a></p>
646
+ </div>
647
  <?php } elseif ( 'bws_system_status' == $page || 'system-status' == $tab ) { ?>
648
+ <h1><?php _e( 'System status', 'bestwebsoft' ); ?></h1>
649
+ <div class="updated fade notice is-dismissible inline" <?php if ( ! ( isset( $_REQUEST['bwsmn_form_submit'] ) || isset( $_REQUEST['bwsmn_form_submit_custom_email'] ) ) || $error != "" ) echo 'style="display:none"'; ?>><p><strong><?php echo $message; ?></strong></p></div>
650
+ <div class="error" <?php if ( "" == $error ) echo 'style="display:none"'; ?>><p><strong><?php echo $error; ?></strong></p></div>
651
+ <form method="post" action="">
652
+ <p>
653
+ <input type="hidden" name="bwsmn_form_submit" value="submit" />
654
+ <input type="submit" class="button-primary" value="<?php _e( 'Send to support', 'bestwebsoft' ) ?>" />
655
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bwsmn_nonce_submit' ); ?>
656
+ </p>
657
+ </form>
658
+ <form method="post" action="">
659
+ <p>
660
+ <input type="hidden" name="bwsmn_form_submit_custom_email" value="submit" />
661
+ <input type="submit" class="button" value="<?php _e( 'Send to custom email &#187;', 'bestwebsoft' ) ?>" />
662
+ <input type="text" maxlength="250" value="" name="bwsmn_form_email" />
663
  <?php wp_nonce_field( plugin_basename(__FILE__), 'bwsmn_nonce_submit_custom_email' ); ?>
664
+ </p>
665
+ </form>
666
  <?php foreach ( $system_info as $info ) { ?>
667
+ <table class="widefat bws-system-info" cellspacing="0">
668
+ <thead>
669
+ <tr>
670
+ <th colspan="2">
671
+ <strong>
672
+ <?php echo $info['name'];
673
+ if ( isset( $info['count'] ) )
674
+ echo ' (' . $info['count'] . ')'; ?>
675
+ </strong>
676
+ </th>
677
+ </tr>
678
+ </thead>
679
+ <tbody>
680
+ <?php foreach ( $info['data'] as $key => $value ) { ?>
681
+ <tr>
682
+ <td scope="row"><?php echo $key; ?></td>
683
+ <td scope="row"><?php echo $value; ?></td>
684
+ </tr>
685
+ <?php } ?>
686
+ </tbody>
687
+ </table>
688
  <?php }
689
  } ?>
690
+ </div>
691
+ </div>
692
  <?php }
693
  }
694
 
729
  array( 'gglstmp_hide_banner_on_plugin_page', 'google-sitemap-plugin/google-sitemap-plugin.php', '2.8.4' ),
730
  array( 'cntctfrmpr_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-pro/contact_form_pro.php', '1.14' ),
731
  array( 'cntctfrm_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.47' ),
732
+ array( 'cptch_hide_banner_on_plugin_page', 'captcha-bws/captcha-bws.php', '3.8.4' ),
733
  array( 'gllr_hide_banner_on_plugin_page', 'gallery-plugin/gallery-plugin.php', '3.9.1' ),
734
+ array( 'cntctfrm_for_ctfrmtdb_hide_banner_on_plugin_page', 'contact-form-plugin/contact_form.php', '3.62' ),
735
+ array( 'bwscrrntl_hide_banner_on_plugin_page', 'bws-car-rental/bws-car-rental.php', '0.0.1' ),
736
+ array( 'rtng_hide_banner_on_plugin_page', 'rating-bws/rating-bws.php', '1.0.0' ),
737
+ array( 'prflxtrflds_hide_banner_on_plugin_page', 'profile-extra-fields/profile-extra-fields.php', '1.1.3' )
738
  );
739
  }
740
  }
bws_menu/class-bws-settings.php CHANGED
@@ -14,10 +14,10 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
14
  public $plugin_basename;
15
  public $prefix;
16
  public $wp_slug;
17
-
18
  public $options;
19
  public $default_options;
20
- public $is_network_options;
21
  public $plugins_info = array();
22
  public $hide_pro_tabs = false;
23
  public $demo_data;
@@ -28,8 +28,9 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
28
  public $link_key;
29
  public $link_pn;
30
  public $is_trial = false;
 
31
  public $trial_days;
32
- public $bws_hide_pro_option_exist = true;
33
 
34
  public $forbid_view = false;
35
  public $change_permission_attr = '';
@@ -48,35 +49,36 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
48
  * The child class should call this constructor from its own constructor to override
49
  * the default $args.
50
  * @access public
51
- *
52
  * @param array|string $args
53
  */
54
  public function __construct( $args = array() ) {
55
  $args = wp_parse_args( $args, array(
56
  'plugin_basename' => '',
57
  'prefix' => '',
58
- 'plugins_info' => array(),
59
  'default_options' => array(),
60
  'options' => array(),
61
  'is_network_options' => false,
62
  'tabs' => array(),
63
- 'doc_link' => '',
64
- 'doc_video_link' => '',
65
- 'wp_slug' => '',
66
- 'demo_data' => false,
67
  /* if this is free version and pro exist */
68
- 'pro_page' => '',
69
- 'bws_license_plugin'=> '',
70
- 'link_key' => '',
71
- 'link_pn' => '',
72
- 'trial_days' => false
 
73
  ) );
74
 
75
  $args['plugins_info']['Name'] = str_replace( ' by BestWebSoft', '', $args['plugins_info']['Name'] );
76
-
77
  $this->plugin_basename = $args['plugin_basename'];
78
  $this->prefix = $args['prefix'];
79
- $this->plugins_info = $args['plugins_info'];
80
  $this->options = $args['options'];
81
  $this->default_options = $args['default_options'];
82
  $this->wp_slug = $args['wp_slug'];
@@ -93,13 +95,28 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
93
  $this->link_key = $args['link_key'];
94
  $this->link_pn = $args['link_pn'];
95
  $this->trial_days = $args['trial_days'];
 
96
 
97
  $this->hide_pro_tabs = bws_hide_premium_options_check( $this->options );
98
  $this->version = '1.0.0';
99
  $this->is_multisite = is_multisite();
100
 
101
- if ( empty( $this->pro_page ) && array_key_exists( 'license', $this->tabs ) )
102
  $this->is_pro = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
105
  /**
@@ -124,20 +141,20 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
124
  $this->demo_data->bws_demo_confirm();
125
  } else {
126
  bws_show_settings_notice(); ?>
127
- <form class="bws_form" method="post" action="" enctype="multipart/form-data">
128
- <div id="poststuff">
129
- <div id="post-body" class="metabox-holder columns-2">
130
- <div id="post-body-content" style="position: relative;">
131
- <?php $this->display_tabs(); ?>
132
- </div><!-- #post-body-content -->
133
- <div id="postbox-container-1" class="postbox-container">
134
- <div class="meta-box-sortables ui-sortable">
135
- <div id="submitdiv" class="postbox">
136
- <h3 class="hndle"><?php _e( 'Information', 'bestwebsoft' ); ?></h3>
137
- <div class="inside">
138
- <div class="submitbox" id="submitpost">
139
- <div id="minor-publishing">
140
- <div id="misc-publishing-actions">
141
  <?php if ( $this->is_pro ) {
142
  if ( ! isset( $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] ) || isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $this->plugin_basename ] ) ) {
143
  $license_type = 'Pro';
@@ -145,7 +162,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
145
  } else {
146
  $finish = strtotime( $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] );
147
  $today = strtotime( date( "m/d/Y" ) );
148
- if ( isset( $bstwbsftwppdtplgns_options['trial'][ $this->plugin_basename ] ) ) {
149
  $license_type = 'Trial Pro';
150
 
151
  if ( $finish < $today ) {
@@ -154,7 +171,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
154
  $daysleft = floor( ( $finish - $today ) / ( 60*60*24 ) );
155
  $license_status = sprintf( __( '%s day(-s) left', 'bestwebsoft' ), $daysleft );
156
  }
157
- $license_status .= '. <a target="_blank" href="' . esc_url( $this->plugins_info['PluginURI'] ) . '">' . __( 'Upgrade to Pro', 'bestwebsoft' ) . '</a>';
158
  } else {
159
  $license_type = isset( $bstwbsftwppdtplgns_options['nonprofit'][ $this->plugin_basename ] ) ? 'Nonprofit Pro' : 'Pro';
160
  if ( $finish < $today ) {
@@ -164,50 +181,50 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
164
  }
165
  }
166
  } ?>
167
- <div class="misc-pub-section">
168
- <strong><?php _e( 'License', 'bestwebsoft' ); ?>:</strong> <?php echo $license_type; ?>
169
- </div>
170
- <div class="misc-pub-section">
171
- <strong><?php _e( 'Status', 'bestwebsoft' ); ?>:</strong> <?php echo $license_status; ?>
172
- </div><!-- .misc-pub-section -->
173
  <?php } ?>
174
- <div class="misc-pub-section">
175
- <strong><?php _e( 'Version', 'bestwebsoft' ); ?>:</strong> <?php echo $this->plugins_info['Version']; ?>
176
- </div><!-- .misc-pub-section -->
177
- </div>
178
- <div class="clear"></div>
179
- </div>
180
- <div id="major-publishing-actions">
181
- <div id="publishing-action">
182
- <input type="hidden" name="<?php echo $this->prefix; ?>_form_submit" value="submit" />
183
- <input id="bws-submit-button" type="submit" class="button button-primary button-large" value="<?php _e( 'Save Changes', 'bestwebsoft' ); ?>" />
184
- <?php wp_nonce_field( $this->plugin_basename, 'bws_nonce_name' ); ?>
185
- </div>
186
- <div class="clear"></div>
187
- </div>
188
- </div>
189
- </div>
190
- </div>
191
  <?php /**
192
  * action - Display custom metabox
193
  */
194
  do_action( __CLASS__ . '_display_metabox' ); ?>
195
- </div>
196
- </div>
197
- <div id="postbox-container-2" class="postbox-container">
198
  <?php /**
199
  * action - Display additional content for #postbox-container-2
200
  */
201
  do_action( __CLASS__ . '_display_second_postbox' ); ?>
202
- <div class="submit">
203
- <input type="submit" class="button button-primary button-large" value="<?php _e( 'Save Changes', 'bestwebsoft' ); ?>" />
204
- </div>
205
  <?php if ( ! empty( $this->wp_slug ) )
206
  bws_plugin_reviews_block( $this->plugins_info['Name'], $this->wp_slug ); ?>
207
- </div>
208
- </div>
209
- </form>
210
- </div>
211
  <?php }
212
  }
213
 
@@ -217,16 +234,16 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
217
  * @param void
218
  * @return void
219
  */
220
- public function display_tabs() {
221
  global $wp_version; ?>
222
- <div id="bws_settings_tabs_wrapper"<?php if ( version_compare( $wp_version, '4.0', '<' ) ) echo ' class="edit-form-section"'; ?>>
223
- <ul id="bws_settings_tabs">
224
  <?php $this->display_tabs_list(); ?>
225
- </ul>
226
  <?php $this->display_tabs_content(); ?>
227
- <div class="clear"></div>
228
- <input type="hidden" name="bws_active_tab" value="<?php if ( isset( $_REQUEST['bws_active_tab'] ) ) echo esc_attr( $_REQUEST['bws_active_tab'] ); ?>" />
229
- </div>
230
  <?php }
231
 
232
  /**
@@ -243,11 +260,11 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
243
  $tab_class .= ' bws_pro_tab';
244
  if ( ! empty( $data['class'] ) )
245
  $tab_class .= ' ' . $data['class']; ?>
246
- <li class="<?php echo $tab_class; ?>" data-slug="<?php echo $tab_slug; ?>">
247
- <a href="#<?php echo $this->prefix; ?>_<?php echo $tab_slug; ?>_tab">
248
- <span><?php echo esc_html( $data['label'] ); ?></span>
249
- </a>
250
- </li>
251
  <?php }
252
  }
253
 
@@ -258,16 +275,16 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
258
  * @return void
259
  */
260
  public function display_tabs_content() {
261
- foreach ( $this->tabs as $tab_slug => $data ) {
262
  if ( ! empty( $data['is_pro'] ) && $this->hide_pro_tabs )
263
  continue; ?>
264
- <div class="bws_tab ui-tabs-panel ui-widget-content ui-corner-bottom" id="<?php echo esc_attr( $this->prefix . '_' . $tab_slug . '_tab' ); ?>" aria-labelledby="ui-id-2" role="tabpanel" aria-hidden="false" style="display: block;">
265
  <?php $tab_slug = str_replace( '-', '_', $tab_slug );
266
  if ( method_exists( $this, 'tab_' . $tab_slug ) ) {
267
  call_user_func( array( $this, 'tab_' . $tab_slug ) );
268
  do_action_ref_array( __CLASS__ . '_after_tab_' . $tab_slug, array( &$this ) );
269
  } ?>
270
- </div>
271
  <?php }
272
  }
273
 
@@ -283,16 +300,18 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
283
  if ( isset( $_POST['bws_restore_confirm'] ) && check_admin_referer( $this->plugin_basename, 'bws_settings_nonce_name' ) ) {
284
  $this->restore_options();
285
  $message = __( 'All plugin settings were restored.', 'bestwebsoft' );
286
- /* Go Pro - check license key */
287
  } elseif ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
288
  $result = $this->save_options_license_key();
 
 
289
  if ( ! empty( $result['error'] ) )
290
  $error = $result['error'];
291
  if ( ! empty( $result['message'] ) )
292
  $message = $result['message'];
293
  if ( ! empty( $result['notice'] ) )
294
  $notice = $result['notice'];
295
- /* check demo data */
296
  } else {
297
  $demo_result = ! empty( $this->demo_data ) ? $this->demo_data->bws_handle_demo_data() : false;
298
  if ( false !== $demo_result ) {
@@ -302,9 +321,9 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
302
  if ( ! empty( $demo_result['done'] ) && ! empty( $demo_result['options'] ) )
303
  $this->options = $demo_result['options'];
304
  }
305
- /* Save options */
306
  } elseif ( ! isset( $_REQUEST['bws_restore_default'] ) && ! isset( $_POST['bws_handle_demo'] ) && isset( $_REQUEST[ $this->prefix . '_form_submit'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
307
- /* save tabs */
308
  $result = $this->save_options();
309
  if ( ! empty( $result['error'] ) )
310
  $error = $result['error'];
@@ -341,9 +360,9 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
341
  * action - Display custom error\message\notice
342
  */
343
  do_action( __CLASS__ . '_display_custom_messages', $save_results ); ?>
344
- <div class="updated fade inline" <?php if ( empty( $save_results['message'] ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $save_results['message']; ?></strong></p></div>
345
- <div class="updated bws-notice inline" <?php if ( empty( $save_results['notice'] ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $save_results['notice']; ?></strong></p></div>
346
- <div class="error inline" <?php if ( empty( $save_results['error'] ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $save_results['error']; ?></strong></p></div>
347
  <?php }
348
 
349
  /**
@@ -390,19 +409,19 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
390
  fclose( $f );
391
  }
392
  }
393
-
394
  if ( $this->is_multisite )
395
  $this->custom_code_args['blog_id'] = get_current_blog_id();
396
 
397
  foreach ( array( 'css', 'php', 'js' ) as $extension ) {
398
  $file = 'bws-custom-code.' . $extension;
399
  $real_file = $folder . '/' . $file;
400
-
401
  if ( file_exists( $real_file ) ) {
402
  update_recently_edited( $real_file );
403
  $this->custom_code_args["content_{$extension}"] = file_get_contents( $real_file );
404
  if ( ( $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $this->custom_code_args['blog_id'] ][ $file ] ) ) ||
405
- ( ! $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $file ] ) ) ) {
406
  $this->custom_code_args["is_{$extension}_active"] = true;
407
  }
408
  if ( is_writeable( $real_file ) )
@@ -420,55 +439,55 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
420
  * @access private
421
  */
422
  private function tab_custom_code() { ?>
423
- <h3 class="bws_tab_label"><?php _e( 'Custom Code', 'bestwebsoft' ); ?></h3>
424
  <?php $this->help_phrase(); ?>
425
- <hr>
426
  <?php if ( ! current_user_can( 'edit_plugins' ) ) {
427
  echo '<p>' . __( 'You do not have sufficient permissions to edit plugins for this site.', 'bestwebsoft' ) . '</p>';
428
  return;
429
  }
430
 
431
- $list = array(
432
  'css' => array( 'description' => __( 'These styles will be added to the header on all pages of your site.', 'bestwebsoft' ),
433
- 'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started'
434
- ),
435
  '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>' ),
436
- 'learn_more_link' => 'http://php.net/'
437
- ),
438
  'js' => array( 'description' => __( 'These code will be added to the header on all pages of your site.', 'bestwebsoft' ),
439
- 'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/JavaScript'
440
- ),
441
  );
442
 
443
  if ( ! $this->custom_code_args['css_writeable'] ||
444
- ! $this->custom_code_args['php_writeable'] ||
445
- ! $this->custom_code_args['js_writeable'] ) { ?>
446
- <p><em><?php printf( __( 'You need to make this files writable before you can save your changes. See %s the Codex %s for more information.', 'bestwebsoft' ),
447
- '<a href="https://codex.wordpress.org/Changing_File_Permissions" target="_blank">',
448
- '</a>' ); ?></em></p>
449
  <?php }
450
 
451
  foreach ( $list as $extension => $extension_data ) {
452
  $name = 'js' == $extension ? 'JavaScript' : strtoupper( $extension ); ?>
453
- <p><big>
454
- <strong><?php echo $name; ?></strong>
455
- <?php if ( ! $this->custom_code_args["{$extension}_writeable"] )
456
- echo '(' . __( 'Browsing', 'bestwebsoft' ) . ')'; ?>
457
- </big></p>
458
- <p class="bws_info">
459
- <label>
460
- <input type="checkbox" name="bws_custom_<?php echo $extension; ?>_active" value="1" <?php if ( $this->custom_code_args["is_{$extension}_active"] ) echo "checked"; ?> />
461
  <?php printf( __( 'Activate custom %s code.', 'bestwebsoft' ), $name ); ?>
462
- </label>
463
- </p>
464
- <textarea cols="70" rows="25" name="bws_newcontent_<?php echo $extension; ?>" id="bws_newcontent_<?php echo $extension; ?>"><?php if ( isset( $this->custom_code_args["content_{$extension}"] ) ) echo esc_textarea( $this->custom_code_args["content_{$extension}"] ); ?></textarea>
465
- <p class="bws_info">
466
  <?php echo $extension_data['description']; ?>
467
- <br>
468
- <a href="<?php echo esc_url( $extension_data['learn_more_link'] ); ?>" target="_blank">
469
  <?php printf( __( 'Learn more about %s', 'bestwebsoft' ), $name ); ?>
470
- </a>
471
- </p>
472
  <?php }
473
  }
474
 
@@ -481,15 +500,15 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
481
  global $bstwbsftwppdtplgns_options;
482
  $folder = $this->upload_dir['basedir'] . '/bws-custom-code';
483
 
484
- foreach ( array( 'css', 'php', 'js' ) as $extension ) {
485
  $file = 'bws-custom-code.' . $extension;
486
  $real_file = $folder . '/' . $file;
487
 
488
  if ( isset( $_POST["bws_newcontent_{$extension}"] ) &&
489
- $this->custom_code_args["{$extension}_writeable"] ) {
490
  $newcontent = trim( wp_unslash( $_POST["bws_newcontent_{$extension}"] ) );
491
  if ( 'css' == $extension )
492
- $newcontent = wp_kses( $newcontent, 'strip' );
493
 
494
  if ( ! empty( $newcontent ) && isset( $_POST["bws_custom_{$extension}_active"] ) ) {
495
  $this->custom_code_args["is_{$extension}_active"] = true;
@@ -526,55 +545,55 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
526
  * Display 'misc' tab
527
  * @access private
528
  */
529
- private function tab_misc() {
530
  global $bstwbsftwppdtplgns_options; ?>
531
- <h3 class="bws_tab_label"><?php _e( 'Miscellaneous Settings', 'bestwebsoft' ); ?></h3>
532
  <?php $this->help_phrase(); ?>
533
- <hr>
534
  <?php /**
535
  * action - Display custom options on the Import / Export' tab
536
  */
537
  do_action( __CLASS__ . '_additional_misc_options' );
538
 
539
  if ( ! $this->forbid_view && ! empty( $this->change_permission_attr ) ) { ?>
540
- <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to change %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
541
  <?php }
542
  if ( $this->forbid_view ) { ?>
543
- <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to view %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
544
  <?php } else { ?>
545
- <table class="form-table">
546
  <?php /**
547
  * action - Display custom options on the 'misc' tab
548
  */
549
  do_action( __CLASS__ . '_additional_misc_options_affected' );
550
  if ( ! empty( $this->pro_page ) && $this->bws_hide_pro_option_exist ) { ?>
551
- <tr>
552
- <th scope="row"><?php _e( 'Pro Options', 'bestwebsoft' ); ?></th>
553
- <td>
554
- <label>
555
- <input <?php echo $this->change_permission_attr; ?> name="bws_hide_premium_options_submit" type="checkbox" value="1" <?php if ( ! $this->hide_pro_tabs ) echo 'checked="checked "'; ?> />
556
- <span class="bws_info"><?php _e( 'Enable to display plugin Pro options.', 'bestwebsoft' ); ?></span>
557
- </label>
558
- </td>
559
- </tr>
560
  <?php } ?>
561
- <tr>
562
- <th scope="row"><?php _e( 'Track Usage', 'bestwebsoft' ); ?></th>
563
- <td>
564
- <label>
565
- <input <?php echo $this->change_permission_attr; ?> name="bws_track_usage" type="checkbox" value="1" <?php if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] ) ) echo 'checked="checked "'; ?>/>
566
- <span class="bws_info"><?php _e( 'Enable to allow tracking plugin usage anonymously in order to make it better.', 'bestwebsoft' ); ?></span>
567
- </label>
568
- </td>
569
- </tr>
570
- <tr>
571
- <th scope="row"><?php _e( 'Default Settings', 'bestwebsoft' ); ?></th>
572
- <td>
573
- <input<?php echo $this->change_permission_attr; ?> name="bws_restore_default" type="submit" class="button" value="<?php _e( 'Restore Settings', 'bestwebsoft' ); ?>" />
574
- <div class="bws_info"><?php _e( 'This will restore plugin settings to defaults.', 'bestwebsoft' ); ?></div>
575
- </td>
576
- </tr>
577
- </table>
578
  <?php }
579
  }
580
 
@@ -583,26 +602,26 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
583
  * @access private
584
  */
585
  public function tab_import_export() { ?>
586
- <h3 class="bws_tab_label"><?php _e( 'Import / Export', 'bestwebsoft' ); ?></h3>
587
  <?php $this->help_phrase(); ?>
588
- <hr>
589
  <?php /**
590
  * action - Display custom options on the Import / Export' tab
591
  */
592
  do_action( __CLASS__ . '_additional_import_export_options' );
593
 
594
  if ( ! $this->forbid_view && ! empty( $this->change_permission_attr ) ) { ?>
595
- <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to change %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
596
  <?php }
597
  if ( $this->forbid_view ) { ?>
598
- <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to view %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
599
  <?php } else { ?>
600
- <table class="form-table">
601
  <?php /**
602
  * action - Display custom options on the Import / Export' tab
603
  */
604
  do_action( __CLASS__ . '_additional_import_export_options_affected' ); ?>
605
- </table>
606
  <?php }
607
  }
608
 
@@ -634,7 +653,7 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
634
  else
635
  update_option( $this->prefix . '_options', $this->options );
636
  }
637
- $this->hide_pro_tabs = false;
638
  } else {
639
  if ( empty( $this->options['hide_premium_options'] ) ) {
640
  $this->options['hide_premium_options'][] = get_current_user_id();
@@ -679,8 +698,8 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
679
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
680
 
681
  if ( is_array( $response ) &&
682
- ! empty( $response['usage_id'] ) &&
683
- $response['usage_id'] != $usage_id ) {
684
  $bstwbsftwppdtplgns_options['track_usage']['usage_id'] = $response['usage_id'];
685
  }
686
  }
@@ -692,89 +711,102 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
692
  }
693
 
694
  return compact( 'notice' );
695
- }
696
 
697
  /**
698
  *
699
  */
700
  public function tab_license() {
701
  global $wp_version, $bstwbsftwppdtplgns_options; ?>
702
- <h3 class="bws_tab_label"><?php _e( 'License Key', 'bestwebsoft' ); ?></h3>
703
  <?php $this->help_phrase(); ?>
704
- <hr>
705
- <?php if ( ! empty( $this->pro_page ) ) {
706
- $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? stripslashes( sanitize_text_field( $_POST['bws_license_key'] ) ) : "";
707
-
708
- if ( $this->pro_plugin_is_activated ) {
709
- deactivate_plugins( $this->plugin_basename ); ?>
710
- <script type="text/javascript">
711
- (function($) {
712
- var i = 7;
713
- function bws_set_timeout() {
714
- i--;
715
- if ( 0 == i ) {
716
- window.location.href = '<?php echo esc_url( self_admin_url( $this->pro_page ) ); ?>';
717
- } else {
718
- $( '#bws_timeout_counter' ).text( i );
719
- window.setTimeout( bws_set_timeout, 1000 );
 
 
 
720
  }
721
- }
722
- window.setTimeout( bws_set_timeout, 1000 );
723
- })(jQuery);
724
- </script>
725
- <p><strong><?php _e( 'Congratulations! Pro license is activated successfully.', 'bestwebsoft' ); ?></strong></p>
726
- <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>
727
- <?php } else {
728
- $attr = '';
729
- if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] ) &&
730
- '5' < $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] &&
731
- $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) )
732
- $attr = 'disabled="disabled"'; ?>
733
- <table class="form-table">
734
- <tr>
735
- <th scope="row"><?php _e( 'License Key', 'bestwebsoft' ); ?></th>
736
- <td>
737
- <input <?php echo $attr; ?> type="text" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
738
- <input <?php echo $attr; ?> type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $this->bws_license_plugin ); ?>" />
739
- <input <?php echo $attr; ?> type="submit" class="button button-secondary" name="bws_license_submit" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
740
- <div class="bws_info">
741
- <?php printf( __( 'Enter your license key to activate %s and get premium plugin features.', 'bestwebsoft' ), '<a href="' . esc_url( $this->plugins_info['PluginURI'] . '?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version ) . '" target="_blank" title="' . $this->plugins_info["Name"] . ' Pro">' . $this->plugins_info["Name"] . ' Pro</a>' ); ?>
742
- </div>
743
- <?php if ( '' != $attr ) { ?>
744
- <p><?php _e( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'bestwebsoft' ); ?></p>
745
- <?php }
746
- if ( $this->trial_days !== false )
747
- echo '<p>' . __( 'or', 'bestwebsoft' ) . ' <a href="' . esc_url( $this->plugins_info['PluginURI'] . 'trial/?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version ) . '" target="_blank">' . sprintf( __( 'Start Your Free %s-Day Trial Now', 'bestwebsoft' ), $this->trial_days ) . '</a></p>'; ?>
748
- </td>
749
- </tr>
750
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
751
  <?php }
752
- } else {
753
- global $bstwbsftwppdtplgns_options;
754
- $license_key = ( isset( $bstwbsftwppdtplgns_options[ $this->plugin_basename ] ) ) ? $bstwbsftwppdtplgns_options[ $this->plugin_basename ] : ''; ?>
755
- <table class="form-table">
756
- <tr>
757
- <th scope="row"><?php _e( 'License Key', 'bestwebsoft' ); ?></th>
758
- <td>
759
- <input type="text" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $license_key ); ?>" />
760
- <input type="submit" class="button button-secondary" name="bws_license_submit" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
761
- <div class="bws_info">
762
- <?php _e( 'If necessary, you can check if the license key is correct or reenter it in the field below.', 'bestwebsoft' ); ?>
763
- </div>
764
- </td>
765
- </tr>
766
- <tr>
767
- <th scope="row"><?php _e( 'Manage License Settings', 'bestwebsoft' ); ?></th>
768
- <td>
769
- <a class="button button-secondary" href="https://bestwebsoft.com/client-area" target="_blank"><?php _e( 'Login to Client Area', 'bestwebsoft' ); ?></a>
770
- <div class="bws_info">
771
- <?php _e( 'Manage active licenses, download BWS products, and view your payment history using BestWebSoft Client Area.', 'bestwebsoft' ); ?>
772
- </div>
773
- </td>
774
- </tr>
775
- </table>
776
- <?php }
777
- }
778
 
779
  /**
780
  * Save plugin options to the database
@@ -784,264 +816,278 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
784
  */
785
  private function save_options_license_key() {
786
  global $wp_version, $bstwbsftwppdtplgns_options;
 
 
 
 
 
 
 
 
787
 
788
- $bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? stripslashes( sanitize_text_field( $_POST['bws_license_key'] ) ) : '';
789
-
790
- if ( '' != $bws_license_key ) {
791
- if ( strlen( $bws_license_key ) != 18 ) {
792
- $error = __( 'Wrong license key', 'bestwebsoft' );
793
- } else {
794
-
795
- /* CHECK license key */
796
- if ( $this->is_pro ) {
797
- delete_transient( 'bws_plugins_update' );
798
- if ( ! $this->all_plugins ) {
799
- if ( ! function_exists( 'get_plugins' ) )
800
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
801
- $this->all_plugins = get_plugins();
802
- }
803
- $current = get_site_transient( 'update_plugins' );
804
-
805
- if ( ! empty( $this->all_plugins ) && ! empty( $current ) && isset( $current->response ) && is_array( $current->response ) ) {
806
- $to_send = array();
807
- $to_send["plugins"][ $this->plugin_basename ] = $this->all_plugins[ $this->plugin_basename ];
808
- $to_send["plugins"][ $this->plugin_basename ]["bws_license_key"] = $bws_license_key;
809
- $to_send["plugins"][ $this->plugin_basename ]["bws_illegal_client"] = true;
810
- $options = array(
811
- 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
812
- 'body' => array( 'plugins' => serialize( $to_send ) ),
813
- 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
814
- );
815
- $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/update-check/1.0/', $options );
816
-
817
- if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
818
- $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' );
819
- } else {
820
- $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
821
- if ( is_array( $response ) && !empty( $response ) ) {
822
- foreach ( $response as $single_response ) {
823
- if ( "wrong_license_key" == $single_response->package ) {
824
- $error = __( 'Wrong license key.', 'bestwebsoft' );
825
- } else if ( "wrong_domain" == $single_response->package ) {
826
- $error = __( 'This license key is bound to another site.', 'bestwebsoft' );
827
- } else if ( "time_out" == $single_response->package ) {
828
- $message = __( 'This license key is valid, but Your license has expired. If you want to update our plugin in future, you should extend the license.', 'bestwebsoft' );
829
- } elseif ( "you_are_banned" == $single_response->package ) {
830
- $error = __( "Unfortunately, you have exceeded the number of available tries.", 'bestwebsoft' );
831
- } elseif ( "duplicate_domen_for_trial" == $single_response->package ) {
832
- $error = __( "Unfortunately, the Pro Trial licence was already installed to this domain. The Pro Trial license can be installed only once.", 'bestwebsoft' );
833
- }
834
- if ( empty( $error ) ) {
835
- if ( empty( $message ) ) {
836
- if ( isset( $single_response->trial ) )
837
- $message = __( 'The Pro Trial license key is valid.', 'bestwebsoft' );
838
- else
839
- $message = __( 'The license key is valid.', 'bestwebsoft' );
840
-
841
- if ( ! empty( $single_response->time_out ) )
842
- $message .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $single_response->time_out . '.';
843
-
844
- if ( isset( $single_response->trial ) && $this->is_trial )
845
- $message .= ' ' . sprintf( __( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), '<a href="' . esc_url( $this->plugins_info['PluginURI'] . '?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version ) . '" target="_blank" title="' . $this->plugins_info["Name"] . '">Pro</a>' );
846
- }
847
-
848
- if ( isset( $single_response->trial ) ) {
849
- $bstwbsftwppdtplgns_options['trial'][ $this->plugin_basename ] = 1;
850
- } else {
851
- unset( $bstwbsftwppdtplgns_options['trial'][ $this->plugin_basename ] );
852
- }
853
-
854
- if ( isset( $single_response->nonprofit ) ) {
855
- $bstwbsftwppdtplgns_options['nonprofit'][ $this->plugin_basename ] = 1;
856
- } else {
857
- unset( $bstwbsftwppdtplgns_options['nonprofit'][ $this->plugin_basename ] );
858
- }
859
-
860
- if ( ! isset( $bstwbsftwppdtplgns_options[ $this->plugin_basename ] ) || $bstwbsftwppdtplgns_options[ $this->plugin_basename ] != $bws_license_key ) {
861
- $bstwbsftwppdtplgns_options[ $this->plugin_basename ] = $bws_license_key;
862
-
863
- $file = @fopen( dirname( dirname( __FILE__ ) ) . "/license_key.txt" , "w+" );
864
- if ( $file ) {
865
- @fwrite( $file, $bws_license_key );
866
- @fclose( $file );
867
- }
868
- $update_option = true;
869
- }
870
-
871
- if ( ! isset( $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] ) || $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] != $single_response->time_out ) {
872
- $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] = $single_response->time_out;
873
- $update_option = true;
874
- }
875
-
876
- if ( isset( $update_option ) ) {
877
- if ( $this->is_multisite )
878
- update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
879
- else
880
- update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
881
- }
882
- }
883
- }
884
- } else {
885
- $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' );
886
  }
 
887
  }
888
- }
889
- /* Go Pro */
890
- } else {
891
-
892
- $bws_license_plugin = stripslashes( sanitize_text_field( $_POST['bws_license_plugin'] ) );
893
- if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - (24 * 60 * 60) ) ) {
894
- $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
895
- } else {
896
- $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
897
- $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time();
898
- }
899
-
900
- /* download Pro */
901
- if ( ! $this->all_plugins ) {
902
- if ( ! function_exists( 'get_plugins' ) )
903
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
904
- $this->all_plugins = get_plugins();
905
- }
906
-
907
- if ( ! array_key_exists( $bws_license_plugin, $this->all_plugins ) ) {
908
  $current = get_site_transient( 'update_plugins' );
909
- if ( ! empty( $current ) && isset( $current->response ) && is_array( $current->response ) ) {
 
910
  $to_send = array();
911
- $to_send["plugins"][ $bws_license_plugin ] = array();
912
- $to_send["plugins"][ $bws_license_plugin ]["bws_license_key"] = $bws_license_key;
913
- $to_send["plugins"][ $bws_license_plugin ]["bws_illegal_client"] = true;
914
- $options = array(
915
- 'timeout' => ( ( defined( 'DOING_CRON' ) && DOING_CRON ) ? 30 : 3 ),
916
- 'body' => array( 'plugins' => serialize( $to_send ) ),
917
- 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
 
918
  $raw_response = wp_remote_post( 'http://bestwebsoft.com/wp-content/plugins/paid-products/plugins/update-check/1.0/', $options );
919
 
920
  if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
921
- $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' );
922
  } else {
923
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
924
  if ( is_array( $response ) && ! empty( $response ) ) {
925
  foreach ( $response as $single_response ) {
926
  if ( "wrong_license_key" == $single_response->package ) {
927
- $error = __( "Wrong license key.", 'bestwebsoft' );
928
- } elseif ( "wrong_domain" == $single_response->package ) {
929
- $error = __( "This license key is bound to another site.", 'bestwebsoft' );
 
 
930
  } elseif ( "you_are_banned" == $single_response->package ) {
931
- $error = __( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'bestwebsoft' );
932
- } elseif ( "time_out" == $single_response->package ) {
933
- $error = sprintf( __( "Unfortunately, Your license has expired. To continue getting top-priority support and plugin updates, you should extend it in your %s.", 'bestwebsoft' ), ' <a href="https://bestwebsoft.com/client-area">Client Area</a>' );
934
  } elseif ( "duplicate_domen_for_trial" == $single_response->package ) {
935
- $error = __( "Unfortunately, the Pro licence was already installed to this domain. The Pro Trial license can be installed only once.", 'bestwebsoft' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
  }
937
  }
938
- if ( empty( $error ) ) {
939
- $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
940
-
941
- $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';
942
-
943
- if ( ! $this->upload_dir )
944
- $this->upload_dir = wp_upload_dir();
945
-
946
- $zip_name = explode( '/', $bws_license_plugin );
947
-
948
- if ( !function_exists( 'curl_init' ) ) {
949
- $received_content = file_get_contents( $url );
950
- } else {
951
- $ch = curl_init();
952
- curl_setopt( $ch, CURLOPT_URL, $url );
953
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
954
- $received_content = curl_exec( $ch );
955
- curl_close( $ch );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  }
 
 
 
 
 
 
957
 
958
- if ( ! $received_content ) {
959
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
960
- } else {
961
- if ( is_writable( $this->upload_dir["path"] ) ) {
962
- $file_put_contents = $this->upload_dir["path"] . "/" . $zip_name[0] . ".zip";
963
- if ( file_put_contents( $file_put_contents, $received_content ) ) {
964
- @chmod( $file_put_contents, octdec( 755 ) );
965
- if ( class_exists( 'ZipArchive' ) ) {
966
- $zip = new ZipArchive();
967
- if ( $zip->open( $file_put_contents ) === TRUE ) {
968
- $zip->extractTo( WP_PLUGIN_DIR );
969
- $zip->close();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
970
  } else {
971
- $error = __( "Failed to open the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
972
  }
973
- } elseif ( class_exists( 'Phar' ) ) {
974
- $phar = new PharData( $file_put_contents );
975
- $phar->extractTo( WP_PLUGIN_DIR );
976
  } else {
977
- $error = __( "Your server does not support either ZipArchive or Phar. Please, upload the plugin manually.", 'bestwebsoft' );
978
  }
979
- @unlink( $file_put_contents );
980
  } else {
981
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
982
  }
983
- } else {
984
- $error = __( "UploadDir is not writable. Please, upload the plugin manually.", 'bestwebsoft' );
985
  }
986
- }
987
 
988
- /* activate Pro */
989
- if ( file_exists( WP_PLUGIN_DIR . '/' . $zip_name[0] ) ) {
990
- if ( $this->is_multisite && is_plugin_active_for_network( $this->plugin_basename ) ) {
991
- /* if multisite and free plugin is network activated */
992
- $active_plugins = get_site_option( 'active_sitewide_plugins' );
993
- $active_plugins[ $bws_license_plugin ] = time();
994
- update_site_option( 'active_sitewide_plugins', $active_plugins );
995
- } else {
996
- /* activate on a single blog */
997
- $active_plugins = get_option( 'active_plugins' );
998
- array_push( $active_plugins, $bws_license_plugin );
999
- update_option( 'active_plugins', $active_plugins );
 
 
 
 
1000
  }
1001
- $this->pro_plugin_is_activated = true;
1002
- } elseif ( empty( $error ) ) {
1003
- $error = __( "Failed to download the zip archive. Please, upload the plugin manually.", 'bestwebsoft' );
1004
  }
 
 
1005
  }
 
 
 
 
 
 
 
 
 
1006
  } else {
1007
- $error = __( "Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.", 'bestwebsoft' );
 
1008
  }
 
 
1009
  }
1010
  }
1011
- } else {
1012
- $bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
1013
- /* activate Pro */
1014
- if ( ! is_plugin_active( $bws_license_plugin ) ) {
1015
- if ( $this->is_multisite && is_plugin_active_for_network( $this->plugin_basename ) ) {
1016
- /* if multisite and free plugin is network activated */
1017
- $network_wide = true;
1018
- } else {
1019
- /* activate on a single blog */
1020
- $network_wide = false;
1021
- }
1022
- activate_plugin( $bws_license_plugin, NULL, $network_wide );
1023
- $this->pro_plugin_is_activated = true;
1024
  }
1025
- }
1026
- /* add 'track_usage' for Pro version */
1027
- if ( ! empty( $bstwbsftwppdtplgns_options['track_usage'][ $this->plugin_basename ] ) &&
1028
- empty( $bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] ) ) {
1029
- $bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] = $bstwbsftwppdtplgns_options['track_usage'][ $this->plugin_basename ];
1030
- }
1031
 
1032
- if ( $this->is_multisite )
1033
- update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
1034
- else
1035
- update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
 
1036
 
1037
- if ( $this->pro_plugin_is_activated )
1038
- delete_transient( 'bws_plugins_update' );
 
 
1039
  }
 
 
1040
  }
1041
- } else {
1042
- $error = __( "Please, enter Your license key", 'bestwebsoft' );
1043
  }
1044
- return compact( 'error', 'message' );
1045
  }
1046
 
1047
  /**
@@ -1061,18 +1107,18 @@ if ( ! class_exists( 'Bws_Settings_Tabs' ) ) {
1061
  echo '</a></div>';
1062
  }
1063
 
1064
- public function bws_pro_block_links() {
1065
  global $wp_version; ?>
1066
- <div class="bws_pro_version_tooltip">
1067
- <a class="bws_button" href="<?php echo esc_url( $this->plugins_info['PluginURI'] ); ?>?k=<?php echo $this->link_key; ?>&amp;pn=<?php echo $this->link_pn; ?>&amp;v=<?php echo $this->plugins_info["Version"]; ?>&amp;wp_v=<?php echo $wp_version; ?>" target="_blank" title="<?php echo $this->plugins_info["Name"]; ?>"><?php _e( 'Upgrade to Pro', 'bestwebsoft' ); ?></a>
1068
  <?php if ( $this->trial_days !== false ) { ?>
1069
- <span class="bws_trial_info">
1070
- <?php _e( 'or', 'bestwebsoft' ); ?>
1071
- <a href="<?php echo esc_url( $this->plugins_info['PluginURI'] . '?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version ); ?>" target="_blank" title="<?php echo $this->plugins_info["Name"]; ?>"><?php _e( 'Start Your Free Trial', 'bestwebsoft' ); ?></a>
1072
  </span>
1073
  <?php } ?>
1074
- <div class="clear"></div>
1075
- </div>
1076
  <?php }
1077
 
1078
  /**
14
  public $plugin_basename;
15
  public $prefix;
16
  public $wp_slug;
17
+
18
  public $options;
19
  public $default_options;
20
+ public $is_network_options;
21
  public $plugins_info = array();
22
  public $hide_pro_tabs = false;
23
  public $demo_data;
28
  public $link_key;
29
  public $link_pn;
30
  public $is_trial = false;
31
+ public $licenses;
32
  public $trial_days;
33
+ public $bws_hide_pro_option_exist = true;
34
 
35
  public $forbid_view = false;
36
  public $change_permission_attr = '';
49
  * The child class should call this constructor from its own constructor to override
50
  * the default $args.
51
  * @access public
52
+ *
53
  * @param array|string $args
54
  */
55
  public function __construct( $args = array() ) {
56
  $args = wp_parse_args( $args, array(
57
  'plugin_basename' => '',
58
  'prefix' => '',
59
+ 'plugins_info' => array(),
60
  'default_options' => array(),
61
  'options' => array(),
62
  'is_network_options' => false,
63
  'tabs' => array(),
64
+ 'doc_link' => '',
65
+ 'doc_video_link' => '',
66
+ 'wp_slug' => '',
67
+ 'demo_data' => false,
68
  /* if this is free version and pro exist */
69
+ 'pro_page' => '',
70
+ 'bws_license_plugin' => '',
71
+ 'link_key' => '',
72
+ 'link_pn' => '',
73
+ 'trial_days' => false,
74
+ 'licenses' => array()
75
  ) );
76
 
77
  $args['plugins_info']['Name'] = str_replace( ' by BestWebSoft', '', $args['plugins_info']['Name'] );
78
+
79
  $this->plugin_basename = $args['plugin_basename'];
80
  $this->prefix = $args['prefix'];
81
+ $this->plugins_info = $args['plugins_info'];
82
  $this->options = $args['options'];
83
  $this->default_options = $args['default_options'];
84
  $this->wp_slug = $args['wp_slug'];
95
  $this->link_key = $args['link_key'];
96
  $this->link_pn = $args['link_pn'];
97
  $this->trial_days = $args['trial_days'];
98
+ $this->licenses = $args['licenses'];
99
 
100
  $this->hide_pro_tabs = bws_hide_premium_options_check( $this->options );
101
  $this->version = '1.0.0';
102
  $this->is_multisite = is_multisite();
103
 
104
+ if ( empty( $this->pro_page ) && array_key_exists( 'license', $this->tabs ) ) {
105
  $this->is_pro = true;
106
+ $this->licenses[ $this->plugins_info['TextDomain'] ] = array(
107
+ 'name' => $this->plugins_info['Name'],
108
+ 'slug' => $this->plugins_info['TextDomain'],
109
+ 'basename' => $this->plugin_basename
110
+ );
111
+ } else {
112
+ $this->licenses[ $this->plugins_info['TextDomain'] ] = array(
113
+ 'name' => $this->plugins_info['Name'],
114
+ 'slug' => $this->plugins_info['TextDomain'],
115
+ 'pro_slug' => stristr( $this->bws_license_plugin, '/', TRUE ),
116
+ 'basename' => $this->plugin_basename,
117
+ 'pro_basename' => $this->bws_license_plugin
118
+ );
119
+ }
120
  }
121
 
122
  /**
141
  $this->demo_data->bws_demo_confirm();
142
  } else {
143
  bws_show_settings_notice(); ?>
144
+ <form class="bws_form" method="post" action="" enctype="multipart/form-data">
145
+ <div id="poststuff">
146
+ <div id="post-body" class="metabox-holder columns-2">
147
+ <div id="post-body-content" style="position: relative;">
148
+ <?php $this->display_tabs(); ?>
149
+ </div><!-- #post-body-content -->
150
+ <div id="postbox-container-1" class="postbox-container">
151
+ <div class="meta-box-sortables ui-sortable">
152
+ <div id="submitdiv" class="postbox">
153
+ <h3 class="hndle"><?php _e( 'Information', 'bestwebsoft' ); ?></h3>
154
+ <div class="inside">
155
+ <div class="submitbox" id="submitpost">
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';
162
  } else {
163
  $finish = strtotime( $bstwbsftwppdtplgns_options['time_out'][ $this->plugin_basename ] );
164
  $today = strtotime( date( "m/d/Y" ) );
165
+ if ( isset( $bstwbsftwppdtplgns_options['trial'][ $this->plugin_basename ] ) ) {
166
  $license_type = 'Trial Pro';
167
 
168
  if ( $finish < $today ) {
171
  $daysleft = floor( ( $finish - $today ) / ( 60*60*24 ) );
172
  $license_status = sprintf( __( '%s day(-s) left', 'bestwebsoft' ), $daysleft );
173
  }
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 ) {
181
  }
182
  }
183
  } ?>
184
+ <div class="misc-pub-section">
185
+ <strong><?php _e( 'License', 'bestwebsoft' ); ?>:</strong> <?php echo $license_type; ?>
186
+ </div>
187
+ <div class="misc-pub-section">
188
+ <strong><?php _e( 'Status', 'bestwebsoft' ); ?>:</strong> <?php echo $license_status; ?>
189
+ </div><!-- .misc-pub-section -->
190
  <?php } ?>
191
+ <div class="misc-pub-section">
192
+ <strong><?php _e( 'Version', 'bestwebsoft' ); ?>:</strong> <?php echo $this->plugins_info['Version']; ?>
193
+ </div><!-- .misc-pub-section -->
194
+ </div>
195
+ <div class="clear"></div>
196
+ </div>
197
+ <div id="major-publishing-actions">
198
+ <div id="publishing-action">
199
+ <input type="hidden" name="<?php echo $this->prefix; ?>_form_submit" value="submit" />
200
+ <input id="bws-submit-button" type="submit" class="button button-primary button-large" value="<?php _e( 'Save Changes', 'bestwebsoft' ); ?>" />
201
+ <?php wp_nonce_field( $this->plugin_basename, 'bws_nonce_name' ); ?>
202
+ </div>
203
+ <div class="clear"></div>
204
+ </div>
205
+ </div>
206
+ </div>
207
+ </div>
208
  <?php /**
209
  * action - Display custom metabox
210
  */
211
  do_action( __CLASS__ . '_display_metabox' ); ?>
212
+ </div>
213
+ </div>
214
+ <div id="postbox-container-2" class="postbox-container">
215
  <?php /**
216
  * action - Display additional content for #postbox-container-2
217
  */
218
  do_action( __CLASS__ . '_display_second_postbox' ); ?>
219
+ <div class="submit">
220
+ <input type="submit" class="button button-primary button-large" value="<?php _e( 'Save Changes', 'bestwebsoft' ); ?>" />
221
+ </div>
222
  <?php if ( ! empty( $this->wp_slug ) )
223
  bws_plugin_reviews_block( $this->plugins_info['Name'], $this->wp_slug ); ?>
224
+ </div>
225
+ </div>
226
+ </form>
227
+ </div>
228
  <?php }
229
  }
230
 
234
  * @param void
235
  * @return void
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>
243
  <?php $this->display_tabs_content(); ?>
244
+ <div class="clear"></div>
245
+ <input type="hidden" name="bws_active_tab" value="<?php if ( isset( $_REQUEST['bws_active_tab'] ) ) echo esc_attr( $_REQUEST['bws_active_tab'] ); ?>" />
246
+ </div>
247
  <?php }
248
 
249
  /**
260
  $tab_class .= ' bws_pro_tab';
261
  if ( ! empty( $data['class'] ) )
262
  $tab_class .= ' ' . $data['class']; ?>
263
+ <li class="<?php echo $tab_class; ?>" data-slug="<?php echo $tab_slug; ?>">
264
+ <a href="#<?php echo $this->prefix; ?>_<?php echo $tab_slug; ?>_tab">
265
+ <span><?php echo esc_html( $data['label'] ); ?></span>
266
+ </a>
267
+ </li>
268
  <?php }
269
  }
270
 
275
  * @return void
276
  */
277
  public function display_tabs_content() {
278
+ foreach ( $this->tabs as $tab_slug => $data ) {
279
  if ( ! empty( $data['is_pro'] ) && $this->hide_pro_tabs )
280
  continue; ?>
281
+ <div class="bws_tab ui-tabs-panel ui-widget-content ui-corner-bottom" id="<?php echo esc_attr( $this->prefix . '_' . $tab_slug . '_tab' ); ?>" aria-labelledby="ui-id-2" role="tabpanel" aria-hidden="false" style="display: block;">
282
  <?php $tab_slug = str_replace( '-', '_', $tab_slug );
283
  if ( method_exists( $this, 'tab_' . $tab_slug ) ) {
284
  call_user_func( array( $this, 'tab_' . $tab_slug ) );
285
  do_action_ref_array( __CLASS__ . '_after_tab_' . $tab_slug, array( &$this ) );
286
  } ?>
287
+ </div>
288
  <?php }
289
  }
290
 
300
  if ( isset( $_POST['bws_restore_confirm'] ) && check_admin_referer( $this->plugin_basename, 'bws_settings_nonce_name' ) ) {
301
  $this->restore_options();
302
  $message = __( 'All plugin settings were restored.', 'bestwebsoft' );
303
+ /* Go Pro - check license key */
304
  } elseif ( isset( $_POST['bws_license_submit'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
305
  $result = $this->save_options_license_key();
306
+ if ( ! empty( $result['empty_field_error'] ) )
307
+ $error = $result['empty_field_error'];
308
  if ( ! empty( $result['error'] ) )
309
  $error = $result['error'];
310
  if ( ! empty( $result['message'] ) )
311
  $message = $result['message'];
312
  if ( ! empty( $result['notice'] ) )
313
  $notice = $result['notice'];
314
+ /* check demo data */
315
  } else {
316
  $demo_result = ! empty( $this->demo_data ) ? $this->demo_data->bws_handle_demo_data() : false;
317
  if ( false !== $demo_result ) {
321
  if ( ! empty( $demo_result['done'] ) && ! empty( $demo_result['options'] ) )
322
  $this->options = $demo_result['options'];
323
  }
324
+ /* Save options */
325
  } elseif ( ! isset( $_REQUEST['bws_restore_default'] ) && ! isset( $_POST['bws_handle_demo'] ) && isset( $_REQUEST[ $this->prefix . '_form_submit'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
326
+ /* save tabs */
327
  $result = $this->save_options();
328
  if ( ! empty( $result['error'] ) )
329
  $error = $result['error'];
360
  * action - Display custom error\message\notice
361
  */
362
  do_action( __CLASS__ . '_display_custom_messages', $save_results ); ?>
363
+ <div class="updated fade inline" <?php if ( empty( $save_results['message'] ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $save_results['message']; ?></strong></p></div>
364
+ <div class="updated bws-notice inline" <?php if ( empty( $save_results['notice'] ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $save_results['notice']; ?></strong></p></div>
365
+ <div class="error inline" <?php if ( empty( $save_results['error'] ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $save_results['error']; ?></strong></p></div>
366
  <?php }
367
 
368
  /**
409
  fclose( $f );
410
  }
411
  }
412
+
413
  if ( $this->is_multisite )
414
  $this->custom_code_args['blog_id'] = get_current_blog_id();
415
 
416
  foreach ( array( 'css', 'php', 'js' ) as $extension ) {
417
  $file = 'bws-custom-code.' . $extension;
418
  $real_file = $folder . '/' . $file;
419
+
420
  if ( file_exists( $real_file ) ) {
421
  update_recently_edited( $real_file );
422
  $this->custom_code_args["content_{$extension}"] = file_get_contents( $real_file );
423
  if ( ( $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $this->custom_code_args['blog_id'] ][ $file ] ) ) ||
424
+ ( ! $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $file ] ) ) ) {
425
  $this->custom_code_args["is_{$extension}_active"] = true;
426
  }
427
  if ( is_writeable( $real_file ) )
439
  * @access private
440
  */
441
  private function tab_custom_code() { ?>
442
+ <h3 class="bws_tab_label"><?php _e( 'Custom Code', 'bestwebsoft' ); ?></h3>
443
  <?php $this->help_phrase(); ?>
444
+ <hr>
445
  <?php if ( ! current_user_can( 'edit_plugins' ) ) {
446
  echo '<p>' . __( 'You do not have sufficient permissions to edit plugins for this site.', 'bestwebsoft' ) . '</p>';
447
  return;
448
  }
449
 
450
+ $list = array(
451
  'css' => array( 'description' => __( 'These styles will be added to the header on all pages of your site.', 'bestwebsoft' ),
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'
459
+ ),
460
  );
461
 
462
  if ( ! $this->custom_code_args['css_writeable'] ||
463
+ ! $this->custom_code_args['php_writeable'] ||
464
+ ! $this->custom_code_args['js_writeable'] ) { ?>
465
+ <p><em><?php printf( __( 'You need to make this files writable before you can save your changes. See %s the Codex %s for more information.', 'bestwebsoft' ),
466
+ '<a href="https://codex.wordpress.org/Changing_File_Permissions" target="_blank">',
467
+ '</a>' ); ?></em></p>
468
  <?php }
469
 
470
  foreach ( $list as $extension => $extension_data ) {
471
  $name = 'js' == $extension ? 'JavaScript' : strtoupper( $extension ); ?>
472
+ <p><big>
473
+ <strong><?php echo $name; ?></strong>
474
+ <?php if ( ! $this->custom_code_args["{$extension}_writeable"] )
475
+ echo '(' . __( 'Browsing', 'bestwebsoft' ) . ')'; ?>
476
+ </big></p>
477
+ <p class="bws_info">
478
+ <label>
479
+ <input type="checkbox" name="bws_custom_<?php echo $extension; ?>_active" value="1" <?php if ( $this->custom_code_args["is_{$extension}_active"] ) echo "checked"; ?> />
480
  <?php printf( __( 'Activate custom %s code.', 'bestwebsoft' ), $name ); ?>
481
+ </label>
482
+ </p>
483
+ <textarea cols="70" rows="25" name="bws_newcontent_<?php echo $extension; ?>" id="bws_newcontent_<?php echo $extension; ?>"><?php if ( isset( $this->custom_code_args["content_{$extension}"] ) ) echo esc_textarea( $this->custom_code_args["content_{$extension}"] ); ?></textarea>
484
+ <p class="bws_info">
485
  <?php echo $extension_data['description']; ?>
486
+ <br>
487
+ <a href="<?php echo esc_url( $extension_data['learn_more_link'] ); ?>" target="_blank">
488
  <?php printf( __( 'Learn more about %s', 'bestwebsoft' ), $name ); ?>
489
+ </a>
490
+ </p>
491
  <?php }
492
  }
493
 
500
  global $bstwbsftwppdtplgns_options;
501
  $folder = $this->upload_dir['basedir'] . '/bws-custom-code';
502
 
503
+ foreach ( array( 'css', 'php', 'js' ) as $extension ) {
504
  $file = 'bws-custom-code.' . $extension;
505
  $real_file = $folder . '/' . $file;
506
 
507
  if ( isset( $_POST["bws_newcontent_{$extension}"] ) &&
508
+ $this->custom_code_args["{$extension}_writeable"] ) {
509
  $newcontent = trim( wp_unslash( $_POST["bws_newcontent_{$extension}"] ) );
510
  if ( 'css' == $extension )
511
+ $newcontent = wp_kses( $newcontent, array( '\'', '\"' ) );
512
 
513
  if ( ! empty( $newcontent ) && isset( $_POST["bws_custom_{$extension}_active"] ) ) {
514
  $this->custom_code_args["is_{$extension}_active"] = true;
545
  * Display 'misc' tab
546
  * @access private
547
  */
548
+ private function tab_misc() {
549
  global $bstwbsftwppdtplgns_options; ?>
550
+ <h3 class="bws_tab_label"><?php _e( 'Miscellaneous Settings', 'bestwebsoft' ); ?></h3>
551
  <?php $this->help_phrase(); ?>
552
+ <hr>
553
  <?php /**
554
  * action - Display custom options on the Import / Export' tab
555
  */
556
  do_action( __CLASS__ . '_additional_misc_options' );
557
 
558
  if ( ! $this->forbid_view && ! empty( $this->change_permission_attr ) ) { ?>
559
+ <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to change %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
560
  <?php }
561
  if ( $this->forbid_view ) { ?>
562
+ <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to view %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
563
  <?php } else { ?>
564
+ <table class="form-table">
565
  <?php /**
566
  * action - Display custom options on the 'misc' tab
567
  */
568
  do_action( __CLASS__ . '_additional_misc_options_affected' );
569
  if ( ! empty( $this->pro_page ) && $this->bws_hide_pro_option_exist ) { ?>
570
+ <tr>
571
+ <th scope="row"><?php _e( 'Pro Options', 'bestwebsoft' ); ?></th>
572
+ <td>
573
+ <label>
574
+ <input <?php echo $this->change_permission_attr; ?> name="bws_hide_premium_options_submit" type="checkbox" value="1" <?php if ( ! $this->hide_pro_tabs ) echo 'checked="checked "'; ?> />
575
+ <span class="bws_info"><?php _e( 'Enable to display plugin Pro options.', 'bestwebsoft' ); ?></span>
576
+ </label>
577
+ </td>
578
+ </tr>
579
  <?php } ?>
580
+ <tr>
581
+ <th scope="row"><?php _e( 'Track Usage', 'bestwebsoft' ); ?></th>
582
+ <td>
583
+ <label>
584
+ <input <?php echo $this->change_permission_attr; ?> name="bws_track_usage" type="checkbox" value="1" <?php if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] ) ) echo 'checked="checked "'; ?>/>
585
+ <span class="bws_info"><?php _e( 'Enable to allow tracking plugin usage anonymously in order to make it better.', 'bestwebsoft' ); ?></span>
586
+ </label>
587
+ </td>
588
+ </tr>
589
+ <tr>
590
+ <th scope="row"><?php _e( 'Default Settings', 'bestwebsoft' ); ?></th>
591
+ <td>
592
+ <input<?php echo $this->change_permission_attr; ?> name="bws_restore_default" type="submit" class="button" value="<?php _e( 'Restore Settings', 'bestwebsoft' ); ?>" />
593
+ <div class="bws_info"><?php _e( 'This will restore plugin settings to defaults.', 'bestwebsoft' ); ?></div>
594
+ </td>
595
+ </tr>
596
+ </table>
597
  <?php }
598
  }
599
 
602
  * @access private
603
  */
604
  public function tab_import_export() { ?>
605
+ <h3 class="bws_tab_label"><?php _e( 'Import / Export', 'bestwebsoft' ); ?></h3>
606
  <?php $this->help_phrase(); ?>
607
+ <hr>
608
  <?php /**
609
  * action - Display custom options on the Import / Export' tab
610
  */
611
  do_action( __CLASS__ . '_additional_import_export_options' );
612
 
613
  if ( ! $this->forbid_view && ! empty( $this->change_permission_attr ) ) { ?>
614
+ <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to change %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
615
  <?php }
616
  if ( $this->forbid_view ) { ?>
617
+ <div class="error inline bws_visible"><p><strong><?php _e( "Notice", 'bestwebsoft' ); ?>:</strong> <strong><?php printf( __( "It is prohibited to view %s settings on this site in the %s network settings.", 'bestwebsoft' ), $this->plugins_info["Name"], $this->plugins_info["Name"] ); ?></strong></p></div>
618
  <?php } else { ?>
619
+ <table class="form-table">
620
  <?php /**
621
  * action - Display custom options on the Import / Export' tab
622
  */
623
  do_action( __CLASS__ . '_additional_import_export_options_affected' ); ?>
624
+ </table>
625
  <?php }
626
  }
627
 
653
  else
654
  update_option( $this->prefix . '_options', $this->options );
655
  }
656
+ $this->hide_pro_tabs = false;
657
  } else {
658
  if ( empty( $this->options['hide_premium_options'] ) ) {
659
  $this->options['hide_premium_options'][] = get_current_user_id();
698
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
699
 
700
  if ( is_array( $response ) &&
701
+ ! empty( $response['usage_id'] ) &&
702
+ $response['usage_id'] != $usage_id ) {
703
  $bstwbsftwppdtplgns_options['track_usage']['usage_id'] = $response['usage_id'];
704
  }
705
  }
711
  }
712
 
713
  return compact( 'notice' );
714
+ }
715
 
716
  /**
717
  *
718
  */
719
  public function tab_license() {
720
  global $wp_version, $bstwbsftwppdtplgns_options; ?>
721
+ <h3 class="bws_tab_label"><?php _e( 'License Key', 'bestwebsoft' ); ?></h3>
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'] ) &&
751
+ '5' < $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] &&
752
+ $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) )
753
+ $attr = 'disabled="disabled"';
754
+
755
+
756
+ $license_key = '';
757
+ if( ! empty( $single_license['pro_basename'] ) ) {
758
+ $license_key = ! empty( $bstwbsftwppdtplgns_options[ $single_license['pro_basename'] ] ) ? $bstwbsftwppdtplgns_options[ $single_license['pro_basename'] ] : '';
759
+ }
760
+ $current_plugin_link = ( ! empty( $this->link_key ) && ! empty( $this->link_pn ) ? esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $single_license['slug'] . '/' . '?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version ) : esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $single_license['slug'] . '/' ) );
761
+ ?>
762
+ <table class="form-table">
763
+ <tr>
764
+ <th scope="row"><?php echo $pro_plugin_name . ' License'; ?></th>
765
+ <td>
766
+ <input <?php echo $attr; ?> type="text" name="bws_license_key_<?php echo ( ! empty( $single_license['pro_slug'] ) ) ? $single_license['pro_slug'] : $single_license['slug']; ?>" value="<?php echo esc_attr( $license_key ); ?>" />
767
+ <input <?php echo $attr; ?> type="hidden" name="bws_license_plugin_<?php echo ( ! empty( $single_license['pro_slug'] ) ) ? $single_license['pro_slug'] : $single_license['slug']; ?>" value="<?php echo esc_attr( ( ! empty( $single_license['pro_slug'] ) ) ? $single_license['pro_slug'] : $single_license['slug'] ); ?>" />
768
+ <input <?php echo $attr; ?> type="submit" class="button button-secondary" name="bws_license_submit" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
769
+ <div class="bws_info">
770
+ <?php printf( __( 'Enter your license key to activate %s and get premium plugin features.', 'bestwebsoft' ), '<a href="' . $current_plugin_link . '" target="_blank" title="' . $pro_plugin_name . '">' . $pro_plugin_name . '</a>' ); ?>
771
+ </div>
772
+ <?php if ( '' != $attr ) { ?>
773
+ <p><?php _e( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'bestwebsoft' ); ?></p>
774
+ <?php }
775
+ if ( $this->trial_days !== false )
776
+ echo '<p>' . __( 'or', 'bestwebsoft' ) . ' <a href="' . esc_url( $this->plugins_info['PluginURI'] . 'trial/?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version ) . '" target="_blank">' . sprintf( __( 'Start Your Free %s-Day Trial Now', 'bestwebsoft' ), $this->trial_days ) . '</a></p>'; ?>
777
+ </td>
778
+ </tr>
779
+ </table>
780
+ <?php }
781
+ } else {
782
+ global $bstwbsftwppdtplgns_options;
783
+ $license_key = ( isset( $bstwbsftwppdtplgns_options[ $single_license['basename'] ] ) ) ? $bstwbsftwppdtplgns_options[ $single_license['basename'] ] : ''; ?>
784
+ <table class="form-table">
785
+ <tr>
786
+ <th scope="row"><?php echo $pro_plugin_name . ' License'; ?></th>
787
+ <td>
788
+ <input type="text" maxlength="100" name="bws_license_key_<?php echo $single_license['slug']; ?>" value="<?php echo esc_attr( $license_key ); ?>" />
789
+ <input type="submit" class="button button-secondary" name="bws_license_submit" value="<?php _e( 'Check license key', 'bestwebsoft' ); ?>" />
790
+ <div class="bws_info">
791
+ <?php _e( 'If necessary, you can check if the license key is correct or reenter it in the field below.', 'bestwebsoft' ); ?>
792
+ </div>
793
+ </td>
794
+ </tr>
795
+ </table>
796
  <?php }
797
+ } ?>
798
+ <table class="form-table">
799
+ <tr>
800
+ <th scope="row"><?php _e( 'Manage License Settings', 'bestwebsoft' ); ?></th>
801
+ <td>
802
+ <a class="button button-secondary" href="https://bestwebsoft.com/client-area" target="_blank"><?php _e( 'Login to Client Area', 'bestwebsoft' ); ?></a>
803
+ <div class="bws_info">
804
+ <?php _e( 'Manage active licenses, download BWS products, and view your payment history using BestWebSoft Client Area.', 'bestwebsoft' ); ?>
805
+ </div>
806
+ </td>
807
+ </tr>
808
+ </table>
809
+ <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
810
 
811
  /**
812
  * Save plugin options to the database
816
  */
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 ) {
824
+ if ( strlen( $bws_license_key ) != 18 ) {
825
+ $error = __( 'Wrong license key', 'bestwebsoft' );
826
+ } else {
827
 
828
+ /* CHECK license key */
829
+ if ( $this->is_pro && empty( $single_license['pro_basename'] ) ) {
830
+ delete_transient( 'bws_plugins_update' );
831
+ if ( ! $this->all_plugins ) {
832
+ if ( ! function_exists( 'get_plugins' ) ) {
833
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
834
  }
835
+ $this->all_plugins = get_plugins();
836
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  $current = get_site_transient( 'update_plugins' );
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/update-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' );
853
  } else {
854
  $response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
855
  if ( is_array( $response ) && ! empty( $response ) ) {
856
  foreach ( $response as $single_response ) {
857
  if ( "wrong_license_key" == $single_response->package ) {
858
+ $error = __( 'Wrong license key.', 'bestwebsoft' );
859
+ } else if ( "wrong_domain" == $single_response->package ) {
860
+ $error = __( 'This license key is bound to another site.', 'bestwebsoft' );
861
+ } else if ( "time_out" == $single_response->package ) {
862
+ $message = __( 'This license key is valid, but Your license has expired. If you want to update our plugin in future, you should extend the license.', 'bestwebsoft' );
863
  } elseif ( "you_are_banned" == $single_response->package ) {
864
+ $error = __( "Unfortunately, you have exceeded the number of available tries.", 'bestwebsoft' );
 
 
865
  } elseif ( "duplicate_domen_for_trial" == $single_response->package ) {
866
+ $error = __( "Unfortunately, the Pro Trial licence was already installed to this domain. The Pro Trial license can be installed only once.", 'bestwebsoft' );
867
+ }
868
+ if ( empty( $error ) ) {
869
+ if ( empty( $message ) ) {
870
+ if ( isset( $single_response->trial ) ) {
871
+ $message = __( 'The Pro Trial license key is valid.', 'bestwebsoft' );
872
+ } else {
873
+ $message = __( 'The license key is valid.', 'bestwebsoft' );
874
+ }
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 ) {
881
+ $message .= ' ' . sprintf( __( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), '<a href="' . esc_url( $this->plugins_info['PluginURI'] . '?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version ) . '" target="_blank" title="' . $this->plugins_info["Name"] . '">Pro</a>' );
882
+ }
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 ) {
902
+ @fwrite( $file, $bws_license_key );
903
+ @fclose( $file );
904
+ }
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 ) ) {
914
+ if ( $this->is_multisite ) {
915
+ update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
916
+ } else {
917
+ update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
918
+ }
919
+ }
920
  }
921
  }
922
+ } else {
923
+ $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' );
924
+ }
925
+ }
926
+ }
927
+ /* Go Pro */
928
+ } else {
929
+
930