wp/wp-includes/post-formats.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
--- a/wp/wp-includes/post-formats.php	Mon Jun 08 16:11:51 2015 +0000
+++ b/wp/wp-includes/post-formats.php	Tue Jun 09 03:35:32 2015 +0200
@@ -26,29 +26,27 @@
 	if ( empty( $_format ) )
 		return false;
 
-	$format = array_shift( $_format );
+	$format = reset( $_format );
 
 	return str_replace('post-format-', '', $format->slug );
 }
 
 /**
- * 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();
 
-	$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 @@
  *
  * @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 @@
  *
  * @since 3.1.0
  *
- * @uses get_post_format_strings()
- *
  * @param string $slug A post format slug.
  * @return string The translated post format name.
  */
@@ -167,7 +161,6 @@
 		$qvs['post_type'] = $tax->object_type;
 	return $qvs;
 }
-add_filter( 'request', '_post_format_request' );
 
 /**
  * Filters the post format term link to remove the format prefix.
@@ -186,7 +179,6 @@
 		return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link );
 	}
 }
-add_filter( 'term_link', '_post_format_link', 10, 3 );
 
 /**
  * Remove the post format prefix from the name property of the term object created by get_term().
@@ -200,7 +192,6 @@
 	}
 	return $term;
 }
-add_filter( 'get_post_format', '_post_format_get_term' );
 
 /**
  * Remove the post format prefix from the name property of the term objects created by get_terms().
@@ -224,7 +215,6 @@
 	}
 	return $terms;
 }
-add_filter( 'get_terms', '_post_format_get_terms', 10, 3 );
 
 /**
  * Remove the post format prefix from the name property of the term objects created by wp_get_object_terms().
@@ -240,4 +230,3 @@
 	}
 	return $terms;
 }
-add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );