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
/home/sportsfe.../httpdocs/wp-conte.../plugins/custom-t.../inc/Admin
File: CTF_New_User.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* CTF_New_User.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 2.18
[4] Fix | Delete
*/
[5] Fix | Delete
namespace TwitterFeed\Admin;
[6] Fix | Delete
[7] Fix | Delete
// Exit if accessed directly
[8] Fix | Delete
use TwitterFeed\Builder\CTF_Db;
[9] Fix | Delete
[10] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[11] Fix | Delete
exit;
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
class CTF_New_User extends CTF_Notifications {
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* Source of notifications content.
[18] Fix | Delete
*
[19] Fix | Delete
* @since 2.0
[20] Fix | Delete
*
[21] Fix | Delete
* @var string
[22] Fix | Delete
*/
[23] Fix | Delete
const SOURCE_URL = 'https://plugin.smashballoon.com/newuser.json';
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* @var string
[27] Fix | Delete
*/
[28] Fix | Delete
const OPTION_NAME = 'ctf_newuser_notifications';
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Register hooks.
[32] Fix | Delete
*
[33] Fix | Delete
* @since 2.0
[34] Fix | Delete
*/
[35] Fix | Delete
public function hooks() {
[36] Fix | Delete
add_action( 'admin_init', array( $this, 'dismiss' ) );
[37] Fix | Delete
add_action( 'wp_ajax_ctf_review_notice_consent_update', array( $this, 'review_notice_consent' ) );
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
public function option_name() {
[41] Fix | Delete
return self::OPTION_NAME;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
public function source_url() {
[45] Fix | Delete
return self::SOURCE_URL;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Verify notification data before it is saved.
[50] Fix | Delete
*
[51] Fix | Delete
* @param array $notifications Array of notifications items to verify.
[52] Fix | Delete
*
[53] Fix | Delete
* @return array
[54] Fix | Delete
*
[55] Fix | Delete
* @since 2.0
[56] Fix | Delete
*/
[57] Fix | Delete
public function verify( $notifications ) {
[58] Fix | Delete
$data = array();
[59] Fix | Delete
[60] Fix | Delete
if ( ! is_array( $notifications ) || empty( $notifications ) ) {
[61] Fix | Delete
return $data;
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
$option = $this->get_option();
[65] Fix | Delete
[66] Fix | Delete
foreach ( $notifications as $key => $notification ) {
[67] Fix | Delete
[68] Fix | Delete
// The message should never be empty, if they are, ignore.
[69] Fix | Delete
if ( empty( $notification['content'] ) ) {
[70] Fix | Delete
continue;
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
// Ignore if notification has already been dismissed.
[74] Fix | Delete
if ( ! empty( $option['dismissed'] ) && in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
[75] Fix | Delete
continue;
[76] Fix | Delete
}
[77] Fix | Delete
[78] Fix | Delete
$data[ $key ] = $notification;
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
return $data;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Verify saved notification data for active notifications.
[86] Fix | Delete
*
[87] Fix | Delete
* @since 2.0
[88] Fix | Delete
*
[89] Fix | Delete
* @param array $notifications Array of notifications items to verify.
[90] Fix | Delete
*
[91] Fix | Delete
* @return array
[92] Fix | Delete
*/
[93] Fix | Delete
public function verify_active( $notifications ) {
[94] Fix | Delete
if ( ! is_array( $notifications ) || empty( $notifications ) ) {
[95] Fix | Delete
return array();
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
$ctf_statuses_option = get_option( 'ctf_statuses', array() );
[99] Fix | Delete
$current_time = ctf_get_current_time();
[100] Fix | Delete
[101] Fix | Delete
// rating notice logic
[102] Fix | Delete
$ctf_rating_notice_option = get_option( 'ctf_rating_notice', false );
[103] Fix | Delete
$ctf_rating_notice_waiting = get_transient( 'custom_twitter_feeds_rating_notice_waiting' );
[104] Fix | Delete
$should_show_rating_notice = ($ctf_rating_notice_waiting !== 'waiting' && $ctf_rating_notice_option !== 'dismissed');
[105] Fix | Delete
[106] Fix | Delete
// new user discount logic
[107] Fix | Delete
$in_new_user_month_range = true;
[108] Fix | Delete
$should_show_new_user_discount = false;
[109] Fix | Delete
$has_been_one_month_since_rating_dismissal = isset( $ctf_statuses_option['rating_notice_dismissed'] ) ? ((int)$ctf_statuses_option['rating_notice_dismissed'] + ((int)$notifications['review']['wait'] * DAY_IN_SECONDS)) < $current_time + 1: true;
[110] Fix | Delete
[111] Fix | Delete
if ( isset( $ctf_statuses_option['first_install'] ) && $ctf_statuses_option['first_install'] === 'from_update' ) {
[112] Fix | Delete
global $current_user;
[113] Fix | Delete
$user_id = $current_user->ID;
[114] Fix | Delete
$ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'ctf_ignore_new_user_sale_notice' );
[115] Fix | Delete
$ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
[116] Fix | Delete
if ( $ignore_new_user_sale_notice_meta !== 'always' ) {
[117] Fix | Delete
$should_show_new_user_discount = true;
[118] Fix | Delete
}
[119] Fix | Delete
} elseif ( $in_new_user_month_range && $has_been_one_month_since_rating_dismissal && $ctf_rating_notice_waiting !== 'waiting' ) {
[120] Fix | Delete
global $current_user;
[121] Fix | Delete
$user_id = $current_user->ID;
[122] Fix | Delete
$ignore_new_user_sale_notice_meta = get_user_meta( $user_id, 'ctf_ignore_new_user_sale_notice' );
[123] Fix | Delete
$ignore_new_user_sale_notice_meta = isset( $ignore_new_user_sale_notice_meta[0] ) ? $ignore_new_user_sale_notice_meta[0] : '';
[124] Fix | Delete
[125] Fix | Delete
if ( $ignore_new_user_sale_notice_meta !== 'always'
[126] Fix | Delete
&& isset( $ctf_statuses_option['first_install'] )
[127] Fix | Delete
&& $current_time > (int)$ctf_statuses_option['first_install'] + ((int)$notifications['discount']['wait'] * DAY_IN_SECONDS) ) {
[128] Fix | Delete
$should_show_new_user_discount = true;
[129] Fix | Delete
}
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
if ( ctf_is_pro_version() ) {
[133] Fix | Delete
$should_show_new_user_discount = false;
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
if ( isset( $notifications['review'] ) && $should_show_rating_notice ) {
[137] Fix | Delete
return array( $notifications['review'] );
[138] Fix | Delete
} elseif ( isset( $notifications['discount'] ) && $should_show_new_user_discount ) {
[139] Fix | Delete
return array( $notifications['discount'] );
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
return array();
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* Get notification data.
[147] Fix | Delete
*
[148] Fix | Delete
* @since 2.0
[149] Fix | Delete
*
[150] Fix | Delete
* @return array
[151] Fix | Delete
*/
[152] Fix | Delete
public function get() {
[153] Fix | Delete
if ( ! $this->has_access() ) {
[154] Fix | Delete
return array();
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
$option = $this->get_option();
[158] Fix | Delete
[159] Fix | Delete
$ctf_options = get_option( 'ctf_options', array() );
[160] Fix | Delete
[161] Fix | Delete
if ( empty( $ctf_options[ CTF_SITE_ACCESS_TOKEN_KEY ] ) ) {
[162] Fix | Delete
$feeds_count = CTF_Db::feeds_count();
[163] Fix | Delete
if ( $feeds_count > 0 ) {
[164] Fix | Delete
$notifications = array(
[165] Fix | Delete
array(
[166] Fix | Delete
'title' => 'Twitter API Changes',
[167] Fix | Delete
'content' => 'Using Custom Twitter Feeds now requires that you connect with Smash Balloon and create a site key. Click the button below to visit our website and verify an email address to get started.',
[168] Fix | Delete
'image' => 'balloon',
[169] Fix | Delete
'type' => array( 'free' ),
[170] Fix | Delete
'id' => 'freeconnect',
[171] Fix | Delete
'recent_install_override' => true,
[172] Fix | Delete
"btns" => array(
[173] Fix | Delete
'primary' => array(
[174] Fix | Delete
'url' => ctf_oauth_url( admin_url( 'admin.php?page=ctf-settings' ) ),
[175] Fix | Delete
'text' => 'Connect',
[176] Fix | Delete
'attr' => array(
[177] Fix | Delete
)
[178] Fix | Delete
)
[179] Fix | Delete
),
[180] Fix | Delete
'start' => '2022-02-08 00:00:00',
[181] Fix | Delete
'end' => '2030-02-08 00:00:00',
[182] Fix | Delete
)
[183] Fix | Delete
);
[184] Fix | Delete
return $notifications;
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
// Only update if does not exist.
[190] Fix | Delete
if ( empty( $option['update'] ) ) {
[191] Fix | Delete
$this->update();
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
$events = ! empty( $option['events'] ) ? $this->verify_active( $option['events'] ) : array();
[195] Fix | Delete
$feed = ! empty( $option['feed'] ) ? $this->verify_active( $option['feed'] ) : array();
[196] Fix | Delete
[197] Fix | Delete
return array_merge( $events, $feed );
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
/**
[201] Fix | Delete
* Add a manual notification event.
[202] Fix | Delete
*
[203] Fix | Delete
* @since 2.0
[204] Fix | Delete
*
[205] Fix | Delete
* @param array $notification Notification data.
[206] Fix | Delete
*/
[207] Fix | Delete
public function add( $notification ) {
[208] Fix | Delete
if ( empty( $notification['id'] ) ) {
[209] Fix | Delete
return;
[210] Fix | Delete
}
[211] Fix | Delete
[212] Fix | Delete
$option = $this->get_option();
[213] Fix | Delete
[214] Fix | Delete
if ( in_array( $notification['id'], $option['dismissed'] ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
[215] Fix | Delete
return;
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
foreach ( $option['events'] as $item ) {
[219] Fix | Delete
if ( $item['id'] === $notification['id'] ) {
[220] Fix | Delete
return;
[221] Fix | Delete
}
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
$notification = $this->verify( array( $notification ) );
[225] Fix | Delete
[226] Fix | Delete
update_option(
[227] Fix | Delete
$this->option_name(),
[228] Fix | Delete
array(
[229] Fix | Delete
'update' => $option['update'],
[230] Fix | Delete
'feed' => $option['feed'],
[231] Fix | Delete
'events' => array_merge( $notification, $option['events'] ),
[232] Fix | Delete
'dismissed' => $option['dismissed'],
[233] Fix | Delete
)
[234] Fix | Delete
);
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
/**
[238] Fix | Delete
* Update notification data from feed.
[239] Fix | Delete
*
[240] Fix | Delete
* @since 2.0
[241] Fix | Delete
*/
[242] Fix | Delete
public function update() {
[243] Fix | Delete
$feed = $this->fetch_feed();
[244] Fix | Delete
$option = $this->get_option();
[245] Fix | Delete
[246] Fix | Delete
update_option(
[247] Fix | Delete
$this->option_name(),
[248] Fix | Delete
array(
[249] Fix | Delete
'update' => time(),
[250] Fix | Delete
'feed' => $feed,
[251] Fix | Delete
'events' => $option['events'],
[252] Fix | Delete
'dismissed' => $option['dismissed'],
[253] Fix | Delete
)
[254] Fix | Delete
);
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
/**
[258] Fix | Delete
* Do not enqueue anything extra.
[259] Fix | Delete
*
[260] Fix | Delete
* @since 2.0
[261] Fix | Delete
*/
[262] Fix | Delete
public function enqueues() {
[263] Fix | Delete
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
public function review_notice_consent() {
[267] Fix | Delete
//Security Checks
[268] Fix | Delete
check_ajax_referer( 'ctf-admin', 'ctf_nonce' );
[269] Fix | Delete
$cap = ctf_get_manage_options_cap();
[270] Fix | Delete
[271] Fix | Delete
if ( ! current_user_can( $cap ) ) {
[272] Fix | Delete
wp_send_json_error(); // This auto-dies.
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
$consent = isset( $_POST[ 'consent' ] ) ? sanitize_text_field( $_POST[ 'consent' ] ) : '';
[276] Fix | Delete
[277] Fix | Delete
update_option( 'ctf_review_consent', $consent );
[278] Fix | Delete
[279] Fix | Delete
if ( $consent == 'no' ) {
[280] Fix | Delete
$ctf_statuses_option = get_option( 'ctf_statuses', array() );
[281] Fix | Delete
update_option( 'ctf_rating_notice', 'dismissed', false );
[282] Fix | Delete
$ctf_statuses_option['rating_notice_dismissed'] = ctf_get_current_time();
[283] Fix | Delete
update_option( 'ctf_statuses', $ctf_statuses_option, false );
[284] Fix | Delete
}
[285] Fix | Delete
wp_die();
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
/**
[289] Fix | Delete
* Output notifications on Form Overview admin area.
[290] Fix | Delete
*
[291] Fix | Delete
* @since 2.0
[292] Fix | Delete
*/
[293] Fix | Delete
public function output() {
[294] Fix | Delete
$notifications = $this->get();
[295] Fix | Delete
[296] Fix | Delete
if ( empty( $notifications ) ) {
[297] Fix | Delete
return;
[298] Fix | Delete
}
[299] Fix | Delete
[300] Fix | Delete
if ( function_exists( 'display_instagram' ) ) {
[301] Fix | Delete
return;
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
if ( function_exists( 'cff_check_for_db_updates' ) ) {
[305] Fix | Delete
return;
[306] Fix | Delete
}
[307] Fix | Delete
// new user notices included in regular settings page notifications so this
[308] Fix | Delete
// checks to see if user is one of those pages
[309] Fix | Delete
if ( ! empty( $_GET['page'] )
[310] Fix | Delete
&& strpos( $_GET['page'], 'ctf' ) !== false ) {
[311] Fix | Delete
return;
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
$content_allowed_tags = array(
[315] Fix | Delete
'em' => array(),
[316] Fix | Delete
'strong' => array(),
[317] Fix | Delete
'span' => array(
[318] Fix | Delete
'style' => array(),
[319] Fix | Delete
),
[320] Fix | Delete
'a' => array(
[321] Fix | Delete
'href' => array(),
[322] Fix | Delete
'target' => array(),
[323] Fix | Delete
'rel' => array(),
[324] Fix | Delete
),
[325] Fix | Delete
);
[326] Fix | Delete
$image_overlay = '';
[327] Fix | Delete
[328] Fix | Delete
foreach ( $notifications as $notification ) {
[329] Fix | Delete
$img_src = CTF_PLUGIN_URL . 'admin/assets/img/' . sanitize_text_field( $notification['image'] );
[330] Fix | Delete
$type = sanitize_text_field( $notification['id'] );
[331] Fix | Delete
// check if this is a review notice
[332] Fix | Delete
if( $type == 'review' ) {
[333] Fix | Delete
$review_consent = get_option( 'ctf_review_consent' );
[334] Fix | Delete
$ctf_open_feedback_url = 'https://smashballoon.com/feedback/?plugin=twitter-free';
[335] Fix | Delete
// step #1 for the review notice
[336] Fix | Delete
if ( ! $review_consent ) {
[337] Fix | Delete
?>
[338] Fix | Delete
<div class="ctf_notice ctf_review_notice_step_1">
[339] Fix | Delete
<div class="ctf_thumb">
[340] Fix | Delete
<img src="<?php echo esc_url( str_replace( array( 'sbi', 'png' ), array( 'ctf', 'svg' ), $img_src ) ); ?>" alt="notice">
[341] Fix | Delete
</div>
[342] Fix | Delete
<div class="ctf-notice-text">
[343] Fix | Delete
<p class="ctf-notice-text-p"><?php echo __( 'Are you enjoying the Twitter Feed Plugin?', 'custom-twitter-feeds' ); ?></p>
[344] Fix | Delete
</div>
[345] Fix | Delete
<div class="ctf-notice-consent-btns">
[346] Fix | Delete
<?php
[347] Fix | Delete
printf(
[348] Fix | Delete
'<button class="ctf-btn-link" id="ctf_review_consent_yes">%s</button>',
[349] Fix | Delete
__( 'Yes', 'custom-twitter-feeds' )
[350] Fix | Delete
);
[351] Fix | Delete
[352] Fix | Delete
printf(
[353] Fix | Delete
'<a href="%s" target="_blank" rel="nofollow noopener" class="ctf-btn-link" id="ctf_review_consent_no">%s</a>',
[354] Fix | Delete
$ctf_open_feedback_url,
[355] Fix | Delete
__( 'No', 'custom-twitter-feeds' )
[356] Fix | Delete
);
[357] Fix | Delete
?>
[358] Fix | Delete
</div>
[359] Fix | Delete
</div>
[360] Fix | Delete
<?php
[361] Fix | Delete
}
[362] Fix | Delete
}
[363] Fix | Delete
$close_href = add_query_arg( array( 'ctf_dismiss' => $type ) );
[364] Fix | Delete
[365] Fix | Delete
$title = $this->get_notice_title( $notification );
[366] Fix | Delete
$content = $this->get_notice_content( $notification, $content_allowed_tags );
[367] Fix | Delete
[368] Fix | Delete
$buttons = array();
[369] Fix | Delete
if ( ! empty( $notification['btns'] ) && is_array( $notification['btns'] ) ) {
[370] Fix | Delete
foreach ( $notification['btns'] as $btn_type => $btn ) {
[371] Fix | Delete
if ( ! is_array( $btn['url'] ) ) {
[372] Fix | Delete
$buttons[ $btn_type ]['url'] = $this->replace_merge_fields( $btn['url'], $notification );
[373] Fix | Delete
} elseif ( is_array( $btn['url'] ) ) {
[374] Fix | Delete
$buttons[ $btn_type ]['url'] = add_query_arg( $btn['url'] );
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
$buttons[ $btn_type ]['attr'] = '';
[378] Fix | Delete
if ( ! empty( $btn['attr'] ) ) {
[379] Fix | Delete
$buttons[ $btn_type ]['attr'] = ' target="_blank" rel="noopener noreferrer"';
[380] Fix | Delete
}
[381] Fix | Delete
[382] Fix | Delete
$buttons[ $btn_type ]['class'] = '';
[383] Fix | Delete
if ( ! empty( $btn['class'] ) ) {
[384] Fix | Delete
$buttons[ $btn_type ]['class'] = ' ' . $btn['class'];
[385] Fix | Delete
}
[386] Fix | Delete
[387] Fix | Delete
$buttons[ $btn_type ]['text'] = '';
[388] Fix | Delete
if ( ! empty( $btn['text'] ) ) {
[389] Fix | Delete
$buttons[ $btn_type ]['text'] = wp_kses( $btn['text'], $content_allowed_tags );
[390] Fix | Delete
}
[391] Fix | Delete
}
[392] Fix | Delete
}
[393] Fix | Delete
}
[394] Fix | Delete
[395] Fix | Delete
$review_consent = get_option( 'ctf_review_consent' );
[396] Fix | Delete
$review_step2_style = '';
[397] Fix | Delete
if ( $type == 'review' && ! $review_consent ) {
[398] Fix | Delete
$review_step2_style = 'style="display: none;"';
[399] Fix | Delete
}
[400] Fix | Delete
?>
[401] Fix | Delete
[402] Fix | Delete
<div class="ctf_notice_op ctf_notice ctf_<?php echo esc_attr( $type ); ?>_notice" <?php echo !empty( $review_step2_style ) ? $review_step2_style : ''; ?>>
[403] Fix | Delete
<div class="ctf_thumb">
[404] Fix | Delete
<img src="<?php echo esc_url( str_replace( array( 'sbi', 'png' ), array( 'ctf', 'svg' ), $img_src ) ); ?>" alt="notice">
[405] Fix | Delete
<?php echo $image_overlay; ?>
[406] Fix | Delete
</div>
[407] Fix | Delete
<div class="ctf-notice-text">
[408] Fix | Delete
<div class="ctf-notice-text-inner">
[409] Fix | Delete
<h3 class="ctf-notice-text-header"><?php echo $title; ?></h3>
[410] Fix | Delete
<p class="ctf-notice-text-p"><?php echo $content; ?></p>
[411] Fix | Delete
</div>
[412] Fix | Delete
<div class="ctf-notice-btns-wrap">
[413] Fix | Delete
<p class="ctf-notice-links">
[414] Fix | Delete
<?php
[415] Fix | Delete
foreach ( $buttons as $type => $button ) :
[416] Fix | Delete
$btn_classes = array('ctf-btn');
[417] Fix | Delete
$btn_classes[] = esc_attr( $button['class'] );
[418] Fix | Delete
if ( $type == 'primary' ) {
[419] Fix | Delete
$btn_classes[] = 'ctf-btn-blue';
[420] Fix | Delete
} else {
[421] Fix | Delete
$btn_classes[] = 'ctf-btn-grey';
[422] Fix | Delete
}
[423] Fix | Delete
?>
[424] Fix | Delete
<a class="<?php echo implode(' ', $btn_classes); ?>" href="<?php echo esc_attr( str_replace( 'sbi_', 'ctf_', $button['url'] ) ); ?>"<?php echo $button['attr']; ?>><?php echo $button['text']; ?></a>
[425] Fix | Delete
<?php endforeach; ?>
[426] Fix | Delete
</p>
[427] Fix | Delete
</div>
[428] Fix | Delete
</div>
[429] Fix | Delete
<div class="ctf-notice-dismiss">
[430] Fix | Delete
<a href="<?php echo esc_url( $close_href ); ?>">
[431] Fix | Delete
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
[432] Fix | Delete
<path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" fill="#141B38"></path>
[433] Fix | Delete
</svg>
[434] Fix | Delete
</a>
[435] Fix | Delete
</div>
[436] Fix | Delete
</div>
[437] Fix | Delete
<?php
[438] Fix | Delete
}
[439] Fix | Delete
[440] Fix | Delete
/**
[441] Fix | Delete
* CTF Get Notice Title depending on the notice type
[442] Fix | Delete
*
[443] Fix | Delete
* @since 6.0
[444] Fix | Delete
*
[445] Fix | Delete
* @param array $notification
[446] Fix | Delete
*
[447] Fix | Delete
* @return string $title
[448] Fix | Delete
*/
[449] Fix | Delete
public function get_notice_title( $notification ) {
[450] Fix | Delete
$type = $notification['id'];
[451] Fix | Delete
$title = '';
[452] Fix | Delete
[453] Fix | Delete
// Notice title depending on notice type
[454] Fix | Delete
if ( $type == 'review' ) {
[455] Fix | Delete
$title = __( 'Glad to hear you are enjoying it. Would you consider leaving a positive review?', 'custom-twitter-feeds' );
[456] Fix | Delete
} else if ( $type == 'discount' ) {
[457] Fix | Delete
$title = __( 'Exclusive Offer! 60% OFF', 'custom-twitter-feeds' );
[458] Fix | Delete
} else {
[459] Fix | Delete
$title = $this->replace_merge_fields( $notification['title'], $notification );
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
return $title;
[463] Fix | Delete
}
[464] Fix | Delete
[465] Fix | Delete
/**
[466] Fix | Delete
* CTF Get Notice Content depending on the notice type
[467] Fix | Delete
*
[468] Fix | Delete
* @since 6.0
[469] Fix | Delete
*
[470] Fix | Delete
* @param array $notification
[471] Fix | Delete
* @param array $content_allowed_tags
[472] Fix | Delete
*
[473] Fix | Delete
* @return string $content
[474] Fix | Delete
*/
[475] Fix | Delete
public function get_notice_content( $notification, $content_allowed_tags ) {
[476] Fix | Delete
$type = $notification['id'];
[477] Fix | Delete
$content = '';
[478] Fix | Delete
[479] Fix | Delete
// Notice content depending on notice type
[480] Fix | Delete
if ( $type == 'review' ) {
[481] Fix | Delete
$content = __( 'It really helps to support the plugin and help others to discover it too!', 'custom-twitter-feeds' );
[482] Fix | Delete
} else if ( $type == 'discount' ) {
[483] Fix | Delete
$content = __( '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 Twitter Feed.', 'custom-twitter-feeds' );
[484] Fix | Delete
} else {
[485] Fix | Delete
if ( ! empty( $notification['content'] ) ) {
[486] Fix | Delete
$content = wp_kses( $this->replace_merge_fields( $notification['content'], $notification ), $content_allowed_tags );
[487] Fix | Delete
}
[488] Fix | Delete
}
[489] Fix | Delete
return $content;
[490] Fix | Delete
}
[491] Fix | Delete
[492] Fix | Delete
/**
[493] Fix | Delete
* Hide messages permanently or some can be dismissed temporarily
[494] Fix | Delete
*
[495] Fix | Delete
* @since 2.0
[496] Fix | Delete
*/
[497] Fix | Delete
public function dismiss() {
[498] Fix | Delete
global $current_user;
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function