X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/11be15bd505d66a91e2c80062190b13e315a04a9..caeaf8dc94b5e3f75dc98ec92dc7b76049cdddb6:/wp-includes/post-formats.php diff --git a/wp-includes/post-formats.php b/wp-includes/post-formats.php index a13de3ea..ac613f39 100644 --- a/wp-includes/post-formats.php +++ b/wp-includes/post-formats.php @@ -32,23 +32,21 @@ function get_post_format( $post = null ) { } /** - * Check if a post has a particular format + * Check if a post has any of the given formats, or any format. * * @since 3.1.0 * - * @uses has_term() - * - * @param string|array $format The format or formats to check. - * @param object|int $post The post to check. If not supplied, defaults to the current post if used in the loop. - * @return bool True if the post has the format, false otherwise. + * @param string|array $format Optional. The format or formats to check. + * @param object|int $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop. + * @return bool True if the post has any of the given formats (or any format, if no format specified), false otherwise. */ -function has_post_format( $format, $post = null ) { - if ( ! is_array( $format ) ) - $format = array( $format ); - +function has_post_format( $format = array(), $post = null ) { $prefixed = array(); - foreach( $format as $single ) { - $prefixed[] = 'post-format-' . sanitize_key( $single ); + + if ( $format ) { + foreach ( (array) $format as $single ) { + $prefixed[] = 'post-format-' . sanitize_key( $single ); + } } return has_term( $prefixed, 'post_format', $post ); @@ -108,8 +106,6 @@ function get_post_format_strings() { * * @since 3.1.0 * - * @uses get_post_format_strings() - * * @return array The array of post format slugs. */ function get_post_format_slugs() { @@ -122,8 +118,6 @@ function get_post_format_slugs() { * * @since 3.1.0 * - * @uses get_post_format_strings() - * * @param string $slug A post format slug. * @return string The translated post format name. */