Plugin Directory

Changeset 2158044


Ignore:
Timestamp:
09/17/2019 06:54:20 PM (6 years ago)
Author:
pixelative
Message:

Resolved referenced AMP URL is self-canonical AMP URL when 'AMP URL Format' is at end.

Location:
amp-wp
Files:
377 added
4 edited

Legend:

Unmodified
Added
Removed
  • amp-wp/trunk/README.txt

    r2157488 r2158044  
    66Tested up to: 5.2.3
    77Requires PHP: 5.6
    8 Stable tag: 1.5.9
     8Stable tag: 1.5.10
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    174174== Changelog ==
    175175
     176= 1.5.10 - 2019-09-17 =
     177* Fix: Resolved referenced AMP URL is self-canonical AMP URL when 'AMP URL Format' is at end.
     178
    176179= 1.5.9 - 2019-09-16 =
    177 * Fix: Resolved referenced AMP URL is self-canonical AMP URL.
     180* Fix: Resolved referenced AMP URL is self-canonical AMP URL when 'AMP URL Format' is at start.
    178181
    179182= 1.5.8 - 2019-07-18 =
     
    310313== Upgrade Notice ==
    311314
    312 = 1.5.9 =
    313 1.5.9 is an important update to fix referenced AMP URL is self-canonical AMP URL.
     315= 1.5.10 =
     3161.5.10 is an important update to fix referenced AMP URL is self-canonical AMP URL when 'AMP URL Format' is at end.
  • amp-wp/trunk/admin/partials/settings/amp-wp-admin-general.php

    r2125154 r2158044  
    8989                            <div class="description">
    9090                                <p><?php esc_html_e( 'You can exclude URLs of your site to prevent converting them into AMP URL inside your site.', 'amp-wp' ); ?></p>
    91                                 <p><?php _e( 'You can use <strong>*</strong> in the end of URL to exclude all URLs that start with it. e.g. <span class="pre">https://yoursite.com/test/*</span>', 'amp-wp' ); ?></p>
     91                                <p><?php _e( 'You can use <strong>*</strong> in the end of URL to exclude all URLs that start with it. e.g. <span class="pre">//yoursite.com/test/*</span>', 'amp-wp' ); ?></p>
    9292                            </div>
    9393                        </td>
     
    118118                            </select>
    119119                            <div class="description">
    120                                 <p><strong><?php esc_html_e( 'Start Point:', 'amp-wp' ); ?></strong> <span class="pre"><?php _e( 'https://yoursite.com/<strong>amp</strong>/post/', 'amp-wp' ); ?></span></p>
    121                                 <p><strong><?php esc_html_e( 'End Point:', 'amp-wp' ); ?></strong> <span class="pre"><?php _e( 'https://yoursite.com/post/<strong>amp</strong>/', 'amp-wp' ); ?></span></p>
     120                                <p><strong><?php esc_html_e( 'Start Point:', 'amp-wp' ); ?></strong> <span class="pre"><?php _e( '//yoursite.com/<strong>amp</strong>/post/', 'amp-wp' ); ?></span></p>
     121                                <p><strong><?php esc_html_e( 'End Point:', 'amp-wp' ); ?></strong> <span class="pre"><?php _e( '//yoursite.com/post/<strong>amp</strong>/', 'amp-wp' ); ?></span></p>
    122122                            </div>
    123123                        </td>
  • amp-wp/trunk/amp-wp.php

    r2157488 r2158044  
    1616 * Plugin URI:          https://wordpress.org/plugins/amp-wp
    1717 * Description:         Automagically add Google AMP functionality to your site. Tons of Premium Features for FREE. Enable/Disable Post Types, Categories, and Tags.
    18  * Version:             1.5.9
     18 * Version:             1.5.10
    1919 * Author:              Pixelative, Mohsin Rafique
    2020 * Author URI:          https://pixelative.co
     
    5454 * Rename this for your plugin and update it as you release new versions.
    5555 */
    56 define( 'AMP_WP_VERSION', '1.5.9' );
     56define( 'AMP_WP_VERSION', '1.5.10' );
    5757
    5858/**
  • amp-wp/trunk/includes/class-amp-wp-content-sanitizer.php

    r2125154 r2158044  
    454454                $url = self::remove_end_point_amp( $url, $url );
    455455                $url = self::remove_start_point_amp( $url, $url );
    456             } elseif ( 'end-point' === amp_wp_url_format() ) {
     456            } elseif ( 'end-point' == amp_wp_url_format() ) {
    457457                $url = self::remove_end_point_amp( $url, $url );
    458458            } else {
     
    517517            return $default;
    518518        }
    519 
     519       
    520520        if ( ! preg_match( '#^https?://w*\.?' . self::regex_url() . '/?#', $url ) ) {
    521521            return $default;
    522522        }
    523 
    524         $parsed = parse_url( $url );
     523       
     524        $parsed = wp_parse_url( $url );
    525525        if ( empty( $parsed['path'] ) ) {
    526526            return $default;
    527527        }
    528528
    529         if ( basename( $parsed['path'] ) !== Amp_WP_Public::SLUG ) {
     529        if ( basename( $parsed['path'] ) != Amp_WP_Public::SLUG ) {
     530               
    530531            if ( $transformed = self::single_post_pagination_non_amp_url( $parsed['path'] ) ) {
    531532                return $transformed;
    532533            }
     534           
    533535            if ( $transformed = self::pagination_non_amp_url( $parsed['path'] ) ) {
    534536                return $transformed;
    535537            }
     538           
    536539            return $default;
    537540        }
     541       
    538542        return trailingslashit( sprintf( '%s://%s%s', $parsed['scheme'], $parsed['host'], dirname( $parsed['path'] ) ) );
    539543    }
     
    578582     */
    579583    public static function pagination_non_amp_url( $url_path ) {
     584       
    580585        if ( preg_match( '#(.+)/' . Amp_WP_Public::SLUG . '(/page/\d+/?)#', $url_path, $match ) ) {
    581586            return home_url( $match[1] . $match[2] );
    582587        }
     588       
     589        if ( false !== strpos( $url_path, Amp_WP_Public::SLUG ) ){
     590            return home_url( substr( $url_path, strlen( "/".Amp_WP_Public::SLUG )) );
     591        }
     592       
    583593        return false;
    584594    }
Note: See TracChangeset for help on using the changeset viewer.