| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | * |
| 28 | 28 | * @return bool |
| 29 | 29 | */ |
| 30 | 30 | public function is_enabled() { |
| 31 | - return $this->get('enabled'); | |
| 31 | + return (bool) $this->get('enabled'); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Removes all Minify settings from the Database if 'preserve_settings_on_uninstall' is false |
| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Get config from file or cache |
| 51 | 51 | * |
| 52 | - * @param string $option - An option name | |
| 52 | + * @param ?string $option - An option name | |
| 53 | 53 | * @param mixed $default - A default for the option |
| 54 | 54 | * @return array|string |
| 55 | 55 | */ |
| 56 | 56 | public function get($option = null, $default = false) { |
| @@ -118,18 +118,20 @@ | ||
| 118 | 118 | 'emoji_removal' => true, |
| 119 | 119 | 'merge_google_fonts' => true, |
| 120 | 120 | 'enable_display_swap' => true, |
| 121 | 121 | 'remove_googlefonts' => false, |
| 122 | + 'host_local_google_fonts' => false, | |
| 123 | + 'disable_google_fonts_processing' => false, | |
| 122 | 124 | 'gfonts_method' => 'inherit', // inline, async, exclude |
| 123 | 125 | 'fawesome_method' => 'inherit', // inline, async, exclude |
| 124 | 126 | 'enable_css' => true, |
| 125 | 127 | 'enable_css_minification' => true, |
| 126 | - 'enable_merging_of_css' => true, | |
| 128 | + 'enable_merging_of_css' => false, | |
| 127 | 129 | 'remove_print_mediatypes' => false, |
| 128 | 130 | 'inline_css' => false, |
| 129 | 131 | 'enable_js' => true, |
| 130 | 132 | 'enable_js_minification' => true, |
| 131 | - 'enable_merging_of_js' => true, | |
| 133 | + 'enable_merging_of_js' => false, | |
| 132 | 134 | 'enable_defer_js' => 'individual', |
| 133 | 135 | 'defer_js_type' => 'defer', |
| 134 | 136 | 'defer_jquery' => true, |
| 135 | 137 | 'enable_js_trycatch' => false, |
| @@ -136,12 +138,26 @@ | ||
| 136 | 138 | 'exclude_defer_login' => true, |
| 137 | 139 | 'cdn_url' => '', |
| 138 | 140 | 'cdn_force' => false, |
| 139 | 141 | |
| 142 | + 'enable_delay_js' => false, | |
| 143 | + 'enable_preload_js' => false, | |
| 144 | + 'exclude_delay_js' => '', | |
| 145 | + | |
| 140 | 146 | 'async_css' => '', |
| 141 | 147 | 'async_js' => '', |
| 142 | 148 | 'disable_css_inline_merge' => true, |
| 143 | - 'ualist' => array('x11.*fox\/54', 'oid\s4.*xus.*ome\/62', 'x11.*ome\/62', 'oobot', 'ighth', 'tmetr', 'eadles', 'ingdo'), | |
| 149 | + /** | |
| 150 | + * UA list compiled from these resources: | |
| 151 | + * https://explore.whatismybrowser.com/useragents/explore/software_name/gtmetrix-analyser/ | |
| 152 | + * https://explore.whatismybrowser.com/useragents/explore/software_name/pingdom-bot/ | |
| 153 | + * https://explore.whatismybrowser.com/useragents/explore/software_name/google-lighthouse/ | |
| 154 | + * https://explore.whatismybrowser.com/useragents/explore/software_name/googlebot/ | |
| 155 | + * https://explore.whatismybrowser.com/useragents/explore/software_name/headless-chrome/ | |
| 156 | + */ | |
| 157 | + 'ualist' => array('Googlebot', 'Chrome-Lighthouse', 'GTmetrix', 'HeadlessChrome', 'Pingdom'), | |
| 158 | + 'exclude_js_from_page_speed_tools' => false, | |
| 159 | + 'exclude_css_from_page_speed_tools' => false, | |
| 144 | 160 | 'blacklist' => array(), |
| 145 | 161 | 'ignore_list' => array(), |
| 146 | 162 | 'exclude_js' => '', |
| 147 | 163 | 'exclude_css' => '', |
| @@ -147,9 +163,9 @@ | ||
| 147 | 163 | 'exclude_css' => '', |
| 148 | 164 | 'edit_default_exclutions' => false, |
| 149 | 165 | |
| 150 | 166 | 'merge_allowed_urls' => '', |
| 151 | - | |
| 167 | + | |
| 152 | 168 | // internal |
| 153 | 169 | 'enabled' => false, |
| 154 | 170 | 'last-cache-update' => 0, |
| 155 | 171 | 'plugin_version' => '0.0.0', |
| @@ -154,8 +170,14 @@ | ||
| 154 | 170 | 'last-cache-update' => 0, |
| 155 | 171 | 'plugin_version' => '0.0.0', |
| 156 | 172 | 'cache_lifespan' => 30, |
| 157 | 173 | 'merge_inline_extra_css_js' => true, |
| 174 | + | |
| 175 | + 'enable_analytics' => false, | |
| 176 | + 'analytics_method' => 'gtagv4', | |
| 177 | + 'tracking_id' => '', | |
| 178 | + | |
| 179 | + 'enable_unused_css' => false, | |
| 158 | 180 | ); |
| 159 | 181 | return apply_filters('wpo_minify_defaults', $defaults); |
| 160 | 182 | } |
| 161 | 183 | |
| @@ -169,9 +191,10 @@ | ||
| 169 | 191 | * Filters the result of always_purge_everything |
| 170 | 192 | * |
| 171 | 193 | * @return boolean |
| 172 | 194 | */ |
| 173 | - return apply_filters('wpo_minify_always_purge_everything', 0 === intval($this->get('cache_lifespan')) || (defined('WPO_ADVANCED_CACHE') && defined('WP_CACHE') && WP_CACHE)); | |
| 195 | + $filtered_value = apply_filters('wpo_minify_always_purge_everything', 0 === intval($this->get('cache_lifespan')) || (defined('WPO_ADVANCED_CACHE') && defined('WP_CACHE') && WP_CACHE)); | |
| 196 | + return is_bool($filtered_value) ? $filtered_value : false; | |
| 174 | 197 | } |
| 175 | 198 | |
| 176 | 199 | /** |
| 177 | 200 | * Get the instance |