C:\xampp\htdocs\landing\wp-content\plugins\amp\includes\deprecated.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?php
/**
 * Deprecated functions.
 *
 * @package AMP
 */

/**
 * Load classes.
 *
 * @since 0.2
 * @codeCoverageIgnore
 * @deprecated As of 0.6 since autoloading is now employed.
 * @internal
 */
function amp_load_classes() {
    
_deprecated_function__FUNCTION__'0.6' );
}

/**
 * Conditionally add AMP actions or render the transitional mode template(s).
 *
 * If the request is for an AMP page and this is in 'canonical mode,' redirect to the non-AMP page.
 * It won't need this plugin's template system, nor the frontend actions like the 'rel' link.
 *
 * @codeCoverageIgnore
 * @deprecated This function is not used when 'amp' theme support is added.
 * @global WP_Query $wp_query
 * @since 0.2
 * @return void
 */
function amp_maybe_add_actions() {
    
_deprecated_function__FUNCTION__'1.5' );

    
// Short-circuit when theme supports AMP, as everything is handled by AMP_Theme_Support.
    
if ( current_theme_supportsAMP_Theme_Support::SLUG ) ) {
        return;
    }

    
// The remaining logic here is for transitional mode running in themes that don't support AMP, the template system in AMP<=0.6.
    
global $wp_query;
    if ( ! ( 
is_singular() || $wp_query->is_posts_page ) || is_feed() ) {
        return;
    }

    
$is_amp_request amp_is_request();

    
/**
     * Queried post object.
     *
     * @var WP_Post $post
     */
    
$post get_queried_object();
    if ( ! 
amp_is_post_supported$post ) ) {
        if ( 
$is_amp_request ) {
            
/*
             * Temporary redirect is used for admin users because reader mode and AMP support can be enabled by user at any time,
             * so they will be able to make AMP available for this URL and see the change without wrestling with the redirect cache.
             */
            
wp_safe_redirectget_permalink$post->ID ), current_user_can'manage_options' ) ? 302 301 );
            exit;
        }
        return;
    }

    if ( 
$is_amp_request ) {

        
// Prevent infinite URL space under /amp/ endpoint.
        
global $wp;
        
$path_args = [];
        
wp_parse_str$wp->matched_query$path_args );
        if ( isset( 
$path_argsamp_get_slug() ] ) && '' !== $path_argsamp_get_slug() ] ) {
            
wp_safe_redirectamp_get_permalink$post->ID ), 301 );
            exit;
        }

        
amp_prepare_render();
    } else {
        
amp_add_frontend_actions();
    }
}

/**
 * Add post template actions.
 *
 * @since 0.2
 * @codeCoverageIgnore
 * @deprecated This function is not used when 'amp' theme support is added.
 */
function amp_add_post_template_actions() {
    
_deprecated_function__FUNCTION__'1.5' );
    require_once 
AMP__DIR__ '/includes/amp-post-template-functions.php';
    
amp_post_template_init_hooks();
}

/**
 * Add action to do post template rendering at template_redirect action.
 *
 * @since 0.2
 * @since 1.0 The amp_render() function is called at template_redirect action priority 11 instead of priority 10.
 * @codeCoverageIgnore
 * @deprecated This function is not used when 'amp' theme support is added.
 */
function amp_prepare_render() {
    
_deprecated_function__FUNCTION__'1.5' );
    
add_action'template_redirect''amp_render'11 );
}

/**
 * Render AMP for queried post.
 *
 * @since 0.1
 * @codeCoverageIgnore
 * @deprecated This function is not used when 'amp' theme support is added.
 */
function amp_render() {
    
_deprecated_function__FUNCTION__'1.5' );

    
// Note that queried object is used instead of the ID so that the_preview for the queried post can apply.
    
$post get_queried_object();
    if ( 
$post instanceof WP_Post ) {
        
amp_render_post$post );
        exit;
    }
}

/**
 * Render AMP post template.
 *
 * @since 0.5
 * @codeCoverageIgnore
 * @deprecated Rendering a post is now handled by AMP_Theme_Support.
 *
 * @param WP_Post|int $post Post.
 * @global WP_Query $wp_query
 */
function amp_render_post$post ) {
    
_deprecated_function__FUNCTION__'1.5' );
    global 
$wp_query;

    if ( ! ( 
$post instanceof WP_Post ) ) {
        
$post get_post$post );
        if ( ! 
$post ) {
            return;
        }
    }
    
