X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/f9001779751f83dc8a10e478bfecb4d8dd5f964c..5aa86a9053fb0fa15846bb60aac2fb8fdfff524a:/wp-includes/post-template.php diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index bf4671b6..eac548b0 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -160,9 +160,9 @@ function get_the_guid( $id = 0 ) { * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. - * @param string $stripteaser Optional. Teaser content before the more text. + * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. */ -function the_content($more_link_text = null, $stripteaser = 0) { +function the_content($more_link_text = null, $stripteaser = false) { $content = get_the_content($more_link_text, $stripteaser); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); @@ -175,10 +175,10 @@ function the_content($more_link_text = null, $stripteaser = 0) { * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. - * @param string $stripteaser Optional. Teaser content before the more text. + * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. * @return string */ -function get_the_content($more_link_text = null, $stripteaser = 0) { +function get_the_content($more_link_text = null, $stripteaser = false) { global $post, $more, $page, $pages, $multipage, $preview; if ( null === $more_link_text ) @@ -207,9 +207,9 @@ function get_the_content($more_link_text = null, $stripteaser = 0) { $content = array($content); } if ( (false !== strpos($post->post_content, '') && ((!$multipage) || ($page==1))) ) - $stripteaser = 1; + $stripteaser = true; $teaser = $content[0]; - if ( ($more) && ($stripteaser) && ($hasTeaser) ) + if ( $more && $stripteaser && $hasTeaser ) $teaser = ''; $output .= $teaser; if ( count($content) > 1 ) { @@ -329,9 +329,9 @@ function get_post_class( $class = '', $post_id = null ) { $classes[] = 'status-' . $post->post_status; // Post Format - $post_format = get_post_format( $post->ID ); - if ( post_type_supports( $post->post_type, 'post-formats' ) ) { + $post_format = get_post_format( $post->ID ); + if ( $post_format && !is_wp_error($post_format) ) $classes[] = 'format-' . sanitize_html_class( $post_format ); else @@ -432,12 +432,14 @@ function get_body_class( $class = '' ) { $classes[] = 'postid-' . $post_id; // Post Format - $post_format = get_post_format( $post->ID ); + if ( post_type_supports( $post->post_type, 'post-formats' ) ) { + $post_format = get_post_format( $post->ID ); - if ( $post_format && !is_wp_error($post_format) ) - $classes[] = 'single-format-' . sanitize_html_class( $post_format ); - else - $classes[] = 'single-format-standard'; + if ( $post_format && !is_wp_error($post_format) ) + $classes[] = 'single-format-' . sanitize_html_class( $post_format ); + else + $classes[] = 'single-format-standard'; + } if ( is_attachment() ) { $mime_type = get_post_mime_type($post_id); @@ -489,6 +491,8 @@ function get_body_class( $class = '' ) { if ( is_page_template() ) { $classes[] = 'page-template'; $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_post_meta( $page_id, '_wp_page_template', true ) ), '' ); + } else { + $classes[] = 'page-template-default'; } } elseif ( is_search() ) { if ( !empty( $wp_query->posts ) ) @@ -503,6 +507,9 @@ function get_body_class( $class = '' ) { if ( is_admin_bar_showing() ) $classes[] = 'admin-bar'; + if ( get_background_image() || get_background_color() ) + $classes[] = 'custom-background'; + $page = $wp_query->get( 'page' ); if ( !$page || $page < 2) @@ -529,10 +536,13 @@ function get_body_class( $class = '' ) { $classes[] = 'post-type-paged-' . $page; } - if ( !empty( $class ) ) { + if ( ! empty( $class ) ) { if ( !is_array( $class ) ) $class = preg_split( '#\s+#', $class ); $classes = array_merge( $classes, $class ); + } else { + // Ensure that we always coerce class to being an array. + $class = array(); } $classes = array_map( 'esc_attr', $classes ); @@ -557,7 +567,7 @@ function post_password_required( $post = null ) { if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) ) return true; - if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) + if ( stripslashes( $_COOKIE['wp-postpass_' . COOKIEHASH] ) != $post->post_password ) return true; return false; @@ -732,7 +742,7 @@ function the_meta() { echo "