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