X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/5aa86a9053fb0fa15846bb60aac2fb8fdfff524a..refs/tags/wordpress-3.4:/wp-includes/post-template.php
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index eac548b0..5a414eaf 100644
--- a/wp-includes/post-template.php
+++ b/wp-includes/post-template.php
@@ -79,7 +79,6 @@ function the_title_attribute( $args = '' ) {
$r = wp_parse_args($args, $defaults);
extract( $r, EXTR_SKIP );
-
$title = $before . $title . $after;
$title = esc_attr(strip_tags($title));
@@ -188,10 +187,8 @@ function get_the_content($more_link_text = null, $stripteaser = false) {
$hasTeaser = false;
// If post password required and it doesn't match the cookie.
- if ( post_password_required($post) ) {
- $output = get_the_password_form();
- return $output;
- }
+ if ( post_password_required($post) )
+ return get_the_password_form();
if ( $page > count($pages) ) // if the requested page doesn't exist
$page = count($pages); // give them the highest numbered page that DOES exist
@@ -414,8 +411,10 @@ function get_body_class( $class = '' ) {
$classes[] = 'archive';
if ( is_date() )
$classes[] = 'date';
- if ( is_search() )
+ if ( is_search() ) {
$classes[] = 'search';
+ $classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
+ }
if ( is_paged() )
$classes[] = 'paged';
if ( is_attachment() )
@@ -490,15 +489,10 @@ 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 ) ), '' );
+ $classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_page_template_slug( $page_id ) ) );
} else {
$classes[] = 'page-template-default';
}
- } elseif ( is_search() ) {
- if ( !empty( $wp_query->posts ) )
- $classes[] = 'search-results';
- else
- $classes[] = 'search-no-results';
}
if ( is_user_logged_in() )
@@ -507,7 +501,7 @@ function get_body_class( $class = '' ) {
if ( is_admin_bar_showing() )
$classes[] = 'admin-bar';
- if ( get_background_image() || get_background_color() )
+ if ( get_theme_mod( 'background_color' ) || get_background_image() )
$classes[] = 'custom-background';
$page = $wp_query->get( 'page' );
@@ -555,22 +549,29 @@ function get_body_class( $class = '' ) {
*
* @since 2.7.0
*
- * @param int|object $post An optional post. Global $post used if not provided.
+ * @param int|object $post An optional post. Global $post used if not provided.
* @return bool false if a password is not required or the correct password cookie is present, true otherwise.
*/
function post_password_required( $post = null ) {
+ global $wp_hasher;
+
$post = get_post($post);
- if ( empty($post->post_password) )
+ if ( empty( $post->post_password ) )
return false;
- if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) )
+ if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
return true;
- if ( stripslashes( $_COOKIE['wp-postpass_' . COOKIEHASH] ) != $post->post_password )
- return true;
+ if ( empty( $wp_hasher ) ) {
+ require_once( ABSPATH . 'wp-includes/class-phpass.php');
+ // By default, use the portable hash from phpass
+ $wp_hasher = new PasswordHash(8, true);
+ }
- return false;
+ $hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
+
+ return ! $wp_hasher->CheckPassword( $post->post_password, $hash );
}
/**
@@ -994,7 +995,7 @@ class Walker_Page extends Walker {
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
- function start_lvl(&$output, $depth) {
+ function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent
\n";
}
@@ -1006,7 +1007,7 @@ class Walker_Page extends Walker {
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
- function end_lvl(&$output, $depth) {
+ function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\n";
}
@@ -1021,7 +1022,7 @@ class Walker_Page extends Walker {
* @param int $current_page Page ID.
* @param array $args
*/
- function start_el(&$output, $page, $depth, $args, $current_page) {
+ function start_el( &$output, $page, $depth, $args, $current_page = 0 ) {
if ( $depth )
$indent = str_repeat("\t", $depth);
else
@@ -1064,7 +1065,7 @@ class Walker_Page extends Walker {
* @param object $page Page data object. Not used.
* @param int $depth Depth of page. Not Used.
*/
- function end_el(&$output, $page, $depth) {
+ function end_el( &$output, $page, $depth = 0, $args = array() ) {
$output .= "\n";
}
@@ -1102,7 +1103,7 @@ class Walker_PageDropdown extends Walker {
* @param int $depth Depth of page in reference to parent pages. Used for padding.
* @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
*/
- function start_el(&$output, $page, $depth, $args) {
+ function start_el(&$output, $page, $depth, $args, $id = 0) {
$pad = str_repeat(' ', $depth * 3);
$output .= "\t