ilters( 'autoptimize_filter_meta_optim_nonbool', array( 'ao_post_preload' ) ) ) ) { // but make sure to return false for text input. return false; } return true; } else if ( array_key_exists( 'ao_post_optimize', $_meta_value ) && 'on' !== $_meta_value['ao_post_optimize'] ) { // ao entirely off for this page. return false; } else if ( in_array( $optim, apply_filters( 'autoptimize_filter_meta_optim_with_filters', array() ) ) ) { // if an $optim is registered as having a filter, apply filter and return that (default false). return apply_filters( 'autoptimize_filter_meta_filtered_optim', false, $optim, $_meta_value ); } else if ( array_key_exists( $optim, $_meta_value ) && empty( $_meta_value[ $optim ] ) ) { // sub-optimization off for this page. return false; } else if ( array_key_exists( $optim, $_meta_value ) && 'on' === $_meta_value[ $optim ] ) { // sub-optimization is explictly on. return true; } else if ( array_key_exists( $optim, $_meta_value ) && in_array( $optim, array( 'ao_post_preload' ) ) && ! empty( $_meta_value[ $optim ] ) ) { // a non-bool metabox optimization (currently only preload field), return value instead of bool. return $_meta_value[ $optim ]; } else if ( in_array( $optim, array( 'ao_post_preload' ) ) && ( ! array_key_exists( $optim, $_meta_value ) || empty( $_meta_value[ $optim ] ) ) ) { // a non-bool metabox optimization not found or empty, so returning false. return false; } else { // when in doubt "go" for optimization, but this should never happen? if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { error_log( 'AO meta box logic fallback; well, how did I get here? Maybe this helps: looking for ' . $optim . ' in ' . json_encode( $_meta_value ) ); } return true; } } /** * Are the post meta AO settings active (default: no)? * * @return bool */ public static function is_ao_meta_settings_active() { static $_meta_settings_active = null; if ( null === $_meta_settings_active ) { $_meta_settings_active = apply_filters( 'autoptimize_filter_enable_meta_ao_settings', autoptimizeOptionWrapper::get_option( 'autoptimize_enable_meta_ao_settings', '1' ) ); } return $_meta_settings_active; } }