Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/portfoli.../bws_menu
File: class-bws-settings.php
if ( $this->is_multisite ) {
[500] Fix | Delete
$this->custom_code_args['blog_id'] = get_current_blog_id();
[501] Fix | Delete
}
[502] Fix | Delete
[503] Fix | Delete
WP_Filesystem();
[504] Fix | Delete
[505] Fix | Delete
foreach ( array( 'css', 'php', 'js' ) as $extension ) {
[506] Fix | Delete
$file = 'bws-custom-code.' . $extension;
[507] Fix | Delete
$real_file = $folder . '/' . $file;
[508] Fix | Delete
[509] Fix | Delete
if ( $wp_filesystem->exists( $real_file ) ) {
[510] Fix | Delete
update_recently_edited( $real_file );
[511] Fix | Delete
$this->custom_code_args[ "content_{$extension}" ] = $wp_filesystem->get_contents( $real_file );
[512] Fix | Delete
if ( ( $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $this->custom_code_args['blog_id'] ][ $file ] ) ) ||
[513] Fix | Delete
( ! $this->is_multisite && isset( $bstwbsftwppdtplgns_options['custom_code'][ $file ] ) ) ) {
[514] Fix | Delete
$this->custom_code_args[ "is_{$extension}_active" ] = true;
[515] Fix | Delete
}
[516] Fix | Delete
if ( is_writeable( $real_file ) ) {
[517] Fix | Delete
$this->custom_code_args[ "{$extension}_writeable" ] = true;
[518] Fix | Delete
}
[519] Fix | Delete
} else {
[520] Fix | Delete
$this->custom_code_args[ "{$extension}_writeable" ] = true;
[521] Fix | Delete
if ( 'php' === $extension ) {
[522] Fix | Delete
$this->custom_code_args[ "content_{$extension}" ] = '<?php' . "\n" . "if ( ! defined( 'ABSPATH' ) ) exit;" . "\n" . "if ( ! defined( 'BWS_GLOBAL' ) ) exit;" . "\n\n" . '/* Start your code here */' . "\n";
[523] Fix | Delete
}
[524] Fix | Delete
}
[525] Fix | Delete
}
[526] Fix | Delete
}
[527] Fix | Delete
[528] Fix | Delete
/**
[529] Fix | Delete
* Display 'custom_code' tab
[530] Fix | Delete
*
[531] Fix | Delete
* @access private
[532] Fix | Delete
*/
[533] Fix | Delete
private function tab_custom_code() {
[534] Fix | Delete
global $bstwbsftwppdtplgns_options, $wp_version;
[535] Fix | Delete
?>
[536] Fix | Delete
<h3 class="bws_tab_label"><?php esc_html_e( 'Custom Code', 'bestwebsoft' ); ?></h3>
[537] Fix | Delete
<?php
[538] Fix | Delete
$this->help_phrase();
[539] Fix | Delete
$bws_hide_premium = bws_hide_premium_options_check( $bstwbsftwppdtplgns_options );
[540] Fix | Delete
?>
[541] Fix | Delete
<hr>
[542] Fix | Delete
<h4><?php esc_html_e( 'The ability to add custom code is available in the Pro version. If the Pro version is not available please contact us via Help Center', 'bestwebsoft' ); ?> (<a href="<?php echo esc_url( 'https://support.bestwebsoft.com/hc/en-us/requests/new' ); ?>"><?php echo esc_url( 'https://support.bestwebsoft.com/hc/en-us/requests/new' ); ?></a>)</h4>
[543] Fix | Delete
<?php
[544] Fix | Delete
if ( ! $bws_hide_premium ) {
[545] Fix | Delete
?>
[546] Fix | Delete
<div class="bws_pro_version_bloc pdfprnt-pro-feature">
[547] Fix | Delete
<div class="bws_pro_version_table_bloc">
[548] Fix | Delete
<button type="submit" name="bws_hide_premium_options" class="notice-dismiss bws_hide_premium_options" title="Close"></button>
[549] Fix | Delete
<div class="bws_table_bg"></div>
[550] Fix | Delete
<div class="bws_pro_version">
[551] Fix | Delete
<?php
[552] Fix | Delete
if ( ! current_user_can( 'edit_plugins' ) ) {
[553] Fix | Delete
echo '<p>' . esc_html__( 'You do not have sufficient permissions to edit plugins for this site.', 'bestwebsoft' ) . '</p>';
[554] Fix | Delete
return;
[555] Fix | Delete
}
[556] Fix | Delete
[557] Fix | Delete
$list = array(
[558] Fix | Delete
'css' => array(
[559] Fix | Delete
'description' => __( 'These styles will be added to the header on all pages of your site.', 'bestwebsoft' ),
[560] Fix | Delete
'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started',
[561] Fix | Delete
),
[562] Fix | Delete
'php' => array(
[563] Fix | Delete
'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>' ),
[564] Fix | Delete
'learn_more_link' => 'https://php.net/',
[565] Fix | Delete
),
[566] Fix | Delete
'js' => array(
[567] Fix | Delete
'description' => __( 'These code will be added to the header on all pages of your site.', 'bestwebsoft' ),
[568] Fix | Delete
'learn_more_link' => 'https://developer.mozilla.org/en-US/docs/Web/JavaScript',
[569] Fix | Delete
),
[570] Fix | Delete
);
[571] Fix | Delete
[572] Fix | Delete
foreach ( $list as $extension => $extension_data ) {
[573] Fix | Delete
$name = 'js' === $extension ? 'JavaScript' : strtoupper( $extension );
[574] Fix | Delete
?>
[575] Fix | Delete
<p><big>
[576] Fix | Delete
<strong><?php echo esc_html( $name ); ?></strong>
[577] Fix | Delete
<?php
[578] Fix | Delete
if ( ! $this->custom_code_args[ "{$extension}_writeable" ] ) {
[579] Fix | Delete
echo '(' . esc_html__( 'Browsing', 'bestwebsoft' ) . ')';
[580] Fix | Delete
}
[581] Fix | Delete
?>
[582] Fix | Delete
</big>
[583] Fix | Delete
</p>
[584] Fix | Delete
<p class="bws_info">
[585] Fix | Delete
<label>
[586] Fix | Delete
<input type="checkbox" value="1"
[587] Fix | Delete
<?php
[588] Fix | Delete
if ( $this->custom_code_args[ "is_{$extension}_active" ] ) {
[589] Fix | Delete
echo 'checked';
[590] Fix | Delete
}
[591] Fix | Delete
?>
[592] Fix | Delete
/>
[593] Fix | Delete
<?php printf( esc_html__( 'Activate custom %s code.', 'bestwebsoft' ), esc_html( $name ) ); ?>
[594] Fix | Delete
</label>
[595] Fix | Delete
</p>
[596] Fix | Delete
<textarea cols="70" rows="25" id="bws_newcontent_<?php echo esc_attr( $extension ); ?>" disabled="disabled"><?php
[597] Fix | Delete
if ( isset( $this->custom_code_args[ "content_{$extension}" ] ) ) {
[598] Fix | Delete
echo esc_html( stripslashes_deep( $this->custom_code_args[ "content_{$extension}" ] ) ); }
[599] Fix | Delete
?></textarea>
[600] Fix | Delete
<p class="bws_info">
[601] Fix | Delete
<?php echo wp_kses_post( $extension_data['description'] ); ?>
[602] Fix | Delete
<br>
[603] Fix | Delete
<a href="<?php echo esc_url( $extension_data['learn_more_link'] ); ?>" target="_blank">
[604] Fix | Delete
<?php printf( esc_html__( 'Learn more about %s', 'bestwebsoft' ), esc_html( $name ) ); ?>
[605] Fix | Delete
</a>
[606] Fix | Delete
</p>
[607] Fix | Delete
<?php
[608] Fix | Delete
}
[609] Fix | Delete
?>
[610] Fix | Delete
</div>
[611] Fix | Delete
</div>
[612] Fix | Delete
<div class="bws_pro_version_tooltip">
[613] Fix | Delete
<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>
[614] Fix | Delete
<div class="clear"></div>
[615] Fix | Delete
</div>
[616] Fix | Delete
</div>
[617] Fix | Delete
<?php
[618] Fix | Delete
} else {
[619] Fix | Delete
?>
[620] Fix | Delete
<div class="bws_pro_version_tooltip">
[621] Fix | Delete
<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>
[622] Fix | Delete
<div class="clear"></div>
[623] Fix | Delete
</div>
[624] Fix | Delete
<?php
[625] Fix | Delete
}
[626] Fix | Delete
}
[627] Fix | Delete
[628] Fix | Delete
/**
[629] Fix | Delete
* Display 'misc' tab
[630] Fix | Delete
*
[631] Fix | Delete
* @access private
[632] Fix | Delete
*/
[633] Fix | Delete
private function tab_misc() {
[634] Fix | Delete
global $bstwbsftwppdtplgns_options;
[635] Fix | Delete
?>
[636] Fix | Delete
<h3 class="bws_tab_label"><?php esc_html_e( 'Miscellaneous Settings', 'bestwebsoft' ); ?></h3>
[637] Fix | Delete
<?php $this->help_phrase(); ?>
[638] Fix | Delete
<hr>
[639] Fix | Delete
<?php
[640] Fix | Delete
/**
[641] Fix | Delete
* Action - Display custom options on the Import / Export' tab
[642] Fix | Delete
*/
[643] Fix | Delete
do_action( __CLASS__ . '_additional_misc_options' );
[644] Fix | Delete
[645] Fix | Delete
if ( ! $this->forbid_view && ! empty( $this->change_permission_attr ) ) {
[646] Fix | Delete
?>
[647] Fix | Delete
<div class="error inline bws_visible"><p><strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?>:</strong> <strong><?php printf( esc_html__( 'It is prohibited to change %1$s settings on this site in the %2$s network settings.', 'bestwebsoft' ), esc_html( $this->plugins_info['Name'] ), esc_html( $this->plugins_info['Name'] ) ); ?></strong></p></div>
[648] Fix | Delete
<?php
[649] Fix | Delete
}
[650] Fix | Delete
if ( $this->forbid_view ) {
[651] Fix | Delete
?>
[652] Fix | Delete
<div class="error inline bws_visible"><p><strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?>:</strong> <strong><?php printf( esc_html__( 'It is prohibited to view %1$s settings on this site in the %2$s network settings.', 'bestwebsoft' ), esc_html( $this->plugins_info['Name'] ), esc_html( $this->plugins_info['Name'] ) ); ?></strong></p></div>
[653] Fix | Delete
<?php } else { ?>
[654] Fix | Delete
<table class="form-table">
[655] Fix | Delete
<?php
[656] Fix | Delete
/**
[657] Fix | Delete
* Action - Display custom options on the 'misc' tab
[658] Fix | Delete
*/
[659] Fix | Delete
do_action( __CLASS__ . '_additional_misc_options_affected' );
[660] Fix | Delete
if ( ! empty( $this->pro_page ) && $this->bws_hide_pro_option_exist ) {
[661] Fix | Delete
?>
[662] Fix | Delete
<tr>
[663] Fix | Delete
<th scope="row"><?php esc_html_e( 'Pro Options', 'bestwebsoft' ); ?></th>
[664] Fix | Delete
<td>
[665] Fix | Delete
<label>
[666] Fix | Delete
<input <?php echo esc_attr( wp_kses_data( $this->change_permission_attr ) ); ?> name="bws_hide_premium_options_submit" type="checkbox" value="1"
[667] Fix | Delete
<?php
[668] Fix | Delete
if ( ! $this->hide_pro_tabs ) {
[669] Fix | Delete
echo 'checked="checked "';
[670] Fix | Delete
}
[671] Fix | Delete
?>
[672] Fix | Delete
/>
[673] Fix | Delete
<span class="bws_info"><?php esc_html_e( 'Enable to display plugin Pro options.', 'bestwebsoft' ); ?></span>
[674] Fix | Delete
</label>
[675] Fix | Delete
</td>
[676] Fix | Delete
</tr>
[677] Fix | Delete
<?php } ?>
[678] Fix | Delete
<tr>
[679] Fix | Delete
<th scope="row"><?php esc_html_e( 'Track Usage', 'bestwebsoft' ); ?></th>
[680] Fix | Delete
<td>
[681] Fix | Delete
<label>
[682] Fix | Delete
<input <?php echo esc_attr( wp_kses_data( $this->change_permission_attr ) ); ?> name="bws_track_usage" type="checkbox" value="1"
[683] Fix | Delete
<?php
[684] Fix | Delete
if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] ) ) {
[685] Fix | Delete
echo 'checked="checked "';
[686] Fix | Delete
}
[687] Fix | Delete
?>
[688] Fix | Delete
/>
[689] Fix | Delete
<span class="bws_info"><?php esc_html_e( 'Enable to allow tracking plugin usage anonymously in order to make it better.', 'bestwebsoft' ); ?></span>
[690] Fix | Delete
</label>
[691] Fix | Delete
</td>
[692] Fix | Delete
</tr>
[693] Fix | Delete
<tr>
[694] Fix | Delete
<th scope="row"><?php esc_html_e( 'Default Settings', 'bestwebsoft' ); ?></th>
[695] Fix | Delete
<td>
[696] Fix | Delete
<input<?php echo esc_attr( wp_kses_data( $this->change_permission_attr ) ); ?> name="bws_restore_default" type="submit" class="button" value="<?php esc_html_e( 'Restore Settings', 'bestwebsoft' ); ?>" />
[697] Fix | Delete
<div class="bws_info"><?php esc_html_e( 'This will restore plugin settings to defaults.', 'bestwebsoft' ); ?></div>
[698] Fix | Delete
</td>
[699] Fix | Delete
</tr>
[700] Fix | Delete
</table>
[701] Fix | Delete
<?php
[702] Fix | Delete
}
[703] Fix | Delete
}
[704] Fix | Delete
[705] Fix | Delete
/**
[706] Fix | Delete
* Display 'Import / Export' tab
[707] Fix | Delete
*
[708] Fix | Delete
* @access private
[709] Fix | Delete
*/
[710] Fix | Delete
public function tab_import_export() {
[711] Fix | Delete
?>
[712] Fix | Delete
<h3 class="bws_tab_label"><?php esc_html_e( 'Import / Export', 'bestwebsoft' ); ?></h3>
[713] Fix | Delete
<?php $this->help_phrase(); ?>
[714] Fix | Delete
<hr>
[715] Fix | Delete
<?php
[716] Fix | Delete
/**
[717] Fix | Delete
* Action - Display custom options on the Import / Export' tab
[718] Fix | Delete
*/
[719] Fix | Delete
do_action( __CLASS__ . '_additional_import_export_options' );
[720] Fix | Delete
[721] Fix | Delete
if ( ! $this->forbid_view && ! empty( $this->change_permission_attr ) ) {
[722] Fix | Delete
?>
[723] Fix | Delete
<div class="error inline bws_visible"><p><strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?>:</strong> <strong><?php printf( esc_html__( 'It is prohibited to change %1$s settings on this site in the %2$s network settings.', 'bestwebsoft' ), esc_html( $this->plugins_info['Name'] ), esc_html( $this->plugins_info['Name'] ) ); ?></strong></p></div>
[724] Fix | Delete
<?php
[725] Fix | Delete
}
[726] Fix | Delete
if ( $this->forbid_view ) {
[727] Fix | Delete
?>
[728] Fix | Delete
<div class="error inline bws_visible"><p><strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?>:</strong> <strong><?php printf( esc_html__( 'It is prohibited to view %1$s settings on this site in the %2$s network settings.', 'bestwebsoft' ), esc_html( $this->plugins_info['Name'] ), esc_html( $this->plugins_info['Name'] ) ); ?></strong></p></div>
[729] Fix | Delete
<?php } else { ?>
[730] Fix | Delete
<table class="form-table">
[731] Fix | Delete
<?php
[732] Fix | Delete
/**
[733] Fix | Delete
* Action - Display custom options on the Import / Export' tab
[734] Fix | Delete
*/
[735] Fix | Delete
do_action( __CLASS__ . '_additional_import_export_options_affected' );
[736] Fix | Delete
?>
[737] Fix | Delete
</table>
[738] Fix | Delete
<?php
[739] Fix | Delete
}
[740] Fix | Delete
}
[741] Fix | Delete
[742] Fix | Delete
/**
[743] Fix | Delete
* Save plugin options to the database
[744] Fix | Delete
*
[745] Fix | Delete
* @access private
[746] Fix | Delete
*/
[747] Fix | Delete
private function save_options_misc() {
[748] Fix | Delete
global $bstwbsftwppdtplgns_options, $wp_version;
[749] Fix | Delete
$notice = '';
[750] Fix | Delete
[751] Fix | Delete
/* hide premium options */
[752] Fix | Delete
if ( ! empty( $this->pro_page ) ) {
[753] Fix | Delete
if ( isset( $_POST['bws_hide_premium_options'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
[754] Fix | Delete
$hide_result = bws_hide_premium_options( $this->options );
[755] Fix | Delete
$this->hide_pro_tabs = true;
[756] Fix | Delete
$this->options = $hide_result['options'];
[757] Fix | Delete
if ( ! empty( $hide_result['message'] ) ) {
[758] Fix | Delete
$notice = $hide_result['message'];
[759] Fix | Delete
}
[760] Fix | Delete
if ( $this->is_network_options ) {
[761] Fix | Delete
update_site_option( $this->prefix . '_options', $this->options );
[762] Fix | Delete
} else {
[763] Fix | Delete
update_option( $this->prefix . '_options', $this->options );
[764] Fix | Delete
}
[765] Fix | Delete
} elseif ( isset( $_POST['bws_hide_premium_options_submit'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
[766] Fix | Delete
if ( ! empty( $this->options['hide_premium_options'] ) ) {
[767] Fix | Delete
$key = array_search( get_current_user_id(), $this->options['hide_premium_options'] );
[768] Fix | Delete
if ( false !== $key ) {
[769] Fix | Delete
unset( $this->options['hide_premium_options'][ $key ] );
[770] Fix | Delete
}
[771] Fix | Delete
if ( $this->is_network_options ) {
[772] Fix | Delete
update_site_option( $this->prefix . '_options', $this->options );
[773] Fix | Delete
} else {
[774] Fix | Delete
update_option( $this->prefix . '_options', $this->options );
[775] Fix | Delete
}
[776] Fix | Delete
}
[777] Fix | Delete
$this->hide_pro_tabs = false;
[778] Fix | Delete
} else {
[779] Fix | Delete
if ( empty( $this->options['hide_premium_options'] ) ) {
[780] Fix | Delete
$this->options['hide_premium_options'][] = get_current_user_id();
[781] Fix | Delete
if ( $this->is_network_options ) {
[782] Fix | Delete
update_site_option( $this->prefix . '_options', $this->options );
[783] Fix | Delete
} else {
[784] Fix | Delete
update_option( $this->prefix . '_options', $this->options );
[785] Fix | Delete
}
[786] Fix | Delete
}
[787] Fix | Delete
$this->hide_pro_tabs = true;
[788] Fix | Delete
}
[789] Fix | Delete
}
[790] Fix | Delete
/* Save 'Track Usage' option */
[791] Fix | Delete
if ( isset( $_POST['bws_track_usage'] ) && check_admin_referer( $this->plugin_basename, 'bws_nonce_name' ) ) {
[792] Fix | Delete
if ( empty( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] ) ) {
[793] Fix | Delete
$bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] = true;
[794] Fix | Delete
$track_usage = true;
[795] Fix | Delete
}
[796] Fix | Delete
} else {
[797] Fix | Delete
if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] ) ) {
[798] Fix | Delete
unset( $bstwbsftwppdtplgns_options['track_usage']['products'][ $this->plugin_basename ] );
[799] Fix | Delete
false;
[800] Fix | Delete
$track_usage = false;
[801] Fix | Delete
}
[802] Fix | Delete
}
[803] Fix | Delete
if ( isset( $track_usage ) ) {
[804] Fix | Delete
$usage_id = ! empty( $bstwbsftwppdtplgns_options['track_usage']['usage_id'] ) ? $bstwbsftwppdtplgns_options['track_usage']['usage_id'] : false;
[805] Fix | Delete
/* send data */
[806] Fix | Delete
$options = array(
[807] Fix | Delete
'timeout' => 3,
[808] Fix | Delete
'body' => array(
[809] Fix | Delete
'url' => get_bloginfo( 'url' ),
[810] Fix | Delete
'wp_version' => $wp_version,
[811] Fix | Delete
'is_active' => $track_usage,
[812] Fix | Delete
'product' => $this->plugin_basename,
[813] Fix | Delete
'version' => $this->plugins_info['Version'],
[814] Fix | Delete
'usage_id' => $usage_id,
[815] Fix | Delete
),
[816] Fix | Delete
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ),
[817] Fix | Delete
);
[818] Fix | Delete
$raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/products-statistics/track-usage/', $options );
[819] Fix | Delete
[820] Fix | Delete
if ( ! is_wp_error( $raw_response ) && 200 === intval( wp_remote_retrieve_response_code( $raw_response ) ) ) {
[821] Fix | Delete
$response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
[822] Fix | Delete
[823] Fix | Delete
if ( is_array( $response ) &&
[824] Fix | Delete
! empty( $response['usage_id'] ) &&
[825] Fix | Delete
$response['usage_id'] !== $usage_id ) {
[826] Fix | Delete
$bstwbsftwppdtplgns_options['track_usage']['usage_id'] = $response['usage_id'];
[827] Fix | Delete
}
[828] Fix | Delete
}
[829] Fix | Delete
[830] Fix | Delete
if ( $this->is_multisite ) {
[831] Fix | Delete
update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[832] Fix | Delete
} else {
[833] Fix | Delete
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[834] Fix | Delete
}
[835] Fix | Delete
}
[836] Fix | Delete
[837] Fix | Delete
return compact( 'notice' );
[838] Fix | Delete
}
[839] Fix | Delete
[840] Fix | Delete
/**
[841] Fix | Delete
*
[842] Fix | Delete
*/
[843] Fix | Delete
public function tab_license() {
[844] Fix | Delete
global $wp_version, $bstwbsftwppdtplgns_options;
[845] Fix | Delete
?>
[846] Fix | Delete
<h3 class="bws_tab_label"><?php esc_html_e( 'License Key', 'bestwebsoft' ); ?></h3>
[847] Fix | Delete
<?php $this->help_phrase(); ?>
[848] Fix | Delete
<hr>
[849] Fix | Delete
<?php
[850] Fix | Delete
foreach ( $this->licenses as $single_license ) {
[851] Fix | Delete
$pro_plugin_name = ( strpos( $single_license['name'], 'Pro' ) ) ? $single_license['name'] : $single_license['name'] . ' Pro';
[852] Fix | Delete
if ( ! empty( $this->pro_page ) || ! empty( $single_license['pro_basename'] ) ) {
[853] Fix | Delete
[854] Fix | Delete
if ( $this->pro_plugin_is_activated && ( empty( $single_license['pro_basename'] ) || isset( $this->bws_license_plugin ) ) ) {
[855] Fix | Delete
$url = 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/downloads/?bws_first_download=' . $this->bws_license_plugin . '&bws_license_key=' . $bstwbsftwppdtplgns_options[ $this->bws_license_plugin ] . '&download_from=5';
[856] Fix | Delete
?>
[857] Fix | Delete
<table class="form-table">
[858] Fix | Delete
<tr>
[859] Fix | Delete
<th scope="row"><?php echo wp_kses_data( $pro_plugin_name ) . ' License'; ?></th>
[860] Fix | Delete
<td>
[861] Fix | Delete
<p>
[862] Fix | Delete
<strong><?php esc_html_e( 'Your Pro plugin is ready', 'bestwebsoft' ); ?></strong>
[863] Fix | Delete
<br>
[864] Fix | Delete
<?php esc_html_e( 'Your plugin has been zipped, and now is ready to download.', 'bestwebsoft' ); ?>
[865] Fix | Delete
</p>
[866] Fix | Delete
<p>
[867] Fix | Delete
<a class="button button-secondary" target="_parent" href="<?php echo esc_url( $url ); ?>"><?php esc_html_e( 'Download Now', 'bestwebsoft' ); ?></a>
[868] Fix | Delete
</p>
[869] Fix | Delete
<br>
[870] Fix | Delete
<p>
[871] Fix | Delete
<strong><?php esc_html_e( 'Need help installing the plugin?', 'bestwebsoft' ); ?></strong>
[872] Fix | Delete
<br>
[873] Fix | Delete
<a target="_blank" href="https://bestwebsoft.com/documentation/how-to-install-a-wordpress-product/how-to-install-a-wordpress-plugin/"><?php esc_html_e( 'How to install WordPress plugin from your admin Dashboard (ZIP archive)', 'bestwebsoft' ); ?></a>
[874] Fix | Delete
</p>
[875] Fix | Delete
<br>
[876] Fix | Delete
<p>
[877] Fix | Delete
<strong><?php esc_html_e( 'Get Started', 'bestwebsoft' ); ?></strong>
[878] Fix | Delete
<br>
[879] Fix | Delete
<a target="_blank" href="https://bestwebsoft.com/documentation/"><?php esc_html_e( 'Documentation', 'bestwebsoft' ); ?></a>
[880] Fix | Delete
<br>
[881] Fix | Delete
<a target="_blank" href="https://www.youtube.com/user/bestwebsoft"><?php esc_html_e( 'Video Instructions', 'bestwebsoft' ); ?></a>
[882] Fix | Delete
<br>
[883] Fix | Delete
<a target="_blank" href="https://support.bestwebsoft.com"><?php esc_html_e( 'Knowledge Base', 'bestwebsoft' ); ?></a>
[884] Fix | Delete
</p>
[885] Fix | Delete
</td>
[886] Fix | Delete
</tr>
[887] Fix | Delete
</table>
[888] Fix | Delete
<?php
[889] Fix | Delete
} else {
[890] Fix | Delete
$attr = '';
[891] Fix | Delete
$license_key = '';
[892] Fix | Delete
if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] ) &&
[893] Fix | Delete
'5' < $bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['count'] &&
[894] Fix | Delete
$bstwbsftwppdtplgns_options['go_pro'][ $this->bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
[895] Fix | Delete
$attr = 'disabled="disabled"';
[896] Fix | Delete
}
[897] Fix | Delete
[898] Fix | Delete
if ( ! empty( $single_license['pro_basename'] ) ) {
[899] Fix | Delete
$license_key = ! empty( $bstwbsftwppdtplgns_options[ $single_license['pro_basename'] ] ) ? $bstwbsftwppdtplgns_options[ $single_license['pro_basename'] ] : '';
[900] Fix | Delete
}
[901] Fix | Delete
?>
[902] Fix | Delete
<table class="form-table">
[903] Fix | Delete
<tr>
[904] Fix | Delete
<th scope="row"><?php echo esc_html( $pro_plugin_name ) . ' License'; ?></th>
[905] Fix | Delete
<td>
[906] Fix | Delete
<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 ); ?>" />
[907] Fix | Delete
<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'] ); ?>" />
[908] Fix | Delete
<input <?php echo wp_kses_data( $attr ); ?> type="submit" class="button button-secondary" name="bws_license_submit" value="<?php esc_html_e( 'Activate', 'bestwebsoft' ); ?>" />
[909] Fix | Delete
<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( 'bws_license_key_nonce' ) ); ?>" />
[910] Fix | Delete
<div class="bws_info">
[911] Fix | Delete
<?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>' ); ?>
[912] Fix | Delete
</div>
[913] Fix | Delete
<?php if ( '' !== $attr ) { ?>
[914] Fix | Delete
<p><?php esc_html_e( 'Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.', 'bestwebsoft' ); ?></p>
[915] Fix | Delete
<?php
[916] Fix | Delete
}
[917] Fix | Delete
if ( false !== $this->trial_days ) {
[918] Fix | Delete
echo '<p>' . esc_html__( '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( esc_html__( 'Start Your Free %s-Day Trial Now', 'bestwebsoft' ), esc_attr( $this->trial_days ) ) . '</a></p>';
[919] Fix | Delete
}
[920] Fix | Delete
?>
[921] Fix | Delete
</td>
[922] Fix | Delete
</tr>
[923] Fix | Delete
</table>
[924] Fix | Delete
<?php
[925] Fix | Delete
}
[926] Fix | Delete
} else {
[927] Fix | Delete
global $bstwbsftwppdtplgns_options;
[928] Fix | Delete
$license_key = ( isset( $bstwbsftwppdtplgns_options[ $single_license['basename'] ] ) ) ? $bstwbsftwppdtplgns_options[ $single_license['basename'] ] : '';
[929] Fix | Delete
?>
[930] Fix | Delete
<table class="form-table">
[931] Fix | Delete
<tr>
[932] Fix | Delete
<th scope="row"><?php echo esc_html( $pro_plugin_name ) . ' License'; ?></th>
[933] Fix | Delete
<td>
[934] Fix | Delete
<input type="text" maxlength="100" name="bws_license_key_<?php echo esc_attr( $single_license['slug'] ); ?>" value="<?php echo esc_attr( $license_key ); ?>" />
[935] Fix | Delete
<input type="submit" class="button button-secondary" name="bws_license_submit" value="<?php esc_html_e( 'Check license key', 'bestwebsoft' ); ?>" />
[936] Fix | Delete
<div class="bws_info">
[937] Fix | Delete
<?php esc_html_e( 'If necessary, you can check if the license key is correct or reenter it in the field below.', 'bestwebsoft' ); ?>
[938] Fix | Delete
</div>
[939] Fix | Delete
</td>
[940] Fix | Delete
</tr>
[941] Fix | Delete
</table>
[942] Fix | Delete
<?php
[943] Fix | Delete
}
[944] Fix | Delete
}
[945] Fix | Delete
?>
[946] Fix | Delete
<table class="form-table">
[947] Fix | Delete
<tr>
[948] Fix | Delete
<th scope="row"><?php esc_html_e( 'Manage License Settings', 'bestwebsoft' ); ?></th>
[949] Fix | Delete
<td>
[950] Fix | Delete
<a class="button button-secondary" href="https://bestwebsoft.com/client-area" target="_blank"><?php esc_html_e( 'Login to Client Area', 'bestwebsoft' ); ?></a>
[951] Fix | Delete
<div class="bws_info">
[952] Fix | Delete
<?php esc_html_e( 'Manage active licenses, download BWS products, and view your payment history using BestWebSoft Client Area.', 'bestwebsoft' ); ?>
[953] Fix | Delete
</div>
[954] Fix | Delete
</td>
[955] Fix | Delete
</tr>
[956] Fix | Delete
</table>
[957] Fix | Delete
<?php
[958] Fix | Delete
}
[959] Fix | Delete
[960] Fix | Delete
/**
[961] Fix | Delete
* Save plugin options to the database
[962] Fix | Delete
*
[963] Fix | Delete
* @access private
[964] Fix | Delete
* @param ab
[965] Fix | Delete
* @return array The Action results
[966] Fix | Delete
*/
[967] Fix | Delete
private function save_options_license_key() {
[968] Fix | Delete
global $wp_version, $bstwbsftwppdtplgns_options, $wp_filesystem;
[969] Fix | Delete
/*$empty_field_error - added to avoid error when 1 field is empty while another field contains license key*/
[970] Fix | Delete
[971] Fix | Delete
$error = '';
[972] Fix | Delete
$message = '';
[973] Fix | Delete
$empty_field_error = '';
[974] Fix | Delete
[975] Fix | Delete
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'bws_license_key_nonce' ) ) {
[976] Fix | Delete
die( esc_html__( 'Security check', 'bestwebsoft' ) );
[977] Fix | Delete
} else {
[978] Fix | Delete
[979] Fix | Delete
foreach ( $this->licenses as $single_license ) {
[980] Fix | Delete
$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'] ] ) ) : '';
[981] Fix | Delete
if ( '' !== $bws_license_key ) {
[982] Fix | Delete
if ( strlen( $bws_license_key ) !== 18 ) {
[983] Fix | Delete
$error = __( 'Wrong license key', 'bestwebsoft' );
[984] Fix | Delete
} else {
[985] Fix | Delete
/* CHECK license key */
[986] Fix | Delete
if ( $this->is_pro && empty( $single_license['pro_basename'] ) ) {
[987] Fix | Delete
delete_transient( 'bws_plugins_update' );
[988] Fix | Delete
if ( ! $this->all_plugins ) {
[989] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[990] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[991] Fix | Delete
}
[992] Fix | Delete
$this->all_plugins = get_plugins();
[993] Fix | Delete
}
[994] Fix | Delete
$current = get_site_transient( 'update_plugins' );
[995] Fix | Delete
[996] Fix | Delete
if ( ! empty( $this->all_plugins ) && ! empty( $current ) && isset( $current->response ) && is_array( $current->response ) ) {
[997] Fix | Delete
$to_send = array();
[998] Fix | Delete
$to_send['plugins'][ $single_license['basename'] ] = $this->all_plugins[ $single_license['basename'] ];
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function