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
File: CTF_Display_Elements.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Class CTF_Display_Elements
[2] Fix | Delete
*
[3] Fix | Delete
*
[4] Fix | Delete
* @since 2.0
[5] Fix | Delete
*/
[6] Fix | Delete
namespace TwitterFeed;
[7] Fix | Delete
use TwitterFeed\Builder\CTF_Feed_Builder;
[8] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[9] Fix | Delete
die( '-1' );
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
class CTF_Display_Elements {
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Get Feed Item CSS Classes
[16] Fix | Delete
*
[17] Fix | Delete
* @since 2.0
[18] Fix | Delete
*/
[19] Fix | Delete
public static function get_item_classes( $data, $feed_options, $i ) {
[20] Fix | Delete
$data = $data[$i];
[21] Fix | Delete
[22] Fix | Delete
$tweet_classes = 'ctf-item ctf-author-' . CTF_Parse::get_author_screen_name( $data ) .' ctf-new';
[23] Fix | Delete
$tweet_classes .= ( !ctf_show( 'avatar', $feed_options ) ) ? ' ctf-hide-avatar' : '';
[24] Fix | Delete
$tweet_classes = apply_filters( 'ctf_tweet_classes', $tweet_classes );
[25] Fix | Delete
[26] Fix | Delete
$tweet_classes .= isset( $data['retweeted_status'] ) ? ' ctf-retweet' : '';
[27] Fix | Delete
$tweet_classes .= isset( $data['quoted_status'] ) ? ' ctf-quoted' : '';
[28] Fix | Delete
$tweet_classes = ' class="' . $tweet_classes . '" ';
[29] Fix | Delete
if( ctf_doing_customizer($feed_options) ){
[30] Fix | Delete
$tweet_classes .= ' :class="!$parent.valueIsEnabled($parent.customizerFeedData.settings.include_avatar) ? \'ctf-hide-avatar\' : \'\'" ';
[31] Fix | Delete
}
[32] Fix | Delete
return $tweet_classes;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Get Tweet Retweet Attribute
[38] Fix | Delete
*
[39] Fix | Delete
* @since 2.0
[40] Fix | Delete
*/
[41] Fix | Delete
public static function get_retweet_attr( $post, $check_duplicates ) {
[42] Fix | Delete
if( isset( $post['retweeted_status'] ) && $check_duplicates ) {
[43] Fix | Delete
return ' data-ctfretweetid="'.$post['retweeted_status']['id_str'].'"';
[44] Fix | Delete
}
[45] Fix | Delete
return '';
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Get Tweet Quoted Media Text
[50] Fix | Delete
*
[51] Fix | Delete
* @since 2.0
[52] Fix | Delete
*/
[53] Fix | Delete
public static function get_quoted_media_text( $post, $feed_options ) {
[54] Fix | Delete
$quoted_media_text = '';
[55] Fix | Delete
if(!$feed_options['is_legacy'] || ($feed_options['is_legacy'] && ctf_show( 'placeholder', $feed_options ))){
[56] Fix | Delete
if ( isset( $post['quoted_status'] ) ) {
[57] Fix | Delete
$quoted = $post['quoted_status'];
[58] Fix | Delete
[59] Fix | Delete
if ( ( isset( $quoted['extended_entities']['media'][0] ) || isset( $quoted['entities']['media'][0] ) ) && ctf_show( 'placeholder', $feed_options ) ) {
[60] Fix | Delete
$quoted_media = isset( $quoted['extended_entities']['media'] ) ? $quoted['extended_entities']['media'] : $quoted['entities']['media'];
[61] Fix | Delete
$quoted_media_count = count( $quoted_media );
[62] Fix | Delete
switch ( $quoted_media[0]['type'] ) {
[63] Fix | Delete
case 'video':
[64] Fix | Delete
case 'animated_gif':
[65] Fix | Delete
$quoted_media_text .= '<span class="ctf-quoted-tweet-text-media-wrap">' . ctf_get_fa_el( 'fa-file-video-o' ) . '</span>';
[66] Fix | Delete
break;
[67] Fix | Delete
default:
[68] Fix | Delete
if ( $quoted_media_count > 1 ) {
[69] Fix | Delete
$quoted_media_text .= '<span class="ctf-quoted-tweet-text-media-wrap ctf-multi-media-icon">' . $quoted_media_count . ctf_get_fa_el( 'fa-picture-o' ) . '</span>';
[70] Fix | Delete
} else {
[71] Fix | Delete
$quoted_media_text .= '<span class="ctf-quoted-tweet-text-media-wrap">' . ctf_get_fa_el( 'fa-picture-o' ) . '</span>';
[72] Fix | Delete
}
[73] Fix | Delete
break;
[74] Fix | Delete
}
[75] Fix | Delete
} else {
[76] Fix | Delete
unset( $quoted_media );
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
return $quoted_media_text;
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Get Tweet Post media TExt
[86] Fix | Delete
*
[87] Fix | Delete
* @since 2.0
[88] Fix | Delete
*/
[89] Fix | Delete
public static function get_post_media_text( $post, $feed_options, $type = 'text' ) {
[90] Fix | Delete
$post_media_text = '';
[91] Fix | Delete
$post_media_count = 0;
[92] Fix | Delete
if ( ( isset( $post['extended_entities']['media'][0] ) || isset( $post['entities']['media'][0] ) ) ) {
[93] Fix | Delete
$post_media = isset( $post['extended_entities']['media'] ) ? $post['extended_entities']['media'] : $post['entities']['media'];
[94] Fix | Delete
$post_media_count = count( $post_media );
[95] Fix | Delete
switch ( $post_media[0]['type'] ) {
[96] Fix | Delete
case 'video':
[97] Fix | Delete
case 'animated_gif':
[98] Fix | Delete
$post_media_text .= ctf_get_fa_el( 'fa-file-video-o' );
[99] Fix | Delete
break;
[100] Fix | Delete
default:
[101] Fix | Delete
if ( $post_media_count > 1 ) {
[102] Fix | Delete
$post_media_text .= $post_media_count . ctf_get_fa_el( 'fa-picture-o' );
[103] Fix | Delete
} else {
[104] Fix | Delete
$post_media_text .= ctf_get_fa_el( 'fa-picture-o' );
[105] Fix | Delete
}
[106] Fix | Delete
break;
[107] Fix | Delete
}
[108] Fix | Delete
} else {
[109] Fix | Delete
unset( $post_media );
[110] Fix | Delete
return '';
[111] Fix | Delete
}
[112] Fix | Delete
$html = ($type == 'text') ? $post_media_text : $post_media_count;
[113] Fix | Delete
$multi_class = $post_media_count > 1 ? ' ctf-multi-media-icon' : '';
[114] Fix | Delete
[115] Fix | Delete
if ( $feed_options['linktexttotwitter'] ) {
[116] Fix | Delete
return $html;
[117] Fix | Delete
} elseif ( $feed_options['disablelinks'] ) {
[118] Fix | Delete
$return = '<span class="ctf-tweet-text-media-wrap'.$multi_class.'">' . $html . '</span>';
[119] Fix | Delete
} else {
[120] Fix | Delete
$return = '</p><a href="https://twitter.com/' . $post['user']['screen_name'] . '/status/' . $post['id_str'] . '" target="_blank" rel="noopener noreferrer" class="ctf-tweet-text-media-wrap'.$multi_class.'">' . $html . '</a>';
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
return $return;
[124] Fix | Delete
}
[125] Fix | Delete
/**
[126] Fix | Delete
* Display Feed Header
[127] Fix | Delete
*
[128] Fix | Delete
* @param array $settings
[129] Fix | Delete
*
[130] Fix | Delete
* @return string
[131] Fix | Delete
*
[132] Fix | Delete
* @since 2.0
[133] Fix | Delete
*/
[134] Fix | Delete
public static function display_header( $feed_options, $tweet_set ){
[135] Fix | Delete
if ( empty( $tweet_set ) || (isset( $tweet_set[0] ) && is_string( $tweet_set[0] ) && $tweet_set[0] === 'error') ) {
[136] Fix | Delete
return;
[137] Fix | Delete
}
[138] Fix | Delete
if( ctf_doing_customizer( $feed_options ) ){
[139] Fix | Delete
$header_template = 'header-generic';
[140] Fix | Delete
if ( $feed_options['type'] === 'usertimeline' || $feed_options['type'] === 'mentionstimeline' || $feed_options['type'] === 'hometimeline' ) {
[141] Fix | Delete
$header_template = 'header';
[142] Fix | Delete
}
[143] Fix | Delete
include ctf_get_feed_template_part( $header_template, $feed_options );
[144] Fix | Delete
include ctf_get_feed_template_part( 'header-text', $feed_options );
[145] Fix | Delete
}else{
[146] Fix | Delete
include ctf_get_feed_template_part( CTF_Display_Elements::header_type( $feed_options ), $feed_options );
[147] Fix | Delete
}
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
public static function header_type( $feed_options ) {
[151] Fix | Delete
$header_template = 'header-generic';
[152] Fix | Delete
if ( $feed_options['type'] === 'usertimeline' || $feed_options['type'] === 'mentionstimeline' || $feed_options['type'] === 'hometimeline' ) {
[153] Fix | Delete
$header_template = 'header';
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
if( isset( $feed_options['headerstyle'] ) && $feed_options['headerstyle'] == 'text'){
[157] Fix | Delete
$header_template = 'header-text';
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
return $header_template;
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
/**
[164] Fix | Delete
* Should Show Element
[165] Fix | Delete
*
[166] Fix | Delete
* @param array $settings
[167] Fix | Delete
* @param string $setting_name
[168] Fix | Delete
* @param bool $custom_condition
[169] Fix | Delete
*
[170] Fix | Delete
* @return string
[171] Fix | Delete
*
[172] Fix | Delete
* @since 2.0
[173] Fix | Delete
*/
[174] Fix | Delete
public static function should_show_element_vue( $settings, $setting_name, $custom_condition = false ) {
[175] Fix | Delete
$customizer = ctf_doing_customizer( $settings );
[176] Fix | Delete
if ( $customizer ) {
[177] Fix | Delete
return ' v-if="$parent.valueIsEnabled($parent.customizerFeedData.settings.' . $setting_name . ')' . ( $custom_condition != false ? $custom_condition : '' ) . '" ';
[178] Fix | Delete
}
[179] Fix | Delete
return '';
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
/**
[183] Fix | Delete
* Should Print HTML
[184] Fix | Delete
*
[185] Fix | Delete
* @param bool $customizer
[186] Fix | Delete
* @param string $content
[187] Fix | Delete
*
[188] Fix | Delete
* @return string
[189] Fix | Delete
*
[190] Fix | Delete
* @since 2.0
[191] Fix | Delete
*/
[192] Fix | Delete
public static function should_print_element_vue( $customizer, $content ) {
[193] Fix | Delete
if ( $customizer ) {
[194] Fix | Delete
return ' v-html="' . $content . '" ';
[195] Fix | Delete
}
[196] Fix | Delete
return '';
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
/**
[200] Fix | Delete
* Should Print HTML
[201] Fix | Delete
*
[202] Fix | Delete
* @param bool $customizer
[203] Fix | Delete
* @param string $condition
[204] Fix | Delete
*
[205] Fix | Delete
* @return string
[206] Fix | Delete
*
[207] Fix | Delete
* @since 2.0
[208] Fix | Delete
*/
[209] Fix | Delete
public static function create_condition_vue( $customizer, $condition ) {
[210] Fix | Delete
if ( $customizer ) {
[211] Fix | Delete
return ' v-if="' . $condition . '" ';
[212] Fix | Delete
}
[213] Fix | Delete
return '';
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
/**
[217] Fix | Delete
* Should Show Print HTML
[218] Fix | Delete
*
[219] Fix | Delete
* @param bool $customizer
[220] Fix | Delete
* @param string $condition
[221] Fix | Delete
*
[222] Fix | Delete
* @return string
[223] Fix | Delete
*
[224] Fix | Delete
* @since 2.0
[225] Fix | Delete
*/
[226] Fix | Delete
public static function create_condition_show_vue( $customizer, $condition ) {
[227] Fix | Delete
if ( $customizer ) {
[228] Fix | Delete
return ' v-show="' . $condition . '" ';
[229] Fix | Delete
}
[230] Fix | Delete
return '';
[231] Fix | Delete
}
[232] Fix | Delete
[233] Fix | Delete
/**
[234] Fix | Delete
* Print Element HTML Attribute
[235] Fix | Delete
*
[236] Fix | Delete
* @param bool $customizer
[237] Fix | Delete
* @param array $args
[238] Fix | Delete
*
[239] Fix | Delete
* @return string
[240] Fix | Delete
*
[241] Fix | Delete
* @since 2.0
[242] Fix | Delete
*/
[243] Fix | Delete
public static function print_element_attribute( $customizer, $args ) {
[244] Fix | Delete
if ( $customizer ) {
[245] Fix | Delete
return ' :' . $args['attr'] . '="' . $args['vue_content'] . '"';
[246] Fix | Delete
}
[247] Fix | Delete
if( ( isset( $args['php_condition'] ) && $args['php_condition'] ) || !isset( $args['php_condition'] ) ){
[248] Fix | Delete
return ' ' . $args['attr'] . '="' . $args['php_content'] . '"';
[249] Fix | Delete
}
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
/**
[253] Fix | Delete
* Print Element HTML Attribute
[254] Fix | Delete
*
[255] Fix | Delete
* @param bool $customizer
[256] Fix | Delete
* @param array $args
[257] Fix | Delete
*
[258] Fix | Delete
* @return string
[259] Fix | Delete
*
[260] Fix | Delete
* @since 2.0
[261] Fix | Delete
*/
[262] Fix | Delete
public static function get_element_attribute( $element, $settings ) {
[263] Fix | Delete
$customizer = ctf_doing_customizer( $settings );
[264] Fix | Delete
if( $customizer ){
[265] Fix | Delete
switch ($element) {
[266] Fix | Delete
case 'author':
[267] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_author)');
[268] Fix | Delete
break;
[269] Fix | Delete
case 'avatar':
[270] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_author) && $parent.valueIsEnabled($parent.customizerFeedData.settings.include_avatar)');
[271] Fix | Delete
break;
[272] Fix | Delete
case 'author_text':
[273] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_author) && $parent.valueIsEnabled($parent.customizerFeedData.settings.include_author_text)');
[274] Fix | Delete
break;
[275] Fix | Delete
case 'date':
[276] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_date)');
[277] Fix | Delete
break;
[278] Fix | Delete
case 'logo':
[279] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_logo)');
[280] Fix | Delete
break;
[281] Fix | Delete
case 'text_and_link':
[282] Fix | Delete
return CTF_Display_Elements::create_condition_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_text) && $parent.valueIsEnabled($parent.customizerFeedData.settings.linktexttotwitter)');
[283] Fix | Delete
break;
[284] Fix | Delete
case 'text_no_link':
[285] Fix | Delete
return CTF_Display_Elements::create_condition_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_text) && !$parent.valueIsEnabled($parent.customizerFeedData.settings.linktexttotwitter)');
[286] Fix | Delete
break;
[287] Fix | Delete
case 'linkbox':
[288] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_linkbox)');
[289] Fix | Delete
break;
[290] Fix | Delete
case 'media':
[291] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_media)');
[292] Fix | Delete
break;
[293] Fix | Delete
case 'repliedto':
[294] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_replied_to)');
[295] Fix | Delete
break;
[296] Fix | Delete
case 'retweeter':
[297] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_retweeter)');
[298] Fix | Delete
break;
[299] Fix | Delete
case 'loadmore':
[300] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.showbutton) && $parent.customizerFeedData.settings.layout !== \'carousel\' ') . ' ' . CTF_Display_Elements::should_print_element_vue( $customizer, '$parent.customizerFeedData.settings.buttontext' );
[301] Fix | Delete
break;
[302] Fix | Delete
case 'headerbio':
[303] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.showbio)');
[304] Fix | Delete
break;
[305] Fix | Delete
case 'header':
[306] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.showheader) && $parent.customizerFeedData.settings.headerstyle === \'standard\' ');
[307] Fix | Delete
break;
[308] Fix | Delete
case 'header-text':
[309] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.showheader) && $parent.customizerFeedData.settings.headerstyle === \'text\' ') . ' ' . CTF_Display_Elements::should_print_element_vue( $customizer, '$parent.customizerFeedData.settings.customheadertext' );
[310] Fix | Delete
break;
[311] Fix | Delete
case 'actions':
[312] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.include_actions)');
[313] Fix | Delete
break;
[314] Fix | Delete
case 'viewtwitterlink':
[315] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.valueIsEnabled($parent.customizerFeedData.settings.viewtwitterlink)');
[316] Fix | Delete
break;
[317] Fix | Delete
case 'viewtwitterlink_text':
[318] Fix | Delete
return CTF_Display_Elements::should_print_element_vue( $customizer, '$parent.customizerFeedData.settings.twitterlinktext' );
[319] Fix | Delete
break;
[320] Fix | Delete
case 'twitter_cards':
[321] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.customizerFeedData.settings.include_twittercards' );
[322] Fix | Delete
break;
[323] Fix | Delete
case 'linkto':
[324] Fix | Delete
return CTF_Display_Elements::create_condition_show_vue( $customizer, '$parent.customizerFeedData.settings.linktexttotwitter' );
[325] Fix | Delete
break;
[326] Fix | Delete
[327] Fix | Delete
}
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
return '';
[331] Fix | Delete
}
[332] Fix | Delete
[333] Fix | Delete
[334] Fix | Delete
/**
[335] Fix | Delete
* Should Show Element
[336] Fix | Delete
*
[337] Fix | Delete
* @param array $settings
[338] Fix | Delete
* @param string $setting_name
[339] Fix | Delete
* @param bool $custom_condition
[340] Fix | Delete
*
[341] Fix | Delete
* @return string
[342] Fix | Delete
*
[343] Fix | Delete
* @since 2.0
[344] Fix | Delete
*/
[345] Fix | Delete
public static function get_feed_container_data_attributes( $settings, $feed_id, $twitter_feed_id ) {
[346] Fix | Delete
$customizer = ctf_doing_customizer( $settings );
[347] Fix | Delete
[348] Fix | Delete
$atts = CTF_Display_Elements::print_element_attribute(
[349] Fix | Delete
$customizer,
[350] Fix | Delete
array(
[351] Fix | Delete
'attr' => 'data-ctfdisablelinks',
[352] Fix | Delete
'vue_content' => '$parent.customizerFeedData.settings.disablelinks',
[353] Fix | Delete
'php_content' => self::cast_boolean($settings['disablelinks']) ? 'true' : 'false',
[354] Fix | Delete
)
[355] Fix | Delete
);
[356] Fix | Delete
[357] Fix | Delete
$atts .= CTF_Display_Elements::print_element_attribute(
[358] Fix | Delete
$customizer,
[359] Fix | Delete
array(
[360] Fix | Delete
'attr' => 'data-ctflinktextcolor',
[361] Fix | Delete
'vue_content' => '$parent.customizerFeedData.settings.linktextcolor',
[362] Fix | Delete
'php_content' => $settings['linktextcolor'],
[363] Fix | Delete
)
[364] Fix | Delete
);
[365] Fix | Delete
/*
[366] Fix | Delete
[367] Fix | Delete
$atts .= CTF_Display_Elements::print_element_attribute(
[368] Fix | Delete
$customizer,
[369] Fix | Delete
array(
[370] Fix | Delete
'attr' => 'data-ctfscrolloffset',
[371] Fix | Delete
'vue_content' => '$parent.valueIsEnabled($parent.customizerFeedData.settings.autoscroll) ? $parent.customizerFeedData.settings.autoscrolldistance : false',
[372] Fix | Delete
'php_condition' => CTF_Feed_Builder::check_if_on( $settings['autoscroll'] ),
[373] Fix | Delete
'php_content' => $settings['autoscrolldistance'],
[374] Fix | Delete
)
[375] Fix | Delete
);
[376] Fix | Delete
*/
[377] Fix | Delete
/*
[378] Fix | Delete
*/
[379] Fix | Delete
[380] Fix | Delete
$atts .= CTF_Display_Elements::print_element_attribute(
[381] Fix | Delete
$customizer,
[382] Fix | Delete
array(
[383] Fix | Delete
'attr' => 'data-boxshadow',
[384] Fix | Delete
'vue_content' => ' $parent.customizerFeedData.settings.tweetpoststyle === \'boxed\' && $parent.valueIsEnabled($parent.customizerFeedData.settings.tweetboxshadow) ? \'true\' : \'false\' ',
[385] Fix | Delete
'php_condition' => $settings['tweetpoststyle'] === 'boxed' && CTF_Feed_Builder::check_if_on( $settings['tweetboxshadow'] ),
[386] Fix | Delete
'php_content' => "true",
[387] Fix | Delete
)
[388] Fix | Delete
);
[389] Fix | Delete
$atts .= CTF_Display_Elements::print_element_attribute(
[390] Fix | Delete
$customizer,
[391] Fix | Delete
array(
[392] Fix | Delete
'attr' => 'data-header-size',
[393] Fix | Delete
'vue_content' => '$parent.customizerFeedData.settings.customheadersize',
[394] Fix | Delete
'php_content' => $settings['customheadersize'],
[395] Fix | Delete
)
[396] Fix | Delete
);
[397] Fix | Delete
[398] Fix | Delete
//Global Feed Atts
[399] Fix | Delete
$atts .= ' data-feedid="' . esc_attr($feed_id) . '" data-postid="' . esc_attr(get_the_ID()) . '" ';
[400] Fix | Delete
if ( ! empty( $settings['feed'] ) ) {
[401] Fix | Delete
$atts .= ' data-feed="' . esc_attr($settings['feed']) . '"';
[402] Fix | Delete
}
[403] Fix | Delete
$flags = array();
[404] Fix | Delete
$dbsettings = ctf_get_database_settings();
[405] Fix | Delete
[406] Fix | Delete
if ( CTF_GDPR_Integrations::doing_gdpr( $dbsettings ) ) {
[407] Fix | Delete
$flags[] = 'gdpr';
[408] Fix | Delete
}
[409] Fix | Delete
if ( !is_admin() && CTF_Feed_Locator::should_do_ajax_locating( $twitter_feed_id , get_the_ID() ) ) {
[410] Fix | Delete
$flags[] = 'locator';
[411] Fix | Delete
}
[412] Fix | Delete
if (!empty($flags)) {
[413] Fix | Delete
$atts .= ' data-ctf-flags="' . implode(',', $flags) . '"';
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
return $atts;
[417] Fix | Delete
}
[418] Fix | Delete
[419] Fix | Delete
[420] Fix | Delete
public static function cast_boolean( $value ) {
[421] Fix | Delete
if ( $value === 'true' || $value === true || $value === 'on' ) {
[422] Fix | Delete
return true;
[423] Fix | Delete
}
[424] Fix | Delete
return false;
[425] Fix | Delete
}
[426] Fix | Delete
[427] Fix | Delete
[428] Fix | Delete
/**
[429] Fix | Delete
* Get Post Date TExt Attribure
[430] Fix | Delete
*
[431] Fix | Delete
*
[432] Fix | Delete
* @return string
[433] Fix | Delete
*
[434] Fix | Delete
* @since 2.0
[435] Fix | Delete
*/
[436] Fix | Delete
public static function get_post_date_attr($created_at, $settings ) {
[437] Fix | Delete
$customizer = ctf_doing_customizer( $settings );
[438] Fix | Delete
return CTF_Display_Elements::should_print_element_vue( $customizer, '$parent.printDate(\''.$created_at.'\')' );
[439] Fix | Delete
}
[440] Fix | Delete
/**
[441] Fix | Delete
* Some characters in captions are breaking the customizer.
[442] Fix | Delete
*
[443] Fix | Delete
* @param $caption
[444] Fix | Delete
*
[445] Fix | Delete
* @return mixed
[446] Fix | Delete
*/
[447] Fix | Delete
public static function sanitize_caption( $caption ) {
[448] Fix | Delete
$caption = str_replace( array( "'" ), '`', $caption );
[449] Fix | Delete
$caption = str_replace( '&amp;', '&', $caption );
[450] Fix | Delete
$caption = str_replace( '&lt;', '<', $caption );
[451] Fix | Delete
$caption = str_replace( '&gt;', '>', $caption );
[452] Fix | Delete
$caption = str_replace( '&quot;', '"', $caption );
[453] Fix | Delete
$caption = str_replace( '&#039;', '/', $caption );
[454] Fix | Delete
$caption = str_replace( '&#92;', '\/', $caption );
[455] Fix | Delete
[456] Fix | Delete
$caption = str_replace( array( "\r", "\n" ), '<br>', $caption );
[457] Fix | Delete
$caption = str_replace( '&lt;br /&gt;', '<br>', nl2br( $caption ) );
[458] Fix | Delete
[459] Fix | Delete
return $caption;
[460] Fix | Delete
}
[461] Fix | Delete
/**
[462] Fix | Delete
* Get Post Text Attributes
[463] Fix | Delete
*
[464] Fix | Delete
*
[465] Fix | Delete
* @return string
[466] Fix | Delete
*
[467] Fix | Delete
* @since 2.0
[468] Fix | Delete
*/
[469] Fix | Delete
public static function get_post_text_attr( $post_text, $settings, $post_id ) {
[470] Fix | Delete
$customizer = ctf_doing_customizer( $settings );
[471] Fix | Delete
if( $customizer ){
[472] Fix | Delete
$post_text = self::sanitize_caption( $post_text );
[473] Fix | Delete
return ' v-html="$parent.getPostText(\'' . htmlspecialchars( $post_text ) . '\', ' . $post_id . ')"';
[474] Fix | Delete
}
[475] Fix | Delete
return '';
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
public static function post_text( $post, $feed_options ) {
[479] Fix | Delete
$text = isset($post['text']) ? $post['text'] : (isset($post['full_text']) ? $post['full_text'] : '');
[480] Fix | Delete
$post_text = apply_filters( 'ctf_tweet_text', $text, $feed_options, $post );
[481] Fix | Delete
[482] Fix | Delete
return $post_text;
[483] Fix | Delete
}
[484] Fix | Delete
[485] Fix | Delete
/**
[486] Fix | Delete
* Get Post Text
[487] Fix | Delete
*
[488] Fix | Delete
*
[489] Fix | Delete
* @return string
[490] Fix | Delete
*
[491] Fix | Delete
* @since 2.0
[492] Fix | Delete
*/
[493] Fix | Delete
public static function get_post_text( $feed_options, $post_text, $post_id, $author_screen_name, $post_media_text ) {
[494] Fix | Delete
$customizer = ctf_doing_customizer( $feed_options );
[495] Fix | Delete
$post_text_attr = CTF_Display_Elements::get_post_text_attr( $post_text, $feed_options, $post_id );
[496] Fix | Delete
$text_and_link_attr = CTF_Display_Elements::get_element_attribute( 'text_and_link', $feed_options );
[497] Fix | Delete
$text_no_link_attr = CTF_Display_Elements::get_element_attribute( 'text_no_link', $feed_options );
[498] Fix | Delete
if( !$customizer ){
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function