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
</p>
[3500] Fix | Delete
</div> <?php
[3501] Fix | Delete
}
[3502] Fix | Delete
}
[3503] Fix | Delete
[3504] Fix | Delete
// 58. YouTube Shortcode compatablity with AMP #557 #971
[3505] Fix | Delete
[3506] Fix | Delete
add_filter('amp_content_embed_handlers','ampforwp_youtube_shortcode_embedder');
[3507] Fix | Delete
function ampforwp_youtube_shortcode_embedder($data){
[3508] Fix | Delete
unset($data['AMP_YouTube_Embed_Handler']);
[3509] Fix | Delete
$data[ 'AMPforWP_YouTube_Embed_Handler' ] = array();
[3510] Fix | Delete
return $data;
[3511] Fix | Delete
}
[3512] Fix | Delete
if ( ! function_exists( 'ampforwp_youtube_shortcode') ) {
[3513] Fix | Delete
[3514] Fix | Delete
function ampforwp_youtube_shortcode( $params, $old_format_support = false ) {
[3515] Fix | Delete
$str = '';
[3516] Fix | Delete
$parsed_url = array();
[3517] Fix | Delete
$youtube_url = 'https://www.youtube.com/watch?v=';
[3518] Fix | Delete
if(isset( $params['id']) ){
[3519] Fix | Delete
$parsed_url = parse_url( $params['id'] );
[3520] Fix | Delete
}
[3521] Fix | Delete
$server = 'www.youtube.com';
[3522] Fix | Delete
[3523] Fix | Delete
if ( in_array( $server, $parsed_url ) === false ) {
[3524] Fix | Delete
if(isset($params['id']) && $params['id']){
[3525] Fix | Delete
$new_url = $youtube_url . $params['id'] ;
[3526] Fix | Delete
$params['id'] = $new_url;
[3527] Fix | Delete
}
[3528] Fix | Delete
}
[3529] Fix | Delete
if ( $old_format_support && isset( $params[0] ) ) {
[3530] Fix | Delete
$str = ltrim( $params[0], '=' );
[3531] Fix | Delete
} elseif ( is_array( $params ) ) {
[3532] Fix | Delete
foreach ( array_keys( $params ) as $key ) {
[3533] Fix | Delete
if ( ! is_numeric( $key ) ) {
[3534] Fix | Delete
$str = $key . '=' . $params[ $key ];
[3535] Fix | Delete
}
[3536] Fix | Delete
}
[3537] Fix | Delete
}
[3538] Fix | Delete
return str_replace( array( '&amp;', '&#038;' ), '&', $str );
[3539] Fix | Delete
}
[3540] Fix | Delete
}
[3541] Fix | Delete
// Add extra params in amp-youtube
[3542] Fix | Delete
add_filter('amp_youtube_params', 'ampforwp_youtube_modified_params');
[3543] Fix | Delete
if( ! function_exists(' ampforwp_youtube_modified_params ') ){
[3544] Fix | Delete
function ampforwp_youtube_modified_params($amp_youtube){
[3545] Fix | Delete
$check = '';
[3546] Fix | Delete
$param = '';
[3547] Fix | Delete
// Check for extra params
[3548] Fix | Delete
$check = preg_match('/(.*?)&(.*)/', $amp_youtube['data-videoid']);
[3549] Fix | Delete
if(1 === $check){
[3550] Fix | Delete
// Grab the extra param
[3551] Fix | Delete
$param = preg_replace('/(.*?)&(.*)/', '$2', $amp_youtube['data-videoid']);
[3552] Fix | Delete
// Parse the string into variables
[3553] Fix | Delete
parse_str($param, $query_args);
[3554] Fix | Delete
// Check for rel param
[3555] Fix | Delete
if(isset($query_args['rel'])){
[3556] Fix | Delete
// Add the rel param in amp-youtube's data-param
[3557] Fix | Delete
$amp_youtube['data-param-rel'] = $query_args['rel'];
[3558] Fix | Delete
}
[3559] Fix | Delete
// Remove that param from URL
[3560] Fix | Delete
$amp_youtube['data-videoid'] = preg_replace('/&(.*)/', '', $amp_youtube['data-videoid']);
[3561] Fix | Delete
// Plyr Plugin Compatibility #1505
[3562] Fix | Delete
if ( class_exists('Plyr') ) {
[3563] Fix | Delete
$amp_youtube['data-param-rel'] = 0;
[3564] Fix | Delete
$amp_youtube['data-param-autoplay'] = 0;
[3565] Fix | Delete
$amp_youtube['data-param-showinfo'] = 0;
[3566] Fix | Delete
}
[3567] Fix | Delete
}
[3568] Fix | Delete
return $amp_youtube;
[3569] Fix | Delete
}
[3570] Fix | Delete
}
[3571] Fix | Delete
// 59. Comment Button URL
[3572] Fix | Delete
function ampforwp_comment_button_url(){
[3573] Fix | Delete
global $redux_builder_amp;
[3574] Fix | Delete
$button_url = "";
[3575] Fix | Delete
if(ampforwp_get_setting('amp-mobile-redirection')==1){
[3576] Fix | Delete
$button_url = add_query_arg( array( 'nonamp' => '1' ), get_permalink() );
[3577] Fix | Delete
$button_url = $button_url. '#commentform';
[3578] Fix | Delete
}
[3579] Fix | Delete
elseif ( ampforwp_get_setting('ampforwp-amp-takeover') ) {
[3580] Fix | Delete
$button_url = user_trailingslashit(get_the_permalink()).'#comments';
[3581] Fix | Delete
}
[3582] Fix | Delete
else{
[3583] Fix | Delete
$button_url = get_permalink(). '#commentform';
[3584] Fix | Delete
}
[3585] Fix | Delete
return esc_url( apply_filters( 'ampforwp_comment_button_url', $button_url ) );
[3586] Fix | Delete
}
[3587] Fix | Delete
[3588] Fix | Delete
// 60. Remove Category Layout modification code added by TagDiv #842 and #796
[3589] Fix | Delete
// #1683
[3590] Fix | Delete
add_action('pre_amp_render_post', 'ampforwp_remove_tagdiv_category_layout');
[3591] Fix | Delete
function ampforwp_remove_tagdiv_category_layout(){
[3592] Fix | Delete
if ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) {
[3593] Fix | Delete
remove_action('pre_get_posts', 'td_modify_main_query_for_category_page',9);
[3594] Fix | Delete
}
[3595] Fix | Delete
}
[3596] Fix | Delete
[3597] Fix | Delete
// 61. Add Gist Support
[3598] Fix | Delete
add_shortcode('amp-gist', 'ampforwp_gist_shortcode_generator');
[3599] Fix | Delete
function ampforwp_gist_shortcode_generator($atts) {
[3600] Fix | Delete
extract(shortcode_atts(array(
[3601] Fix | Delete
'id' =>'' ,
[3602] Fix | Delete
'layout' => 'fixed-height',
[3603] Fix | Delete
'height' => 200,
[3604] Fix | Delete
), $atts));
[3605] Fix | Delete
if ( empty ( $height ) ) {
[3606] Fix | Delete
$height = '250';
[3607] Fix | Delete
}
[3608] Fix | Delete
// adding sanitization for gist id
[3609] Fix | Delete
$sanitized_id = preg_replace('/[^a-z0-9\-]/', '', $atts['id']);
[3610] Fix | Delete
if($sanitized_id){
[3611] Fix | Delete
return '<amp-gist data-gistid='. esc_attr($sanitized_id) .'
[3612] Fix | Delete
layout="fixed-height"
[3613] Fix | Delete
height="'. esc_attr($height) .'">
[3614] Fix | Delete
</amp-gist>';
[3615] Fix | Delete
}
[3616] Fix | Delete
}
[3617] Fix | Delete
[3618] Fix | Delete
// Code updated and added the JS proper way #336
[3619] Fix | Delete
add_filter('amp_post_template_data','ampforwp_add_amp_gist_script', 100);
[3620] Fix | Delete
function ampforwp_add_amp_gist_script( $data ){
[3621] Fix | Delete
global $redux_builder_amp;
[3622] Fix | Delete
$content = "";
[3623] Fix | Delete
[3624] Fix | Delete
$content = $data['post'];
[3625] Fix | Delete
if( $content ){
[3626] Fix | Delete
$content = $content->post_content;
[3627] Fix | Delete
[3628] Fix | Delete
if( is_single() ) {
[3629] Fix | Delete
if( has_shortcode( $content, 'amp-gist' ) ){
[3630] Fix | Delete
if ( empty( $data['amp_component_scripts']['amp-gist'] ) ) {
[3631] Fix | Delete
$data['amp_component_scripts']['amp-gist'] = 'https://cdn.ampproject.org/v0/amp-gist-0.1.js';
[3632] Fix | Delete
}
[3633] Fix | Delete
}
[3634] Fix | Delete
}
[3635] Fix | Delete
}
[3636] Fix | Delete
[3637] Fix | Delete
return $data;
[3638] Fix | Delete
}
[3639] Fix | Delete
[3640] Fix | Delete
[3641] Fix | Delete
// 62. Adding Meta viewport via hook instead of direct #878
[3642] Fix | Delete
add_action( 'amp_post_template_head','ampforwp_add_meta_viewport', 9);
[3643] Fix | Delete
function ampforwp_add_meta_viewport() {
[3644] Fix | Delete
$output = '';
[3645] Fix | Delete
$output = '<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes">
[3646] Fix | Delete
';
[3647] Fix | Delete
if (ampforwp_get_setting('ampforwp-meta-viewport') == false) {
[3648] Fix | Delete
$output = '<meta name="viewport" content="width=device-width">';
[3649] Fix | Delete
}
[3650] Fix | Delete
if(!class_exists( 'AMPforWP_Mobile_Detect') && !ampforwp_get_setting('amp-mobile-redirection')){
[3651] Fix | Delete
ampforwp_require_file( AMPFORWP_PLUGIN_DIR.'/includes/vendor/Mobile_Detect.php ');
[3652] Fix | Delete
}
[3653] Fix | Delete
if(class_exists('AMPforWP_Mobile_Detect')){
[3654] Fix | Delete
$mobile_detect = new AMPforWP_Mobile_Detect;
[3655] Fix | Delete
$isMobile = $mobile_detect->isMobile();
[3656] Fix | Delete
$isTablet = $mobile_detect->isTablet();
[3657] Fix | Delete
if( $isMobile || $isTablet ){
[3658] Fix | Delete
$output = '<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,user-scalable=yes">';
[3659] Fix | Delete
}
[3660] Fix | Delete
}
[3661] Fix | Delete
global $is_safari;
[3662] Fix | Delete
if ($is_safari) {
[3663] Fix | Delete
$output .= '<meta name="referrer" content="no-referrer-when-downgrade">';
[3664] Fix | Delete
}
[3665] Fix | Delete
echo apply_filters('ampforwp_modify_meta_viewport_filter',$output);
[3666] Fix | Delete
[3667] Fix | Delete
}
[3668] Fix | Delete
[3669] Fix | Delete
// 63. Frontpage Comments #682
[3670] Fix | Delete
function ampforwp_frontpage_comments() {
[3671] Fix | Delete
global $redux_builder_amp;
[3672] Fix | Delete
$data = get_option( 'ampforwp_design',array());
[3673] Fix | Delete
$enable_comments = false;
[3674] Fix | Delete
$post_id = "";
[3675] Fix | Delete
[3676] Fix | Delete
$post_id = ampforwp_get_frontpage_id();
[3677] Fix | Delete
[3678] Fix | Delete
if (empty($data)) {
[3679] Fix | Delete
$data['elements'] = "meta_info:1,title:1,featured_image:1,content:1,meta_taxonomy:1,social_icons:1,comments:1,related_posts:1";
[3680] Fix | Delete
}
[3681] Fix | Delete
if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
[3682] Fix | Delete
$options = explode( ',', $data['elements'] );
[3683] Fix | Delete
};
[3684] Fix | Delete
if ($options): foreach ($options as $key=>$value) {
[3685] Fix | Delete
switch ($value) {
[3686] Fix | Delete
case 'comments:1':
[3687] Fix | Delete
$enable_comments = true;
[3688] Fix | Delete
break;
[3689] Fix | Delete
}
[3690] Fix | Delete
} endif;
[3691] Fix | Delete
if ( $enable_comments ) { ?>
[3692] Fix | Delete
<div class="ampforwp-comment-wrapper">
[3693] Fix | Delete
<?php
[3694] Fix | Delete
$comment_button_url = "";
[3695] Fix | Delete
$postID = '';
[3696] Fix | Delete
// Gather comments for a Front from post id
[3697] Fix | Delete
$postID = ampforwp_get_frontpage_id();
[3698] Fix | Delete
$comment_order = get_option( 'comment_order' );
[3699] Fix | Delete
$comments = get_comments(array(
[3700] Fix | Delete
'post_id' => $postID,
[3701] Fix | Delete
'order' => esc_attr($comment_order),
[3702] Fix | Delete
'status' => 'approve' //Change this to the type of comments to be displayed
[3703] Fix | Delete
));
[3704] Fix | Delete
$comment_button_url = get_permalink( $post_id );
[3705] Fix | Delete
$comment_button_url = apply_filters('ampforwp_frontpage_comments_url',$comment_button_url );
[3706] Fix | Delete
if ( $comments ) { ?>
[3707] Fix | Delete
<div class="amp-wp-content comments_list cmts_list">
[3708] Fix | Delete
<h3><?php global $redux_builder_amp; echo esc_html(ampforwp_translation($redux_builder_amp['amp-translator-view-comments-text'] , 'View Comments' ))?></h3>
[3709] Fix | Delete
<ul>
[3710] Fix | Delete
<?php
[3711] Fix | Delete
$page = (get_query_var('page')) ? get_query_var('page') : 1;
[3712] Fix | Delete
$total_comments = get_comments( array(
[3713] Fix | Delete
'orderby' => 'post_date' ,
[3714] Fix | Delete
'order' => 'DESC',
[3715] Fix | Delete
'post_id' => $postID,
[3716] Fix | Delete
'status' => 'approve',
[3717] Fix | Delete
'parent' =>0 )
[3718] Fix | Delete
);
[3719] Fix | Delete
$pages = ceil(count($total_comments)/AMPFORWP_COMMENTS_PER_PAGE);
[3720] Fix | Delete
$pagination_args = array(
[3721] Fix | Delete
'base' => @add_query_arg('page','%#%'),
[3722] Fix | Delete
'format' => '?page=%#%',
[3723] Fix | Delete
'total' => $pages,
[3724] Fix | Delete
'current' => $page,
[3725] Fix | Delete
'show_all' => False,
[3726] Fix | Delete
'end_size' => 1,
[3727] Fix | Delete
'mid_size' => 2,
[3728] Fix | Delete
'prev_next' => True,
[3729] Fix | Delete
'prev_text' => ampforwp_translation($redux_builder_amp['amp-translator-previous-text'], 'Previous'),
[3730] Fix | Delete
'next_text' => ampforwp_translation( $redux_builder_amp['amp-translator-next-text'], 'Next'),
[3731] Fix | Delete
'type' => 'plain'
[3732] Fix | Delete
);
[3733] Fix | Delete
[3734] Fix | Delete
// Display the list of comments
[3735] Fix | Delete
function ampforwp_custom_translated_comment($comment, $args, $depth){
[3736] Fix | Delete
$GLOBALS['comment'] = $comment;
[3737] Fix | Delete
global $redux_builder_amp; ?>
[3738] Fix | Delete
<li id="li-comment-<?php esc_attr(comment_ID()) ?>"
[3739] Fix | Delete
<?php comment_class(); ?> >
[3740] Fix | Delete
<article id="comment-<?php esc_attr(comment_ID()); ?>" class="cmt-body">
[3741] Fix | Delete
<footer class="cmt-meta">
[3742] Fix | Delete
<div class="cmt-author vcard">
[3743] Fix | Delete
<?php
[3744] Fix | Delete
printf('<b class="fn">%s</b> <span class="says">'.esc_html(ampforwp_translation(ampforwp_get_setting('amp-translator-says-text'),'says')).':</span>', get_comment_author_link()) ?>
[3745] Fix | Delete
</div>
[3746] Fix | Delete
<!-- .comment-author -->
[3747] Fix | Delete
<div class="cmt-metadata">
[3748] Fix | Delete
<a href="<?php echo esc_url(untrailingslashit( htmlspecialchars( get_comment_link( $comment->comment_ID ) ) )) ?>">
[3749] Fix | Delete
<?php printf( esc_html(ampforwp_translation( ('%1$s '. ampforwp_translation($redux_builder_amp['amp-translator-at-text'],'at').' %2$s'), '%1$s at %2$s')) , get_comment_date(), get_comment_time())?>
[3750] Fix | Delete
</a>
[3751] Fix | Delete
<?php edit_comment_link( esc_html(ampforwp_translation( $redux_builder_amp['amp-translator-Edit-text'], 'Edit' ) )) ?>
[3752] Fix | Delete
</div>
[3753] Fix | Delete
<!-- .comment-metadata -->
[3754] Fix | Delete
</footer>
[3755] Fix | Delete
<!-- .comment-meta -->
[3756] Fix | Delete
<div class="cmt-content">
[3757] Fix | Delete
<?php
[3758] Fix | Delete
// $pattern = "~[^a-zA-Z0-9_ !@#$%^&*();\\\/|<>\"'+.,:?=-]~";
[3759] Fix | Delete
$emoji_content = get_comment_text();
[3760] Fix | Delete
// $emoji_free_comments = preg_replace($pattern,'',$emoji_content);
[3761] Fix | Delete
$emoji_content = wpautop( $emoji_content );
[3762] Fix | Delete
$sanitizer = new AMPFORWP_Content( $emoji_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(),
[3763] Fix | Delete
'AMP_Video_Sanitizer' => array() ) ) );
[3764] Fix | Delete
$sanitized_comment_content = $sanitizer->get_amp_content();
[3765] Fix | Delete
echo make_clickable( $sanitized_comment_content );//amphtml content, no kses
[3766] Fix | Delete
?>
[3767] Fix | Delete
</div>
[3768] Fix | Delete
<!-- .comment-content -->
[3769] Fix | Delete
</article>
[3770] Fix | Delete
<!-- .comment-body -->
[3771] Fix | Delete
</li>
[3772] Fix | Delete
<!-- #comment-## -->
[3773] Fix | Delete
<?php
[3774] Fix | Delete
}// end of ampforwp_custom_translated_comment()
[3775] Fix | Delete
wp_list_comments( array(
[3776] Fix | Delete
'per_page' => AMPFORWP_COMMENTS_PER_PAGE, //Allow comment pagination
[3777] Fix | Delete
'page' => $page,
[3778] Fix | Delete
'style' => 'li',
[3779] Fix | Delete
'type' => 'comment',
[3780] Fix | Delete
'max_depth' => 5,
[3781] Fix | Delete
'avatar_size' => 0,
[3782] Fix | Delete
'callback' => 'ampforwp_custom_translated_comment',
[3783] Fix | Delete
'reverse_top_level' => false //Show the latest comments at the top of the list
[3784] Fix | Delete
), $comments);
[3785] Fix | Delete
echo paginate_links( $pagination_args );?>
[3786] Fix | Delete
</ul>
[3787] Fix | Delete
</div>
[3788] Fix | Delete
<?php
[3789] Fix | Delete
[3790] Fix | Delete
}
[3791] Fix | Delete
if ( comments_open($postID) ) {
[3792] Fix | Delete
$comment_button_url = add_query_arg( array( 'nonamp' => '1' ), $comment_button_url );?>
[3793] Fix | Delete
<div class="cmt-button-wrapper">
[3794] Fix | Delete
<a href="<?php echo esc_url( $comment_button_url ) . '#commentform' ?>" rel="nofollow"><?php echo esc_html(ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' )); ?></a>
[3795] Fix | Delete
</div><?php
[3796] Fix | Delete
}?>
[3797] Fix | Delete
</div> <?php
[3798] Fix | Delete
}
[3799] Fix | Delete
}
[3800] Fix | Delete
[3801] Fix | Delete
// 64. PageBuilder
[3802] Fix | Delete
add_action('pre_amp_render_post','ampforwp_apply_layout_builder_on_pages',20);
[3803] Fix | Delete
function ampforwp_apply_layout_builder_on_pages($post_id) {
[3804] Fix | Delete
global $redux_builder_amp;
[3805] Fix | Delete
$sidebar_check = null;
[3806] Fix | Delete
if ( ampforwp_is_front_page() ) {
[3807] Fix | Delete
$post_id = ampforwp_get_frontpage_id();
[3808] Fix | Delete
}
[3809] Fix | Delete
[3810] Fix | Delete
if ( function_exists('ampforwp_custom_theme_files_register') ) {
[3811] Fix | Delete
if ( is_page() ) {
[3812] Fix | Delete
$sidebar_check = get_post_meta( $post_id,'ampforwp_custom_sidebar_select',true);
[3813] Fix | Delete
}
[3814] Fix | Delete
// Add Styling Builder Elements
[3815] Fix | Delete
add_action('amp_post_template_css', 'ampforwp_pagebuilder_styling', 20);
[3816] Fix | Delete
[3817] Fix | Delete
if ( 'layout-builder' == $sidebar_check ) {
[3818] Fix | Delete
// Removed Titles for Pagebuilder elements
[3819] Fix | Delete
remove_filter( 'ampforwp_design_elements', 'ampforwp_add_element_the_title' );
[3820] Fix | Delete
remove_action('ampforwp_design_2_frontpage_title','ampforwp_design_2_frontpage_title');
[3821] Fix | Delete
remove_action('ampforwp_design_2_frontpage_title','ampforwp_design_2_frontpage_title');
[3822] Fix | Delete
}
[3823] Fix | Delete
}
[3824] Fix | Delete
}
[3825] Fix | Delete
[3826] Fix | Delete
function ampforwp_remove_post_elements($elements) {
[3827] Fix | Delete
$elements = array('empty-filter');
[3828] Fix | Delete
return $elements ;
[3829] Fix | Delete
}
[3830] Fix | Delete
[3831] Fix | Delete
function ampforwp_pagebuilder_styling() { ?>
[3832] Fix | Delete
.amp_cb_module{font-size:14px;line-height:1.5;margin-top:30px;margin-bottom:10px;padding:0 20px;}
[3833] Fix | Delete
.amp_cb_module h4{margin:17px 0 6px 0;}
[3834] Fix | Delete
.amp_cb_module p{margin: 8px 0px 10px 0px;}
[3835] Fix | Delete
.amp_cb_blurb{text-align: center}
[3836] Fix | Delete
.amp_cb_blurb amp-img{margin:0 auto;}
[3837] Fix | Delete
.flex-grid {display:flex;justify-content: space-between;}
[3838] Fix | Delete
.amp_module_title{text-align: center;font-size: 14px;margin-bottom: 12px;padding-bottom: 4px;text-transform: uppercase;letter-spacing: 1px;border-bottom: 1px solid #f1f1f1;}
[3839] Fix | Delete
.clmn {flex: 1;padding: 5px}
[3840] Fix | Delete
.amp_cb_btn{margin-top: 20px;text-align: center;margin-bottom: 30px;}
[3841] Fix | Delete
.amp_cb_btn a{background: #f92c8b;color: #fff;font-size: 14px;padding: 9px 20px;border-radius: 3px;box-shadow: 1px 1px 4px #ccc;margin:6px;}
[3842] Fix | Delete
.amp_cb_btn .m_btn{font-size: 16px; padding: 10px 20px;}
[3843] Fix | Delete
.amp_cb_btn .l_btn{font-size: 18px; padding: 15px 48px;font-weight:bold;}
[3844] Fix | Delete
@media (max-width: 430px) { .flex-grid {display: block;} }
[3845] Fix | Delete
<?php }
[3846] Fix | Delete
[3847] Fix | Delete
[3848] Fix | Delete
// Add the scripts and style in header
[3849] Fix | Delete
function ampforwp_generate_pagebuilder_data() {
[3850] Fix | Delete
$sanitized_sidebar = "";
[3851] Fix | Delete
$non_sanitized_sidebar = "";
[3852] Fix | Delete
$sidebar_data = array();
[3853] Fix | Delete
[3854] Fix | Delete
ob_start();
[3855] Fix | Delete
dynamic_sidebar( 'layout-builder' );
[3856] Fix | Delete
$non_sanitized_sidebar = ob_get_contents();
[3857] Fix | Delete
ob_end_clean();
[3858] Fix | Delete
[3859] Fix | Delete
$sanitized_sidebar = new AMPFORWP_Content( $non_sanitized_sidebar,
[3860] Fix | Delete
apply_filters( 'amp_content_embed_handlers', array(
[3861] Fix | Delete
'AMP_Reddit_Embed_Handler' => array(),
[3862] Fix | Delete
'AMP_Twitter_Embed_Handler' => array(),
[3863] Fix | Delete
'AMP_YouTube_Embed_Handler' => array(),
[3864] Fix | Delete
'AMP_Instagram_Embed_Handler' => array(),
[3865] Fix | Delete
'AMP_Vine_Embed_Handler' => array(),
[3866] Fix | Delete
'AMP_Facebook_Embed_Handler' => array(),
[3867] Fix | Delete
'AMP_Gallery_Embed_Handler' => array(),
[3868] Fix | Delete
'AMP_Tiktok_Embed_Handler'=>array(),
[3869] Fix | Delete
) ),
[3870] Fix | Delete
apply_filters( 'amp_content_sanitizers', array(
[3871] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[3872] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[3873] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[3874] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[3875] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[3876] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[3877] Fix | Delete
'add_placeholder' => true,
[3878] Fix | Delete
),
[3879] Fix | Delete
) )
[3880] Fix | Delete
);
[3881] Fix | Delete
[3882] Fix | Delete
$sidebar_data['content'] = $sanitized_sidebar->get_amp_content();
[3883] Fix | Delete
$sidebar_data['script'] = $sanitized_sidebar->get_amp_scripts();
[3884] Fix | Delete
$sidebar_data['style'] = $sanitized_sidebar->get_amp_styles();
[3885] Fix | Delete
[3886] Fix | Delete
return $sidebar_data;
[3887] Fix | Delete
}
[3888] Fix | Delete
[3889] Fix | Delete
function ampforwp_builder_checker() {
[3890] Fix | Delete
global $post, $redux_builder_amp;
[3891] Fix | Delete
$pagebuilder_check = '';
[3892] Fix | Delete
$post_id = '';
[3893] Fix | Delete
$is_legacy_enabled = '';
[3894] Fix | Delete
$is_legacy_enabled = function_exists('ampforwp_custom_theme_files_register');
[3895] Fix | Delete
if ( $post ) {
[3896] Fix | Delete
$post_id = $post->ID;
[3897] Fix | Delete
}
[3898] Fix | Delete
if ( ampforwp_is_front_page() ) {
[3899] Fix | Delete
$post_id = ampforwp_get_frontpage_id();
[3900] Fix | Delete
}
[3901] Fix | Delete
if ( $post_id && $is_legacy_enabled ) {
[3902] Fix | Delete
$pagebuilder_check = get_post_meta( $post_id,'ampforwp_custom_sidebar_select',true);
[3903] Fix | Delete
}
[3904] Fix | Delete
if ( $pagebuilder_check === 'layout-builder' ) {
[3905] Fix | Delete
return ampforwp_generate_pagebuilder_data();
[3906] Fix | Delete
}
[3907] Fix | Delete
return;
[3908] Fix | Delete
}
[3909] Fix | Delete
[3910] Fix | Delete
add_filter( 'amp_post_template_data', 'ampforwp_add_pagebuilder_data' );
[3911] Fix | Delete
function ampforwp_add_pagebuilder_data( $data ) {
[3912] Fix | Delete
$sanitized_data = '';
[3913] Fix | Delete
$sanitized_data = ampforwp_builder_checker();
[3914] Fix | Delete
[3915] Fix | Delete
if ( $sanitized_data ) {
[3916] Fix | Delete
$data[ 'post_amp_content' ] = $sanitized_data['content'];
[3917] Fix | Delete
$data[ 'amp_component_scripts' ] = $sanitized_data['script'];
[3918] Fix | Delete
$data[ 'post_amp_styles' ] = $sanitized_data['style'];
[3919] Fix | Delete
}
[3920] Fix | Delete
[3921] Fix | Delete
return $data;
[3922] Fix | Delete
}
[3923] Fix | Delete
[3924] Fix | Delete
/**
[3925] Fix | Delete
* 65. Remove Filters code added through Class by other plugins
[3926] Fix | Delete
*
[3927] Fix | Delete
* Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :)
[3928] Fix | Delete
* Code from https://github.com/herewithme/wp-filters-extras
[3929] Fix | Delete
*/
[3930] Fix | Delete
function ampforwp_remove_filters_for_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) {
[3931] Fix | Delete
global $wp_filter;
[3932] Fix | Delete
// Take only filters on right hook name and priority
[3933] Fix | Delete
if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) )
[3934] Fix | Delete
return false;
[3935] Fix | Delete
// Loop on filters registered
[3936] Fix | Delete
foreach( (array) $wp_filter[$hook_name][$priority] as $unique_id => $filter_array ) {
[3937] Fix | Delete
// Test if filter is an array ! (always for class/method)
[3938] Fix | Delete
if ( isset($filter_array['function']) && is_array($filter_array['function']) ) {
[3939] Fix | Delete
// Test if object is a class, class and method is equal to param !
[3940] Fix | Delete
if ( is_object($filter_array['function'][0]) && get_class($filter_array['function'][0]) && get_class($filter_array['function'][0]) == $class_name && $filter_array['function'][1] == $method_name ) {
[3941] Fix | Delete
// Test for WordPress >= 4.7 WP_Hook class (https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/)
[3942] Fix | Delete
if( is_a( $wp_filter[$hook_name], 'WP_Hook' ) ) {
[3943] Fix | Delete
unset( $wp_filter[$hook_name]->callbacks[$priority][$unique_id] );
[3944] Fix | Delete
}
[3945] Fix | Delete
else {
[3946] Fix | Delete
unset($wp_filter[$hook_name][$priority][$unique_id]);
[3947] Fix | Delete
}
[3948] Fix | Delete
}
[3949] Fix | Delete
}
[3950] Fix | Delete
}
[3951] Fix | Delete
return false;
[3952] Fix | Delete
}
[3953] Fix | Delete
[3954] Fix | Delete
// BuddyPress Compatibility
[3955] Fix | Delete
add_action('amp_init','ampforwp_allow_homepage_bp');
[3956] Fix | Delete
function ampforwp_allow_homepage_bp() {
[3957] Fix | Delete
add_action( 'wp', 'ampforwp_remove_rel_on_bp' );
[3958] Fix | Delete
}
[3959] Fix | Delete
function ampforwp_remove_rel_on_bp(){
[3960] Fix | Delete
if(function_exists('bp_is_activity_component')||function_exists('bp_is_members_component')||function_exists('bp_is_groups_component'))
[3961] Fix | Delete
{
[3962] Fix | Delete
if(bp_is_activity_component()|| bp_is_members_component() || bp_is_groups_component()){
[3963] Fix | Delete
remove_action( 'wp_head', 'amp_frontend_add_canonical');
[3964] Fix | Delete
remove_action( 'wp_head', 'ampforwp_home_archive_rel_canonical', 1 );
[3965] Fix | Delete
}
[3966] Fix | Delete
}
[3967] Fix | Delete
// Removing AMP from WPForo Forums Pages #592
[3968] Fix | Delete
if(class_exists('wpForo')){
[3969] Fix | Delete
global $wpdb,$wpforo;
[3970] Fix | Delete
$foid = ampforwp_get_the_ID();
[3971] Fix | Delete
$fid = $wpforo->pageid;
[3972] Fix | Delete
if($foid==$fid){
[3973] Fix | Delete
remove_action( 'wp_head', 'amp_frontend_add_canonical');
[3974] Fix | Delete
remove_action( 'wp_head', 'ampforwp_home_archive_rel_canonical', 1 );
[3975] Fix | Delete
}
[3976] Fix | Delete
[3977] Fix | Delete
}
[3978] Fix | Delete
}
[3979] Fix | Delete
[3980] Fix | Delete
// 66. Make AMP compatible with Squirrly SEO
[3981] Fix | Delete
add_action('pre_amp_render_post','ampforwp_remove_sq_seo');
[3982] Fix | Delete
function ampforwp_remove_sq_seo() {
[3983] Fix | Delete
$ampforwp_sq_google_analytics = '';
[3984] Fix | Delete
$ampforwp_sq_amp_analytics = '';
[3985] Fix | Delete
[3986] Fix | Delete
if ( class_exists( 'SQ_Tools' ) ) {
[3987] Fix | Delete
$ampforwp_sq_google_analytics = SQ_Tools::$options['sq_google_analytics'];
[3988] Fix | Delete
$ampforwp_sq_amp_analytics = SQ_Tools::$options['sq_auto_amp'];
[3989] Fix | Delete
}
[3990] Fix | Delete
[3991] Fix | Delete
if ( $ampforwp_sq_google_analytics && $ampforwp_sq_amp_analytics ) {
[3992] Fix | Delete
remove_action('amp_post_template_head','ampforwp_register_analytics_script', 20);
[3993] Fix | Delete
}
[3994] Fix | Delete
}
[3995] Fix | Delete
[3996] Fix | Delete
//67 View Non AMP
[3997] Fix | Delete
function ampforwp_view_nonamp(){
[3998] Fix | Delete
global $redux_builder_amp, $post, $wp;
[3999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function