diff --git a/gulpfile.js b/gulpfile.js index 1787d3293..21a3a8a0b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -219,13 +219,20 @@ gulp.task( 'build:php:frontend', function () { .pipe( gulp.dest( 'dist/frontend/' ) ); } ); +gulp.task( 'build:php:helpers', function () { + return gulp + .src( [ 'src/php/helpers/**/*.php' ] ) + .pipe( gulp.dest( 'dist/helpers/' ) ); +} ); + gulp.task( 'build:php', gulp.parallel( 'build:php:admin', 'build:php:base', 'build:php:exceptions', - 'build:php:frontend' + 'build:php:frontend', + 'build:php:helpers' ) ); diff --git a/src/php/helpers/class-script-and-style-helpers.php b/src/php/helpers/class-script-and-style-helpers.php index 0b38138f6..fdef75077 100644 --- a/src/php/helpers/class-script-and-style-helpers.php +++ b/src/php/helpers/class-script-and-style-helpers.php @@ -23,8 +23,9 @@ class Script_And_Style_Helpers { * @return void */ public static function register_script( $handle, $src, $deps = array() ) { - $file = plugin_dir_path( __FILE__ ) . $src; - wp_register_script( $handle, plugin_dir_url( __FILE__ ) . $src, $deps, file_exists( $file ) ? strval( filemtime( $file ) ) : false, true ); + $path = plugin_dir_path( dirname( __FILE__ ) ) . $src; + $url = plugin_dir_url( dirname( __FILE__ ) ) . $src; + wp_register_script( $handle, $url, $deps, file_exists( $path ) ? strval( filemtime( $path ) ) : false, true ); } /** @@ -39,8 +40,9 @@ public static function register_script( $handle, $src, $deps = array() ) { * @return void */ public static function register_style( $handle, $src, $deps = array() ) { - $file = plugin_dir_path( __FILE__ ) . $src; - wp_register_style( $handle, plugin_dir_url( __FILE__ ) . $src, $deps, file_exists( $file ) ? strval( filemtime( $file ) ) : false ); + $path = plugin_dir_path( dirname( __FILE__ ) ) . $src; + $url = plugin_dir_url( dirname( __FILE__ ) ) . $src; + wp_register_style( $handle, $url, $deps, file_exists( $path ) ? strval( filemtime( $path ) ) : false ); } /** diff --git a/src/php/skaut-google-drive-gallery.php b/src/php/skaut-google-drive-gallery.php index d038ed8c3..ccf3dc876 100644 --- a/src/php/skaut-google-drive-gallery.php +++ b/src/php/skaut-google-drive-gallery.php @@ -69,6 +69,9 @@ require_once __DIR__ . '/exceptions/class-root-not-found-exception.php'; require_once __DIR__ . '/exceptions/class-unsupported-value-exception.php'; +require_once __DIR__ . '/helpers/class-get-helpers.php'; +require_once __DIR__ . '/helpers/class-script-and-style-helpers.php'; + require_once __DIR__ . '/frontend/interface-pagination-helper-interface.php'; require_once __DIR__ . '/frontend/class-api-fields.php'; require_once __DIR__ . '/frontend/class-block.php'; @@ -84,9 +87,6 @@ require_once __DIR__ . '/admin/class-settings-pages.php'; require_once __DIR__ . '/admin/class-tinymce-plugin.php'; -require_once __DIR__ . '/helpers/class-get-helpers.php'; -require_once __DIR__ . '/helpers/class-script-and-style-helpers.php'; - /** * Initializes the plugin *