C:\xampp\htdocs\landing\wp-content\plugins\penci-pennews-amp\includes\utils\class-amp-wp-utils.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
<?php

class Penci_AMP_WP_Utils {
    
/**
     * wp_parse_url in < WordPress 4.7 does not respect the component arg, so we're adding this helper so we can use it.
     *
     * This can be removed once 4.8 is out and we bump up our min supported WP version.
     */
    
public static function parse_url$url$component = -) {
        
$parsed wp_parse_url$url$component );

        
// Because < 4.7 always returned a full array regardless of component
        
if ( -!== $component && is_array$parsed ) ) {
            return 
self::_get_component_from_parsed_url_array$parsed$component );
        }

        return 
$parsed;
    }

    
/**
     * Included for 4.6 back-compat
     *
     * Copied from https://developer.wordpress.org/reference/functions/_get_component_from_parsed_url_array/
     */
    
protected static function _get_component_from_parsed_url_array$url_parts$component = -) {
        if ( -
=== $component ) {
            return 
$url_parts;
        }

        
$key self::_wp_translate_php_url_constant_to_key$component );
        if ( 
false !== $key && is_array$url_parts ) && isset( $url_parts$key ] ) ) {
            return 
$url_parts$key ];
        }

        return 
null;
    }

    
/**
     * Included for 4.6 back-compat
     *
     * Copied from https://developer.wordpress.org/reference/functions/_wp_translate_php_url_constant_to_key/
     */
    
protected static function _wp_translate_php_url_constant_to_key$constant ) {
        
$translation = array(
            
PHP_URL_SCHEME   => 'scheme',
            
PHP_URL_HOST     => 'host',
            
PHP_URL_PORT     => 'port',
            
PHP_URL_USER     => 'user',
            
PHP_URL_PASS     => 'pass',
            
PHP_URL_PATH     => 'path',
            
PHP_URL_QUERY    => 'query',
            
PHP_URL_FRAGMENT => 'fragment',
        );

        if ( isset( 
$translation$constant ] ) ) {
            return 
$translation$constant ];
        }

        return 
false;
    }
}
x

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