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
$element = $video_nodes->item( $i );
[3000] Fix | Delete
$source = $element->childNodes->item(0);
[3001] Fix | Delete
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
[3002] Fix | Delete
$source = $element->childNodes->item(1);
[3003] Fix | Delete
if($source)
[3004] Fix | Delete
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
[3005] Fix | Delete
}
[3006] Fix | Delete
}
[3007] Fix | Delete
$audio = $dom->getElementsByTagName( 'amp-audio' );
[3008] Fix | Delete
$num_nodes = $audio->length;
[3009] Fix | Delete
if ( 0 !== $num_nodes ) {
[3010] Fix | Delete
for ( $i = 0; $i < $audio->length; ++$i ) {
[3011] Fix | Delete
$element = $audio->item( $i );
[3012] Fix | Delete
$source = $element->childNodes->item(0);
[3013] Fix | Delete
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
[3014] Fix | Delete
$source = $element->childNodes->item(1);
[3015] Fix | Delete
$source->setAttribute('src',preg_replace('#^http?:#', '', $source->getAttribute('src') ));
[3016] Fix | Delete
}
[3017] Fix | Delete
}
[3018] Fix | Delete
$content = AMP_DOM_Utils::get_content_from_dom($dom);
[3019] Fix | Delete
return $content;
[3020] Fix | Delete
}
[3021] Fix | Delete
[3022] Fix | Delete
function ampforwp_sidebar_blacklist_tags($tags) {
[3023] Fix | Delete
$form = array_search('form', $tags);
[3024] Fix | Delete
$input = array_search('input', $tags);
[3025] Fix | Delete
$label = array_search('label', $tags);
[3026] Fix | Delete
$textarea = array_search('textarea', $tags);
[3027] Fix | Delete
$select = array_search('select', $tags);
[3028] Fix | Delete
$option = array_search('option', $tags);
[3029] Fix | Delete
if ( $input ) {
[3030] Fix | Delete
unset($tags[$input]);
[3031] Fix | Delete
}
[3032] Fix | Delete
if ( $label ) {
[3033] Fix | Delete
unset($tags[$label]);
[3034] Fix | Delete
}
[3035] Fix | Delete
if ( $textarea ) { unset($tags[$textarea]); }
[3036] Fix | Delete
if ( $select ) { unset($tags[$select]); }
[3037] Fix | Delete
if ( $option ) { unset($tags[$option]); }
[3038] Fix | Delete
return $tags;
[3039] Fix | Delete
}
[3040] Fix | Delete
// Sidebar Scripts
[3041] Fix | Delete
add_filter( 'amp_post_template_data', 'ampforwp_add_sidebar_data', 85 );
[3042] Fix | Delete
function ampforwp_add_sidebar_data( $data ) {
[3043] Fix | Delete
$sanitized_data_above_loop = '';
[3044] Fix | Delete
$sanitized_data_below_loop = '';
[3045] Fix | Delete
$sanitized_data_below_header = '';
[3046] Fix | Delete
$sanitized_data_above_footer = '';
[3047] Fix | Delete
$sanitized_data_swift_sidebar = '';
[3048] Fix | Delete
$sanitized_data_swift_footer = '';
[3049] Fix | Delete
// Get the Data
[3050] Fix | Delete
$sanitized_data_above_loop = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
[3051] Fix | Delete
$sanitized_data_below_loop = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
[3052] Fix | Delete
$sanitized_data_below_header = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
[3053] Fix | Delete
$sanitized_data_above_footer = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
[3054] Fix | Delete
$sanitized_data_swift_sidebar = ampforwp_sidebar_content_sanitizer('swift-sidebar');
[3055] Fix | Delete
$sanitized_data_swift_footer = ampforwp_sidebar_content_sanitizer('swift-footer-widget-area');
[3056] Fix | Delete
[3057] Fix | Delete
if ( $sanitized_data_above_loop ) {
[3058] Fix | Delete
// Add Scripts
[3059] Fix | Delete
if ( $sanitized_data_above_loop->get_amp_scripts() ) {
[3060] Fix | Delete
foreach ($sanitized_data_above_loop->get_amp_scripts() as $key => $value ) {
[3061] Fix | Delete
if( empty( $data['amp_component_scripts'][$key] ) ){
[3062] Fix | Delete
$data['amp_component_scripts'][$key] = $value;
[3063] Fix | Delete
}
[3064] Fix | Delete
}
[3065] Fix | Delete
}
[3066] Fix | Delete
// Form script #1400
[3067] Fix | Delete
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_above_loop->get_amp_content());
[3068] Fix | Delete
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
[3069] Fix | Delete
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
[3070] Fix | Delete
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
[3071] Fix | Delete
}
[3072] Fix | Delete
}
[3073] Fix | Delete
// Add Styles
[3074] Fix | Delete
if ( $sanitized_data_above_loop->get_amp_styles() ) {
[3075] Fix | Delete
foreach ($sanitized_data_above_loop->get_amp_styles() as $key => $value ) {
[3076] Fix | Delete
if( empty( $data['post_amp_styles'][$key] ) ){
[3077] Fix | Delete
$data['post_amp_styles'][$key] = $value;
[3078] Fix | Delete
}
[3079] Fix | Delete
}
[3080] Fix | Delete
}
[3081] Fix | Delete
}
[3082] Fix | Delete
if ( $sanitized_data_below_loop ) {
[3083] Fix | Delete
// Add Scripts
[3084] Fix | Delete
if ( $sanitized_data_below_loop->get_amp_scripts() ) {
[3085] Fix | Delete
foreach ($sanitized_data_below_loop->get_amp_scripts() as $key => $value ) {
[3086] Fix | Delete
if( empty( $data['amp_component_scripts'][$key] ) ){
[3087] Fix | Delete
$data['amp_component_scripts'][$key] = $value;
[3088] Fix | Delete
}
[3089] Fix | Delete
}
[3090] Fix | Delete
}
[3091] Fix | Delete
// Form script #1400
[3092] Fix | Delete
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_below_loop->get_amp_content());
[3093] Fix | Delete
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
[3094] Fix | Delete
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
[3095] Fix | Delete
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
[3096] Fix | Delete
}
[3097] Fix | Delete
}
[3098] Fix | Delete
// Add Styles
[3099] Fix | Delete
if ( $sanitized_data_below_loop->get_amp_styles() ) {
[3100] Fix | Delete
foreach ($sanitized_data_below_loop->get_amp_styles() as $key => $value ) {
[3101] Fix | Delete
if( empty( $data['post_amp_styles'][$key] ) ){
[3102] Fix | Delete
$data['post_amp_styles'][$key] = $value;
[3103] Fix | Delete
}
[3104] Fix | Delete
}
[3105] Fix | Delete
}
[3106] Fix | Delete
}
[3107] Fix | Delete
if ( $sanitized_data_below_header ) {
[3108] Fix | Delete
// Add Scripts
[3109] Fix | Delete
if ( $sanitized_data_below_header->get_amp_scripts() ) {
[3110] Fix | Delete
foreach ($sanitized_data_below_header->get_amp_scripts() as $key => $value ) {
[3111] Fix | Delete
if( empty( $data['amp_component_scripts'][$key] ) ){
[3112] Fix | Delete
$data['amp_component_scripts'][$key] = $value;
[3113] Fix | Delete
}
[3114] Fix | Delete
}
[3115] Fix | Delete
}
[3116] Fix | Delete
// Form script #1400
[3117] Fix | Delete
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_below_header->get_amp_content());
[3118] Fix | Delete
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
[3119] Fix | Delete
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
[3120] Fix | Delete
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
[3121] Fix | Delete
}
[3122] Fix | Delete
}
[3123] Fix | Delete
// Add Styles
[3124] Fix | Delete
if ( $sanitized_data_below_header->get_amp_styles() ) {
[3125] Fix | Delete
foreach ($sanitized_data_below_header->get_amp_styles() as $key => $value ) {
[3126] Fix | Delete
if( empty( $data['post_amp_styles'][$key] ) ){
[3127] Fix | Delete
$data['post_amp_styles'][$key] = $value;
[3128] Fix | Delete
}
[3129] Fix | Delete
}
[3130] Fix | Delete
}
[3131] Fix | Delete
}
[3132] Fix | Delete
if ( $sanitized_data_above_footer ) {
[3133] Fix | Delete
// Add Scripts
[3134] Fix | Delete
if ( $sanitized_data_above_footer->get_amp_scripts() ) {
[3135] Fix | Delete
foreach ($sanitized_data_above_footer->get_amp_scripts() as $key => $value ) {
[3136] Fix | Delete
if( empty( $data['amp_component_scripts'][$key] ) ){
[3137] Fix | Delete
$data['amp_component_scripts'][$key] = $value;
[3138] Fix | Delete
}
[3139] Fix | Delete
}
[3140] Fix | Delete
}
[3141] Fix | Delete
// Form script #1400
[3142] Fix | Delete
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_above_footer->get_amp_content());
[3143] Fix | Delete
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
[3144] Fix | Delete
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
[3145] Fix | Delete
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
[3146] Fix | Delete
}
[3147] Fix | Delete
}
[3148] Fix | Delete
// Add Styles
[3149] Fix | Delete
if ( $sanitized_data_above_footer->get_amp_styles() ) {
[3150] Fix | Delete
foreach ($sanitized_data_above_footer->get_amp_styles() as $key => $value ) {
[3151] Fix | Delete
if( empty( $data['post_amp_styles'][$key] ) ){
[3152] Fix | Delete
$data['post_amp_styles'][$key] = $value;
[3153] Fix | Delete
}
[3154] Fix | Delete
}
[3155] Fix | Delete
}
[3156] Fix | Delete
}
[3157] Fix | Delete
if ( $sanitized_data_swift_sidebar ) {
[3158] Fix | Delete
// Add Scripts
[3159] Fix | Delete
if ( $sanitized_data_swift_sidebar->get_amp_scripts() ) {
[3160] Fix | Delete
foreach ($sanitized_data_swift_sidebar->get_amp_scripts() as $key => $value ) {
[3161] Fix | Delete
if( empty( $data['amp_component_scripts'][$key] ) ){
[3162] Fix | Delete
$data['amp_component_scripts'][$key] = $value;
[3163] Fix | Delete
}
[3164] Fix | Delete
}
[3165] Fix | Delete
}
[3166] Fix | Delete
// Form script #1400
[3167] Fix | Delete
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_swift_sidebar->get_amp_content());
[3168] Fix | Delete
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
[3169] Fix | Delete
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
[3170] Fix | Delete
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
[3171] Fix | Delete
}
[3172] Fix | Delete
}
[3173] Fix | Delete
// Add Styles
[3174] Fix | Delete
if ( $sanitized_data_swift_sidebar->get_amp_styles() ) {
[3175] Fix | Delete
foreach ($sanitized_data_swift_sidebar->get_amp_styles() as $key => $value ) {
[3176] Fix | Delete
if( empty( $data['post_amp_styles'][$key] ) ){
[3177] Fix | Delete
$data['post_amp_styles'][$key] = $value;
[3178] Fix | Delete
}
[3179] Fix | Delete
}
[3180] Fix | Delete
}
[3181] Fix | Delete
}
[3182] Fix | Delete
if ( $sanitized_data_swift_footer ) {
[3183] Fix | Delete
// Add Scripts
[3184] Fix | Delete
if ( $sanitized_data_swift_footer->get_amp_scripts() ) {
[3185] Fix | Delete
foreach ($sanitized_data_swift_footer->get_amp_scripts() as $key => $value ) {
[3186] Fix | Delete
if( empty( $data['amp_component_scripts'][$key] ) ){
[3187] Fix | Delete
$data['amp_component_scripts'][$key] = $value;
[3188] Fix | Delete
}
[3189] Fix | Delete
}
[3190] Fix | Delete
}
[3191] Fix | Delete
// Form script #1400
[3192] Fix | Delete
$dom = AMP_DOM_Utils::get_dom_from_content($sanitized_data_swift_footer->get_amp_content());
[3193] Fix | Delete
if ( 0 !== $dom->getElementsByTagName( 'form' )->length ) {
[3194] Fix | Delete
if( empty( $data['amp_component_scripts']['amp-form'] ) ){
[3195] Fix | Delete
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
[3196] Fix | Delete
}
[3197] Fix | Delete
}
[3198] Fix | Delete
// Add Styles
[3199] Fix | Delete
if ( $sanitized_data_swift_footer->get_amp_styles() ) {
[3200] Fix | Delete
foreach ($sanitized_data_swift_footer->get_amp_styles() as $key => $value ) {
[3201] Fix | Delete
if( empty( $data['post_amp_styles'][$key] ) ){
[3202] Fix | Delete
$data['post_amp_styles'][$key] = $value;
[3203] Fix | Delete
}
[3204] Fix | Delete
}
[3205] Fix | Delete
}
[3206] Fix | Delete
}
[3207] Fix | Delete
return $data;
[3208] Fix | Delete
}
[3209] Fix | Delete
// 44. auto adding /amp for the menu
[3210] Fix | Delete
add_action('amp_init','ampforwp_auto_add_amp_menu_link_insert');
[3211] Fix | Delete
function ampforwp_auto_add_amp_menu_link_insert() {
[3212] Fix | Delete
add_action( 'pre_amp_render_post', 'ampforwp_auto_add_amp_in_link_check', 99 );
[3213] Fix | Delete
}
[3214] Fix | Delete
[3215] Fix | Delete
function ampforwp_auto_add_amp_in_link_check() {
[3216] Fix | Delete
$ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
[3217] Fix | Delete
$add_amp_menu = get_transient('ampforwp_auto_add_amp_in_menu_link');
[3218] Fix | Delete
if ( false == $add_amp_menu || ( 'on' && 0 == ampforwp_get_setting('ampforwp-auto-amp-menu-link') ) ) {
[3219] Fix | Delete
delete_transient('ampforwp_header_menu');
[3220] Fix | Delete
delete_transient('ampforwp_footer_menu');
[3221] Fix | Delete
set_transient('ampforwp_auto_add_amp_in_menu_link', 'off');
[3222] Fix | Delete
}
[3223] Fix | Delete
if ( $ampforwp_is_amp_endpoint && ampforwp_get_setting('ampforwp-auto-amp-menu-link') == 1 ) {
[3224] Fix | Delete
if( 'off' == $add_amp_menu ) {
[3225] Fix | Delete
delete_transient('ampforwp_header_menu');
[3226] Fix | Delete
delete_transient('ampforwp_footer_menu');
[3227] Fix | Delete
set_transient('ampforwp_auto_add_amp_in_menu_link', 'on');
[3228] Fix | Delete
}
[3229] Fix | Delete
add_filter( 'nav_menu_link_attributes', 'ampforwp_auto_add_amp_in_menu_link', 10, 3 );
[3230] Fix | Delete
}
[3231] Fix | Delete
}
[3232] Fix | Delete
[3233] Fix | Delete
function ampforwp_auto_add_amp_in_menu_link( $atts, $item, $args ) {
[3234] Fix | Delete
if($item->type=='post_type' && !in_array($item->object, ampforwp_get_all_post_types()) ){
[3235] Fix | Delete
return $atts;
[3236] Fix | Delete
}
[3237] Fix | Delete
if($item->type=='taxonomy' && !in_array($item->object, ampforwp_get_all_post_types()) ){
[3238] Fix | Delete
return $atts;
[3239] Fix | Delete
}
[3240] Fix | Delete
$mob_pres_link = false;
[3241] Fix | Delete
if(function_exists('ampforwp_mobile_redirect_preseve_link')){
[3242] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[3243] Fix | Delete
}
[3244] Fix | Delete
if(ampforwp_get_setting('ampforwp-amp-takeover') || $mob_pres_link == true){
[3245] Fix | Delete
return $atts;
[3246] Fix | Delete
}
[3247] Fix | Delete
$url = $atts['href'];
[3248] Fix | Delete
if($url){
[3249] Fix | Delete
$is_external = ampforwp_isexternal($url);
[3250] Fix | Delete
}
[3251] Fix | Delete
if($is_external){
[3252] Fix | Delete
return $atts;
[3253] Fix | Delete
}
[3254] Fix | Delete
if(ampforwp_get_setting('amp-core-end-point') == 1 ){
[3255] Fix | Delete
$atts['href'] = user_trailingslashit(trailingslashit( $atts['href'] ) );
[3256] Fix | Delete
$atts['href'] = add_query_arg(AMPFORWP_AMP_QUERY_VAR,'1', $atts['href']);
[3257] Fix | Delete
}
[3258] Fix | Delete
else{
[3259] Fix | Delete
if(false === strpos($atts['href'], "#")){
[3260] Fix | Delete
$atts['href'] = user_trailingslashit(trailingslashit( $atts['href'] ) . AMPFORWP_AMP_QUERY_VAR);
[3261] Fix | Delete
}
[3262] Fix | Delete
}
[3263] Fix | Delete
[3264] Fix | Delete
$atts = apply_filters('ampforwp_auto_add_amp_menu_url',$atts);
[3265] Fix | Delete
[3266] Fix | Delete
return $atts;
[3267] Fix | Delete
}
[3268] Fix | Delete
[3269] Fix | Delete
// 45. searchpage, frontpage, homepage structured data
[3270] Fix | Delete
// Moved to structured-data-functions.php
[3271] Fix | Delete
[3272] Fix | Delete
// 46. search search search everywhere #615
[3273] Fix | Delete
require 'search-functions.php';
[3274] Fix | Delete
[3275] Fix | Delete
// 47. social js properly adding when required
[3276] Fix | Delete
if( !function_exists( 'is_socialshare_or_socialsticky_enabled_in_ampforwp' ) ) {
[3277] Fix | Delete
function is_socialshare_or_socialsticky_enabled_in_ampforwp() {
[3278] Fix | Delete
global $redux_builder_amp;
[3279] Fix | Delete
if( $redux_builder_amp['enable-single-facebook-share'] ||
[3280] Fix | Delete
$redux_builder_amp['enable-single-twitter-share'] ||
[3281] Fix | Delete
$redux_builder_amp['enable-single-email-share'] ||
[3282] Fix | Delete
$redux_builder_amp['enable-single-pinterest-share'] ||
[3283] Fix | Delete
$redux_builder_amp['enable-single-linkedin-share'] ) {
[3284] Fix | Delete
return true;
[3285] Fix | Delete
}
[3286] Fix | Delete
return false;
[3287] Fix | Delete
}
[3288] Fix | Delete
}
[3289] Fix | Delete
[3290] Fix | Delete
// 48. Remove all unwanted scripts on search pages
[3291] Fix | Delete
add_filter( 'amp_post_template_data', 'ampforwp_remove_scripts_search_page' );
[3292] Fix | Delete
function ampforwp_remove_scripts_search_page( $data ) {
[3293] Fix | Delete
if( is_search() ) {
[3294] Fix | Delete
// Remove all unwanted scripts on search pages
[3295] Fix | Delete
unset( $data['amp_component_scripts']);
[3296] Fix | Delete
}
[3297] Fix | Delete
return $data;
[3298] Fix | Delete
}
[3299] Fix | Delete
[3300] Fix | Delete
// 49. Properly adding ad Script the AMP way
[3301] Fix | Delete
// Moved to ads-functions.php
[3302] Fix | Delete
[3303] Fix | Delete
// internal function for checing if social profiles have been set
[3304] Fix | Delete
if( !function_exists('ampforwp_checking_any_social_profiles') ) {
[3305] Fix | Delete
function ampforwp_checking_any_social_profiles() {
[3306] Fix | Delete
global $redux_builder_amp;
[3307] Fix | Delete
if(
[3308] Fix | Delete
$redux_builder_amp['enable-single-twittter-profile'] ||
[3309] Fix | Delete
$redux_builder_amp['enable-single-facebook-profile'] ||
[3310] Fix | Delete
$redux_builder_amp['enable-single-pintrest-profile'] ||
[3311] Fix | Delete
$redux_builder_amp['enable-single-google-plus-profile'] ||
[3312] Fix | Delete
$redux_builder_amp['enable-single-linkdin-profile'] ||
[3313] Fix | Delete
$redux_builder_amp['enable-single-youtube-profile'] ||
[3314] Fix | Delete
$redux_builder_amp['enable-single-instagram-profile'] ||
[3315] Fix | Delete
$redux_builder_amp['enable-single-VKontakte-profile'] ||
[3316] Fix | Delete
$redux_builder_amp['enable-single-reddit-profile'] ||
[3317] Fix | Delete
$redux_builder_amp['enable-single-snapchat-profile'] ||
[3318] Fix | Delete
$redux_builder_amp['enable-single-Tumblr-profile']
[3319] Fix | Delete
) {
[3320] Fix | Delete
return true;
[3321] Fix | Delete
}
[3322] Fix | Delete
return false;
[3323] Fix | Delete
}
[3324] Fix | Delete
}
[3325] Fix | Delete
[3326] Fix | Delete
// 50. Properly adding noditification Scritps the AMP way
[3327] Fix | Delete
// Moved to notice-bar-functions.php
[3328] Fix | Delete
[3329] Fix | Delete
//52. Adding a generalized sanitizer function for purifiying normal html to amp-html
[3330] Fix | Delete
function ampforwp_content_sanitizer( $content ) {
[3331] Fix | Delete
global $post;
[3332] Fix | Delete
$amp_custom_post_content_input = $content;
[3333] Fix | Delete
if ( !empty( $amp_custom_post_content_input ) ) {
[3334] Fix | Delete
$amp_custom_content = new AMPFORWP_Content( $amp_custom_post_content_input,
[3335] Fix | Delete
apply_filters( 'amp_content_embed_handlers', array(
[3336] Fix | Delete
'AMP_Reddit_Embed_Handler' => array(),
[3337] Fix | Delete
'AMP_Twitter_Embed_Handler' => array(),
[3338] Fix | Delete
'AMP_YouTube_Embed_Handler' => array(),
[3339] Fix | Delete
'AMP_Instagram_Embed_Handler' => array(),
[3340] Fix | Delete
'AMP_Vine_Embed_Handler' => array(),
[3341] Fix | Delete
'AMP_Facebook_Embed_Handler' => array(),
[3342] Fix | Delete
'AMP_Gallery_Embed_Handler' => array(),
[3343] Fix | Delete
'AMP_Tiktok_Embed_Handler'=>array(),
[3344] Fix | Delete
) ),
[3345] Fix | Delete
apply_filters( 'amp_content_sanitizers', array(
[3346] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[3347] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[3348] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[3349] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[3350] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[3351] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[3352] Fix | Delete
'add_placeholder' => true,
[3353] Fix | Delete
),
[3354] Fix | Delete
),$post )
[3355] Fix | Delete
);
[3356] Fix | Delete
[3357] Fix | Delete
if ( $amp_custom_content ) {
[3358] Fix | Delete
global $data;
[3359] Fix | Delete
$data = (array) $data;
[3360] Fix | Delete
$data['amp_component_scripts'] = $amp_custom_content->get_amp_scripts();
[3361] Fix | Delete
$data['post_amp_styles'] = $amp_custom_content->get_amp_styles();
[3362] Fix | Delete
return $amp_custom_content->get_amp_content();
[3363] Fix | Delete
}
[3364] Fix | Delete
return '';
[3365] Fix | Delete
}
[3366] Fix | Delete
}
[3367] Fix | Delete
[3368] Fix | Delete
[3369] Fix | Delete
//53. Removed AMP-WooCommerce Code and added it in AMP-WooCommerce #929
[3370] Fix | Delete
// Adding the styling for AMP Woocommerce latest Products(AMP-WooCommerce Widgets)
[3371] Fix | Delete
add_action('amp_post_template_css','amp_latest_products_styling',PHP_INT_MAX);
[3372] Fix | Delete
function amp_latest_products_styling() {
[3373] Fix | Delete
if ( class_exists( 'woocommerce' ) ) { ?>
[3374] Fix | Delete
.ampforwp_wc_shortcode{margin-top: 0;padding:0;display:inline-block;width: 100%;}
[3375] Fix | Delete
.ampforwp_wc_shortcode li{position: relative;width:29%; font-size:12px; line-height: 1; float: left;list-style-type: none;margin:2%;}
[3376] Fix | Delete
.ampforwp_wc_shortcode .onsale{position: absolute;top: 0;right: 0;background: #ddd;padding: 7px;font-size: 12px;}
[3377] Fix | Delete
.single-post .ampforwp_wc_shortcode li amp-img{margin:0}
[3378] Fix | Delete
.ampforwp-wc-title{margin: 8px 0px 10px 0px;font-size: 13px;}
[3379] Fix | Delete
.ampforwp-wc-price{color:#444}
[3380] Fix | Delete
.wc_widgettitle{text-align:center;margin-bottom: 0px;}
[3381] Fix | Delete
.ampforwp-wc-price, .ampforwp_wc_star_rating{float:left;margin-right: 10px;}
[3382] Fix | Delete
<?php }
[3383] Fix | Delete
}
[3384] Fix | Delete
[3385] Fix | Delete
// 54. Change the default values of post meta for AMP pages. #746
[3386] Fix | Delete
add_action('admin_head','ampforwp_change_default_amp_page_meta');
[3387] Fix | Delete
function ampforwp_change_default_amp_page_meta() {
[3388] Fix | Delete
if ( ! current_user_can('manage_options') ) {
[3389] Fix | Delete
return ;
[3390] Fix | Delete
}
[3391] Fix | Delete
global $redux_builder_amp;
[3392] Fix | Delete
$check_meta = get_option('ampforwp_default_pages_to');
[3393] Fix | Delete
$checker = 'show';
[3394] Fix | Delete
$control = $redux_builder_amp['amp-pages-meta-default'];
[3395] Fix | Delete
$meta_value_to_upate = 'default';
[3396] Fix | Delete
[3397] Fix | Delete
if ( $control === 'hide' ) {
[3398] Fix | Delete
$checker = 'hide';
[3399] Fix | Delete
$meta_value_to_upate = 'hide-amp';
[3400] Fix | Delete
}
[3401] Fix | Delete
[3402] Fix | Delete
// Check and Run only if the value has been changed, else return
[3403] Fix | Delete
if ( $check_meta === $checker ) {
[3404] Fix | Delete
return;
[3405] Fix | Delete
}
[3406] Fix | Delete
// Get all the pages and update the post meta
[3407] Fix | Delete
$pages = get_pages(array());
[3408] Fix | Delete
foreach($pages as $page){
[3409] Fix | Delete
update_post_meta($page->ID,'ampforwp-amp-on-off', $meta_value_to_upate);
[3410] Fix | Delete
}
[3411] Fix | Delete
// Update the option as the process has been done and update an option
[3412] Fix | Delete
update_option('ampforwp_default_pages_to', $checker);
[3413] Fix | Delete
return ;
[3414] Fix | Delete
}
[3415] Fix | Delete
[3416] Fix | Delete
[3417] Fix | Delete
// Adding the meta="description" from yoast or from the content
[3418] Fix | Delete
add_action('amp_post_template_head','ampforwp_meta_description');
[3419] Fix | Delete
function ampforwp_meta_description() {
[3420] Fix | Delete
global $redux_builder_amp;
[3421] Fix | Delete
if ( false == ampforwp_get_setting('ampforwp-seo-meta-desc') || ('rank_math' == ampforwp_get_setting('ampforwp-seo-selection') && is_singular() )) {
[3422] Fix | Delete
return;
[3423] Fix | Delete
}
[3424] Fix | Delete
if (function_exists('aioseo_pro_just_activated') && 'aioseo' == ampforwp_get_setting('ampforwp-seo-selection') ) {
[3425] Fix | Delete
return;
[3426] Fix | Delete
}
[3427] Fix | Delete
$desc = ampforwp_generate_meta_desc();
[3428] Fix | Delete
if ( $desc && !class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')) {
[3429] Fix | Delete
echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $desc ) ) ) .'"/>';
[3430] Fix | Delete
}else if(class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')){
[3431] Fix | Delete
$yoast_desc = addslashes( strip_tags( WPSEO_Meta::get_value('metadesc', ampforwp_get_the_ID() ) ) );
[3432] Fix | Delete
$yoast_desc_meta = get_option( 'wpseo_titles' );
[3433] Fix | Delete
if(isset($yoast_desc_meta['metadesc-page'])){
[3434] Fix | Delete
$yoast_desc_meta = $yoast_desc_meta['metadesc-page'];
[3435] Fix | Delete
}
[3436] Fix | Delete
if(empty($yoast_desc)){
[3437] Fix | Delete
$yoast_desc = $yoast_desc_meta;
[3438] Fix | Delete
}
[3439] Fix | Delete
if ($yoast_desc && ampforwp_is_front_page()) {
[3440] Fix | Delete
echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $yoast_desc ) ) ) .'"/>';
[3441] Fix | Delete
}
[3442] Fix | Delete
elseif ($desc && ampforwp_is_home() && 'page' == get_option( 'show_on_front') && empty(get_option( 'page_for_posts')) ){
[3443] Fix | Delete
echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $desc ) ) ) .'"/>';
[3444] Fix | Delete
}
[3445] Fix | Delete
}
[3446] Fix | Delete
}
[3447] Fix | Delete
// All in One Seo Compatibility #1557
[3448] Fix | Delete
if(defined( 'AIOSEO_VERSION' ) && version_compare(AIOSEO_VERSION,'4.0.0', '<')){
[3449] Fix | Delete
add_filter('aioseop_amp_description', '__return_false');
[3450] Fix | Delete
}
[3451] Fix | Delete
// 55. Call Now Button Feature added
[3452] Fix | Delete
add_action('ampforwp_call_button','ampforwp_call_button_html_output');
[3453] Fix | Delete
function ampforwp_call_button_html_output(){
[3454] Fix | Delete
global $redux_builder_amp;
[3455] Fix | Delete
if ( $redux_builder_amp['ampforwp-callnow-button'] ) { ?>
[3456] Fix | Delete
<div class="callnow">
[3457] Fix | Delete
<a href="tel:<?php echo esc_attr($redux_builder_amp['enable-amp-call-numberfield']); ?>"></a>
[3458] Fix | Delete
</div> <?php
[3459] Fix | Delete
}
[3460] Fix | Delete
}
[3461] Fix | Delete
[3462] Fix | Delete
// 56. Multi Translation Feature #540
[3463] Fix | Delete
// Moved to functions.php
[3464] Fix | Delete
[3465] Fix | Delete
// 57. Adding Updated date at in the Content
[3466] Fix | Delete
add_action('ampforwp_after_post_content','ampforwp_add_modified_date');
[3467] Fix | Delete
function ampforwp_add_modified_date($post_object){
[3468] Fix | Delete
global $redux_builder_amp;
[3469] Fix | Delete
if ( is_single() && $redux_builder_amp['post-modified-date'] == true && ( ! checkAMPforPageBuilderStatus( get_the_ID() ) ) ) { ?>
[3470] Fix | Delete
<div class="ampforwp-last-modified-date">
[3471] Fix | Delete
<p> <?php
[3472] Fix | Delete
$date_notice_type = ampforwp_get_setting('ampforwp-post-date-notice-type');
[3473] Fix | Delete
if( $date_notice_type == "modified" && $post_object->get( 'post_modified_timestamp' ) !== $post_object->get( 'post_publish_timestamp' ) ){
[3474] Fix | Delete
$date_notice_text = ampforwp_get_setting('amp-translator-modified-date-text');
[3475] Fix | Delete
$date = $post_object->get( 'post_modified_timestamp' );
[3476] Fix | Delete
echo esc_html(
[3477] Fix | Delete
sprintf(
[3478] Fix | Delete
_x( ampforwp_translation( $date_notice_text ,'This article was last modified on ' ) . ' %s ' , '%s = human-readable time difference', 'accelerated-mobile-pages' ),
[3479] Fix | Delete
date_i18n( get_option( 'date_format' ) , $date )
[3480] Fix | Delete
)
[3481] Fix | Delete
);
[3482] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-post-date-notice-time')){
[3483] Fix | Delete
echo get_the_modified_time();
[3484] Fix | Delete
}
[3485] Fix | Delete
}elseif($date_notice_type == "published"){
[3486] Fix | Delete
$date_notice_text = ampforwp_get_setting('amp-translator-published-date-text');
[3487] Fix | Delete
$date = $post_object->get( 'post_publish_timestamp' );
[3488] Fix | Delete
echo esc_html(
[3489] Fix | Delete
sprintf(
[3490] Fix | Delete
_x( ampforwp_translation( $date_notice_text ,'This article was last modified on ' ) . ' %s ' , '%s = human-readable time difference', 'accelerated-mobile-pages' ),
[3491] Fix | Delete
date_i18n( get_option( 'date_format' ) , $date )
[3492] Fix | Delete
)
[3493] Fix | Delete
);
[3494] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-post-date-notice-time')){
[3495] Fix | Delete
echo get_the_time();
[3496] Fix | Delete
}
[3497] Fix | Delete
}
[3498] Fix | Delete
?>
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function