$post_id $post->ID;

    
/*
     * If amp_render_post is called directly outside of the standard endpoint, amp_is_request() will return false,
     * which is not ideal for any code that expects to run in an AMP context.
     * Let's force the value to be true while we render AMP.
     */
    
$was_set = isset( $wp_query->query_varsamp_get_slug() ] );
    if ( ! 
$was_set ) {
        
$wp_query->query_varsamp_get_slug() ] = true;
    }

    
// Prevent New Relic from causing invalid AMP responses due the NREUM script it injects after the meta charset.
    
if ( extension_loaded'newrelic' ) ) {
        
newrelic_disable_autorum();
    }

    
/**
     * Fires before rendering a post in AMP.
     *
     * This action is not triggered when 'amp' theme support is present. Instead, you should use 'template_redirect' action and check if `amp_is_request()`.
     *
     * @since 0.2
     * @deprecated Check amp_is_request() on the template_redirect action instead.
     *
     * @param int $post_id Post ID.
     */
    
do_action'pre_amp_render_post'$post_id );

    
amp_add_post_template_actions();
    
$template = new AMP_Post_Template$post );
    
$template->load();

    if ( ! 
$was_set ) {
        unset( 
$wp_query->query_varsamp_get_slug() ] );
    }
}

/**
 * Print scripts.
 *
 * @codeCoverageIgnore
 * @deprecated Scripts are now automatically added.
 * @internal
 * @see amp_register_default_scripts()
 * @see amp_filter_script_loader_tag()
 * @param AMP_Post_Template $amp_template Template.
 */
function amp_post_template_add_scripts$amp_template ) {
    
_deprecated_function__FUNCTION__'1.5' );
    
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    
echo amp_render_scripts(
        
array_merge(
            [
                
// Just in case the runtime has been overridden by amp_post_template_data filter.
                
'amp-runtime' => $amp_template->get'amp_runtime_script' ),
            ],
            
$amp_template->get'amp_component_scripts', [] )
        )
    );
}

/**
 * Print boilerplate CSS.
 *
 * @codeCoverageIgnore
 * @deprecated Boilerplate is now automatically added via the ampproject/optimizer library.
 * @internal
 * @since 0.3
 * @see amp_get_boilerplate_code()
 */
function amp_post_template_add_boilerplate_css() {
    
_deprecated_function__FUNCTION__'1.5' );
    echo 
amp_get_boilerplate_code(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

/**
 * Print Schema.org metadata.
 *
 * @codeCoverageIgnore
 * @deprecated Since 0.7
 * @internal
 */
function amp_post_template_add_schemaorg_metadata() {
    
_deprecated_function__FUNCTION__'0.7''amp_print_schemaorg_metadata' );
    
amp_print_schemaorg_metadata();
}

/**
 * Bootstrap AMP post meta box.
 *
 * This function must be invoked only once through the 'wp_loaded' action.
 *
 * @since 0.6
 * @codeCoverageIgnore
 * @deprecated Since 1.5.0, as admin class bootstrapping is moved to amp_bootstrap_admin().
 * @internal
 */
function amp_post_meta_box() {
    
_deprecated_function__FUNCTION__'1.5.0' );
}

/**
 * Bootstrap the AMP admin pointer class.
 *
 * @since 1.0
 * @codeCoverageIgnore
 * @deprecated Since 1.5.0, as admin class bootstrapping is moved to amp_bootstrap_admin().
 * @internal
 */
function amp_admin_pointer() {
    
_deprecated_function__FUNCTION__'1.5.0' );
}

/**
 * Print admin notice if the Xdebug extension is loaded.
 *
 * @since 1.3
 * @deprecated 1.5.0 Warning moved to Site Health.
 * @internal
 * @see AmpProject\AmpWP\Admin\SiteHealth::xdebug_extension()
 */
function _amp_xdebug_admin_notice() {
    
_deprecated_function__FUNCTION__'1.5.0' );

    
?>
    <div class="notice notice-warning">
        <p>
            <?php
            esc_html_e
(
                
'Your server currently has the Xdebug PHP extension loaded. This can cause some of the AMP plugin\'s processes to timeout depending on your system resources and configuration. Please deactivate Xdebug for the best experience.',
                
'amp'
            
);
            
?>
        </p>
    </div>
    <?php
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586