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.../includes/vendor/amp
File: jetpack-helper.php
<?php
[0] Fix | Delete
namespace AMPforWP\AMPVendor;
[1] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[2] Fix | Delete
exit;
[3] Fix | Delete
}
[4] Fix | Delete
// Jetpack bits.
[5] Fix | Delete
[6] Fix | Delete
add_action( 'pre_amp_render_post', 'AMPforWP\\AMPVendor\\amp_jetpack_mods' );
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Disable Jetpack features that are not compatible with AMP.
[10] Fix | Delete
*
[11] Fix | Delete
**/
[12] Fix | Delete
function amp_jetpack_mods() {
[13] Fix | Delete
if ( class_exists('Jetpack') ) {
[14] Fix | Delete
if ( \Jetpack::is_module_active( 'stats' ) ) {
[15] Fix | Delete
add_action( 'amp_post_template_footer', 'AMPforWP\\AMPVendor\\jetpack_amp_add_stats_pixel' );
[16] Fix | Delete
}
[17] Fix | Delete
amp_jetpack_disable_sharing();
[18] Fix | Delete
amp_jetpack_disable_related_posts();
[19] Fix | Delete
}
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
[23] Fix | Delete
function amp_jetpack_disable_sharing() {
[24] Fix | Delete
add_filter( 'sharing_show', '__return_false', 100 );
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Remove the Related Posts placeholder and headline that gets hooked into the_content
[29] Fix | Delete
*
[30] Fix | Delete
* That placeholder is useless since we can't ouput, and don't want to output Related Posts in AMP.
[31] Fix | Delete
*
[32] Fix | Delete
**/
[33] Fix | Delete
function amp_jetpack_disable_related_posts() {
[34] Fix | Delete
if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
[35] Fix | Delete
$jprp = \Jetpack_RelatedPosts::init();
[36] Fix | Delete
remove_filter( 'the_content', array( $jprp, 'filter_add_target_to_dom' ), 40 );
[37] Fix | Delete
}
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
function jetpack_amp_add_stats_pixel( $amp_template ) {
[41] Fix | Delete
if ( ! has_action( 'wp_footer', array( 'Automattic\Jetpack\Stats\Tracking_Pixel', 'add_amp_pixel' ) ) ) {
[42] Fix | Delete
return;
[43] Fix | Delete
}
[44] Fix | Delete
?>
[45] Fix | Delete
<amp-pixel src="<?php echo esc_url( jetpack_amp_build_stats_pixel_url() ); ?>"></amp-pixel>
[46] Fix | Delete
<?php
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Generate the stats pixel.
[51] Fix | Delete
*
[52] Fix | Delete
* Looks something like:
[53] Fix | Delete
* https://pixel.wp.com/g.gif?v=ext&j=1%3A3.9.1&blog=1234&post=5678&tz=-4&srv=example.com&host=example.com&ref=&rand=0.4107963021218808
[54] Fix | Delete
*/
[55] Fix | Delete
function jetpack_amp_build_stats_pixel_url() {
[56] Fix | Delete
global $wp_the_query;
[57] Fix | Delete
if ( method_exists('Automattic\Jetpack\Stats\Tracking_Pixel', 'build_view_data') ) {
[58] Fix | Delete
$data = \Automattic\Jetpack\Stats\Tracking_Pixel::build_view_data();
[59] Fix | Delete
} else {
[60] Fix | Delete
$blog = \Jetpack_Options::get_option( 'id' );
[61] Fix | Delete
$tz = get_option( 'gmt_offset' );
[62] Fix | Delete
$v = 'ext';
[63] Fix | Delete
$blog_url = parse_url( site_url() );
[64] Fix | Delete
$srv = $blog_url['host'];
[65] Fix | Delete
$j = sprintf( '%s:%s', JETPACK__API_VERSION, JETPACK__VERSION );
[66] Fix | Delete
$post = $wp_the_query->get_queried_object_id();
[67] Fix | Delete
$data = compact( 'v', 'j', 'blog', 'post', 'tz', 'srv' );
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
$data['host'] = rawurlencode( AMPFROWP_HOST_NAME );
[71] Fix | Delete
$data['rand'] = 'RANDOM'; // amp placeholder
[72] Fix | Delete
$data['ref'] = 'DOCUMENT_REFERRER'; // amp placeholder
[73] Fix | Delete
$data = array_map( 'rawurlencode' , $data );
[74] Fix | Delete
return add_query_arg( $data, 'https://pixel.wp.com/g.gif' );
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function