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
<?php } }
[2500] Fix | Delete
}
[2501] Fix | Delete
[2502] Fix | Delete
add_filter( 'amp_post_template_data', 'ampforwp_global_head_scripts');
[2503] Fix | Delete
function ampforwp_global_head_scripts($data){
[2504] Fix | Delete
$content = $data['post_amp_content'];
[2505] Fix | Delete
$script_slug = '';
[2506] Fix | Delete
$script_url = '';
[2507] Fix | Delete
if( ampforwp_get_setting('amp-header-text-area-for-html') ) {
[2508] Fix | Delete
$allscripts = ampforwp_get_setting('amp-header-text-area-for-html');
[2509] Fix | Delete
preg_match_all('/<script(.*?)custom-element=\"(.*?)\"(.*?)src=\"(.*?)\"(.*?)><\/script>/', $allscripts, $matches);
[2510] Fix | Delete
$script_slug = $matches[2];
[2511] Fix | Delete
$script_url = $matches[4];
[2512] Fix | Delete
if($matches){
[2513] Fix | Delete
foreach ($script_slug as $key => $slug) {
[2514] Fix | Delete
if(preg_match('/<\/'.$slug.'>/', $content)){
[2515] Fix | Delete
if ( empty( $data['amp_component_scripts'][$slug] ) ) {
[2516] Fix | Delete
$data['amp_component_scripts'][$slug] = $script_url[$key];
[2517] Fix | Delete
}
[2518] Fix | Delete
}
[2519] Fix | Delete
}
[2520] Fix | Delete
}
[2521] Fix | Delete
}
[2522] Fix | Delete
return $data;
[2523] Fix | Delete
}
[2524] Fix | Delete
[2525] Fix | Delete
add_action('amp_post_template_head','ampforwp_header_html_output',11);
[2526] Fix | Delete
function ampforwp_header_html_output() {
[2527] Fix | Delete
if( ampforwp_get_setting('ampforwp-seo-custom-additional-meta') ){
[2528] Fix | Delete
echo strip_tags( ampforwp_get_setting('ampforwp-seo-custom-additional-meta'), '<link><meta>' );
[2529] Fix | Delete
}
[2530] Fix | Delete
if( ampforwp_get_setting('amp-header-text-area-for-html') ) {
[2531] Fix | Delete
$allhtml = ampforwp_get_setting('amp-header-text-area-for-html');
[2532] Fix | Delete
$allhtml = preg_replace('/<script(.*?)custom-element=\"(.*?)\"(.*?)src=\"(.*?)\"(.*?)><\/script>/','', $allhtml);
[2533] Fix | Delete
echo $allhtml;
[2534] Fix | Delete
}
[2535] Fix | Delete
$mob_pres_link = false;
[2536] Fix | Delete
if(function_exists('ampforwp_mobile_redirect_preseve_link')){
[2537] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[2538] Fix | Delete
}
[2539] Fix | Delete
}
[2540] Fix | Delete
[2541] Fix | Delete
add_filter('amp_post_template_data','ampforwp_set_body_content_script', 20);
[2542] Fix | Delete
function ampforwp_set_body_content_script($data){
[2543] Fix | Delete
if( ampforwp_get_setting('amp-body-text-area') || ampforwp_get_setting('amp-footer-text-area-for-html') ) {
[2544] Fix | Delete
$head_content = ampforwp_get_setting('amp-header-text-area-for-html');
[2545] Fix | Delete
preg_match_all('/"amp-(.*?)"/', $head_content, $matches1);
[2546] Fix | Delete
$body_content = ampforwp_get_setting('amp-body-text-area');
[2547] Fix | Delete
preg_match_all('/<\/amp-(.*?)>/', $body_content, $matches);
[2548] Fix | Delete
if(ampforwp_get_setting('amp-footer-text-area-for-html') ) {
[2549] Fix | Delete
$footer_content = ampforwp_get_setting('amp-footer-text-area-for-html');
[2550] Fix | Delete
preg_match_all('/<\/amp-(.*?)>/', $footer_content, $matches);
[2551] Fix | Delete
}
[2552] Fix | Delete
if(isset($matches[1][0])){
[2553] Fix | Delete
$amp_comp = $matches[1];
[2554] Fix | Delete
for($i=0;$i<count($amp_comp);$i++){
[2555] Fix | Delete
$comp = $amp_comp[$i];
[2556] Fix | Delete
if($comp!='img'){
[2557] Fix | Delete
$script_ver = 'latest';
[2558] Fix | Delete
if($comp == 'auto-ads' || $comp == 'ad'){
[2559] Fix | Delete
$script_ver = '0.1';
[2560] Fix | Delete
}
[2561] Fix | Delete
$component_url = "https://cdn.ampproject.org/v0/amp-".esc_attr($comp)."-".esc_attr($script_ver).".js";
[2562] Fix | Delete
if(isset($matches[1][0])){
[2563] Fix | Delete
$thtml = $matches1[1];
[2564] Fix | Delete
if(!in_array($comp, $thtml)){
[2565] Fix | Delete
$data['amp_component_scripts']["amp-".esc_attr($comp)] = esc_url($component_url);
[2566] Fix | Delete
}else{
[2567] Fix | Delete
$data['amp_component_scripts']["amp-".esc_attr($comp)] = esc_url($component_url);
[2568] Fix | Delete
}
[2569] Fix | Delete
} else{
[2570] Fix | Delete
$data['amp_component_scripts']["amp-".esc_attr($comp)] = esc_url($component_url);
[2571] Fix | Delete
}
[2572] Fix | Delete
}
[2573] Fix | Delete
}
[2574] Fix | Delete
}
[2575] Fix | Delete
[2576] Fix | Delete
}
[2577] Fix | Delete
return $data;
[2578] Fix | Delete
}
[2579] Fix | Delete
[2580] Fix | Delete
//40. Meta Robots
[2581] Fix | Delete
add_action('amp_post_template_head' , 'ampforwp_talking_to_robots');
[2582] Fix | Delete
function ampforwp_talking_to_robots() {
[2583] Fix | Delete
[2584] Fix | Delete
global $redux_builder_amp;
[2585] Fix | Delete
global $wp;
[2586] Fix | Delete
$meta_content = "";
[2587] Fix | Delete
$talk_to_robots=false;
[2588] Fix | Delete
[2589] Fix | Delete
//author archives index/noindex
[2590] Fix | Delete
if( is_author() && !$redux_builder_amp['ampforwp-robots-archive-author-pages'] ) {
[2591] Fix | Delete
$talk_to_robots = true;
[2592] Fix | Delete
}
[2593] Fix | Delete
[2594] Fix | Delete
//date archives index/noindex
[2595] Fix | Delete
if( is_date() && !$redux_builder_amp['ampforwp-robots-archive-date-pages'] ) {
[2596] Fix | Delete
$talk_to_robots = true;
[2597] Fix | Delete
}
[2598] Fix | Delete
[2599] Fix | Delete
//Search pages noindexing by default
[2600] Fix | Delete
if( is_search() ) {
[2601] Fix | Delete
$talk_to_robots = true;
[2602] Fix | Delete
}
[2603] Fix | Delete
[2604] Fix | Delete
//categorys index/noindex
[2605] Fix | Delete
if( is_category() && !$redux_builder_amp['ampforwp-robots-archive-category-pages'] ) {
[2606] Fix | Delete
$talk_to_robots = true;
[2607] Fix | Delete
}
[2608] Fix | Delete
[2609] Fix | Delete
//categorys index/noindex
[2610] Fix | Delete
if( is_tag() && !$redux_builder_amp['ampforwp-robots-archive-tag-pages'] ) {
[2611] Fix | Delete
$talk_to_robots = true;
[2612] Fix | Delete
}
[2613] Fix | Delete
[2614] Fix | Delete
if( is_archive() || is_home() ) {
[2615] Fix | Delete
if ( get_query_var( 'paged' ) ) {
[2616] Fix | Delete
$paged = get_query_var('paged');
[2617] Fix | Delete
} elseif ( get_query_var( 'page' ) ) {
[2618] Fix | Delete
$paged = get_query_var('page');
[2619] Fix | Delete
} else {
[2620] Fix | Delete
$paged = 1;
[2621] Fix | Delete
}
[2622] Fix | Delete
//sitewide archives sub pages index/noindex ie page 2 onwards
[2623] Fix | Delete
if( $paged >= 2 && !$redux_builder_amp['ampforwp-robots-archive-sub-pages-sitewide'] ) {
[2624] Fix | Delete
$talk_to_robots = true;
[2625] Fix | Delete
}
[2626] Fix | Delete
}
[2627] Fix | Delete
[2628] Fix | Delete
$query_array = $wp->query_vars;
[2629] Fix | Delete
if( array_key_exists( 'page' , $query_array ) ) {
[2630] Fix | Delete
$page = $wp->query_vars['page'];
[2631] Fix | Delete
if ( $redux_builder_amp['amp-frontpage-select-option'] && $page >= '2') {
[2632] Fix | Delete
$talk_to_robots = true;
[2633] Fix | Delete
}
[2634] Fix | Delete
}
[2635] Fix | Delete
[2636] Fix | Delete
if( $talk_to_robots ) {
[2637] Fix | Delete
$meta_content = "noindex,noarchive";
[2638] Fix | Delete
}
[2639] Fix | Delete
// Genesis
[2640] Fix | Delete
if ( function_exists('genesis_get_robots_meta_content') && 'genesis' == ampforwp_get_setting('ampforwp-seo-selection') ) {
[2641] Fix | Delete
$meta_content = genesis_get_robots_meta_content();
[2642] Fix | Delete
}
[2643] Fix | Delete
// All in One SEO #1720
[2644] Fix | Delete
if ( class_exists('All_in_One_SEO_Pack') ) {
[2645] Fix | Delete
$aios_class = $page = $opts = $aios_meta = $aiosp_noindex = $aiosp_nofollow = '';
[2646] Fix | Delete
$noindex = 'index';
[2647] Fix | Delete
$nofollow = 'follow';
[2648] Fix | Delete
$aios_class = new All_in_One_SEO_Pack();
[2649] Fix | Delete
if (is_object($aios_class) && property_exists($aios_class,'get_page_number')) {
[2650] Fix | Delete
$page = $aios_class->get_page_number();
[2651] Fix | Delete
}
[2652] Fix | Delete
if (is_object($aios_class) && property_exists($aios_class,'get_current_options')) {
[2653] Fix | Delete
$opts = $aios_class->get_current_options( array(), 'aiosp' );
[2654] Fix | Delete
}
[2655] Fix | Delete
if (is_object($aios_class) && property_exists($aios_class,'get_robots_meta')) {
[2656] Fix | Delete
$aios_meta = $aios_class->get_robots_meta();
[2657] Fix | Delete
}
[2658] Fix | Delete
if ( ( is_category() && ! empty( $aioseop_options['aiosp_category_noindex'] ) ) || ( ! is_category() && is_archive() && ! is_tag() && ! is_tax() || ( is_tag() && ! empty( $aioseop_options['aiosp_tags_noindex'] ) ) || ( is_search() && ! empty( $aioseop_options['aiosp_search_noindex'] ) )
[2659] Fix | Delete
) ){
[2660] Fix | Delete
$noindex = 'noindex';
[2661] Fix | Delete
} elseif ( is_single() || is_page() || $aios_class->is_static_posts_page() || is_attachment() || is_category() || is_tag() || is_tax() || ( $page > 1 ) ) {
[2662] Fix | Delete
$post_type = get_post_type();
[2663] Fix | Delete
if ( ! empty( $opts ) ) {
[2664] Fix | Delete
$aiosp_noindex = htmlspecialchars( stripslashes( $opts['aiosp_noindex'] ) );
[2665] Fix | Delete
$aiosp_nofollow = htmlspecialchars( stripslashes( $opts['aiosp_nofollow'] ) );
[2666] Fix | Delete
}
[2667] Fix | Delete
if ( $aiosp_noindex || $aiosp_nofollow || ! empty( $aioseop_options['aiosp_cpostnoindex'] )
[2668] Fix | Delete
|| ! empty( $aioseop_options['aiosp_cpostnofollow'] ) || ! empty( $aioseop_options['aiosp_paginated_noindex'] ) || ! empty( $aioseop_options['aiosp_paginated_nofollow'] )
[2669] Fix | Delete
) {
[2670] Fix | Delete
if ( ( $aiosp_noindex == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && $page > 1 ) ||
[2671] Fix | Delete
( ( $aiosp_noindex == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) )
[2672] Fix | Delete
) {
[2673] Fix | Delete
$noindex = 'noindex';
[2674] Fix | Delete
}
[2675] Fix | Delete
if ( ( $aiosp_nofollow == 'on' ) || ( ( ! empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && $page > 1 ) ||
[2676] Fix | Delete
( ( $aiosp_nofollow == '' ) && ( ! empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) )
[2677] Fix | Delete
) {
[2678] Fix | Delete
$nofollow = 'nofollow';
[2679] Fix | Delete
}
[2680] Fix | Delete
}
[2681] Fix | Delete
}
[2682] Fix | Delete
if ( is_singular() && is_object($aios_class) && property_exists($aios_class,'is_password_protected') && $aios_class->is_password_protected() && apply_filters( 'aiosp_noindex_password_posts', false ) ) {
[2683] Fix | Delete
$noindex = 'noindex';
[2684] Fix | Delete
}
[2685] Fix | Delete
[2686] Fix | Delete
$robots_meta = $noindex . ',' . $nofollow;
[2687] Fix | Delete
if ( $robots_meta == 'index,follow' ) {
[2688] Fix | Delete
$robots_meta = '';
[2689] Fix | Delete
}
[2690] Fix | Delete
[2691] Fix | Delete
if ( !empty($robots_meta) ) {
[2692] Fix | Delete
$meta_content = $robots_meta;
[2693] Fix | Delete
}
[2694] Fix | Delete
}
[2695] Fix | Delete
// Meta Robots Tag From Yoast #1563
[2696] Fix | Delete
if ( class_exists('WPSEO_Frontend') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && is_singular() && !class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')) {
[2697] Fix | Delete
$class_instance = '';
[2698] Fix | Delete
$class_instance = WPSEO_Frontend::get_instance();
[2699] Fix | Delete
// robots() will return and print the meta robots tag
[2700] Fix | Delete
$class_instance->robots();
[2701] Fix | Delete
// Empty the above meta content to avoid duplicate meta robot tags
[2702] Fix | Delete
$meta_content = '';
[2703] Fix | Delete
}
[2704] Fix | Delete
$meta_content = apply_filters('ampforwp_robots_meta', $meta_content);
[2705] Fix | Delete
if ( isset($redux_builder_amp['amp-inspection-tool']) && true == $redux_builder_amp['amp-inspection-tool'] ) {
[2706] Fix | Delete
$talk_to_robots = $meta_content = '';
[2707] Fix | Delete
}
[2708] Fix | Delete
if ( $meta_content ) {
[2709] Fix | Delete
if ( ( is_archive() && $talk_to_robots ) || is_singular() || is_home() ) {
[2710] Fix | Delete
echo '<meta name="robots" content="' . esc_attr($meta_content) . '"/>';
[2711] Fix | Delete
}
[2712] Fix | Delete
}
[2713] Fix | Delete
[2714] Fix | Delete
}
[2715] Fix | Delete
[2716] Fix | Delete
// 41. Rewrite URL only on save #511
[2717] Fix | Delete
function ampforwp_auto_flush_on_save($redux_builder_amp) {
[2718] Fix | Delete
if ( $redux_builder_amp['amp-on-off-for-all-pages'] == 1 || $redux_builder_amp['ampforwp-archive-support'] == 1 || $redux_builder_amp['fb-instant-article-switch'] == 1 ) {
[2719] Fix | Delete
global $wp_rewrite;
[2720] Fix | Delete
$wp_rewrite->flush_rules();
[2721] Fix | Delete
}
[2722] Fix | Delete
$options = $new_options = array();
[2723] Fix | Delete
if ( is_array(ampforwp_get_setting('hide-amp-categories')) && !is_array(ampforwp_get_setting('hide-amp-categories2'))) {
[2724] Fix | Delete
$options = array_keys(array_filter($redux_builder_amp['hide-amp-categories'] ) );
[2725] Fix | Delete
foreach ($options as $option ) {
[2726] Fix | Delete
$new_options[] = $option;
[2727] Fix | Delete
}
[2728] Fix | Delete
$redux_builder_amp['hide-amp-categories2'] = $new_options;
[2729] Fix | Delete
$redux_builder_amp['hide-amp-categories'] = '';
[2730] Fix | Delete
update_option('redux_builder_amp',$redux_builder_amp);
[2731] Fix | Delete
}
[2732] Fix | Delete
}
[2733] Fix | Delete
add_action("redux/options/redux_builder_amp/saved",'ampforwp_auto_flush_on_save', 10, 1);
[2734] Fix | Delete
[2735] Fix | Delete
// 42. registeing AMP sidebars
[2736] Fix | Delete
add_action('init', 'ampforwp_add_widget_support');
[2737] Fix | Delete
function ampforwp_add_widget_support() {
[2738] Fix | Delete
if (function_exists('register_sidebar')) {
[2739] Fix | Delete
global $redux_builder_amp;
[2740] Fix | Delete
[2741] Fix | Delete
register_sidebar(array(
[2742] Fix | Delete
'name' => 'AMP Above Loop [HomePage]',
[2743] Fix | Delete
'id' => 'ampforwp-above-loop',
[2744] Fix | Delete
'description' => 'This Widget will be display on AMP HomePage Above the loop ',
[2745] Fix | Delete
'before_widget' => '',
[2746] Fix | Delete
'after_widget' => '',
[2747] Fix | Delete
'before_title' => '<h4>',
[2748] Fix | Delete
'after_title' => '</h4>'
[2749] Fix | Delete
));
[2750] Fix | Delete
[2751] Fix | Delete
register_sidebar(array(
[2752] Fix | Delete
'name' => 'AMP Below Loop [HomePage]',
[2753] Fix | Delete
'id' => 'ampforwp-below-loop',
[2754] Fix | Delete
'description' => 'This Widget will be display on AMP HomePage Below the loop',
[2755] Fix | Delete
'before_widget' => '',
[2756] Fix | Delete
'after_widget' => '',
[2757] Fix | Delete
'before_title' => '<h4>',
[2758] Fix | Delete
'after_title' => '</h4>'
[2759] Fix | Delete
));
[2760] Fix | Delete
[2761] Fix | Delete
register_sidebar(array(
[2762] Fix | Delete
'name' => 'AMP Below the Header [Site Wide]',
[2763] Fix | Delete
'id' => 'ampforwp-below-header',
[2764] Fix | Delete
'description' => 'This Widget will be display after the header bar',
[2765] Fix | Delete
'before_widget' => '',
[2766] Fix | Delete
'after_widget' => '',
[2767] Fix | Delete
'before_title' => '<h4><span>',
[2768] Fix | Delete
'after_title' => '</h4></span>'
[2769] Fix | Delete
));
[2770] Fix | Delete
[2771] Fix | Delete
register_sidebar(array(
[2772] Fix | Delete
'name' => 'AMP Above the Footer [Site Wide]',
[2773] Fix | Delete
'id' => 'ampforwp-above-footer',
[2774] Fix | Delete
'description' => 'This Widget display Above the Footer',
[2775] Fix | Delete
'before_widget' => '',
[2776] Fix | Delete
'after_widget' => '',
[2777] Fix | Delete
'before_title' => '<h4><span>',
[2778] Fix | Delete
'after_title' => '</h4></span>'
[2779] Fix | Delete
));
[2780] Fix | Delete
[2781] Fix | Delete
if ( function_exists('ampforwp_custom_theme_files_register') ) {
[2782] Fix | Delete
$desc = "<b>Update: <a target='_blank' href='https://ampforwp.com/tutorials/article/amp-page-builder-installation/'>Introducing PageBuilder 2.0</a></b><br />Drag and Drop the AMP Modules in this Widget Area and then assign this widget area to a page <a href=http://ampforwp.com/tutorials/page-builder>(Need Help?)</a>";
[2783] Fix | Delete
$placeholder = 'PLACEHOLDER';
[2784] Fix | Delete
register_sidebar(array(
[2785] Fix | Delete
'name' => 'Page Builder (AMP) [Legacy]',
[2786] Fix | Delete
'id' => 'layout-builder',
[2787] Fix | Delete
'description' => $placeholder,
[2788] Fix | Delete
'before_widget' => '',
[2789] Fix | Delete
'after_widget' => '',
[2790] Fix | Delete
'before_title' => '<h4>',
[2791] Fix | Delete
'after_title' => '</h4>'
[2792] Fix | Delete
));
[2793] Fix | Delete
[2794] Fix | Delete
add_action( 'widgets_admin_page', function() use ( $desc, $placeholder ) {
[2795] Fix | Delete
add_filter( 'esc_html', function( $safe_text, $text ) use ( $desc, $placeholder ) {
[2796] Fix | Delete
[2797] Fix | Delete
if ( $text !== $placeholder )
[2798] Fix | Delete
return $safe_text;
[2799] Fix | Delete
[2800] Fix | Delete
remove_filter( current_filter(), __FUNCTION__ );
[2801] Fix | Delete
[2802] Fix | Delete
return $desc;
[2803] Fix | Delete
}, 10, 2 );
[2804] Fix | Delete
});
[2805] Fix | Delete
[2806] Fix | Delete
}
[2807] Fix | Delete
[2808] Fix | Delete
}
[2809] Fix | Delete
}
[2810] Fix | Delete
[2811] Fix | Delete
// 43. custom actions for widgets output
[2812] Fix | Delete
add_action( 'ampforwp_home_above_loop' , 'ampforwp_output_widget_content_above_loop' );
[2813] Fix | Delete
add_action( 'ampforwp_frontpage_above_loop' , 'ampforwp_output_widget_content_above_loop' );
[2814] Fix | Delete
function ampforwp_output_widget_content_above_loop() {
[2815] Fix | Delete
$sanitized_sidebar = "";
[2816] Fix | Delete
$sidebar_output = "";
[2817] Fix | Delete
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
[2818] Fix | Delete
if ( $sanitized_sidebar) {
[2819] Fix | Delete
$sidebar_output = $sanitized_sidebar->get_amp_content();
[2820] Fix | Delete
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
[2821] Fix | Delete
}
[2822] Fix | Delete
if ( $sidebar_output ) { ?>
[2823] Fix | Delete
<div class="cntr">
[2824] Fix | Delete
<div class="amp-wp-content widget-wrapper amp_widget_above_loop">
[2825] Fix | Delete
<div class="f-w">
[2826] Fix | Delete
<?php echo do_shortcode($sidebar_output); ?>
[2827] Fix | Delete
<div class="cb"></div>
[2828] Fix | Delete
</div>
[2829] Fix | Delete
</div>
[2830] Fix | Delete
</div>
[2831] Fix | Delete
<?php }
[2832] Fix | Delete
}
[2833] Fix | Delete
[2834] Fix | Delete
add_action( 'ampforwp_home_below_loop' , 'ampforwp_output_widget_content_below_loop' );
[2835] Fix | Delete
add_action( 'ampforwp_frontpage_below_loop' , 'ampforwp_output_widget_content_below_loop' );
[2836] Fix | Delete
function ampforwp_output_widget_content_below_loop() {
[2837] Fix | Delete
$sanitized_sidebar = "";
[2838] Fix | Delete
$sidebar_output = "";
[2839] Fix | Delete
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
[2840] Fix | Delete
if ( $sanitized_sidebar) {
[2841] Fix | Delete
$sidebar_output = $sanitized_sidebar->get_amp_content();
[2842] Fix | Delete
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
[2843] Fix | Delete
}
[2844] Fix | Delete
if ( $sidebar_output ) { ?>
[2845] Fix | Delete
<div class="amp-wp-content widget-wrapper">
[2846] Fix | Delete
<div class="amp_widget_below_loop f-w">
[2847] Fix | Delete
<?php echo do_shortcode($sidebar_output); ?>
[2848] Fix | Delete
</div>
[2849] Fix | Delete
</div>
[2850] Fix | Delete
<?php }
[2851] Fix | Delete
}
[2852] Fix | Delete
[2853] Fix | Delete
add_action( 'ampforwp_after_header' , 'ampforwp_output_widget_content_below_the_header' );
[2854] Fix | Delete
add_action('below_the_header_design_1','ampforwp_output_widget_content_below_the_header');
[2855] Fix | Delete
function ampforwp_output_widget_content_below_the_header() {
[2856] Fix | Delete
$sanitized_sidebar = "";
[2857] Fix | Delete
$sidebar_output = "";
[2858] Fix | Delete
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
[2859] Fix | Delete
if ( $sanitized_sidebar) {
[2860] Fix | Delete
$sidebar_output = $sanitized_sidebar->get_amp_content();
[2861] Fix | Delete
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
[2862] Fix | Delete
}
[2863] Fix | Delete
if ( $sidebar_output ) { ?>
[2864] Fix | Delete
<div class="amp-wp-content widget-wrapper">
[2865] Fix | Delete
<div class="cntr">
[2866] Fix | Delete
<div class="amp_widget_below_the_header f-w">
[2867] Fix | Delete
<?php echo do_shortcode($sidebar_output); ?>
[2868] Fix | Delete
</div>
[2869] Fix | Delete
</div>
[2870] Fix | Delete
</div>
[2871] Fix | Delete
<?php }
[2872] Fix | Delete
}
[2873] Fix | Delete
[2874] Fix | Delete
add_action( 'amp_post_template_above_footer' , 'ampforwp_output_widget_content_above_the_footer' );
[2875] Fix | Delete
function ampforwp_output_widget_content_above_the_footer() {
[2876] Fix | Delete
$sanitized_sidebar = "";
[2877] Fix | Delete
$sidebar_output = "";
[2878] Fix | Delete
$sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
[2879] Fix | Delete
if ( $sanitized_sidebar) {
[2880] Fix | Delete
$sidebar_output = $sanitized_sidebar->get_amp_content();
[2881] Fix | Delete
$sidebar_output = apply_filters('ampforwp_modify_sidebars_content',do_shortcode($sidebar_output));
[2882] Fix | Delete
}
[2883] Fix | Delete
if ( $sidebar_output ) { ?>
[2884] Fix | Delete
<div class="amp-wp-content widget-wrapper">
[2885] Fix | Delete
<div class="cntr">
[2886] Fix | Delete
<div class="amp_widget_above_the_footer f-w">
[2887] Fix | Delete
<?php echo do_shortcode($sidebar_output); ?>
[2888] Fix | Delete
</div>
[2889] Fix | Delete
</div>
[2890] Fix | Delete
</div>
[2891] Fix | Delete
<?php }
[2892] Fix | Delete
}
[2893] Fix | Delete
// Filter the sidebars content to make it work properly with carousels
[2894] Fix | Delete
add_filter('ampforwp_modify_sidebars_content','ampforwp_sidebars_carousel_content');
[2895] Fix | Delete
function ampforwp_sidebars_carousel_content($content){
[2896] Fix | Delete
$content = str_replace(array(':openbrack:',':closebrack:'), array('[',']'), $content);
[2897] Fix | Delete
return $content;
[2898] Fix | Delete
}
[2899] Fix | Delete
// Sidebar Content Sanitizer
[2900] Fix | Delete
function ampforwp_sidebar_content_sanitizer($sidebar){
[2901] Fix | Delete
global $redux_builder_amp;
[2902] Fix | Delete
$sanitized_sidebar = "";
[2903] Fix | Delete
$non_sanitized_sidebar = "";
[2904] Fix | Delete
$sidebar_data = array();
[2905] Fix | Delete
$blacklist_array = array();
[2906] Fix | Delete
// Remove some blacklist tags from sidebars only when search,archives and categories widgets are active #2835
[2907] Fix | Delete
if ( is_active_widget(false,false,'search') || is_active_widget(false,false,'archives') || is_active_widget(false,false,'categories') ) {
[2908] Fix | Delete
$blacklist_array['non-content'] = 'non-content';
[2909] Fix | Delete
}
[2910] Fix | Delete
ob_start();
[2911] Fix | Delete
dynamic_sidebar( $sidebar );
[2912] Fix | Delete
$non_sanitized_sidebar = ob_get_contents();
[2913] Fix | Delete
ob_end_clean();
[2914] Fix | Delete
[2915] Fix | Delete
if ( $non_sanitized_sidebar ) {
[2916] Fix | Delete
$sanitized_sidebar = new AMPforWP_Content( $non_sanitized_sidebar,
[2917] Fix | Delete
apply_filters( 'amp_content_embed_handlers', array(
[2918] Fix | Delete
'AMP_Reddit_Embed_Handler' => array(),
[2919] Fix | Delete
'AMP_Twitter_Embed_Handler' => array(),
[2920] Fix | Delete
'AMP_YouTube_Embed_Handler' => array(),
[2921] Fix | Delete
'AMP_DailyMotion_Embed_Handler' => array(),
[2922] Fix | Delete
'AMP_Vimeo_Embed_Handler' => array(),
[2923] Fix | Delete
'AMP_SoundCloud_Embed_Handler' => array(),
[2924] Fix | Delete
'AMP_Instagram_Embed_Handler' => array(),
[2925] Fix | Delete
'AMP_Vine_Embed_Handler' => array(),
[2926] Fix | Delete
'AMP_Facebook_Embed_Handler' => array(),
[2927] Fix | Delete
'AMP_Pinterest_Embed_Handler' => array(),
[2928] Fix | Delete
'AMP_Gallery_Embed_Handler' => array(),
[2929] Fix | Delete
) ),
[2930] Fix | Delete
apply_filters( 'amp_sidebar_sanitizers', array(
[2931] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[2932] Fix | Delete
'AMP_Blacklist_Sanitizer' => $blacklist_array,
[2933] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[2934] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[2935] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[2936] Fix | Delete
'AMP_Playbuzz_Sanitizer' => array(),
[2937] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[2938] Fix | Delete
'add_placeholder' => true,
[2939] Fix | Delete
),
[2940] Fix | Delete
'AMP_Tag_And_Attribute_Sanitizer' => array(),
[2941] Fix | Delete
) ), array('non-content'=>'non-content')
[2942] Fix | Delete
);
[2943] Fix | Delete
}
[2944] Fix | Delete
if ( is_active_widget(false,false,'search') && $sanitized_sidebar) {
[2945] Fix | Delete
// Allow some blacklisted tags #1400
[2946] Fix | Delete
add_filter('ampforwp_modify_sidebars_content','ampforwp_modified_search_sidebar');
[2947] Fix | Delete
}
[2948] Fix | Delete
return $sanitized_sidebar;
[2949] Fix | Delete
}
[2950] Fix | Delete
[2951] Fix | Delete
function ampforwp_modified_search_sidebar( $content ) {
[2952] Fix | Delete
global $redux_builder_amp;
[2953] Fix | Delete
$mob_pres_link = false;
[2954] Fix | Delete
if(function_exists('ampforwp_mobile_redirect_preseve_link')){
[2955] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[2956] Fix | Delete
}
[2957] Fix | Delete
$mob_pres_link = false;
[2958] Fix | Delete
if(function_exists('ampforwp_mobile_redirect_preseve_link')){
[2959] Fix | Delete
$mob_pres_link = ampforwp_mobile_redirect_preseve_link();
[2960] Fix | Delete
}
[2961] Fix | Delete
$dom = '';
[2962] Fix | Delete
$dom = AMP_DOM_Utils::get_dom_from_content($content);
[2963] Fix | Delete
$nodes = $dom->getElementsByTagName( 'form' );
[2964] Fix | Delete
$num_nodes = $nodes->length;
[2965] Fix | Delete
if ( 0 !== $num_nodes ) {
[2966] Fix | Delete
for ( $i = 0; $i < $nodes->length; ++$i ) {
[2967] Fix | Delete
$element = $nodes->item( $i );
[2968] Fix | Delete
if (ampforwp_get_setting('ampforwp-amp-takeover') == false && $mob_pres_link == false ) {
[2969] Fix | Delete
$amp_query_variable = 'amp';
[2970] Fix | Delete
$amp_query_variable_val = '1';
[2971] Fix | Delete
}
[2972] Fix | Delete
if ( ! $element->hasAttribute('action-xhr') ){
[2973] Fix | Delete
$action_url = $element->getAttribute('action');
[2974] Fix | Delete
$action_url = preg_replace('#^http?:#', '', $action_url);
[2975] Fix | Delete
$element->setAttribute('action', $action_url);
[2976] Fix | Delete
}
[2977] Fix | Delete
$element->setAttribute('target', '_top');
[2978] Fix | Delete
$input_nodes = $element->getElementsByTagName('input');
[2979] Fix | Delete
if ( 0 !== $input_nodes->length ) {
[2980] Fix | Delete
for ( $i = 0; $i < $input_nodes->length; ++$i ) {
[2981] Fix | Delete
$input_node = $input_nodes->item( $i );
[2982] Fix | Delete
if ( 'submit' !== $input_node->getAttribute('type') ) {
[2983] Fix | Delete
$input_submit = $dom->createElement('input');
[2984] Fix | Delete
$input_submit->setAttribute('type', 'submit');
[2985] Fix | Delete
$input_submit->setAttribute('class', 'search-submit');
[2986] Fix | Delete
}
[2987] Fix | Delete
}
[2988] Fix | Delete
if ( $input_submit ) {
[2989] Fix | Delete
$element->appendChild($input_submit);
[2990] Fix | Delete
}
[2991] Fix | Delete
}
[2992] Fix | Delete
}
[2993] Fix | Delete
}
[2994] Fix | Delete
// Remove http/https from Audio and Video URLs #1400
[2995] Fix | Delete
$video_nodes = $dom->getElementsByTagName( 'amp-video' );
[2996] Fix | Delete
$num_nodes = $video_nodes->length;
[2997] Fix | Delete
if ( 0 !== $num_nodes ) {
[2998] Fix | Delete
for ( $i = 0; $i < $video_nodes->length; ++$i ) {
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function