diff --git a/wpa-superstar-plugin.php b/wpa-superstar-plugin.php index 09e79fa..4289453 100644 --- a/wpa-superstar-plugin.php +++ b/wpa-superstar-plugin.php @@ -1,3 +1,4 @@ + admin_url( 'admin-ajax.php' ), - 'nonce' => wp_create_nonce( 'wpa-superstar-nonce' ) - ] + $ajax_data = array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'nonce' => wp_create_nonce( 'wpa-superstar-nonce' ) ); + wp_localize_script( 'wpa-superstar-admin', 'wpaSuperstar', $ajax_data ); } add_action( 'admin_enqueue_scripts', 'wpa_superstar_admin_assets' ); @@ -83,4 +81,15 @@ function lazyLoad_assets() { plugins_url( 'public/css/wpa-superstar-lazy-load.css', __FILE__ ), [], WPA_SUPERSTAR_VERSION - ); \ No newline at end of file + ); +} + +function minifyCSS($css) { + // Remove comments + $css = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css); + // Remove space after colons + $css = str_replace(': ', ':', $css); + // Remove whitespace + $css = str_replace(["\r\n", "\r", "\n", "\t", ' ', ' ', ' '], '', $css); + return $css; +}