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/wp-conte.../plugins/embedpre.../EmbedPre.../Includes/Classes
File: EmbedPress_Plugin_Usage_Tracker.php
$site_url = get_bloginfo( 'url' );
[500] Fix | Delete
$original_site_url = get_option( "wpins_{$this->plugin_name}_original_url", false );
[501] Fix | Delete
[502] Fix | Delete
if( ( $original_site_url === false || $original_site_url != $site_url ) && version_compare( $body['wpins_version'], '3.0.1', '>=' ) ) {
[503] Fix | Delete
$site_id = false;
[504] Fix | Delete
}
[505] Fix | Delete
/**
[506] Fix | Delete
* Send Initial Data to API
[507] Fix | Delete
*/
[508] Fix | Delete
if( $site_id == false && $this->item_id !== false ) {
[509] Fix | Delete
if( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' ) ) {
[510] Fix | Delete
$country_request = wp_remote_get( 'http://ip-api.com/json/'. $_SERVER['REMOTE_ADDR'] .'?fields=country');
[511] Fix | Delete
if( ! is_wp_error( $country_request ) && $country_request['response']['code'] == 200 ) {
[512] Fix | Delete
$ip_data = json_decode( $country_request["body"] );
[513] Fix | Delete
$body['country'] = isset( $ip_data->country ) ? $ip_data->country : 'NOT SET';
[514] Fix | Delete
}
[515] Fix | Delete
}
[516] Fix | Delete
[517] Fix | Delete
$body['plugin_slug'] = $this->plugin_name;
[518] Fix | Delete
$body['url'] = $site_url;
[519] Fix | Delete
$body['item_id'] = $this->item_id;
[520] Fix | Delete
[521] Fix | Delete
$request = $this->remote_post( $body );
[522] Fix | Delete
if( ! is_wp_error( $request ) && $request['response']['code'] == 200 ) {
[523] Fix | Delete
$retrieved_body = json_decode( wp_remote_retrieve_body( $request ), true );
[524] Fix | Delete
if( is_array( $retrieved_body ) && isset( $retrieved_body['siteId'] ) ) {
[525] Fix | Delete
update_option( $site_id_key, $retrieved_body['siteId'] );
[526] Fix | Delete
update_option( "wpins_{$this->plugin_name}_original_url", $site_url );
[527] Fix | Delete
update_option( "wpins_{$this->plugin_name}_{$retrieved_body['siteId']}", $body );
[528] Fix | Delete
}
[529] Fix | Delete
} else {
[530] Fix | Delete
$failed_data = $body;
[531] Fix | Delete
}
[532] Fix | Delete
}
[533] Fix | Delete
[534] Fix | Delete
$site_id_data_key = "wpins_{$this->plugin_name}_{$site_id}";
[535] Fix | Delete
$site_id_data_failed_key = "wpins_{$this->plugin_name}_{$site_id}_send_failed";
[536] Fix | Delete
[537] Fix | Delete
if( $site_id != false ) {
[538] Fix | Delete
$old_sent_data = get_option( $site_id_data_key, [] );
[539] Fix | Delete
$diff_data = $this->diff( $body, $old_sent_data );
[540] Fix | Delete
$failed_data = get_option( $site_id_data_failed_key, [] );
[541] Fix | Delete
if( ! empty( $failed_data ) && $diff_data != $failed_data ) {
[542] Fix | Delete
$failed_data = array_merge( $failed_data, $diff_data );
[543] Fix | Delete
}
[544] Fix | Delete
}
[545] Fix | Delete
[546] Fix | Delete
if( ! empty( $failed_data ) && $site_id != false ) {
[547] Fix | Delete
$failed_data['plugin_slug'] = $this->plugin_name;
[548] Fix | Delete
$failed_data['url'] = $site_url;
[549] Fix | Delete
$failed_data['site_id'] = $site_id;
[550] Fix | Delete
if( $original_site_url != false ) {
[551] Fix | Delete
$failed_data['original_url'] = $original_site_url;
[552] Fix | Delete
}
[553] Fix | Delete
[554] Fix | Delete
$request = $this->remote_post( $failed_data );
[555] Fix | Delete
if( ! is_wp_error( $request ) ) {
[556] Fix | Delete
delete_option( $site_id_data_failed_key );
[557] Fix | Delete
$replaced_data = array_merge( $old_sent_data, $failed_data );
[558] Fix | Delete
update_option( $site_id_data_key, $replaced_data );
[559] Fix | Delete
}
[560] Fix | Delete
}
[561] Fix | Delete
[562] Fix | Delete
if( ! empty( $diff_data ) && $site_id != false && empty( $failed_data ) ) {
[563] Fix | Delete
$diff_data['plugin_slug'] = $this->plugin_name;
[564] Fix | Delete
$diff_data['url'] = $site_url;
[565] Fix | Delete
$diff_data['site_id'] = $site_id;
[566] Fix | Delete
if( $original_site_url != false ) {
[567] Fix | Delete
$diff_data['original_url'] = $original_site_url;
[568] Fix | Delete
}
[569] Fix | Delete
[570] Fix | Delete
$request = $this->remote_post( $diff_data );
[571] Fix | Delete
if( is_wp_error( $request ) ) {
[572] Fix | Delete
update_option( $site_id_data_failed_key, $diff_data );
[573] Fix | Delete
} else {
[574] Fix | Delete
$replaced_data = array_merge( $old_sent_data, $diff_data );
[575] Fix | Delete
update_option( $site_id_data_key, $replaced_data );
[576] Fix | Delete
}
[577] Fix | Delete
}
[578] Fix | Delete
[579] Fix | Delete
$this->set_track_time();
[580] Fix | Delete
[581] Fix | Delete
if( isset( $request ) && is_wp_error( $request ) ) {
[582] Fix | Delete
return $request;
[583] Fix | Delete
}
[584] Fix | Delete
[585] Fix | Delete
if( isset( $request ) ) {
[586] Fix | Delete
return true;
[587] Fix | Delete
}
[588] Fix | Delete
return false;
[589] Fix | Delete
}
[590] Fix | Delete
/**
[591] Fix | Delete
* WP_REMOTE_POST method responsible for send data to the API_URL
[592] Fix | Delete
*
[593] Fix | Delete
* @param array $data
[594] Fix | Delete
* @param array $args
[595] Fix | Delete
* @return void
[596] Fix | Delete
*/
[597] Fix | Delete
protected function remote_post( $data = array(), $args = array() ){
[598] Fix | Delete
if( empty( $data ) ) {
[599] Fix | Delete
return;
[600] Fix | Delete
}
[601] Fix | Delete
[602] Fix | Delete
$args = wp_parse_args( $args, array(
[603] Fix | Delete
'method' => 'POST',
[604] Fix | Delete
'timeout' => 30,
[605] Fix | Delete
'redirection' => 5,
[606] Fix | Delete
'httpversion' => '1.1',
[607] Fix | Delete
'blocking' => true,
[608] Fix | Delete
'body' => $data,
[609] Fix | Delete
'user-agent' => 'PUT/1.0.0; ' . get_bloginfo( 'url' )
[610] Fix | Delete
));
[611] Fix | Delete
$request = wp_remote_post( esc_url( self::API_URL ), $args );
[612] Fix | Delete
if( is_wp_error( $request ) || ( isset( $request['response'], $request['response']['code'] ) && $request['response']['code'] != 200 ) ) {
[613] Fix | Delete
return new WP_Error( 500, 'Something went wrong.' );
[614] Fix | Delete
}
[615] Fix | Delete
return $request;
[616] Fix | Delete
}
[617] Fix | Delete
/**
[618] Fix | Delete
* Difference between old and new data
[619] Fix | Delete
*
[620] Fix | Delete
* @param array $new_data
[621] Fix | Delete
* @param array $old_data
[622] Fix | Delete
* @return void
[623] Fix | Delete
*/
[624] Fix | Delete
protected function diff( $new_data, $old_data ){
[625] Fix | Delete
$data = [];
[626] Fix | Delete
if( ! empty( $new_data ) ) {
[627] Fix | Delete
foreach( $new_data as $key => $value ) {
[628] Fix | Delete
if( isset( $old_data[ $key ] ) ) {
[629] Fix | Delete
if( $old_data[ $key ] == $value ) {
[630] Fix | Delete
continue;
[631] Fix | Delete
}
[632] Fix | Delete
}
[633] Fix | Delete
$data[ $key ] = $value;
[634] Fix | Delete
}
[635] Fix | Delete
}
[636] Fix | Delete
return $data;
[637] Fix | Delete
}
[638] Fix | Delete
/**
[639] Fix | Delete
* Display the admin notice to users to allow them to opt in
[640] Fix | Delete
*
[641] Fix | Delete
* @since 3.0.0
[642] Fix | Delete
*/
[643] Fix | Delete
public function notice() {
[644] Fix | Delete
/**
[645] Fix | Delete
* Return if notice is not set.
[646] Fix | Delete
*/
[647] Fix | Delete
if( ! isset( $this->notice_options['notice'] ) ) {
[648] Fix | Delete
return;
[649] Fix | Delete
}
[650] Fix | Delete
/**
[651] Fix | Delete
* Check is allowed or blocked for notice.
[652] Fix | Delete
*/
[653] Fix | Delete
$block_notice = get_option( 'wpins_block_notice' );
[654] Fix | Delete
if( isset( $block_notice[$this->plugin_name] ) ) {
[655] Fix | Delete
return;
[656] Fix | Delete
}
[657] Fix | Delete
[658] Fix | Delete
if( ! \function_exists('wp_get_current_user') ) {
[659] Fix | Delete
require_once ABSPATH . "wp-includes/pluggable.php";
[660] Fix | Delete
}
[661] Fix | Delete
[662] Fix | Delete
if ( ! current_user_can( 'manage_options' ) ) {
[663] Fix | Delete
return;
[664] Fix | Delete
}
[665] Fix | Delete
[666] Fix | Delete
$url_yes = add_query_arg( [
[667] Fix | Delete
'plugin' => $this->plugin_name,
[668] Fix | Delete
'plugin_action' => 'yes',
[669] Fix | Delete
] );
[670] Fix | Delete
$url_no = add_query_arg( array(
[671] Fix | Delete
'plugin' => $this->plugin_name,
[672] Fix | Delete
'plugin_action' => 'no'
[673] Fix | Delete
) );
[674] Fix | Delete
[675] Fix | Delete
$url_yes = wp_nonce_url( $url_yes, '_wpnonce_optin_' . $this->plugin_name );
[676] Fix | Delete
$url_no = wp_nonce_url( $url_no, '_wpnonce_optin_' . $this->plugin_name );
[677] Fix | Delete
[678] Fix | Delete
// Decide on notice text
[679] Fix | Delete
$notice_text = $this->notice_options['notice'] . ' <a href="#" class="wpinsights-'. $this->plugin_name .'-collect">'. $this->notice_options['consent_button_text'] .'</a>';
[680] Fix | Delete
$extra_notice_text = $this->notice_options['extra_notice'];
[681] Fix | Delete
[682] Fix | Delete
$output = '';
[683] Fix | Delete
$output .= '<div class="embedpress-optin">';
[684] Fix | Delete
$output .= '<p>'. $notice_text .'</p>';
[685] Fix | Delete
$output .= '<div class="wpinsights-data" style="display: none;">';
[686] Fix | Delete
$output .= '<p>'. $extra_notice_text .'</p>';
[687] Fix | Delete
$output .= '</div>';
[688] Fix | Delete
$output .= '<p>';
[689] Fix | Delete
$output .= '<a href="'. esc_url( $url_yes ) .'" class="button-primary">'. $this->notice_options['yes'] .'</a>&nbsp;';
[690] Fix | Delete
$output .= '<a href="'. esc_url( $url_no ) .'" class="button-secondary">'. $this->notice_options['no'] .'</a>';
[691] Fix | Delete
$output .= '</p>';
[692] Fix | Delete
$output .= "<script type='text/javascript'>jQuery('.wpinsights-". $this->plugin_name ."-collect').on('click', function(e) {e.preventDefault();jQuery('.wpinsights-data').slideToggle('fast');});</script>";
[693] Fix | Delete
$output .= '</div>';
[694] Fix | Delete
[695] Fix | Delete
echo $output;
[696] Fix | Delete
}
[697] Fix | Delete
/**
[698] Fix | Delete
* Set all notice options to customized notice.
[699] Fix | Delete
*
[700] Fix | Delete
* @since 3.0.0
[701] Fix | Delete
* @param array $options
[702] Fix | Delete
* @return void
[703] Fix | Delete
*/
[704] Fix | Delete
public function set_notice_options( $options = [] ){
[705] Fix | Delete
$default_options = [
[706] Fix | Delete
'consent_button_text' => __( 'What we collect.', 'embedpress' ),
[707] Fix | Delete
'yes' => __( 'Sure, I\'d like to help', 'embedpress' ),
[708] Fix | Delete
'no' => __( 'No Thanks.', 'embedpress' ),
[709] Fix | Delete
];
[710] Fix | Delete
$options = wp_parse_args( $options, $default_options );
[711] Fix | Delete
$this->notice_options = $options;
[712] Fix | Delete
}
[713] Fix | Delete
/**
[714] Fix | Delete
* Responsible for track the click from Notice.
[715] Fix | Delete
* @return void
[716] Fix | Delete
*/
[717] Fix | Delete
public function clicked( $notice = null ){
[718] Fix | Delete
if( isset( $_GET[ '_wpnonce' ] ) && isset( $_GET['plugin'] ) && trim($_GET['plugin']) === $this->plugin_name && isset( $_GET['plugin_action'] ) ) {
[719] Fix | Delete
if( isset( $_GET['tab'] ) && $_GET['tab'] === 'plugin-information' ) {
[720] Fix | Delete
return;
[721] Fix | Delete
}
[722] Fix | Delete
[723] Fix | Delete
if( ! wp_verify_nonce( $_GET[ '_wpnonce' ], '_wpnonce_optin_' . $this->plugin_name ) ) {
[724] Fix | Delete
return;
[725] Fix | Delete
}
[726] Fix | Delete
[727] Fix | Delete
$plugin = sanitize_text_field( $_GET['plugin'] );
[728] Fix | Delete
$action = sanitize_text_field( $_GET['plugin_action'] );
[729] Fix | Delete
if( $action == 'yes' ) {
[730] Fix | Delete
$this->schedule_tracking();
[731] Fix | Delete
$this->set_is_tracking_allowed( true, $plugin );
[732] Fix | Delete
if( $this->do_tracking( true ) ) {
[733] Fix | Delete
$this->update_block_notice( $plugin );
[734] Fix | Delete
if( ! is_null ( $notice ) ) {
[735] Fix | Delete
$notice->dismiss->dismiss_notice();
[736] Fix | Delete
}
[737] Fix | Delete
}
[738] Fix | Delete
} else {
[739] Fix | Delete
$this->set_is_tracking_allowed( false, $plugin );
[740] Fix | Delete
$this->update_block_notice( $plugin );
[741] Fix | Delete
if( ! is_null ( $notice ) ) {
[742] Fix | Delete
$notice->dismiss->dismiss_notice();
[743] Fix | Delete
}
[744] Fix | Delete
}
[745] Fix | Delete
/**
[746] Fix | Delete
* Redirect User To the Current URL, but without set query arguments.
[747] Fix | Delete
*/
[748] Fix | Delete
wp_safe_redirect( $this->redirect_to() );
[749] Fix | Delete
}
[750] Fix | Delete
}
[751] Fix | Delete
/**
[752] Fix | Delete
* Set if we should block the opt-in notice for this plugin
[753] Fix | Delete
*
[754] Fix | Delete
* @since 3.0.0
[755] Fix | Delete
*/
[756] Fix | Delete
public function update_block_notice( $plugin = null ) {
[757] Fix | Delete
if( empty( $plugin ) ) {
[758] Fix | Delete
$plugin = $this->plugin_name;
[759] Fix | Delete
}
[760] Fix | Delete
$block_notice = get_option( 'wpins_block_notice' );
[761] Fix | Delete
if( empty( $block_notice ) || ! is_array( $block_notice ) ) {
[762] Fix | Delete
$block_notice = array( $plugin => $plugin );
[763] Fix | Delete
} else {
[764] Fix | Delete
$block_notice[$plugin] = $plugin;
[765] Fix | Delete
}
[766] Fix | Delete
update_option( 'wpins_block_notice', $block_notice );
[767] Fix | Delete
}
[768] Fix | Delete
/**
[769] Fix | Delete
* AJAX callback when the deactivated form is submitted.
[770] Fix | Delete
* @since 3.0.0
[771] Fix | Delete
*/
[772] Fix | Delete
public function deactivate_reasons_form_submit() {
[773] Fix | Delete
check_ajax_referer( 'wpins_deactivation_nonce', 'security' );
[774] Fix | Delete
if( isset( $_POST['values'] ) ) {
[775] Fix | Delete
$values = $_POST['values'];
[776] Fix | Delete
update_option( 'wpins_deactivation_reason_' . $this->plugin_name, $values );
[777] Fix | Delete
}
[778] Fix | Delete
if( isset( $_POST['details'] ) ) {
[779] Fix | Delete
$details = sanitize_text_field( $_POST['details'] );
[780] Fix | Delete
update_option( 'wpins_deactivation_details_' . $this->plugin_name, $details );
[781] Fix | Delete
}
[782] Fix | Delete
echo 'success';
[783] Fix | Delete
wp_die();
[784] Fix | Delete
}
[785] Fix | Delete
/**
[786] Fix | Delete
* Filter the deactivation link to allow us to present a form when the user deactivates the plugin
[787] Fix | Delete
* @since 3.0.0
[788] Fix | Delete
*/
[789] Fix | Delete
public function deactivate_action_links( $links ) {
[790] Fix | Delete
/**
[791] Fix | Delete
* Check is tracking allowed or not.
[792] Fix | Delete
*/
[793] Fix | Delete
if( ! $this->is_tracking_allowed() ) {
[794] Fix | Delete
return $links;
[795] Fix | Delete
}
[796] Fix | Delete
if( isset( $links['deactivate'] ) && $this->include_goodbye_form ) {
[797] Fix | Delete
$deactivation_link = $links['deactivate'];
[798] Fix | Delete
/**
[799] Fix | Delete
* Change the default deactivate button link.
[800] Fix | Delete
*/
[801] Fix | Delete
$deactivation_link = str_replace( '<a ', '<div class="wpinsights-goodbye-form-wrapper-'. esc_attr( $this->plugin_name ) .'"><div class="wpinsights-goodbye-form-bg"></div><span class="wpinsights-goodbye-form" id="wpinsights-goodbye-form"></span></div><a onclick="javascript:event.preventDefault();" id="wpinsights-goodbye-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
[802] Fix | Delete
$links['deactivate'] = $deactivation_link;
[803] Fix | Delete
}
[804] Fix | Delete
return $links;
[805] Fix | Delete
}
[806] Fix | Delete
/**
[807] Fix | Delete
* ALL Deactivate Reasons.
[808] Fix | Delete
* @since 3.0.0
[809] Fix | Delete
*/
[810] Fix | Delete
public function deactivation_reasons() {
[811] Fix | Delete
$form = array();
[812] Fix | Delete
$form['heading'] = __( 'Sorry to see you go', 'embedpress' );
[813] Fix | Delete
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'embedpress' );
[814] Fix | Delete
[815] Fix | Delete
$form['options'] = array(
[816] Fix | Delete
__( 'I no longer need the plugin', 'embedpress' ),
[817] Fix | Delete
[
[818] Fix | Delete
'label' => __( 'I found a better plugin', 'embedpress' ),
[819] Fix | Delete
'extra_field' => __( 'Please share which plugin', 'embedpress' )
[820] Fix | Delete
],
[821] Fix | Delete
__( "I couldn't get the plugin to work", 'embedpress' ),
[822] Fix | Delete
__( 'It\'s a temporary deactivation', 'embedpress' ),
[823] Fix | Delete
[
[824] Fix | Delete
'label' => __( 'Other', 'embedpress' ),
[825] Fix | Delete
'extra_field' => __( 'Please share the reason', 'embedpress' ),
[826] Fix | Delete
'type' => 'textarea'
[827] Fix | Delete
]
[828] Fix | Delete
);
[829] Fix | Delete
return apply_filters( 'wpins_form_text_' . $this->plugin_name, $form );
[830] Fix | Delete
}
[831] Fix | Delete
/**
[832] Fix | Delete
* Deactivate Reasons Form.
[833] Fix | Delete
* This form will appears when user wants to deactivate the plugin to send you deactivated reasons.
[834] Fix | Delete
*
[835] Fix | Delete
* @since 3.0.0
[836] Fix | Delete
*/
[837] Fix | Delete
public function deactivate_reasons_form() {
[838] Fix | Delete
$form = $this->deactivation_reasons();
[839] Fix | Delete
$class_plugin_name = esc_attr( $this->plugin_name );
[840] Fix | Delete
$html = '<div class="wpinsights-goodbye-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
[841] Fix | Delete
$html .= '<div class="wpinsights-goodbye-form-body"><p class="wpinsights-goodbye-form-caption">' . esc_html( $form['body'] ) . '</p>';
[842] Fix | Delete
if( is_array( $form['options'] ) ) {
[843] Fix | Delete
$html .= '<div id="wpinsights-goodbye-options" class="wpinsights-goodbye-options"><ul>';
[844] Fix | Delete
foreach( $form['options'] as $option ) {
[845] Fix | Delete
if( is_array( $option ) ) {
[846] Fix | Delete
$id = strtolower( str_replace( " ", "_", esc_attr( $option['label'] ) ) );
[847] Fix | Delete
$id = $id . '_' . $class_plugin_name;
[848] Fix | Delete
$html .= '<li class="has-goodbye-extra">';
[849] Fix | Delete
$html .= '<input type="radio" name="wpinsights-'. $class_plugin_name .'-goodbye-options" id="' . $id . '" value="' . esc_attr( $option['label'] ) . '">';
[850] Fix | Delete
$html .= '<div><label for="' . $id . '">' . esc_attr( $option['label'] ) . '</label>';
[851] Fix | Delete
if( isset( $option[ 'extra_field' ] ) && ! isset( $option['type'] )) {
[852] Fix | Delete
$html .= '<input type="text" style="display: none" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '">';
[853] Fix | Delete
}
[854] Fix | Delete
if( isset( $option[ 'extra_field' ] ) && isset( $option['type'] )) {
[855] Fix | Delete
$html .= '<'. $option['type'] .' style="display: none" type="text" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '"></' . $option['type'] . '>';
[856] Fix | Delete
}
[857] Fix | Delete
$html .= '</div></li>';
[858] Fix | Delete
} else {
[859] Fix | Delete
$id = strtolower( str_replace( " ", "_", esc_attr( $option ) ) );
[860] Fix | Delete
$id = $id . '_' . $class_plugin_name;
[861] Fix | Delete
$html .= '<li><input type="radio" name="wpinsights-'. $class_plugin_name .'-goodbye-options" id="' . $id . '" value="' . esc_attr( $option ) . '"> <label for="' . $id . '">' . esc_attr( $option ) . '</label></li>';
[862] Fix | Delete
}
[863] Fix | Delete
}
[864] Fix | Delete
$html .= '</ul></div><!-- .wpinsights-'. $class_plugin_name .'-goodbye-options -->';
[865] Fix | Delete
}
[866] Fix | Delete
$html .= '</div><!-- .wpinsights-goodbye-form-body -->';
[867] Fix | Delete
$html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'embedpress' ) . '</p>';
[868] Fix | Delete
[869] Fix | Delete
$wrapper_class = '.wpinsights-goodbye-form-wrapper-'. $class_plugin_name;
[870] Fix | Delete
[871] Fix | Delete
$styles = '';
[872] Fix | Delete
$styles .= '<style type="text/css">';
[873] Fix | Delete
$styles .= '.wpinsights-form-active-' . $class_plugin_name . ' .wpinsights-goodbye-form-bg {';
[874] Fix | Delete
$styles .= 'background: rgba( 0, 0, 0, .8 );position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 9;';
[875] Fix | Delete
$styles .= '}';
[876] Fix | Delete
$styles .= $wrapper_class . '{';
[877] Fix | Delete
$styles .= 'position: relative; display: none;';
[878] Fix | Delete
$styles .= '}';
[879] Fix | Delete
$styles .= '.wpinsights-form-active-' . $class_plugin_name . ' ' . $wrapper_class . '{';
[880] Fix | Delete
$styles .= 'display: flex !important; position: fixed;top: 0;left: 0;width: 100%;height: 100%; justify-content: center; align-items: center;';
[881] Fix | Delete
$styles .= '}';
[882] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form { display: none; }';
[883] Fix | Delete
$styles .= '.wpinsights-form-active-' . $class_plugin_name . ' .wpinsights-goodbye-form {';
[884] Fix | Delete
$styles .= 'position: relative !important; width: 550px; max-width: 80%; background: #fff; box-shadow: 2px 8px 23px 3px rgba(0,0,0,.2); border-radius: 3px; white-space: normal; overflow: hidden; display: block; z-index: 999999;';
[885] Fix | Delete
$styles .= '}';
[886] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-head {';
[887] Fix | Delete
$styles .= 'background: #fff; color: #495157; padding: 18px; box-shadow: 0 0 8px rgba(0,0,0,.1); font-size: 15px;';
[888] Fix | Delete
$styles .= '}';
[889] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form .wpinsights-goodbye-form-head strong { font-size: 15px; }';
[890] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body { padding: 8px 18px; color: #333; }';
[891] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body label { padding-left: 5px; color: #6d7882; }';
[892] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body .wpinsights-goodbye-form-caption {';
[893] Fix | Delete
$styles .= 'font-weight: 500; font-size: 15px; color: #495157; line-height: 1.4;';
[894] Fix | Delete
$styles .= '}';
[895] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options { padding-top: 5px; }';
[896] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li { margin-bottom: 15px; }';
[897] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li > div { display: inline; padding-left: 3px; }';
[898] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li > div > input, '. $wrapper_class .' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li > div > textarea {';
[899] Fix | Delete
$styles .= 'margin: 10px 18px; padding: 8px; width: 80%;';
[900] Fix | Delete
$styles .= '}';
[901] Fix | Delete
$styles .= $wrapper_class . ' .deactivating-spinner { display: none; padding-bottom: 20px !important; }';
[902] Fix | Delete
$styles .= $wrapper_class . ' .deactivating-spinner .spinner { float: none; margin: 4px 4px 0 18px; vertical-align: bottom; visibility: visible; }';
[903] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer { padding: 8px 18px; margin-bottom: 15px; }';
[904] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer > .wpinsights-goodbye-form-buttons { display: flex; align-items: center; justify-content: space-between; }';
[905] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer .wpinsights-submit-btn {';
[906] Fix | Delete
$styles .= 'background-color: #d30c5c; -webkit-border-radius: 3px; border-radius: 3px; color: #fff; line-height: 1; padding: 15px 20px; font-size: 13px;';
[907] Fix | Delete
$styles .= '}';
[908] Fix | Delete
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer .wpinsights-deactivate-btn {';
[909] Fix | Delete
$styles .= 'font-size: 13px; color: #a4afb7; background: none; float: right; padding-right: 10px; width: auto; text-decoration: underline;';
[910] Fix | Delete
$styles .= '}';
[911] Fix | Delete
$styles .= $wrapper_class . ' .test {';
[912] Fix | Delete
$styles .= '}';
[913] Fix | Delete
$styles .= '</style>';
[914] Fix | Delete
$styles .= '';
[915] Fix | Delete
[916] Fix | Delete
echo $styles;
[917] Fix | Delete
?>
[918] Fix | Delete
<script type="text/javascript">
[919] Fix | Delete
jQuery(document).ready(function($){
[920] Fix | Delete
$("#wpinsights-goodbye-link-<?php echo $class_plugin_name; ?>").on("click",function(){
[921] Fix | Delete
// We'll send the user to this deactivation link when they've completed or dismissed the form
[922] Fix | Delete
var url = document.getElementById("wpinsights-goodbye-link-<?php echo $class_plugin_name; ?>");
[923] Fix | Delete
$('body').toggleClass('wpinsights-form-active-<?php echo $class_plugin_name; ?>');
[924] Fix | Delete
$(".wpinsights-goodbye-form-wrapper-<?php echo $class_plugin_name; ?> #wpinsights-goodbye-form").fadeIn();
[925] Fix | Delete
$(".wpinsights-goodbye-form-wrapper-<?php echo $class_plugin_name; ?> #wpinsights-goodbye-form").html( '<?php echo $html; ?>' + '<div class="wpinsights-goodbye-form-footer"><div class="wpinsights-goodbye-form-buttons"><a id="wpinsights-submit-form-<?php echo $class_plugin_name; ?>" class="wpinsights-submit-btn" href="#"><?php _e( 'Submit and Deactivate', 'embedpress' ); ?></a>&nbsp;<a class="wpsp-put-deactivate-btn" href="'+url+'"><?php _e( 'Just Deactivate', 'embedpress' ); ?></a></div></div>');
[926] Fix | Delete
$('#wpinsights-submit-form-<?php echo $class_plugin_name; ?>').on('click', function(e){
[927] Fix | Delete
// As soon as we click, the body of the form should disappear
[928] Fix | Delete
$("#wpinsights-goodbye-form-<?php echo $class_plugin_name; ?> .wpinsights-goodbye-form-body").fadeOut();
[929] Fix | Delete
$("#wpinsights-goodbye-form-<?php echo $class_plugin_name; ?> .wpinsights-goodbye-form-footer").fadeOut();
[930] Fix | Delete
// Fade in spinner
[931] Fix | Delete
$("#wpinsights-goodbye-form-<?php echo $class_plugin_name; ?> .deactivating-spinner").fadeIn();
[932] Fix | Delete
e.preventDefault();
[933] Fix | Delete
var checkedInput = $("input[name='wpinsights-<?php echo $class_plugin_name; ?>-goodbye-options']:checked"),
[934] Fix | Delete
checkedInputVal, details;
[935] Fix | Delete
if( checkedInput.length > 0 ) {
[936] Fix | Delete
checkedInputVal = checkedInput.val();
[937] Fix | Delete
details = $('input[name="'+ checkedInput[0].id +'"], textarea[name="'+ checkedInput[0].id +'"]').val();
[938] Fix | Delete
}
[939] Fix | Delete
[940] Fix | Delete
if( typeof details === 'undefined' ) {
[941] Fix | Delete
details = '';
[942] Fix | Delete
}
[943] Fix | Delete
if( typeof checkedInputVal === 'undefined' ) {
[944] Fix | Delete
checkedInputVal = 'No Reason';
[945] Fix | Delete
}
[946] Fix | Delete
[947] Fix | Delete
var data = {
[948] Fix | Delete
'action': 'deactivation_form_<?php echo $class_plugin_name; ?>',
[949] Fix | Delete
'values': checkedInputVal,
[950] Fix | Delete
'details': details,
[951] Fix | Delete
'security': "<?php echo wp_create_nonce ( 'wpins_deactivation_nonce' ); ?>",
[952] Fix | Delete
'dataType': "json"
[953] Fix | Delete
}
[954] Fix | Delete
[955] Fix | Delete
$.post(
[956] Fix | Delete
ajaxurl,
[957] Fix | Delete
data,
[958] Fix | Delete
function(response){
[959] Fix | Delete
// Redirect to original deactivation URL
[960] Fix | Delete
window.location.href = url;
[961] Fix | Delete
}
[962] Fix | Delete
);
[963] Fix | Delete
});
[964] Fix | Delete
$('#wpinsights-goodbye-options > ul ').on('click', 'li label, li > input', function( e ){
[965] Fix | Delete
var parent = $(this).parents('li');
[966] Fix | Delete
parent.siblings().find('label').next('input, textarea').css('display', 'none');
[967] Fix | Delete
parent.find('label').next('input, textarea').css('display', 'block');
[968] Fix | Delete
});
[969] Fix | Delete
// If we click outside the form, the form will close
[970] Fix | Delete
$('.wpinsights-goodbye-form-bg').on('click',function(){
[971] Fix | Delete
$("#wpinsights-goodbye-form").fadeOut();
[972] Fix | Delete
$('body').removeClass('wpinsights-form-active-<?php echo $class_plugin_name; ?>');
[973] Fix | Delete
});
[974] Fix | Delete
});
[975] Fix | Delete
});
[976] Fix | Delete
</script>
[977] Fix | Delete
<?php }
[978] Fix | Delete
}
[979] Fix | Delete
endif;
[980] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function