Ticket #3148: patch.diff

File patch.diff, 3.4 KB (added by alexkingorg, 7 years ago)

patch

Line 
1Index: wp-includes/category.php
2===================================================================
3--- wp-includes/category.php    (revision 4197)
4+++ wp-includes/category.php    (working copy)
5@@ -20,7 +20,7 @@
6                parse_str($args, $r);
7 
8        $defaults = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC',
9-               'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, $exclude => '', $include => '',
10+               'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, 'exclude' => '', 'include' => '',
11                'number' => '');
12        $r = array_merge($defaults, $r);
13        if ( 'count' == $r['orderby'] )
14Index: wp-includes/post.php
15===================================================================
16--- wp-includes/post.php        (revision 4197)
17+++ wp-includes/post.php        (working copy)
18@@ -99,7 +99,7 @@
19                }
20        }
21 
22-       if ( defined(WP_IMPORTING) )
23+       if ( defined('WP_IMPORTING') )
24                unset($post_cache);
25 
26        if ( $output == OBJECT ) {
27@@ -923,12 +923,12 @@
28                wp_cache_add($page->ID, $page, 'pages');
29                $_page = $page;
30        } else {
31-               if ( isset($GLOBALS['page']) && ($page == $GLOBALS['page']->ID) ) {
32+               if ( isset($GLOBALS['page']->ID) && ($page == $GLOBALS['page']->ID) ) {
33                        $_page = & $GLOBALS['page'];
34                        wp_cache_add($_page->ID, $_page, 'pages');
35-               } elseif ( $_page = $GLOBALS['post_cache'][$page] ) {
36+               } elseif ( isset($_page) && $_page == $GLOBALS['post_cache'][$page] ) {
37                        return get_post($page, $output);
38-               } elseif ( $_page = wp_cache_get($page, 'pages') ) {
39+               } elseif ( isset($_page) && $_page == wp_cache_get($page, 'pages') ) {
40                        // Got it.
41                } else {
42                        $query = "SELECT * FROM $wpdb->posts WHERE ID= '$page' LIMIT 1";
43Index: wp-includes/classes.php
44===================================================================
45--- wp-includes/classes.php     (revision 4197)
46+++ wp-includes/classes.php     (working copy)
47@@ -388,13 +388,13 @@
48                        // If flat, start and end the element and skip the level checks.
49                        if ( $flat) {
50                                // Start the element.
51-                               if ( $element->$id_field != 0 ) {
52+                               if ( isset($element->$id_field) && $element->$id_field != 0 ) {
53                                        $cb_args = array_merge( array($output, $element, $depth - 1), $args);
54                                        $output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
55                                }
56       
57                                // End the element.
58-                               if ( $element->$id_field != 0 ) {
59+                               if ( isset($element->$id_field) && $element->$id_field != 0 ) {
60                                        $cb_args = array_merge( array($output, $element, $depth - 1), $args);
61                                        $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
62                                }
63@@ -583,10 +583,10 @@
64                                $link .= ')';
65                }
66       
67-               if ( $show_count )
68+               if ( isset($show_count) && $show_count )
69                        $link .= ' ('.intval($category->category_count).')';
70       
71-               if ( $show_date ) {
72+               if ( isset($show_date) && $show_date ) {
73                        $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
74                }
75       
76Index: wp-includes/category-template.php
77===================================================================
78--- wp-includes/category-template.php   (revision 4197)
79+++ wp-includes/category-template.php   (working copy)
80@@ -219,7 +219,8 @@
81                'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '',
82                'hierarchical' => true, 'title_li' => __('Categories'));
83        $r = array_merge($defaults, $r);
84-       $r['include_last_update_time'] = $r['show_date'];
85+       if ( isset($r['show_date']) )
86+               $r['include_last_update_time'] = $r['show_date'];
87        extract($r);
88 
89        $categories = get_categories($r);