Ticket #18975: 18975.diff

File 18975.diff, 15.5 KB (added by ryan, 19 months ago)
Line 
1Index: wp-includes/post-template.php
2===================================================================
3--- wp-includes/post-template.php       (revision 19071)
4+++ wp-includes/post-template.php       (working copy)
5@@ -995,7 +995,7 @@
6         * @param string $output Passed by reference. Used to append additional content.
7         * @param int $depth Depth of page. Used for padding.
8         */
9-       function start_lvl(&$output, $depth) {
10+       function start_lvl( &$output, $depth = 0, $args = array() ) {
11                $indent = str_repeat("\t", $depth);
12                $output .= "\n$indent<ul class='children'>\n";
13        }
14@@ -1007,7 +1007,7 @@
15         * @param string $output Passed by reference. Used to append additional content.
16         * @param int $depth Depth of page. Used for padding.
17         */
18-       function end_lvl(&$output, $depth) {
19+       function end_lvl( &$output, $depth = 0, $args = array() ) {
20                $indent = str_repeat("\t", $depth);
21                $output .= "$indent</ul>\n";
22        }
23@@ -1022,7 +1022,7 @@
24         * @param int $current_page Page ID.
25         * @param array $args
26         */
27-       function start_el(&$output, $page, $depth, $args, $current_page) {
28+       function start_el( &$output, $page, $depth, $args, $current_page = 0 ) {
29                if ( $depth )
30                        $indent = str_repeat("\t", $depth);
31                else
32@@ -1065,7 +1065,7 @@
33         * @param object $page Page data object. Not used.
34         * @param int $depth Depth of page. Not Used.
35         */
36-       function end_el(&$output, $page, $depth) {
37+       function end_el( &$output, $page, $depth = 0, $args = array() ) {
38                $output .= "</li>\n";
39        }
40 
41@@ -1103,7 +1103,7 @@
42         * @param int $depth Depth of page in reference to parent pages. Used for padding.
43         * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
44         */
45-       function start_el(&$output, $page, $depth, $args) {
46+       function start_el(&$output, $page, $depth, $args, $id = 0) {
47                $pad = str_repeat('&nbsp;', $depth * 3);
48 
49                $output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
50Index: wp-includes/nav-menu-template.php
51===================================================================
52--- wp-includes/nav-menu-template.php   (revision 19071)
53+++ wp-includes/nav-menu-template.php   (working copy)
54@@ -37,7 +37,7 @@
55         * @param string $output Passed by reference. Used to append additional content.
56         * @param int $depth Depth of page. Used for padding.
57         */
58-       function start_lvl(&$output, $depth) {
59+       function start_lvl( &$output, $depth = 0, $args = array() ) {
60                $indent = str_repeat("\t", $depth);
61                $output .= "\n$indent<ul class=\"sub-menu\">\n";
62        }
63@@ -49,7 +49,7 @@
64         * @param string $output Passed by reference. Used to append additional content.
65         * @param int $depth Depth of page. Used for padding.
66         */
67-       function end_lvl(&$output, $depth) {
68+       function end_lvl( &$output, $depth = 0, $args = array() ) {
69                $indent = str_repeat("\t", $depth);
70                $output .= "$indent</ul>\n";
71        }
72@@ -64,7 +64,7 @@
73         * @param int $current_page Menu item ID.
74         * @param object $args
75         */
76-       function start_el(&$output, $item, $depth, $args) {
77+       function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
78                global $wp_query;
79                $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
80 
81@@ -103,7 +103,7 @@
82         * @param object $item Page data object. Not used.
83         * @param int $depth Depth of page. Not Used.
84         */
85-       function end_el(&$output, $item, $depth) {
86+       function end_el( &$output, $item, $depth = 0, $args = array() ) {
87                $output .= "</li>\n";
88        }
89 }
90Index: wp-includes/class-http.php
91===================================================================
92--- wp-includes/class-http.php  (revision 19071)
93+++ wp-includes/class-http.php  (working copy)
94@@ -346,7 +346,7 @@
95         * @return array Processed string headers. If duplicate headers are encountered,
96         *                                      Then a numbered array is returned as the value of that header-key.
97         */
98-       function processHeaders($headers) {
99+       public static function processHeaders($headers) {
100                // split headers, one per array element
101                if ( is_string($headers) ) {
102                        // tolerate line terminator: CRLF = LF (RFC 2616 19.3)
103@@ -413,7 +413,7 @@
104         *
105         * @param array $r Full array of args passed into ::request()
106         */
107-       function buildCookieHeader( &$r ) {
108+       public static function buildCookieHeader( &$r ) {
109                if ( ! empty($r['cookies']) ) {
110                        $cookies_header = '';
111                        foreach ( (array) $r['cookies'] as $cookie ) {
112@@ -756,7 +756,7 @@
113         * @static
114         * @return boolean False means this class can not be used, true means it can.
115         */
116-       function test( $args = array() ) {
117+       public static function test( $args = array() ) {
118                if ( ! function_exists( 'fsockopen' ) )
119                        return false;
120 
121@@ -939,7 +939,7 @@
122         *
123         * @return boolean False means this class can not be used, true means it can.
124         */
125-       function test( $args = array() ) {
126+       public static function test( $args = array() ) {
127                if ( ! function_exists( 'fopen' ) )
128                        return false;
129 
130@@ -1166,7 +1166,7 @@
131         *
132         * @return boolean False means this class can not be used, true means it can.
133         */
134-       function test( $args = array() ) {
135+       public static function test( $args = array() ) {
136                if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) )
137                        return false;
138 
139@@ -1580,7 +1580,7 @@
140         * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
141         * @return string|bool False on failure.
142         */
143-       function compress( $raw, $level = 9, $supports = null ) {
144+       public static function compress( $raw, $level = 9, $supports = null ) {
145                return gzdeflate( $raw, $level );
146        }
147 
148@@ -1598,7 +1598,7 @@
149         * @param int $length The optional length of the compressed data.
150         * @return string|bool False on failure.
151         */
152-       function decompress( $compressed, $length = null ) {
153+       public static function decompress( $compressed, $length = null ) {
154 
155                if ( empty($compressed) )
156                        return $compressed;
157@@ -1642,7 +1642,7 @@
158         * @param string $gzData String to decompress.
159         * @return string|bool False on failure.
160         */
161-       function compatible_gzinflate($gzData) {
162+       public static function compatible_gzinflate($gzData) {
163 
164                // Compressed data might contain a full header, if so strip it for gzinflate()
165                if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
166@@ -1680,7 +1680,7 @@
167         *
168         * @return string Types of encoding to accept.
169         */
170-       function accept_encoding() {
171+       public static function accept_encoding() {
172                $type = array();
173                if ( function_exists( 'gzinflate' ) )
174                        $type[] = 'deflate;q=1.0';
175@@ -1701,7 +1701,7 @@
176         *
177         * @return string Content-Encoding string to send in the header.
178         */
179-       function content_encoding() {
180+       public static function content_encoding() {
181                return 'deflate';
182        }
183 
184@@ -1713,7 +1713,7 @@
185         * @param array|string $headers All of the available headers.
186         * @return bool
187         */
188-       function should_decode($headers) {
189+       public static function should_decode($headers) {
190                if ( is_array( $headers ) ) {
191                        if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
192                                return true;
193@@ -1735,7 +1735,7 @@
194         *
195         * @return bool
196         */
197-       function is_available() {
198+       public static function is_available() {
199                return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') );
200        }
201 }
202Index: wp-includes/post.php
203===================================================================
204--- wp-includes/post.php        (revision 19071)
205+++ wp-includes/post.php        (working copy)
206@@ -4033,7 +4033,8 @@
207                        $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) );
208                        $icon_files = array();
209                        while ( $dirs ) {
210-                               $dir = array_shift($keys = array_keys($dirs));
211+                               $keys = array_keys( $dirs );
212+                               $dir = array_shift( $keys );
213                                $uri = array_shift($dirs);
214                                if ( $dh = opendir($dir) ) {
215                                        while ( false !== $file = readdir($dh) ) {
216Index: wp-includes/comment-template.php
217===================================================================
218--- wp-includes/comment-template.php    (revision 19071)
219+++ wp-includes/comment-template.php    (working copy)
220@@ -1238,7 +1238,7 @@
221         * @param int $depth Depth of comment.
222         * @param array $args Uses 'style' argument for type of HTML list.
223         */
224-       function start_lvl(&$output, $depth, $args) {
225+       function start_lvl( &$output, $depth = 0, $args = array() ) {
226                $GLOBALS['comment_depth'] = $depth + 1;
227 
228                switch ( $args['style'] ) {
229@@ -1262,7 +1262,7 @@
230         * @param int $depth Depth of comment.
231         * @param array $args Will only append content if style argument value is 'ol' or 'ul'.
232         */
233-       function end_lvl(&$output, $depth, $args) {
234+       function end_lvl( &$output, $depth = 0, $args = array() ) {
235                $GLOBALS['comment_depth'] = $depth + 1;
236 
237                switch ( $args['style'] ) {
238@@ -1326,7 +1326,7 @@
239         * @param int $depth Depth of comment in reference to parents.
240         * @param array $args
241         */
242-       function start_el(&$output, $comment, $depth, $args) {
243+       function start_el( &$output, $comment, $depth, $args, $id = 0 ) {
244                $depth++;
245                $GLOBALS['comment_depth'] = $depth;
246 
247@@ -1386,7 +1386,7 @@
248         * @param int $depth Depth of comment.
249         * @param array $args
250         */
251-       function end_el(&$output, $comment, $depth, $args) {
252+       function end_el(&$output, $comment, $depth = 0, $args = array() ) {
253                if ( !empty($args['end-callback']) ) {
254                        call_user_func($args['end-callback'], $comment, $args, $depth);
255                        return;
256Index: wp-includes/class-wp-walker.php
257===================================================================
258--- wp-includes/class-wp-walker.php     (revision 19071)
259+++ wp-includes/class-wp-walker.php     (working copy)
260@@ -52,7 +52,7 @@
261         *
262         * @param string $output Passed by reference. Used to append additional content.
263         */
264-       function start_lvl(&$output) {}
265+       function start_lvl( &$output, $depth = 0, $args = array() ) {}
266 
267        /**
268         * Ends the list of after the elements are added.
269@@ -66,7 +66,7 @@
270         *
271         * @param string $output Passed by reference. Used to append additional content.
272         */
273-       function end_lvl(&$output)   {}
274+       function end_lvl( &$output, $depth = 0, $args = array() )   {}
275 
276        /**
277         * Start the element output.
278@@ -80,7 +80,7 @@
279         *
280         * @param string $output Passed by reference. Used to append additional content.
281         */
282-       function start_el(&$output)  {}
283+       function start_el( &$output, $object, $depth, $args, $current_object_id = 0 )  {}
284 
285        /**
286         * Ends the element output, if needed.
287@@ -93,7 +93,7 @@
288         *
289         * @param string $output Passed by reference. Used to append additional content.
290         */
291-       function end_el(&$output)    {}
292+       function end_el( &$output, $object, $depth = 0, $args = array() )    {}
293 
294        /**
295         * Traverse elements to create list from elements.
296Index: wp-includes/general-template.php
297===================================================================
298--- wp-includes/general-template.php    (revision 19071)
299+++ wp-includes/general-template.php    (working copy)
300@@ -1621,7 +1621,8 @@
301        $args = wp_parse_args( $args, $defaults );
302 
303        if ( is_single() || is_page() ) {
304-               $post = &get_post( $id = 0 );
305+               $id = 0;
306+               $post = &get_post( $id );
307 
308                if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
309                        $title = esc_attr(sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ));
310Index: wp-includes/class-wp.php
311===================================================================
312--- wp-includes/class-wp.php    (revision 19071)
313+++ wp-includes/class-wp.php    (working copy)
314@@ -572,7 +572,7 @@
315         * @param array  $matches data used for substitution
316         * @return string
317         */
318-       function apply($subject, $matches) {
319+       public static function apply($subject, $matches) {
320                $oSelf = new WP_MatchesMapRegex($subject, $matches);
321                return $oSelf->output;
322        }
323Index: wp-includes/ms-load.php
324===================================================================
325--- wp-includes/ms-load.php     (revision 19071)
326+++ wp-includes/ms-load.php     (working copy)
327@@ -134,6 +134,10 @@
328  */
329 function wpmu_current_site() {
330        global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
331+
332+       if ( empty( $current_site ) )
333+               $current_site = new stdClass;
334+
335        if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
336                $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
337                $current_site->domain = DOMAIN_CURRENT_SITE;
338Index: wp-includes/category-template.php
339===================================================================
340--- wp-includes/category-template.php   (revision 19071)
341+++ wp-includes/category-template.php   (working copy)
342@@ -794,7 +794,7 @@
343         * @param int $depth Depth of category. Used for tab indentation.
344         * @param array $args Will only append content if style argument value is 'list'.
345         */
346-       function start_lvl(&$output, $depth, $args) {
347+       function start_lvl( &$output, $depth = 0, $args = array() ) {
348                if ( 'list' != $args['style'] )
349                        return;
350 
351@@ -810,7 +810,7 @@
352         * @param int $depth Depth of category. Used for tab indentation.
353         * @param array $args Will only append content if style argument value is 'list'.
354         */
355-       function end_lvl(&$output, $depth, $args) {
356+       function end_lvl( &$output, $depth = 0, $args = array() ) {
357                if ( 'list' != $args['style'] )
358                        return;
359 
360@@ -827,7 +827,7 @@
361         * @param int $depth Depth of category in reference to parents.
362         * @param array $args
363         */
364-       function start_el(&$output, $category, $depth, $args) {
365+       function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
366                extract($args);
367 
368                $cat_name = esc_attr( $category->name );
369@@ -902,7 +902,7 @@
370         * @param int $depth Depth of category. Not used.
371         * @param array $args Only uses 'list' for whether should append to output.
372         */
373-       function end_el(&$output, $page, $depth, $args) {
374+       function end_el( &$output, $page, $depth = 0, $args = array() ) {
375                if ( 'list' != $args['style'] )
376                        return;
377 
378@@ -943,7 +943,7 @@
379         * @param int $depth Depth of category. Used for padding.
380         * @param array $args Uses 'selected', 'show_count', and 'show_last_update' keys, if they exist.
381         */
382-       function start_el(&$output, $category, $depth, $args) {
383+       function start_el( &$output, $category, $depth, $args, $id = 0 ) {
384                $pad = str_repeat('&nbsp;', $depth * 3);
385 
386                $cat_name = apply_filters('list_cats', $category->name, $category);
387Index: wp-admin/includes/template.php
388===================================================================
389--- wp-admin/includes/template.php      (revision 19071)
390+++ wp-admin/includes/template.php      (working copy)
391@@ -22,17 +22,17 @@
392        var $tree_type = 'category';
393        var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
394 
395-       function start_lvl(&$output, $depth, $args) {
396+       function start_lvl( &$output, $depth = 0, $args = array() ) {
397                $indent = str_repeat("\t", $depth);
398                $output .= "$indent<ul class='children'>\n";
399        }
400 
401-       function end_lvl(&$output, $depth, $args) {
402+       function end_lvl( &$output, $depth = 0, $args = array() ) {
403                $indent = str_repeat("\t", $depth);
404                $output .= "$indent</ul>\n";
405        }
406 
407-       function start_el(&$output, $category, $depth, $args) {
408+       function start_el( &$output, $category, $depth, $args, $id = 0 ) {
409                extract($args);
410                if ( empty($taxonomy) )
411                        $taxonomy = 'category';
412@@ -46,7 +46,7 @@
413                $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
414        }
415 
416-       function end_el(&$output, $category, $depth, $args) {
417+       function end_el( &$output, $category, $depth = 0, $args = array() ) {
418                $output .= "</li>\n";
419        }
420 }