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
// Disable wptextturize #1458
[6000] Fix | Delete
add_action('init','ampforwp_wptexturize_disabler');
[6001] Fix | Delete
if ( ! function_exists('ampforwp_wptexturize_disabler') ) {
[6002] Fix | Delete
function ampforwp_wptexturize_disabler(){
[6003] Fix | Delete
global $redux_builder_amp;
[6004] Fix | Delete
if ( isset($redux_builder_amp['ampforwp-wptexturize']) && true == $redux_builder_amp['ampforwp-wptexturize'] ) {
[6005] Fix | Delete
remove_filter('the_content', 'wptexturize');
[6006] Fix | Delete
remove_filter('the_title', 'wptexturize');
[6007] Fix | Delete
}
[6008] Fix | Delete
}
[6009] Fix | Delete
}
[6010] Fix | Delete
[6011] Fix | Delete
// amp-vimeo proper video id for 3 parameter url
[6012] Fix | Delete
add_filter('amp_vimeo_parse_url','amp_vimeo_parse_url_video_id');
[6013] Fix | Delete
function amp_vimeo_parse_url_video_id($tok){
[6014] Fix | Delete
if (in_array("ondemand", $tok) && sizeof($tok)==3){
[6015] Fix | Delete
$tok = '';
[6016] Fix | Delete
return $tok;
[6017] Fix | Delete
}
[6018] Fix | Delete
if(sizeof($tok)==3){
[6019] Fix | Delete
return $tok[1];
[6020] Fix | Delete
}else{
[6021] Fix | Delete
return end($tok);
[6022] Fix | Delete
}
[6023] Fix | Delete
}
[6024] Fix | Delete
[6025] Fix | Delete
// Cart Page URL
[6026] Fix | Delete
if( ! function_exists( 'ampforwp_wc_cart_page_url' ) ){
[6027] Fix | Delete
function ampforwp_wc_cart_page_url(){
[6028] Fix | Delete
if(function_exists('amp_woocommerce_pro_add_woocommerce_support') && (function_exists('wc_get_cart_url') || function_exists('get_cart_url'))){
[6029] Fix | Delete
global $woocommerce;
[6030] Fix | Delete
$cart_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : $woocommerce->cart->get_cart_url();
[6031] Fix | Delete
$cart_url = ampforwp_url_controller($cart_url);
[6032] Fix | Delete
return $cart_url;
[6033] Fix | Delete
}
[6034] Fix | Delete
else
[6035] Fix | Delete
return '#';
[6036] Fix | Delete
}
[6037] Fix | Delete
}
[6038] Fix | Delete
[6039] Fix | Delete
// Add Google Font support
[6040] Fix | Delete
add_action('amp_post_template_css', 'ampforwp_google_fonts_generator');
[6041] Fix | Delete
if ( ! function_exists( 'ampforwp_google_fonts_generator' ) ) {
[6042] Fix | Delete
function ampforwp_google_fonts_generator() {
[6043] Fix | Delete
global $redux_builder_amp;
[6044] Fix | Delete
if( 1!=ampforwp_get_setting('ampforwp-google-font-switch') || true == ampforwp_get_setting('amp_google_font_restrict')){
[6045] Fix | Delete
return;
[6046] Fix | Delete
}
[6047] Fix | Delete
if(isset($redux_builder_amp['google_current_font_data'])){
[6048] Fix | Delete
$font_data = json_decode(stripslashes($redux_builder_amp['google_current_font_data']));
[6049] Fix | Delete
}
[6050] Fix | Delete
[6051] Fix | Delete
$font_weight = "";
[6052] Fix | Delete
$font_output = "";
[6053] Fix | Delete
$font_type = "";
[6054] Fix | Delete
if(isset( $redux_builder_amp['amp_font_type'])){
[6055] Fix | Delete
$font_type = $redux_builder_amp['amp_font_type'];
[6056] Fix | Delete
}
[6057] Fix | Delete
[6058] Fix | Delete
if ( $font_type && ampforwp_get_setting('amp_font_selector') != 'Segoe UI') {
[6059] Fix | Delete
foreach ($font_type as $key => $value) {
[6060] Fix | Delete
// Font Weight generator
[6061] Fix | Delete
$font_weight = (int) $value;
[6062] Fix | Delete
$font_weight = ( $font_weight != 0 ? $font_weight : 400 );
[6063] Fix | Delete
[6064] Fix | Delete
// Font Stlye Generator
[6065] Fix | Delete
$font_style = preg_replace('/\d+/u', '', $value);
[6066] Fix | Delete
$font_style = ( $font_style == 'italic' ? 'italic' : 'normal' );
[6067] Fix | Delete
[6068] Fix | Delete
// Local Generator
[6069] Fix | Delete
// Font Weight
[6070] Fix | Delete
$font_local_weight = '';
[6071] Fix | Delete
[6072] Fix | Delete
if ( $font_weight === 100 ) {
[6073] Fix | Delete
$font_local_weight = 'Thin';
[6074] Fix | Delete
}
[6075] Fix | Delete
[6076] Fix | Delete
if ( $font_weight === 200 ) {
[6077] Fix | Delete
$font_local_weight = 'Ultra Light';
[6078] Fix | Delete
}
[6079] Fix | Delete
[6080] Fix | Delete
if ( $font_weight === 300 ) {
[6081] Fix | Delete
$font_local_weight = 'Light';
[6082] Fix | Delete
}
[6083] Fix | Delete
[6084] Fix | Delete
if ( $font_weight === 400 ) {
[6085] Fix | Delete
$font_local_weight = 'Regular';
[6086] Fix | Delete
}
[6087] Fix | Delete
[6088] Fix | Delete
if ( $font_weight === 500 ) {
[6089] Fix | Delete
$font_local_weight = 'Medium';
[6090] Fix | Delete
}
[6091] Fix | Delete
[6092] Fix | Delete
if ( $font_weight === 600 ) {
[6093] Fix | Delete
$font_local_weight = 'SemiBold';
[6094] Fix | Delete
}
[6095] Fix | Delete
[6096] Fix | Delete
if ( $font_weight === 700 ) {
[6097] Fix | Delete
$font_local_weight = 'Bold';
[6098] Fix | Delete
}
[6099] Fix | Delete
[6100] Fix | Delete
if ( $font_weight === 800 ) {
[6101] Fix | Delete
$font_local_weight = 'ExtraBold';
[6102] Fix | Delete
}
[6103] Fix | Delete
[6104] Fix | Delete
if ( $font_weight === 900 ) {
[6105] Fix | Delete
$font_local_weight = 'Black';
[6106] Fix | Delete
}
[6107] Fix | Delete
[6108] Fix | Delete
// Font Style
[6109] Fix | Delete
$font_local_type = '';
[6110] Fix | Delete
if ('italic' === $font_style) {
[6111] Fix | Delete
$font_local_type = 'Italic';
[6112] Fix | Delete
}
[6113] Fix | Delete
[6114] Fix | Delete
$font_output .= "@font-face { ";
[6115] Fix | Delete
$font_output .= "font-family: " . $redux_builder_amp['amp_font_selector']. ';' ;
[6116] Fix | Delete
$font_output .= "font-display: optional;";
[6117] Fix | Delete
$font_output .= "font-style: " . $font_style . ';';
[6118] Fix | Delete
$font_output .= "font-weight: " . $font_weight . ';' ;
[6119] Fix | Delete
$font_output .= "src: local('". $redux_builder_amp['amp_font_selector']." ".$font_local_weight." ".$font_local_type."'), local('". $redux_builder_amp['amp_font_selector']."-".$font_local_weight.$font_local_type."'), url(" .str_replace("http://", "https://", $font_data->files->$value) . ');' ;
[6120] Fix | Delete
$font_output .= "}";
[6121] Fix | Delete
}
[6122] Fix | Delete
}
[6123] Fix | Delete
[6124] Fix | Delete
//for Single content Font Family
[6125] Fix | Delete
if(ampforwp_get_setting('content-font-family-enable') && (is_singular() || (ampforwp_get_setting('amp-design-selector')!=4) ) ){
[6126] Fix | Delete
if(ampforwp_get_setting('google_current_font_data_content_single')){
[6127] Fix | Delete
$font_data = json_decode(stripslashes(ampforwp_get_setting('google_current_font_data_content_single')));
[6128] Fix | Delete
}
[6129] Fix | Delete
$font_output .= "\n";
[6130] Fix | Delete
if( ampforwp_get_setting('amp_font_type_content_single') ){
[6131] Fix | Delete
$font_type = ampforwp_get_setting('amp_font_type_content_single');
[6132] Fix | Delete
}
[6133] Fix | Delete
if ( $font_type && ampforwp_get_setting('amp_font_selector_content_single') != 'Segoe UI') {
[6134] Fix | Delete
foreach ($font_type as $key => $value) {
[6135] Fix | Delete
// Font Weight generator
[6136] Fix | Delete
$font_weight = (int) $value;
[6137] Fix | Delete
$font_weight = ( $font_weight != 0 ? $font_weight : 400 );
[6138] Fix | Delete
// Font Stlye Generator
[6139] Fix | Delete
$font_style = preg_replace('/\d+/u', '', $value);
[6140] Fix | Delete
$font_style = ( $font_style == 'italic' ? 'italic' : 'normal' );
[6141] Fix | Delete
// Local Generator
[6142] Fix | Delete
// Font Weight
[6143] Fix | Delete
$font_local_weight = '';
[6144] Fix | Delete
if ( $font_weight === 100 ) {
[6145] Fix | Delete
$font_local_weight = 'Thin';
[6146] Fix | Delete
}
[6147] Fix | Delete
if ( $font_weight === 200 ) {
[6148] Fix | Delete
$font_local_weight = 'Ultra Light';
[6149] Fix | Delete
}
[6150] Fix | Delete
if ( $font_weight === 300 ) {
[6151] Fix | Delete
$font_local_weight = 'Light';
[6152] Fix | Delete
}
[6153] Fix | Delete
if ( $font_weight === 400 ) {
[6154] Fix | Delete
$font_local_weight = 'Regular';
[6155] Fix | Delete
}
[6156] Fix | Delete
if ( $font_weight === 500 ) {
[6157] Fix | Delete
$font_local_weight = 'Medium';
[6158] Fix | Delete
}
[6159] Fix | Delete
if ( $font_weight === 600 ) {
[6160] Fix | Delete
$font_local_weight = 'SemiBold';
[6161] Fix | Delete
}
[6162] Fix | Delete
if ( $font_weight === 700 ) {
[6163] Fix | Delete
$font_local_weight = 'Bold';
[6164] Fix | Delete
}
[6165] Fix | Delete
if ( $font_weight === 800 ) {
[6166] Fix | Delete
$font_local_weight = 'ExtraBold';
[6167] Fix | Delete
}
[6168] Fix | Delete
if ( $font_weight === 900 ) {
[6169] Fix | Delete
$font_local_weight = 'Black';
[6170] Fix | Delete
}
[6171] Fix | Delete
// Font Style
[6172] Fix | Delete
$font_local_type = '';
[6173] Fix | Delete
if ('italic' === $font_style) {
[6174] Fix | Delete
$font_local_type = 'Italic';
[6175] Fix | Delete
}
[6176] Fix | Delete
$font_output .= "@font-face { ";
[6177] Fix | Delete
$font_output .= "font-family: " . esc_attr(ampforwp_get_setting('amp_font_selector_content_single')). ';' ;
[6178] Fix | Delete
if (ampforwp_get_setting('ampforwp_font_display') == 'optional') {
[6179] Fix | Delete
$font_output .= "font-display: optional".';';
[6180] Fix | Delete
}else{
[6181] Fix | Delete
$font_output .= "font-display: swap".';';
[6182] Fix | Delete
}
[6183] Fix | Delete
$font_output .= "font-style: " . esc_attr($font_style) . ';';
[6184] Fix | Delete
$font_output .= "font-weight: " . esc_attr($font_weight) . ';' ;
[6185] Fix | Delete
$font_output .= "src: local('". esc_attr(ampforwp_get_setting('amp_font_selector_content_single'))." ".esc_attr($font_local_weight)." ".esc_attr($font_local_type)."'), local('". esc_attr(ampforwp_get_setting('amp_font_selector_content_single'))."-".esc_attr($font_local_weight).$font_local_type."'), url(" .esc_url(str_replace("http://", "https://", $font_data->files->$value)) . ');' ;
[6186] Fix | Delete
$font_output .= "}";
[6187] Fix | Delete
}
[6188] Fix | Delete
}
[6189] Fix | Delete
}
[6190] Fix | Delete
[6191] Fix | Delete
echo $font_output; // escaped above
[6192] Fix | Delete
}
[6193] Fix | Delete
}
[6194] Fix | Delete
[6195] Fix | Delete
function swifttheme_footer_widgets_init() {
[6196] Fix | Delete
register_sidebar( array(
[6197] Fix | Delete
'name' => esc_html__( 'AMP Widget Below Header', 'accelerated-mobile-pages' ),
[6198] Fix | Delete
'id' => 'ampforwp-below-header',
[6199] Fix | Delete
'description' => esc_html__( 'This Widget will be display on Below Header area', 'accelerated-mobile-pages' ),
[6200] Fix | Delete
'class'=>'w-bl',
[6201] Fix | Delete
'before_widget' => '<div class="w-bl">',
[6202] Fix | Delete
'after_widget' => '</div>',
[6203] Fix | Delete
'before_title' => '<h4>',
[6204] Fix | Delete
'after_title' => '</h4>',
[6205] Fix | Delete
) );
[6206] Fix | Delete
register_sidebar( array(
[6207] Fix | Delete
'name' => esc_html__( 'AMP Widget Above Loop', 'accelerated-mobile-pages' ),
[6208] Fix | Delete
'id' => 'ampforwp-above-loop',
[6209] Fix | Delete
'description' => esc_html__( 'This Widget will be display on Above Loop area', 'accelerated-mobile-pages' ),
[6210] Fix | Delete
'class'=>'w-bl',
[6211] Fix | Delete
'before_widget' => '<div class="w-bl">',
[6212] Fix | Delete
'after_widget' => '</div>',
[6213] Fix | Delete
'before_title' => '<h4>',
[6214] Fix | Delete
'after_title' => '</h4>',
[6215] Fix | Delete
) );
[6216] Fix | Delete
register_sidebar( array(
[6217] Fix | Delete
'name' => esc_html__( 'AMP Widget Below loop', 'accelerated-mobile-pages' ),
[6218] Fix | Delete
'id' => 'ampforwp-below-loop',
[6219] Fix | Delete
'description' => esc_html__( 'This Widget will be display on Below loop area', 'accelerated-mobile-pages' ),
[6220] Fix | Delete
'class'=>'w-bl',
[6221] Fix | Delete
'before_widget' => '<div class="w-bl">',
[6222] Fix | Delete
'after_widget' => '</div>',
[6223] Fix | Delete
'before_title' => '<h4>',
[6224] Fix | Delete
'after_title' => '</h4>',
[6225] Fix | Delete
) );
[6226] Fix | Delete
register_sidebar( array(
[6227] Fix | Delete
'name' => esc_html__( 'AMP Widget Above Footer', 'accelerated-mobile-pages' ),
[6228] Fix | Delete
'id' => 'ampforwp-above-footer',
[6229] Fix | Delete
'description' => esc_html__( 'This Widget will be display on Above Footer area', 'accelerated-mobile-pages' ),
[6230] Fix | Delete
'class'=>'w-bl',
[6231] Fix | Delete
'before_widget' => '<div class="w-bl">',
[6232] Fix | Delete
'after_widget' => '</div>',
[6233] Fix | Delete
'before_title' => '<h4>',
[6234] Fix | Delete
'after_title' => '</h4>',
[6235] Fix | Delete
) );
[6236] Fix | Delete
if(ampforwp_design_selector()==4 || ampforwp_design_selector()==3 || ampforwp_design_selector()==2 || ampforwp_design_selector()==1){
[6237] Fix | Delete
register_sidebar( array(
[6238] Fix | Delete
'name' => esc_html__( 'AMP Footer', 'accelerated-mobile-pages' ),
[6239] Fix | Delete
'id' => 'swift-footer-widget-area',
[6240] Fix | Delete
'description' => esc_html__( 'The Footer widget area', 'accelerated-mobile-pages' ),
[6241] Fix | Delete
'class'=>'w-bl',
[6242] Fix | Delete
'before_widget' => '<div class="w-bl">',
[6243] Fix | Delete
'after_widget' => '</div>',
[6244] Fix | Delete
'before_title' => '<h4>',
[6245] Fix | Delete
'after_title' => '</h4>',
[6246] Fix | Delete
) );
[6247] Fix | Delete
if(true == ampforwp_get_setting('gnrl-sidebar')){
[6248] Fix | Delete
register_sidebar( array(
[6249] Fix | Delete
'name' => esc_html__( 'AMP Sidebar', 'accelerated-mobile-pages' ),
[6250] Fix | Delete
'id' => 'swift-sidebar',
[6251] Fix | Delete
'description' => esc_html__( 'The Swift Sidebar', 'accelerated-mobile-pages' ),
[6252] Fix | Delete
'class'=>'amp-sidebar',
[6253] Fix | Delete
'before_widget' => '<div class="amp-sidebar">',
[6254] Fix | Delete
'after_widget' => '</div>',
[6255] Fix | Delete
'before_title' => '<h4>',
[6256] Fix | Delete
'after_title' => '</h4>',
[6257] Fix | Delete
) );
[6258] Fix | Delete
}
[6259] Fix | Delete
}
[6260] Fix | Delete
}
[6261] Fix | Delete
add_action( 'init', 'swifttheme_footer_widgets_init' );
[6262] Fix | Delete
[6263] Fix | Delete
// AMP Takeover
[6264] Fix | Delete
function ampforwp_is_non_amp( $type="" ) {
[6265] Fix | Delete
global $redux_builder_amp;
[6266] Fix | Delete
$non_amp = false;
[6267] Fix | Delete
$ampforwp_amp_post_on_off_meta = $post_id = '';
[6268] Fix | Delete
$post_id = get_the_ID();
[6269] Fix | Delete
if ( ampforwp_is_front_page() ) {
[6270] Fix | Delete
$post_id = ampforwp_get_frontpage_id();
[6271] Fix | Delete
}
[6272] Fix | Delete
if ( false !== get_query_var( 'amp', false ) ) {
[6273] Fix | Delete
return false;
[6274] Fix | Delete
}
[6275] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[6276] Fix | Delete
if (""===$type && (ampforwp_get_setting('ampforwp-amp-takeover') || $mob_pres_link == true) ) {
[6277] Fix | Delete
$non_amp = true;
[6278] Fix | Delete
[6279] Fix | Delete
[6280] Fix | Delete
// Check for Posts
[6281] Fix | Delete
if ( is_single() && false == ampforwp_get_setting('amp-on-off-for-all-posts') ) {
[6282] Fix | Delete
return false;
[6283] Fix | Delete
}
[6284] Fix | Delete
// Archives
[6285] Fix | Delete
if ( is_archive() && false == ampforwp_get_setting('ampforwp-archive-support') ) {
[6286] Fix | Delete
return false;
[6287] Fix | Delete
}
[6288] Fix | Delete
// Pages
[6289] Fix | Delete
if ( is_page() && false == ampforwp_get_setting('amp-on-off-for-all-pages') ) {
[6290] Fix | Delete
return false;
[6291] Fix | Delete
}
[6292] Fix | Delete
//Blogpage
[6293] Fix | Delete
$page_for_posts = intval(get_option( 'page_for_posts' ));
[6294] Fix | Delete
if ( $page_for_posts == ampforwp_get_the_ID() ) {
[6295] Fix | Delete
return true;
[6296] Fix | Delete
}
[6297] Fix | Delete
// Homepage
[6298] Fix | Delete
if ( is_home() && false == ampforwp_get_setting('ampforwp-homepage-on-off-support') ) {
[6299] Fix | Delete
return false;
[6300] Fix | Delete
}
[6301] Fix | Delete
// Search #2681
[6302] Fix | Delete
if ( is_search() && ( (4 == ampforwp_get_setting('amp-design-selector') && false == ampforwp_get_setting('amp-swift-search-feature') ) ) ){
[6303] Fix | Delete
return false;
[6304] Fix | Delete
}
[6305] Fix | Delete
//Removed AMP Takeover when custom 404 Page is selected in enfold theme #4723
[6306] Fix | Delete
if ( function_exists('avia_preload_screen') && !empty(avia_get_option('error404_page')) && is_404() ) {
[6307] Fix | Delete
return false;
[6308] Fix | Delete
}
[6309] Fix | Delete
// Enabling AMP Takeover only when selected in Custom Post Type
[6310] Fix | Delete
$supported_types_for_takeover = array();
[6311] Fix | Delete
$supported_types_for_takeover = ampforwp_get_all_post_types();
[6312] Fix | Delete
if( $supported_types_for_takeover ){
[6313] Fix | Delete
$current_type = get_post_type(get_the_ID());
[6314] Fix | Delete
if( $current_type==false){
[6315] Fix | Delete
$non_amp = true;
[6316] Fix | Delete
}else{
[6317] Fix | Delete
if(!in_array($current_type, $supported_types_for_takeover) && !is_404() && !is_search()){
[6318] Fix | Delete
return ;
[6319] Fix | Delete
}
[6320] Fix | Delete
}
[6321] Fix | Delete
}
[6322] Fix | Delete
if ( is_front_page() && false == ampforwp_get_setting('ampforwp-homepage-on-off-support') ) {
[6323] Fix | Delete
return false;
[6324] Fix | Delete
}
[6325] Fix | Delete
if ( is_feed() ) {
[6326] Fix | Delete
return false;
[6327] Fix | Delete
}
[6328] Fix | Delete
if(get_query_var( 'robots' )){
[6329] Fix | Delete
return;
[6330] Fix | Delete
}
[6331] Fix | Delete
if ( function_exists('is_embed') && is_embed() ){
[6332] Fix | Delete
return;
[6333] Fix | Delete
}
[6334] Fix | Delete
if(is_search() && 0 == ampforwp_get_setting('amp-redirection-search')){
[6335] Fix | Delete
return false;
[6336] Fix | Delete
}
[6337] Fix | Delete
}elseif( (
[6338] Fix | Delete
ampforwp_get_setting('amp-design-selector') == 4)
[6339] Fix | Delete
&&
[6340] Fix | Delete
(
[6341] Fix | Delete
true == ampforwp_get_setting('ampforwp-amp-convert-to-wp')
[6342] Fix | Delete
)
[6343] Fix | Delete
||
[6344] Fix | Delete
(
[6345] Fix | Delete
'non_amp_check_convert' === $type
[6346] Fix | Delete
&& true == ampforwp_get_setting('ampforwp-amp-convert-to-wp')
[6347] Fix | Delete
) ) {
[6348] Fix | Delete
$non_amp = true;
[6349] Fix | Delete
[6350] Fix | Delete
}
[6351] Fix | Delete
// Convert AMP to WP issues fixed #2493
[6352] Fix | Delete
//Blogposts
[6353] Fix | Delete
if ( is_home() && ampforwp_get_setting('ampforwp-homepage-on-off-support') == false ) {
[6354] Fix | Delete
return;
[6355] Fix | Delete
}
[6356] Fix | Delete
// Pages
[6357] Fix | Delete
[6358] Fix | Delete
if ( is_page() && false == ampforwp_get_setting('amp-on-off-for-all-pages') ) {
[6359] Fix | Delete
return;
[6360] Fix | Delete
}
[6361] Fix | Delete
if ( is_singular() || ampforwp_is_front_page() || ampforwp_is_blog() ) {
[6362] Fix | Delete
$ampforwp_amp_post_on_off_meta = get_post_meta( $post_id,'ampforwp-amp-on-off',true);
[6363] Fix | Delete
if($ampforwp_amp_post_on_off_meta == 'hide-amp'){
[6364] Fix | Delete
return false;
[6365] Fix | Delete
}
[6366] Fix | Delete
}
[6367] Fix | Delete
// Removing the AMP on login register etc of Theme My Login plugin
[6368] Fix | Delete
[6369] Fix | Delete
if (function_exists('tml_register_default_actions')){
[6370] Fix | Delete
$tml_pages = tml_get_actions();
[6371] Fix | Delete
$pages = array();
[6372] Fix | Delete
if ( isset($tml_pages) && $tml_pages ) {
[6373] Fix | Delete
foreach ($tml_pages as $page) {
[6374] Fix | Delete
$pages[] = $page->get_slug();
[6375] Fix | Delete
}
[6376] Fix | Delete
}
[6377] Fix | Delete
if(in_array(get_query_var('action'), $pages) ){
[6378] Fix | Delete
return false;
[6379] Fix | Delete
}
[6380] Fix | Delete
}
[6381] Fix | Delete
return $non_amp;
[6382] Fix | Delete
}
[6383] Fix | Delete
function ampforwp_mobile_redirect_preseve_link(){
[6384] Fix | Delete
$redirectToAMP = false;
[6385] Fix | Delete
if(ampforwp_get_setting('amp-mobile-redirection') == true && ampforwp_get_setting('amp-mob-redirection-pres-link') == true){
[6386] Fix | Delete
require_once AMPFORWP_PLUGIN_DIR.'/includes/vendor/Mobile_Detect.php';
[6387] Fix | Delete
$mobile_detect = new AMPforWP_Mobile_Detect;
[6388] Fix | Delete
$isMobile = $mobile_detect->isMobile();
[6389] Fix | Delete
$isTablet = $mobile_detect->isTablet();
[6390] Fix | Delete
$isTabletUserAction = ampforwp_get_setting('amp-tablet-redirection');
[6391] Fix | Delete
if( $isMobile && $isTabletUserAction && $isTablet ){ //Only For tablet
[6392] Fix | Delete
$redirectToAMP = true;
[6393] Fix | Delete
}else if($isMobile && !$isTablet){ // Only for mobile
[6394] Fix | Delete
$redirectToAMP = true;
[6395] Fix | Delete
}
[6396] Fix | Delete
}
[6397] Fix | Delete
return $redirectToAMP;
[6398] Fix | Delete
}
[6399] Fix | Delete
// Remove wpautop from specific posts which contain amp-components
[6400] Fix | Delete
add_action('pre_amp_render_post','ampforwp_custom_wpautop');
[6401] Fix | Delete
function ampforwp_custom_wpautop(){
[6402] Fix | Delete
if ( is_single() ) {
[6403] Fix | Delete
if ( get_post_meta(get_the_ID(), 'ampforwp-wpautop', true) == 'false') {
[6404] Fix | Delete
remove_filter('the_content', 'wpautop');
[6405] Fix | Delete
}
[6406] Fix | Delete
}
[6407] Fix | Delete
if(function_exists('ubermenu_get_nav_menu_args')){
[6408] Fix | Delete
add_filter( 'ubermenu_nav_menu_args' ,'ampforwp_modify_ubermenu_nav_menu_args' , 10,2);
[6409] Fix | Delete
}
[6410] Fix | Delete
}
[6411] Fix | Delete
function ampforwp_modify_ubermenu_nav_menu_args($args , $config_id){
[6412] Fix | Delete
$args['menu_class'] = 'amp-menu '.$args['menu_class'];
[6413] Fix | Delete
return $args;
[6414] Fix | Delete
}
[6415] Fix | Delete
// Backward Compatibility for AMP Preview #1529
[6416] Fix | Delete
if ( ! function_exists('get_preview_post_link') ) {
[6417] Fix | Delete
function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) {
[6418] Fix | Delete
$post = get_post( $post );
[6419] Fix | Delete
if ( ! $post ) {
[6420] Fix | Delete
return;
[6421] Fix | Delete
}
[6422] Fix | Delete
[6423] Fix | Delete
$post_type_object = get_post_type_object( $post->post_type );
[6424] Fix | Delete
if ( is_post_type_viewable( $post_type_object ) ) {
[6425] Fix | Delete
if ( ! $preview_link ) {
[6426] Fix | Delete
$preview_link = set_url_scheme( get_permalink( $post ) );
[6427] Fix | Delete
}
[6428] Fix | Delete
[6429] Fix | Delete
$query_args['preview'] = 'true';
[6430] Fix | Delete
$preview_link = add_query_arg( $query_args, $preview_link );
[6431] Fix | Delete
}
[6432] Fix | Delete
return apply_filters( 'preview_post_link', $preview_link, $post );
[6433] Fix | Delete
}
[6434] Fix | Delete
}
[6435] Fix | Delete
[6436] Fix | Delete
// Homepage Loop Modifier #1701
[6437] Fix | Delete
add_filter('ampforwp_query_args','ampforwp_homepage_loop');
[6438] Fix | Delete
function ampforwp_homepage_loop( $args ) {
[6439] Fix | Delete
global $redux_builder_amp;
[6440] Fix | Delete
if ( is_home() ) {
[6441] Fix | Delete
$post_type = 'post';
[6442] Fix | Delete
// Check if Custom Post Type is selected
[6443] Fix | Delete
if ('' != ampforwp_get_setting('ampforwp-homepage-loop-type') ) {
[6444] Fix | Delete
$post_type = ampforwp_get_setting('ampforwp-homepage-loop-type');
[6445] Fix | Delete
}
[6446] Fix | Delete
$args['post_type'] = $post_type;
[6447] Fix | Delete
// Exclude Categories if any selected
[6448] Fix | Delete
if ('' != ampforwp_get_setting('ampforwp-homepage-loop-cats') ) {
[6449] Fix | Delete
$args['category__not_in'] = ampforwp_get_setting('ampforwp-homepage-loop-cats');
[6450] Fix | Delete
}
[6451] Fix | Delete
}
[6452] Fix | Delete
if(function_exists('ampforwp_is_home') && ampforwp_is_home() && isset($redux_builder_amp['amp-no-of-posts-home-page'])){
[6453] Fix | Delete
$args['posts_per_page'] = $redux_builder_amp['amp-no-of-posts-home-page'];
[6454] Fix | Delete
}
[6455] Fix | Delete
if(function_exists('is_category') && is_category() && isset($redux_builder_amp['amp-no-of-posts-cat-page'])){
[6456] Fix | Delete
$args['posts_per_archive_page'] = $redux_builder_amp['amp-no-of-posts-cat-page'];
[6457] Fix | Delete
}
[6458] Fix | Delete
return $args;
[6459] Fix | Delete
}
[6460] Fix | Delete
[6461] Fix | Delete
//To modify number of posts #5503
[6462] Fix | Delete
add_filter( 'pre_get_posts', 'ampforwp_modify_no_of_posts' );
[6463] Fix | Delete
function ampforwp_modify_no_of_posts( $query ) {
[6464] Fix | Delete
global $redux_builder_amp;
[6465] Fix | Delete
$amp_q_ck = is_object($query) ? $query->query : '';
[6466] Fix | Delete
if(isset($amp_q_ck['amp']) && $amp_q_ck['amp'] == 1){
[6467] Fix | Delete
if(function_exists('ampforwp_is_home') && ampforwp_is_home() && isset($redux_builder_amp['amp-no-of-posts-home-page'])){
[6468] Fix | Delete
$query->set( 'posts_per_page', $redux_builder_amp['amp-no-of-posts-home-page']);
[6469] Fix | Delete
}
[6470] Fix | Delete
if(function_exists('is_category') && is_category() && isset($redux_builder_amp['amp-no-of-posts-cat-page'])){
[6471] Fix | Delete
$query->set( 'posts_per_page', $redux_builder_amp['amp-no-of-posts-cat-page']);
[6472] Fix | Delete
}
[6473] Fix | Delete
}
[6474] Fix | Delete
}
[6475] Fix | Delete
[6476] Fix | Delete
// To get correct comments count #1662
[6477] Fix | Delete
add_filter('get_comments_number', 'ampforwp_comment_count', 0);
[6478] Fix | Delete
function ampforwp_comment_count( $count ) {
[6479] Fix | Delete
[6480] Fix | Delete
/* TODO: Allowed memory size exhausted #1865
[6481] Fix | Delete
get_comments() was trying to access by Id and because the ID is not present on amp frontpages. It is getting exhausted. Need to recreate issue and validate the hypothesis
[6482] Fix | Delete
*/
[6483] Fix | Delete
[6484] Fix | Delete
if ( ! is_admin() && function_exists('ampforwp_is_amp_endpoint') && ampforwp_is_amp_endpoint() && is_single() ) {
[6485] Fix | Delete
global $id;
[6486] Fix | Delete
$get_comments = get_comments('status=approve&post_id=' . $id);
[6487] Fix | Delete
$comments_by_type = separate_comments($get_comments);
[6488] Fix | Delete
return count($comments_by_type['comment']);
[6489] Fix | Delete
}
[6490] Fix | Delete
else {
[6491] Fix | Delete
return $count;
[6492] Fix | Delete
}
[6493] Fix | Delete
}
[6494] Fix | Delete
// Glue underline css compatibility #1743 #1932
[6495] Fix | Delete
add_action('amp_post_template_css', 'ampforwp_glue_css_comp', PHP_INT_MAX );
[6496] Fix | Delete
if ( ! function_exists('ampforwp_glue_css_comp') ) {
[6497] Fix | Delete
function ampforwp_glue_css_comp() {
[6498] Fix | Delete
global $redux_builder_amp;
[6499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function