diff --git a/Puc/v4/Factory.php b/Puc/v4/Factory.php index f3a8438..cb75f3b 100644 --- a/Puc/v4/Factory.php +++ b/Puc/v4/Factory.php @@ -35,7 +35,7 @@ if ( !class_exists('Puc_v4_Factory', false) ): * @return Puc_v4p2_Plugin_UpdateChecker|Puc_v4p2_Theme_UpdateChecker|Puc_v4p2_Vcs_BaseChecker */ public static function buildUpdateChecker($metadataUrl, $fullPath, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '') { - $fullPath = self::wp_normalize_path($fullPath); + $fullPath = self::normalizePath($fullPath); $id = null; //Plugin or theme? @@ -111,18 +111,18 @@ if ( !class_exists('Puc_v4_Factory', false) ): * * Normalize a filesystem path. Introduced in WP 3.9. * Copying here allows use of the class on earlier versions. - * This version taken from WP 4.8.2 (unchanged since 4.5.0) + * This version adapted from WP 4.8.2 (unchanged since 4.5.0) * * @param string $path Path to normalize. * @return string Normalized path. */ - protected static function wp_normalize_path($path) { + protected static function normalizePath($path) { if ( function_exists('wp_normalize_path') ) { return wp_normalize_path($path); } $path = str_replace('\\', '/', $path); $path = preg_replace('|(?<=.)/+|', '/', $path); - if ( ':' === substr($path, 1, 1) ) { + if ( substr($path, 1, 1) === ':' ) { $path = ucfirst($path); } return $path; @@ -136,8 +136,8 @@ if ( !class_exists('Puc_v4_Factory', false) ): */ protected static function isPluginFile($absolutePath) { //Is the file inside the "plugins" or "mu-plugins" directory? - $pluginDir = self::wp_normalize_path(WP_PLUGIN_DIR); - $muPluginDir = self::wp_normalize_path(WPMU_PLUGIN_DIR); + $pluginDir = self::normalizePath(WP_PLUGIN_DIR); + $muPluginDir = self::normalizePath(WPMU_PLUGIN_DIR); if ( (strpos($absolutePath, $pluginDir) === 0) || (strpos($absolutePath, $muPluginDir) === 0) ) { return true; }