X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..5d244c8fd9a27c9f89dd08da2af6fbc67d4fce63:/wp-includes/post-template.php diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index c736e316..f13a458b 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -21,7 +21,6 @@ function the_ID() { * Retrieve the ID of the current item in the WordPress Loop. * * @since 2.1.0 - * @uses $post * * @return int|bool The ID of the current item in the WordPress Loop. False if $post is not set. */ @@ -207,7 +206,7 @@ function get_the_guid( $id = 0 ) { * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. - * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. + * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. */ function the_content( $more_link_text = null, $strip_teaser = false) { $content = get_the_content( $more_link_text, $strip_teaser ); @@ -230,7 +229,7 @@ function the_content( $more_link_text = null, $strip_teaser = false) { * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. - * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. + * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. * @return string */ function get_the_content( $more_link_text = null, $strip_teaser = false ) { @@ -291,14 +290,14 @@ function get_the_content( $more_link_text = null, $strip_teaser = false ) { } } - if ( $preview ) // preview fix for javascript bug with foreign languages + if ( $preview ) // Preview fix for JavaScript bug with foreign languages. $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output ); return $output; } /** - * Preview fix for javascript bug with foreign languages + * Preview fix for JavaScript bug with foreign languages. * * @since 3.1.0 * @access private @@ -615,7 +614,14 @@ function get_body_class( $class = '' ) { } if ( is_page_template() ) { $classes[] = 'page-template'; - $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_page_template_slug( $page_id ) ) ); + + $template_slug = get_page_template_slug( $page_id ); + $template_parts = explode( '/', $template_slug ); + + foreach ( $template_parts as $part ) { + $classes[] = 'page-template-' . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) ); + } + $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', $template_slug ) ); } else { $classes[] = 'page-template-default'; } @@ -724,11 +730,11 @@ function post_password_required( $post = null ) { * @param string|array $args { * Optional. Array or string of default arguments. * - * @type string $before HTML or text to prepend to each link. Default is '

Pages:'. - * @type string $after HTML or text to append to each link. Default is '

'. - * @type string $link_before HTML or text to prepend to each link, inside the tag. + * @type string $before HTML or text to prepend to each link. Default is `

Pages:`. + * @type string $after HTML or text to append to each link. Default is `

`. + * @type string $link_before HTML or text to prepend to each link, inside the `
` tag. * Also prepended to the current item, which is not linked. Default empty. - * @type string $link_after HTML or text to append to each Pages link inside the tag. + * @type string $link_after HTML or text to append to each Pages link inside the `` tag. * Also appended to the current item, which is not linked. Default empty. * @type string $next_or_number Indicates whether page numbers should be used. Valid values are number * and next. Default is 'number'. @@ -787,7 +793,10 @@ function wp_link_pages( $args = '' ) { * @param int $i Page number for paginated posts' page links. */ $link = apply_filters( 'wp_link_pages_link', $link, $i ); - $output .= $r['separator'] . $link; + + // Use the custom links separator beginning with the second link. + $output .= ( 1 === $i ) ? ' ' : $r['separator']; + $output .= $link; } $output .= $r['after']; } elseif ( $more ) { @@ -797,16 +806,17 @@ function wp_link_pages( $args = '' ) { $link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . ''; /** This filter is documented in wp-includes/post-template.php */ - $link = apply_filters( 'wp_link_pages_link', $link, $prev ); - $output .= $r['separator'] . $link; + $output .= apply_filters( 'wp_link_pages_link', $link, $prev ); } $next = $page + 1; if ( $next <= $numpages ) { + if ( $prev ) { + $output .= $r['separator']; + } $link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . ''; /** This filter is documented in wp-includes/post-template.php */ - $link = apply_filters( 'wp_link_pages_link', $link, $next ); - $output .= $r['separator'] . $link; + $output .= apply_filters( 'wp_link_pages_link', $link, $next ); } $output .= $r['after']; } @@ -896,7 +906,6 @@ function post_custom( $key = '' ) { * * @internal This will probably change at some point... * @since 1.2.0 - * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters. */ function the_meta() { if ( $keys = get_post_custom_keys() ) { @@ -1296,7 +1305,7 @@ class Walker_Page extends Walker { if ( ! empty( $current_page ) ) { $_current_page = get_post( $current_page ); - if ( in_array( $page->ID, $_current_page->ancestors ) ) { + if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) { $css_class[] = 'current_page_ancestor'; } if ( $page->ID == $current_page ) { @@ -1437,9 +1446,9 @@ class Walker_PageDropdown extends Walker { * @since 2.0.0 * * @param int|WP_Post $id Optional. Post ID or post object. - * @param bool $fullsize Optional, default is false. Whether to use full size. - * @param bool $deprecated Deprecated. Not used. - * @param bool $permalink Optional, default is false. Whether to include permalink. + * @param bool $fullsize Optional, default is false. Whether to use full size. + * @param bool $deprecated Deprecated. Not used. + * @param bool $permalink Optional, default is false. Whether to include permalink. */ function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { if ( !empty( $deprecated ) ) @@ -1455,16 +1464,16 @@ function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $ * Retrieve an attachment page link using an image or icon, if possible. * * @since 2.5.0 - * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function. * - * @param int|WP_Post $id Optional. Post ID or post object. - * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. - * @param bool $permalink Optional, default is false. Whether to add permalink to image. - * @param bool $icon Optional, default is false. Whether to include icon. - * @param string|bool $text Optional, default is false. If string, then will be link text. + * @param int|WP_Post $id Optional. Post ID or post object. + * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. + * @param bool $permalink Optional, default is false. Whether to add permalink to image. + * @param bool $icon Optional, default is false. Whether to include icon. + * @param string|bool $text Optional, default is false. If string, then will be link text. + * @param array|string $attr Optional. Array or string of attributes. * @return string HTML content. */ -function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { +function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) { $id = intval( $id ); $_post = get_post( $id ); @@ -1474,12 +1483,13 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals if ( $permalink ) $url = get_attachment_link( $_post->ID ); - if ( $text ) + if ( $text ) { $link_text = $text; - elseif ( $size && 'none' != $size ) - $link_text = wp_get_attachment_image( $id, $size, $icon ); - else + } elseif ( $size && 'none' != $size ) { + $link_text = wp_get_attachment_image( $id, $size, $icon, $attr ); + } else { $link_text = ''; + } if ( trim( $link_text ) == '' ) $link_text = $_post->post_title; @@ -1500,7 +1510,7 @@ function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = fals } /** - * Wrap attachment in <

> element before content. + * Wrap attachment in paragraph tag before content. * * @since 2.0.0 * @@ -1589,7 +1599,6 @@ function get_the_password_form( $post = 0 ) { * specific to that template. * * @since 2.5.0 - * @uses $wp_query * * @param string $template The specific template name if specific matching is required. * @return bool True on success, false on failure. @@ -1636,8 +1645,6 @@ function get_page_template_slug( $post_id = null ) { * * @since 2.6.0 * - * @uses date_i18n() - * * @param int|object $revision Revision ID or revision object. * @param bool $link Optional, default is true. Link to revisions's page? * @return string i18n formatted datetimestamp or localized 'Current Revision'. @@ -1673,8 +1680,6 @@ function wp_post_revision_title( $revision, $link = true ) { * * @since 3.6.0 * - * @uses date_i18n() - * * @param int|object $revision Revision ID or revision object. * @param bool $link Optional, default is true. Link to revisions's page? * @return string gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'. @@ -1724,13 +1729,8 @@ function wp_post_revision_title_expanded( $revision, $link = true ) { * * @since 2.6.0 * - * @uses wp_get_post_revisions() - * @uses wp_post_revision_title_expanded() - * @uses get_edit_post_link() - * @uses get_the_author_meta() - * * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. - * @param string $type 'all' (default), 'revision' or 'autosave' + * @param string $type 'all' (default), 'revision' or 'autosave' * @return null */ function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {