| @@ -14,10 +14,10 @@ | ||
| 14 | 14 | * @var bool |
| 15 | 15 | */ |
| 16 | 16 | private $settings_screen_do_remote_http = true; |
| 17 | 17 | |
| 18 | - public function __construct() | |
| 19 | - { | |
| 18 | + public function __construct() { | |
| 19 | + $this->criticalcss = autoptimize()->criticalcss(); | |
| 20 | 20 | $this->settings_screen_do_remote_http = apply_filters( 'autoptimize_settingsscreen_remotehttp', $this->settings_screen_do_remote_http ); |
| 21 | 21 | $this->run(); |
| 22 | 22 | } |
| 23 | 23 | |
| @@ -38,14 +38,19 @@ | ||
| 38 | 38 | add_action( 'admin_menu', array( $this, 'add_critcss_admin_menu' ) ); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $criticalcss_ajax = new autoptimizeCriticalCSSSettingsAjax(); |
| 42 | + | |
| 43 | + // if debug logging is off but the file is present, then remove the debug log file. | |
| 44 | + if ( empty( $this->criticalcss->get_option( 'debug' ) ) && file_exists( AO_CCSS_LOG ) ) { | |
| 45 | + unlink( AO_CCSS_LOG ); | |
| 46 | + } | |
| 42 | 47 | } |
| 43 | 48 | } |
| 44 | 49 | |
| 45 | 50 | public function add_critcss_tabs( $in ) |
| 46 | 51 | { |
| 47 | - $in = array_merge( $in, array( 'ao_critcss' => '⚡ ' . __( 'Critical CSS', 'autoptimize' ) ) ); | |
| 52 | + $in = array_merge( $in, array( 'ao_critcss' => apply_filters( 'autoptimize_filter_ccss_tab_text', '⚡ ' . __( 'Critical CSS', 'autoptimize' ) ) ) ); | |
| 48 | 53 | |
| 49 | 54 | return $in; |
| 50 | 55 | } |
| 51 | 56 | |
| @@ -57,9 +62,9 @@ | ||
| 57 | 62 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_additional' ); |
| 58 | 63 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_queue' ); |
| 59 | 64 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_viewport' ); |
| 60 | 65 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_finclude' ); |
| 61 | - register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_rlimit' ); | |
| 66 | + register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_rtimelimit' ); | |
| 62 | 67 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_noptimize' ); |
| 63 | 68 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_debug' ); |
| 64 | 69 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_key' ); |
| 65 | 70 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_keyst' ); |
| @@ -69,9 +74,9 @@ | ||
| 69 | 74 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_domain' ); |
| 70 | 75 | register_setting( 'ao_ccss_options_group', 'autoptimize_ccss_unloadccss' ); |
| 71 | 76 | |
| 72 | 77 | // And add submenu-page. |
| 73 | - add_submenu_page( null, 'Critical CSS', 'Critical CSS', 'manage_options', 'ao_critcss', array( $this, 'ao_criticalcsssettings_page' ) ); | |
| 78 | + add_submenu_page( '', 'Critical CSS', 'Critical CSS', 'manage_options', 'ao_critcss', array( $this, 'ao_criticalcsssettings_page' ) ); | |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | 81 | public function admin_assets( $hook ) { |
| 77 | 82 | // Return if plugin is not hooked. |
| @@ -99,20 +104,29 @@ | ||
| 99 | 104 | require_once( 'critcss-inc/admin_settings_key.php' ); |
| 100 | 105 | require_once( 'critcss-inc/admin_settings_adv.php' ); |
| 101 | 106 | require_once( 'critcss-inc/admin_settings_explain.php' ); |
| 102 | 107 | |
| 103 | - // fetch all options at once and populate them individually explicitely as globals. | |
| 104 | - $all_options = autoptimizeCriticalCSSBase::fetch_options(); | |
| 105 | - foreach ( $all_options as $_option => $_value ) { | |
| 106 | - global ${$_option}; | |
| 107 | - ${$_option} = $_value; | |
| 108 | - } | |
| 108 | + $ao_ccss_key = $this->criticalcss->get_option( 'key' ); | |
| 109 | + $ao_ccss_keyst = $this->criticalcss->get_option( 'keyst' ); | |
| 110 | + $ao_css_defer = $this->criticalcss->get_option( 'css_defer' ); | |
| 111 | + $ao_ccss_deferjquery = $this->criticalcss->get_option( 'deferjquery' ); | |
| 112 | + $ao_ccss_queue = $this->criticalcss->get_option( 'queue' ); | |
| 113 | + $ao_ccss_rules = $this->criticalcss->get_option( 'rules' ); | |
| 114 | + $ao_ccss_servicestatus = $this->criticalcss->get_option( 'servicestatus' ); | |
| 115 | + $ao_ccss_finclude = $this->criticalcss->get_option( 'finclude' ); | |
| 116 | + $ao_ccss_rtimelimit = $this->criticalcss->get_option( 'rtimelimit' ); | |
| 117 | + $ao_ccss_debug = $this->criticalcss->get_option( 'debug' ); | |
| 118 | + $ao_ccss_noptimize = $this->criticalcss->get_option( 'noptimize' ); | |
| 119 | + $ao_css_defer_inline = $this->criticalcss->get_option( 'css_defer_inline' ); | |
| 120 | + $ao_ccss_loggedin = $this->criticalcss->get_option( 'loggedin' ); | |
| 121 | + $ao_ccss_forcepath = $this->criticalcss->get_option( 'forcepath' ); | |
| 122 | + $ao_ccss_domain = $this->criticalcss->get_option( 'domain' ); | |
| 109 | 123 | ?> |
| 110 | 124 | <script>document.title = "Autoptimize: <?php _e( 'Critical CSS', 'autoptimize' ); ?> " + document.title;</script> |
| 111 | 125 | <div class="wrap"> |
| 112 | 126 | <div id="autoptimize_main"> |
| 113 | 127 | <div id="ao_title_and_button"> |
| 114 | - <h1><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1> | |
| 128 | + <h1><?php apply_filters( 'autoptimize_filter_settings_is_pro', false ) ? _e( 'Autoptimize Pro Settings', 'autoptimize' ) : _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1> | |
| 115 | 129 | </div> |
| 116 | 130 | |
| 117 | 131 | <?php |
| 118 | 132 | // Print AO settings tabs. |
| @@ -117,41 +131,70 @@ | ||
| 117 | 131 | <?php |
| 118 | 132 | // Print AO settings tabs. |
| 119 | 133 | echo autoptimizeConfig::ao_admin_tabs(); |
| 120 | 134 | |
| 121 | - // Make sure dir to write ao_ccss exists and is writable. | |
| 122 | - if ( ! is_dir( AO_CCSS_DIR ) ) { | |
| 123 | - $mkdirresp = @mkdir( AO_CCSS_DIR, 0775, true ); // @codingStandardsIgnoreLine | |
| 124 | - $fileresp = file_put_contents( AO_CCSS_DIR . 'index.html', '<html><head><meta name="robots" content="noindex, nofollow"></head><body>Generated by <a href="http://wordpress.org/extend/plugins/autoptimize/" rel="nofollow">Autoptimize</a></body></html>' ); | |
| 125 | - if ( ( ! $mkdirresp ) || ( ! $fileresp ) ) { | |
| 126 | - ?> | |
| 127 | - <div class="notice-error notice"><p> | |
| 135 | + if ( autoptimizeUtils::is_local_server() && isset( $ao_ccss_key ) ) { ?> | |
| 136 | + <div class="notice-warning notice"><p> | |
| 137 | + <?php | |
| 138 | + echo __( 'The Critical CSS service does not work on locally hosted sites or when the server is on a private network.', 'autoptimize' ); | |
| 139 | + ?> | |
| 140 | + </p></div> | |
| 141 | + <?php } | |
| 142 | + | |
| 143 | + $mkdirresult = $this->criticalcss->create_ao_ccss_dir(); | |
| 144 | + | |
| 145 | + // Warn if we could not create those files. | |
| 146 | + if ( ( true !== $mkdirresult ) ) { | |
| 147 | + ?> | |
| 148 | + <div class="notice-error notice"><p> | |
| 149 | + <?php | |
| 150 | + _e( 'Could not create the required directory. Make sure the webserver can write to the wp-content/uploads directory.', 'autoptimize' ); | |
| 151 | + ?> | |
| 152 | + </p></div> | |
| 153 | + <?php | |
| 154 | + } | |
| 155 | + | |
| 156 | + // Check if CSS optimization is on. | |
| 157 | + if ( 'on' !== autoptimizeOptionWrapper::get_option( 'autoptimize_css' ) || 'on' !== autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer' ) ) { | |
| 158 | + ?> | |
| 159 | + <div class="notice-info notice"><p> | |
| 160 | + <?php | |
| 161 | + _e( 'To be able to use Critical CSS you will have to enable CSS optimization and make sure "eliminate render-blocking CSS" is active on the main Autoptimize settings page.', 'autoptimize' ); | |
| 162 | + ?> | |
| 163 | + </p></div> | |
| 164 | + <?php | |
| 165 | + } | |
| 166 | + | |
| 167 | + // Check for "inline & defer CSS" being active in Autoptimize. | |
| 168 | + if ( ! empty( $ao_ccss_key ) && ! $ao_css_defer && empty( $ao_ccss_keyst ) ) { | |
| 169 | + // no keystate so likely in activation-process of CCSS, let's enable "inline & defer CSS" immediately to make things easier! | |
| 170 | + autoptimizeOptionWrapper::update_option( 'autoptimize_css_defer', 'on' ); | |
| 171 | + ?> | |
| 172 | + <div class="notice-info notice"><p> | |
| 128 | 173 | <?php |
| 129 | - _e( 'Could not create the required directory. Make sure the webserver can write to the wp-content directory.', 'autoptimize' ); | |
| 174 | + _e( 'The "Eliminate render-blocking CSS" option was activated to allow critical CSS to be used.', 'autoptimize' ); | |
| 130 | 175 | ?> |
| 131 | 176 | </p></div> |
| 132 | 177 | <?php |
| 133 | - } | |
| 134 | 178 | } |
| 135 | 179 | |
| 136 | - // Check for Autoptimize. | |
| 137 | - if ( ! empty( $ao_ccss_key ) && ! $ao_css_defer ) { | |
| 180 | + // check if WordPress cron is disabled and warn if so. | |
| 181 | + if ( ! empty( $ao_ccss_key ) && defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && PAnD::is_admin_notice_active( 'i-know-about-disable-cron-forever' ) ) { | |
| 138 | 182 | ?> |
| 139 | - <div class="notice-error notice"><p> | |
| 183 | + <div data-dismissible="i-know-about-disable-cron-forever" class="notice-warning notice is-dismissible"><p> | |
| 140 | 184 | <?php |
| 141 | - _e( "Oops! Please <strong>activate the \"Inline and Defer CSS\" option</strong> on Autoptimize's main settings page to use this power-up.", 'autoptimize' ); | |
| 185 | + _e( 'WordPress cron (for task scheduling) seems to be disabled. Have a look at <a href="https://wordpress.org/plugins/autoptimize-criticalcss/faq/" target="_blank">the FAQ</a> or the info in the Job Queue instructions if all jobs remain in "N" status and no rules are created.', 'autoptimize' ); | |
| 142 | 186 | ?> |
| 143 | 187 | </p></div> |
| 144 | 188 | <?php |
| 145 | - return; | |
| 146 | 189 | } |
| 147 | 190 | |
| 148 | - // check if WordPress cron is disabled and warn if so. | |
| 149 | - if ( ! empty( $ao_ccss_key ) && defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && PAnD::is_admin_notice_active( 'i-know-about-disable-cron-forever' ) ) { | |
| 191 | + // check if defer jQuery is active and warn if so. | |
| 192 | + if ( 1 == $ao_ccss_deferjquery && PAnD::is_admin_notice_active( 'i-know-about-defer-inline-forever' ) ) { | |
| 150 | 193 | ?> |
| 151 | - <div data-dismissible="i-know-about-disable-cron-forever" class="notice-warning notice is-dismissible"><p> | |
| 194 | + <div data-dismissible="i-know-about-defer-inline-forever" class="notice-warning notice is-dismissible"><p> | |
| 152 | 195 | <?php |
| 153 | - _e( 'WordPress cron (for task scheduling) seems to be disabled. Have a look at <a href="https://wordpress.org/plugins/autoptimize-criticalcss/faq/" target="_blank">the FAQ</a> or the info in the Job Queue instructions if all jobs remain in "N" status and no rules are created.', 'autoptimize' ); | |
| 196 | + _e( 'You have "defer jQuery and other non-aggregated JS-files" active (under Advanced Settings), but that functionality is deprecated and will be removed in the next major version of Autoptimize. Consider using the new "Do not aggregate but defer" and "Also defer inline JS" options on the main settings page instead.', 'autoptimize' ); | |
| 154 | 197 | ?> |
| 155 | 198 | </p></div> |
| 156 | 199 | <?php |
| 157 | 200 | } |
| @@ -211,8 +254,10 @@ | ||
| 211 | 254 | ?> |
| 212 | 255 | <div class="notice-success notice"><p> |
| 213 | 256 | <?php |
| 214 | 257 | _e( 'Great, Autoptimize will now automatically start creating new critical CSS rules, you should see those appearing below in the next couple of hours.', 'autoptimize' ); |
| 258 | + echo ' '; | |
| 259 | + _e( 'In the meantime you might want to <strong>edit default rule CSS now</strong>, to avoid all CSS being inlined when no (applicable) rules are found.', 'autoptimize' ); | |
| 215 | 260 | ?> |
| 216 | 261 | </p></div> |
| 217 | 262 | <?php |
| 218 | 263 | } |
| @@ -227,8 +272,21 @@ | ||
| 227 | 272 | </p></div> |
| 228 | 273 | <?php |
| 229 | 274 | } |
| 230 | 275 | |
| 276 | + // warn if too many rules (based on length of ao_ccss_rules option) as that might cause issues at e.g. wpengine | |
| 277 | + // see https://wpengine.com/support/database-optimization-best-practices/#Autoloaded_Data . | |
| 278 | + $_raw_rules_length = strlen( get_option( 'autoptimize_ccss_rules', '' ) ); | |
| 279 | + if ( $_raw_rules_length > apply_filters( 'autoptimize_ccss_rules_length_warning', 500000 ) ) { | |
| 280 | + ?> | |
| 281 | + <div class="notice-warning notice"><p> | |
| 282 | + <?php | |
| 283 | + _e( 'It looks like the amount of Critical CSS rules is very high, it is recommended to reconfigure Autoptimize (e.g. by manually creating broader rules) to ensure less rules are created.', 'autoptimize' ); | |
| 284 | + ?> | |
| 285 | + </p></div> | |
| 286 | + <?php | |
| 287 | + } | |
| 288 | + | |
| 231 | 289 | // Settings Form. |
| 232 | 290 | ?> |
| 233 | 291 | <form id="settings" method="post" action="options.php"> |
| 234 | 292 | <?php |
| @@ -234,9 +292,9 @@ | ||
| 234 | 292 | <?php |
| 235 | 293 | settings_fields( 'ao_ccss_options_group' ); |
| 236 | 294 | |
| 237 | 295 | // Get API key status. |
| 238 | - $key = autoptimizeCriticalCSSCore::ao_ccss_key_status( true ); | |
| 296 | + $key = $this->criticalcss->key_status( true ); | |
| 239 | 297 | |
| 240 | 298 | if ( $this->is_multisite_network_admin() ) { |
| 241 | 299 | ?> |
| 242 | 300 | <ul id="key-panel"> |
| @@ -248,9 +306,9 @@ | ||
| 248 | 306 | </li> |
| 249 | 307 | </ul> |
| 250 | 308 | <?php |
| 251 | 309 | } else { |
| 252 | - if ( 'valid' == $key['status'] ) { | |
| 310 | + if ( 'valid' == $key['status'] || ( defined( 'AO_PRO_VERSION' ) && has_filter( 'autoptimize_filter_ccss_key' ) ) ) { | |
| 253 | 311 | // If key status is valid, render other panels. |
| 254 | 312 | // Render rules section. |
| 255 | 313 | ao_ccss_render_rules(); |
| 256 | 314 | // Render queue section. |
| @@ -257,27 +315,34 @@ | ||
| 257 | 315 | ao_ccss_render_queue(); |
| 258 | 316 | // Render advanced panel. |
| 259 | 317 | ao_ccss_render_adv(); |
| 260 | 318 | } else { |
| 319 | + if ( apply_filters( 'autoptimize_filter_ccss_rules_without_api', true ) ) { | |
| 320 | + // Render rules section for manual rules. | |
| 321 | + ao_ccss_render_rules(); | |
| 322 | + } else { | |
| 323 | + echo "<input class='hidden' name='autoptimize_ccss_rules' value='" . json_encode( $ao_ccss_rules, JSON_FORCE_OBJECT ) . "'>"; | |
| 324 | + } | |
| 325 | + | |
| 261 | 326 | // But if key is other than valid, add hidden fields to persist settings when submitting form |
| 262 | 327 | // Show explanation of why and how to get a API key. |
| 263 | 328 | ao_ccss_render_explain(); |
| 264 | 329 | |
| 265 | 330 | // Get viewport size. |
| 266 | - $viewport = autoptimizeCriticalCSSCore::ao_ccss_viewport(); | |
| 331 | + $viewport = $this->criticalcss->viewport(); | |
| 267 | 332 | |
| 268 | 333 | // Add hidden fields. |
| 269 | - echo "<input class='hidden' name='autoptimize_ccss_rules' value='" . $ao_ccss_rules_raw . "'>"; | |
| 270 | - echo "<input class='hidden' name='autoptimize_ccss_queue' value='" . $ao_ccss_queue_raw . "'>"; | |
| 271 | - echo '<input class="hidden" name="autoptimize_ccss_viewport[w]" value="' . $viewport['w'] . '">'; | |
| 272 | - echo '<input class="hidden" name="autoptimize_ccss_viewport[h]" value="' . $viewport['h'] . '">'; | |
| 273 | - echo '<input class="hidden" name="autoptimize_ccss_finclude" value="' . $ao_ccss_finclude . '">'; | |
| 274 | - echo '<input class="hidden" name="autoptimize_ccss_rlimit" value="' . $ao_ccss_rlimit . '">'; | |
| 275 | - echo '<input class="hidden" name="autoptimize_ccss_debug" value="' . $ao_ccss_debug . '">'; | |
| 276 | - echo '<input class="hidden" name="autoptimize_ccss_noptimize" value="' . $ao_ccss_noptimize . '">'; | |
| 334 | + echo "<input class='hidden' name='autoptimize_ccss_queue' value='" . json_encode( $ao_ccss_queue, JSON_FORCE_OBJECT ) . "'>"; | |
| 335 | + echo '<input class="hidden" name="autoptimize_ccss_viewport[w]" value="' . esc_attr( $viewport['w'] ) . '">'; | |
| 336 | + echo '<input class="hidden" name="autoptimize_ccss_viewport[h]" value="' . esc_attr( $viewport['h'] ) . '">'; | |
| 337 | + echo '<input class="hidden" name="autoptimize_ccss_finclude" value="' . esc_attr( $ao_ccss_finclude ) . '">'; | |
| 338 | + echo '<input class="hidden" name="autoptimize_ccss_rtimelimit" value="' . esc_attr( $ao_ccss_rtimelimit ) . '">'; | |
| 339 | + echo '<input class="hidden" name="autoptimize_ccss_debug" value="' . esc_attr( $ao_ccss_debug ) . '">'; | |
| 340 | + echo '<input class="hidden" name="autoptimize_ccss_noptimize" value="' . esc_attr( $ao_ccss_noptimize ) . '">'; | |
| 277 | 341 | echo '<input class="hidden" name="autoptimize_css_defer_inline" value="' . esc_attr( $ao_css_defer_inline ) . '">'; |
| 278 | - echo '<input class="hidden" name="autoptimize_ccss_loggedin" value="' . $ao_ccss_loggedin . '">'; | |
| 279 | - echo '<input class="hidden" name="autoptimize_ccss_forcepath" value="' . $ao_ccss_forcepath . '">'; | |
| 342 | + echo '<input class="hidden" name="autoptimize_ccss_loggedin" value="' . esc_attr( $ao_ccss_loggedin ) . '">'; | |
| 343 | + echo '<input class="hidden" name="autoptimize_ccss_forcepath" value="' . esc_attr( $ao_ccss_forcepath ) . '">'; | |
| 344 | + echo '<input class="hidden" name="autoptimize_ccss_domain" id="autoptimize_ccss_domain" value="' . esc_attr( $ao_ccss_domain ) . '">'; | |
| 280 | 345 | } |
| 281 | 346 | // Render key panel unconditionally. |
| 282 | 347 | ao_ccss_render_key( $ao_ccss_key, $key['status'], $key['stmsg'], $key['msg'], $key['color'] ); |
| 283 | 348 | ?> |
| @@ -299,9 +364,9 @@ | ||
| 299 | 364 | return String.fromCharCode((letter <= 'Z' ? 90 : 122) >= (letter = letter.charCodeAt(0) + itype) ? letter : letter - 26); |
| 300 | 365 | }); |
| 301 | 366 | } |
| 302 | 367 | </script> |
| 303 | - <form id="importSettingsForm"<?php if ( $this->is_multisite_network_admin() ) { echo ' class="hidden"'; } ?>> | |
| 368 | + <form id="importSettingsForm"<?php if ( $this->is_multisite_network_admin() ) { echo ' class="hidden"'; } // @codingStandardsIgnoreLine ?>> | |
| 304 | 369 | <span id="exportSettings" class="button-secondary"><?php _e( 'Export Settings', 'autoptimize' ); ?></span> |
| 305 | 370 | <input class="button-secondary" id="importSettings" type="button" value="<?php _e( 'Import Settings', 'autoptimize' ); ?>" onclick="upload();return false;" /> |
| 306 | 371 | <input class="button-secondary" id="settingsfile" name="settingsfile" type="file" /> |
| 307 | 372 | </form> |
| @@ -311,9 +376,9 @@ | ||
| 311 | 376 | <?php |
| 312 | 377 | if ( ! $this->is_multisite_network_admin() ) { |
| 313 | 378 | // Include debug panel if debug mode is enable. |
| 314 | 379 | if ( $ao_ccss_debug ) { |
| 315 | - ?> | |
| 380 | + ?> | |
| 316 | 381 | <div id="debug"> |
| 317 | 382 | <?php |
| 318 | 383 | // Include debug panel. |
| 319 | 384 | include( 'critcss-inc/admin_settings_debug.php' ); |
| @@ -318,9 +383,9 @@ | ||
| 318 | 383 | // Include debug panel. |
| 319 | 384 | include( 'critcss-inc/admin_settings_debug.php' ); |
| 320 | 385 | ?> |
| 321 | 386 | </div><!-- /#debug --> |
| 322 | - <?php | |
| 387 | + <?php | |
| 323 | 388 | } |
| 324 | 389 | echo '<script>'; |
| 325 | 390 | include( 'critcss-inc/admin_settings_rules.js.php' ); |
| 326 | 391 | include( 'critcss-inc/admin_settings_queue.js.php' ); |
| @@ -328,13 +393,13 @@ | ||
| 328 | 393 | echo '</script>'; |
| 329 | 394 | } |
| 330 | 395 | } |
| 331 | 396 | |
| 332 | - public static function ao_ccss_has_autorules() { | |
| 397 | + public function ao_ccss_has_autorules() { | |
| 333 | 398 | static $_has_auto_rules = null; |
| 334 | 399 | |
| 335 | 400 | if ( null === $_has_auto_rules ) { |
| 336 | - global $ao_ccss_rules; | |
| 401 | + $ao_ccss_rules = $this->criticalcss->get_option( 'rules' ); | |
| 337 | 402 | $_has_auto_rules = false; |
| 338 | 403 | if ( ! empty( $ao_ccss_rules ) ) { |
| 339 | 404 | foreach ( array( 'types', 'paths' ) as $_typat ) { |
| 340 | 405 | foreach ( $ao_ccss_rules[ $_typat ] as $rule ) { |
| @@ -353,9 +418,9 @@ | ||
| 353 | 418 | |
| 354 | 419 | return $_has_auto_rules; |
| 355 | 420 | } |
| 356 | 421 | |
| 357 | - public function is_multisite_network_admin() { | |
| 422 | + public static function is_multisite_network_admin() { | |
| 358 | 423 | static $_multisite_network_admin = null; |
| 359 | 424 | |
| 360 | 425 | if ( null === $_multisite_network_admin ) { |
| 361 | 426 | if ( is_multisite() && is_network_admin() ) { |