X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/7f1521bf193b382565eb753043c161f4cb3fcda7..53f4633144ed68c8b8fb5861f992b5489894a940:/wp-includes/post-formats.php diff --git a/wp-includes/post-formats.php b/wp-includes/post-formats.php index 94a38581..b904408e 100644 --- a/wp-includes/post-formats.php +++ b/wp-includes/post-formats.php @@ -11,8 +11,8 @@ * * @since 3.1.0 * - * @param int|object $post Post ID or post object. Optional, default is the current post from the loop. - * @return mixed The format if successful. False otherwise. + * @param int|object|null $post Post ID or post object. Optional, default is the current post from the loop. + * @return string|false The format if successful. False otherwise. */ function get_post_format( $post = null ) { if ( ! $post = get_post( $post ) ) @@ -36,8 +36,8 @@ function get_post_format( $post = null ) { * * @since 3.1.0 * - * @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. + * @param string|array $format Optional. The format or formats to check. + * @param object|int|null $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 = array(), $post = null ) { @@ -57,15 +57,15 @@ function has_post_format( $format = array(), $post = null ) { * * @since 3.1.0 * - * @param int|object $post The post for which to assign a format. - * @param string $format A format to assign. Use an empty string or array to remove all formats from the post. - * @return mixed WP_Error on error. Array of affected term IDs on success. + * @param int|object $post The post for which to assign a format. + * @param string $format A format to assign. Use an empty string or array to remove all formats from the post. + * @return array|WP_Error|false WP_Error on error. Array of affected term IDs on success. */ function set_post_format( $post, $format ) { $post = get_post( $post ); if ( empty( $post ) ) - return new WP_Error( 'invalid_post', __( 'Invalid post' ) ); + return new WP_Error( 'invalid_post', __( 'Invalid post.' ) ); if ( ! empty( $format ) ) { $format = sanitize_key( $format ); @@ -135,7 +135,7 @@ function get_post_format_string( $slug ) { * @since 3.1.0 * * @param string $format The post format slug. - * @return string The post format term link. + * @return string|WP_Error|false The post format term link. */ function get_post_format_link( $format ) { $term = get_term_by('slug', 'post-format-' . $format, 'post_format' ); @@ -149,6 +149,9 @@ function get_post_format_link( $format ) { * * @access private * @since 3.1.0 + * + * @param array $qvs + * @return array */ function _post_format_request( $qvs ) { if ( ! isset( $qvs['post_format'] ) ) @@ -167,11 +170,19 @@ function _post_format_request( $qvs ) { * * @access private * @since 3.1.0 + * + * @global WP_Rewrite $wp_rewrite + * + * @param string $link + * @param object $term + * @param string $taxonomy + * @return string */ function _post_format_link( $link, $term, $taxonomy ) { global $wp_rewrite; - if ( 'post_format' != $taxonomy ) + if ( 'post_format' != $taxonomy ) { return $link; + } if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link ); } else { @@ -185,6 +196,9 @@ function _post_format_link( $link, $term, $taxonomy ) { * * @access private * @since 3.1.0 + * + * @param object $term + * @return object */ function _post_format_get_term( $term ) { if ( isset( $term->slug ) ) { @@ -198,6 +212,11 @@ function _post_format_get_term( $term ) { * * @access private * @since 3.1.0 + * + * @param array $terms + * @param string|array $taxonomies + * @param array $args + * @return array */ function _post_format_get_terms( $terms, $taxonomies, $args ) { if ( in_array( 'post_format', (array) $taxonomies ) ) { @@ -221,6 +240,9 @@ function _post_format_get_terms( $terms, $taxonomies, $args ) { * * @access private * @since 3.1.0 + * + * @param array $terms + * @return array */ function _post_format_wp_get_object_terms( $terms ) { foreach ( (array) $terms as $order => $term ) {