diff --git a/includes/LinkPrefetch.php b/includes/LinkPrefetch.php
index cd686e1..2046d86 100644
--- a/includes/LinkPrefetch.php
+++ b/includes/LinkPrefetch.php
@@ -47,7 +47,7 @@ public function add_to_runtime( $sdk ) {
* return void
*/
public function enqueueScripts() {
- $plugin_url = $this->container->plugin()->url . $this->getScriptPath();
+ $plugin_url = $this->container->plugin()->url . get_scripts_path( 'linkPrefetch' );
$settings = get_option( 'nfd_link_prefetch_settings', static::getDefaultSettings() );
if ( ! $settings['activeOnDesktop'] && ! $settings['activeOnMobile'] ) {
@@ -60,16 +60,6 @@ public function enqueueScripts() {
wp_add_inline_script( 'linkprefetcher', 'window.LP_CONFIG = ' . wp_json_encode( $settings ), 'before' );
}
- /**
- * Get js script path.
- *
- * return string
- */
- public function getScriptPath() {
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
- return 'vendor/newfold-labs/wp-module-performance/scripts/linkPrefetch' . $suffix . '.js';
- }
-
/**
* Get link prefetch default settings.
*
diff --git a/includes/Performance.php b/includes/Performance.php
index 0d201ad..5756be5 100644
--- a/includes/Performance.php
+++ b/includes/Performance.php
@@ -81,6 +81,8 @@ public function __construct( Container $container ) {
$container->set( 'cachePurger', $cachePurger );
$container->set( 'hasMustUsePlugin', file_exists( WPMU_PLUGIN_DIR . '/endurance-page-cache.php' ) );
+
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
}
/**
@@ -293,4 +295,13 @@ public function adminBarMenu( \WP_Admin_Bar $wp_admin_bar ) {
);
}
}
+
+ /**
+ * Enqueue scripts and styles in admin
+ */
+ public function enqueue_scripts() {
+ $plugin_url = $this->container->plugin()->url . get_styles_path();
+ wp_register_style( 'wp-module-performance-styles', $plugin_url );
+ wp_enqueue_style( 'wp-module-performance-styles' );
+ }
}
diff --git a/includes/functions.php b/includes/functions.php
index 4133e84..447cdb4 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -17,12 +17,12 @@ function getCacheLevel() {
* @return string[]
*/
function getCacheLevels() {
- return [
+ return array(
0 => 'Off', // Disable caching
1 => 'Assets Only', // Cache assets only
2 => 'Normal', // Cache pages and assets for a shorter time range
3 => 'Advanced', // Cache pages and assets for a longer time range
- ];
+ );
}
/**
@@ -36,10 +36,10 @@ function getCacheLevelDropdown() {
$name = Performance::OPTION_CACHE_LEVEL;
$label = __( 'Cache Level', 'newfold-performance-module' );
?>
-