Make WordPress Core

Changeset 6592


Ignore:
Timestamp:
01/10/2008 08:51:07 PM (17 years ago)
Author:
westi
Message:

Notice fixing for wp-includes. See #5607 props filosofo.

Location:
trunk/wp-includes
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/bookmark.php

    r6480 r6592  
    185185    }
    186186
    187     if ($show_updated) {
    188         $get_updated = ", UNIX_TIMESTAMP(link_updated) AS link_updated_f ";
    189     }
     187    $get_updated = ( $show_updated ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';
    190188
    191189    $orderby = strtolower($orderby);
  • trunk/wp-includes/functions.php

    r6568 r6592  
    991991
    992992function wp_get_referer() {
    993     foreach ( array( $_REQUEST['_wp_http_referer'], $_SERVER['HTTP_REFERER'] ) as $ref )
    994         if ( !empty( $ref ) )
    995             return $ref;
     993    if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
     994        return $_REQUEST['_wp_http_referer'];
     995    else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
     996        return $_SERVER['HTTP_REFERER'];
    996997    return false;
    997998}
  • trunk/wp-includes/link-template.php

    r6551 r6592  
    143143    $pagestruct = $wp_rewrite->get_page_permastruct();
    144144
    145     if ( '' != $pagestruct && 'draft' != $post->post_status ) {
     145    if ( '' != $pagestruct && isset($post->post_status) && 'draft' != $post->post_status ) {
    146146        $link = get_page_uri($id);
    147147        $link = str_replace('%pagename%', $link, $pagestruct);
     
    598598
    599599    $home_root = parse_url(get_option('home'));
    600     $home_root = $home_root['path'];
     600    $home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
    601601    $home_root = preg_quote( trailingslashit( $home_root ), '|' );
    602602
  • trunk/wp-includes/post-template.php

    r6399 r6592  
    5757    if ( !empty($post->post_password) )
    5858        $title = sprintf(__('Protected: %s'), $title);
    59     else if ( 'private' == $post->post_status )
     59    else if ( isset($post->post_status) && 'private' == $post->post_status )
    6060        $title = sprintf(__('Private: %s'), $title);
    6161
     
    444444            $constraint = '';
    445445        }
     446    } else {
     447        $constraint = '';
    446448    }
    447449
  • trunk/wp-includes/post.php

    r6551 r6592  
    158158function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
    159159    global $wpdb;
     160    $null = null;
    160161
    161162    if ( empty($post) ) {
     
    163164            $_post = & $GLOBALS['post'];
    164165        else
    165             return null;
     166            return $null;
    166167    } elseif ( is_object($post) ) {
    167168        wp_cache_add($post->ID, $post, 'posts');
  • trunk/wp-includes/rewrite.php

    r6398 r6592  
    6868
    6969    // First, check to see if there is a 'p=N' or 'page_id=N' to match against
    70     preg_match('#[?&](p|page_id)=(\d+)#', $url, $values);
    71     $id = intval($values[2]);
    72     if ( $id ) return $id;
     70    if ( preg_match('#[?&](p|page_id)=(\d+)#', $url, $values) ) {
     71        $id = absint($values[2]);
     72        if ($id)
     73            return $id;
     74    }
    7375
    7476    // Check to see if we are using rewrite rules
     
    592594            if (0 < $i) {
    593595                $queries[$i] = $queries[$i - 1] . '&';
     596            } else {
     597                $queries[$i] = '';
    594598            }
    595599
     
    629633            $num_toks = preg_match_all('/%.+?%/', $struct, $toks);
    630634            //get the 'tagname=$matches[i]'
    631             $query = $queries[$num_toks - 1];
     635            $query = ( isset($queries) && is_array($queries) ) ? $queries[$num_toks - 1] : '';
    632636
    633637            //set up $ep_mask_specific which is used to match more specific URL types
     
    722726
    723727                    //do endpoints for attachments
    724                     if ($endpoint) { foreach ($ep_query_append as $regex => $ep) {
     728                    if (! empty($endpoint) ) { foreach ($ep_query_append as $regex => $ep) {
    725729                        if ($ep[0] & EP_ATTACHMENT) {
    726730                            $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
  • trunk/wp-includes/taxonomy.php

    r6551 r6592  
    507507function &get_terms($taxonomies, $args = '') {
    508508    global $wpdb;
     509    $empty_array = array();
    509510
    510511    $single_taxonomy = false;
     
    546547        $hierarchy = _get_term_hierarchy($taxonomies[0]);
    547548        if ( !isset($hierarchy[$child_of]) )
    548             return array();
     549            return $empty_array;
    549550    }
    550551
     
    552553        $hierarchy = _get_term_hierarchy($taxonomies[0]);
    553554        if ( !isset($hierarchy[$parent]) )
    554             return array();
     555            return $empty_array;
    555556    }
    556557
     
    15821583 */
    15831584function &get_object_term_cache($id, $taxonomy) {
    1584     return wp_cache_get($id, "{$taxonomy}_relationships");
     1585    $cache = wp_cache_get($id, "{$taxonomy}_relationships");
     1586    return $cache;
    15851587}
    15861588
     
    17281730 */
    17291731function &_get_term_children($term_id, $terms, $taxonomy) {
     1732    $empty_array = array();
    17301733    if ( empty($terms) )
    1731         return array();
     1734        return $empty_array;
    17321735
    17331736    $term_list = array();
     
    17351738
    17361739    if  ( ( 0 != $term_id ) && ! isset($has_children[$term_id]) )
    1737         return array();
     1740        return $empty_array;
    17381741
    17391742    foreach ( $terms as $term ) {
  • trunk/wp-includes/theme.php

    r6530 r6592  
    7777    preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri );
    7878    preg_match( '|Description:(.*)$|mi', $theme_data, $description );
    79     preg_match( '|Author:(.*)$|mi', $theme_data, $author_name );
    80     preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri );
    81     preg_match( '|Template:(.*)$|mi', $theme_data, $template );
     79
     80    if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
     81        $author_uri = clean_url( trim( $author_uri[1]) );
     82    else
     83        $author_uti = '';
     84
     85    if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
     86        $template = wp_kses( trim( $template[1], $themes_allowed_tags ) );
     87    else
     88        $template = '';
    8289
    8390    if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
     
    99106    $theme_uri = clean_url( trim( $theme_uri[1] ) );
    100107    $description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
    101     $template = wp_kses( trim( $template[1] ), $themes_allowed_tags );
    102 
    103     $author_uri = clean_url( trim( $author_uri[1] ) );
    104 
    105     if ( empty( $author_uri[1] ) ) {
    106         $author = wp_kses( trim( $author_name[1] ), $themes_allowed_tags );
     108
     109    if ( preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ) ) {
     110        if ( empty( $author_uri ) ) {
     111            $author = wp_kses( trim( $author_name[1] ), $themes_allowed_tags );
     112        } else {
     113            $author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( trim( $author_name[1] ), $themes_allowed_tags ) );
     114        }
    107115    } else {
    108         $author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( trim( $author_name[1] ), $themes_allowed_tags ) );
     116        $author = __('Anonymous');
    109117    }
    110118
Note: See TracChangeset for help on using the changeset viewer.