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/custom-t.../inc/Admin
File: CTF_Notifications.php
[500] Fix | Delete
$notifications = $this->get();
[501] Fix | Delete
[502] Fix | Delete
if ( empty( $notifications ) ) {
[503] Fix | Delete
return;
[504] Fix | Delete
}
[505] Fix | Delete
[506] Fix | Delete
$is_review_notice = ! empty( $notifications[0] ) && ! empty( $notifications[0]['id'] ) && $notifications[0]['id'] === 'review';
[507] Fix | Delete
[508] Fix | Delete
if ( ! $is_review_notice && ! empty( $_GET['feed_id'] ) ) {
[509] Fix | Delete
return;
[510] Fix | Delete
}
[511] Fix | Delete
[512] Fix | Delete
$notifications_html = '';
[513] Fix | Delete
$current_class = ' current';
[514] Fix | Delete
$content_allowed_tags = array(
[515] Fix | Delete
'em' => array(),
[516] Fix | Delete
'strong' => array(),
[517] Fix | Delete
'br' => array(),
[518] Fix | Delete
'span' => array(
[519] Fix | Delete
'style' => array(),
[520] Fix | Delete
),
[521] Fix | Delete
'a' => array(
[522] Fix | Delete
'href' => array(),
[523] Fix | Delete
'target' => array(),
[524] Fix | Delete
'rel' => array(),
[525] Fix | Delete
),
[526] Fix | Delete
);
[527] Fix | Delete
[528] Fix | Delete
foreach ( $notifications as $notification ) {
[529] Fix | Delete
$type = $notification['id'];
[530] Fix | Delete
// Buttons HTML.
[531] Fix | Delete
$buttons_html = '';
[532] Fix | Delete
if ( ! empty( $notification['btns'] ) && is_array( $notification['btns'] ) ) {
[533] Fix | Delete
foreach ( $notification['btns'] as $btn_type => $btn ) {
[534] Fix | Delete
if ( $type == 'review' || $type == 'discount' ) {
[535] Fix | Delete
$btn_class = $btn_type === 'primary' ? 'ctf-btn-blue' : 'ctf-btn-grey';
[536] Fix | Delete
} else {
[537] Fix | Delete
$btn_class = $btn_type === 'primary' ? 'ctf-btn-orange' : 'ctf-btn-grey';
[538] Fix | Delete
}
[539] Fix | Delete
if ( is_array( $btn['url'] ) ) {
[540] Fix | Delete
$args = array();
[541] Fix | Delete
foreach ( $btn['url'] as $key => $value ) {
[542] Fix | Delete
$args[ sanitize_key( $key ) ] = sanitize_key( $value );
[543] Fix | Delete
}
[544] Fix | Delete
$btn['url'] = add_query_arg( $args );
[545] Fix | Delete
}
[546] Fix | Delete
if ( ! empty( $btn['attr'] ) ) {
[547] Fix | Delete
$btn['target'] = '_blank';
[548] Fix | Delete
}
[549] Fix | Delete
if ( empty( $btn['class'] ) ) {
[550] Fix | Delete
$btn['class'] = '';
[551] Fix | Delete
}
[552] Fix | Delete
$buttons_html .= sprintf(
[553] Fix | Delete
'<a href="%1$s" class="ctf-btn %2$s %3$s"%4$s>%5$s</a>',
[554] Fix | Delete
! empty( $btn['url'] ) ? esc_url( $this->replace_merge_fields( str_replace( 'sbi_', 'ctf_', $btn['url'] ), $notification ) ) : '',
[555] Fix | Delete
esc_attr( $btn['class'] ),
[556] Fix | Delete
esc_attr( $btn_class ),
[557] Fix | Delete
! empty( $btn['target'] ) && $btn['target'] === '_blank' ? ' target="_blank" rel="noopener noreferrer"' : '',
[558] Fix | Delete
! empty( $btn['text'] ) ? sanitize_text_field( $btn['text'] ) : ''
[559] Fix | Delete
);
[560] Fix | Delete
}
[561] Fix | Delete
$buttons_html = ! empty( $buttons_html ) ? '<div class="buttons">' . $buttons_html . '</div>' : '';
[562] Fix | Delete
}
[563] Fix | Delete
[564] Fix | Delete
if ( empty( $notification['image'] ) ) {
[565] Fix | Delete
$image_html = '<div class="bell">';
[566] Fix | Delete
[567] Fix | Delete
$image_html .= '<svg xmlns="http://www.w3.org/2000/svg" width="42" height="48" viewBox="0 0 42 48"><defs><style>.a{fill:#777;}.b{fill:#ca4a1f;}</style></defs><path class="a" d="M23-79a6.005,6.005,0,0,1-6-6h10.06a12.066,12.066,0,0,0,1.791,1.308,6.021,6.021,0,0,1-2.077,3.352A6.008,6.008,0,0,1,23-79Zm1.605-9H5.009a2.955,2.955,0,0,1-2.173-.923A3.088,3.088,0,0,1,2-91a2.919,2.919,0,0,1,.807-2.036c.111-.12.229-.243.351-.371a14.936,14.936,0,0,0,3.126-4.409A23.283,23.283,0,0,0,8.007-107.5a14.846,14.846,0,0,1,.906-5.145,14.5,14.5,0,0,1,2.509-4.324A15.279,15.279,0,0,1,20-122.046V-124a3,3,0,0,1,3-3,3,3,0,0,1,3,3v1.954a15.28,15.28,0,0,1,8.58,5.078,14.5,14.5,0,0,1,2.509,4.324,14.846,14.846,0,0,1,.906,5.145c0,.645.016,1.281.047,1.888A12.036,12.036,0,0,0,35-106a11.921,11.921,0,0,0-8.485,3.515A11.923,11.923,0,0,0,23-94a12,12,0,0,0,1.6,6Z" transform="translate(-2 127)"/><circle class="b" cx="9" cy="9" r="9" transform="translate(24 24)"/></svg>';
[568] Fix | Delete
$image_html .= '</div>';
[569] Fix | Delete
} else {
[570] Fix | Delete
if ( $notification['image'] === 'balloon' ) {
[571] Fix | Delete
$image_html = sprintf(
[572] Fix | Delete
'<div class="bell"><img src="%s" alt="notice">',
[573] Fix | Delete
CTF_PLUGIN_URL . 'admin/assets/img/balloon.svg' );
[574] Fix | Delete
} else if ( $notification['id'] === 'review' || $notification['id'] === 'discount' ) {
[575] Fix | Delete
$image_html = sprintf(
[576] Fix | Delete
'<div class="bell"><img src="%s" alt="notice">',
[577] Fix | Delete
CTF_PLUGIN_URL . 'admin/assets/img/' . sanitize_text_field( str_replace( array( 'sbi', '.png' ), array( 'ctf', '.svg' ), $notification['image'] ) )
[578] Fix | Delete
);
[579] Fix | Delete
} else {
[580] Fix | Delete
$image_html = '<div class="thumb">';
[581] Fix | Delete
$img_src = CTF_PLUGIN_URL . 'admin/assets/img/' . sanitize_text_field( $notification['image'] );
[582] Fix | Delete
$image_html .= '<img src="'.esc_url( $img_src ).'" alt="notice">';
[583] Fix | Delete
[584] Fix | Delete
if ( isset( $notification['image_overlay'] ) ) {
[585] Fix | Delete
$image_html .= '<div class="img-overlay">'. esc_html( str_replace( '%', '%%', $notification['image_overlay'] ) ).'</div>';
[586] Fix | Delete
}
[587] Fix | Delete
}
[588] Fix | Delete
$image_html .= '</div>';
[589] Fix | Delete
[590] Fix | Delete
}
[591] Fix | Delete
[592] Fix | Delete
// Check if it's review notice then show step #1
[593] Fix | Delete
if ( $type == 'review' ) {
[594] Fix | Delete
$step1_img = CTF_PLUGIN_URL . 'admin/assets/img/' . sanitize_text_field( str_replace( array( 'sbi', 'png' ), array( 'ctf', 'svg' ), $notification['image'] ) );
[595] Fix | Delete
$step1_img_html = sprintf('<div class="bell"><img src="%s" alt="notice"></div>', $step1_img);
[596] Fix | Delete
[597] Fix | Delete
$review_consent = get_option( 'ctf_review_consent' );
[598] Fix | Delete
$ctf_open_feedback_url = 'https://smashballoon.com/feedback/?plugin=twitter-free';
[599] Fix | Delete
// step #1 for the review notice
[600] Fix | Delete
if ( ! $review_consent ) {
[601] Fix | Delete
$step1_btns = sprintf(
[602] Fix | Delete
'<button class="ctf-btn-link" id="ctf_review_consent_yes">%s</button>',
[603] Fix | Delete
__( 'Yes', 'custom-twitter-feeds' )
[604] Fix | Delete
);
[605] Fix | Delete
$step1_btns .= sprintf(
[606] Fix | Delete
'<a href="%s" target="_blank" rel="nofollow noopener" class="ctf-btn-link" id="ctf_review_consent_no">%s</a>',
[607] Fix | Delete
$ctf_open_feedback_url,
[608] Fix | Delete
__( 'No', 'custom-twitter-feeds' )
[609] Fix | Delete
);
[610] Fix | Delete
$notifications_html .= sprintf(
[611] Fix | Delete
'<div class="ctf_review_step1_notice" data-message-id="%3$s">' . $step1_img_html . '
[612] Fix | Delete
<h3 class="title">%1$s</h3>
[613] Fix | Delete
<div class="review-step-1-btns">%2$s</div>
[614] Fix | Delete
</div>',
[615] Fix | Delete
__( 'Are you enjoying the Custom Twitter Feeds Plugin?', 'custom-twitter-feeds' ),
[616] Fix | Delete
$step1_btns,
[617] Fix | Delete
! empty( $notification['id'] ) ? esc_attr( sanitize_text_field( $notification['id'] ) ) : 0
[618] Fix | Delete
);
[619] Fix | Delete
}
[620] Fix | Delete
}
[621] Fix | Delete
[622] Fix | Delete
$review_consent = get_option( 'ctf_review_consent' );
[623] Fix | Delete
$review_step2_style = '';
[624] Fix | Delete
if ( $type == 'review' && ! $review_consent ) {
[625] Fix | Delete
$review_step2_style = 'style="display: none;"';
[626] Fix | Delete
}
[627] Fix | Delete
[628] Fix | Delete
// Build the notification HTML for review notice
[629] Fix | Delete
if ( $type == 'review' ) {
[630] Fix | Delete
$notifications_html .= sprintf(
[631] Fix | Delete
'<div class="message%5$s %7$s" data-message-id="%4$s" %6$s>' . $image_html . '
[632] Fix | Delete
<h3 class="title">%1$s</h3>
[633] Fix | Delete
<p class="content">%2$s</p>
[634] Fix | Delete
%3$s
[635] Fix | Delete
</div>',
[636] Fix | Delete
__( 'Glad to hear you are enjoying it. Would you consider leaving a positive review?', 'custom-twitter-feeds' ),
[637] Fix | Delete
__( 'It really helps to support the plugin and help others to discover it too!', 'custom-twitter-feeds' ),
[638] Fix | Delete
$buttons_html,
[639] Fix | Delete
! empty( $notification['id'] ) ? esc_attr( sanitize_text_field( $notification['id'] ) ) : 0,
[640] Fix | Delete
$current_class,
[641] Fix | Delete
( $notification['id'] == 'review' && ! empty( $review_step2_style ) ) ? $review_step2_style : '',
[642] Fix | Delete
( $type == 'review' ) ? 'rn_step_2' : ''
[643] Fix | Delete
);
[644] Fix | Delete
} else if ( $type == 'discount' ) {
[645] Fix | Delete
// Build the notification HTML for discount notice
[646] Fix | Delete
$notifications_html .= sprintf(
[647] Fix | Delete
'<div class="message%5$s %7$s" data-message-id="%4$s" %6$s>' . $image_html . '
[648] Fix | Delete
<h3 class="title">%1$s</h3>
[649] Fix | Delete
<p class="content">%2$s</p>
[650] Fix | Delete
%3$s
[651] Fix | Delete
</div>',
[652] Fix | Delete
__( 'Exclusive offer - 60% off!', 'custom-twitter-feeds' ),
[653] Fix | Delete
__( 'We don’t run promotions very often, but for a limited time we’re offering 60% Off our Pro version to all users of our free Custom Twitter Feeds.', 'custom-twitter-feeds' ),
[654] Fix | Delete
$buttons_html,
[655] Fix | Delete
! empty( $notification['id'] ) ? esc_attr( sanitize_text_field( $notification['id'] ) ) : 0,
[656] Fix | Delete
$current_class,
[657] Fix | Delete
( $notification['id'] == 'review' && ! empty( $review_step2_style ) ) ? $review_step2_style : '',
[658] Fix | Delete
( $type == 'review' && ! $review_consent ) ? 'rn_step_2' : ''
[659] Fix | Delete
);
[660] Fix | Delete
} else {
[661] Fix | Delete
// Notification HTML for other notices
[662] Fix | Delete
$notifications_html .= sprintf(
[663] Fix | Delete
'<div class="message%5$s" data-message-id="%4$s" %6$s>' . $image_html . '
[664] Fix | Delete
<h3 class="title">%1$s</h3>
[665] Fix | Delete
<p class="content">%2$s</p>
[666] Fix | Delete
%3$s
[667] Fix | Delete
</div>',
[668] Fix | Delete
! empty( $notification['title'] ) ? $this->replace_merge_fields( sanitize_text_field( $notification['title'] ), $notification ) : '',
[669] Fix | Delete
! empty( $notification['content'] ) ? wp_kses( $this->replace_merge_fields( $notification['content'], $notification ), $content_allowed_tags ) : '',
[670] Fix | Delete
$buttons_html,
[671] Fix | Delete
! empty( $notification['id'] ) ? esc_attr( sanitize_text_field( $notification['id'] ) ) : 0,
[672] Fix | Delete
$current_class,
[673] Fix | Delete
( $notification['id'] == 'review' && ! empty( $review_step2_style ) ) ? $review_step2_style : ''
[674] Fix | Delete
);
[675] Fix | Delete
}
[676] Fix | Delete
[677] Fix | Delete
// Only first notification is current.
[678] Fix | Delete
$current_class = '';
[679] Fix | Delete
}
[680] Fix | Delete
[681] Fix | Delete
$close_href = add_query_arg( array( 'ctf_dismiss' => $type ) );
[682] Fix | Delete
$type_class = '';
[683] Fix | Delete
if ( $type === 'review' || $type == 'discount' ) {
[684] Fix | Delete
$type_class = $type === 'review' ? 'ctf_review_notice' : 'ctf_discount_notice';
[685] Fix | Delete
}
[686] Fix | Delete
[687] Fix | Delete
?>
[688] Fix | Delete
[689] Fix | Delete
<div id="ctf-notifications" class="<?php echo esc_attr( $type_class ); ?>">
[690] Fix | Delete
<a
[691] Fix | Delete
class="dismiss"
[692] Fix | Delete
title="<?php echo esc_attr__( 'Dismiss this message', 'custom-twitter-feeds' ); ?>"
[693] Fix | Delete
<?php echo ( $type == 'review' || $type == 'discount' ) ? 'href="'. esc_attr( $close_href ) .'"' : '' ?>
[694] Fix | Delete
>
[695] Fix | Delete
<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
[696] Fix | Delete
<path d="M9.66683 1.27325L8.72683 0.333252L5.00016 4.05992L1.2735 0.333252L0.333496 1.27325L4.06016 4.99992L0.333496 8.72659L1.2735 9.66659L5.00016 5.93992L8.72683 9.66659L9.66683 8.72659L5.94016 4.99992L9.66683 1.27325Z" fill="white"/>
[697] Fix | Delete
</svg>
[698] Fix | Delete
</a>
[699] Fix | Delete
[700] Fix | Delete
<?php if ( count( $notifications ) > 1 ) : ?>
[701] Fix | Delete
<div class="navigation">
[702] Fix | Delete
<a class="prev disabled" title="<?php echo esc_attr__( 'Previous message', 'custom-twitter-feeds' ); ?>"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-left" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" class="svg-inline--fa fa-chevron-left fa-w-10"><path fill="currentColor" d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z" class=""></path></svg></a>
[703] Fix | Delete
<a class="next disabled" title="<?php echo esc_attr__( 'Next message', 'custom-twitter-feeds' ); ?>"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-right" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" class="svg-inline--fa fa-chevron-right fa-w-10"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" class=""></path></svg></a>
[704] Fix | Delete
</div>
[705] Fix | Delete
<?php endif; ?>
[706] Fix | Delete
[707] Fix | Delete
<div class="messages">
[708] Fix | Delete
<?php echo $notifications_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
[709] Fix | Delete
</div>
[710] Fix | Delete
</div>
[711] Fix | Delete
<?php
[712] Fix | Delete
}
[713] Fix | Delete
[714] Fix | Delete
/**
[715] Fix | Delete
* Dismiss notification via AJAX. If it's a new user message, also dismiss it
[716] Fix | Delete
* on all admin pages.
[717] Fix | Delete
*
[718] Fix | Delete
* @since 2.0
[719] Fix | Delete
*/
[720] Fix | Delete
public function dismiss() {
[721] Fix | Delete
// Run a security check.
[722] Fix | Delete
check_ajax_referer( 'ctf-admin', 'nonce' );
[723] Fix | Delete
[724] Fix | Delete
// Check for access and required param.
[725] Fix | Delete
if ( ! $this->has_access() || empty( $_POST['id'] ) ) {
[726] Fix | Delete
wp_send_json_error();
[727] Fix | Delete
}
[728] Fix | Delete
[729] Fix | Delete
$id = sanitize_text_field( wp_unslash( $_POST['id'] ) );
[730] Fix | Delete
[731] Fix | Delete
if ( $id === 'review' ) {
[732] Fix | Delete
$ctf_statuses_option = get_option( 'ctf_statuses', array() );
[733] Fix | Delete
[734] Fix | Delete
update_option( 'ctf_rating_notice', 'dismissed', false );
[735] Fix | Delete
$ctf_statuses_option['rating_notice_dismissed'] = ctf_get_current_time();
[736] Fix | Delete
update_option( 'ctf_statuses', $ctf_statuses_option, false );
[737] Fix | Delete
} elseif ( $id === 'discount' ) {
[738] Fix | Delete
update_user_meta( get_current_user_id(), 'ctf_ignore_new_user_sale_notice', 'always' );
[739] Fix | Delete
[740] Fix | Delete
$current_month_number = (int)date('n', ctf_get_current_time() );
[741] Fix | Delete
$not_early_in_the_year = ($current_month_number > 5);
[742] Fix | Delete
[743] Fix | Delete
if ( $not_early_in_the_year ) {
[744] Fix | Delete
update_user_meta( get_current_user_id(), 'ctf_ignore_bfcm_sale_notice', date( 'Y', ctf_get_current_time() ) );
[745] Fix | Delete
}
[746] Fix | Delete
}
[747] Fix | Delete
[748] Fix | Delete
$option = $this->get_option();
[749] Fix | Delete
$type = is_numeric( $id ) ? 'feed' : 'events';
[750] Fix | Delete
[751] Fix | Delete
$option['dismissed'][] = $id;
[752] Fix | Delete
$option['dismissed'] = array_unique( $option['dismissed'] );
[753] Fix | Delete
[754] Fix | Delete
// Remove notification.
[755] Fix | Delete
if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) {
[756] Fix | Delete
foreach ( $option[ $type ] as $key => $notification ) {
[757] Fix | Delete
if ( $notification['id'] == $id ) { // phpcs:ignore WordPress.PHP.StrictComparisons
[758] Fix | Delete
unset( $option[ $type ][ $key ] );
[759] Fix | Delete
break;
[760] Fix | Delete
}
[761] Fix | Delete
}
[762] Fix | Delete
}
[763] Fix | Delete
[764] Fix | Delete
update_option( 'ctf_notifications', $option );
[765] Fix | Delete
[766] Fix | Delete
wp_send_json_success();
[767] Fix | Delete
}
[768] Fix | Delete
}
[769] Fix | Delete
[770] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function