Validate all the checkboxes. * Include the default values. */ $checkboxes = array( 'breeze-active' => '1', 'breeze-cross-origin' => '0', 'breeze-gzip-compression' => '1', 'breeze-browser-cache' => '1', 'breeze-lazy-load' => '0', 'breeze-lazy-load-native' => '0', 'breeze-lazy-load-iframes' => '0', 'breeze-desktop-cache' => '1', 'breeze-mobile-cache' => '1', 'breeze-display-clean' => '1', 'breeze-minify-html' => '0', 'breeze-minify-css' => '0', 'breeze-font-display-swap' => '0', 'breeze-group-css' => '0', 'breeze-include-inline-css' => '0', 'breeze-minify-js' => '0', 'breeze-group-js' => '0', 'breeze-include-inline-js' => '0', 'breeze-enable-js-delay' => '0', 'breeze-preload-links' => '1', 'breeze-wp-emoji' => '0', 'cdn-active' => '0', 'cdn-relative-path' => '1', 'auto-purge-varnish' => '1', 'breeze_inherit_settings' => '0', 'breeze-control-heartbeat' => '0', 'breeze-delay-all-js' => '0', ); if ( array_key_exists( $option, $checkboxes ) ) { if ( '1' === $value || '0' === $value ) { return $value; } else { return $checkboxes[ $option ]; } } $wp_content = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ); $all_user_roles = breeze_all_wp_user_roles(); $active_cache_users = array(); foreach ( $all_user_roles as $usr_role ) { $active_cache_users[ $usr_role ] = 0; } /** * Validate all the options that should have array values. */ $array_list = array( 'breeze-disable-admin' => $active_cache_users, 'breeze-exclude-css' => array(), 'breeze-exclude-js' => array(), 'breeze-move-to-footer-js' => array(), 'breeze-defer-js' => array(), 'breeze-delay-js-scripts' => array( 'gtag', 'document.write', 'html5.js', 'show_ads.js', 'google_ad', 'blogcatalog.com/w', 'tweetmeme.com/i', 'mybloglog.com/', 'histats.com/js', 'ads.smowtion.com/ad.js', 'statcounter.com/counter/counter.js', 'widgets.amung.us', 'ws.amazon.com/widgets', 'media.fastclick.net', '/ads/', 'comment-form-quicktags/quicktags.php', 'edToolbar', 'intensedebate.com', 'scripts.chitika.net/', '_gaq.push', 'jotform.com/', 'admin-bar.min.js', 'GoogleAnalyticsObject', 'plupload.full.min.js', 'syntaxhighlighter', 'adsbygoogle', 'gist.github.com', '_stq', 'nonce', 'post_id', 'data-noptimize', 'googletagmanager', ), 'no-breeze-no-delay-js' => array(), 'breeze-preload-fonts' => array(), 'breeze-exclude-urls' => array(), 'cached-query-strings' => array(), 'cdn-content' => array( 'wp-includes', $wp_content ), 'cdn-exclude-content' => array( '.php' ), 'breeze-prefetch-urls' => array(), ); if ( array_key_exists( $option, $array_list ) ) { if ( is_array( $value ) ) { return $value; } else { return $array_list[ $option ]; } } return '0'; } /** * Validate all the options in the group given. * * @param $option_group * @param $group_name * * @return array * @access private * @since 2.0.0 * @static */ private static function validate_option_group( $option_group, $group_name ) { if ( ! array( $option_group ) ) { return array(); } $changed_options = $option_group; if ( ! empty( $option_group ) && is_array( $option_group ) ) { foreach ( $option_group as $option_name => $option_value ) { $changed_options[ $option_name ] = self::validate_json_entry( $option_value, $option_name ); } return $changed_options; } else { return self::validate_json_entry( $option_group, $group_name ); } } } new Breeze_Settings_Import_Export();