wp/wp-content/plugins/portfolio/bws_menu/class-bws-settings.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     1 <?php
     1 <?php
       
     2 if ( ! defined( 'ABSPATH' ) ) {
       
     3 	exit;
       
     4 }
       
     5 
     2 /**
     6 /**
     3  * Displays the content on the plugin settings page
     7  * Displays the content on the plugin settings page
     4  *
     8  *
     5  * @package BestWebSoft
     9  * @package BestWebSoft
     6  * @since 1.9.8
    10  * @since 1.9.8
    99 			$this->link_key   = $args['link_key'];
   103 			$this->link_key   = $args['link_key'];
   100 			$this->link_pn    = $args['link_pn'];
   104 			$this->link_pn    = $args['link_pn'];
   101 			$this->trial_days = $args['trial_days'];
   105 			$this->trial_days = $args['trial_days'];
   102 			$this->licenses   = $args['licenses'];
   106 			$this->licenses   = $args['licenses'];
   103 
   107 
   104 			$this->pro_page = $this->bws_license_plugin = '';
   108 			$this->pro_page           = '';
       
   109 			$this->bws_license_plugin = '';
   105 			/* get $bws_plugins */
   110 			/* get $bws_plugins */
   106 			require dirname( __FILE__ ) . '/product_list.php';
   111 			require dirname( __FILE__ ) . '/product_list.php';
   107 			if ( isset( $bws_plugins[ $this->plugin_basename ] ) ) {
   112 			if ( isset( $bws_plugins[ $this->plugin_basename ] ) ) {
   108 				if ( isset( $bws_plugins[ $this->plugin_basename ]['pro_settings'] ) ) {
   113 				if ( isset( $bws_plugins[ $this->plugin_basename ]['pro_settings'] ) ) {
   109 					$this->pro_page           = $bws_plugins[ $this->plugin_basename ]['pro_settings'];
   114 					$this->pro_page           = $bws_plugins[ $this->plugin_basename ]['pro_settings'];
   176 											<div class="submitbox" id="submitpost">
   181 											<div class="submitbox" id="submitpost">
   177 												<div id="minor-publishing">
   182 												<div id="minor-publishing">
   178 													<div id="misc-publishing-actions">
   183 													<div id="misc-publishing-actions">
   179 														<?php
   184 														<?php
   180 														/**
   185 														/**
   181 														 * Action - Display additional content for #misc-publishing-Actions
   186 														 * Action - Display additional content for #misc-publishing-actions
   182 														 */
   187 														 */
   183 														do_action( __CLASS__ . '_information_postbox_top' );
   188 														do_action( __CLASS__ . '_information_postbox_top' );
   184 														?>
   189 														?>
   185 														<?php
   190 														<?php
   186 														if ( $this->is_pro ) {
   191 														if ( $this->is_pro ) {
   220 														<div class="misc-pub-section">
   225 														<div class="misc-pub-section">
   221 															<strong><?php esc_html_e( 'Version', 'bestwebsoft' ); ?>:</strong> <?php echo esc_attr( $this->plugins_info['Version'] ); ?>
   226 															<strong><?php esc_html_e( 'Version', 'bestwebsoft' ); ?>:</strong> <?php echo esc_attr( $this->plugins_info['Version'] ); ?>
   222 														</div><!-- .misc-pub-section -->
   227 														</div><!-- .misc-pub-section -->
   223 														<?php
   228 														<?php
   224 														/**
   229 														/**
   225 														 * Action - Display additional content for #misc-publishing-Actions
   230 														 * Action - Display additional content for #misc-publishing-actions
   226 														 */
   231 														 */
   227 														do_action( __CLASS__ . '_information_postbox_bottom' );
   232 														do_action( __CLASS__ . '_information_postbox_bottom' );
   228 														?>
   233 														?>
   229 													</div>
   234 													</div>
   230 													<div class="clear"></div>
   235 													<div class="clear"></div>
   231 												</div>
   236 												</div>
   232 												<div id="major-publishing-Actions">
   237 												<div id="major-publishing-actions">
   233 													<div id="publishing-Action">
   238 													<div id="publishing-action">
   234 														<input type="hidden" name="<?php echo esc_attr( $this->prefix ); ?>_form_submit" value="submit" />
   239 														<input type="hidden" name="<?php echo esc_attr( $this->prefix ); ?>_form_submit" value="submit" />
   235 														<input id="bws-submit-button" type="submit" class="button button-primary button-large" value="<?php esc_html_e( 'Save Changes', 'bestwebsoft' ); ?>" />
   240 														<input id="bws-submit-button" type="submit" class="button button-primary button-large" value="<?php esc_html_e( 'Save Changes', 'bestwebsoft' ); ?>" />
   236 														<?php wp_nonce_field( $this->plugin_basename, 'bws_nonce_name' ); ?>
   241 														<?php wp_nonce_field( $this->plugin_basename, 'bws_nonce_name' ); ?>
   237 													</div>
   242 													</div>
   238 													<div class="clear"></div>
   243 													<div class="clear"></div>
   263 									<input type="submit" class="button button-primary button-large" value="<?php esc_html_e( 'Save Changes', 'bestwebsoft' ); ?>" />
   268 									<input type="submit" class="button button-primary button-large" value="<?php esc_html_e( 'Save Changes', 'bestwebsoft' ); ?>" />
   264 									<?php wp_nonce_field( $this->plugin_basename, 'bws_nonce_name' ); ?>
   269 									<?php wp_nonce_field( $this->plugin_basename, 'bws_nonce_name' ); ?>
   265 								</div>
   270 								</div>
   266 								<?php
   271 								<?php
   267 								if ( ! empty( $this->wp_slug ) ) {
   272 								if ( ! empty( $this->wp_slug ) ) {
   268 									bws_plugin_reviews_block( $this->plugins_info['Name'], $this->wp_slug );}
   273 									bws_plugin_reviews_block( $this->plugins_info['Name'], $this->wp_slug );
       
   274 								}
   269 								?>
   275 								?>
   270 							</div>
   276 							</div>
   271 						</div>
   277 						</div>
   272 					</form>
   278 					</form>
   273 				</div>
   279 				</div>
   289 					<?php $this->display_tabs_list(); ?>
   295 					<?php $this->display_tabs_list(); ?>
   290 				</ul>
   296 				</ul>
   291 				<?php $this->display_tabs_content(); ?>
   297 				<?php $this->display_tabs_content(); ?>
   292 				<div class="clear"></div>
   298 				<div class="clear"></div>
   293 				<input type="hidden" name="bws_active_tab" value="<?php
   299 				<input type="hidden" name="bws_active_tab" value="<?php
   294 					if ( isset( $_REQUEST['bws_active_tab'] ) ) {
   300 				if ( isset( $_REQUEST['bws_active_tab'] ) ) {
   295 						echo esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['bws_active_tab'] ) ) );
   301 					echo esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['bws_active_tab'] ) ) );
   296 					}
   302 				}
   297 				?>" />
   303 				?>" />
   298 			</div>
   304 			</div>
   299 			<?php
   305 			<?php
   300 		}
   306 		}
   301 
   307 
   329 
   335 
   330 		/**
   336 		/**
   331 		 * Displays the content of tabs
   337 		 * Displays the content of tabs
   332 		 *
   338 		 *
   333 		 * @access private
   339 		 * @access private
   334 		 * @param  string $tab_slug
       
   335 		 * @return void
       
   336 		 */
   340 		 */
   337 		public function display_tabs_content() {
   341 		public function display_tabs_content() {
   338 			foreach ( $this->tabs as $tab_slug => $data ) {
   342 			foreach ( $this->tabs as $tab_slug => $data ) {
   339 				if ( ! empty( $data['is_pro'] ) && $this->hide_pro_tabs ) {
   343 				if ( ! empty( $data['is_pro'] ) && $this->hide_pro_tabs ) {
   340 					continue;
   344 					continue;
   355 
   359 
   356 		/**
   360 		/**
   357 		 * Save all options from all tabs and display errors\messages
   361 		 * Save all options from all tabs and display errors\messages
   358 		 *
   362 		 *
   359 		 * @access public
   363 		 * @access public
   360 		 * @param  void
       
   361 		 * @return array
   364 		 * @return array
   362 		 */
   365 		 */
   363 		public function save_all_tabs_options() {
   366 		public function save_all_tabs_options() {
   364 			$message = $notice = $error = '';
   367 			$message = '';
       
   368 			$notice  = '';
       
   369 			$error   = '';
   365 			/* Restore default settings */
   370 			/* Restore default settings */
   366 			if ( isset( $_POST['bws_restore_confirm'] ) && check_admin_referer( $this->plugin_basename, 'bws_settings_nonce_name' ) ) {
   371 			if ( isset( $_POST['bws_restore_confirm'] ) && check_admin_referer( $this->plugin_basename, 'bws_settings_nonce_name' ) ) {
   367 				$this->restore_options();
   372 				$this->restore_options();
   368 				$message = __( 'All plugin settings were restored.', 'bestwebsoft' );
   373 				$message = __( 'All plugin settings were restored.', 'bestwebsoft' );
   369 				/* Go Pro - check license key */
   374 				/* Go Pro - check license key */
   433 			do_action( __CLASS__ . '_display_custom_messages', $save_results );
   438 			do_action( __CLASS__ . '_display_custom_messages', $save_results );
   434 			?>
   439 			?>
   435 			<div class="updated fade inline" 
   440 			<div class="updated fade inline" 
   436 			<?php
   441 			<?php
   437 			if ( empty( $save_results['message'] ) ) {
   442 			if ( empty( $save_results['message'] ) ) {
   438 				echo 'style="display:none"';}
   443 				echo 'style="display:none"';
       
   444 			}
   439 			?>
   445 			?>
   440 			><p><strong><?php echo esc_html( $save_results['message'] ); ?></strong></p></div>
   446 			><p><strong><?php echo ! empty( $save_results['message'] ) ? wp_kses_post( $save_results['message'] ) : ''; ?></strong></p></div>
   441 			<div class="updated bws-notice inline" 
   447 			<div class="updated bws-notice inline" 
   442 			<?php
   448 			<?php
   443 			if ( empty( $save_results['notice'] ) ) {
   449 			if ( empty( $save_results['notice'] ) ) {
   444 				echo 'style="display:none"';}
   450 				echo 'style="display:none"';
       
   451 			}
   445 			?>
   452 			?>
   446 			><p><strong><?php echo esc_html( $save_results['notice'] ); ?></strong></p></div>
   453 			><p><strong><?php echo ! empty( $save_results['notice'] ) ? wp_kses_post( $save_results['notice'] ) : ''; ?></strong></p></div>
   447 			<div class="error inline" 
   454 			<div class="error inline" 
   448 			<?php
   455 			<?php
   449 			if ( empty( $save_results['error'] ) ) {
   456 			if ( empty( $save_results['error'] ) ) {
   450 				echo 'style="display:none"';}
   457 				echo 'style="display:none"';
       
   458 			}
   451 			?>
   459 			?>
   452 			><p><strong><?php echo esc_html( $save_results['error'] ); ?></strong></p></div>
   460 			><p><strong><?php echo ! empty( $save_results['error'] ) ? wp_kses_post( $save_results['error'] ) : ''; ?></strong></p></div>
   453 			<?php
   461 			<?php
   454 		}
   462 		}
   455 
   463 
   456 		/**
   464 		/**
   457 		 * Save plugin options to the database
   465 		 * Save plugin options to the database
   458 		 *
   466 		 *
   459 		 * @access public
   467 		 * @access public
   460 		 * @param  ab
   468 		 * @param  ab
   461 		 * @return array    The Action results
       
   462 		 * @abstract
   469 		 * @abstract
   463 		 */
   470 		 */
   464 		public function save_options() {
   471 		public function save_options() {
   465 			die( 'function Bws_Settings_Tabs::save_options() must be over-ridden in a sub-class.' );
   472 			die( 'function Bws_Settings_Tabs::save_options() must be over-ridden in a sub-class.' );
   466 		}
   473 		}
   498 			WP_Filesystem();
   505 			WP_Filesystem();
   499 
   506 
   500 			foreach ( array( 'css', 'php', 'js' ) as $extension ) {
   507 			foreach ( array( 'css', 'php', 'js' ) as $extension ) {
   501 				$file      = 'bws-custom-code.' . $extension;
   508 				$file      = 'bws-custom-code.' . $extension;
   502 				$real_file = $folder . '/' . $file;
   509 				$real_file = $folder . '/' . $file;
   503 				
   510 
   504 				if ( $wp_filesystem->exists( $real_file ) ) {
   511 				if ( $wp_filesystem->exists( $real_file ) ) {
   505 					update_recently_edited( $real_file );
   512 					update_recently_edited( $real_file );
   506 					$this->custom_code_args[ "content_{$extension}" ] = $wp_filesystem->get_contents( $real_file );//file_get_contents( $real_file );
   513 					$this->custom_code_args[ "content_{$extension}" ] = $wp_filesystem->get_contents( $real_file );
   507 					if ( ( $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $this->custom_code_args['blog_id'] ][ $file ] ) ) ||
   514 					if ( ( $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $this->custom_code_args['blog_id'] ][ $file ] ) ) ||
   508 						 ( ! $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $file ] ) ) ) {
   515 						( ! $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $file ] ) ) ) {
   509 						$this->custom_code_args[ "is_{$extension}_active" ] = true;
   516 						$this->custom_code_args[ "is_{$extension}_active" ] = true;
   510 					}
   517 					}
   511 					if ( is_writeable( $real_file ) ) {
   518 					if ( is_writeable( $real_file ) ) {
   512 						$this->custom_code_args[ "{$extension}_writeable" ] = true;
   519 						$this->custom_code_args[ "{$extension}_writeable" ] = true;
   513 					}
   520 					}
   569 								?>
   576 								?>
   570 								<p><big>
   577 								<p><big>
   571 										<strong><?php echo esc_html( $name ); ?></strong>
   578 										<strong><?php echo esc_html( $name ); ?></strong>
   572 										<?php
   579 										<?php
   573 										if ( ! $this->custom_code_args[ "{$extension}_writeable" ] ) {
   580 										if ( ! $this->custom_code_args[ "{$extension}_writeable" ] ) {
   574 											echo '(' . esc_html__( 'Browsing', 'bestwebsoft' ) . ')';}
   581 											echo '(' . esc_html__( 'Browsing', 'bestwebsoft' ) . ')';
       
   582 										}
   575 										?>
   583 										?>
   576 									</big>
   584 									</big>
   577 								</p>
   585 								</p>
   578 								<p class="bws_info">
   586 								<p class="bws_info">
   579 									<label>
   587 									<label>
   580 										<input type="checkbox" value="1" 
   588 										<input type="checkbox" value="1" 
   581 											<?php
   589 											<?php
   582 											if ( $this->custom_code_args[ "is_{$extension}_active" ] ) {
   590 											if ( $this->custom_code_args[ "is_{$extension}_active" ] ) {
   583 												echo 'checked';}
   591 												echo 'checked';
       
   592 											}
   584 											?>
   593 											?>
   585 										 />
   594 										 />
   586 										<?php printf( esc_html__( 'Activate custom %s code.', 'bestwebsoft' ), esc_html( $name ) ); ?>
   595 										<?php printf( esc_html__( 'Activate custom %s code.', 'bestwebsoft' ), esc_html( $name ) ); ?>
   587 									</label>
   596 									</label>
   588 								</p>
   597 								</p>
   589 								<textarea cols="70" rows="25" id="bws_newcontent_<?php echo esc_attr( $extension ); ?>" disabled="disabled"><?php
   598 								<textarea cols="70" rows="25" id="bws_newcontent_<?php echo esc_attr( $extension ); ?>" disabled="disabled"><?php
   590 									if ( isset( $this->custom_code_args[ "content_{$extension}" ] ) ) {
   599 								if ( isset( $this->custom_code_args[ "content_{$extension}" ] ) ) {
   591 										echo esc_html( stripslashes_deep( $this->custom_code_args[ "content_{$extension}" ] ) ); }
   600 									echo esc_html( stripslashes_deep( $this->custom_code_args[ "content_{$extension}" ] ) ); }
   592 									?></textarea>
   601 								?></textarea>
   593 								<p class="bws_info">
   602 								<p class="bws_info">
   594 									<?php echo esc_html( $extension_data['description'] ); ?>
   603 									<?php echo wp_kses_post( $extension_data['description'] ); ?>
   595 									<br>
   604 									<br>
   596 									<a href="<?php echo esc_url( $extension_data['learn_more_link'] ); ?>" target="_blank">
   605 									<a href="<?php echo esc_url( $extension_data['learn_more_link'] ); ?>" target="_blank">
   597 										<?php printf( esc_html__( 'Learn more about %s', 'bestwebsoft' ), esc_html__( $name ) ); ?>
   606 										<?php printf( esc_html__( 'Learn more about %s', 'bestwebsoft' ), esc_html( $name ) ); ?>
   598 									</a>
   607 									</a>
   599 								</p>
   608 								</p>
   600 								<?php
   609 								<?php
   601 							}
   610 							}
   602 							?>
   611 							?>
   603 						</div>
   612 						</div>
   604 					</div>
   613 					</div>
   605 					<div class="bws_pro_version_tooltip">
   614 					<div class="bws_pro_version_tooltip">
   606 						<a class="bws_button" href="<?php echo esc_url( $this->plugins_info['PluginURI'] ); ?>?k=<?php echo esc_attr( $this->link_key ); ?>&amp;pn=<?php echo esc_attr( $this->link_pn ); ?>&amp;v=<?php echo esc_attr( $this->plugins_info['Version'] ); ?>&amp;wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="<?php echo $this->plugins_info["Name"]; ?>">Upgrade to Pro</a>
   615 						<a class="bws_button" href="<?php echo esc_url( $this->plugins_info['PluginURI'] ); ?>?k=<?php echo esc_attr( $this->link_key ); ?>&amp;pn=<?php echo esc_attr( $this->link_pn ); ?>&amp;v=<?php echo esc_attr( $this->plugins_info['Version'] ); ?>&amp;wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="<?php echo esc_html( $this->plugins_info['Name'] ); ?>">Upgrade to Pro</a>
   607 						<div class="clear"></div>
   616 						<div class="clear"></div>
   608 					</div>
   617 					</div>
   609 				</div>
   618 				</div>
   610 				<?php
   619 				<?php
   611 			} else {
   620 			} else {
   612 				?>
   621 				?>
   613 				<div class="bws_pro_version_tooltip">
   622 				<div class="bws_pro_version_tooltip">
   614 					<a class="bws_button" href="<?php echo esc_url( $this->plugins_info['PluginURI'] ); ?>?k=<?php echo esc_attr( $this->link_key ); ?>&amp;pn=<?php echo esc_attr( $this->link_pn ); ?>&amp;v=<?php echo esc_attr( $this->plugins_info['Version'] ); ?>&amp;wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="<?php echo $this->plugins_info["Name"]; ?>">Upgrade to Pro</a>
   623 					<a class="bws_button" href="<?php echo esc_url( $this->plugins_info['PluginURI'] ); ?>?k=<?php echo esc_attr( $this->link_key ); ?>&amp;pn=<?php echo esc_attr( $this->link_pn ); ?>&amp;v=<?php echo esc_attr( $this->plugins_info['Version'] ); ?>&amp;wp_v=<?php echo esc_attr( $wp_version ); ?>" target="_blank" title="<?php echo esc_html( $this->plugins_info['Name'] ); ?>">Upgrade to Pro</a>
   615 					<div class="clear"></div>
   624 					<div class="clear"></div>
   616 				</div>
   625 				</div>
   617 				<?php
   626 				<?php
   618 			}
   627 			}
   619 		}
   628 		}
   657 							<td>
   666 							<td>
   658 								<label>
   667 								<label>
   659 									<input <?php echo esc_attr( wp_kses_data( $this->change_permission_attr ) ); ?> name="bws_hide_premium_options_submit" type="checkbox" value="1" 
   668 									<input <?php echo esc_attr( wp_kses_data( $this->change_permission_attr ) ); ?> name="bws_hide_premium_options_submit" type="checkbox" value="1" 
   660 										<?php
   669 										<?php
   661 										if ( ! $this->hide_pro_tabs ) {
   670 										if ( ! $this->hide_pro_tabs ) {
   662 											echo 'checked="checked "';}
   671 											echo 'checked="checked "';
       
   672 										}
   663 										?>
   673 										?>
   664 									/>
   674 									/>
   665 									<span class="bws_info"><?php esc_html_e( 'Enable to display plugin Pro options.', 'bestwebsoft' ); ?></span>
   675 									<span class="bws_info"><?php esc_html_e( 'Enable to display plugin Pro options.', 'bestwebsoft' ); ?></span>
   666 								</label>
   676 								</label>
   667 							</td>
   677 							</td>
   672 						<td>
   682 						<td>
   673 							<label>
   683 							<label>
   674 								<input <?php echo esc_attr( wp_kses_data( $this->change_permission_attr ) ); ?> name="bws_track_usage" type="checkbox" value="1" 
   684 								<input <?php echo esc_attr( wp_kses_data( $this->change_permission_attr ) ); ?> name="bws_track_usage" type="checkbox" value="1" 
   675 									<?php
   685 									<?php
   676 									if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] ) ) {
   686 									if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] ) ) {
   677 										echo 'checked="checked "';}
   687 										echo 'checked="checked "';
       
   688 									}
   678 									?>
   689 									?>
   679 								/>
   690 								/>
   680 								<span class="bws_info"><?php esc_html_e( 'Enable to allow tracking plugin usage anonymously in order to make it better.', 'bestwebsoft' ); ?></span>
   691 								<span class="bws_info"><?php esc_html_e( 'Enable to allow tracking plugin usage anonymously in order to make it better.', 'bestwebsoft' ); ?></span>
   681 							</label>
   692 							</label>
   682 						</td>
   693 						</td>
   876 								</td>
   887 								</td>
   877 							</tr>
   888 							</tr>
   878 						</table>
   889 						</table>
   879 						<?php
   890 						<?php
   880 					} else {
   891 					} else {
   881 						$attr = $license_key = '';
   892 						$attr        = '';
       
   893 						$license_key = '';
   882 						if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] ) &&
   894 						if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] ) &&
   883 							'5' < $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] &&
   895 							'5' < $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] &&
   884 							$bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
   896 							$bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
   885 							$attr = 'disabled="disabled"';
   897 							$attr = 'disabled="disabled"';
   886 						}
   898 						}
   894 								<th scope="row"><?php echo esc_html( $pro_plugin_name ) . ' License'; ?></th>
   906 								<th scope="row"><?php echo esc_html( $pro_plugin_name ) . ' License'; ?></th>
   895 								<td>
   907 								<td>
   896 									<input <?php echo wp_kses_data( $attr ); ?> type="text" name="bws_license_key_<?php echo esc_attr( ( ! empty( $single_license['pro_slug'] ) ) ? $single_license['pro_slug'] : $single_license['slug'] ); ?>" value="<?php echo esc_attr( $license_key ); ?>" />
   908 									<input <?php echo wp_kses_data( $attr ); ?> type="text" name="bws_license_key_<?php echo esc_attr( ( ! empty( $single_license['pro_slug'] ) ) ? $single_license['pro_slug'] : $single_license['slug'] ); ?>" value="<?php echo esc_attr( $license_key ); ?>" />
   897 									<input <?php echo wp_kses_data( $attr ); ?> type="hidden" name="bws_license_plugin_<?php echo esc_attr( ( ! 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'] ); ?>" />
   909 									<input <?php echo wp_kses_data( $attr ); ?> type="hidden" name="bws_license_plugin_<?php echo esc_attr( ( ! 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'] ); ?>" />
   898 									<input <?php echo wp_kses_data( $attr ); ?> type="submit" class="button button-secondary" name="bws_license_submit" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
   910 									<input <?php echo wp_kses_data( $attr ); ?> type="submit" class="button button-secondary" name="bws_license_submit" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
   899 									<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'bws_license_key_nonce' ); ?>" />
   911 									<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'bws_license_key_nonce' ) ); ?>" />
   900 									<div class="bws_info">
   912 									<div class="bws_info">
   901 										<?php printf( esc_html__( 'Enter your license key to activate %s and get premium plugin features.', 'bestwebsoft' ), '<a href="' . esc_url( $this->bws_plugin_link ) . '" target="_blank" title="' . esc_html( $pro_plugin_name ) . '">' . esc_html( $pro_plugin_name ) . '</a>' ); ?>
   913 										<?php printf( esc_html__( 'Enter your license key to activate %s and get premium plugin features.', 'bestwebsoft' ), '<a href="' . esc_url( $this->bws_plugin_link ) . '" target="_blank" title="' . esc_html( $pro_plugin_name ) . '">' . esc_html( $pro_plugin_name ) . '</a>' ); ?>
   902 									</div>
   914 									</div>
   903 									<?php if ( '' !== $attr ) { ?>
   915 									<?php if ( '' !== $attr ) { ?>
   904 										<p><?php esc_html_e( 'Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.', 'bestwebsoft' ); ?></p>
   916 										<p><?php esc_html_e( 'Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.', 'bestwebsoft' ); ?></p>
   956 		 */
   968 		 */
   957 		private function save_options_license_key() {
   969 		private function save_options_license_key() {
   958 			global $wp_version, $bstwbsftwppdtplgns_options, $wp_filesystem;
   970 			global $wp_version, $bstwbsftwppdtplgns_options, $wp_filesystem;
   959 			/*$empty_field_error - added to avoid error when 1 field is empty while another field contains license key*/
   971 			/*$empty_field_error - added to avoid error when 1 field is empty while another field contains license key*/
   960 
   972 
   961 			$error = $message = $empty_field_error = '';
   973 			$error             = '';
       
   974 			$message           = '';
       
   975 			$empty_field_error = '';
   962 
   976 
   963 			if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'bws_license_key_nonce' ) ) {
   977 			if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'bws_license_key_nonce' ) ) {
   964 					die( __( 'Security check', 'bestwebsoft' ) );
   978 					die( esc_html__( 'Security check', 'bestwebsoft' ) );
   965 			} else {
   979 			} else {
   966 
   980 
   967 				foreach ( $this->licenses as $single_license ) {
   981 				foreach ( $this->licenses as $single_license ) {
   968 					$bws_license_key = ( isset( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) : '';
   982 					$bws_license_key = ( isset( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ ( ! empty( $single_license['pro_slug'] ) ) ? 'bws_license_key_' . $single_license['pro_slug'] : 'bws_license_key_' . $single_license['slug'] ] ) ) : '';
   969 					if ( '' !== $bws_license_key ) {
   983 					if ( '' !== $bws_license_key ) {
  1076 									}
  1090 									}
  1077 								}
  1091 								}
  1078 								/* Go Pro */
  1092 								/* Go Pro */
  1079 							} else {
  1093 							} else {
  1080 								$slug = ! empty( $single_license['pro_slug'] ) ? 'bws_license_plugin_' . $single_license['pro_slug'] : 'bws_license_plugin_' . $single_license['slug'];
  1094 								$slug = ! empty( $single_license['pro_slug'] ) ? 'bws_license_plugin_' . $single_license['pro_slug'] : 'bws_license_plugin_' . $single_license['slug'];
       
  1095 
  1081 								$bws_license_plugin = isset( $_POST[ $slug ] ) ? sanitize_text_field( wp_unslash( $_POST[ $slug ] ) ) : '';
  1096 								$bws_license_plugin = isset( $_POST[ $slug ] ) ? sanitize_text_field( wp_unslash( $_POST[ $slug ] ) ) : '';
  1082 								if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
  1097 								if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
  1083 									$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
  1098 									$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
  1084 								} else {
  1099 								} else {
  1085 									$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
  1100 									$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
  1152 										$this->pro_plugin_is_activated = true;
  1167 										$this->pro_plugin_is_activated = true;
  1153 									}
  1168 									}
  1154 								}
  1169 								}
  1155 								/* add 'track_usage' for Pro version */
  1170 								/* add 'track_usage' for Pro version */
  1156 								if ( ! empty( $bstwbsftwppdtplgns_options['track_usage'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] ) &&
  1171 								if ( ! empty( $bstwbsftwppdtplgns_options['track_usage'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] ) &&
  1157 									 empty( $bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] ) ) {
  1172 									empty( $bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] ) ) {
  1158 									$bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] = $bstwbsftwppdtplgns_options['track_usage'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ];
  1173 									$bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] = $bstwbsftwppdtplgns_options['track_usage'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ];
  1159 								}
  1174 								}
  1160 
  1175 
  1161 								if ( $this->is_multisite ) {
  1176 								if ( $this->is_multisite ) {
  1162 									update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
  1177 									update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
  1179 
  1194 
  1180 		/**
  1195 		/**
  1181 		 * Display help phrase
  1196 		 * Display help phrase
  1182 		 *
  1197 		 *
  1183 		 * @access public
  1198 		 * @access public
  1184 		 * @param  void
  1199 		 * @echo html    The Action results
  1185 		 * @return html    The Action results
       
  1186 		 */
  1200 		 */
  1187 		public function help_phrase() {
  1201 		public function help_phrase() {
  1188 			/*pls */
  1202 			/*pls */
  1189 			echo '<div class="bws_tab_description">' . esc_html__( 'Need Help?', 'bestwebsoft' ) . ' ';
  1203 			echo '<div class="bws_tab_description">' . esc_html__( 'Need Help?', 'bestwebsoft' ) . ' ';
  1190 			if ( '' !== $this->doc_link ) {
  1204 			if ( '' !== $this->doc_link ) {
  1227 				$this->default_options['first_install'],
  1241 				$this->default_options['first_install'],
  1228 				$this->default_options['suggest_feature_banner'],
  1242 				$this->default_options['suggest_feature_banner'],
  1229 				$this->default_options['display_settings_notice']
  1243 				$this->default_options['display_settings_notice']
  1230 			);
  1244 			);
  1231 			/**
  1245 			/**
  1232 			 * filter - Change default_options array OR process custom functions
  1246 			 * Filter - Change default_options array OR process custom functions
  1233 			 */
  1247 			 */
  1234 			$this->options = apply_filters( __CLASS__ . '_additional_restore_options', $this->default_options );
  1248 			$this->options = apply_filters( __CLASS__ . '_additional_restore_options', $this->default_options );
  1235 			if ( $this->is_network_options ) {
  1249 			if ( $this->is_network_options ) {
  1236 				$this->options['network_apply']  = 'default';
  1250 				$this->options['network_apply']  = 'default';
  1237 				$this->options['network_view']   = '1';
  1251 				$this->options['network_view']   = '1';
  1367 			wp_add_inline_script( 'bws-request-feature-dialog', sprintf( $script ) );
  1381 			wp_add_inline_script( 'bws-request-feature-dialog', sprintf( $script ) );
  1368 		}
  1382 		}
  1369 	}
  1383 	}
  1370 }
  1384 }
  1371 
  1385 
  1372 /**
       
  1373  * Called after the user has submitted his reason for deactivating the plugin.
       
  1374  *
       
  1375  * @since  2.1.3
       
  1376  */
       
  1377 if ( ! function_exists( 'bws_submit_request_feature_action' ) ) {
  1386 if ( ! function_exists( 'bws_submit_request_feature_action' ) ) {
       
  1387 	/**
       
  1388 	 * Called after the user has submitted his reason for deactivating the plugin.
       
  1389 	 *
       
  1390 	 * @since  2.1.3
       
  1391 	 */
  1378 	function bws_submit_request_feature_action() {
  1392 	function bws_submit_request_feature_action() {
  1379 		global $bstwbsftwppdtplgns_options, $wp_version, $bstwbsftwppdtplgns_active_plugins, $current_user;
  1393 		global $bstwbsftwppdtplgns_options, $wp_version, $bstwbsftwppdtplgns_active_plugins, $current_user;
  1380 
  1394 
  1381 		if ( isset( $_REQUEST['bws_ajax_nonce'] ) ) {
  1395 		if ( isset( $_REQUEST['bws_ajax_nonce'] ) ) {
  1382 
  1396 
  1383 			wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['bws_ajax_nonce'] ) ), 'bws_ajax_nonce' );
  1397 			check_ajax_referer( 'bws_ajax_nonce', sanitize_text_field( wp_unslash( $_REQUEST['bws_ajax_nonce'] ) ) );
  1384 
  1398 
  1385 			$basename = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : '';
  1399 			$basename = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : '';
  1386 			$info     = isset( $_REQUEST['info'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['info'] ) ) : '';
  1400 			$info     = isset( $_REQUEST['info'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['info'] ) ) : '';
  1387 
  1401 
  1388 			if ( empty( $info ) || empty( $basename ) ) {
  1402 			if ( empty( $info ) || empty( $basename ) ) {