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: amp.php
<?php
[0] Fix | Delete
namespace AMPforWP\AMPVendor;
[1] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[2] Fix | Delete
exit;
[3] Fix | Delete
}
[4] Fix | Delete
/**
[5] Fix | Delete
* Plugin Name: AMP
[6] Fix | Delete
* Description: Add AMP support to your WordPress site.
[7] Fix | Delete
* Plugin URI: https://github.com/automattic/amp-wp
[8] Fix | Delete
* Author: Automattic
[9] Fix | Delete
* Author URI: https://automattic.com
[10] Fix | Delete
* Version: 0.4.2
[11] Fix | Delete
* Text Domain: amp
[12] Fix | Delete
* License: GPLv2 or later
[13] Fix | Delete
*/
[14] Fix | Delete
// Make sure the `amp` query var has an explicit value.
[15] Fix | Delete
// Avoids issues when filtering the deprecated `query_string` hook.
[16] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\amp_force_query_var_value') ) {
[17] Fix | Delete
function amp_force_query_var_value( $query_vars ) {
[18] Fix | Delete
if ( isset( $query_vars[ AMP_QUERY_VAR ] ) && '' === $query_vars[ AMP_QUERY_VAR ] ) {
[19] Fix | Delete
$query_vars[ AMP_QUERY_VAR ] = 1;
[20] Fix | Delete
}
[21] Fix | Delete
return $query_vars;
[22] Fix | Delete
}
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
[26] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\amp_maybe_add_actions') ) {
[27] Fix | Delete
function amp_maybe_add_actions() {
[28] Fix | Delete
if ( ! is_singular() || is_feed() ) {
[29] Fix | Delete
return;
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
$is_amp_endpoint = is_amp_endpoint();
[33] Fix | Delete
[34] Fix | Delete
// Cannot use `get_queried_object` before canonical redirect; see https://core.trac.wordpress.org/ticket/35344
[35] Fix | Delete
global $wp_query;
[36] Fix | Delete
$post = $wp_query->post;
[37] Fix | Delete
[38] Fix | Delete
$supports = post_supports_amp( $post );
[39] Fix | Delete
[40] Fix | Delete
if ( ! $supports ) {
[41] Fix | Delete
if ( $is_amp_endpoint ) {
[42] Fix | Delete
wp_safe_redirect( get_permalink( $post->ID ) , 301);
[43] Fix | Delete
exit;
[44] Fix | Delete
}
[45] Fix | Delete
return;
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
if ( $is_amp_endpoint ) {
[49] Fix | Delete
amp_prepare_render();
[50] Fix | Delete
} else {
[51] Fix | Delete
amp_add_frontend_actions();
[52] Fix | Delete
}
[53] Fix | Delete
}
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\amp_load_classes') ) {
[57] Fix | Delete
function amp_load_classes() {
[58] Fix | Delete
require_once( AMP__VENDOR__DIR__ . '/includes/class-amp-post-template.php' ); // this loads everything else
[59] Fix | Delete
}
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\amp_add_frontend_actions') ) {
[63] Fix | Delete
function amp_add_frontend_actions() {
[64] Fix | Delete
require_once( AMP__VENDOR__DIR__ . '/includes/amp-frontend-actions.php' );
[65] Fix | Delete
}
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\amp_add_post_template_actions') ) {
[69] Fix | Delete
function amp_add_post_template_actions() {
[70] Fix | Delete
require_once( AMP__VENDOR__DIR__ . '/includes/amp-post-template-actions.php' );
[71] Fix | Delete
require_once( AMP__VENDOR__DIR__ . '/includes/amp-post-template-functions.php' );
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\amp_prepare_render') ) {
[75] Fix | Delete
function amp_prepare_render() {
[76] Fix | Delete
add_action( 'template_redirect', 'AMPforWP\\AMPVendor\\amp_render' );
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\amp_render') ) {
[80] Fix | Delete
function amp_render() {
[81] Fix | Delete
amp_load_classes();
[82] Fix | Delete
$post_id = get_queried_object_id();
[83] Fix | Delete
do_action( 'pre_amp_render_post', $post_id );
[84] Fix | Delete
$post = get_queried_object();
[85] Fix | Delete
if ( $post instanceof WP_Post && function_exists('amp_activate')) {
[86] Fix | Delete
amp_render_post( $post );
[87] Fix | Delete
exit;
[88] Fix | Delete
}
[89] Fix | Delete
if ( !function_exists('amp_activate')) {
[90] Fix | Delete
global $ampforwpTemplate;
[91] Fix | Delete
amp_add_post_template_actions();
[92] Fix | Delete
$template = $ampforwpTemplate = new AMP_Post_Template( $post_id );
[93] Fix | Delete
$template->load();
[94] Fix | Delete
// Set Header: last modified information
[95] Fix | Delete
$last_modified = true;
[96] Fix | Delete
$last_modified = apply_filters('ampforwp_update_last_modified_header', $last_modified);
[97] Fix | Delete
if( is_singular() && $post_id && $last_modified) {
[98] Fix | Delete
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
[99] Fix | Delete
}
[100] Fix | Delete
exit;
[101] Fix | Delete
}
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
/**
[105] Fix | Delete
* Bootstraps the AMP customizer.
[106] Fix | Delete
*
[107] Fix | Delete
* If the AMP customizer is enabled, initially drop the core widgets and menus panels. If the current
[108] Fix | Delete
* preview page isn't flagged as an AMP template, the core panels will be re-added and the AMP panel
[109] Fix | Delete
* hidden.
[110] Fix | Delete
*
[111] Fix | Delete
* @internal This callback must be hooked before priority 10 on 'plugins_loaded' to properly unhook
[112] Fix | Delete
* the core panels.
[113] Fix | Delete
*
[114] Fix | Delete
* @since 0.4
[115] Fix | Delete
*/
[116] Fix | Delete
if ( ! function_exists('AMPforWP\\AMPVendor\\_amp_bootstrap_customizer') ) {
[117] Fix | Delete
function _amp_bootstrap_customizer() {
[118] Fix | Delete
/**
[119] Fix | Delete
* Filter whether to enable the AMP template customizer functionality.
[120] Fix | Delete
*
[121] Fix | Delete
* @param bool $enable Whether to enable the AMP customizer. Default true.
[122] Fix | Delete
*/
[123] Fix | Delete
$amp_customizer_enabled = apply_filters( 'amp_customizer_is_enabled', true );
[124] Fix | Delete
[125] Fix | Delete
if ( true === $amp_customizer_enabled ) {
[126] Fix | Delete
amp_init_customizer();
[127] Fix | Delete
}
[128] Fix | Delete
}
[129] Fix | Delete
add_action( 'plugins_loaded', 'AMPforWP\\AMPVendor\\_amp_bootstrap_customizer', 9 );
[130] Fix | Delete
}
[131] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function