diff --git a/extensions/customizer/extension_customizer.php b/extensions/customizer/extension_customizer.php index 1b76826..e4d97e7 100644 --- a/extensions/customizer/extension_customizer.php +++ b/extensions/customizer/extension_customizer.php @@ -81,6 +81,12 @@ public function __construct( $parent ) { if ( empty( $this->extension_dir ) ) { $this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ); $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) ); + + // Easier to read and less buggy way to find out correct url, but applicable + // only if wp-content found. Othewise fall back to old URL detection code. + if ( preg_match("/wp-content\/(.*)/", $this->extension_dir, $match) ) { + $this->extension_url = site_url('/wp-content/'.$match[1]); + } } } diff --git a/extensions/edd/extension_edd.php b/extensions/edd/extension_edd.php index 4a9ab76..0391402 100644 --- a/extensions/edd/extension_edd.php +++ b/extensions/edd/extension_edd.php @@ -53,8 +53,14 @@ public function __construct( $parent ) { if ( empty( $this->extension_dir ) ) { $this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ); $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) ); + + // Easier to read and less buggy way to find out correct url, but applicable + // only if wp-content found. Othewise fall back to old URL detection code. + if ( preg_match("/wp-content\/(.*)/", $this->extension_dir, $match) ) { + $this->extension_url = site_url('/wp-content/'.$match[1]); + } } - + if ( isset( $parent->args['edd'] ) && !empty( $parent->args['edd'] ) ) { // Create defaults array