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/clone/wp-conte.../plugins/accelera.../template...
File: features.php
$video_id ='';
[9500] Fix | Delete
$width = 800;
[9501] Fix | Delete
$height = 450;
[9502] Fix | Delete
foreach ($nodes as $key => $node) {
[9503] Fix | Delete
$video_id = $node->getAttribute('data-videoid');
[9504] Fix | Delete
$width =$node->getAttribute('width');
[9505] Fix | Delete
$height =$node->getAttribute('height');
[9506] Fix | Delete
}
[9507] Fix | Delete
[9508] Fix | Delete
$amp_light_box = '<amp-lightbox id="open-video'.esc_attr($video_id).'" layout="nodisplay">
[9509] Fix | Delete
<div class="amp-lightbox-video" on="tap:open-video'.esc_attr($video_id).'.close,btn-play'.esc_attr($video_id).'.show" role="button" tabindex="'.$i.'" aria-label="Close Video">
[9510] Fix | Delete
<div class="amp-video-box">'.$match.'</div>
[9511] Fix | Delete
</div>
[9512] Fix | Delete
</amp-lightbox>
[9513] Fix | Delete
<div class="amp-video-img" id="btn-play'.esc_attr($video_id).'" on="tap:video.show, video.play, btn-play'.esc_attr($video_id).'.hide,open-video'.esc_attr($video_id).'" role="button" tabindex="'.$i.'" aria-label="Play Video">
[9514] Fix | Delete
<amp-img alt="Video" src="http://i3.ytimg.com/vi/'.esc_attr($video_id).'/hqdefault.jpg" width="'.esc_attr($width).'" height="'.esc_attr($height).'" layout="responsive"></amp-img>
[9515] Fix | Delete
<div class="amp-video-play-on-image"></div>
[9516] Fix | Delete
</div>';
[9517] Fix | Delete
$content = str_replace("$match", $amp_light_box, $content);
[9518] Fix | Delete
}
[9519] Fix | Delete
}
[9520] Fix | Delete
}
[9521] Fix | Delete
}
[9522] Fix | Delete
return $content;
[9523] Fix | Delete
}
[9524] Fix | Delete
}
[9525] Fix | Delete
[9526] Fix | Delete
function ampforwp_video_lightbox_css(){
[9527] Fix | Delete
echo '.amp-video-box,.amp-video-img{width:100%;margin:0 auto;text-align:center}
[9528] Fix | Delete
.amp-lightbox-video{background:rgba(0,0,0,.8);width:100%;height:100%;position:absolute;display:flex;align-items:center;justify-content:center}
[9529] Fix | Delete
.amp-video-box{max-width:800px}
[9530] Fix | Delete
.amp-video-img{max-width:600px;position:relative}
[9531] Fix | Delete
.amp-lightbox-video .lb-x { top: 100px; right: 5%; }
[9532] Fix | Delete
.amp-video-play-on-image{cursor:pointer;margin:auto;width:56px;height:56px;-webkit-border-radius:50%;border-radius:50%;background-color:rgba(0,0,0,.2);background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAY1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////80LMUcAAAAIHRSTlMA1d4MSXeg9glf6yEq4hfnnr7Z8qm5U/3Jm1pwFJcmBYTgJ9QAAAIjSURBVGje7VnJdoMwDFSMHVMSQljCklX//5U99NQHGEm22gtz9tPAWNYKsGPHDiou1h3rpvDD4Iumvjp7SWg86yeDM5ipz5KYt53HFfjORn+8KzEI88iizLe4icLlUvtfFZJQ3kXmTzWScTsJPr9FBtovpvn8iExMrJu4jMjGyHh67xIFMOSLOFcoQnUmfr/QPmL1JulfohiGcA/5iBEYt33piFG4br4vjMTGizu1sQRt2FlrjMZNVSBExEBszaoUBOW6JzlMArf6A0XIOzyZoMgkPwDnA5nhsWz/E4wRnBxhVuoTDBMAkGVarma6TQKyTN3iFfttAqJMg1/y1B4JBFSZ+gWCiUZAk+m1QGCIBCSZmoVEhlQCkkxPppP+JiDIZNlxiFmYOXaqnEX2sEwTO9XMq6egTPXsfMMlCMt0mB0v2ARBmYrZYS8gCMjkZ2cHCcG6TMPfE6hLpH7J6m6a+KHN67urdqhQD3bq4Vo94ainTP2kn7RssbqFF7a5buk4dP9T/Ib9KEH5Dg/lBkS/hVJvAiEvU9gPtLFwT0HQh1r9m/IoQX8YEj+t2JwCX+PsT7ojtWH8EIaCJmIo+FQeaxJHs9LBbPkGIt4ilQxjxi8ajj+BgZztra8P8MBcUAi2LCdGXJKsWADgTozeppeuoXJXEPKXfM0FANnDaC7qtlaNbfyq8Uep/rXQYDUvm0M6XKyb6sPPuvdwm5x9wo4dO6j4BoilN6H4pmTiAAAAAElFTkSuQmCC);background-position:center;-webkit-background-size:48px 48px;background-size:48px 48px;position:absolute;top:0;bottom:0;left:0;right:0}';
[9533] Fix | Delete
}
[9534] Fix | Delete
[9535] Fix | Delete
if (class_exists('WPSEO_Options')) {
[9536] Fix | Delete
add_filter('yoast_seo_development_mode','ampforwp_yoast_seo_development');
[9537] Fix | Delete
add_filter('wpseo_debug_json_data','ampforwp_remove_homepage_breadcrumb');
[9538] Fix | Delete
}
[9539] Fix | Delete
[9540] Fix | Delete
function ampforwp_yoast_seo_development($dev){
[9541] Fix | Delete
$url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH),'/' );
[9542] Fix | Delete
if (ampforwp_get_setting('ampforwp-seo-selection') == 'yoast' && ampforwp_get_setting('ampforwp-seo-yoast-schema') && ampforwp_is_home() && function_exists('ampforwp_is_amp_inURL') && ampforwp_is_amp_inURL($url_path)) {
[9543] Fix | Delete
$dev = true;
[9544] Fix | Delete
}
[9545] Fix | Delete
return $dev;
[9546] Fix | Delete
}
[9547] Fix | Delete
function ampforwp_remove_homepage_breadcrumb($data){
[9548] Fix | Delete
$url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH),'/' );
[9549] Fix | Delete
if (ampforwp_get_setting('ampforwp-seo-selection') == 'yoast' && ampforwp_get_setting('ampforwp-seo-yoast-schema') && ampforwp_is_home() && function_exists('ampforwp_is_amp_inURL') && ampforwp_is_amp_inURL($url_path)) {
[9550] Fix | Delete
if (isset($data["@graph"][2]["breadcrumb"])) {
[9551] Fix | Delete
unset($data["@graph"][2]["breadcrumb"]);
[9552] Fix | Delete
}
[9553] Fix | Delete
if(array_key_exists(3, $data["@graph"])) {
[9554] Fix | Delete
if (!empty($data["@graph"][3]["@type"]) && $data["@graph"][3]["@type"] == 'BreadcrumbList') {
[9555] Fix | Delete
unset($data["@graph"][3]);
[9556] Fix | Delete
}
[9557] Fix | Delete
}
[9558] Fix | Delete
}
[9559] Fix | Delete
return $data;
[9560] Fix | Delete
}
[9561] Fix | Delete
//Twitter title #2744
[9562] Fix | Delete
function ampforwp_sanitize_twitter_title($post_title){
[9563] Fix | Delete
$post_title = html_entity_decode( $post_title, ENT_QUOTES, 'UTF-8' );
[9564] Fix | Delete
$post_title = rawurlencode( $post_title );
[9565] Fix | Delete
$post_title = esc_html( $post_title );
[9566] Fix | Delete
return $post_title;
[9567] Fix | Delete
}
[9568] Fix | Delete
if (function_exists('i2_pros_cons_setup')) {
[9569] Fix | Delete
add_action('amp_post_template_css','ampforwp_i2prosandcons');
[9570] Fix | Delete
}
[9571] Fix | Delete
function ampforwp_i2prosandcons(){
[9572] Fix | Delete
$options = get_option( 'i2_pros_and_cons');
[9573] Fix | Delete
$prosHeadingBackground = $options['pros_heading_background'];
[9574] Fix | Delete
$consHeadingBackground = $options['cons_heading_background'];
[9575] Fix | Delete
$prosBackground = $options['pros_background'];
[9576] Fix | Delete
$consBackground = $options['cons_background'];
[9577] Fix | Delete
$headingFontSize = $options['heading_font_size'];
[9578] Fix | Delete
$sectionFontSize = $options['body_font_size'];
[9579] Fix | Delete
$headingColor = $options['heading_color'];
[9580] Fix | Delete
$sectionColor = $options['body_color'];?>
[9581] Fix | Delete
.i2-pros-cons-main-wrapper .i2-pros-cons-wrapper {
[9582] Fix | Delete
display: table;
[9583] Fix | Delete
width: 100%;
[9584] Fix | Delete
}
[9585] Fix | Delete
.i2-pros-cons-main-wrapper .i2-pros-cons-wrapper .i2-pros, .i2-pros-cons-main-wrapper .i2-pros-cons-wrapper .i2-cons {
[9586] Fix | Delete
display: table-cell;
[9587] Fix | Delete
width: 50%;
[9588] Fix | Delete
margin-bottom: 15px;
[9589] Fix | Delete
position: relative;
[9590] Fix | Delete
}
[9591] Fix | Delete
.i2-pros-cons-main-wrapper .i2-pros-cons-wrapper .i2-pros .i2-pros-title, .i2-pros-cons-main-wrapper .i2-pros-cons-wrapper .i2-pros .i2-cons-title, .i2-pros-cons-main-wrapper .i2-pros-cons-wrapper .i2-cons .i2-pros-title, .i2-pros-cons-main-wrapper .i2-pros-cons-wrapper .i2-cons .i2-cons-title {
[9592] Fix | Delete
padding: 5px 15px 5px;
[9593] Fix | Delete
margin: 0px;
[9594] Fix | Delete
display: block;
[9595] Fix | Delete
}
[9596] Fix | Delete
.i2-pros-cons-wrapper .i2-pros-title {
[9597] Fix | Delete
background-color:<?php echo ampforwp_sanitize_color($prosHeadingBackground); ?>;
[9598] Fix | Delete
font-size:<?php echo esc_html($headingFontSize); ?>px;
[9599] Fix | Delete
}
[9600] Fix | Delete
.i2-pros-cons-wrapper .i2-cons-title, .i2-pros-cons-wrapper .i2-pros-title {
[9601] Fix | Delete
color: #ffffff!important;
[9602] Fix | Delete
font-size:<?php echo esc_html($headingFontSize); ?>px;
[9603] Fix | Delete
}
[9604] Fix | Delete
.i2-pros {
[9605] Fix | Delete
background-color: <?php echo ampforwp_sanitize_color($prosBackground); ?>;
[9606] Fix | Delete
}
[9607] Fix | Delete
.i2-cons{
[9608] Fix | Delete
background-color: <?php echo ampforwp_sanitize_color($consBackground); ?>;
[9609] Fix | Delete
}
[9610] Fix | Delete
.i2-pros-cons-wrapper ul li{
[9611] Fix | Delete
font-size:<?php echo esc_html($sectionFontSize); ?>px;
[9612] Fix | Delete
}
[9613] Fix | Delete
.artl-cnt ul li:before {
[9614] Fix | Delete
content: "\e315";
[9615] Fix | Delete
display: inline-block;
[9616] Fix | Delete
width: 0;
[9617] Fix | Delete
background: #333;
[9618] Fix | Delete
position: absolute;
[9619] Fix | Delete
top: 0px;
[9620] Fix | Delete
left: 0px;
[9621] Fix | Delete
font-family: 'icomoon';
[9622] Fix | Delete
}
[9623] Fix | Delete
.i2-pros-cons-wrapper .i2-cons-title {
[9624] Fix | Delete
background-color: <?php echo ampforwp_sanitize_color($consHeadingBackground); ?>;
[9625] Fix | Delete
}
[9626] Fix | Delete
.i2-pros-cons-wrapper .i2-pros, .i2-pros-cons-wrapper .i2-cons{
[9627] Fix | Delete
color: <?php echo ampforwp_sanitize_color($sectionColor); ?>;
[9628] Fix | Delete
}
[9629] Fix | Delete
.i2-pros-cons-wrapper .i2-cons-title, .i2-pros-cons-wrapper .i2-pros-title {
[9630] Fix | Delete
color: <?php echo ampforwp_sanitize_color($headingColor); ?>;
[9631] Fix | Delete
}
[9632] Fix | Delete
<?php }
[9633] Fix | Delete
function ampforwp_modify_url_utm_params($url){
[9634] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-related-post-utm-tracking-switch') && !empty(ampforwp_get_setting('ampforwp-related-posts-utm-tracking'))){
[9635] Fix | Delete
$modify_url = ampforwp_get_setting('ampforwp-related-posts-utm-tracking');
[9636] Fix | Delete
$modify_url = apply_filters('ampforwp_modify_related_post_url', $modify_url);
[9637] Fix | Delete
$url = add_query_arg($modify_url, '' , $url);
[9638] Fix | Delete
return esc_url_raw($url);
[9639] Fix | Delete
}
[9640] Fix | Delete
return esc_url_raw($url);
[9641] Fix | Delete
}
[9642] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-recent-post-utm-tracking-switch') && !empty(ampforwp_get_setting('ampforwp-recent-posts-utm-tracking'))){
[9643] Fix | Delete
add_filter('ampforwp_loop_permalink_update','ampforwp_recent_posts_utm_tracking');
[9644] Fix | Delete
}
[9645] Fix | Delete
function ampforwp_recent_posts_utm_tracking($recent_post_permalink){
[9646] Fix | Delete
if(is_single()){
[9647] Fix | Delete
$modify_url = ampforwp_get_setting('ampforwp-recent-posts-utm-tracking');
[9648] Fix | Delete
$modify_url = apply_filters('ampforwp_modify_recent_post_url', $modify_url);
[9649] Fix | Delete
$recent_post_permalink = add_query_arg($modify_url, '' , $recent_post_permalink);
[9650] Fix | Delete
return esc_url_raw($recent_post_permalink);
[9651] Fix | Delete
}
[9652] Fix | Delete
return esc_url_raw($recent_post_permalink);
[9653] Fix | Delete
}
[9654] Fix | Delete
if(ampforwp_get_setting('ampforwp-facebook-comments-support')){
[9655] Fix | Delete
add_action('amp_post_template_head','ampforwp_facebook_moderation_tool');
[9656] Fix | Delete
}
[9657] Fix | Delete
function ampforwp_facebook_moderation_tool(){
[9658] Fix | Delete
$facebook_app_id = ampforwp_get_setting('ampforwp-fb-moderation-app-id');
[9659] Fix | Delete
if($facebook_app_id!=''){
[9660] Fix | Delete
?>
[9661] Fix | Delete
<meta property="fb:app_id" content="<?php echo esc_attr($facebook_app_id);?>" />
[9662] Fix | Delete
<?php
[9663] Fix | Delete
}
[9664] Fix | Delete
$facebook_admin_id = ampforwp_get_setting('ampforwp-fb-moderation-admin-id');
[9665] Fix | Delete
if($facebook_admin_id!=''){
[9666] Fix | Delete
$ids = explode(",", $facebook_admin_id);
[9667] Fix | Delete
for($i=0;$i<count($ids);$i++){
[9668] Fix | Delete
$id = $ids[$i];
[9669] Fix | Delete
if($id!=''){
[9670] Fix | Delete
?>
[9671] Fix | Delete
<meta property="fb:admins" content="<?php echo esc_attr($id);?>"/>
[9672] Fix | Delete
<?php
[9673] Fix | Delete
}
[9674] Fix | Delete
}
[9675] Fix | Delete
}
[9676] Fix | Delete
}
[9677] Fix | Delete
[9678] Fix | Delete
//Schema Pro FAQ block compatibility #4956
[9679] Fix | Delete
add_filter('ampforwp_modify_the_content','ampforwp_schema_pro_faq_block');
[9680] Fix | Delete
function ampforwp_schema_pro_faq_block($content_buffer){
[9681] Fix | Delete
if (!function_exists('on_bsf_aiosrs_pro_activate')) {
[9682] Fix | Delete
return $content_buffer;
[9683] Fix | Delete
}
[9684] Fix | Delete
preg_match_all('/<div class="wp-block-wpsp-faq(.*?)class="wpsp-question">(.*?)<\/(.*?)>(.*?)class="wpsp-faq-content"><span><p>(.*?)<\/p>/', $content_buffer, $matches);
[9685] Fix | Delete
if(is_array($matches)){
[9686] Fix | Delete
$schema = array();
[9687] Fix | Delete
$schema['@context'] = 'https://schema.org';
[9688] Fix | Delete
$schema['type'] = 'FAQPage';
[9689] Fix | Delete
for($i=0;$i<count($matches[2]);$i++){
[9690] Fix | Delete
$questions = $matches[2];
[9691] Fix | Delete
$answers = $matches[5];
[9692] Fix | Delete
foreach ( $questions as $key => $question ) {
[9693] Fix | Delete
$schema['mainEntity'][ $key ]['@type'] = 'Question';
[9694] Fix | Delete
$schema['mainEntity'][ $key ]['name'] = $question;
[9695] Fix | Delete
}
[9696] Fix | Delete
foreach ( $answers as $key => $answer ) {
[9697] Fix | Delete
$schema['mainEntity'][ $key ]['acceptedAnswer']['@type'] = 'Answer';
[9698] Fix | Delete
$schema['mainEntity'][ $key ]['acceptedAnswer']['text'] = $answer;
[9699] Fix | Delete
}
[9700] Fix | Delete
}
[9701] Fix | Delete
$schema = '<script type="application/ld+json">'.wp_json_encode( $schema, JSON_UNESCAPED_UNICODE ).'</script>';
[9702] Fix | Delete
$content_buffer = preg_replace('/(<div class="wp-block-wpsp-faq\s(.*?)<\/div>)/s', ''.$schema.'$1', $content_buffer);
[9703] Fix | Delete
}
[9704] Fix | Delete
return $content_buffer;
[9705] Fix | Delete
}
[9706] Fix | Delete
[9707] Fix | Delete
function ampforwp_get_gitty_image_embed( $html, $url, $attr, $post_ID ) {
[9708] Fix | Delete
global $getty_img_content;
[9709] Fix | Delete
$getty_img_content[] = $html;
[9710] Fix | Delete
return $html;
[9711] Fix | Delete
}
[9712] Fix | Delete
[9713] Fix | Delete
function ampforwp_getty_image_compatibility($content){
[9714] Fix | Delete
global $getty_img_content;
[9715] Fix | Delete
if(is_array($getty_img_content)){
[9716] Fix | Delete
if(preg_match_all('/<a id="(.*?)"\sclass="gie-single(.*?)">Embed from Getty Images<\/a>/', $content, $matches)){
[9717] Fix | Delete
if(isset($matches[0])){
[9718] Fix | Delete
for($i=0;$i<count($matches[0]);$i++){
[9719] Fix | Delete
$full_content = $matches[0][$i];
[9720] Fix | Delete
$img_id = $matches[1][$i];
[9721] Fix | Delete
if(isset($getty_img_content[$i])){
[9722] Fix | Delete
if(preg_match('/gie\.widgets\.load\({id:\'(.*?)\',sig:\'(.*?)\',w:\'(.*?)\',h:\'(.*?)\',items:\'(.*?)\'/',$getty_img_content[$i],$match)){
[9723] Fix | Delete
if(isset($match[1]) && isset($match[2]) && isset($match[3]) && isset($match[4]) && isset($match[5])){
[9724] Fix | Delete
$image_id = $match[1];
[9725] Fix | Delete
$image_key = $match[2];
[9726] Fix | Delete
$width = $match[3];
[9727] Fix | Delete
$height = $match[4];
[9728] Fix | Delete
$img_emb_id = $match[5];
[9729] Fix | Delete
$iframe = '<iframe src="//embed.gettyimages.com/embed/'.esc_attr($img_emb_id).'?et='.esc_attr($image_id).'&amp;tld=com&sig='.esc_attr($image_key).'&caption=false&ver=2" scrolling="no" frameborder="0" width="'.esc_attr($width).'" height="'.esc_attr($height).'"></iframe>';
[9730] Fix | Delete
$description = get_the_archive_description();
[9731] Fix | Delete
$sanitizer = new AMPFORWP_Content( $iframe, array(),
[9732] Fix | Delete
apply_filters( 'ampforwp_content_sanitizers',
[9733] Fix | Delete
array(
[9734] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[9735] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[9736] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[9737] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[9738] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[9739] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[9740] Fix | Delete
'add_placeholder' => true,
[9741] Fix | Delete
)
[9742] Fix | Delete
) ) );
[9743] Fix | Delete
$iframe_content = $sanitizer->get_amp_content();
[9744] Fix | Delete
$content = str_replace($full_content, $iframe_content, $content );
[9745] Fix | Delete
}
[9746] Fix | Delete
}
[9747] Fix | Delete
}
[9748] Fix | Delete
}
[9749] Fix | Delete
}
[9750] Fix | Delete
}
[9751] Fix | Delete
}
[9752] Fix | Delete
return $content;
[9753] Fix | Delete
}
[9754] Fix | Delete
[9755] Fix | Delete
if(function_exists('vp_pfui_admin_init') && function_exists('penci_setup')){
[9756] Fix | Delete
add_action('ampforwp_before_post_content','ampforwp_pennews_audio_embed');
[9757] Fix | Delete
}
[9758] Fix | Delete
function ampforwp_pennews_audio_embed(){
[9759] Fix | Delete
$audio = get_post_meta(ampforwp_get_the_ID(), '_format_audio_embed', true);
[9760] Fix | Delete
if(empty($audio)){
[9761] Fix | Delete
return;
[9762] Fix | Delete
}
[9763] Fix | Delete
$audio = preg_replace('/<iframe(.*?)width="(.*?)%"(.*?)<\/iframe>/', '<iframe$1width="1000"$3</iframe>', $audio);
[9764] Fix | Delete
$audio_str = substr( $audio, -4 );
[9765] Fix | Delete
$html ='<div class="audio-iframe">';
[9766] Fix | Delete
if ( wp_oembed_get( $audio ) ) {
[9767] Fix | Delete
$html .= wp_oembed_get( $audio );
[9768] Fix | Delete
}elseif( $audio_str == '.mp3' ) {
[9769] Fix | Delete
$html .= do_shortcode('[audio src="'. esc_url( $audio ) .'"]');
[9770] Fix | Delete
}else{
[9771] Fix | Delete
$html .= do_shortcode( $audio );
[9772] Fix | Delete
}
[9773] Fix | Delete
$html .= '</div>';
[9774] Fix | Delete
$sanitizer = new AMPFORWP_Content( $html, array(),
[9775] Fix | Delete
apply_filters( 'ampforwp_content_sanitizers',
[9776] Fix | Delete
array(
[9777] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[9778] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[9779] Fix | Delete
'add_placeholder' => true,
[9780] Fix | Delete
)
[9781] Fix | Delete
) ) );
[9782] Fix | Delete
$sanitized_html = $sanitizer->get_amp_content();
[9783] Fix | Delete
echo $sanitized_html;
[9784] Fix | Delete
}
[9785] Fix | Delete
[9786] Fix | Delete
if(function_exists('penci_soledad_theme_setup')){
[9787] Fix | Delete
add_action('ampforwp_before_post_content','ampforwp_penci_format_video_embed');
[9788] Fix | Delete
add_filter('ampforwp_modify_featured_image','ampforwp_penci_remove_featured_image');
[9789] Fix | Delete
}
[9790] Fix | Delete
[9791] Fix | Delete
//Show Video
[9792] Fix | Delete
function ampforwp_penci_format_video_embed($content){
[9793] Fix | Delete
$penci_video = get_post_meta( get_the_ID(), '_format_video_embed', true );
[9794] Fix | Delete
if(!empty($penci_video) && $penci_video != ''){
[9795] Fix | Delete
$video_id = '';
[9796] Fix | Delete
$penci_video = 'https://www.youtube.com/watch?v=pMFEDv9Chlw';
[9797] Fix | Delete
$video_html = '<div class="amp fluid-width-video-wrapper">';
[9798] Fix | Delete
if(strpos($penci_video, 'youtu') !== false){
[9799] Fix | Delete
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $penci_video, $match)){
[9800] Fix | Delete
$video_id = $match[1];
[9801] Fix | Delete
$video_html .= '<amp-youtube width="480" height="270" layout="responsive" data-videoid="'.$video_id.'" loop autoplay></amp-youtube>';
[9802] Fix | Delete
}
[9803] Fix | Delete
}elseif(strpos($penci_video, 'vimeo')){
[9804] Fix | Delete
if (preg_match('%^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)(?:[?]?.*)$%im', $penci_video, $regs)){
[9805] Fix | Delete
$video_id = $regs[3];
[9806] Fix | Delete
$video_html .= '<amp-vimeo data-videoid="'.$video_id.'" layout="responsive" width="16" height="9" loop autoplay></amp-vimeo>';
[9807] Fix | Delete
}
[9808] Fix | Delete
}else{
[9809] Fix | Delete
$video_html .= '<amp-video width="480" height="270" src="'.$penci_video.'" layout="responsive" loop autoplay>
[9810] Fix | Delete
<div fallback>
[9811] Fix | Delete
<p>Your browser doesn\'t support HTML5 video.</p>
[9812] Fix | Delete
</div>
[9813] Fix | Delete
<source type="video/mp4" src="'.$penci_video.'>
[9814] Fix | Delete
</amp-video>';
[9815] Fix | Delete
}
[9816] Fix | Delete
$video_html .= '</div>';
[9817] Fix | Delete
echo $video_html;
[9818] Fix | Delete
}
[9819] Fix | Delete
}
[9820] Fix | Delete
[9821] Fix | Delete
//Remove Image if video is present.
[9822] Fix | Delete
function ampforwp_penci_remove_featured_image($amp_html){
[9823] Fix | Delete
$penci_video = get_post_meta( get_the_ID(), '_format_video_embed', true );
[9824] Fix | Delete
if(!empty($penci_video) && $penci_video != ''){
[9825] Fix | Delete
$amp_html = false;
[9826] Fix | Delete
}
[9827] Fix | Delete
return $amp_html;
[9828] Fix | Delete
}
[9829] Fix | Delete
[9830] Fix | Delete
//Alignment issue with Gutenberg image block #4997
[9831] Fix | Delete
add_filter('ampforwp_modify_the_content','ampforwp_wp_block_cover_image');
[9832] Fix | Delete
function ampforwp_wp_block_cover_image($content_buffer){
[9833] Fix | Delete
if(ampforwp_get_setting('ampforwp_css_tree_shaking') && ampforwp_is_gutenberg_active()){
[9834] Fix | Delete
preg_match_all('/<amp-img(.*?)class="wp-block-cover__image-background(.*?)"(.*?)src="(.*?)"(.*?)<\/amp-img>/', $content_buffer, $matches);
[9835] Fix | Delete
if(is_array($matches) && isset($matches[4][0])){
[9836] Fix | Delete
$img_url = $matches[4][0];
[9837] Fix | Delete
if (!empty($img_url)) {
[9838] Fix | Delete
$content_buffer = preg_replace('/<div(.*?)class="wp-block-cover(.*?)"><amp-img(.*?)<\/amp-img>/', '<div$1style="background-image:url('.$img_url.');" class="wp-block-cover$2"><amp-img$3</amp-img>', $content_buffer);
[9839] Fix | Delete
$content_buffer = preg_replace('/<amp-img(.*?)class="wp-block-cover__image-background(.*?)"(.*?)src="(.*?)"(.*?)<\/amp-img>/', '', $content_buffer);
[9840] Fix | Delete
return $content_buffer;
[9841] Fix | Delete
}
[9842] Fix | Delete
}
[9843] Fix | Delete
}
[9844] Fix | Delete
return $content_buffer;
[9845] Fix | Delete
}
[9846] Fix | Delete
function ampforwp_mobile_redirection_js() {
[9847] Fix | Delete
$url_to_redirect = ampforwp_amphtml_generator();?>
[9848] Fix | Delete
<script>
[9849] Fix | Delete
if(screen.width<769){
[9850] Fix | Delete
window.location = "<?php echo esc_url($url_to_redirect); ?>";
[9851] Fix | Delete
}
[9852] Fix | Delete
</script>
[9853] Fix | Delete
<?php }
[9854] Fix | Delete
function ampforwp_webp_express_compatibility($content){
[9855] Fix | Delete
if(function_exists('webp_express_process_post')){
[9856] Fix | Delete
preg_match_all('/src="(.*?)"/', $content,$src);
[9857] Fix | Delete
if(isset($src[1][0])){
[9858] Fix | Delete
$img_url = esc_url($src[1][0]);
[9859] Fix | Delete
if(preg_match('/m\.media-amazon/', $img_url)){
[9860] Fix | Delete
return $content;
[9861] Fix | Delete
}
[9862] Fix | Delete
if(!preg_match('/\.webp/', $img_url)){
[9863] Fix | Delete
$config = \WebPExpress\Config::loadConfigAndFix();
[9864] Fix | Delete
if($config['destination-folder'] == 'mingled'){
[9865] Fix | Delete
$img_url_webp = $img_url;
[9866] Fix | Delete
}else{
[9867] Fix | Delete
$img_url_webp = preg_replace('/http(.*?)\/wp-content(.*?)/', 'http$1/wp-content/webp-express/webp-images$2', $img_url);
[9868] Fix | Delete
if($config['destination-structure'] == 'doc-root'){
[9869] Fix | Delete
$img_url_webp = preg_replace('/http(.*?)\/wp-content(.*?)/', 'http$1/wp-content/webp-express/webp-images/doc-root/wp-content$2', $img_url);
[9870] Fix | Delete
}
[9871] Fix | Delete
}
[9872] Fix | Delete
if(!preg_match('/\.webp/', $img_url)){
[9873] Fix | Delete
$img_url_webp = esc_url($img_url_webp).".webp";
[9874] Fix | Delete
$content = str_replace($img_url, $img_url_webp, $content);
[9875] Fix | Delete
}
[9876] Fix | Delete
}
[9877] Fix | Delete
}
[9878] Fix | Delete
}
[9879] Fix | Delete
return $content;
[9880] Fix | Delete
}
[9881] Fix | Delete
add_action('amp_post_template_css','ampforwp_set_local_font',33);
[9882] Fix | Delete
if(!function_exists('ampforwp_set_local_font')){
[9883] Fix | Delete
function ampforwp_set_local_font(){
[9884] Fix | Delete
if(ampforwp_get_setting('ampforwp-local-font-switch') && ampforwp_get_setting('ampforwp-local-font-upload','url')!=""){
[9885] Fix | Delete
$upload_dir = wp_upload_dir();
[9886] Fix | Delete
$user_dirname = $upload_dir['basedir'] . '/' . 'ampforwp-local-fonts';
[9887] Fix | Delete
if ( file_exists( $user_dirname ) ) {
[9888] Fix | Delete
$font_name = '';
[9889] Fix | Delete
$files = glob( $user_dirname . '/*' );
[9890] Fix | Delete
$font_css = '@font-face {';
[9891] Fix | Delete
$i = 0;
[9892] Fix | Delete
foreach ( $files as $file ) {
[9893] Fix | Delete
$fonts = explode("/", $file);
[9894] Fix | Delete
$font_name = end($fonts);
[9895] Fix | Delete
$ext = end(explode(".", $font_name));
[9896] Fix | Delete
if($ext!='zip'){
[9897] Fix | Delete
$font_arr = explode('-', $font_name);
[9898] Fix | Delete
$font_family = $font_arr[0];
[9899] Fix | Delete
if($i==0){
[9900] Fix | Delete
$font_css .= "font-family: '".esc_attr(ucfirst($font_family))."'; font-style: normal; font-weight: 400;";
[9901] Fix | Delete
}
[9902] Fix | Delete
$font_path = $upload_dir['baseurl'].'/'.'ampforwp-local-fonts/'.$font_name;
[9903] Fix | Delete
if($ext=='eot'){
[9904] Fix | Delete
$font_css .= "src: url('".esc_url($font_path)."'); src: url('".esc_url($font_path)."?#iefix') format('embedded-opentype'),";
[9905] Fix | Delete
}else if($ext=='svg'){
[9906] Fix | Delete
$font_css .= "src: url('".esc_url($font_path)."?#".esc_attr(ucfirst($font_family))."') format('svg'),";
[9907] Fix | Delete
}else if($ext=='ttf'){
[9908] Fix | Delete
$font_css .= "src: url('".esc_url($font_path)."') format('truetype'),";
[9909] Fix | Delete
}else{
[9910] Fix | Delete
$font_css .= "src: url('".esc_url($font_path)."') format('".esc_attr($ext)."'),";
[9911] Fix | Delete
}
[9912] Fix | Delete
$i++;
[9913] Fix | Delete
}
[9914] Fix | Delete
}
[9915] Fix | Delete
$font_css .= '}';
[9916] Fix | Delete
if(!empty($font_family) && $font_family != ''){
[9917] Fix | Delete
$font_css .= "body, .cntn-wrp {font-family: '".esc_attr(ucfirst($font_family))."'}";
[9918] Fix | Delete
}
[9919] Fix | Delete
echo $font_css;
[9920] Fix | Delete
}
[9921] Fix | Delete
}
[9922] Fix | Delete
}
[9923] Fix | Delete
}
[9924] Fix | Delete
[9925] Fix | Delete
function ampforwp_year_shortcode() {
[9926] Fix | Delete
$year = date('Y');
[9927] Fix | Delete
return $year;
[9928] Fix | Delete
}
[9929] Fix | Delete
add_shortcode('ampforwp_current_year', 'ampforwp_year_shortcode');
[9930] Fix | Delete
[9931] Fix | Delete
function ampforwp_litespeed_webp_compatibility($content){
[9932] Fix | Delete
if(class_exists( 'WP_Offload_Media_Autoloader')){
[9933] Fix | Delete
return $content;
[9934] Fix | Delete
}
[9935] Fix | Delete
if(function_exists( 'run_litespeed_cache' )){
[9936] Fix | Delete
preg_match_all('/src="(.*?)"/', $content,$src);
[9937] Fix | Delete
if(isset($src[1][0])){
[9938] Fix | Delete
$img_url = esc_url($src[1][0]);
[9939] Fix | Delete
if(!preg_match('/\.webp/', $img_url)){
[9940] Fix | Delete
$rep_url = esc_url($src[1][0]).".webp";
[9941] Fix | Delete
if(preg_match('/http(.*)\/wp-content\/uploads/', $rep_url)){
[9942] Fix | Delete
$upload_dir = wp_upload_dir()['basedir'];
[9943] Fix | Delete
$img_file = preg_replace('/http(.*)\/wp-content\/uploads/', $upload_dir, $rep_url);
[9944] Fix | Delete
if(file_exists($img_file)){
[9945] Fix | Delete
$content = str_replace($img_url, $rep_url, $content);
[9946] Fix | Delete
}
[9947] Fix | Delete
}
[9948] Fix | Delete
}
[9949] Fix | Delete
}
[9950] Fix | Delete
}
[9951] Fix | Delete
$content = str_replace('.webp.webp','.webp',$content);
[9952] Fix | Delete
return $content;
[9953] Fix | Delete
}
[9954] Fix | Delete
[9955] Fix | Delete
if (ampforwp_get_setting('amp-core-end-point') && function_exists('get_rocket_cache_query_string') ) {
[9956] Fix | Delete
add_filter('rocket_cache_query_strings', 'ampforwp_rocket_cache_query_string');
[9957] Fix | Delete
}
[9958] Fix | Delete
[9959] Fix | Delete
function ampforwp_rocket_cache_query_string($query_strings){
[9960] Fix | Delete
array_push($query_strings,"amp");
[9961] Fix | Delete
return $query_strings;
[9962] Fix | Delete
}
[9963] Fix | Delete
[9964] Fix | Delete
[9965] Fix | Delete
function ampforwp_publisher_desk_ads_insert( $ads, $content ) {
[9966] Fix | Delete
if ( ! is_array( $ads ) ) {
[9967] Fix | Delete
return $content;
[9968] Fix | Delete
}
[9969] Fix | Delete
[9970] Fix | Delete
$closing_p = '</p>';
[9971] Fix | Delete
$paragraphs = explode( $closing_p, $content );
[9972] Fix | Delete
[9973] Fix | Delete
foreach ($paragraphs as $index => $paragraph) {
[9974] Fix | Delete
if ( trim( $paragraph ) ) {
[9975] Fix | Delete
$paragraphs[$index] .= $closing_p;
[9976] Fix | Delete
}
[9977] Fix | Delete
[9978] Fix | Delete
$n = $index + 1;
[9979] Fix | Delete
if ( isset( $ads[ $n ] ) ) {
[9980] Fix | Delete
$paragraphs[$index] .= $ads[ $n ];
[9981] Fix | Delete
}
[9982] Fix | Delete
}
[9983] Fix | Delete
[9984] Fix | Delete
return implode( '', $paragraphs );
[9985] Fix | Delete
}
[9986] Fix | Delete
[9987] Fix | Delete
add_filter( 'ampforwp_modify_the_content', 'ampforwp_publisher_desk_ads' );
[9988] Fix | Delete
function ampforwp_publisher_desk_ads( $content ) {
[9989] Fix | Delete
if (!ampforwp_get_setting('ampforwp-ads-publisherdesk')) {
[9990] Fix | Delete
return $content;
[9991] Fix | Delete
}
[9992] Fix | Delete
$pub_id = $url = '';
[9993] Fix | Delete
$pub_id = ampforwp_get_setting('ampforwp-publisherdesk-id');
[9994] Fix | Delete
if (!empty($pub_id)) {
[9995] Fix | Delete
$url = 'https://cdn.tpdads.com/json/amp-tags/'.esc_html($pub_id).'.json';
[9996] Fix | Delete
}
[9997] Fix | Delete
[9998] Fix | Delete
$data_api = wp_remote_get($url);
[9999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function