WordPress.org

Make WordPress Core

Changeset 12284


Ignore:
Timestamp:
11/26/09 11:29:54 (5 years ago)
Author:
azaozz
Message:

Fix notices and phpdoc, props hakre, fixes #10758

Location:
trunk
Files:
9 edited

Legend:

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

    r12246 r12284  
    934934 * @since unknown 
    935935 * 
    936  * @param unknown_type $id 
    937  * @param unknown_type $title 
    938  * @param unknown_type $name 
    939  * @return unknown 
     936 * @param int|object $id    Post ID or post object.  
     937 * @param string $title (optional) Title  
     938 * @param string $name (optional) Name  
     939 * @return array With two entries of type string  
    940940 */ 
    941941function get_sample_permalink($id, $title = null, $name = null) { 
     
    952952    if (in_array($post->post_status, array('draft', 'pending'))) { 
    953953        $post->post_status = 'publish'; 
    954         $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID); 
     954        $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID); 
    955955    } 
    956956 
     
    960960    // Note: if empty name is supplied -- use the title instead, see #6072 
    961961    if (!is_null($name)) { 
    962         $post->post_name = sanitize_title($name? $name : $title, $post->ID); 
     962        $post->post_name = sanitize_title($name ? $name : $title, $post->ID); 
    963963    } 
    964964 
     
    988988 
    989989/** 
    990  * {@internal Missing Short Description}} 
    991  * 
    992  * @since unknown 
    993  * 
    994  * @param unknown_type $id 
    995  * @param unknown_type $new_title 
    996  * @param unknown_type $new_slug 
    997  * @return unknown 
     990 * sample permalink html 
     991 * 
     992 * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 
     993 *  
     994 * @since unknown 
     995 * 
     996 * @param int|object $id Post ID or post object.  
     997 * @param string $new_title (optional) New title   
     998 * @param string $new_slug (optional) New slug  
     999 * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.  
    9981000 */ 
    9991001function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { 
  • trunk/wp-admin/includes/widgets.php

    r12213 r12284  
    191191    <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($id_format); ?>" /> 
    192192    <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" /> 
    193     <input type="hidden" name="widget-width" class="widget-width" value="<?php echo esc_attr($control['width']); ?>" /> 
    194     <input type="hidden" name="widget-height" class="widget-height" value="<?php echo esc_attr($control['height']); ?>" /> 
     193    <input type="hidden" name="widget-width" class="widget-width" value="<?php if (isset( $control['width'] )) echo esc_attr($control['width']); ?>" /> 
     194    <input type="hidden" name="widget-height" class="widget-height" value="<?php if (isset( $control['height'] )) echo esc_attr($control['height']); ?>" /> 
    195195    <input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr($widget_number); ?>" /> 
    196196    <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" /> 
  • trunk/wp-admin/upload.php

    r12231 r12284  
    309309    if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?> 
    310310<select name='m'> 
    311 <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option> 
     311<option value='0'><?php _e('Show all dates'); ?></option> 
    312312<?php 
    313313foreach ($arc_result as $arc_row) { 
  • trunk/wp-comments-post.php

    r12267 r12284  
    1818nocache_headers(); 
    1919 
    20 $comment_post_ID = (int) $_POST['comment_post_ID']; 
     20$comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0; 
    2121 
    2222$status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); 
  • trunk/wp-includes/author-template.php

    r12012 r12284  
    2323function get_the_author($deprecated = '') { 
    2424    global $authordata; 
    25     return apply_filters('the_author', $authordata->display_name); 
     25    return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null); 
    2626} 
    2727 
  • trunk/wp-includes/comment.php

    r12267 r12284  
    11381138        $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_id']; 
    11391139 
    1140     $commentdata['comment_parent'] = absint($commentdata['comment_parent']); 
     1140    $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0; 
    11411141    $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : ''; 
    11421142    $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0; 
  • trunk/wp-includes/post.php

    r12279 r12284  
    19421942 * Given the desired slug and some post details computes a unique slug for the post. 
    19431943 * 
     1944 * @global wpdb $wpdb  
     1945 * @global WP_Rewrite $wp_rewrite  
    19441946 * @param string $slug the desired slug (post_name) 
    19451947 * @param integer $post_ID 
     
    19541956 
    19551957    global $wpdb, $wp_rewrite; 
     1958 
     1959    $feeds = $wp_rewrite->feeds; 
     1960    if ( !is_array($feeds) ) 
     1961        $feeds = array(); 
     1962 
    19561963    $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page')); 
    19571964    if ( 'attachment' == $post_type ) { 
     
    19601967        $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID)); 
    19611968 
    1962         if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { 
     1969        if ( $post_name_check || in_array($slug, $feeds) ) { 
    19631970            $suffix = 2; 
    19641971            do { 
     
    19751982        $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent)); 
    19761983 
    1977         if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { 
     1984        if ( $post_name_check || in_array($slug, $feeds) ) { 
    19781985            $suffix = 2; 
    19791986            do { 
  • trunk/wp-includes/vars.php

    r11761 r12284  
    3838$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false; 
    3939 
    40 if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) { 
    41     $is_lynx = true; 
    42 } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) { 
    43     $is_chrome = true; 
    44 } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) { 
    45     $is_safari = true; 
    46 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) { 
    47     $is_gecko = true; 
    48 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) { 
    49     $is_winIE = true; 
    50 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) { 
    51     $is_macIE = true; 
    52 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) { 
    53     $is_opera = true; 
    54 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) { 
    55     $is_NS4 = true; 
     40if ( isset($_SERVER['HTTP_USER_AGENT']) ) { 
     41    if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) { 
     42        $is_lynx = true; 
     43    } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) { 
     44        $is_chrome = true; 
     45    } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) { 
     46        $is_safari = true; 
     47    } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) { 
     48        $is_gecko = true; 
     49    } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false ) { 
     50        $is_winIE = true; 
     51    } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false ) { 
     52        $is_macIE = true; 
     53    } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false ) { 
     54        $is_opera = true; 
     55    } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false ) { 
     56        $is_NS4 = true; 
     57    } 
    5658} 
    5759 
  • trunk/wp-trackback.php

    r12032 r12284  
    3737$request_array = 'HTTP_POST_VARS'; 
    3838 
    39 if ( !$_GET['tb_id'] ) { 
     39if ( !isset($_GET['tb_id']) || !$_GET['tb_id'] ) { 
    4040    $tb_id = explode('/', $_SERVER['REQUEST_URI']); 
    4141    $tb_id = intval( $tb_id[ count($tb_id) - 1 ] ); 
    4242} 
    4343 
    44 $tb_url  = $_POST['url']; 
    45 $charset = $_POST['charset']; 
     44$tb_url  = isset($_POST['url'])     ? $_POST['url']     : ''; 
     45$charset = isset($_POST['charset']) ? $_POST['charset'] : ''; 
    4646 
    4747// These three are stripslashed here so that they can be properly escaped after mb_convert_encoding() 
    48 $title     = stripslashes($_POST['title']); 
    49 $excerpt   = stripslashes($_POST['excerpt']); 
    50 $blog_name = stripslashes($_POST['blog_name']); 
     48$title     = isset($_POST['title'])     ? stripslashes($_POST['title'])      : ''; 
     49$excerpt   = isset($_POST['excerpt'])   ? stripslashes($_POST['excerpt'])    : ''; 
     50$blog_name = isset($_POST['blog_name']) ? stripslashes($_POST['blog_name'])  : ''; 
    5151 
    5252if ($charset) 
     
    7373    $tb_id = $posts[0]->ID; 
    7474 
    75 if ( !intval( $tb_id ) ) 
     75if ( !isset($tb_id) || !intval( $tb_id ) ) 
    7676    trackback_response(1, 'I really need an ID for this to work.'); 
    7777 
Note: See TracChangeset for help on using the changeset viewer.