ID ); $menu = array( 'navigation-bar' => 'Navigation Bar', 'advanced' => 'Advanced' ); $menu = apply_filters( 'tps_post_options_tabs_menu', $menu ); ?>
$option ) { if ( ! array_key_exists( $optionKey, $defaults ) ) { unset( $options[ $optionKey ] ); } else { // Sanitize. if ( is_bool( $defaults[ $optionKey ] ) ) { $options[ $optionKey ] = ( $options[ $optionKey ] === true || $options[ $optionKey ] === 'true' ) ? true : false; } } } $options = array_merge( $defaults, $options ); update_post_meta( $postId, 'tps_options', $options ); } public static function get_post_defaults() { $defaults = array( 'enabled' => 'global', 'nav_vertical_position' => 'global' ); $defaults = apply_filters( 'tps_get_post_defaults', $defaults ); return $defaults; } // Get post options. public static function get_post_options( $postId ) { $defaults = self::get_post_defaults(); $options = get_post_meta( $postId, 'tps_options', true ); if ( ! is_array( $options ) ) { $options = array(); } else { if ( array_key_exists( 'enable', $options ) ) { if ( $options['enable'] === true ) { $options['enable'] = 'enabled'; } elseif ( $options['enable'] === false ) { $options['enable'] = 'disabled'; } } } $options = array_merge( $defaults, $options ); return $options; } public static function get( $postId, $optionId, $optionGroups = array( 'tps_general', 'tps_nav', 'tps_advanced' ) ) { $postOptions = TpsPostOptions::get_post_options( $postId ); if ( array_key_exists( $optionId, $postOptions ) && $postOptions[ $optionId ] != 'global' ) { $value = $postOptions[ $optionId ]; } else { $value = TpsOptions::get( $optionId, $optionGroups ); } return $value; } public static function get_enabled_options() { $options = array( 'global' => 'Use global setting', 'enabled' => 'Enabled', 'disabled' => 'Disabled' ); return $options; } public static function get_post_option_enabled( $postId ) { $postOptions = TpsPostOptions::get_post_options( $postId ); if ( $postOptions['enabled'] == 'global' ) { return TpsOptions::get( 'default_activation_behavior' ) == 1; } return $postOptions['enabled'] == 'enabled'; } }