wp/wp-content/plugins/portfolio/bws_menu/deprecated.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 <?php
     1 <?php
     2 /*
     2 /**
     3 * Deprecated functions for BestWebSoft plugins
     3  * Deprecated functions for BestWebSoft plugins
     4 */
     4  */
     5 
     5 
     6 /**
     6 /**
     7 * Function add BWS Plugins page
     7  * Function add BWS Plugins page
     8 * @deprecated 1.9.8 (15.12.2016)
     8  *
     9 * @return void
     9  * @deprecated 1.9.8 (15.12.2016)
    10 */
    10  * @return void
    11 if ( ! function_exists ( 'bws_general_menu' ) ) {
    11  */
       
    12 if ( ! function_exists( 'bws_general_menu' ) ) {
    12 	function bws_general_menu() {
    13 	function bws_general_menu() {
    13 		global $menu, $bws_general_menu_exist;
    14 		global $menu, $bws_general_menu_exist;
    14 
    15 
    15 		if ( ! $bws_general_menu_exist ) {
    16 		if ( ! $bws_general_menu_exist ) {
    16 			/* we check also menu exist in global array as in old plugins $bws_general_menu_exist variable not exist */
    17 			/* we check also menu exist in global array as in old plugins $bws_general_menu_exist variable not exist */
    17 			foreach ( $menu as $value_menu ) {
    18 			foreach ( $menu as $value_menu ) {
    18 				if ( 'bws_panel' == $value_menu[2] ) {
    19 				if ( 'bws_panel' === $value_menu[2] ) {
    19 					$bws_general_menu_exist = true;
    20 					$bws_general_menu_exist = true;
    20 					return;
    21 					return;
    21 				}
    22 				}
    22 			}
    23 			}
    23 
    24 
    24 			add_menu_page( 'BWS Panel', 'BWS Panel', 'manage_options', 'bws_panel', 'bws_add_menu_render', 'none', '1001' );
    25 			add_menu_page( 'BWS Panel', 'BWS Panel', 'manage_options', 'bws_panel', 'bws_add_menu_render', 'none', '1001' );
    25 
    26 
    26 			add_submenu_page( 'bws_panel', __( 'Plugins', 'bestwebsoft' ), __( 'Plugins', 'bestwebsoft' ), 'manage_options', 'bws_panel', 'bws_add_menu_render' );
    27 			add_submenu_page( 'bws_panel', esc_html__( 'Plugins', 'bestwebsoft' ), esc_html__( 'Plugins', 'bestwebsoft' ), 'manage_options', 'bws_panel', 'bws_add_menu_render' );
    27 			add_submenu_page( 'bws_panel', __( 'Themes', 'bestwebsoft' ), __( 'Themes', 'bestwebsoft' ), 'manage_options', 'bws_themes', 'bws_add_menu_render' );
    28 			add_submenu_page( 'bws_panel', esc_html__( 'Themes', 'bestwebsoft' ), esc_html__( 'Themes', 'bestwebsoft' ), 'manage_options', 'bws_themes', 'bws_add_menu_render' );
    28 			add_submenu_page( 'bws_panel', __( 'System Status', 'bestwebsoft' ), __( 'System Status', 'bestwebsoft' ), 'manage_options', 'bws_system_status', 'bws_add_menu_render' );
    29 			add_submenu_page( 'bws_panel', esc_html__( 'System Status', 'bestwebsoft' ), esc_html__( 'System Status', 'bestwebsoft' ), 'manage_options', 'bws_system_status', 'bws_add_menu_render' );
    29 
    30 
    30 			$bws_general_menu_exist = true;
    31 			$bws_general_menu_exist = true;
    31 		}
    32 		}
    32 	}
    33 	}
    33 }
    34 }
    34 
    35 
    35 /**
    36 /**
    36 * Function process submit on the `Go Pro` tab
    37  * Function process submit on the `Go Pro` tab
    37 * @deprecated 1.9.8 (15.12.2016)
    38  *
    38 * @todo Remove function after 01.01.2021
    39  * @deprecated 1.9.8 (15.12.2016)
    39 */
    40  * @todo Remove function after 01.01.2021
       
    41  */
    40 if ( ! function_exists( 'bws_go_pro_tab_check' ) ) {
    42 if ( ! function_exists( 'bws_go_pro_tab_check' ) ) {
    41 	function bws_go_pro_tab_check( $plugin_basename, $plugin_options_name = false, $is_network_option = false ) {
    43 	function bws_go_pro_tab_check( $plugin_basename, $plugin_options_name = false, $is_network_option = false ) {
    42 		global $bstwbsftwppdtplgns_options;
    44 		global $bstwbsftwppdtplgns_options;
    43 		if ( ! isset( $bstwbsftwppdtplgns_options ) )
    45 		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
    44 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
    46 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
       
    47 		}
    45 		if ( ! isset( $bstwbsftwppdtplgns_options['deprecated_function']['bws_go_pro_tab_check'] ) ) {
    48 		if ( ! isset( $bstwbsftwppdtplgns_options['deprecated_function']['bws_go_pro_tab_check'] ) ) {
    46 			$get_debug_backtrace = debug_backtrace();
    49 			$get_debug_backtrace = debug_backtrace();
    47 			$file = ( ! empty( $get_debug_backtrace[0]['file'] ) ) ? $get_debug_backtrace[0]['file'] : '';
    50 			$file                = ( ! empty( $get_debug_backtrace[0]['file'] ) ) ? $get_debug_backtrace[0]['file'] : '';
    48 			$bstwbsftwppdtplgns_options['deprecated_function']['bws_go_pro_tab_check'] = array(
    51 			$bstwbsftwppdtplgns_options['deprecated_function']['bws_go_pro_tab_check'] = array(
    49 				'file' => $file
    52 				'file' => $file,
    50 			);
    53 			);
    51 			if ( is_multisite() )
    54 			if ( is_multisite() ) {
    52 				update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    55 				update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    53 			else
    56 			} else {
    54 				update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    57 				update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    55 		}
    58 			}
    56 	}
    59 		}
    57 }
    60 	}
    58 
    61 }
    59 /**
    62 
    60 * Function display 'Custom code' tab
    63 /**
    61 *
    64  * Function display 'Custom code' tab
    62 * @deprecated 1.9.8 (15.12.2016)
    65  *
    63 * @todo Remove function after 01.01.2021
    66  * @deprecated 1.9.8 (15.12.2016)
    64 */
    67  * @todo Remove function after 01.01.2021
       
    68  */
    65 if ( ! function_exists( 'bws_custom_code_tab' ) ) {
    69 if ( ! function_exists( 'bws_custom_code_tab' ) ) {
    66 	function bws_custom_code_tab() {
    70 	function bws_custom_code_tab() {
    67 		global $bstwbsftwppdtplgns_options;
    71 		global $bstwbsftwppdtplgns_options;
    68 		if ( ! isset( $bstwbsftwppdtplgns_options ) )
    72 		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
    69 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
    73 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
       
    74 		}
    70 		if ( ! isset( $bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] ) ) {
    75 		if ( ! isset( $bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] ) ) {
    71 			$get_debug_backtrace = debug_backtrace();
    76 			$get_debug_backtrace = debug_backtrace();
    72 			$file = ( ! empty( $get_debug_backtrace[0]['file'] ) ) ? $get_debug_backtrace[0]['file'] : '';
    77 			$file                = ( ! empty( $get_debug_backtrace[0]['file'] ) ) ? $get_debug_backtrace[0]['file'] : '';
    73 			$bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] = array(
    78 			$bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] = array(
    74 				'file' => $file
    79 				'file' => $file,
    75 			);
    80 			);
    76 			if ( is_multisite() )
    81 			if ( is_multisite() ) {
    77 				update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    82 				update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    78 			else
    83 			} else {
    79 				update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    84 				update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
    80 		}
    85 			}
    81 	}
    86 		}
    82 }
    87 	}
    83 
    88 }
    84 /**
    89 
    85 * Function check license key for Pro plugins version
    90 /**
    86 * @deprecated 1.9.8 (15.12.2016)
    91  * Function check license key for Pro plugins version
    87 * @todo Remove function after 01.01.2021
    92  *
    88 */
    93  * @deprecated 1.9.8 (15.12.2016)
       
    94  * @todo Remove function after 01.01.2021
       
    95  */
    89 if ( ! function_exists( 'bws_check_pro_license' ) ) {
    96 if ( ! function_exists( 'bws_check_pro_license' ) ) {
    90 	function bws_check_pro_license( $plugin_basename, $trial_plugin = false ) {
    97 	function bws_check_pro_license( $plugin_basename, $trial_plugin = false ) {
    91 		global $bstwbsftwppdtplgns_options;
    98 		global $bstwbsftwppdtplgns_options;
    92 		if ( ! isset( $bstwbsftwppdtplgns_options ) )
    99 		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
    93 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
   100 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
       
   101 		}
    94 		if ( ! isset( $bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] ) ) {
   102 		if ( ! isset( $bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] ) ) {
    95 			$get_debug_backtrace = debug_backtrace();
   103 			$get_debug_backtrace = debug_backtrace();
    96 			$file = ( ! empty( $get_debug_backtrace[0]['file'] ) ) ? $get_debug_backtrace[0]['file'] : '';
   104 			$file                = ( ! empty( $get_debug_backtrace[0]['file'] ) ) ? $get_debug_backtrace[0]['file'] : '';
    97 			$bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] = array(
   105 			$bstwbsftwppdtplgns_options['deprecated_function']['bws_custom_code_tab'] = array(
    98 				'file' => $file
   106 				'file' => $file,
    99 			);
   107 			);
   100 			if ( is_multisite() )
   108 			if ( is_multisite() ) {
   101 				update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   109 				update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   102 			else
   110 			} else {
   103 				update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   111 				update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
   104 		}
   112 			}
   105 	}
   113 		}
   106 }
   114 	}
   107 
   115 }
   108 /**
   116 
   109 * Function display block for checking license key for Pro plugins version
   117 /**
   110 * @deprecated 1.9.8 (15.12.2016)
   118  * Function display block for checking license key for Pro plugins version
   111 * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
   119  *
   112 */
   120  * @deprecated 1.9.8 (15.12.2016)
   113 if ( ! function_exists ( 'bws_check_pro_license_form' ) ) {
   121  * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
       
   122  */
       
   123 if ( ! function_exists( 'bws_check_pro_license_form' ) ) {
   114 	function bws_check_pro_license_form( $plugin_basename ) {
   124 	function bws_check_pro_license_form( $plugin_basename ) {
   115 		global $bstwbsftwppdtplgns_options;
   125 		global $bstwbsftwppdtplgns_options;
   116 		$license_key = ( isset( $bstwbsftwppdtplgns_options[ $plugin_basename ] ) ) ? $bstwbsftwppdtplgns_options[ $plugin_basename ] : ''; ?>
   126 		$license_key = ( isset( $bstwbsftwppdtplgns_options[ $plugin_basename ] ) ) ? $bstwbsftwppdtplgns_options[ $plugin_basename ] : ''; ?>
   117 		<div class="clear"></div>
   127 		<div class="clear"></div>
   118 		<form method="post" action="">
   128 		<form method="post" action="">
   119 			<p><?php echo _e( 'If necessary, you can check if the license key is correct or reenter it in the field below. You can find your license key on your personal page - Client Area - on our website', 'bestwebsoft' ) . ' <a href="https://bestwebsoft.com/client-area">https://bestwebsoft.com/client-area</a> ' . __( '(your username is the email address specified during the purchase). If necessary, please submit "Lost your password?" request.', 'bestwebsoft' ); ?></p>
   129 			<p><?php echo esc_html_e( 'If necessary, you can check if the license key is correct or reenter it in the field below. You can find your license key on your personal page - Client Area - on our website', 'bestwebsoft' ) . ' <a href="https://bestwebsoft.com/client-area">https://bestwebsoft.com/client-area</a> ' . esc_html__( '(your username is the email address specified during the purchase). If necessary, please submit "Lost your password?" request.', 'bestwebsoft' ); ?></p>
   120 			<p>
   130 			<p>
   121 				<input type="text" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $license_key ); ?>" />
   131 				<input type="text" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $license_key ); ?>" />
   122 				<input type="hidden" name="bws_license_submit" value="submit" />
   132 				<input type="hidden" name="bws_license_submit" value="submit" />
   123 				<input type="submit" class="button" value="<?php _e( 'Check license key', 'bestwebsoft' ) ?>" />
   133 				<input type="submit" class="button" value="<?php esc_html_e( 'Check license key', 'bestwebsoft' ); ?>" />
   124 				<?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
   134 				<?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
   125 			</p>
   135 			</p>
   126 		</form>
   136 		</form>
   127 	<?php }
   137 		<?php
   128 }
   138 	}
   129 
   139 }
   130 /**
   140 
   131 * Function process submit on the `Go Pro` tab for TRIAL
   141 /**
   132 * @deprecated 1.9.8 (15.12.2016)
   142  * Function process submit on the `Go Pro` tab for TRIAL
   133 * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
   143  *
   134 */
   144  * @deprecated 1.9.8 (15.12.2016)
       
   145  * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
       
   146  */
   135 if ( ! function_exists( 'bws_go_pro_from_trial_tab' ) ) {
   147 if ( ! function_exists( 'bws_go_pro_from_trial_tab' ) ) {
   136 	function bws_go_pro_from_trial_tab( $plugin_info, $plugin_basename, $page, $link_slug, $link_key, $link_pn, $trial_license_is_set = true ) {
   148 	function bws_go_pro_from_trial_tab( $plugin_info, $plugin_basename, $page, $link_slug, $link_key, $link_pn, $trial_license_is_set = true ) {
   137 		global $wp_version, $bstwbsftwppdtplgns_options;
   149 		global $wp_version, $bstwbsftwppdtplgns_options;
   138 		$bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? sanitize_text_field( $_POST['bws_license_key'] ) : "";
   150 		$bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? sanitize_text_field( wp_unslash( $_POST['bws_license_key'] ) ) : '';
   139 		if ( $trial_license_is_set ) { ?>
   151 		if ( $trial_license_is_set ) {
       
   152 			?>
   140 			<form method="post" action="">
   153 			<form method="post" action="">
   141 				<p>
   154 				<p>
   142 					<?php printf( __( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), '<a href="https://bestwebsoft.com/products/wordpress/plugins/' . $link_slug . '/?k=' . $link_key . '&amp;pn=' . $link_pn . '&amp;v=' . $plugin_info["Version"] . '&amp;wp_v=' . $wp_version .'" target="_blank" title="' . $plugin_info["Name"] . '">Pro</a>' ); ?> <?php _e( 'After that, you can activate it by entering your license key.', 'bestwebsoft' ); ?>
   155 					<?php printf( esc_html__( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), esc_html( '<a href="https://bestwebsoft.com/products/wordpress/plugins/' . $link_slug . '/?k=' . $link_key . '&amp;pn=' . $link_pn . '&amp;v=' . $plugin_info['Version'] . '&amp;wp_v=' . $wp_version . '" target="_blank" title="' . $plugin_info['Name'] . '">Pro</a>' ) ); ?> <?php esc_html_e( 'After that, you can activate it by entering your license key.', 'bestwebsoft' ); ?>
   143 					<br />
   156 					<br />
   144 					<span class="bws_info">
   157 					<span class="bws_info">
   145 						<?php _e( 'License key can be found in the', 'bestwebsoft' ); ?>
   158 						<?php esc_html_e( 'License key can be found in the', 'bestwebsoft' ); ?>
   146 						<a href="https://bestwebsoft.com/wp-login.php">Client Area</a>
   159 						<a href="https://bestwebsoft.com/wp-login.php">Client Area</a>
   147 						<?php _e( '(your username is the email address specified during the purchase).', 'bestwebsoft' ); ?>
   160 						<?php esc_html_e( '(your username is the email address specified during the purchase).', 'bestwebsoft' ); ?>
   148 					</span>
   161 					</span>
   149 				</p>
   162 				</p>
   150 				<?php if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['count'] ) &&
   163 				<?php
       
   164 				if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['count'] ) &&
   151 					'5' < $bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['count'] &&
   165 					'5' < $bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['count'] &&
   152 					$bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) { ?>
   166 					$bstwbsftwppdtplgns_options['go_pro'][ $plugin_basename ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
       
   167 					?>
   153 					<p>
   168 					<p>
   154 						<input disabled="disabled" type="text" name="bws_license_key" value="" />
   169 						<input disabled="disabled" type="text" name="bws_license_key" value="" />
   155 						<input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
   170 						<input disabled="disabled" type="submit" class="button-primary" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
   156 					</p>
   171 					</p>
   157 					<p><?php _e( "Unfortunately, you have exceeded the number of available tries per day.", 'bestwebsoft' ); ?></p>
   172 					<p><?php esc_html_e( 'Unfortunately, you have exceeded the number of available tries per day.', 'bestwebsoft' ); ?></p>
   158 				<?php } else { ?>
   173 				<?php } else { ?>
   159 					<p>
   174 					<p>
   160 						<input type="text" maxlength="100" name="bws_license_key" value="" />
   175 						<input type="text" maxlength="100" name="bws_license_key" value="" />
   161 						<input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $plugin_basename ); ?>" />
   176 						<input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $plugin_basename ); ?>" />
   162 						<input type="hidden" name="bws_license_submit" value="submit" />
   177 						<input type="hidden" name="bws_license_submit" value="submit" />
   163 						<input type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
   178 						<input type="submit" class="button-primary" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
   164 						<?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
   179 						<?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
   165 					</p>
   180 					</p>
   166 				<?php } ?>
   181 				<?php } ?>
   167 			</form>
   182 			</form>
   168 		<?php } else { 
   183 			<?php
   169 			$page_url = esc_url( self_admin_url( 'admin.php?page=' . $page ) ); ?>
   184 		} else {
   170 			<p><?php _e( "Congratulations! The Pro license of the plugin is activated successfully.", 'bestwebsoft' ); ?></p>
   185 			$page_url = esc_url( self_admin_url( 'admin.php?page=' . $page ) );
       
   186 			?>
       
   187 			<p><?php esc_html_e( 'Congratulations! The Pro license of the plugin is activated successfully.', 'bestwebsoft' ); ?></p>
   171 			<p>
   188 			<p>
   172 				<?php _e( "Please, go to", 'bestwebsoft' ); ?> <a href="<?php echo $page_url; ?>"><?php _e( 'the setting page', 'bestwebsoft' ); ?></a>
   189 				<?php esc_html_e( 'Please, go to', 'bestwebsoft' ); ?> <a href="<?php echo esc_url( $page_url ); ?>"><?php esc_html_e( 'the setting page', 'bestwebsoft' ); ?></a>
   173 			</p>
   190 			</p>
   174 		<?php }
   191 			<?php
   175 	}
   192 		}
   176 }
   193 	}
   177 
   194 }
   178 
   195 
   179 /**
   196 
   180 * Function display block for restoring default product settings
   197 /**
   181 * @deprecated 1.9.8 (15.12.2016)
   198  * Function display block for restoring default product settings
   182 * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
   199  *
   183 */
   200  * @deprecated 1.9.8 (15.12.2016)
   184 if ( ! function_exists ( 'bws_form_restore_default_settings' ) ) {
   201  * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
   185 	function bws_form_restore_default_settings( $plugin_basename, $change_permission_attr = '' ) { ?>
   202  */
       
   203 if ( ! function_exists( 'bws_form_restore_default_settings' ) ) {
       
   204 	function bws_form_restore_default_settings( $plugin_basename, $change_permission_attr = '' ) {
       
   205 		?>
   186 		<form method="post" action="">
   206 		<form method="post" action="">
   187 			<p><?php _e( 'Restore all plugin settings to defaults', 'bestwebsoft' ); ?></p>
   207 			<p><?php esc_html_e( 'Restore all plugin settings to defaults', 'bestwebsoft' ); ?></p>
   188 			<p>
   208 			<p>
   189 				<input <?php echo $change_permission_attr; ?> type="submit" class="button" value="<?php _e( 'Restore settings', 'bestwebsoft' ); ?>" />
   209 				<input <?php echo esc_html( $change_permission_attr ); ?> type="submit" class="button" value="<?php esc_html_e( 'Restore settings', 'bestwebsoft' ); ?>" />
   190 			</p>
   210 			</p>
   191 			<input type="hidden" name="bws_restore_default" value="submit" />
   211 			<input type="hidden" name="bws_restore_default" value="submit" />
   192 			<?php wp_nonce_field( $plugin_basename, 'bws_settings_nonce_name' ); ?>
   212 			<?php wp_nonce_field( $plugin_basename, 'bws_settings_nonce_name' ); ?>
   193 		</form>
   213 		</form>
   194 	<?php }
   214 		<?php
   195 }
   215 	}
   196 
   216 }
   197 /**
   217 
   198 * Function display GO PRO tab
   218 /**
   199 * @deprecated 1.9.8 (15.12.2016)
   219  * Function display GO PRO tab
   200 * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
   220  *
   201 */
   221  * @deprecated 1.9.8 (15.12.2016)
       
   222  * @todo add notice and remove functional after 01.01.2018. Remove function after 01.01.2019
       
   223  */
   202 if ( ! function_exists( 'bws_go_pro_tab_show' ) ) {
   224 if ( ! function_exists( 'bws_go_pro_tab_show' ) ) {
   203 	function bws_go_pro_tab_show( $bws_hide_premium_options_check, $plugin_info, $plugin_basename, $page, $pro_page, $bws_license_plugin, $link_slug, $link_key, $link_pn, $pro_plugin_is_activated = false, $trial_days_number = false ) {
   225 	function bws_go_pro_tab_show( $bws_hide_premium_options_check, $plugin_info, $plugin_basename, $page, $pro_page, $bws_license_plugin, $link_slug, $link_key, $link_pn, $pro_plugin_is_activated = false, $trial_days_number = false ) {
   204 		global $wp_version, $bstwbsftwppdtplgns_options;
   226 		global $wp_version, $bstwbsftwppdtplgns_options;
   205 		$bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? sanitize_text_field( $_POST['bws_license_key'] ) : "";
   227 		$bws_license_key = ( isset( $_POST['bws_license_key'] ) ) ? sanitize_text_field( wp_unslash( $_POST['bws_license_key'] ) ) : '';
   206 		if ( $pro_plugin_is_activated ) { 
   228 		if ( $pro_plugin_is_activated ) {
   207 			$page_url = esc_url( self_admin_url( 'admin.php?page=' . $pro_page ) ); ?>
   229 			$page_url = esc_url( self_admin_url( 'admin.php?page=' . $pro_page ) );
   208 			<p><?php _e( "Congratulations! Pro version of the plugin is  installed and activated successfully.", 'bestwebsoft' ); ?></p>
   230 			?>
       
   231 			<p><?php esc_html_e( 'Congratulations! Pro version of the plugin is  installed and activated successfully.', 'bestwebsoft' ); ?></p>
   209 			<p>
   232 			<p>
   210 				<?php _e( "Please, go to", 'bestwebsoft' ); ?> <a href="<?php echo $page_url; ?>"><?php _e( 'the setting page', 'bestwebsoft' ); ?></a>
   233 				<?php esc_html_e( 'Please, go to', 'bestwebsoft' ); ?> <a href="<?php echo esc_url( $page_url ); ?>"><?php esc_html_e( 'the setting page', 'bestwebsoft' ); ?></a>
   211 			</p>
   234 			</p>
   212 		<?php } else {
   235 			<?php
   213 			if ( $bws_hide_premium_options_check ) { ?>
   236 		} else {
       
   237 			if ( $bws_hide_premium_options_check ) {
       
   238 				?>
   214 				<form method="post" action="">
   239 				<form method="post" action="">
   215 					<p>
   240 					<p>
   216 						<input type="hidden" name="bws_hide_premium_options_submit" value="submit" />
   241 						<input type="hidden" name="bws_hide_premium_options_submit" value="submit" />
   217 						<input type="submit" class="button" value="<?php _e( 'Show Pro features', 'bestwebsoft' ); ?>" />
   242 						<input type="submit" class="button" value="<?php esc_html_e( 'Show Pro features', 'bestwebsoft' ); ?>" />
   218 						<?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
   243 						<?php wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
   219 					</p>
   244 					</p>
   220 				</form>
   245 				</form>
   221 			<?php } ?>
   246 			<?php } ?>
   222 			<form method="post" action="">
   247 			<form method="post" action="">
   223 				<p>
   248 				<p>
   224 					<?php _e( 'Enter your license key to install and activate', 'bestwebsoft' ); ?>
   249 					<?php esc_html_e( 'Enter your license key to install and activate', 'bestwebsoft' ); ?>
   225 					<a href="<?php echo esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $link_slug . '/?k=' . $link_key . '&pn=' . $link_pn . '&v=' . $plugin_info["Version"] . '&wp_v=' . $wp_version ); ?>" target="_blank" title="<?php echo $plugin_info["Name"]; ?> Pro">Pro</a>
   250 					<a href="<?php echo esc_url( 'https://bestwebsoft.com/products/wordpress/plugins/' . $link_slug . '/?k=' . $link_key . '&pn=' . $link_pn . '&v=' . $plugin_info['Version'] . '&wp_v=' . $wp_version ); ?>" target="_blank" title="<?php echo esc_html( $plugin_info['Name'] ); ?> Pro">Pro</a>
   226 					<?php _e( 'version of the plugin.', 'bestwebsoft' ); ?><br />
   251 					<?php esc_html_e( 'version of the plugin.', 'bestwebsoft' ); ?><br />
   227 					<span class="bws_info">
   252 					<span class="bws_info">
   228 						<?php _e( 'License key can be found in the', 'bestwebsoft' ); ?>
   253 						<?php esc_html_e( 'License key can be found in the', 'bestwebsoft' ); ?>
   229 						<a href="https://bestwebsoft.com/wp-login.php">Client Area</a>
   254 						<a href="https://bestwebsoft.com/wp-login.php">Client Area</a>
   230 						<?php _e( '(your username is the email address specified during the purchase).', 'bestwebsoft' ); ?>
   255 						<?php esc_html_e( '(your username is the email address specified during the purchase).', 'bestwebsoft' ); ?>
   231 					</span>
   256 					</span>
   232 				</p>
   257 				</p>
   233 				<?php if ( $trial_days_number !== false )
   258 				<?php
   234 					$trial_days_number = __( 'or', 'bestwebsoft' ) . ' <a href="https://bestwebsoft.com/products/wordpress/plugins/' . $link_slug . '/trial/" target="_blank">' . sprintf( __( 'Start Your Free %s-Day Trial Now', 'bestwebsoft' ), $trial_days_number ) . '</a>';
   259 				if ( false !== $trial_days_number ) {
       
   260 					$trial_days_number = esc_html__( 'or', 'bestwebsoft' ) . ' <a href="https://bestwebsoft.com/products/wordpress/plugins/' . esc_attr( $link_slug ) . '/trial/" target="_blank">' . esc_html( sprintf( esc_html__( 'Start Your Free %s-Day Trial Now', 'bestwebsoft' ), $trial_days_number ) ) . '</a>';
       
   261 				}
   235 				if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) &&
   262 				if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) &&
   236 					'5' < $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] &&
   263 					'5' < $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] &&
   237 					$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) { ?>
   264 					$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
       
   265 					?>
   238 					<p>
   266 					<p>
   239 						<input disabled="disabled" type="text" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
   267 						<input disabled="disabled" type="text" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
   240 						<input disabled="disabled" type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
   268 						<input disabled="disabled" type="submit" class="button-primary" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
   241 						<?php if ( $trial_days_number !== false ) echo $trial_days_number; ?>
   269 						<?php
   242 					</p>
   270 						if ( false !== $trial_days_number ) {
   243 					<p><?php _e( "Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.", 'bestwebsoft' ); ?></p>
   271 							echo esc_html( $trial_days_number );
       
   272 						}
       
   273 						?>
       
   274 					</p>
       
   275 					<p><?php esc_html_e( 'Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.', 'bestwebsoft' ); ?></p>
   244 				<?php } else { ?>
   276 				<?php } else { ?>
   245 					<p>
   277 					<p>
   246 						<input type="text" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
   278 						<input type="text" maxlength="100" name="bws_license_key" value="<?php echo esc_attr( $bws_license_key ); ?>" />
   247 						<input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $bws_license_plugin ); ?>" />
   279 						<input type="hidden" name="bws_license_plugin" value="<?php echo esc_attr( $bws_license_plugin ); ?>" />
   248 						<input type="hidden" name="bws_license_submit" value="submit" />
   280 						<input type="hidden" name="bws_license_submit" value="submit" />
   249 						<input type="submit" class="button-primary" value="<?php _e( 'Activate', 'bestwebsoft' ); ?>" />
   281 						<input type="submit" class="button-primary" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
   250 						<?php if ( $trial_days_number !== false )
   282 						<?php
   251 							echo $trial_days_number;
   283 						if ( false !== $trial_days_number ) {
   252 						wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' ); ?>
   284 							echo esc_html( $trial_days_number );
       
   285 						}
       
   286 						wp_nonce_field( $plugin_basename, 'bws_license_nonce_name' );
       
   287 						?>
   253 					</p>
   288 					</p>
   254 				<?php } ?>
   289 				<?php } ?>
   255 			</form>
   290 			</form>
   256 		<?php }
   291 			<?php
   257 	}
   292 		}
   258 }
   293 	}
   259 
   294 }
   260 /**
   295 
   261 * Function display GO PRO Banner (inline in 'admin_notices' action )
   296 /**
   262 * @deprecated 2.2.5 (29.11.2019)
   297  * Function display GO PRO Banner (inline in 'admin_notices' action )
   263 * @todo Remove notice after 01.12.2021
   298  *
   264 */
   299  * @deprecated 2.2.5 (29.11.2019)
       
   300  * @todo Remove notice after 01.12.2021
       
   301  */
   265 if ( ! function_exists( 'bws_plugin_banner' ) ) {
   302 if ( ! function_exists( 'bws_plugin_banner' ) ) {
   266 	function bws_plugin_banner( $plugin_info, $this_banner_prefix, $link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
   303 	function bws_plugin_banner( $plugin_info, $this_banner_prefix, $link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
   267 		/* the function is not longer use, but we need to store it */
   304 		/* the function is not longer use, but we need to store it */
   268 	}
   305 	}
   269 }
   306 }
   270 
   307 
   271 /**
   308 /**
   272 * Function display timeout PRO Banner (inline in 'admin_notices' action )
   309  * Function display timeout PRO Banner (inline in 'admin_notices' action )
   273 * @deprecated 2.2.5 (29.11.2019)
   310  *
   274 * @todo Remove notice after 01.12.2021
   311  * @deprecated 2.2.5 (29.11.2019)
   275 */
   312  * @todo Remove notice after 01.12.2021
   276 if ( ! function_exists ( 'bws_plugin_banner_timeout' ) ) {
   313  */
       
   314 if ( ! function_exists( 'bws_plugin_banner_timeout' ) ) {
   277 	function bws_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug = false ) {
   315 	function bws_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug = false ) {
   278 		/* the function is not longer use, but we need to store it */
   316 		/* the function is not longer use, but we need to store it */
   279 	}
   317 	}
   280 }
   318 }