WordPress.org

Make WordPress Core

Changeset 8732


Ignore:
Timestamp:
08/25/08 21:50:11 (7 years ago)
Author:
ryan
Message:

Notice fixes. see #7509

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r8726 r8732  
    1414if ( ! isset( $post_ID ) ) 
    1515    $post_ID = 0; 
     16else 
     17    $post_ID = (int) $post_ID; 
    1618 
    1719$action = isset($action) ? $action : ''; 
     
    3739    $autosave = false; 
    3840} else { 
    39     $post_ID = (int) $post_ID; 
    4041    $form_action = 'editpost'; 
    4142    $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; 
    42     $autosave = wp_get_post_autosave( $post_id ); 
     43    $autosave = wp_get_post_autosave( $post_ID ); 
    4344 
    4445    // Detect if there exists an autosave newer than the post and if that autosave is different than the post 
  • trunk/wp-admin/includes/post.php

    r8691 r8732  
    1818    $_POST['post_excerpt'] = $_POST['excerpt']; 
    1919    $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : ''; 
    20     $_POST['to_ping'] = $_POST['trackback_url']; 
     20    if ( isset($_POST['trackback_url']) ) 
     21        $_POST['to_ping'] = $_POST['trackback_url']; 
    2122 
    2223    if (!empty ( $_POST['post_author_override'] ) ) { 
     
    3031    } 
    3132 
    32     if ( $_POST['post_author'] != $_POST['user_ID'] ) { 
     33    if ( isset($_POST['user_ID']) && ($_POST['post_author'] != $_POST['user_ID']) ) { 
    3334        if ( 'page' == $_POST['post_type'] ) { 
    3435            if ( !current_user_can( 'edit_others_pages' ) ) { 
     
    6768                $_POST['post_status'] = 'pending'; 
    6869    } else { 
    69         if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) : 
     70        if ( isset($_POST['post_status']) && ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' )) ) : 
    7071            // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate. 
    7172            if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') ) 
  • trunk/wp-admin/includes/template.php

    r8729 r8732  
    918918        $edit = $user_object->user_login; 
    919919    } 
    920     $role_name = $wp_roles->role_names[$role] ? translate_with_context($wp_roles->role_names[$role]) : __('None'); 
     920    $role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None'); 
    921921    $r = "<tr id='user-$user_object->ID'$style> 
    922922        <th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th> 
     
    15311531 
    15321532        foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) { 
    1533             foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) { 
    1534                 if ( false == $box || ! $box['title'] ) 
    1535                     continue; 
    1536                 $i++; 
    1537                 $style = ''; 
    1538                 if ( in_array($box['id'], $hidden) ) 
    1539                     $style = 'style="display:none;"'; 
    1540                 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '" ' . $style . '>' . "\n"; 
    1541                 echo "<h3><span class='hndle'>{$box['title']}</span></h3>\n"; 
    1542                 echo '<div class="inside">' . "\n"; 
    1543                 call_user_func($box['callback'], $object, $box); 
    1544                 echo "</div>\n"; 
    1545                 echo "</div>\n"; 
     1533            if ( isset($wp_meta_boxes[$page][$context][$priority]) ) { 
     1534                foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) { 
     1535                    if ( false == $box || ! $box['title'] ) 
     1536                        continue; 
     1537                    $i++; 
     1538                    $style = ''; 
     1539                    if ( in_array($box['id'], $hidden) ) 
     1540                        $style = 'style="display:none;"'; 
     1541                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '" ' . $style . '>' . "\n"; 
     1542                    echo "<h3><span class='hndle'>{$box['title']}</span></h3>\n"; 
     1543                    echo '<div class="inside">' . "\n"; 
     1544                    call_user_func($box['callback'], $object, $box); 
     1545                    echo "</div>\n"; 
     1546                    echo "</div>\n"; 
     1547                } 
    15461548            } 
    15471549        } 
  • trunk/wp-admin/revision.php

    r8656 r8732  
    1010require_once('admin.php'); 
    1111 
    12 wp_reset_vars(array('revision', 'left', 'right', 'action')); 
     12wp_reset_vars(array('revision', 'left', 'right', 'diff', 'action')); 
    1313$revision_id = absint($revision); 
    1414$diff        = absint($diff); 
  • trunk/wp-includes/canonical.php

    r8667 r8732  
    157157    $redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] ); 
    158158 
    159     // Remove trailing slashes from certain terminating query string args 
    160     $redirect['query'] = preg_replace( '#((p|page_id|cat|tag)=[^&]*?)(%20| )+$#', '$1', $redirect['query'] ); 
    161  
    162     // Clean up empty query strings 
    163     $redirect['query'] = preg_replace( '#&?(p|page_id|cat|tag)=?$#', '', $redirect['query'] ); 
     159    if ( isset( $redirect['query'] ) ) { 
     160        // Remove trailing slashes from certain terminating query string args 
     161        $redirect['query'] = preg_replace( '#((p|page_id|cat|tag)=[^&]*?)(%20| )+$#', '$1', $redirect['query'] ); 
     162 
     163        // Clean up empty query strings 
     164        $redirect['query'] = preg_replace( '#&?(p|page_id|cat|tag)=?$#', '', $redirect['query'] ); 
     165    } 
    164166 
    165167    // strip /index.php/ when we're not using PATHINFO permalinks 
  • trunk/wp-includes/post.php

    r8702 r8732  
    124124 
    125125    $children = get_posts( $r ); 
    126     if ( !$children ) 
    127         return false; 
     126    if ( !$children ) { 
     127        $kids = false; 
     128        return $kids; 
     129    } 
    128130 
    129131    update_post_cache($children); 
     
    777779        return $post; 
    778780    if ( is_object($post) ) { 
     781        if ( !isset($post->ID) ) 
     782            $post->ID = 0; 
    779783        foreach ( array_keys(get_object_vars($post)) as $field ) 
    780784            $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context); 
    781785    } else { 
     786        if ( !isset($post['ID']) ) 
     787            $post['ID'] = 0; 
    782788        foreach ( array_keys($post) as $field ) 
    783789            $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context); 
     
    13171323 
    13181324    // Make sure we set a valid category 
    1319     if (0 == count($post_category) || !is_array($post_category)) { 
     1325    if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) { 
    13201326        $post_category = array(get_option('default_category')); 
    13211327    } 
     
    13291335    if ( empty($post_type) ) 
    13301336        $post_type = 'post'; 
     1337 
     1338    $post_ID = 0; 
    13311339 
    13321340    // Get the post ID and GUID 
     
    14331441        } 
    14341442    } else { 
    1435         $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update 
     1443        if ( isset($post_mime_type) ) 
     1444            $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update 
    14361445        if ( false === $wpdb->insert( $wpdb->posts, $data ) ) { 
    14371446            if ( $wp_error ) 
  • trunk/wp-includes/taxonomy.php

    r8646 r8732  
    610610 
    611611    if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) { 
    612         if ( isset( $cache[ $key ] ) ) 
    613             return apply_filters('get_terms', $cache[$key], $taxonomies, $args); 
     612        if ( isset( $cache[ $key ] ) ) { 
     613            $terms = apply_filters('get_terms', $cache[$key], $taxonomies, $args); 
     614            return $terms; 
     615        } 
    614616    } 
    615617 
Note: See TracChangeset for help on using the changeset viewer.