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/accelera.../componen.../featured...
File: featured-image.php
<?php
[0] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[1] Fix | Delete
exit;
[2] Fix | Delete
}
[3] Fix | Delete
function ampforwp_framework_get_featured_image(){
[4] Fix | Delete
do_action('ampforwp_before_featured_image_hook');
[5] Fix | Delete
global $post, $redux_builder_amp;
[6] Fix | Delete
$post_id = $post->ID;
[7] Fix | Delete
$featured_image = $image_size = "";
[8] Fix | Delete
$amp_html = "";
[9] Fix | Delete
$caption = "";
[10] Fix | Delete
$f_vid = "";
[11] Fix | Delete
$srcet = '';
[12] Fix | Delete
$fox_theme_thumb="true"; // Fox theme amp featured hide/show compatibility
[13] Fix | Delete
if( ampforwp_is_front_page() ){
[14] Fix | Delete
$post_id = ampforwp_get_frontpage_id();
[15] Fix | Delete
}
[16] Fix | Delete
if( true == ampforwp_has_post_thumbnail() ) {
[17] Fix | Delete
// Fox theme amp featured hide/show compatibility
[18] Fix | Delete
if(function_exists('fox_setup'))
[19] Fix | Delete
{
[20] Fix | Delete
$fox_theme_thumb=get_post_meta( $post_id, '_wi_thumbnail', true);
[21] Fix | Delete
}
[22] Fix | Delete
// Featured Video SmartMag theme Compatibility #2559
[23] Fix | Delete
if(class_exists('Bunyad') && Bunyad::posts()->meta('featured_video') ){
[24] Fix | Delete
global $wp_embed;
[25] Fix | Delete
$f_vid = 'f_vid';
[26] Fix | Delete
$videoContent = Bunyad::posts()->meta('featured_video');
[27] Fix | Delete
$featured_video = $wp_embed->autoembed($videoContent);
[28] Fix | Delete
$amp_html = ampforwp_content_sanitizer($featured_video);
[29] Fix | Delete
}
[30] Fix | Delete
// Featured Video Plus Compatibility #2394 #2583
[31] Fix | Delete
elseif(function_exists('has_post_video') && has_post_video($post_id)){
[32] Fix | Delete
$videoContent = get_the_post_video();
[33] Fix | Delete
$amp_html = ampforwp_content_sanitizer($videoContent);
[34] Fix | Delete
}elseif (has_post_thumbnail( $post_id ) ){
[35] Fix | Delete
$thumb_id = get_post_thumbnail_id($post_id);
[36] Fix | Delete
$post_content = $post->post_content;
[37] Fix | Delete
if ( ampforwp_webp_featured_image() && true !== apply_filters('ampforwp_allow_featured_image', false) && ( false !== strpos( $post_content, 'wp-image-' . $thumb_id ) || false !== strpos( $post_content, 'attachment_' . $thumb_id )) || $fox_theme_thumb == "false" ) {
[38] Fix | Delete
return;
[39] Fix | Delete
}
[40] Fix | Delete
$image_size = ampforwp_get_setting('swift-featued-image-size');
[41] Fix | Delete
$image_size = apply_filters( 'ampforwp_featured_image_size', $image_size );
[42] Fix | Delete
$image = wp_get_attachment_image_src( $thumb_id, $image_size );
[43] Fix | Delete
$caption = get_the_post_thumbnail_caption( $post_id );
[44] Fix | Delete
$thumb_alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true);
[45] Fix | Delete
$thumbnail_srcset = wp_get_attachment_image_srcset( $thumb_id, $image_size);
[46] Fix | Delete
if ( $thumbnail_srcset && 'full' == ampforwp_get_setting('swift-featued-image-size') ) {
[47] Fix | Delete
$srcet = $thumbnail_srcset;
[48] Fix | Delete
}
[49] Fix | Delete
if($thumb_alt){
[50] Fix | Delete
$alt = $thumb_alt;
[51] Fix | Delete
}
[52] Fix | Delete
else{
[53] Fix | Delete
$alt = get_the_title( $post_id );
[54] Fix | Delete
}
[55] Fix | Delete
if(class_exists('transposh_plugin')){
[56] Fix | Delete
$alt = strtok($alt, " ");
[57] Fix | Delete
}
[58] Fix | Delete
$alt = convert_chars( stripslashes( $alt ) );
[59] Fix | Delete
if(function_exists('fifu_show_elements')){
[60] Fix | Delete
$fifu_image_url = get_post_meta($post_id, 'fifu_image_url', true);
[61] Fix | Delete
if($fifu_image_url){
[62] Fix | Delete
$size = getimagesize(get_the_post_thumbnail_url());
[63] Fix | Delete
if(isset($size[0])){
[64] Fix | Delete
$image[1] = $size[0];
[65] Fix | Delete
}
[66] Fix | Delete
if(isset($size[1])){
[67] Fix | Delete
$image[2] = $size[1];
[68] Fix | Delete
}
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
if( $image ){
[72] Fix | Delete
if(empty($image[1])){
[73] Fix | Delete
$image[1] = 1000;
[74] Fix | Delete
}
[75] Fix | Delete
if(empty($image[2])){
[76] Fix | Delete
$image[2] = 600;
[77] Fix | Delete
}
[78] Fix | Delete
if ( empty($srcet) ) {
[79] Fix | Delete
$srcet = $image[0];
[80] Fix | Delete
}
[81] Fix | Delete
$amp_html = '<amp-img data-hero src="'.esc_url($image[0]).'" srcset="'.esc_html($srcet).'" width="'.esc_attr($image[1]).'" height="'.esc_attr($image[2]).'" layout="responsive" alt="'.esc_attr($alt).'"></amp-img>';
[82] Fix | Delete
}
[83] Fix | Delete
}
[84] Fix | Delete
elseif ( ampforwp_is_custom_field_featured_image() ) {
[85] Fix | Delete
$amp_img_src = ampforwp_cf_featured_image_src();
[86] Fix | Delete
$amp_img_width = ampforwp_cf_featured_image_src('width');
[87] Fix | Delete
$amp_img_height = ampforwp_cf_featured_image_src('height');
[88] Fix | Delete
if( $amp_img_src ){
[89] Fix | Delete
$amp_html = "<amp-img src='".esc_url($amp_img_src)."' width=".esc_attr($amp_img_width)." height=".esc_attr($amp_img_height)." layout='responsive' ></amp-img>";
[90] Fix | Delete
}
[91] Fix | Delete
}
[92] Fix | Delete
elseif( true == ampforwp_get_setting('ampforwp-featured-image-from-content') && ampforwp_get_featured_image_from_content() ){
[93] Fix | Delete
$amp_html = ampforwp_get_featured_image_from_content();
[94] Fix | Delete
$amp_html = preg_replace('#sizes="(.*)"#', "layout='responsive'", $amp_html);
[95] Fix | Delete
}
[96] Fix | Delete
$amp_html = apply_filters('ampforwp_modify_featured_image',$amp_html);
[97] Fix | Delete
if( $amp_html ){ ?>
[98] Fix | Delete
<figure class="amp-featured-image <?php echo esc_html($f_vid); ?>"> <?php
[99] Fix | Delete
if(function_exists('ampforwp_add_fallback_element')){
[100] Fix | Delete
$amp_html = ampforwp_add_fallback_element($amp_html,'amp-img');
[101] Fix | Delete
}
[102] Fix | Delete
echo $amp_html; // escaped above
[103] Fix | Delete
if ( $caption ) : ?>
[104] Fix | Delete
<p class="wp-caption-text">
[105] Fix | Delete
<?php echo wp_kses_data( $caption ); ?>
[106] Fix | Delete
</p>
[107] Fix | Delete
<?php endif; ?>
[108] Fix | Delete
<?php
[109] Fix | Delete
$caption = get_post_meta($post->ID, '_cc_featured_image_caption', true);
[110] Fix | Delete
if (isset($caption['caption_text']) && !empty($caption['caption_text'])) {
[111] Fix | Delete
echo "<p class='wp-caption-text'>".esc_html($caption['caption_text'])."</p>";
[112] Fix | Delete
}
[113] Fix | Delete
?>
[114] Fix | Delete
[115] Fix | Delete
</figure>
[116] Fix | Delete
<?php do_action('ampforwp_after_featured_image_hook');
[117] Fix | Delete
}
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function