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
$nofollow = $page = $amp_url = $non_amp_url = '';
[4000] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-nofollow-view-nonamp') ){
[4001] Fix | Delete
$nofollow = 'rel=nofollow';
[4002] Fix | Delete
}
[4003] Fix | Delete
$amp_url = ampforwp_amphtml_generator();
[4004] Fix | Delete
$amp_url = explode('/', $amp_url);
[4005] Fix | Delete
$amp_url = array_flip($amp_url);
[4006] Fix | Delete
$endpoint = AMPFORWP_AMP_QUERY_VAR;
[4007] Fix | Delete
if (ampforwp_get_setting('amp-core-end-point')) {
[4008] Fix | Delete
$endpoint = '?'. $endpoint;
[4009] Fix | Delete
}
[4010] Fix | Delete
unset($amp_url[$endpoint]);
[4011] Fix | Delete
$non_amp_url = array_flip($amp_url);
[4012] Fix | Delete
$non_amp_url = implode('/', $non_amp_url);
[4013] Fix | Delete
$query_arg_array = $wp->query_vars;
[4014] Fix | Delete
[4015] Fix | Delete
if( array_key_exists( "page" , $query_arg_array ) ) {
[4016] Fix | Delete
$page = $wp->query_vars['page'];
[4017] Fix | Delete
}
[4018] Fix | Delete
if ( $page >= '2') {
[4019] Fix | Delete
$non_amp_url = trailingslashit( $non_amp_url . '?page=' . $page);
[4020] Fix | Delete
}
[4021] Fix | Delete
[4022] Fix | Delete
if ( ampforwp_get_setting('amp-mobile-redirection')==true && ampforwp_get_setting('amp-mob-redirection-pres-link')==false) {
[4023] Fix | Delete
$non_amp_url = user_trailingslashit($non_amp_url);
[4024] Fix | Delete
$non_amp_url = add_query_arg('nonamp','1',$non_amp_url);
[4025] Fix | Delete
}
[4026] Fix | Delete
else
[4027] Fix | Delete
$mob_pres_link = false;
[4028] Fix | Delete
if(function_exists('ampforwp_mobile_redirect_preseve_link')){
[4029] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[4030] Fix | Delete
}
[4031] Fix | Delete
$non_amp_url = user_trailingslashit($non_amp_url);
[4032] Fix | Delete
if ( true == ampforwp_get_setting('ampforwp-amp-takeover') || $mob_pres_link == true) {
[4033] Fix | Delete
$non_amp_url = '';
[4034] Fix | Delete
}
[4035] Fix | Delete
$permalink = get_option('permalink_structure');
[4036] Fix | Delete
if(strpos($permalink, '/%year%/%monthnum%/%day%/%postname%/') !== false){
[4037] Fix | Delete
$non_amp_url = get_permalink(ampforwp_get_the_ID());
[4038] Fix | Delete
}
[4039] Fix | Delete
if ( $non_amp_url ) { ?><a class="view-non-amp" href="<?php echo esc_url(apply_filters('ampforwp_view_nonamp_url', $non_amp_url) ) ?>" <?php echo esc_attr($nofollow); ?> title="<?php echo ampforwp_get_setting('amp-translator-non-amp-page-text') ?>"><?php if(function_exists('pll__')){echo pll__(esc_html__( ampforwp_get_setting('amp-translator-non-amp-page-text'), 'accelerated-mobile-pages'));}else{echo esc_html__( ampforwp_get_setting('amp-translator-non-amp-page-text'), 'accelerated-mobile-pages');}?></a> <?php }
[4040] Fix | Delete
}
[4041] Fix | Delete
[4042] Fix | Delete
//68. Facebook Instant Articles
[4043] Fix | Delete
add_action('init', 'ampforwp_fb_instant_article_feed_generator');
[4044] Fix | Delete
[4045] Fix | Delete
function ampforwp_fb_instant_article_feed_generator() {
[4046] Fix | Delete
if( ampforwp_get_setting('fb-instant-article-switch') ) {
[4047] Fix | Delete
add_feed('instant_articles', 'ampforwp_fb_instant_article_feed_function');
[4048] Fix | Delete
add_action( 'ampforwp_fbia_head', 'ampforwp_fbia_meta_tags' );
[4049] Fix | Delete
require AMPFORWP_PLUGIN_DIR . '/templates/instant-articles/instant-article-sanitizer.php';
[4050] Fix | Delete
}
[4051] Fix | Delete
}
[4052] Fix | Delete
[4053] Fix | Delete
function ampforwp_fb_instant_article_feed_function() {
[4054] Fix | Delete
add_filter('pre_option_rss_use_excerpt', '__return_zero');
[4055] Fix | Delete
load_template( AMPFORWP_PLUGIN_DIR . '/feeds/instant-article-feed.php' );
[4056] Fix | Delete
}
[4057] Fix | Delete
[4058] Fix | Delete
if ( ! function_exists('ampforwp_fbia_meta_tags') ) {
[4059] Fix | Delete
function ampforwp_fbia_meta_tags(){
[4060] Fix | Delete
global $redux_builder_amp;
[4061] Fix | Delete
// undefined index fb-instant-page-id #2610
[4062] Fix | Delete
$fb_page_id = '';
[4063] Fix | Delete
$fb_page_id = ampforwp_get_setting('fb-instant-page-id');
[4064] Fix | Delete
// Page ID meta Tag
[4065] Fix | Delete
if( $fb_page_id ) { ?>
[4066] Fix | Delete
<meta property="fb:pages" content="<?php echo esc_attr( $fb_page_id ); ?>" />
[4067] Fix | Delete
<?php }
[4068] Fix | Delete
// undefined index fb-instant-page-id ends here #2610
[4069] Fix | Delete
$post = get_post();
[4070] Fix | Delete
// If there's no current post, return
[4071] Fix | Delete
if ( ! $post ) {
[4072] Fix | Delete
return;
[4073] Fix | Delete
}
[4074] Fix | Delete
$url = get_permalink();
[4075] Fix | Delete
$url = add_query_arg( 'ia_markup', '1', $url );
[4076] Fix | Delete
// ia markup meta tag
[4077] Fix | Delete
if( ampforwp_get_setting('fb-instant-crawler-ingestion') ) { ?>
[4078] Fix | Delete
<meta property="ia:markup_url" content="<?php echo esc_url( $url ); ?>" />
[4079] Fix | Delete
<?php }
[4080] Fix | Delete
}
[4081] Fix | Delete
}
[4082] Fix | Delete
[4083] Fix | Delete
// 69. Post Pagination #834 #857
[4084] Fix | Delete
function ampforwp_post_pagination( $args = '' ) {
[4085] Fix | Delete
[4086] Fix | Delete
wp_reset_postdata();
[4087] Fix | Delete
global $page, $numpages, $multipage, $more, $redux_builder_amp;
[4088] Fix | Delete
if ( ampforwp_is_front_page() ) {
[4089] Fix | Delete
$id = ampforwp_get_frontpage_id();
[4090] Fix | Delete
$content_post = get_post($id);
[4091] Fix | Delete
$content = $content_post->post_content;
[4092] Fix | Delete
$checker = preg_match('/<!--nextpage-->/', $content);
[4093] Fix | Delete
if ( 1 === $checker ) {
[4094] Fix | Delete
$multipage = $more = 1;
[4095] Fix | Delete
$ampforwp_new_content = explode('<!--nextpage-->', $content);
[4096] Fix | Delete
$queried_var = get_query_var('paged');
[4097] Fix | Delete
if ( $queried_var > 1 ) {
[4098] Fix | Delete
$page = $queried_var;
[4099] Fix | Delete
}
[4100] Fix | Delete
$numpages = count($ampforwp_new_content);
[4101] Fix | Delete
}
[4102] Fix | Delete
}else{
[4103] Fix | Delete
$amp_current_post_id =ampforwp_get_the_ID();
[4104] Fix | Delete
$amp_custom_content_enable = get_post_meta( $amp_current_post_id , 'ampforwp_custom_content_editor_checkbox', true);
[4105] Fix | Delete
if($amp_custom_content_enable=='yes'){
[4106] Fix | Delete
$content = get_post_meta ( $amp_current_post_id, 'ampforwp_custom_content_editor', true );
[4107] Fix | Delete
$content = html_entity_decode($content);
[4108] Fix | Delete
$checker = preg_match('/<!--nextpage-->/', $content);
[4109] Fix | Delete
if ( 1 === $checker ) {
[4110] Fix | Delete
$multipage = $more = 1;
[4111] Fix | Delete
$ampforwp_new_content = explode('<!--nextpage-->', $content);
[4112] Fix | Delete
$queried_var = get_query_var('paged');
[4113] Fix | Delete
if ( $queried_var > 1 ) {
[4114] Fix | Delete
$page = $queried_var;
[4115] Fix | Delete
}
[4116] Fix | Delete
$numpages = count($ampforwp_new_content);
[4117] Fix | Delete
}
[4118] Fix | Delete
}else if(ampforwp_get_setting('ampforwp-pagination-link-type')==true && is_singular() && !checkAMPforPageBuilderStatus(ampforwp_get_the_ID())){
[4119] Fix | Delete
$id = ampforwp_get_the_ID();
[4120] Fix | Delete
$content = get_post_field( 'post_content', $id);
[4121] Fix | Delete
if ($content) {
[4122] Fix | Delete
$sanitizer_obj = new AMPFORWP_Content( $content,
[4123] Fix | Delete
apply_filters( 'amp_content_embed_handlers', array(
[4124] Fix | Delete
'AMP_Reddit_Embed_Handler' => array(),
[4125] Fix | Delete
'AMP_Twitter_Embed_Handler' => array(),
[4126] Fix | Delete
'AMP_YouTube_Embed_Handler' => array(),
[4127] Fix | Delete
'AMP_DailyMotion_Embed_Handler' => array(),
[4128] Fix | Delete
'AMP_Vimeo_Embed_Handler' => array(),
[4129] Fix | Delete
'AMP_SoundCloud_Embed_Handler' => array(),
[4130] Fix | Delete
'AMP_Instagram_Embed_Handler' => array(),
[4131] Fix | Delete
'AMP_Vine_Embed_Handler' => array(),
[4132] Fix | Delete
'AMP_Facebook_Embed_Handler' => array(),
[4133] Fix | Delete
'AMP_Pinterest_Embed_Handler' => array(),
[4134] Fix | Delete
'AMP_Gallery_Embed_Handler' => array(),
[4135] Fix | Delete
'AMP_Playlist_Embed_Handler' => array(),
[4136] Fix | Delete
'AMP_Tiktok_Embed_Handler'=>array(),
[4137] Fix | Delete
) ),
[4138] Fix | Delete
apply_filters( 'amp_content_sanitizers', array(
[4139] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[4140] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[4141] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[4142] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[4143] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[4144] Fix | Delete
'AMP_Playbuzz_Sanitizer' => array(),
[4145] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[4146] Fix | Delete
'add_placeholder' => true,
[4147] Fix | Delete
),
[4148] Fix | Delete
) ) );
[4149] Fix | Delete
$content = $sanitizer_obj->get_amp_content();
[4150] Fix | Delete
$checker = preg_match('/<!--nextpage-->/', $content);
[4151] Fix | Delete
if ( 1 === $checker ) {
[4152] Fix | Delete
$multipage = $more = 1;
[4153] Fix | Delete
$ampforwp_new_content = explode('<!--nextpage-->', $content);
[4154] Fix | Delete
$queried_var = get_query_var('paged');
[4155] Fix | Delete
if ( $queried_var > 1 ) {
[4156] Fix | Delete
$page = $queried_var;
[4157] Fix | Delete
}
[4158] Fix | Delete
$numpages = count($ampforwp_new_content);
[4159] Fix | Delete
}
[4160] Fix | Delete
}
[4161] Fix | Delete
[4162] Fix | Delete
}
[4163] Fix | Delete
}
[4164] Fix | Delete
$defaults = array(
[4165] Fix | Delete
'before' => '<div class="ampforwp_post_pagination" ><p>' . '<span>' . ampforwp_translation($redux_builder_amp['amp-translator-page-text'], 'Page') . ':</span>',
[4166] Fix | Delete
'after' => '</p></div>',
[4167] Fix | Delete
'link_before' => '',
[4168] Fix | Delete
'link_after' => '',
[4169] Fix | Delete
'next_or_number' => 'number',
[4170] Fix | Delete
'separator' => ' ',
[4171] Fix | Delete
'nextpagelink' => ampforwp_translation($redux_builder_amp['amp-translator-next-text'], 'Next'),
[4172] Fix | Delete
'previouspagelink' => ampforwp_translation($redux_builder_amp['amp-translator-previous-text'], 'Previous'),
[4173] Fix | Delete
'pagelink' => '%',
[4174] Fix | Delete
'echo' => 1
[4175] Fix | Delete
);
[4176] Fix | Delete
[4177] Fix | Delete
$params = wp_parse_args( $args, $defaults );
[4178] Fix | Delete
[4179] Fix | Delete
/**
[4180] Fix | Delete
* Filters the arguments used in retrieving page links for paginated posts.
[4181] Fix | Delete
* @param array $params An array of arguments for page links for paginated posts.
[4182] Fix | Delete
*/
[4183] Fix | Delete
$r = apply_filters( 'ampforwp_post_pagination_args', $params );
[4184] Fix | Delete
if ( isset($redux_builder_amp['ampforwp-pagination-select']) && 2 == $redux_builder_amp['ampforwp-pagination-select'] ) {
[4185] Fix | Delete
$r['next_or_number'] = 'next';
[4186] Fix | Delete
$r['before'] = '<div class="ampforwp_post_pagination" ><p>';
[4187] Fix | Delete
$r['after'] = '</p></div>';
[4188] Fix | Delete
}
[4189] Fix | Delete
$output = '';
[4190] Fix | Delete
if ( $multipage ) {
[4191] Fix | Delete
if ( 'number' == $r['next_or_number'] ) {
[4192] Fix | Delete
$output .= $r['before'];
[4193] Fix | Delete
for ( $i = 1; $i <= $numpages; $i++ ) {
[4194] Fix | Delete
$link = $r['link_before'] . str_replace( '%', '<span>'.$i.'</span>', $r['pagelink'] ) . $r['link_after'];
[4195] Fix | Delete
if ( $i != $page || ! $more && 1 == $page ) {
[4196] Fix | Delete
$link = ampforwp_post_paginated_link_generator( $i ) . $link . '</a>';
[4197] Fix | Delete
}
[4198] Fix | Delete
/**
[4199] Fix | Delete
* Filters the HTML output of individual page number links.
[4200] Fix | Delete
* @param string $link The page number HTML output.
[4201] Fix | Delete
* @param int $i Page number for paginated posts' page links.
[4202] Fix | Delete
*/
[4203] Fix | Delete
$link = apply_filters( 'ampforwp_post_pagination_link', $link, $i );
[4204] Fix | Delete
[4205] Fix | Delete
// Use the custom links separator beginning with the second link.
[4206] Fix | Delete
$output .= ( 1 === $i ) ? ' ' : $r['separator'];
[4207] Fix | Delete
$output .= $link;
[4208] Fix | Delete
}
[4209] Fix | Delete
$output .= $r['after'];
[4210] Fix | Delete
} elseif ( $more ) {
[4211] Fix | Delete
$output .= $r['before'];
[4212] Fix | Delete
$prev = $page - 1;
[4213] Fix | Delete
if ( $prev > 0 ) {
[4214] Fix | Delete
$link = ampforwp_post_paginated_link_generator( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
[4215] Fix | Delete
$output .= apply_filters( 'ampforwp_post_pagination_link', $link, $prev );
[4216] Fix | Delete
}
[4217] Fix | Delete
$output .= $r['separator'];
[4218] Fix | Delete
$text = $page . ' of ' . $numpages;
[4219] Fix | Delete
$output .= apply_filters( 'ampforwp_post_pagination_page', $text, $page, $numpages);
[4220] Fix | Delete
$next = $page + 1;
[4221] Fix | Delete
if ( $next <= $numpages ) {
[4222] Fix | Delete
$output .= $r['separator'];
[4223] Fix | Delete
$link = ampforwp_post_paginated_link_generator( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
[4224] Fix | Delete
$output .= apply_filters( 'ampforwp_post_pagination_link', $link, $next );
[4225] Fix | Delete
}
[4226] Fix | Delete
$output .= $r['after'];
[4227] Fix | Delete
}
[4228] Fix | Delete
}
[4229] Fix | Delete
[4230] Fix | Delete
/**
[4231] Fix | Delete
* Filters the HTML output of page links for paginated posts.
[4232] Fix | Delete
* @param string $output HTML output of paginated posts' page links.
[4233] Fix | Delete
* @param array $args An array of arguments.
[4234] Fix | Delete
*/
[4235] Fix | Delete
$html = apply_filters( 'ampforwp_post_pagination', $output, $args );
[4236] Fix | Delete
if($redux_builder_amp['amp-pagination']) {
[4237] Fix | Delete
if ( $r['echo'] ) {
[4238] Fix | Delete
echo $html;
[4239] Fix | Delete
}
[4240] Fix | Delete
return $html;
[4241] Fix | Delete
}
[4242] Fix | Delete
[4243] Fix | Delete
}
[4244] Fix | Delete
[4245] Fix | Delete
/**
[4246] Fix | Delete
* Helper function for ampforwp_post_pagination().
[4247] Fix | Delete
* @access private
[4248] Fix | Delete
*
[4249] Fix | Delete
* @global WP_Rewrite $wp_rewrite
[4250] Fix | Delete
*
[4251] Fix | Delete
* @param int $i Page number.
[4252] Fix | Delete
* @return string Link.
[4253] Fix | Delete
*/
[4254] Fix | Delete
function ampforwp_post_paginated_link_generator( $i ) {
[4255] Fix | Delete
global $wp_rewrite;
[4256] Fix | Delete
$post = get_post();
[4257] Fix | Delete
if ( ampforwp_is_front_page() ) {
[4258] Fix | Delete
$id = ampforwp_get_frontpage_id();
[4259] Fix | Delete
$post = get_post($id);
[4260] Fix | Delete
}
[4261] Fix | Delete
$query_args = array();
[4262] Fix | Delete
if ( 1 == $i ) {
[4263] Fix | Delete
$url = get_permalink();
[4264] Fix | Delete
if(ampforwp_is_front_page()){
[4265] Fix | Delete
$url = get_home_url();
[4266] Fix | Delete
}
[4267] Fix | Delete
} else {
[4268] Fix | Delete
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) {
[4269] Fix | Delete
$url = add_query_arg( 'page', $i, get_permalink() );
[4270] Fix | Delete
if(ampforwp_is_front_page()){
[4271] Fix | Delete
$url = add_query_arg( 'page', $i, get_home_url() );
[4272] Fix | Delete
}
[4273] Fix | Delete
}
[4274] Fix | Delete
elseif ( ampforwp_is_front_page() )
[4275] Fix | Delete
$url = trailingslashit(get_home_url()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
[4276] Fix | Delete
else
[4277] Fix | Delete
$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
[4278] Fix | Delete
}
[4279] Fix | Delete
[4280] Fix | Delete
if ( is_preview() ) {
[4281] Fix | Delete
[4282] Fix | Delete
if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
[4283] Fix | Delete
$query_args['preview_id'] = wp_unslash( $_GET['preview_id'] );
[4284] Fix | Delete
$query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] );
[4285] Fix | Delete
}
[4286] Fix | Delete
[4287] Fix | Delete
$url = get_preview_post_link( $post, $query_args, $url );
[4288] Fix | Delete
[4289] Fix | Delete
}
[4290] Fix | Delete
$mob_pres_link = false;
[4291] Fix | Delete
if(function_exists('ampforwp_mobile_redirect_preseve_link')){
[4292] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[4293] Fix | Delete
}
[4294] Fix | Delete
if ( false == ampforwp_get_setting('ampforwp-amp-takeover') && $mob_pres_link == false) {
[4295] Fix | Delete
if(ampforwp_get_setting('ampforwp-pagination-link-type')==true && is_singular() && !checkAMPforPageBuilderStatus(ampforwp_get_the_ID())){
[4296] Fix | Delete
$url = ampforwp_url_controller($url);
[4297] Fix | Delete
}else{
[4298] Fix | Delete
$url = add_query_arg(AMPFORWP_AMP_QUERY_VAR,'1',$url);
[4299] Fix | Delete
}
[4300] Fix | Delete
}
[4301] Fix | Delete
return '<a href="' . esc_url( $url ) . '">';
[4302] Fix | Delete
}
[4303] Fix | Delete
// Modify the content to make Pagination work on Pages and FrontPage #2253
[4304] Fix | Delete
add_filter('ampforwp_modify_the_content','ampforwp_post_paginated_content');
[4305] Fix | Delete
function ampforwp_post_paginated_content($content){
[4306] Fix | Delete
//Embed pinterest images to the amp #4361
[4307] Fix | Delete
if(preg_match('/<a(.*?)data-pin-do="embedPin"(.*?)href="(.*?)"><\/a>/', $content)){
[4308] Fix | Delete
$content = preg_replace('/<a(.*?)data-pin-do="embedPin"(.*?)href="(.*?)"><\/a>/', '<amp-pinterest width="250" height="500" data-do="embedPin" data-url="$3"></amp-pinterest>', $content);
[4309] Fix | Delete
}
[4310] Fix | Delete
if ( is_singular() || ampforwp_is_front_page() ){
[4311] Fix | Delete
global $redux_builder_amp, $page, $multipage;
[4312] Fix | Delete
$ampforwp_new_content = $ampforwp_the_content = $checker = '';
[4313] Fix | Delete
if(ampforwp_get_setting('ampforwp-pagination-link-type')==true && is_singular() && !checkAMPforPageBuilderStatus(ampforwp_get_the_ID())){
[4314] Fix | Delete
if (get_query_var('paged') > 1) {
[4315] Fix | Delete
$id = ampforwp_get_the_ID();
[4316] Fix | Delete
$content = get_post_field( 'post_content', $id);
[4317] Fix | Delete
}
[4318] Fix | Delete
if ($content) {
[4319] Fix | Delete
$sanitizer_obj = new AMPFORWP_Content( $content,
[4320] Fix | Delete
apply_filters( 'amp_content_embed_handlers', array(
[4321] Fix | Delete
'AMP_Reddit_Embed_Handler' => array(),
[4322] Fix | Delete
'AMP_Twitter_Embed_Handler' => array(),
[4323] Fix | Delete
'AMP_YouTube_Embed_Handler' => array(),
[4324] Fix | Delete
'AMP_DailyMotion_Embed_Handler' => array(),
[4325] Fix | Delete
'AMP_Vimeo_Embed_Handler' => array(),
[4326] Fix | Delete
'AMP_SoundCloud_Embed_Handler' => array(),
[4327] Fix | Delete
'AMP_Instagram_Embed_Handler' => array(),
[4328] Fix | Delete
'AMP_Vine_Embed_Handler' => array(),
[4329] Fix | Delete
'AMP_Facebook_Embed_Handler' => array(),
[4330] Fix | Delete
'AMP_Pinterest_Embed_Handler' => array(),
[4331] Fix | Delete
'AMP_Gallery_Embed_Handler' => array(),
[4332] Fix | Delete
'AMP_Playlist_Embed_Handler' => array(),
[4333] Fix | Delete
'AMP_Tiktok_Embed_Handler'=>array(),
[4334] Fix | Delete
) ),
[4335] Fix | Delete
apply_filters( 'amp_content_sanitizers', array(
[4336] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[4337] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[4338] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[4339] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[4340] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[4341] Fix | Delete
'AMP_Playbuzz_Sanitizer' => array(),
[4342] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[4343] Fix | Delete
'add_placeholder' => true,
[4344] Fix | Delete
),
[4345] Fix | Delete
) ) );
[4346] Fix | Delete
$content = $sanitizer_obj->get_amp_content();
[4347] Fix | Delete
$queried_var = get_query_var('paged');
[4348] Fix | Delete
$con = explode("<!--nextpage-->", $content);
[4349] Fix | Delete
if($queried_var>=2){
[4350] Fix | Delete
if(isset($con[$queried_var-1])){
[4351] Fix | Delete
$content = $con[$queried_var-1];
[4352] Fix | Delete
}
[4353] Fix | Delete
}
[4354] Fix | Delete
}
[4355] Fix | Delete
$ampforwp_the_content = $content;
[4356] Fix | Delete
$checker = preg_match('/<!--nextpage-->/', $ampforwp_the_content);
[4357] Fix | Delete
if ( 1 === $checker && true == ampforwp_get_setting('amp-pagination') ) {
[4358] Fix | Delete
$multipage = 1;
[4359] Fix | Delete
$ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
[4360] Fix | Delete
$queried_var = get_query_var('page');
[4361] Fix | Delete
if ( ampforwp_is_front_page() ) {
[4362] Fix | Delete
$queried_var = get_query_var('paged');
[4363] Fix | Delete
}
[4364] Fix | Delete
if ( $queried_var > 1 ) {
[4365] Fix | Delete
$queried_var = $queried_var -1 ;
[4366] Fix | Delete
}
[4367] Fix | Delete
else {
[4368] Fix | Delete
$queried_var = 0;
[4369] Fix | Delete
}
[4370] Fix | Delete
return $ampforwp_new_content[$queried_var];
[4371] Fix | Delete
}
[4372] Fix | Delete
else {
[4373] Fix | Delete
return $ampforwp_the_content;
[4374] Fix | Delete
}
[4375] Fix | Delete
}
[4376] Fix | Delete
}
[4377] Fix | Delete
return $content;
[4378] Fix | Delete
}
[4379] Fix | Delete
[4380] Fix | Delete
add_filter('ampforwp_modify_rel_canonical','ampforwp_modify_rel_amphtml_paginated_post');
[4381] Fix | Delete
function ampforwp_modify_rel_amphtml_paginated_post($url) {
[4382] Fix | Delete
if(is_single()){
[4383] Fix | Delete
$post_paginated_page='';
[4384] Fix | Delete
$post_paginated_page = get_query_var('page');
[4385] Fix | Delete
$permalink_structure = '';
[4386] Fix | Delete
$permalink_structure = get_option('permalink_structure');
[4387] Fix | Delete
if($post_paginated_page){
[4388] Fix | Delete
$url = get_permalink();
[4389] Fix | Delete
if('' == $permalink_structure){
[4390] Fix | Delete
$new_url = add_query_arg('page',$post_paginated_page,$url);
[4391] Fix | Delete
}
[4392] Fix | Delete
else{
[4393] Fix | Delete
$new_url = trailingslashit($url) . user_trailingslashit($post_paginated_page);
[4394] Fix | Delete
}
[4395] Fix | Delete
[4396] Fix | Delete
if(ampforwp_get_setting('ampforwp-pagination-link-type')==true ){
[4397] Fix | Delete
$new_url = ampforwp_url_controller($new_url);
[4398] Fix | Delete
}else{
[4399] Fix | Delete
$new_url = add_query_arg(AMPFORWP_AMP_QUERY_VAR,'1',$new_url);
[4400] Fix | Delete
}
[4401] Fix | Delete
return $new_url;
[4402] Fix | Delete
}
[4403] Fix | Delete
}
[4404] Fix | Delete
return $url;
[4405] Fix | Delete
}
[4406] Fix | Delete
[4407] Fix | Delete
add_action('amp_post_template_head','ampforwp_modify_rel_canonical_paginated_post',9);
[4408] Fix | Delete
function ampforwp_modify_rel_canonical_paginated_post(){
[4409] Fix | Delete
if(is_single()){
[4410] Fix | Delete
$post_paginated_page='';
[4411] Fix | Delete
$post_paginated_page = get_query_var('page');
[4412] Fix | Delete
if($post_paginated_page && !class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')){
[4413] Fix | Delete
remove_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
[4414] Fix | Delete
add_action('amp_post_template_head','ampforwp_rel_canonical_paginated_post');
[4415] Fix | Delete
}
[4416] Fix | Delete
}
[4417] Fix | Delete
}
[4418] Fix | Delete
function ampforwp_rel_canonical_paginated_post(){
[4419] Fix | Delete
$post_paginated_page='';
[4420] Fix | Delete
$new_canonical_url = '';
[4421] Fix | Delete
$permalink_structure = '';
[4422] Fix | Delete
$permalink_structure = get_option('permalink_structure');
[4423] Fix | Delete
global $post;
[4424] Fix | Delete
$current_post_id = $post->ID;
[4425] Fix | Delete
$new_canonical_url = get_permalink($current_post_id);
[4426] Fix | Delete
$new_canonical_url = trailingslashit($new_canonical_url);
[4427] Fix | Delete
$post_paginated_page = get_query_var('page');
[4428] Fix | Delete
if($post_paginated_page){
[4429] Fix | Delete
if('' == $permalink_structure){
[4430] Fix | Delete
$new_canonical_url = add_query_arg('page',$post_paginated_page,$new_canonical_url);
[4431] Fix | Delete
}
[4432] Fix | Delete
else{
[4433] Fix | Delete
$new_canonical_url = $new_canonical_url.$post_paginated_page;
[4434] Fix | Delete
}
[4435] Fix | Delete
?>
[4436] Fix | Delete
<link rel="canonical" href="<?php echo esc_url($new_canonical_url) ?>/" /><?php }
[4437] Fix | Delete
}
[4438] Fix | Delete
add_action('ampforwp_after_post_content','ampforwp_post_pagination');
[4439] Fix | Delete
[4440] Fix | Delete
// Generating Canonical Url for Yoast no index pages.
[4441] Fix | Delete
add_filter( 'wpseo_robots_array', 'ampforwp_yoast_no_index_condition_check',20,2);
[4442] Fix | Delete
function ampforwp_yoast_no_index_condition_check($robots,$object){
[4443] Fix | Delete
global $yoast_data;
[4444] Fix | Delete
if($robots['index'] == 'noindex'){
[4445] Fix | Delete
$yoast_data['canonical'] = $object->model->permalink;
[4446] Fix | Delete
add_action( 'amp_post_template_head', 'ampforwp_generate_yoast_no_index_canonical_url' );
[4447] Fix | Delete
}
[4448] Fix | Delete
return $robots;
[4449] Fix | Delete
}
[4450] Fix | Delete
[4451] Fix | Delete
function ampforwp_generate_yoast_no_index_canonical_url(){
[4452] Fix | Delete
global $yoast_data;
[4453] Fix | Delete
if(isset($yoast_data['canonical'])){
[4454] Fix | Delete
$canonical_url = $yoast_data['canonical'];
[4455] Fix | Delete
if(ampforwp_is_home() || ampforwp_is_front_page()){
[4456] Fix | Delete
$canonical_url = user_trailingslashit(get_home_url());
[4457] Fix | Delete
} ?>
[4458] Fix | Delete
<link rel="canonical" href="<?php echo esc_url($canonical_url) ?>"/>
[4459] Fix | Delete
<?php }
[4460] Fix | Delete
}
[4461] Fix | Delete
[4462] Fix | Delete
// Modified Homepage wrong canonical url generated by yoast
[4463] Fix | Delete
add_action('pre_amp_render_post','ampforwp_modify_yoast_amp_homepage_canonical');
[4464] Fix | Delete
function ampforwp_modify_yoast_amp_homepage_canonical(){
[4465] Fix | Delete
add_filter('wpseo_canonical','ampforwp_modify_yoast_homepage_canonical_url',20);
[4466] Fix | Delete
}
[4467] Fix | Delete
[4468] Fix | Delete
function ampforwp_modify_yoast_homepage_canonical_url($canonical_url){
[4469] Fix | Delete
if(ampforwp_is_home() || ampforwp_is_front_page()){
[4470] Fix | Delete
$canonical_url = user_trailingslashit(get_home_url());
[4471] Fix | Delete
}
[4472] Fix | Delete
return esc_url($canonical_url);
[4473] Fix | Delete
}
[4474] Fix | Delete
[4475] Fix | Delete
// 70. Hide AMP by specific Categories & Tags #872
[4476] Fix | Delete
function ampforwp_posts_to_remove () {
[4477] Fix | Delete
if(is_category()){
[4478] Fix | Delete
if(ampforwp_get_setting('ampforwp-archive-support-cat')==false){
[4479] Fix | Delete
return false;
[4480] Fix | Delete
}
[4481] Fix | Delete
}
[4482] Fix | Delete
if(is_tag()){
[4483] Fix | Delete
if(ampforwp_get_setting('ampforwp-archive-support-tag')==false){
[4484] Fix | Delete
return false;
[4485] Fix | Delete
}
[4486] Fix | Delete
}
[4487] Fix | Delete
if(ampforwp_get_setting('hide-amp-categories2')){
[4488] Fix | Delete
if ( has_category(array_filter(ampforwp_get_setting('hide-amp-categories2'))) ) {
[4489] Fix | Delete
return true;
[4490] Fix | Delete
}
[4491] Fix | Delete
}
[4492] Fix | Delete
if( ampforwp_get_setting('hide-amp-tags-bulk-option2') ) {
[4493] Fix | Delete
if ( has_tag(array_filter(ampforwp_get_setting('hide-amp-tags-bulk-option2') )) ) {
[4494] Fix | Delete
return true;
[4495] Fix | Delete
}
[4496] Fix | Delete
}
[4497] Fix | Delete
return false;
[4498] Fix | Delete
}
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function