| 965 | | } elseif ( 'post' == $this->base && post_type_supports( $this->post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $GLOBALS['post'] ) ) { |
| 966 | | $user_wants = get_user_option( 'post_formats_' . $this->post_type ); |
| 967 | | if ( false !== $user_wants ) { |
| 968 | | // User wants what user gets. |
| 969 | | $show_post_format_ui = (bool) $user_wants; |
| 970 | | } else { |
| 971 | | // UI is shown when the theme supports formats, or if the site has formats assigned to posts. |
| 972 | | $show_post_format_ui = current_theme_supports( 'post-formats' ) || get_terms( 'post_format', array( 'number' => 1 ) ); |
| | 966 | } elseif ( 'post' == $this->base && post_type_supports( $this->post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) { |
| | 967 | |
| | 968 | // If the user has explicitly set a screen option, use it, otherwise the UI is shown |
| | 969 | // when the theme supports formats, or if the site has formats assigned to posts. |
| | 970 | $post_format_user_option = get_user_option( 'post_formats_' . $post->post_type ); |
| | 971 | if ( false !== $post_format_user_option ) |
| | 972 | $show_post_format_ui = (bool) $post_format_user_option; |
| | 973 | else |
| | 974 | $show_post_format_ui = current_theme_supports( 'post-formats' ) || (bool) get_terms( 'post_format', array( 'number' => 1 ) ); |
| | 975 | |
| | 976 | if ( ! $show_post_format_ui && 'auto-draft' != $post->post_status ) { |
| | 977 | $meta = get_post_format_meta( $post->ID ); |
| | 978 | $format_meta_keys = array( |
| | 979 | 'link' => array( 'linkurl' ), |
| | 980 | 'image' => array( 'url', 'image' ), |
| | 981 | 'quote' => array( 'quote_source_name', 'quote_source_url' ), |
| | 982 | 'video' => array( 'video_embed' ), |
| | 983 | 'audio' => array( 'audio_embed' ), |
| | 984 | ); |
| | 985 | |
| | 986 | // If there's any structured post format data, enforce the UI display. |
| | 987 | $format_meta_keys = isset( $format_meta_keys[ get_post_format() ] ) ? $format_meta_keys[ get_post_format() ] : array(); |
| | 988 | foreach ( $format_meta_keys as $key ) |
| | 989 | if ( ! empty( $meta[ $key ] ) ) |
| | 990 | $show_post_format_ui = true; |