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
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/accelera.../componen.../comments
File: comments.php
<?php
[0] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[1] Fix | Delete
exit;
[2] Fix | Delete
}
[3] Fix | Delete
function ampforwp_framework_get_comments(){
[4] Fix | Delete
global $redux_builder_amp;
[5] Fix | Delete
$display_comments_on = "";
[6] Fix | Delete
$display_comments_on = ampforwp_get_comments_status();
[7] Fix | Delete
do_action('ampforwp_comment_start_hook');
[8] Fix | Delete
if ( $display_comments_on ) {
[9] Fix | Delete
if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
[10] Fix | Delete
echo ampforwp_framework_get_facebook_comments();
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
if ( $redux_builder_amp['ampforwp-disqus-comments-support'] ) {
[14] Fix | Delete
ampforwp_framework_get_disqus_comments();
[15] Fix | Delete
}
[16] Fix | Delete
if ( $redux_builder_amp['ampforwp-vuukle-comments-support'] ) {
[17] Fix | Delete
ampforwp_framework_get_vuukle_comments();
[18] Fix | Delete
}
[19] Fix | Delete
if ( $redux_builder_amp['ampforwp-spotim-comments-support'] ) {
[20] Fix | Delete
ampforwp_framework_get_spotim_comments();
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
if ( isset($redux_builder_amp['wordpress-comments-support']) && true == $redux_builder_amp['wordpress-comments-support'] ) {
[24] Fix | Delete
do_action('ampforwp_before_comment_hook'); ?>
[25] Fix | Delete
<div class="amp-comments">
[26] Fix | Delete
<?php
[27] Fix | Delete
// Gather comments for a specific page/post
[28] Fix | Delete
$postID = $comments = $max_page = "";
[29] Fix | Delete
$postID = get_the_ID();
[30] Fix | Delete
if ( ampforwp_is_front_page() ) {
[31] Fix | Delete
$postID = ampforwp_get_frontpage_id();
[32] Fix | Delete
}
[33] Fix | Delete
$comment_order = get_option( 'comment_order' );
[34] Fix | Delete
$comments = get_comments(array(
[35] Fix | Delete
'post_id' => $postID,
[36] Fix | Delete
'order' => esc_attr($comment_order),
[37] Fix | Delete
'status' => 'approve' //Change this to the type of comments to be displayed
[38] Fix | Delete
));
[39] Fix | Delete
[40] Fix | Delete
if ( $comments ) { ?>
[41] Fix | Delete
<div id="comments" class="amp-comments-wrapper">
[42] Fix | Delete
<h3><span><?php echo esc_html(ampforwp_translation($redux_builder_amp['amp-translator-view-comments-text'], 'View Comments' ));?></span></h3>
[43] Fix | Delete
<ul><?php
[44] Fix | Delete
// Display the list of comments
[45] Fix | Delete
function ampforwp_custom_translated_comment($comment, $args, $depth){
[46] Fix | Delete
$GLOBALS['comment'] = $comment;
[47] Fix | Delete
global $redux_builder_amp;
[48] Fix | Delete
$comment_author_img_url = "";
[49] Fix | Delete
$comment_author_img_url = ampforwp_get_comments_gravatar( $comment );
[50] Fix | Delete
[51] Fix | Delete
?>
[52] Fix | Delete
<li id="li-comment-<?php comment_ID() ?>"
[53] Fix | Delete
<?php comment_class(); ?> >
[54] Fix | Delete
<article id="comment-<?php comment_ID(); ?>" class="cmt-body">
[55] Fix | Delete
<footer class="cmt-meta">
[56] Fix | Delete
<?php if($comment_author_img_url){ ?>
[57] Fix | Delete
<amp-img src="<?php echo esc_url($comment_author_img_url); ?>" width="40" height="40" layout="fixed" class="cmt-author-img"></amp-img>
[58] Fix | Delete
<?php } ?>
[59] Fix | Delete
<div class="cmt-author vcard">
[60] Fix | Delete
<?php
[61] 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()) ?>
[62] Fix | Delete
</div>
[63] Fix | Delete
<div class="cmt-metadata">
[64] Fix | Delete
<a href="<?php echo htmlspecialchars( trailingslashit( get_comment_link( $comment->comment_ID ) ) ) ?>">
[65] Fix | Delete
<?php printf( 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())?>
[66] Fix | Delete
</a>
[67] Fix | Delete
<?php edit_comment_link( ampforwp_translation( $redux_builder_amp['amp-translator-Edit-text'], 'Edit' ) ) ?>
[68] Fix | Delete
</div>
[69] Fix | Delete
</footer>
[70] Fix | Delete
<div class="cmt-content">
[71] Fix | Delete
<?php
[72] Fix | Delete
$comment_content = get_comment_text();
[73] Fix | Delete
$comment_content = wpautop( $comment_content );
[74] Fix | Delete
$sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
[75] Fix | Delete
'AMP_Img_Sanitizer' => array(),
[76] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[77] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[78] Fix | Delete
'AMP_Iframe_Sanitizer' =>
[79] Fix | Delete
array(
[80] Fix | Delete
'add_placeholder' => true,
[81] Fix | Delete
) ) ) );
[82] Fix | Delete
$sanitized_comment_content = $sanitizer->get_amp_content();
[83] Fix | Delete
echo make_clickable( $sanitized_comment_content ); ?>
[84] Fix | Delete
</div>
[85] Fix | Delete
<?php do_action('ampforwp_reply_comment_form', $comment, $args, $depth); ?>
[86] Fix | Delete
</article>
[87] Fix | Delete
<?php
[88] Fix | Delete
}
[89] Fix | Delete
wp_list_comments( array(
[90] Fix | Delete
//Allow comment pagination
[91] Fix | Delete
'per_page' => AMPFORWP_COMMENTS_PER_PAGE ,
[92] Fix | Delete
'style' => 'li',
[93] Fix | Delete
'type' => 'comment',
[94] Fix | Delete
'max_depth' => 5,
[95] Fix | Delete
'avatar_size' => 0,
[96] Fix | Delete
'callback' => 'ampforwp_custom_translated_comment',
[97] Fix | Delete
'reverse_top_level' => false //Show the latest comments at the top of the list
[98] Fix | Delete
), $comments); ?>
[99] Fix | Delete
</ul> <?php
[100] Fix | Delete
$max_page = get_comment_pages_count($comments, AMPFORWP_COMMENTS_PER_PAGE);
[101] Fix | Delete
$args = array(
[102] Fix | Delete
'base' => add_query_arg( array('cpage' => '%#%', 'amp' => '1'), get_permalink() ),
[103] Fix | Delete
'format' => '',
[104] Fix | Delete
'total' => $max_page,
[105] Fix | Delete
'echo' => false,
[106] Fix | Delete
'add_fragment' => '#comments',
[107] Fix | Delete
);
[108] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-amp-takeover')){
[109] Fix | Delete
$args['base'] = get_the_permalink().'comment-page-%#%';
[110] Fix | Delete
}
[111] Fix | Delete
if ( paginate_comments_links($args) ) { ?>
[112] Fix | Delete
<div class="cmts-wrap">
[113] Fix | Delete
<?php echo paginate_comments_links( $args ); ?>
[114] Fix | Delete
</div>
[115] Fix | Delete
<?php } ?>
[116] Fix | Delete
</div> <!-- .amp-comments-wrapper -->
[117] Fix | Delete
<?php // if amp-comments extension is enabled then hide this button
[118] Fix | Delete
} // if ( $comments )
[119] Fix | Delete
if ( ! defined( 'AMP_COMMENTS_VERSION' ) && comments_open($postID) ) { ?>
[120] Fix | Delete
<div class="amp-comment-button">
[121] Fix | Delete
<?php if ( comments_open($postID) ) {
[122] Fix | Delete
$nofollow = '';
[123] Fix | Delete
if(true ==ampforwp_get_setting('ampforwp-nofollow-comment-btn')){
[124] Fix | Delete
$nofollow = 'rel=nofollow';
[125] Fix | Delete
}
[126] Fix | Delete
?>
[127] Fix | Delete
<a href="<?php echo ampforwp_comment_button_url(); ?>" title="<?php echo ampforwp_get_setting('amp-translator-leave-a-comment-text')?>" <?php echo esc_html($nofollow) ?> ><?php echo esc_html(ampforwp_translation( ampforwp_get_setting('amp-translator-leave-a-comment-text'), 'Leave a Comment' ) ); ?></a> <?php } ?>
[128] Fix | Delete
</div>
[129] Fix | Delete
<?php } ?>
[130] Fix | Delete
</div>
[131] Fix | Delete
<?php do_action('ampforwp_after_comment_hook');
[132] Fix | Delete
}
[133] Fix | Delete
} // end $display_comments_on
[134] Fix | Delete
do_action('ampforwp_comment_end_hook');
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
//Facebook Comments
[138] Fix | Delete
function ampforwp_framework_get_facebook_comments(){
[139] Fix | Delete
global $redux_builder_amp;
[140] Fix | Delete
$facebook_comments_markup = $lang = $locale = '';
[141] Fix | Delete
$lang = ampforwp_get_setting('ampforwp-fb-comments-lang');
[142] Fix | Delete
if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
[143] Fix | Delete
if( ampforwp_is_non_amp() && isset($redux_builder_amp['ampforwp-amp-convert-to-wp']) && $redux_builder_amp['ampforwp-amp-convert-to-wp']) {
[144] Fix | Delete
$facebook_comments_markup = '<div class="fb-comments" data-href="' . esc_url(get_permalink()) . '" data-width="800px" data-numposts="'.esc_attr($redux_builder_amp['ampforwp-number-of-fb-no-of-comments']).'"></div>';
[145] Fix | Delete
}
[146] Fix | Delete
else {
[147] Fix | Delete
$facebook_comments_markup = '<section class="amp-facebook-comments">';
[148] Fix | Delete
if(true == ampforwp_get_setting('ampforwp-facebook-comments-title')){
[149] Fix | Delete
$facebook_comments_markup .= '<h5>'. esc_html__(ampforwp_translation(ampforwp_get_setting('ampforwp-facebook-comments-title'), 'Leave a Comment'),'accelerated-mobile-pages') .'</h5>';
[150] Fix | Delete
}
[151] Fix | Delete
$facebook_comments_markup .= '<amp-facebook-comments width=486 height=357
[152] Fix | Delete
layout="responsive" '.'data-locale = "'.esc_attr($lang).'"'.' data-numposts=';
[153] Fix | Delete
$facebook_comments_markup .= '"'. esc_attr($redux_builder_amp['ampforwp-number-of-fb-no-of-comments']). '"';
[154] Fix | Delete
if(ampforwp_get_data_consent()){
[155] Fix | Delete
$facebook_comments_markup .= ' data-block-on-consent ';
[156] Fix | Delete
}
[157] Fix | Delete
$facebook_comments_markup .= 'data-href="' . esc_url(get_permalink()) . '"';
[158] Fix | Delete
$facebook_comments_markup .= '></amp-facebook-comments></section>';
[159] Fix | Delete
}
[160] Fix | Delete
return $facebook_comments_markup;
[161] Fix | Delete
}
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
//Disqus Comments
[165] Fix | Delete
function ampforwp_framework_get_disqus_comments(){
[166] Fix | Delete
global $redux_builder_amp;
[167] Fix | Delete
$width = $height = 420;
[168] Fix | Delete
[169] Fix | Delete
$layout = "";
[170] Fix | Delete
$layout = 'responsive';
[171] Fix | Delete
if ( isset($redux_builder_amp['ampforwp-disqus-layout']) && 'fixed' == $redux_builder_amp['ampforwp-disqus-layout'] ) {
[172] Fix | Delete
$layout = 'fixed';
[173] Fix | Delete
}
[174] Fix | Delete
$height = ampforwp_get_setting('ampforwp-disqus-height');
[175] Fix | Delete
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
[176] Fix | Delete
global $post; $post_slug = rawurlencode($post->post_name);
[177] Fix | Delete
[178] Fix | Delete
$disqus_script_host_url = "https://ampforwp.appspot.com/?api=". AMPFORWP_DISQUS_URL;
[179] Fix | Delete
[180] Fix | Delete
if( $redux_builder_amp['ampforwp-disqus-host-position'] == 0 ) {
[181] Fix | Delete
$disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
$disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.rawurlencode(get_permalink()).'&disqus_name='. esc_url( ampforwp_get_setting('ampforwp-disqus-comments-name') ) ."/embed.js" ;
[185] Fix | Delete
?>
[186] Fix | Delete
<section class="amp-disqus-comments">
[187] Fix | Delete
<amp-iframe
[188] Fix | Delete
height=<?php echo esc_attr($height); ?>
[189] Fix | Delete
width=<?php echo esc_attr($width); ?>
[190] Fix | Delete
layout="<?php echo esc_attr($layout); ?>"
[191] Fix | Delete
sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"
[192] Fix | Delete
resizable
[193] Fix | Delete
frameborder="0"
[194] Fix | Delete
<?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?>
[195] Fix | Delete
src="<?php echo esc_url($disqus_url); ?>" title="<?php echo esc_html__('Disqus Comments.','accelerated-mobile-pages'); ?>">
[196] Fix | Delete
<div overflow tabindex="0" role="button" aria-label="Read more"><?php echo esc_html__('Disqus Comments Loading...','accelerated-mobile-pages') ?></div>
[197] Fix | Delete
</amp-iframe>
[198] Fix | Delete
</section>
[199] Fix | Delete
<?php
[200] Fix | Delete
}
[201] Fix | Delete
}
[202] Fix | Delete
function ampforwp_framework_get_vuukle_comments(){
[203] Fix | Delete
echo ampforwp_vuukle_comments_markup();
[204] Fix | Delete
}
[205] Fix | Delete
function ampforwp_framework_get_spotim_comments(){
[206] Fix | Delete
global $post;
[207] Fix | Delete
$spotId ='';
[208] Fix | Delete
if( true == ampforwp_get_setting('ampforwp-spotim-comments-apiKey') && ampforwp_get_setting('ampforwp-spotim-comments-apiKey') !== ""){
[209] Fix | Delete
$spotId = ampforwp_get_setting('ampforwp-spotim-comments-apiKey');
[210] Fix | Delete
}
[211] Fix | Delete
$srcUrl = 'https://amp.spot.im/production.html?spot_im_highlight_immediate=true';
[212] Fix | Delete
$srcUrl = add_query_arg('spotId' ,$spotId, $srcUrl);
[213] Fix | Delete
$srcUrl = add_query_arg('postId' , $post->ID, $srcUrl);
[214] Fix | Delete
$spotim_html = '<amp-iframe width="375" height="815" resizable sandbox="allow-scripts allow-same-origin allow-popups allow-top-navigation" layout="responsive"
[215] Fix | Delete
frameborder="0" src="'.esc_url($srcUrl).'">
[216] Fix | Delete
<amp-img placeholder height="815" layout="fill" src="//amp.spot.im/loader.png"></amp-img>
[217] Fix | Delete
<div overflow class="spot-im-amp-overflow" tabindex="0" role="button" aria-label="Read more">'.esc_html__('Load more...','accelerated-mobile-pages').'</div>
[218] Fix | Delete
</amp-iframe>';
[219] Fix | Delete
echo $spotim_html; // escaped above
[220] Fix | Delete
}
[221] Fix | Delete
[222] Fix | Delete
// Comments Scripts
[223] Fix | Delete
add_filter( 'ampforwp_post_template_data', 'ampforwp_framework_comments_scripts' );
[224] Fix | Delete
function ampforwp_framework_comments_scripts( $data ) {
[225] Fix | Delete
[226] Fix | Delete
$facebook_comments_check = ampforwp_framework_get_facebook_comments();
[227] Fix | Delete
global $redux_builder_amp;
[228] Fix | Delete
$is_pb_enabled = '';
[229] Fix | Delete
$is_pb_enabled = checkAMPforPageBuilderStatus(get_the_ID());
[230] Fix | Delete
$display_comments_on = "";
[231] Fix | Delete
$display_comments_on = ampforwp_get_comments_status();
[232] Fix | Delete
$isBBPress = (function_exists('is_bbpress') ? is_bbpress() : false );
[233] Fix | Delete
if ( $facebook_comments_check && true == ampforwp_get_setting('ampforwp-facebook-comments-support') && $display_comments_on && !is_front_page() && !$is_pb_enabled && !$isBBPress ) {
[234] Fix | Delete
if ( empty( $data['amp_component_scripts']['amp-facebook-comments'] ) ) {
[235] Fix | Delete
$data['amp_component_scripts']['amp-facebook-comments'] = 'https://cdn.ampproject.org/v0/amp-facebook-comments-0.1.js';
[236] Fix | Delete
}
[237] Fix | Delete
}
[238] Fix | Delete
if ( $redux_builder_amp['ampforwp-disqus-comments-support'] && $display_comments_on && comments_open() && !$is_pb_enabled ) {
[239] Fix | Delete
if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
[240] Fix | Delete
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
[241] Fix | Delete
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
[242] Fix | Delete
}
[243] Fix | Delete
}
[244] Fix | Delete
}
[245] Fix | Delete
if ( isset($redux_builder_amp['ampforwp-vuukle-comments-support'])
[246] Fix | Delete
&& $redux_builder_amp['ampforwp-vuukle-comments-support']
[247] Fix | Delete
&& $display_comments_on && comments_open() && !$is_pb_enabled
[248] Fix | Delete
) {
[249] Fix | Delete
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
[250] Fix | Delete
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
[251] Fix | Delete
}
[252] Fix | Delete
if (ampforwp_get_setting('ampforwp-vuukle-Ads-before-comments') && empty( $data['amp_component_scripts']['amp-ad'] ) ) {
[253] Fix | Delete
$data['amp_component_scripts']['amp-ad'] = 'https://cdn.ampproject.org/v0/amp-ad-0.1.js';
[254] Fix | Delete
}
[255] Fix | Delete
}
[256] Fix | Delete
//spotim
[257] Fix | Delete
if ( isset($redux_builder_amp['ampforwp-spotim-comments-support'])
[258] Fix | Delete
&& $redux_builder_amp['ampforwp-spotim-comments-support']
[259] Fix | Delete
&& $display_comments_on && comments_open() ) {
[260] Fix | Delete
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
[261] Fix | Delete
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
}
[265] Fix | Delete
return $data;
[266] Fix | Delete
}
[267] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function