diff --git a/changelog.txt b/changelog.txt index ee51b4e..ee60c29 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ += 2.9.2 = + +* Optimize: Symbolic link handing for file/directory paths. + = 2.9.1 = * Fix: Validate hook priority values (Let's Getz Prioritized) diff --git a/includes/class.utilities.php b/includes/class.utilities.php index f87ed02..fe5d6ef 100644 --- a/includes/class.utilities.php +++ b/includes/class.utilities.php @@ -1251,10 +1251,18 @@ function get_path_base( $relative = null ) { } // Extract base path $base = $this->normalize_path( $base ); - if ( 0 === strpos( $base, $this->normalize_path( WP_PLUGIN_DIR ) ) ) { - $end = strpos( $base, '/', strlen( WP_PLUGIN_DIR ) + 1 ); + $wp_plugin_dir = $this->normalize_path( realpath( WP_PLUGIN_DIR ) ); + if ( 0 === strpos( $base, $wp_plugin_dir ) ) { + $end = strpos( $base, '/', strlen( $wp_plugin_dir ) + 1 ); $base = substr( $base, 0, $end ); } + // Validate path. + if ( !is_dir( $base ) || !is_readable( $base ) ) { + // Fallback: Merge `WP_PLUGIN_DIR` and top-level directory from `plugin_basename()`. + $base = plugin_basename( __FILE__ ); + $base = substr( $base, 0, strpos( $base, '/') ); + $base = $this->normalize_path( WP_PLUGIN_DIR, $base, false ); + } // Save base path. $this->_path_base = $base; } diff --git a/main.php b/main.php index 834cb44..7b0d002 100644 --- a/main.php +++ b/main.php @@ -9,7 +9,7 @@ * Plugin Name: Simple Lightbox * Plugin URI: http://archetyped.com/tools/simple-lightbox/ * Description: The highly customizable lightbox for WordPress - * Version: 2.9.1 + * Version: 2.9.2 * Requires at least: 5.3 * Requires PHP: 5.6.20 * Text Domain: simple-lightbox diff --git a/package-lock.json b/package-lock.json index 3c246dc..fbf22fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "simple-lightbox", - "version": "2.9.1", + "version": "2.9.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "2.9.1", + "version": "2.9.2", "license": "GPLv2", "devDependencies": { "grunt": "^1.5.3", diff --git a/package.json b/package.json index 16a6472..c8fca41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-lightbox", - "version": "2.9.1", + "version": "2.9.2", "title": "Simple Lightbox", "description": "The highly-customizable lightbox for WordPress", "author": "Archetyped ", diff --git a/readme.txt b/readme.txt index 50a3118..74406a2 100644 --- a/readme.txt +++ b/readme.txt @@ -65,6 +65,10 @@ Get more information on [Simple Lightbox's official page](http://archetyped.com/ == Changelog == += 2.9.2 = + +* Optimize: Symbolic link handing for file/directory paths. + = 2.9.1 = * Fix: Validate hook priority values (Let's Getz Prioritized)