From 6ad3a77258f61d1cd692529042b1b8df46487365 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Sun, 16 Dec 2018 10:39:30 +0100 Subject: [PATCH 1/3] Implement Core's new filter to fix json translation loading --- modules/photon-cdn.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/photon-cdn.php b/modules/photon-cdn.php index 3190237b0726c..c43f69e89f652 100644 --- a/modules/photon-cdn.php +++ b/modules/photon-cdn.php @@ -30,6 +30,7 @@ public static function go() { add_action( 'admin_print_scripts', array( __CLASS__, 'cdnize_assets' ) ); add_action( 'admin_print_styles', array( __CLASS__, 'cdnize_assets' ) ); add_action( 'wp_footer', array( __CLASS__, 'cdnize_assets' ) ); + add_filter( 'load_script_textdomain_relative_path', array( __CLASS__, 'fix_script_relative_path' ) ); } /** @@ -83,6 +84,17 @@ public static function cdnize_assets() { } } + /** + * Ensure correct relative path when + * + * @param string $relative The relative path of the script. False if it could not be determined. + * @param string $src The full source url of the script. + * @return string The expected relative path for the CDN-ed URL. + */ + public static function fix_script_relative_path( $relative, $src ) { + return substr( $src, 1 + strpos( $src, '/wp-includes/' ) ); + } + /** * Sets up CDN URLs for supported plugin assets. * From a66d67e0056c671365b79e217b8db12edc261953 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Mon, 17 Dec 2018 13:50:07 +0100 Subject: [PATCH 2/3] typo --- modules/photon-cdn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/photon-cdn.php b/modules/photon-cdn.php index c43f69e89f652..67a37375b9e1d 100644 --- a/modules/photon-cdn.php +++ b/modules/photon-cdn.php @@ -30,7 +30,7 @@ public static function go() { add_action( 'admin_print_scripts', array( __CLASS__, 'cdnize_assets' ) ); add_action( 'admin_print_styles', array( __CLASS__, 'cdnize_assets' ) ); add_action( 'wp_footer', array( __CLASS__, 'cdnize_assets' ) ); - add_filter( 'load_script_textdomain_relative_path', array( __CLASS__, 'fix_script_relative_path' ) ); + add_filter( 'load_script_textdomain_relative_path', array( __CLASS__, 'fix_script_relative_path' ), 10, 2 ); } /** @@ -85,7 +85,7 @@ public static function cdnize_assets() { } /** - * Ensure correct relative path when + * Ensure use of the correct relative path when determining the JavaScript file names. * * @param string $relative The relative path of the script. False if it could not be determined. * @param string $src The full source url of the script. From 3adae0c4e367323ae4bffa9137ecd77b53aeb231 Mon Sep 17 00:00:00 2001 From: Igor Zinovyev Date: Tue, 18 Dec 2018 15:46:40 +0300 Subject: [PATCH 3/3] Fixing indentation. --- modules/photon-cdn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/photon-cdn.php b/modules/photon-cdn.php index c43f69e89f652..df75ee27c0102 100644 --- a/modules/photon-cdn.php +++ b/modules/photon-cdn.php @@ -88,8 +88,8 @@ public static function cdnize_assets() { * Ensure correct relative path when * * @param string $relative The relative path of the script. False if it could not be determined. - * @param string $src The full source url of the script. - * @return string The expected relative path for the CDN-ed URL. + * @param string $src The full source url of the script. + * @return string The expected relative path for the CDN-ed URL. */ public static function fix_script_relative_path( $relative, $src ) { return substr( $src, 1 + strpos( $src, '/wp-includes/' ) );