Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r18415 r19240  
    161161 *
    162162 * @param string $more_link_text Optional. Content for when there is more text.
    163  * @param string $stripteaser Optional. Teaser content before the more text.
    164  */
    165 function the_content($more_link_text = null, $stripteaser = 0) {
     163 * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
     164 */
     165function the_content($more_link_text = null, $stripteaser = false) {
    166166    $content = get_the_content($more_link_text, $stripteaser);
    167167    $content = apply_filters('the_content', $content);
     
    176176 *
    177177 * @param string $more_link_text Optional. Content for when there is more text.
    178  * @param string $stripteaser Optional. Teaser content before the more text.
     178 * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
    179179 * @return string
    180180 */
    181 function get_the_content($more_link_text = null, $stripteaser = 0) {
     181function get_the_content($more_link_text = null, $stripteaser = false) {
    182182    global $post, $more, $page, $pages, $multipage, $preview;
    183183
     
    208208    }
    209209    if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
    210         $stripteaser = 1;
     210        $stripteaser = true;
    211211    $teaser = $content[0];
    212     if ( ($more) && ($stripteaser) && ($hasTeaser) )
     212    if ( $more && $stripteaser && $hasTeaser )
    213213        $teaser = '';
    214214    $output .= $teaser;
     
    330330
    331331    // Post Format
    332     $post_format = get_post_format( $post->ID );
    333 
    334332    if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
     333        $post_format = get_post_format( $post->ID );
     334
    335335        if ( $post_format && !is_wp_error($post_format) )
    336336            $classes[] = 'format-' . sanitize_html_class( $post_format );
     
    433433
    434434        // Post Format
    435         $post_format = get_post_format( $post->ID );
    436 
    437         if ( $post_format && !is_wp_error($post_format) )
    438             $classes[] = 'single-format-' . sanitize_html_class( $post_format );
    439         else
    440             $classes[] = 'single-format-standard';
     435        if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
     436            $post_format = get_post_format( $post->ID );
     437
     438            if ( $post_format && !is_wp_error($post_format) )
     439                $classes[] = 'single-format-' . sanitize_html_class( $post_format );
     440            else
     441                $classes[] = 'single-format-standard';
     442        }
    441443
    442444        if ( is_attachment() ) {
     
    506508        $classes[] = 'admin-bar';
    507509
     510    if ( get_background_image() || get_background_color() )
     511        $classes[] = 'custom-background';
     512
    508513    $page = $wp_query->get( 'page' );
    509514
     
    563568        return true;
    564569
    565     if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password )
     570    if ( stripslashes( $_COOKIE['wp-postpass_' . COOKIEHASH] ) != $post->post_password )
    566571        return true;
    567572
     
    738743        foreach ( (array) $keys as $key ) {
    739744            $keyt = trim($key);
    740             if ( '_' == $keyt[0] )
     745            if ( is_protected_meta( $keyt, 'post' ) )
    741746                continue;
    742747            $values = array_map('trim', get_post_custom_values($key));
     
    774779    $pages = get_pages($r);
    775780    $output = '';
    776     $name = esc_attr($name);
    777781    // Back-compat with old system where both id and name were based on $name argument
    778782    if ( empty($id) )
     
    780784
    781785    if ( ! empty($pages) ) {
    782         $output = "<select name=\"$name\" id=\"$id\">\n";
     786        $output = "<select name='" . esc_attr( $name ) . "' id='" . esc_attr( $id ) . "'>\n";
    783787        if ( $show_option_no_change )
    784788            $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
     
    10391043        }
    10401044
    1041         $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
    1042 
    1043         $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '" title="' . esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
     1045        $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
     1046
     1047        $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
    10441048
    10451049        if ( !empty($show_date) ) {
     
    11061110            $output .= ' selected="selected"';
    11071111        $output .= '>';
    1108         $title = apply_filters( 'list_pages', $page->post_title );
     1112        $title = apply_filters( 'list_pages', $page->post_title, $page );
    11091113        $output .= $pad . esc_html( $title );
    11101114        $output .= "</option>\n";
     
    11491153 * @return string HTML content.
    11501154 */
    1151 function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) {
    1152     $id = intval($id);
     1155function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
     1156    $id = intval( $id );
    11531157    $_post = & get_post( $id );
    11541158
    1155     if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
    1156         return __('Missing Attachment');
     1159    if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
     1160        return __( 'Missing Attachment' );
    11571161
    11581162    if ( $permalink )
    1159         $url = get_attachment_link($_post->ID);
    1160 
    1161     $post_title = esc_attr($_post->post_title);
    1162 
    1163     if ( $text ) {
    1164         $link_text = esc_attr($text);
    1165     } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
    1166         $link_text = wp_get_attachment_image($id, $size, $icon);
    1167     } else {
     1163        $url = get_attachment_link( $_post->ID );
     1164
     1165    $post_title = esc_attr( $_post->post_title );
     1166
     1167    if ( $text )
     1168        $link_text = esc_attr( $text );
     1169    elseif ( $size && 'none' != $size )
     1170        $link_text = wp_get_attachment_image( $id, $size, $icon );
     1171    else
    11681172        $link_text = '';
    1169     }
    1170 
    1171     if( trim($link_text) == '' )
     1173
     1174    if ( trim( $link_text ) == '' )
    11721175        $link_text = $_post->post_title;
    11731176
Note: See TracChangeset for help on using the changeset viewer.