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
$to_send['plugins'][ $single_license['basename'] ]['bws_license_key'] = $bws_license_key;
[1000] Fix | Delete
$to_send['plugins'][ $single_license['basename'] ]['bws_illegal_client'] = true;
[1001] Fix | Delete
$options = array(
[1002] Fix | Delete
'timeout' => ( ( defined( 'DOING_CRON' ) && DOING_CRON ) ? 30 : 3 ),
[1003] Fix | Delete
'body' => array( 'plugins' => serialize( $to_send ) ),
[1004] Fix | Delete
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ),
[1005] Fix | Delete
);
[1006] Fix | Delete
$raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
[1007] Fix | Delete
[1008] Fix | Delete
if ( is_wp_error( $raw_response ) || 200 !== intval( wp_remote_retrieve_response_code( $raw_response ) ) ) {
[1009] Fix | Delete
$error = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ': <a href=https://support.bestwebsoft.com>BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
[1010] Fix | Delete
} else {
[1011] Fix | Delete
$response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
[1012] Fix | Delete
if ( is_array( $response ) && ! empty( $response ) ) {
[1013] Fix | Delete
foreach ( $response as $single_response ) {
[1014] Fix | Delete
if ( 'wrong_license_key' === $single_response->package ) {
[1015] Fix | Delete
$error = __( 'Wrong license key.', 'bestwebsoft' );
[1016] Fix | Delete
} elseif ( 'wrong_domain' === $single_response->package ) {
[1017] Fix | Delete
$error = __( 'This license key is bound to another site.', 'bestwebsoft' );
[1018] Fix | Delete
} elseif ( 'time_out' === $single_response->package ) {
[1019] Fix | Delete
$message = __( 'This license key is valid, but Your license has expired. If you want to update our plugin in future, you should extend the license.', 'bestwebsoft' );
[1020] Fix | Delete
} elseif ( 'you_are_banned' === $single_response->package ) {
[1021] Fix | Delete
$error = __( 'Unfortunately, you have exceeded the number of available tries.', 'bestwebsoft' );
[1022] Fix | Delete
} elseif ( 'duplicate_domen_for_trial' === $single_response->package ) {
[1023] Fix | Delete
$error = __( 'Unfortunately, the Pro Trial licence was already installed to this domain. The Pro Trial license can be installed only once.', 'bestwebsoft' );
[1024] Fix | Delete
}
[1025] Fix | Delete
if ( empty( $error ) ) {
[1026] Fix | Delete
if ( empty( $message ) ) {
[1027] Fix | Delete
if ( isset( $single_response->trial ) ) {
[1028] Fix | Delete
$message = __( 'The Pro Trial license key is valid.', 'bestwebsoft' );
[1029] Fix | Delete
} else {
[1030] Fix | Delete
$message = __( 'The license key is valid.', 'bestwebsoft' );
[1031] Fix | Delete
}
[1032] Fix | Delete
[1033] Fix | Delete
if ( ! empty( $single_response->time_out ) ) {
[1034] Fix | Delete
$message .= ' ' . __( 'Your license will expire on', 'bestwebsoft' ) . ' ' . $single_response->time_out . '.';
[1035] Fix | Delete
} else {
[1036] Fix | Delete
/* lifetime */
[1037] Fix | Delete
$single_response->time_out = null;
[1038] Fix | Delete
}
[1039] Fix | Delete
[1040] Fix | Delete
if ( isset( $single_response->trial ) && $this->is_trial ) {
[1041] Fix | Delete
$message .= ' ' . sprintf( __( 'In order to continue using the plugin it is necessary to buy a %s license.', 'bestwebsoft' ), '<a href="' . esc_url( $this->plugins_info['PluginURI'] . '?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info['Version'] . '&wp_v=' . $wp_version ) . '" target="_blank" title="' . $this->plugins_info['Name'] . '">Pro</a>' );
[1042] Fix | Delete
}
[1043] Fix | Delete
}
[1044] Fix | Delete
[1045] Fix | Delete
if ( isset( $single_response->trial ) ) {
[1046] Fix | Delete
$bstwbsftwppdtplgns_options['trial'][ $single_license['basename'] ] = 1;
[1047] Fix | Delete
} else {
[1048] Fix | Delete
unset( $bstwbsftwppdtplgns_options['trial'][ $single_license['basename'] ] );
[1049] Fix | Delete
}
[1050] Fix | Delete
[1051] Fix | Delete
if ( isset( $single_response->nonprofit ) ) {
[1052] Fix | Delete
$bstwbsftwppdtplgns_options['nonprofit'][ $single_license['basename'] ] = 1;
[1053] Fix | Delete
} else {
[1054] Fix | Delete
unset( $bstwbsftwppdtplgns_options['nonprofit'][ $single_license['basename'] ] );
[1055] Fix | Delete
}
[1056] Fix | Delete
[1057] Fix | Delete
if ( ! isset( $bstwbsftwppdtplgns_options[ $single_license['basename'] ] ) || $bstwbsftwppdtplgns_options[ $single_license['basename'] ] !== $bws_license_key ) {
[1058] Fix | Delete
$bstwbsftwppdtplgns_options[ $single_license['basename'] ] = $bws_license_key;
[1059] Fix | Delete
[1060] Fix | Delete
WP_Filesystem();
[1061] Fix | Delete
if ( $wp_filesystem->put_contents( dirname( dirname( __FILE__ ) ) . '/license_key.txt', $bws_license_key, 0755 ) ) {
[1062] Fix | Delete
$update_option = true;
[1063] Fix | Delete
}
[1064] Fix | Delete
}
[1065] Fix | Delete
[1066] Fix | Delete
if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $single_license['basename'] ] ) ) {
[1067] Fix | Delete
unset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $single_license['basename'] ] );
[1068] Fix | Delete
$update_option = true;
[1069] Fix | Delete
}
[1070] Fix | Delete
[1071] Fix | Delete
if ( ! isset( $bstwbsftwppdtplgns_options['time_out'][ $single_license['basename'] ] ) || $bstwbsftwppdtplgns_options['time_out'][ $single_license['basename'] ] !== $single_response->time_out ) {
[1072] Fix | Delete
$bstwbsftwppdtplgns_options['time_out'][ $single_license['basename'] ] = $single_response->time_out;
[1073] Fix | Delete
$update_option = true;
[1074] Fix | Delete
}
[1075] Fix | Delete
[1076] Fix | Delete
if ( isset( $update_option ) ) {
[1077] Fix | Delete
if ( $this->is_multisite ) {
[1078] Fix | Delete
update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[1079] Fix | Delete
} else {
[1080] Fix | Delete
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[1081] Fix | Delete
}
[1082] Fix | Delete
}
[1083] Fix | Delete
}
[1084] Fix | Delete
}
[1085] Fix | Delete
} else {
[1086] Fix | Delete
$error = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ' <a href=https://support.bestwebsoft.com>BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
[1087] Fix | Delete
}
[1088] Fix | Delete
}
[1089] Fix | Delete
}
[1090] Fix | Delete
/* Go Pro */
[1091] Fix | Delete
} else {
[1092] Fix | Delete
$slug = ! empty( $single_license['pro_slug'] ) ? 'bws_license_plugin_' . $single_license['pro_slug'] : 'bws_license_plugin_' . $single_license['slug'];
[1093] Fix | Delete
[1094] Fix | Delete
$bws_license_plugin = isset( $_POST[ $slug ] ) ? sanitize_text_field( wp_unslash( $_POST[ $slug ] ) ) : '';
[1095] Fix | Delete
if ( isset( $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] ) && $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] > ( time() - ( 24 * 60 * 60 ) ) ) {
[1096] Fix | Delete
$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = $bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] + 1;
[1097] Fix | Delete
} else {
[1098] Fix | Delete
$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['count'] = 1;
[1099] Fix | Delete
$bstwbsftwppdtplgns_options['go_pro'][ $bws_license_plugin ]['time'] = time();
[1100] Fix | Delete
}
[1101] Fix | Delete
[1102] Fix | Delete
/* download Pro */
[1103] Fix | Delete
if ( ! $this->all_plugins ) {
[1104] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[1105] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[1106] Fix | Delete
}
[1107] Fix | Delete
$this->all_plugins = get_plugins();
[1108] Fix | Delete
}
[1109] Fix | Delete
[1110] Fix | Delete
if ( ! array_key_exists( $bws_license_plugin, $this->all_plugins ) ) {
[1111] Fix | Delete
$current = get_site_transient( 'update_plugins' );
[1112] Fix | Delete
if ( ! empty( $current ) && isset( $current->response ) && is_array( $current->response ) ) {
[1113] Fix | Delete
$to_send = array();
[1114] Fix | Delete
$to_send['plugins'][ $bws_license_plugin ] = array();
[1115] Fix | Delete
$to_send['plugins'][ $bws_license_plugin ]['bws_license_key'] = $bws_license_key;
[1116] Fix | Delete
$to_send['plugins'][ $bws_license_plugin ]['bws_illegal_client'] = true;
[1117] Fix | Delete
$options = array(
[1118] Fix | Delete
'timeout' => ( ( defined( 'DOING_CRON' ) && DOING_CRON ) ? 30 : 3 ),
[1119] Fix | Delete
'body' => array( 'plugins' => serialize( $to_send ) ),
[1120] Fix | Delete
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ),
[1121] Fix | Delete
);
[1122] Fix | Delete
$raw_response = wp_remote_post( 'https://bestwebsoft.com/wp-content/plugins/paid-products/plugins/pro-license-check/1.0/', $options );
[1123] Fix | Delete
[1124] Fix | Delete
if ( is_wp_error( $raw_response ) || 200 !== intval( wp_remote_retrieve_response_code( $raw_response ) ) ) {
[1125] Fix | Delete
$error = __( 'Something went wrong. Please try again later. If the error appears again, please contact us', 'bestwebsoft' ) . ': <a href="https://support.bestwebsoft.com">BestWebSoft</a>. ' . __( 'We are sorry for inconvenience.', 'bestwebsoft' );
[1126] Fix | Delete
} else {
[1127] Fix | Delete
$response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
[1128] Fix | Delete
if ( is_array( $response ) && ! empty( $response ) ) {
[1129] Fix | Delete
foreach ( $response as $single_response ) {
[1130] Fix | Delete
if ( 'wrong_license_key' === $single_response->package ) {
[1131] Fix | Delete
$error = __( 'Wrong license key.', 'bestwebsoft' );
[1132] Fix | Delete
} elseif ( 'wrong_domain' === $single_response->package ) {
[1133] Fix | Delete
$error = __( 'This license key is bound to another site.', 'bestwebsoft' );
[1134] Fix | Delete
} elseif ( 'you_are_banned' === $single_response->package ) {
[1135] Fix | Delete
$error = __( 'Unfortunately, you have exceeded the number of available tries per day. Please, upload the plugin manually.', 'bestwebsoft' );
[1136] Fix | Delete
} elseif ( 'time_out' === $single_response->package ) {
[1137] Fix | Delete
$error = sprintf( __( 'Unfortunately, Your license has expired. To continue getting top-priority support and plugin updates, you should extend it in your %s.', 'bestwebsoft' ), ' <a href="https://bestwebsoft.com/client-area">Client Area</a>' );
[1138] Fix | Delete
} elseif ( 'duplicate_domen_for_trial' === $single_response->package ) {
[1139] Fix | Delete
$error = __( 'Unfortunately, the Pro licence was already installed to this domain. The Pro Trial license can be installed only once.', 'bestwebsoft' );
[1140] Fix | Delete
}
[1141] Fix | Delete
}
[1142] Fix | Delete
if ( empty( $error ) ) {
[1143] Fix | Delete
$bws_license_plugin = ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'];
[1144] Fix | Delete
[1145] Fix | Delete
$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
[1146] Fix | Delete
$this->pro_plugin_is_activated = true;
[1147] Fix | Delete
}
[1148] Fix | Delete
} else {
[1149] Fix | Delete
$error = __( 'Something went wrong. Try again later or upload the plugin manually. We are sorry for inconvenience.', 'bestwebsoft' );
[1150] Fix | Delete
}
[1151] Fix | Delete
}
[1152] Fix | Delete
}
[1153] Fix | Delete
} else {
[1154] Fix | Delete
$bstwbsftwppdtplgns_options[ $bws_license_plugin ] = $bws_license_key;
[1155] Fix | Delete
/* activate Pro */
[1156] Fix | Delete
if ( ! is_plugin_active( $bws_license_plugin ) ) {
[1157] Fix | Delete
if ( $this->is_multisite && is_plugin_active_for_network( ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ) ) {
[1158] Fix | Delete
/* if multisite and free plugin is network activated */
[1159] Fix | Delete
$network_wide = true;
[1160] Fix | Delete
} else {
[1161] Fix | Delete
/* activate on a single blog */
[1162] Fix | Delete
$network_wide = false;
[1163] Fix | Delete
}
[1164] Fix | Delete
activate_plugin( $bws_license_plugin, null, $network_wide );
[1165] Fix | Delete
$this->pro_plugin_is_activated = true;
[1166] Fix | Delete
}
[1167] Fix | Delete
}
[1168] Fix | Delete
/* add 'track_usage' for Pro version */
[1169] Fix | Delete
if ( ! empty( $bstwbsftwppdtplgns_options['track_usage'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ] ) &&
[1170] Fix | Delete
empty( $bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] ) ) {
[1171] Fix | Delete
$bstwbsftwppdtplgns_options['track_usage'][ $bws_license_plugin ] = $bstwbsftwppdtplgns_options['track_usage'][ ( ! empty( $single_license['pro_basename'] ) ) ? $single_license['pro_basename'] : $single_license['basename'] ];
[1172] Fix | Delete
}
[1173] Fix | Delete
[1174] Fix | Delete
if ( $this->is_multisite ) {
[1175] Fix | Delete
update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[1176] Fix | Delete
} else {
[1177] Fix | Delete
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[1178] Fix | Delete
}
[1179] Fix | Delete
[1180] Fix | Delete
if ( $this->pro_plugin_is_activated ) {
[1181] Fix | Delete
delete_transient( 'bws_plugins_update' );
[1182] Fix | Delete
}
[1183] Fix | Delete
}
[1184] Fix | Delete
}
[1185] Fix | Delete
} else {
[1186] Fix | Delete
$empty_field_error = __( 'Please, enter Your license key', 'bestwebsoft' );
[1187] Fix | Delete
}
[1188] Fix | Delete
}
[1189] Fix | Delete
}
[1190] Fix | Delete
return compact( 'error', 'message', 'empty_field_error' );
[1191] Fix | Delete
}
[1192] Fix | Delete
[1193] Fix | Delete
/**
[1194] Fix | Delete
* Display help phrase
[1195] Fix | Delete
*
[1196] Fix | Delete
* @access public
[1197] Fix | Delete
* @echo html The Action results
[1198] Fix | Delete
*/
[1199] Fix | Delete
public function help_phrase() {
[1200] Fix | Delete
/*pls */
[1201] Fix | Delete
echo '<div class="bws_tab_description">' . esc_html__( 'Need Help?', 'bestwebsoft' ) . ' ';
[1202] Fix | Delete
if ( '' !== $this->doc_link ) {
[1203] Fix | Delete
echo '<a href="' . esc_url( $this->doc_link ) . '" target="_blank">' . esc_html__( 'Read the Instruction', 'bestwebsoft' );
[1204] Fix | Delete
} else {
[1205] Fix | Delete
echo '<a href="https://support.bestwebsoft.com/hc/en-us/" target="_blank">' . esc_html__( 'Visit Help Center', 'bestwebsoft' );
[1206] Fix | Delete
}
[1207] Fix | Delete
if ( '' !== $this->doc_video_link ) {
[1208] Fix | Delete
echo '</a> ' . esc_html__( 'or', 'bestwebsoft' ) . ' <a href="' . esc_url( $this->doc_video_link ) . '" target="_blank">' . esc_html__( 'Watch the Video', 'bestwebsoft' );
[1209] Fix | Delete
}
[1210] Fix | Delete
echo '</a></div>';
[1211] Fix | Delete
/* pls*/
[1212] Fix | Delete
}
[1213] Fix | Delete
[1214] Fix | Delete
public function bws_pro_block_links() {
[1215] Fix | Delete
global $wp_version;
[1216] Fix | Delete
?>
[1217] Fix | Delete
<div class="bws_pro_version_tooltip">
[1218] 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'] ); ?>"><?php esc_html_e( 'Upgrade to Pro', 'bestwebsoft' ); ?></a>
[1219] Fix | Delete
<?php if ( false !== $this->trial_days ) { ?>
[1220] Fix | Delete
<span class="bws_trial_info">
[1221] Fix | Delete
<?php esc_html_e( 'or', 'bestwebsoft' ); ?>
[1222] Fix | Delete
<a href="<?php echo esc_url( $this->plugins_info['PluginURI'] . '?k=' . $this->link_key . '&pn=' . $this->link_pn . '&v=' . $this->plugins_info['Version'] . '&wp_v=' . $wp_version ); ?>" target="_blank" title="<?php echo esc_html( $this->plugins_info['Name'] ); ?>"><?php esc_html_e( 'Start Your Free Trial', 'bestwebsoft' ); ?></a>
[1223] Fix | Delete
</span>
[1224] Fix | Delete
<?php } ?>
[1225] Fix | Delete
<div class="clear"></div>
[1226] Fix | Delete
</div>
[1227] Fix | Delete
<?php
[1228] Fix | Delete
}
[1229] Fix | Delete
[1230] Fix | Delete
/**
[1231] Fix | Delete
* Restore plugin options to defaults
[1232] Fix | Delete
*
[1233] Fix | Delete
* @access public
[1234] Fix | Delete
* @param void
[1235] Fix | Delete
* @return void
[1236] Fix | Delete
*/
[1237] Fix | Delete
public function restore_options() {
[1238] Fix | Delete
unset(
[1239] Fix | Delete
$this->default_options['first_install'],
[1240] Fix | Delete
$this->default_options['suggest_feature_banner'],
[1241] Fix | Delete
$this->default_options['display_settings_notice']
[1242] Fix | Delete
);
[1243] Fix | Delete
/**
[1244] Fix | Delete
* Filter - Change default_options array OR process custom functions
[1245] Fix | Delete
*/
[1246] Fix | Delete
$this->options = apply_filters( __CLASS__ . '_additional_restore_options', $this->default_options );
[1247] Fix | Delete
if ( $this->is_network_options ) {
[1248] Fix | Delete
$this->options['network_apply'] = 'default';
[1249] Fix | Delete
$this->options['network_view'] = '1';
[1250] Fix | Delete
$this->options['network_change'] = '1';
[1251] Fix | Delete
update_site_option( $this->prefix . '_options', $this->options );
[1252] Fix | Delete
} else {
[1253] Fix | Delete
update_option( $this->prefix . '_options', $this->options );
[1254] Fix | Delete
}
[1255] Fix | Delete
}
[1256] Fix | Delete
[1257] Fix | Delete
public function add_request_feature() {
[1258] Fix | Delete
?>
[1259] Fix | Delete
<div id="bws_request_feature" class="widget-access-link">
[1260] Fix | Delete
<button type="button" class="button" ><?php esc_html_e( 'Request a Feature', 'bestwebsoft' ); ?></button>
[1261] Fix | Delete
</div>
[1262] Fix | Delete
<?php
[1263] Fix | Delete
$modal_html = '<div class="bws-modal bws-modal-deactivation-feedback bws-modal-request-feature">
[1264] Fix | Delete
<div class="bws-modal-dialog">
[1265] Fix | Delete
<div class="bws-modal-body">
[1266] Fix | Delete
<h2>' . sprintf( esc_html__( 'How can we improve %s?', 'bestwebsoft' ), $this->plugins_info['Name'] ) . '</h2>
[1267] Fix | Delete
<div class="bws-modal-panel active">
[1268] Fix | Delete
<p>' . esc_html__( 'We look forward to hear your ideas.', 'bestwebsoft' ) . '</p>
[1269] Fix | Delete
<p>
[1270] Fix | Delete
<textarea placeholder="' . esc_html__( 'Describe your idea', 'bestwebsoft' ) . '..."></textarea>
[1271] Fix | Delete
</p>
[1272] Fix | Delete
<label class="bws-modal-anonymous-label">
[1273] Fix | Delete
<input type="checkbox" /> ' . esc_html__( 'Send website data and allow to contact me back', 'bestwebsoft' ) . '
[1274] Fix | Delete
</label>
[1275] Fix | Delete
</div>
[1276] Fix | Delete
</div>
[1277] Fix | Delete
<div class="bws-modal-footer">
[1278] Fix | Delete
<a href="#" class="button disabled bws-modal-button button-primary">' . esc_html__( 'Submit', 'bestwebsoft' ) . '</a>
[1279] Fix | Delete
<span class="bws-modal-processing hidden">' . esc_html__( 'Processing', 'bestwebsoft' ) . '...</span>
[1280] Fix | Delete
<span class="bws-modal-thank-you hidden">' . esc_html__( 'Thank you!', 'bestwebsoft' ) . '</span>
[1281] Fix | Delete
<div class="clear"></div>
[1282] Fix | Delete
</div>
[1283] Fix | Delete
</div>
[1284] Fix | Delete
</div>';
[1285] Fix | Delete
[1286] Fix | Delete
$script = '(function($) {
[1287] Fix | Delete
var modalHtml = ' . wp_json_encode( $modal_html ) . ",
[1288] Fix | Delete
\$modal = $( modalHtml );
[1289] Fix | Delete
[1290] Fix | Delete
\$modal.appendTo( $( 'body' ) );
[1291] Fix | Delete
[1292] Fix | Delete
$( '#bws_request_feature .button' ).on( 'click', function() {
[1293] Fix | Delete
/* Display the dialog box.*/
[1294] Fix | Delete
\$modal.addClass( 'active' );
[1295] Fix | Delete
$( 'body' ).addClass( 'has-bws-modal' );
[1296] Fix | Delete
});
[1297] Fix | Delete
[1298] Fix | Delete
\$modal.on( 'keypress', 'textarea', function( evt ) {
[1299] Fix | Delete
BwsModalEnableButton();
[1300] Fix | Delete
});
[1301] Fix | Delete
[1302] Fix | Delete
\$modal.on( 'click', '.bws-modal-footer .button', function( evt ) {
[1303] Fix | Delete
evt.preventDefault();
[1304] Fix | Delete
[1305] Fix | Delete
if ( $( this ).hasClass( 'disabled' ) ) {
[1306] Fix | Delete
return;
[1307] Fix | Delete
}
[1308] Fix | Delete
var info = \$modal.find( 'textarea' ).val();
[1309] Fix | Delete
[1310] Fix | Delete
if ( info.length == 0 ) {
[1311] Fix | Delete
return;
[1312] Fix | Delete
}
[1313] Fix | Delete
[1314] Fix | Delete
var _parent = $( this ).parents( '.bws-modal:first' ),
[1315] Fix | Delete
_this = $( this );
[1316] Fix | Delete
[1317] Fix | Delete
var is_anonymous = ( \$modal.find( '.bws-modal-anonymous-label' ).find( 'input' ).is( ':checked' ) ) ? 0 : 1;
[1318] Fix | Delete
[1319] Fix | Delete
$.ajax({
[1320] Fix | Delete
url : ajaxurl,
[1321] Fix | Delete
method : 'POST',
[1322] Fix | Delete
data : {
[1323] Fix | Delete
'Action' : 'bws_submit_request_feature_action',
[1324] Fix | Delete
'plugin' : '" . $this->plugin_basename . "',
[1325] Fix | Delete
'info' : info,
[1326] Fix | Delete
'is_anonymous' : is_anonymous,
[1327] Fix | Delete
'bws_ajax_nonce' : '" . wp_create_nonce( 'bws_ajax_nonce' ) . "'
[1328] Fix | Delete
},
[1329] Fix | Delete
beforeSend: function() {
[1330] Fix | Delete
_parent.find( '.bws-modal-footer .bws-modal-button' ).hide();
[1331] Fix | Delete
_parent.find( '.bws-modal-footer .bws-modal-processing' ).show();
[1332] Fix | Delete
_parent.find( 'textarea, input' ).attr( 'disabled', 'disabled' );
[1333] Fix | Delete
},
[1334] Fix | Delete
complete : function( message ) {
[1335] Fix | Delete
_parent.find( '.bws-modal-footer .bws-modal-processing' ).hide();
[1336] Fix | Delete
_parent.find( '.bws-modal-footer .bws-modal-thank-you' ).show();
[1337] Fix | Delete
}
[1338] Fix | Delete
});
[1339] Fix | Delete
});
[1340] Fix | Delete
[1341] Fix | Delete
/* If the user has clicked outside the window, cancel it. */
[1342] Fix | Delete
\$modal.on( 'click', function( evt ) {
[1343] Fix | Delete
var \$target = $( evt.target );
[1344] Fix | Delete
[1345] Fix | Delete
/* If the user has clicked anywhere in the modal dialog, just return. */
[1346] Fix | Delete
if ( \$target.hasClass( 'bws-modal-body' ) || \$target.hasClass( 'bws-modal-footer' ) ) {
[1347] Fix | Delete
return;
[1348] Fix | Delete
}
[1349] Fix | Delete
[1350] Fix | Delete
/* If the user has not clicked the close button and the clicked element is inside the modal dialog, just return. */
[1351] Fix | Delete
if ( ! \$target.hasClass( 'bws-modal-button-close' ) && ( \$target.parents( '.bws-modal-body' ).length > 0 || \$target.parents( '.bws-modal-footer' ).length > 0 ) ) {
[1352] Fix | Delete
return;
[1353] Fix | Delete
}
[1354] Fix | Delete
[1355] Fix | Delete
/* Close the modal dialog */
[1356] Fix | Delete
\$modal.removeClass( 'active' );
[1357] Fix | Delete
$( 'body' ).removeClass( 'has-bws-modal' );
[1358] Fix | Delete
[1359] Fix | Delete
return false;
[1360] Fix | Delete
});
[1361] Fix | Delete
[1362] Fix | Delete
function BwsModalEnableButton() {
[1363] Fix | Delete
\$modal.find( '.bws-modal-button' ).removeClass( 'disabled' ).show();
[1364] Fix | Delete
\$modal.find( '.bws-modal-processing' ).hide();
[1365] Fix | Delete
}
[1366] Fix | Delete
[1367] Fix | Delete
function BwsModalDisableButton() {
[1368] Fix | Delete
\$modal.find( '.bws-modal-button' ).addClass( 'disabled' );
[1369] Fix | Delete
}
[1370] Fix | Delete
[1371] Fix | Delete
function BwsModalShowPanel() {
[1372] Fix | Delete
\$modal.find( '.bws-modal-panel' ).addClass( 'active' );
[1373] Fix | Delete
}
[1374] Fix | Delete
})(jQuery);";
[1375] Fix | Delete
[1376] Fix | Delete
/* add script in FOOTER */
[1377] Fix | Delete
wp_register_script( 'bws-request-feature-dialog', '', array( 'jquery' ), '2.4.2', true );
[1378] Fix | Delete
wp_enqueue_script( 'bws-request-feature-dialog' );
[1379] Fix | Delete
wp_add_inline_script( 'bws-request-feature-dialog', sprintf( $script ) );
[1380] Fix | Delete
}
[1381] Fix | Delete
}
[1382] Fix | Delete
}
[1383] Fix | Delete
[1384] Fix | Delete
if ( ! function_exists( 'bws_submit_request_feature_action' ) ) {
[1385] Fix | Delete
/**
[1386] Fix | Delete
* Called after the user has submitted his reason for deactivating the plugin.
[1387] Fix | Delete
*
[1388] Fix | Delete
* @since 2.1.3
[1389] Fix | Delete
*/
[1390] Fix | Delete
function bws_submit_request_feature_action() {
[1391] Fix | Delete
global $bstwbsftwppdtplgns_options, $wp_version, $bstwbsftwppdtplgns_active_plugins, $current_user;
[1392] Fix | Delete
[1393] Fix | Delete
if ( isset( $_REQUEST['bws_ajax_nonce'] ) ) {
[1394] Fix | Delete
[1395] Fix | Delete
check_ajax_referer( 'bws_ajax_nonce', sanitize_text_field( wp_unslash( $_REQUEST['bws_ajax_nonce'] ) ) );
[1396] Fix | Delete
[1397] Fix | Delete
$basename = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : '';
[1398] Fix | Delete
$info = isset( $_REQUEST['info'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['info'] ) ) : '';
[1399] Fix | Delete
[1400] Fix | Delete
if ( empty( $info ) || empty( $basename ) ) {
[1401] Fix | Delete
exit;
[1402] Fix | Delete
}
[1403] Fix | Delete
[1404] Fix | Delete
$info = substr( $info, 0, 255 );
[1405] Fix | Delete
$is_anonymous = isset( $_REQUEST['is_anonymous'] ) && 1 === intval( $_REQUEST['is_anonymous'] );
[1406] Fix | Delete
[1407] Fix | Delete
$options = array(
[1408] Fix | Delete
'product' => $basename,
[1409] Fix | Delete
'info' => $info,
[1410] Fix | Delete
);
[1411] Fix | Delete
[1412] Fix | Delete
if ( ! $is_anonymous ) {
[1413] Fix | Delete
if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
[1414] Fix | Delete
$bstwbsftwppdtplgns_options = ( is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
[1415] Fix | Delete
}
[1416] Fix | Delete
[1417] Fix | Delete
if ( ! empty( $bstwbsftwppdtplgns_options['track_usage']['usage_id'] ) ) {
[1418] Fix | Delete
$options['usage_id'] = $bstwbsftwppdtplgns_options['track_usage']['usage_id'];
[1419] Fix | Delete
} else {
[1420] Fix | Delete
$options['usage_id'] = false;
[1421] Fix | Delete
$options['url'] = get_bloginfo( 'url' );
[1422] Fix | Delete
$options['wp_version'] = $wp_version;
[1423] Fix | Delete
$options['is_active'] = false;
[1424] Fix | Delete
$options['version'] = $bstwbsftwppdtplgns_active_plugins[ $basename ]['Version'];
[1425] Fix | Delete
}
[1426] Fix | Delete
[1427] Fix | Delete
$options['email'] = $current_user->data->user_email;
[1428] Fix | Delete
}
[1429] Fix | Delete
[1430] Fix | Delete
/* send data */
[1431] Fix | Delete
$raw_response = wp_remote_post(
[1432] Fix | Delete
'https://bestwebsoft.com/wp-content/plugins/products-statistics/request-feature/',
[1433] Fix | Delete
array(
[1434] Fix | Delete
'method' => 'POST',
[1435] Fix | Delete
'body' => $options,
[1436] Fix | Delete
'timeout' => 15,
[1437] Fix | Delete
)
[1438] Fix | Delete
);
[1439] Fix | Delete
[1440] Fix | Delete
if ( ! is_wp_error( $raw_response ) && 200 === intval( wp_remote_retrieve_response_code( $raw_response ) ) ) {
[1441] Fix | Delete
if ( ! $is_anonymous ) {
[1442] Fix | Delete
$response = maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
[1443] Fix | Delete
[1444] Fix | Delete
if ( is_array( $response ) && ! empty( $response['usage_id'] ) && $response['usage_id'] !== $options['usage_id'] ) {
[1445] Fix | Delete
$bstwbsftwppdtplgns_options['track_usage']['usage_id'] = $response['usage_id'];
[1446] Fix | Delete
[1447] Fix | Delete
if ( is_multisite() ) {
[1448] Fix | Delete
update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[1449] Fix | Delete
} else {
[1450] Fix | Delete
update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options );
[1451] Fix | Delete
}
[1452] Fix | Delete
}
[1453] Fix | Delete
}
[1454] Fix | Delete
[1455] Fix | Delete
echo 'done';
[1456] Fix | Delete
} else {
[1457] Fix | Delete
echo wp_kses_data( $response->get_error_code() ) . ': ' . wp_kses_data( $response->get_error_message() );
[1458] Fix | Delete
}
[1459] Fix | Delete
}
[1460] Fix | Delete
exit;
[1461] Fix | Delete
}
[1462] Fix | Delete
}
[1463] Fix | Delete
[1464] Fix | Delete
add_action( 'wp_ajax_bws_submit_request_feature_action', 'bws_submit_request_feature_action' );
[1465] Fix | Delete
[1466] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function