<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12284] trunk: Fix notices and phpdoc, props hakre, fixes #10758</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12284">12284</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-11-26 11:29:54 +0000 (Thu, 26 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix notices and phpdoc, props hakre, fixes <a href="http://trac.wordpress.org/ticket/10758">#10758</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludeswidgetsphp">trunk/wp-admin/includes/widgets.php</a></li>
<li><a href="#trunkwpadminuploadphp">trunk/wp-admin/upload.php</a></li>
<li><a href="#trunkwpcommentspostphp">trunk/wp-comments-post.php</a></li>
<li><a href="#trunkwpincludesauthortemplatephp">trunk/wp-includes/author-template.php</a></li>
<li><a href="#trunkwpincludescommentphp">trunk/wp-includes/comment.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesvarsphp">trunk/wp-includes/vars.php</a></li>
<li><a href="#trunkwptrackbackphp">trunk/wp-trackback.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-admin/includes/post.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -933,10 +933,10 @@
</span><span class="cx">  *
</span><span class="cx">  * @since unknown
</span><span class="cx">  *
</span><del>- * @param unknown_type $id
- * @param unknown_type $title
- * @param unknown_type $name
- * @return unknown
</del><ins>+ * @param int|object $id    Post ID or post object. 
+ * @param string $title (optional) Title 
+ * @param string $name (optional) Name 
+ * @return array With two entries of type string 
</ins><span class="cx">  */
</span><span class="cx"> function get_sample_permalink($id, $title = null, $name = null) {
</span><span class="cx">         $post = &amp;get_post($id);
</span><span class="lines">@@ -951,7 +951,7 @@
</span><span class="cx">         // drafts, so we will fake, that our post is published
</span><span class="cx">         if (in_array($post-&gt;post_status, array('draft', 'pending'))) {
</span><span class="cx">                 $post-&gt;post_status = 'publish';
</span><del>-                $post-&gt;post_name = sanitize_title($post-&gt;post_name? $post-&gt;post_name : $post-&gt;post_title, $post-&gt;ID);
</del><ins>+                $post-&gt;post_name = sanitize_title($post-&gt;post_name ? $post-&gt;post_name : $post-&gt;post_title, $post-&gt;ID);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $post-&gt;post_name = wp_unique_post_slug($post-&gt;post_name, $post-&gt;ID, $post-&gt;post_status, $post-&gt;post_type, $post-&gt;post_parent);
</span><span class="lines">@@ -959,7 +959,7 @@
</span><span class="cx">         // If the user wants to set a new name -- override the current one
</span><span class="cx">         // Note: if empty name is supplied -- use the title instead, see #6072
</span><span class="cx">         if (!is_null($name)) {
</span><del>-                $post-&gt;post_name = sanitize_title($name? $name : $title, $post-&gt;ID);
</del><ins>+                $post-&gt;post_name = sanitize_title($name ? $name : $title, $post-&gt;ID);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $post-&gt;filter = 'sample';
</span><span class="lines">@@ -987,14 +987,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * {@internal Missing Short Description}}
</del><ins>+ * sample permalink html
</ins><span class="cx">  *
</span><ins>+ * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
+ * 
</ins><span class="cx">  * @since unknown
</span><span class="cx">  *
</span><del>- * @param unknown_type $id
- * @param unknown_type $new_title
- * @param unknown_type $new_slug
- * @return unknown
</del><ins>+ * @param int|object $id Post ID or post object. 
+ * @param string $new_title (optional) New title  
+ * @param string $new_slug (optional) New slug 
+ * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 
</ins><span class="cx">  */
</span><span class="cx"> function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
</span><span class="cx">         $post = &amp;get_post($id);
</span></span></pre></div>
<a id="trunkwpadminincludeswidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/widgets.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/widgets.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-admin/includes/widgets.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -190,8 +190,8 @@
</span><span class="cx">         &lt;/div&gt;
</span><span class="cx">         &lt;input type=&quot;hidden&quot; name=&quot;widget-id&quot; class=&quot;widget-id&quot; value=&quot;&lt;?php echo esc_attr($id_format); ?&gt;&quot; /&gt;
</span><span class="cx">         &lt;input type=&quot;hidden&quot; name=&quot;id_base&quot; class=&quot;id_base&quot; value=&quot;&lt;?php echo esc_attr($id_base); ?&gt;&quot; /&gt;
</span><del>-        &lt;input type=&quot;hidden&quot; name=&quot;widget-width&quot; class=&quot;widget-width&quot; value=&quot;&lt;?php echo esc_attr($control['width']); ?&gt;&quot; /&gt;
-        &lt;input type=&quot;hidden&quot; name=&quot;widget-height&quot; class=&quot;widget-height&quot; value=&quot;&lt;?php echo esc_attr($control['height']); ?&gt;&quot; /&gt;
</del><ins>+        &lt;input type=&quot;hidden&quot; name=&quot;widget-width&quot; class=&quot;widget-width&quot; value=&quot;&lt;?php if (isset( $control['width'] )) echo esc_attr($control['width']); ?&gt;&quot; /&gt;
+        &lt;input type=&quot;hidden&quot; name=&quot;widget-height&quot; class=&quot;widget-height&quot; value=&quot;&lt;?php if (isset( $control['height'] )) echo esc_attr($control['height']); ?&gt;&quot; /&gt;
</ins><span class="cx">         &lt;input type=&quot;hidden&quot; name=&quot;widget_number&quot; class=&quot;widget_number&quot; value=&quot;&lt;?php echo esc_attr($widget_number); ?&gt;&quot; /&gt;
</span><span class="cx">         &lt;input type=&quot;hidden&quot; name=&quot;multi_number&quot; class=&quot;multi_number&quot; value=&quot;&lt;?php echo esc_attr($multi_number); ?&gt;&quot; /&gt;
</span><span class="cx">         &lt;input type=&quot;hidden&quot; name=&quot;add_new&quot; class=&quot;add_new&quot; value=&quot;&lt;?php echo esc_attr($add_new); ?&gt;&quot; /&gt;
</span></span></pre></div>
<a id="trunkwpadminuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/upload.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/upload.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-admin/upload.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -308,7 +308,7 @@
</span><span class="cx"> 
</span><span class="cx">         if ( $month_count &amp;&amp; !( 1 == $month_count &amp;&amp; 0 == $arc_result[0]-&gt;mmonth ) ) : ?&gt;
</span><span class="cx"> &lt;select name='m'&gt;
</span><del>-&lt;option&lt;?php selected( @$_GET['m'], 0 ); ?&gt; value='0'&gt;&lt;?php _e('Show all dates'); ?&gt;&lt;/option&gt;
</del><ins>+&lt;option value='0'&gt;&lt;?php _e('Show all dates'); ?&gt;&lt;/option&gt;
</ins><span class="cx"> &lt;?php
</span><span class="cx"> foreach ($arc_result as $arc_row) {
</span><span class="cx">         if ( $arc_row-&gt;yyear == 0 )
</span></span></pre></div>
<a id="trunkwpcommentspostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-comments-post.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-comments-post.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-comments-post.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -17,7 +17,7 @@
</span><span class="cx"> 
</span><span class="cx"> nocache_headers();
</span><span class="cx"> 
</span><del>-$comment_post_ID = (int) $_POST['comment_post_ID'];
</del><ins>+$comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0;
</ins><span class="cx"> 
</span><span class="cx"> $status = $wpdb-&gt;get_row( $wpdb-&gt;prepare(&quot;SELECT post_status, comment_status FROM $wpdb-&gt;posts WHERE ID = %d&quot;, $comment_post_ID) );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesauthortemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/author-template.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/author-template.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-includes/author-template.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  */
</span><span class="cx"> function get_the_author($deprecated = '') {
</span><span class="cx">         global $authordata;
</span><del>-        return apply_filters('the_author', $authordata-&gt;display_name);
</del><ins>+        return apply_filters('the_author', is_object($authordata) ? $authordata-&gt;display_name : null);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludescommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-includes/comment.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -1137,7 +1137,7 @@
</span><span class="cx">         else
</span><span class="cx">                 $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_id'];
</span><span class="cx"> 
</span><del>-        $commentdata['comment_parent'] = absint($commentdata['comment_parent']);
</del><ins>+        $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
</ins><span class="cx">         $parent_status = ( 0 &lt; $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
</span><span class="cx">         $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-includes/post.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -1941,6 +1941,8 @@
</span><span class="cx"> /**
</span><span class="cx">  * Given the desired slug and some post details computes a unique slug for the post.
</span><span class="cx">  *
</span><ins>+ * @global wpdb $wpdb 
+ * @global WP_Rewrite $wp_rewrite 
</ins><span class="cx">  * @param string $slug the desired slug (post_name)
</span><span class="cx">  * @param integer $post_ID
</span><span class="cx">  * @param string $post_status no uniqueness checks are made if the post is still draft or pending
</span><span class="lines">@@ -1953,13 +1955,18 @@
</span><span class="cx">                 return $slug;
</span><span class="cx"> 
</span><span class="cx">         global $wpdb, $wp_rewrite;
</span><ins>+
+        $feeds = $wp_rewrite-&gt;feeds;
+        if ( !is_array($feeds) )
+                $feeds = array();
+
</ins><span class="cx">         $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page'));
</span><span class="cx">         if ( 'attachment' == $post_type ) {
</span><span class="cx">                 // Attachment slugs must be unique across all types.
</span><span class="cx">                 $check_sql = &quot;SELECT post_name FROM $wpdb-&gt;posts WHERE post_name = %s AND ID != %d LIMIT 1&quot;;
</span><span class="cx">                 $post_name_check = $wpdb-&gt;get_var($wpdb-&gt;prepare($check_sql, $slug, $post_ID));
</span><span class="cx"> 
</span><del>-                if ( $post_name_check || in_array($slug, $wp_rewrite-&gt;feeds) ) {
</del><ins>+                if ( $post_name_check || in_array($slug, $feeds) ) {
</ins><span class="cx">                         $suffix = 2;
</span><span class="cx">                         do {
</span><span class="cx">                                 $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). &quot;-$suffix&quot;;
</span><span class="lines">@@ -1974,7 +1981,7 @@
</span><span class="cx">                 $check_sql = &quot;SELECT post_name FROM $wpdb-&gt;posts WHERE post_name = %s AND post_type IN ( '&quot; . implode(&quot;', '&quot;, esc_sql($hierarchical_post_types)) . &quot;' ) AND ID != %d AND post_parent = %d LIMIT 1&quot;;
</span><span class="cx">                 $post_name_check = $wpdb-&gt;get_var($wpdb-&gt;prepare($check_sql, $slug, $post_ID, $post_parent));
</span><span class="cx"> 
</span><del>-                if ( $post_name_check || in_array($slug, $wp_rewrite-&gt;feeds) ) {
</del><ins>+                if ( $post_name_check || in_array($slug, $feeds) ) {
</ins><span class="cx">                         $suffix = 2;
</span><span class="cx">                         do {
</span><span class="cx">                                 $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). &quot;-$suffix&quot;;
</span></span></pre></div>
<a id="trunkwpincludesvarsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/vars.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/vars.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-includes/vars.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -37,22 +37,24 @@
</span><span class="cx"> // Simple browser detection
</span><span class="cx"> $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;
</span><span class="cx"> 
</span><del>-if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
-        $is_lynx = true;
-} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) {
-        $is_chrome = true;
-} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) {
-        $is_safari = true;
-} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
-        $is_gecko = true;
-} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) {
-        $is_winIE = true;
-} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
-        $is_macIE = true;
-} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
-        $is_opera = true;
-} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) {
-        $is_NS4 = true;
</del><ins>+if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
+        if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
+                $is_lynx = true;
+        } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) {
+                $is_chrome = true;
+        } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) {
+                $is_safari = true;
+        } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) {
+                $is_gecko = true;
+        } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false ) {
+                $is_winIE = true;
+        } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false ) {
+                $is_macIE = true;
+        } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false ) {
+                $is_opera = true;
+        } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false ) {
+                $is_NS4 = true;
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if ( $is_safari &amp;&amp; strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false )
</span></span></pre></div>
<a id="trunkwptrackbackphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-trackback.php (12283 => 12284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-trackback.php        2009-11-26 08:13:31 UTC (rev 12283)
+++ trunk/wp-trackback.php        2009-11-26 11:29:54 UTC (rev 12284)
</span><span class="lines">@@ -36,18 +36,18 @@
</span><span class="cx"> // trackback is done by a POST
</span><span class="cx"> $request_array = 'HTTP_POST_VARS';
</span><span class="cx"> 
</span><del>-if ( !$_GET['tb_id'] ) {
</del><ins>+if ( !isset($_GET['tb_id']) || !$_GET['tb_id'] ) {
</ins><span class="cx">         $tb_id = explode('/', $_SERVER['REQUEST_URI']);
</span><span class="cx">         $tb_id = intval( $tb_id[ count($tb_id) - 1 ] );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-$tb_url  = $_POST['url'];
-$charset = $_POST['charset'];
</del><ins>+$tb_url  = isset($_POST['url'])     ? $_POST['url']     : '';
+$charset = isset($_POST['charset']) ? $_POST['charset'] : '';
</ins><span class="cx"> 
</span><span class="cx"> // These three are stripslashed here so that they can be properly escaped after mb_convert_encoding()
</span><del>-$title     = stripslashes($_POST['title']);
-$excerpt   = stripslashes($_POST['excerpt']);
-$blog_name = stripslashes($_POST['blog_name']);
</del><ins>+$title     = isset($_POST['title'])     ? stripslashes($_POST['title'])      : '';
+$excerpt   = isset($_POST['excerpt'])   ? stripslashes($_POST['excerpt'])    : '';
+$blog_name = isset($_POST['blog_name']) ? stripslashes($_POST['blog_name'])  : '';
</ins><span class="cx"> 
</span><span class="cx"> if ($charset)
</span><span class="cx">         $charset = str_replace( array(',', ' '), '', strtoupper( trim($charset) ) );
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> if ( is_single() || is_page() )
</span><span class="cx">         $tb_id = $posts[0]-&gt;ID;
</span><span class="cx"> 
</span><del>-if ( !intval( $tb_id ) )
</del><ins>+if ( !isset($tb_id) || !intval( $tb_id ) )
</ins><span class="cx">         trackback_response(1, 'I really need an ID for this to work.');
</span><span class="cx"> 
</span><span class="cx"> if (empty($title) &amp;&amp; empty($tb_url) &amp;&amp; empty($blog_name)) {
</span></span></pre>
</div>
</div>

</body>
</html>