<!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>[16099] trunk: Begin the dissolution of classes.php.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16099">16099</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-10-30 07:02:06 +0000 (Sat, 30 Oct 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Begin the dissolution of classes.php. see <a href="http://trac.wordpress.org/ticket/10287">#10287</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminsetupconfigphp">trunk/wp-admin/setup-config.php</a></li>
<li><a href="#trunkwpincludesclassesphp">trunk/wp-includes/classes.php</a></li>
<li><a href="#trunkwploadphp">trunk/wp-load.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasswpajaxresponsephp">trunk/wp-includes/class-wp-ajax-response.php</a></li>
<li><a href="#trunkwpincludesclasswperrorphp">trunk/wp-includes/class-wp-error.php</a></li>
<li><a href="#trunkwpincludesclasswpwalkerphp">trunk/wp-includes/class-wp-walker.php</a></li>
<li><a href="#trunkwpincludesclasswpphp">trunk/wp-includes/class-wp.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminsetupconfigphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/setup-config.php (16098 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/setup-config.php        2010-10-30 06:40:04 UTC (rev 16098)
+++ trunk/wp-admin/setup-config.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> require_once(ABSPATH . WPINC . '/load.php');
</span><span class="cx"> require_once(ABSPATH . WPINC . '/compat.php');
</span><span class="cx"> require_once(ABSPATH . WPINC . '/functions.php');
</span><del>-require_once(ABSPATH . WPINC . '/classes.php');
</del><ins>+require_once(ABSPATH . WPINC . '/class-wp-error.php');
</ins><span class="cx"> require_once(ABSPATH . WPINC . '/version.php');
</span><span class="cx"> 
</span><span class="cx"> if (!file_exists(ABSPATH . 'wp-config-sample.php'))
</span></span></pre></div>
<a id="trunkwpincludesclasswpajaxresponsephpfromrev16091trunkwpincludesclassesphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-includes/class-wp-ajax-response.php (from rev 16091, trunk/wp-includes/classes.php) (0 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-ajax-response.php                                (rev 0)
+++ trunk/wp-includes/class-wp-ajax-response.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -0,0 +1,149 @@
</span><ins>+&lt;?php
+/**
+ * Holds Most of the WordPress classes.
+ *
+ * Some of the other classes are contained in other files. For example, the
+ * WordPress cache is in cache.php and the WordPress roles API is in
+ * capabilities.php. The third party libraries are contained in their own
+ * separate files.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Send XML response back to AJAX request.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
+class WP_Ajax_Response {
+        /**
+         * Store XML responses to send.
+         *
+         * @since 2.1.0
+         * @var array
+         * @access private
+         */
+        var $responses = array();
+
+        /**
+         * PHP4 Constructor - Passes args to {@link WP_Ajax_Response::add()}.
+         *
+         * @since 2.1.0
+         * @see WP_Ajax_Response::add()
+         *
+         * @param string|array $args Optional. Will be passed to add() method.
+         * @return WP_Ajax_Response
+         */
+        function WP_Ajax_Response( $args = '' ) {
+                if ( !empty($args) )
+                        $this-&gt;add($args);
+        }
+
+        /**
+         * Append to XML response based on given arguments.
+         *
+         * The arguments that can be passed in the $args parameter are below. It is
+         * also possible to pass a WP_Error object in either the 'id' or 'data'
+         * argument. The parameter isn't actually optional, content should be given
+         * in order to send the correct response.
+         *
+         * 'what' argument is a string that is the XMLRPC response type.
+         * 'action' argument is a boolean or string that acts like a nonce.
+         * 'id' argument can be WP_Error or an integer.
+         * 'old_id' argument is false by default or an integer of the previous ID.
+         * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
+         * html ID = after, -html ID = before.
+         * 'data' argument is a string with the content or message.
+         * 'supplemental' argument is an array of strings that will be children of
+         * the supplemental element.
+         *
+         * @since 2.1.0
+         *
+         * @param string|array $args Override defaults.
+         * @return string XML response.
+         */
+        function add( $args = '' ) {
+                $defaults = array(
+                        'what' =&gt; 'object', 'action' =&gt; false,
+                        'id' =&gt; '0', 'old_id' =&gt; false,
+                        'position' =&gt; 1,
+                        'data' =&gt; '', 'supplemental' =&gt; array()
+                );
+
+                $r = wp_parse_args( $args, $defaults );
+                extract( $r, EXTR_SKIP );
+                $position = preg_replace( '/[^a-z0-9:_-]/i', '', $position );
+
+                if ( is_wp_error($id) ) {
+                        $data = $id;
+                        $id = 0;
+                }
+
+                $response = '';
+                if ( is_wp_error($data) ) {
+                        foreach ( (array) $data-&gt;get_error_codes() as $code ) {
+                                $response .= &quot;&lt;wp_error code='$code'&gt;&lt;![CDATA[&quot; . $data-&gt;get_error_message($code) . &quot;]]&gt;&lt;/wp_error&gt;&quot;;
+                                if ( !$error_data = $data-&gt;get_error_data($code) )
+                                        continue;
+                                $class = '';
+                                if ( is_object($error_data) ) {
+                                        $class = ' class=&quot;' . get_class($error_data) . '&quot;';
+                                        $error_data = get_object_vars($error_data);
+                                }
+
+                                $response .= &quot;&lt;wp_error_data code='$code'$class&gt;&quot;;
+
+                                if ( is_scalar($error_data) ) {
+                                        $response .= &quot;&lt;![CDATA[$error_data]]&gt;&quot;;
+                                } elseif ( is_array($error_data) ) {
+                                        foreach ( $error_data as $k =&gt; $v )
+                                                $response .= &quot;&lt;$k&gt;&lt;![CDATA[$v]]&gt;&lt;/$k&gt;&quot;;
+                                }
+
+                                $response .= &quot;&lt;/wp_error_data&gt;&quot;;
+                        }
+                } else {
+                        $response = &quot;&lt;response_data&gt;&lt;![CDATA[$data]]&gt;&lt;/response_data&gt;&quot;;
+                }
+
+                $s = '';
+                if ( is_array($supplemental) ) {
+                        foreach ( $supplemental as $k =&gt; $v )
+                                $s .= &quot;&lt;$k&gt;&lt;![CDATA[$v]]&gt;&lt;/$k&gt;&quot;;
+                        $s = &quot;&lt;supplemental&gt;$s&lt;/supplemental&gt;&quot;;
+                }
+
+                if ( false === $action )
+                        $action = $_POST['action'];
+
+                $x = '';
+                $x .= &quot;&lt;response action='{$action}_$id'&gt;&quot;; // The action attribute in the xml output is formatted like a nonce action
+                $x .=        &quot;&lt;$what id='$id' &quot; . ( false === $old_id ? '' : &quot;old_id='$old_id' &quot; ) . &quot;position='$position'&gt;&quot;;
+                $x .=                $response;
+                $x .=                $s;
+                $x .=        &quot;&lt;/$what&gt;&quot;;
+                $x .= &quot;&lt;/response&gt;&quot;;
+
+                $this-&gt;responses[] = $x;
+                return $x;
+        }
+
+        /**
+         * Display XML formatted responses.
+         *
+         * Sets the content type header to text/xml.
+         *
+         * @since 2.1.0
+         */
+        function send() {
+                header('Content-Type: text/xml');
+                echo &quot;&lt;?xml version='1.0' standalone='yes'?&gt;&lt;wp_ajax&gt;&quot;;
+                foreach ( (array) $this-&gt;responses as $response )
+                        echo $response;
+                echo '&lt;/wp_ajax&gt;';
+                die();
+        }
+}
+
+?&gt;
</ins></span></pre></div>
<a id="trunkwpincludesclasswperrorphpfromrev16091trunkwpincludesclassesphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-includes/class-wp-error.php (from rev 16091, trunk/wp-includes/classes.php) (0 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-error.php                                (rev 0)
+++ trunk/wp-includes/class-wp-error.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -0,0 +1,215 @@
</span><ins>+&lt;?php
+/**
+ * Holds Most of the WordPress classes.
+ *
+ * Some of the other classes are contained in other files. For example, the
+ * WordPress cache is in cache.php and the WordPress roles API is in
+ * capabilities.php. The third party libraries are contained in their own
+ * separate files.
+ *
+ * @package WordPress
+ */
+
+/**
+ * WordPress Error class.
+ *
+ * Container for checking for WordPress errors and error messages. Return
+ * WP_Error and use {@link is_wp_error()} to check if this class is returned.
+ * Many core WordPress functions pass this class in the event of an error and
+ * if not handled properly will result in code errors.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
+class WP_Error {
+        /**
+         * Stores the list of errors.
+         *
+         * @since 2.1.0
+         * @var array
+         * @access private
+         */
+        var $errors = array();
+
+        /**
+         * Stores the list of data for error codes.
+         *
+         * @since 2.1.0
+         * @var array
+         * @access private
+         */
+        var $error_data = array();
+
+        /**
+         * PHP4 Constructor - Sets up error message.
+         *
+         * If code parameter is empty then nothing will be done. It is possible to
+         * add multiple messages to the same code, but with other methods in the
+         * class.
+         *
+         * All parameters are optional, but if the code parameter is set, then the
+         * data parameter is optional.
+         *
+         * @since 2.1.0
+         *
+         * @param string|int $code Error code
+         * @param string $message Error message
+         * @param mixed $data Optional. Error data.
+         * @return WP_Error
+         */
+        function WP_Error($code = '', $message = '', $data = '') {
+                if ( empty($code) )
+                        return;
+
+                $this-&gt;errors[$code][] = $message;
+
+                if ( ! empty($data) )
+                        $this-&gt;error_data[$code] = $data;
+        }
+
+        /**
+         * Retrieve all error codes.
+         *
+         * @since 2.1.0
+         * @access public
+         *
+         * @return array List of error codes, if avaiable.
+         */
+        function get_error_codes() {
+                if ( empty($this-&gt;errors) )
+                        return array();
+
+                return array_keys($this-&gt;errors);
+        }
+
+        /**
+         * Retrieve first error code available.
+         *
+         * @since 2.1.0
+         * @access public
+         *
+         * @return string|int Empty string, if no error codes.
+         */
+        function get_error_code() {
+                $codes = $this-&gt;get_error_codes();
+
+                if ( empty($codes) )
+                        return '';
+
+                return $codes[0];
+        }
+
+        /**
+         * Retrieve all error messages or error messages matching code.
+         *
+         * @since 2.1.0
+         *
+         * @param string|int $code Optional. Retrieve messages matching code, if exists.
+         * @return array Error strings on success, or empty array on failure (if using codee parameter).
+         */
+        function get_error_messages($code = '') {
+                // Return all messages if no code specified.
+                if ( empty($code) ) {
+                        $all_messages = array();
+                        foreach ( (array) $this-&gt;errors as $code =&gt; $messages )
+                                $all_messages = array_merge($all_messages, $messages);
+
+                        return $all_messages;
+                }
+
+                if ( isset($this-&gt;errors[$code]) )
+                        return $this-&gt;errors[$code];
+                else
+                        return array();
+        }
+
+        /**
+         * Get single error message.
+         *
+         * This will get the first message available for the code. If no code is
+         * given then the first code available will be used.
+         *
+         * @since 2.1.0
+         *
+         * @param string|int $code Optional. Error code to retrieve message.
+         * @return string
+         */
+        function get_error_message($code = '') {
+                if ( empty($code) )
+                        $code = $this-&gt;get_error_code();
+                $messages = $this-&gt;get_error_messages($code);
+                if ( empty($messages) )
+                        return '';
+                return $messages[0];
+        }
+
+        /**
+         * Retrieve error data for error code.
+         *
+         * @since 2.1.0
+         *
+         * @param string|int $code Optional. Error code.
+         * @return mixed Null, if no errors.
+         */
+        function get_error_data($code = '') {
+                if ( empty($code) )
+                        $code = $this-&gt;get_error_code();
+
+                if ( isset($this-&gt;error_data[$code]) )
+                        return $this-&gt;error_data[$code];
+                return null;
+        }
+
+        /**
+         * Append more error messages to list of error messages.
+         *
+         * @since 2.1.0
+         * @access public
+         *
+         * @param string|int $code Error code.
+         * @param string $message Error message.
+         * @param mixed $data Optional. Error data.
+         */
+        function add($code, $message, $data = '') {
+                $this-&gt;errors[$code][] = $message;
+                if ( ! empty($data) )
+                        $this-&gt;error_data[$code] = $data;
+        }
+
+        /**
+         * Add data for error code.
+         *
+         * The error code can only contain one error data.
+         *
+         * @since 2.1.0
+         *
+         * @param mixed $data Error data.
+         * @param string|int $code Error code.
+         */
+        function add_data($data, $code = '') {
+                if ( empty($code) )
+                        $code = $this-&gt;get_error_code();
+
+                $this-&gt;error_data[$code] = $data;
+        }
+}
+
+/**
+ * Check whether variable is a WordPress Error.
+ *
+ * Looks at the object and if a WP_Error class. Does not check to see if the
+ * parent is also WP_Error, so can't inherit WP_Error and still use this
+ * function.
+ *
+ * @since 2.1.0
+ *
+ * @param mixed $thing Check if unknown variable is WordPress Error object.
+ * @return bool True, if WP_Error. False, if not WP_Error.
+ */
+function is_wp_error($thing) {
+        if ( is_object($thing) &amp;&amp; is_a($thing, 'WP_Error') )
+                return true;
+        return false;
+}
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesclasswpwalkerphpfromrev16091trunkwpincludesclassesphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-includes/class-wp-walker.php (from rev 16091, trunk/wp-includes/classes.php) (0 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-walker.php                                (rev 0)
+++ trunk/wp-includes/class-wp-walker.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -0,0 +1,410 @@
</span><ins>+&lt;?php
+/**
+ * Holds Most of the WordPress classes.
+ *
+ * Some of the other classes are contained in other files. For example, the
+ * WordPress cache is in cache.php and the WordPress roles API is in
+ * capabilities.php. The third party libraries are contained in their own
+ * separate files.
+ *
+ * @package WordPress
+ */
+
+/**
+ * A class for displaying various tree-like structures.
+ *
+ * Extend the Walker class to use it, see examples at the below. Child classes
+ * do not need to implement all of the abstract methods in the class. The child
+ * only needs to implement the methods that are needed. Also, the methods are
+ * not strictly abstract in that the parameter definition needs to be followed.
+ * The child classes can have additional parameters.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @abstract
+ */
+class Walker {
+        /**
+         * What the class handles.
+         *
+         * @since 2.1.0
+         * @var string
+         * @access public
+         */
+        var $tree_type;
+
+        /**
+         * DB fields to use.
+         *
+         * @since 2.1.0
+         * @var array
+         * @access protected
+         */
+        var $db_fields;
+
+        /**
+         * Max number of pages walked by the paged walker
+         *
+         * @since 2.7.0
+         * @var int
+         * @access protected
+         */
+        var $max_pages = 1;
+
+        /**
+         * Starts the list before the elements are added.
+         *
+         * Additional parameters are used in child classes. The args parameter holds
+         * additional values that may be used with the child class methods. This
+         * method is called at the start of the output list.
+         *
+         * @since 2.1.0
+         * @abstract
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         */
+        function start_lvl(&amp;$output) {}
+
+        /**
+         * Ends the list of after the elements are added.
+         *
+         * Additional parameters are used in child classes. The args parameter holds
+         * additional values that may be used with the child class methods. This
+         * method finishes the list at the end of output of the elements.
+         *
+         * @since 2.1.0
+         * @abstract
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         */
+        function end_lvl(&amp;$output)   {}
+
+        /**
+         * Start the element output.
+         *
+         * Additional parameters are used in child classes. The args parameter holds
+         * additional values that may be used with the child class methods. Includes
+         * the element output also.
+         *
+         * @since 2.1.0
+         * @abstract
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         */
+        function start_el(&amp;$output)  {}
+
+        /**
+         * Ends the element output, if needed.
+         *
+         * Additional parameters are used in child classes. The args parameter holds
+         * additional values that may be used with the child class methods.
+         *
+         * @since 2.1.0
+         * @abstract
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         */
+        function end_el(&amp;$output)    {}
+
+        /**
+         * Traverse elements to create list from elements.
+         *
+         * Display one element if the element doesn't have any children otherwise,
+         * display the element and its children. Will only traverse up to the max
+         * depth and no ignore elements under that depth. It is possible to set the
+         * max depth to include all depths, see walk() method.
+         *
+         * This method shouldn't be called directly, use the walk() method instead.
+         *
+         * @since 2.5.0
+         *
+         * @param object $element Data object
+         * @param array $children_elements List of elements to continue traversing.
+         * @param int $max_depth Max depth to traverse.
+         * @param int $depth Depth of current element.
+         * @param array $args
+         * @param string $output Passed by reference. Used to append additional content.
+         * @return null Null on failure with no changes to parameters.
+         */
+        function display_element( $element, &amp;$children_elements, $max_depth, $depth=0, $args, &amp;$output ) {
+
+                if ( !$element )
+                        return;
+
+                $id_field = $this-&gt;db_fields['id'];
+
+                //display this element
+                if ( is_array( $args[0] ) )
+                        $args[0]['has_children'] = ! empty( $children_elements[$element-&gt;$id_field] );
+                $cb_args = array_merge( array(&amp;$output, $element, $depth), $args);
+                call_user_func_array(array(&amp;$this, 'start_el'), $cb_args);
+
+                $id = $element-&gt;$id_field;
+
+                // descend only when the depth is right and there are childrens for this element
+                if ( ($max_depth == 0 || $max_depth &gt; $depth+1 ) &amp;&amp; isset( $children_elements[$id]) ) {
+
+                        foreach( $children_elements[ $id ] as $child ){
+
+                                if ( !isset($newlevel) ) {
+                                        $newlevel = true;
+                                        //start the child delimiter
+                                        $cb_args = array_merge( array(&amp;$output, $depth), $args);
+                                        call_user_func_array(array(&amp;$this, 'start_lvl'), $cb_args);
+                                }
+                                $this-&gt;display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
+                        }
+                        unset( $children_elements[ $id ] );
+                }
+
+                if ( isset($newlevel) &amp;&amp; $newlevel ){
+                        //end the child delimiter
+                        $cb_args = array_merge( array(&amp;$output, $depth), $args);
+                        call_user_func_array(array(&amp;$this, 'end_lvl'), $cb_args);
+                }
+
+                //end this element
+                $cb_args = array_merge( array(&amp;$output, $element, $depth), $args);
+                call_user_func_array(array(&amp;$this, 'end_el'), $cb_args);
+        }
+
+        /**
+         * Display array of elements hierarchically.
+         *
+         * It is a generic function which does not assume any existing order of
+         * elements. max_depth = -1 means flatly display every element. max_depth =
+         * 0 means display all levels. max_depth &gt; 0  specifies the number of
+         * display levels.
+         *
+         * @since 2.1.0
+         *
+         * @param array $elements
+         * @param int $max_depth
+         * @return string
+         */
+        function walk( $elements, $max_depth) {
+
+                $args = array_slice(func_get_args(), 2);
+                $output = '';
+
+                if ($max_depth &lt; -1) //invalid parameter
+                        return $output;
+
+                if (empty($elements)) //nothing to walk
+                        return $output;
+
+                $id_field = $this-&gt;db_fields['id'];
+                $parent_field = $this-&gt;db_fields['parent'];
+
+                // flat display
+                if ( -1 == $max_depth ) {
+                        $empty_array = array();
+                        foreach ( $elements as $e )
+                                $this-&gt;display_element( $e, $empty_array, 1, 0, $args, $output );
+                        return $output;
+                }
+
+                /*
+                 * need to display in hierarchical order
+                 * separate elements into two buckets: top level and children elements
+                 * children_elements is two dimensional array, eg.
+                 * children_elements[10][] contains all sub-elements whose parent is 10.
+                 */
+                $top_level_elements = array();
+                $children_elements  = array();
+                foreach ( $elements as $e) {
+                        if ( 0 == $e-&gt;$parent_field )
+                                $top_level_elements[] = $e;
+                        else
+                                $children_elements[ $e-&gt;$parent_field ][] = $e;
+                }
+
+                /*
+                 * when none of the elements is top level
+                 * assume the first one must be root of the sub elements
+                 */
+                if ( empty($top_level_elements) ) {
+
+                        $first = array_slice( $elements, 0, 1 );
+                        $root = $first[0];
+
+                        $top_level_elements = array();
+                        $children_elements  = array();
+                        foreach ( $elements as $e) {
+                                if ( $root-&gt;$parent_field == $e-&gt;$parent_field )
+                                        $top_level_elements[] = $e;
+                                else
+                                        $children_elements[ $e-&gt;$parent_field ][] = $e;
+                        }
+                }
+
+                foreach ( $top_level_elements as $e )
+                        $this-&gt;display_element( $e, $children_elements, $max_depth, 0, $args, $output );
+
+                /*
+                 * if we are displaying all levels, and remaining children_elements is not empty,
+                 * then we got orphans, which should be displayed regardless
+                 */
+                if ( ( $max_depth == 0 ) &amp;&amp; count( $children_elements ) &gt; 0 ) {
+                        $empty_array = array();
+                        foreach ( $children_elements as $orphans )
+                                foreach( $orphans as $op )
+                                        $this-&gt;display_element( $op, $empty_array, 1, 0, $args, $output );
+                 }
+
+                 return $output;
+        }
+
+        /**
+          * paged_walk() - produce a page of nested elements
+          *
+          * Given an array of hierarchical elements, the maximum depth, a specific page number,
+          * and number of elements per page, this function first determines all top level root elements
+          * belonging to that page, then lists them and all of their children in hierarchical order.
+          *
+          * @package WordPress
+          * @since 2.7
+          * @param int $max_depth = 0 means display all levels; $max_depth &gt; 0 specifies the number of display levels.
+          * @param int $page_num the specific page number, beginning with 1.
+          * @return XHTML of the specified page of elements
+          */
+        function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
+
+                /* sanity check */
+                if ( empty($elements) || $max_depth &lt; -1 )
+                        return '';
+
+                $args = array_slice( func_get_args(), 4 );
+                $output = '';
+
+                $id_field = $this-&gt;db_fields['id'];
+                $parent_field = $this-&gt;db_fields['parent'];
+
+                $count = -1;
+                if ( -1 == $max_depth )
+                        $total_top = count( $elements );
+                if ( $page_num &lt; 1 || $per_page &lt; 0  ) {
+                        // No paging
+                        $paging = false;
+                        $start = 0;
+                        if ( -1 == $max_depth )
+                                $end = $total_top;
+                        $this-&gt;max_pages = 1;
+                } else {
+                        $paging = true;
+                        $start = ( (int)$page_num - 1 ) * (int)$per_page;
+                        $end   = $start + $per_page;
+                        if ( -1 == $max_depth )
+                                $this-&gt;max_pages = ceil($total_top / $per_page);
+                }
+
+                // flat display
+                if ( -1 == $max_depth ) {
+                        if ( !empty($args[0]['reverse_top_level']) ) {
+                                $elements = array_reverse( $elements );
+                                $oldstart = $start;
+                                $start = $total_top - $end;
+                                $end = $total_top - $oldstart;
+                        }
+
+                        $empty_array = array();
+                        foreach ( $elements as $e ) {
+                                $count++;
+                                if ( $count &lt; $start )
+                                        continue;
+                                if ( $count &gt;= $end )
+                                        break;
+                                $this-&gt;display_element( $e, $empty_array, 1, 0, $args, $output );
+                        }
+                        return $output;
+                }
+
+                /*
+                 * separate elements into two buckets: top level and children elements
+                 * children_elements is two dimensional array, eg.
+                 * children_elements[10][] contains all sub-elements whose parent is 10.
+                 */
+                $top_level_elements = array();
+                $children_elements  = array();
+                foreach ( $elements as $e) {
+                        if ( 0 == $e-&gt;$parent_field )
+                                $top_level_elements[] = $e;
+                        else
+                                $children_elements[ $e-&gt;$parent_field ][] = $e;
+                }
+
+                $total_top = count( $top_level_elements );
+                if ( $paging )
+                        $this-&gt;max_pages = ceil($total_top / $per_page);
+                else
+                        $end = $total_top;
+
+                if ( !empty($args[0]['reverse_top_level']) ) {
+                        $top_level_elements = array_reverse( $top_level_elements );
+                        $oldstart = $start;
+                        $start = $total_top - $end;
+                        $end = $total_top - $oldstart;
+                }
+                if ( !empty($args[0]['reverse_children']) ) {
+                        foreach ( $children_elements as $parent =&gt; $children )
+                                $children_elements[$parent] = array_reverse( $children );
+                }
+
+                foreach ( $top_level_elements as $e ) {
+                        $count++;
+
+                        //for the last page, need to unset earlier children in order to keep track of orphans
+                        if ( $end &gt;= $total_top &amp;&amp; $count &lt; $start )
+                                        $this-&gt;unset_children( $e, $children_elements );
+
+                        if ( $count &lt; $start )
+                                continue;
+
+                        if ( $count &gt;= $end )
+                                break;
+
+                        $this-&gt;display_element( $e, $children_elements, $max_depth, 0, $args, $output );
+                }
+
+                if ( $end &gt;= $total_top &amp;&amp; count( $children_elements ) &gt; 0 ) {
+                        $empty_array = array();
+                        foreach ( $children_elements as $orphans )
+                                foreach( $orphans as $op )
+                                        $this-&gt;display_element( $op, $empty_array, 1, 0, $args, $output );
+                }
+
+                return $output;
+        }
+
+        function get_number_of_root_elements( $elements ){
+
+                $num = 0;
+                $parent_field = $this-&gt;db_fields['parent'];
+
+                foreach ( $elements as $e) {
+                        if ( 0 == $e-&gt;$parent_field )
+                                $num++;
+                }
+                return $num;
+        }
+
+        // unset all the children for a given top level element
+        function unset_children( $e, &amp;$children_elements ){
+
+                if ( !$e || !$children_elements )
+                        return;
+
+                $id_field = $this-&gt;db_fields['id'];
+                $id = $e-&gt;$id_field;
+
+                if ( !empty($children_elements[$id]) &amp;&amp; is_array($children_elements[$id]) )
+                        foreach ( (array) $children_elements[$id] as $child )
+                                $this-&gt;unset_children( $child, $children_elements );
+
+                if ( isset($children_elements[$id]) )
+                        unset( $children_elements[$id] );
+
+        }
+}
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesclasswpphpfromrev16091trunkwpincludesclassesphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-includes/class-wp.php (from rev 16091, trunk/wp-includes/classes.php) (0 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp.php                                (rev 0)
+++ trunk/wp-includes/class-wp.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -0,0 +1,617 @@
</span><ins>+&lt;?php
+/**
+ * Holds Most of the WordPress classes.
+ *
+ * Some of the other classes are contained in other files. For example, the
+ * WordPress cache is in cache.php and the WordPress roles API is in
+ * capabilities.php. The third party libraries are contained in their own
+ * separate files.
+ *
+ * @package WordPress
+ */
+
+/**
+ * WordPress environment setup class.
+ *
+ * @package WordPress
+ * @since 2.0.0
+ */
+class WP {
+        /**
+         * Public query variables.
+         *
+         * Long list of public query variables.
+         *
+         * @since 2.0.0
+         * @access public
+         * @var array
+         */
+        var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
+
+        /**
+         * Private query variables.
+         *
+         * Long list of private query variables.
+         *
+         * @since 2.0.0
+         * @var array
+         */
+        var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in');
+
+        /**
+         * Extra query variables set by the user.
+         *
+         * @since 2.1.0
+         * @var array
+         */
+        var $extra_query_vars = array();
+
+        /**
+         * Query variables for setting up the WordPress Query Loop.
+         *
+         * @since 2.0.0
+         * @var array
+         */
+        var $query_vars;
+
+        /**
+         * String parsed to set the query variables.
+         *
+         * @since 2.0.0
+         * @var string
+         */
+        var $query_string;
+
+        /**
+         * Permalink or requested URI.
+         *
+         * @since 2.0.0
+         * @var string
+         */
+        var $request;
+
+        /**
+         * Rewrite rule the request matched.
+         *
+         * @since 2.0.0
+         * @var string
+         */
+        var $matched_rule;
+
+        /**
+         * Rewrite query the request matched.
+         *
+         * @since 2.0.0
+         * @var string
+         */
+        var $matched_query;
+
+        /**
+         * Whether already did the permalink.
+         *
+         * @since 2.0.0
+         * @var bool
+         */
+        var $did_permalink = false;
+
+        /**
+         * Add name to list of public query variables.
+         *
+         * @since 2.1.0
+         *
+         * @param string $qv Query variable name.
+         */
+        function add_query_var($qv) {
+                if ( !in_array($qv, $this-&gt;public_query_vars) )
+                        $this-&gt;public_query_vars[] = $qv;
+        }
+
+        /**
+         * Set the value of a query variable.
+         *
+         * @since 2.3.0
+         *
+         * @param string $key Query variable name.
+         * @param mixed $value Query variable value.
+         */
+        function set_query_var($key, $value) {
+                $this-&gt;query_vars[$key] = $value;
+        }
+
+        /**
+         * Parse request to find correct WordPress query.
+         *
+         * Sets up the query variables based on the request. There are also many
+         * filters and actions that can be used to further manipulate the result.
+         *
+         * @since 2.0.0
+         *
+         * @param array|string $extra_query_vars Set the extra query variables.
+         */
+        function parse_request($extra_query_vars = '') {
+                global $wp_rewrite;
+
+                $this-&gt;query_vars = array();
+                $post_type_query_vars = array();
+
+                if ( is_array($extra_query_vars) )
+                        $this-&gt;extra_query_vars = &amp; $extra_query_vars;
+                else if (! empty($extra_query_vars))
+                        parse_str($extra_query_vars, $this-&gt;extra_query_vars);
+
+                // Process PATH_INFO, REQUEST_URI, and 404 for permalinks.
+
+                // Fetch the rewrite rules.
+                $rewrite = $wp_rewrite-&gt;wp_rewrite_rules();
+
+                if ( ! empty($rewrite) ) {
+                        // If we match a rewrite rule, this will be cleared.
+                        $error = '404';
+                        $this-&gt;did_permalink = true;
+
+                        if ( isset($_SERVER['PATH_INFO']) )
+                                $pathinfo = $_SERVER['PATH_INFO'];
+                        else
+                                $pathinfo = '';
+                        $pathinfo_array = explode('?', $pathinfo);
+                        $pathinfo = str_replace(&quot;%&quot;, &quot;%25&quot;, $pathinfo_array[0]);
+                        $req_uri = $_SERVER['REQUEST_URI'];
+                        $req_uri_array = explode('?', $req_uri);
+                        $req_uri = $req_uri_array[0];
+                        $self = $_SERVER['PHP_SELF'];
+                        $home_path = parse_url(home_url());
+                        if ( isset($home_path['path']) )
+                                $home_path = $home_path['path'];
+                        else
+                                $home_path = '';
+                        $home_path = trim($home_path, '/');
+
+                        // Trim path info from the end and the leading home path from the
+                        // front.  For path info requests, this leaves us with the requesting
+                        // filename, if any.  For 404 requests, this leaves us with the
+                        // requested permalink.
+                        $req_uri = str_replace($pathinfo, '', $req_uri);
+                        $req_uri = trim($req_uri, '/');
+                        $req_uri = preg_replace(&quot;|^$home_path|&quot;, '', $req_uri);
+                        $req_uri = trim($req_uri, '/');
+                        $pathinfo = trim($pathinfo, '/');
+                        $pathinfo = preg_replace(&quot;|^$home_path|&quot;, '', $pathinfo);
+                        $pathinfo = trim($pathinfo, '/');
+                        $self = trim($self, '/');
+                        $self = preg_replace(&quot;|^$home_path|&quot;, '', $self);
+                        $self = trim($self, '/');
+
+                        // The requested permalink is in $pathinfo for path info requests and
+                        //  $req_uri for other requests.
+                        if ( ! empty($pathinfo) &amp;&amp; !preg_match('|^.*' . $wp_rewrite-&gt;index . '$|', $pathinfo) ) {
+                                $request = $pathinfo;
+                        } else {
+                                // If the request uri is the index, blank it out so that we don't try to match it against a rule.
+                                if ( $req_uri == $wp_rewrite-&gt;index )
+                                        $req_uri = '';
+                                $request = $req_uri;
+                        }
+
+                        $this-&gt;request = $request;
+
+                        // Look for matches.
+                        $request_match = $request;
+                        foreach ( (array) $rewrite as $match =&gt; $query) {
+                                // Don't try to match against AtomPub calls
+                                if ( $req_uri == 'wp-app.php' )
+                                        break;
+
+                                // If the requesting file is the anchor of the match, prepend it
+                                // to the path info.
+                                if ( (! empty($req_uri)) &amp;&amp; (strpos($match, $req_uri) === 0) &amp;&amp; ($req_uri != $request) )
+                                        $request_match = $req_uri . '/' . $request;
+
+                                if ( preg_match(&quot;#^$match#&quot;, $request_match, $matches) ||
+                                        preg_match(&quot;#^$match#&quot;, urldecode($request_match), $matches) ) {
+                                        // Got a match.
+                                        $this-&gt;matched_rule = $match;
+
+                                        // Trim the query of everything up to the '?'.
+                                        $query = preg_replace(&quot;!^.+\?!&quot;, '', $query);
+
+                                        // Substitute the substring matches into the query.
+                                        $query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
+
+                                        $this-&gt;matched_query = $query;
+
+                                        // Parse the query.
+                                        parse_str($query, $perma_query_vars);
+
+                                        // If we're processing a 404 request, clear the error var
+                                        // since we found something.
+                                        if ( isset($_GET['error']) )
+                                                unset($_GET['error']);
+
+                                        if ( isset($error) )
+                                                unset($error);
+
+                                        break;
+                                }
+                        }
+
+                        // If req_uri is empty or if it is a request for ourself, unset error.
+                        if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
+                                if ( isset($_GET['error']) )
+                                        unset($_GET['error']);
+
+                                if ( isset($error) )
+                                        unset($error);
+
+                                if ( isset($perma_query_vars) &amp;&amp; strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
+                                        unset($perma_query_vars);
+
+                                $this-&gt;did_permalink = false;
+                        }
+                }
+
+                $this-&gt;public_query_vars = apply_filters('query_vars', $this-&gt;public_query_vars);
+
+                foreach ( $GLOBALS['wp_post_types'] as $post_type =&gt; $t )
+                        if ( $t-&gt;query_var )
+                                $post_type_query_vars[$t-&gt;query_var] = $post_type;
+
+                foreach ( $this-&gt;public_query_vars as $wpvar ) {
+                        if ( isset( $this-&gt;extra_query_vars[$wpvar] ) )
+                                $this-&gt;query_vars[$wpvar] = $this-&gt;extra_query_vars[$wpvar];
+                        elseif ( isset( $_POST[$wpvar] ) )
+                                $this-&gt;query_vars[$wpvar] = $_POST[$wpvar];
+                        elseif ( isset( $_GET[$wpvar] ) )
+                                $this-&gt;query_vars[$wpvar] = $_GET[$wpvar];
+                        elseif ( isset( $perma_query_vars[$wpvar] ) )
+                                $this-&gt;query_vars[$wpvar] = $perma_query_vars[$wpvar];
+
+                        if ( !empty( $this-&gt;query_vars[$wpvar] ) ) {
+                                if ( ! is_array( $this-&gt;query_vars[$wpvar] ) ) {
+                                        $this-&gt;query_vars[$wpvar] = (string) $this-&gt;query_vars[$wpvar];
+                                } else {
+                                        foreach ( $this-&gt;query_vars[$wpvar] as $vkey =&gt; $v ) {
+                                                if ( !is_object( $v ) ) {
+                                                        $this-&gt;query_vars[$wpvar][$vkey] = (string) $v;
+                                                }
+                                        }
+                                }
+
+                                if ( isset($post_type_query_vars[$wpvar] ) ) {
+                                        $this-&gt;query_vars['post_type'] = $post_type_query_vars[$wpvar];
+                                        $this-&gt;query_vars['name'] = $this-&gt;query_vars[$wpvar];
+                                }
+                        }
+                }
+
+                // Limit publicly queried post_types to those that are publicly_queryable
+                if ( isset( $this-&gt;query_vars['post_type']) ) {
+                        $queryable_post_types = get_post_types( array('publicly_queryable' =&gt; true) );
+                        if ( ! is_array( $this-&gt;query_vars['post_type'] ) ) {
+                                if ( ! in_array( $this-&gt;query_vars['post_type'], $queryable_post_types ) )
+                                        unset( $this-&gt;query_vars['post_type'] );
+                        } else {
+                                $this-&gt;query_vars['post_type'] = array_intersect( $this-&gt;query_vars['post_type'], $queryable_post_types );
+                        }
+                }
+
+                foreach ( (array) $this-&gt;private_query_vars as $var) {
+                        if ( isset($this-&gt;extra_query_vars[$var]) )
+                                $this-&gt;query_vars[$var] = $this-&gt;extra_query_vars[$var];
+                }
+
+                if ( isset($error) )
+                        $this-&gt;query_vars['error'] = $error;
+
+                $this-&gt;query_vars = apply_filters('request', $this-&gt;query_vars);
+
+                do_action_ref_array('parse_request', array(&amp;$this));
+        }
+
+        /**
+         * Send additional HTTP headers for caching, content type, etc.
+         *
+         * Sets the X-Pingback header, 404 status (if 404), Content-type. If showing
+         * a feed, it will also send last-modified, etag, and 304 status if needed.
+         *
+         * @since 2.0.0
+         */
+        function send_headers() {
+                $headers = array('X-Pingback' =&gt; get_bloginfo('pingback_url'));
+                $status = null;
+                $exit_required = false;
+
+                if ( is_user_logged_in() )
+                        $headers = array_merge($headers, wp_get_nocache_headers());
+                if ( !empty($this-&gt;query_vars['error']) &amp;&amp; '404' == $this-&gt;query_vars['error'] ) {
+                        $status = 404;
+                        if ( !is_user_logged_in() )
+                                $headers = array_merge($headers, wp_get_nocache_headers());
+                        $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
+                } else if ( empty($this-&gt;query_vars['feed']) ) {
+                        $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
+                } else {
+                        // We're showing a feed, so WP is indeed the only thing that last changed
+                        if ( !empty($this-&gt;query_vars['withcomments'])
+                                || ( empty($this-&gt;query_vars['withoutcomments'])
+                                        &amp;&amp; ( !empty($this-&gt;query_vars['p'])
+                                                || !empty($this-&gt;query_vars['name'])
+                                                || !empty($this-&gt;query_vars['page_id'])
+                                                || !empty($this-&gt;query_vars['pagename'])
+                                                || !empty($this-&gt;query_vars['attachment'])
+                                                || !empty($this-&gt;query_vars['attachment_id'])
+                                        )
+                                )
+                        )
+                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
+                        else
+                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
+                        $wp_etag = '&quot;' . md5($wp_last_modified) . '&quot;';
+                        $headers['Last-Modified'] = $wp_last_modified;
+                        $headers['ETag'] = $wp_etag;
+
+                        // Support for Conditional GET
+                        if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
+                                $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
+                        else $client_etag = false;
+
+                        $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
+                        // If string is empty, return 0. If not, attempt to parse into a timestamp
+                        $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
+
+                        // Make a timestamp for our most recent modification...
+                        $wp_modified_timestamp = strtotime($wp_last_modified);
+
+                        if ( ($client_last_modified &amp;&amp; $client_etag) ?
+                                         (($client_modified_timestamp &gt;= $wp_modified_timestamp) &amp;&amp; ($client_etag == $wp_etag)) :
+                                         (($client_modified_timestamp &gt;= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
+                                $status = 304;
+                                $exit_required = true;
+                        }
+                }
+
+                $headers = apply_filters('wp_headers', $headers, $this);
+
+                if ( ! empty( $status ) )
+                        status_header( $status );
+                foreach( (array) $headers as $name =&gt; $field_value )
+                        @header(&quot;{$name}: {$field_value}&quot;);
+
+                if ( $exit_required )
+                        exit();
+
+                do_action_ref_array('send_headers', array(&amp;$this));
+        }
+
+        /**
+         * Sets the query string property based off of the query variable property.
+         *
+         * The 'query_string' filter is deprecated, but still works. Plugins should
+         * use the 'request' filter instead.
+         *
+         * @since 2.0.0
+         */
+        function build_query_string() {
+                $this-&gt;query_string = '';
+                foreach ( (array) array_keys($this-&gt;query_vars) as $wpvar) {
+                        if ( '' != $this-&gt;query_vars[$wpvar] ) {
+                                $this-&gt;query_string .= (strlen($this-&gt;query_string) &lt; 1) ? '' : '&amp;';
+                                if ( !is_scalar($this-&gt;query_vars[$wpvar]) ) // Discard non-scalars.
+                                        continue;
+                                $this-&gt;query_string .= $wpvar . '=' . rawurlencode($this-&gt;query_vars[$wpvar]);
+                        }
+                }
+
+                // query_string filter deprecated.  Use request filter instead.
+                if ( has_filter('query_string') ) {  // Don't bother filtering and parsing if no plugins are hooked in.
+                        $this-&gt;query_string = apply_filters('query_string', $this-&gt;query_string);
+                        parse_str($this-&gt;query_string, $this-&gt;query_vars);
+                }
+        }
+
+        /**
+         * Set up the WordPress Globals.
+         *
+         * The query_vars property will be extracted to the GLOBALS. So care should
+         * be taken when naming global variables that might interfere with the
+         * WordPress environment.
+         *
+         * @global string $query_string Query string for the loop.
+         * @global int $more Only set, if single page or post.
+         * @global int $single If single page or post. Only set, if single page or post.
+         *
+         * @since 2.0.0
+         */
+        function register_globals() {
+                global $wp_query;
+                // Extract updated query vars back into global namespace.
+                foreach ( (array) $wp_query-&gt;query_vars as $key =&gt; $value) {
+                        $GLOBALS[$key] = $value;
+                }
+
+                $GLOBALS['query_string'] = $this-&gt;query_string;
+                $GLOBALS['posts'] = &amp; $wp_query-&gt;posts;
+                $GLOBALS['post'] = (isset($wp_query-&gt;post)) ? $wp_query-&gt;post : null;
+                $GLOBALS['request'] = $wp_query-&gt;request;
+
+                if ( is_single() || is_page() ) {
+                        $GLOBALS['more'] = 1;
+                        $GLOBALS['single'] = 1;
+                }
+        }
+
+        /**
+         * Set up the current user.
+         *
+         * @since 2.0.0
+         */
+        function init() {
+                wp_get_current_user();
+        }
+
+        /**
+         * Set up the Loop based on the query variables.
+         *
+         * @uses WP::$query_vars
+         * @since 2.0.0
+         */
+        function query_posts() {
+                global $wp_the_query;
+                $this-&gt;build_query_string();
+                $wp_the_query-&gt;query($this-&gt;query_vars);
+         }
+
+         /**
+          * Set the Headers for 404, if nothing is found for requested URL.
+         *
+         * Issue a 404 if a request doesn't match any posts and doesn't match
+         * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already
+         * issued, and if the request was not a search or the homepage.
+         *
+         * Otherwise, issue a 200.
+         *
+         * @since 2.0.0
+          */
+        function handle_404() {
+                global $wp_query;
+
+                if ( !is_admin() &amp;&amp; ( 0 == count( $wp_query-&gt;posts ) ) &amp;&amp; !is_404() &amp;&amp; !is_robots() &amp;&amp; !is_search() &amp;&amp; !is_home() ) {
+                        // Don't 404 for these queries if they matched an object.
+                        if ( ( is_tag() || is_category() || is_tax() || is_author() ) &amp;&amp; $wp_query-&gt;get_queried_object() &amp;&amp; !is_paged() ) {
+                                if ( !is_404() )
+                                        status_header( 200 );
+                                return;
+                        }
+                        $wp_query-&gt;set_404();
+                        status_header( 404 );
+                        nocache_headers();
+                } elseif ( !is_404() ) {
+                        status_header( 200 );
+                }
+        }
+
+        /**
+         * Sets up all of the variables required by the WordPress environment.
+         *
+         * The action 'wp' has one parameter that references the WP object. It
+         * allows for accessing the properties and methods to further manipulate the
+         * object.
+         *
+         * @since 2.0.0
+         *
+         * @param string|array $query_args Passed to {@link parse_request()}
+         */
+        function main($query_args = '') {
+                $this-&gt;init();
+                $this-&gt;parse_request($query_args);
+                $this-&gt;send_headers();
+                $this-&gt;query_posts();
+                $this-&gt;handle_404();
+                $this-&gt;register_globals();
+                do_action_ref_array('wp', array(&amp;$this));
+        }
+
+        /**
+         * PHP4 Constructor - Does nothing.
+         *
+         * Call main() method when ready to run setup.
+         *
+         * @since 2.0.0
+         *
+         * @return WP
+         */
+        function WP() {
+                // Empty.
+        }
+}
+
+/**
+ * Helper class to remove the need to use eval to replace $matches[] in query strings.
+ *
+ * @since 2.9.0
+ */
+class WP_MatchesMapRegex {
+        /**
+         * store for matches
+         *
+         * @access private
+         * @var array
+         */
+        var $_matches;
+
+        /**
+         * store for mapping result
+         *
+         * @access public
+         * @var string
+         */
+        var $output;
+
+        /**
+         * subject to perform mapping on (query string containing $matches[] references
+         *
+         * @access private
+         * @var string
+         */
+        var $_subject;
+
+        /**
+         * regexp pattern to match $matches[] references
+         *
+         * @var string
+         */
+        var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
+
+        /**
+         * constructor
+         *
+         * @param string $subject subject if regex
+         * @param array  $matches data to use in map
+         * @return self
+         */
+        function WP_MatchesMapRegex($subject, $matches) {
+                $this-&gt;_subject = $subject;
+                $this-&gt;_matches = $matches;
+                $this-&gt;output = $this-&gt;_map();
+        }
+
+        /**
+         * Substitute substring matches in subject.
+         *
+         * static helper function to ease use
+         *
+         * @access public
+         * @param string $subject subject
+         * @param array  $matches data used for subsitution
+         * @return string
+         */
+        function apply($subject, $matches) {
+                $oSelf =&amp; new WP_MatchesMapRegex($subject, $matches);
+                return $oSelf-&gt;output;
+        }
+
+        /**
+         * do the actual mapping
+         *
+         * @access private
+         * @return string
+         */
+        function _map() {
+                $callback = array(&amp;$this, 'callback');
+                return preg_replace_callback($this-&gt;_pattern, $callback, $this-&gt;_subject);
+        }
+
+        /**
+         * preg_replace_callback hook
+         *
+         * @access public
+         * @param  array $matches preg_replace regexp matches
+         * @return string
+         */
+        function callback($matches) {
+                $index = intval(substr($matches[0], 9, -1));
+                return ( isset( $this-&gt;_matches[$index] ) ? urlencode($this-&gt;_matches[$index]) : '' );
+        }
+
+}
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/classes.php (16098 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/classes.php        2010-10-30 06:40:04 UTC (rev 16098)
+++ trunk/wp-includes/classes.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -11,1119 +11,6 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * WordPress environment setup class.
- *
- * @package WordPress
- * @since 2.0.0
- */
-class WP {
-        /**
-         * Public query variables.
-         *
-         * Long list of public query variables.
-         *
-         * @since 2.0.0
-         * @access public
-         * @var array
-         */
-        var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
-
-        /**
-         * Private query variables.
-         *
-         * Long list of private query variables.
-         *
-         * @since 2.0.0
-         * @var array
-         */
-        var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in');
-
-        /**
-         * Extra query variables set by the user.
-         *
-         * @since 2.1.0
-         * @var array
-         */
-        var $extra_query_vars = array();
-
-        /**
-         * Query variables for setting up the WordPress Query Loop.
-         *
-         * @since 2.0.0
-         * @var array
-         */
-        var $query_vars;
-
-        /**
-         * String parsed to set the query variables.
-         *
-         * @since 2.0.0
-         * @var string
-         */
-        var $query_string;
-
-        /**
-         * Permalink or requested URI.
-         *
-         * @since 2.0.0
-         * @var string
-         */
-        var $request;
-
-        /**
-         * Rewrite rule the request matched.
-         *
-         * @since 2.0.0
-         * @var string
-         */
-        var $matched_rule;
-
-        /**
-         * Rewrite query the request matched.
-         *
-         * @since 2.0.0
-         * @var string
-         */
-        var $matched_query;
-
-        /**
-         * Whether already did the permalink.
-         *
-         * @since 2.0.0
-         * @var bool
-         */
-        var $did_permalink = false;
-
-        /**
-         * Add name to list of public query variables.
-         *
-         * @since 2.1.0
-         *
-         * @param string $qv Query variable name.
-         */
-        function add_query_var($qv) {
-                if ( !in_array($qv, $this-&gt;public_query_vars) )
-                        $this-&gt;public_query_vars[] = $qv;
-        }
-
-        /**
-         * Set the value of a query variable.
-         *
-         * @since 2.3.0
-         *
-         * @param string $key Query variable name.
-         * @param mixed $value Query variable value.
-         */
-        function set_query_var($key, $value) {
-                $this-&gt;query_vars[$key] = $value;
-        }
-
-        /**
-         * Parse request to find correct WordPress query.
-         *
-         * Sets up the query variables based on the request. There are also many
-         * filters and actions that can be used to further manipulate the result.
-         *
-         * @since 2.0.0
-         *
-         * @param array|string $extra_query_vars Set the extra query variables.
-         */
-        function parse_request($extra_query_vars = '') {
-                global $wp_rewrite;
-
-                $this-&gt;query_vars = array();
-                $post_type_query_vars = array();
-
-                if ( is_array($extra_query_vars) )
-                        $this-&gt;extra_query_vars = &amp; $extra_query_vars;
-                else if (! empty($extra_query_vars))
-                        parse_str($extra_query_vars, $this-&gt;extra_query_vars);
-
-                // Process PATH_INFO, REQUEST_URI, and 404 for permalinks.
-
-                // Fetch the rewrite rules.
-                $rewrite = $wp_rewrite-&gt;wp_rewrite_rules();
-
-                if ( ! empty($rewrite) ) {
-                        // If we match a rewrite rule, this will be cleared.
-                        $error = '404';
-                        $this-&gt;did_permalink = true;
-
-                        if ( isset($_SERVER['PATH_INFO']) )
-                                $pathinfo = $_SERVER['PATH_INFO'];
-                        else
-                                $pathinfo = '';
-                        $pathinfo_array = explode('?', $pathinfo);
-                        $pathinfo = str_replace(&quot;%&quot;, &quot;%25&quot;, $pathinfo_array[0]);
-                        $req_uri = $_SERVER['REQUEST_URI'];
-                        $req_uri_array = explode('?', $req_uri);
-                        $req_uri = $req_uri_array[0];
-                        $self = $_SERVER['PHP_SELF'];
-                        $home_path = parse_url(home_url());
-                        if ( isset($home_path['path']) )
-                                $home_path = $home_path['path'];
-                        else
-                                $home_path = '';
-                        $home_path = trim($home_path, '/');
-
-                        // Trim path info from the end and the leading home path from the
-                        // front.  For path info requests, this leaves us with the requesting
-                        // filename, if any.  For 404 requests, this leaves us with the
-                        // requested permalink.
-                        $req_uri = str_replace($pathinfo, '', $req_uri);
-                        $req_uri = trim($req_uri, '/');
-                        $req_uri = preg_replace(&quot;|^$home_path|&quot;, '', $req_uri);
-                        $req_uri = trim($req_uri, '/');
-                        $pathinfo = trim($pathinfo, '/');
-                        $pathinfo = preg_replace(&quot;|^$home_path|&quot;, '', $pathinfo);
-                        $pathinfo = trim($pathinfo, '/');
-                        $self = trim($self, '/');
-                        $self = preg_replace(&quot;|^$home_path|&quot;, '', $self);
-                        $self = trim($self, '/');
-
-                        // The requested permalink is in $pathinfo for path info requests and
-                        //  $req_uri for other requests.
-                        if ( ! empty($pathinfo) &amp;&amp; !preg_match('|^.*' . $wp_rewrite-&gt;index . '$|', $pathinfo) ) {
-                                $request = $pathinfo;
-                        } else {
-                                // If the request uri is the index, blank it out so that we don't try to match it against a rule.
-                                if ( $req_uri == $wp_rewrite-&gt;index )
-                                        $req_uri = '';
-                                $request = $req_uri;
-                        }
-
-                        $this-&gt;request = $request;
-
-                        // Look for matches.
-                        $request_match = $request;
-                        foreach ( (array) $rewrite as $match =&gt; $query) {
-                                // Don't try to match against AtomPub calls
-                                if ( $req_uri == 'wp-app.php' )
-                                        break;
-
-                                // If the requesting file is the anchor of the match, prepend it
-                                // to the path info.
-                                if ( (! empty($req_uri)) &amp;&amp; (strpos($match, $req_uri) === 0) &amp;&amp; ($req_uri != $request) )
-                                        $request_match = $req_uri . '/' . $request;
-
-                                if ( preg_match(&quot;#^$match#&quot;, $request_match, $matches) ||
-                                        preg_match(&quot;#^$match#&quot;, urldecode($request_match), $matches) ) {
-                                        // Got a match.
-                                        $this-&gt;matched_rule = $match;
-
-                                        // Trim the query of everything up to the '?'.
-                                        $query = preg_replace(&quot;!^.+\?!&quot;, '', $query);
-
-                                        // Substitute the substring matches into the query.
-                                        $query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
-
-                                        $this-&gt;matched_query = $query;
-
-                                        // Parse the query.
-                                        parse_str($query, $perma_query_vars);
-
-                                        // If we're processing a 404 request, clear the error var
-                                        // since we found something.
-                                        if ( isset($_GET['error']) )
-                                                unset($_GET['error']);
-
-                                        if ( isset($error) )
-                                                unset($error);
-
-                                        break;
-                                }
-                        }
-
-                        // If req_uri is empty or if it is a request for ourself, unset error.
-                        if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
-                                if ( isset($_GET['error']) )
-                                        unset($_GET['error']);
-
-                                if ( isset($error) )
-                                        unset($error);
-
-                                if ( isset($perma_query_vars) &amp;&amp; strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
-                                        unset($perma_query_vars);
-
-                                $this-&gt;did_permalink = false;
-                        }
-                }
-
-                $this-&gt;public_query_vars = apply_filters('query_vars', $this-&gt;public_query_vars);
-
-                foreach ( $GLOBALS['wp_post_types'] as $post_type =&gt; $t )
-                        if ( $t-&gt;query_var )
-                                $post_type_query_vars[$t-&gt;query_var] = $post_type;
-
-                foreach ( $this-&gt;public_query_vars as $wpvar ) {
-                        if ( isset( $this-&gt;extra_query_vars[$wpvar] ) )
-                                $this-&gt;query_vars[$wpvar] = $this-&gt;extra_query_vars[$wpvar];
-                        elseif ( isset( $_POST[$wpvar] ) )
-                                $this-&gt;query_vars[$wpvar] = $_POST[$wpvar];
-                        elseif ( isset( $_GET[$wpvar] ) )
-                                $this-&gt;query_vars[$wpvar] = $_GET[$wpvar];
-                        elseif ( isset( $perma_query_vars[$wpvar] ) )
-                                $this-&gt;query_vars[$wpvar] = $perma_query_vars[$wpvar];
-
-                        if ( !empty( $this-&gt;query_vars[$wpvar] ) ) {
-                                if ( ! is_array( $this-&gt;query_vars[$wpvar] ) ) {
-                                        $this-&gt;query_vars[$wpvar] = (string) $this-&gt;query_vars[$wpvar];
-                                } else {
-                                        foreach ( $this-&gt;query_vars[$wpvar] as $vkey =&gt; $v ) {
-                                                if ( !is_object( $v ) ) {
-                                                        $this-&gt;query_vars[$wpvar][$vkey] = (string) $v;
-                                                }
-                                        }
-                                }
-
-                                if ( isset($post_type_query_vars[$wpvar] ) ) {
-                                        $this-&gt;query_vars['post_type'] = $post_type_query_vars[$wpvar];
-                                        $this-&gt;query_vars['name'] = $this-&gt;query_vars[$wpvar];
-                                }
-                        }
-                }
-
-                // Limit publicly queried post_types to those that are publicly_queryable
-                if ( isset( $this-&gt;query_vars['post_type']) ) {
-                        $queryable_post_types = get_post_types( array('publicly_queryable' =&gt; true) );
-                        if ( ! is_array( $this-&gt;query_vars['post_type'] ) ) {
-                                if ( ! in_array( $this-&gt;query_vars['post_type'], $queryable_post_types ) )
-                                        unset( $this-&gt;query_vars['post_type'] );
-                        } else {
-                                $this-&gt;query_vars['post_type'] = array_intersect( $this-&gt;query_vars['post_type'], $queryable_post_types );
-                        }
-                }
-
-                foreach ( (array) $this-&gt;private_query_vars as $var) {
-                        if ( isset($this-&gt;extra_query_vars[$var]) )
-                                $this-&gt;query_vars[$var] = $this-&gt;extra_query_vars[$var];
-                }
-
-                if ( isset($error) )
-                        $this-&gt;query_vars['error'] = $error;
-
-                $this-&gt;query_vars = apply_filters('request', $this-&gt;query_vars);
-
-                do_action_ref_array('parse_request', array(&amp;$this));
-        }
-
-        /**
-         * Send additional HTTP headers for caching, content type, etc.
-         *
-         * Sets the X-Pingback header, 404 status (if 404), Content-type. If showing
-         * a feed, it will also send last-modified, etag, and 304 status if needed.
-         *
-         * @since 2.0.0
-         */
-        function send_headers() {
-                $headers = array('X-Pingback' =&gt; get_bloginfo('pingback_url'));
-                $status = null;
-                $exit_required = false;
-
-                if ( is_user_logged_in() )
-                        $headers = array_merge($headers, wp_get_nocache_headers());
-                if ( !empty($this-&gt;query_vars['error']) &amp;&amp; '404' == $this-&gt;query_vars['error'] ) {
-                        $status = 404;
-                        if ( !is_user_logged_in() )
-                                $headers = array_merge($headers, wp_get_nocache_headers());
-                        $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
-                } else if ( empty($this-&gt;query_vars['feed']) ) {
-                        $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
-                } else {
-                        // We're showing a feed, so WP is indeed the only thing that last changed
-                        if ( !empty($this-&gt;query_vars['withcomments'])
-                                || ( empty($this-&gt;query_vars['withoutcomments'])
-                                        &amp;&amp; ( !empty($this-&gt;query_vars['p'])
-                                                || !empty($this-&gt;query_vars['name'])
-                                                || !empty($this-&gt;query_vars['page_id'])
-                                                || !empty($this-&gt;query_vars['pagename'])
-                                                || !empty($this-&gt;query_vars['attachment'])
-                                                || !empty($this-&gt;query_vars['attachment_id'])
-                                        )
-                                )
-                        )
-                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
-                        else
-                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
-                        $wp_etag = '&quot;' . md5($wp_last_modified) . '&quot;';
-                        $headers['Last-Modified'] = $wp_last_modified;
-                        $headers['ETag'] = $wp_etag;
-
-                        // Support for Conditional GET
-                        if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
-                                $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
-                        else $client_etag = false;
-
-                        $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
-                        // If string is empty, return 0. If not, attempt to parse into a timestamp
-                        $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
-
-                        // Make a timestamp for our most recent modification...
-                        $wp_modified_timestamp = strtotime($wp_last_modified);
-
-                        if ( ($client_last_modified &amp;&amp; $client_etag) ?
-                                         (($client_modified_timestamp &gt;= $wp_modified_timestamp) &amp;&amp; ($client_etag == $wp_etag)) :
-                                         (($client_modified_timestamp &gt;= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
-                                $status = 304;
-                                $exit_required = true;
-                        }
-                }
-
-                $headers = apply_filters('wp_headers', $headers, $this);
-
-                if ( ! empty( $status ) )
-                        status_header( $status );
-                foreach( (array) $headers as $name =&gt; $field_value )
-                        @header(&quot;{$name}: {$field_value}&quot;);
-
-                if ( $exit_required )
-                        exit();
-
-                do_action_ref_array('send_headers', array(&amp;$this));
-        }
-
-        /**
-         * Sets the query string property based off of the query variable property.
-         *
-         * The 'query_string' filter is deprecated, but still works. Plugins should
-         * use the 'request' filter instead.
-         *
-         * @since 2.0.0
-         */
-        function build_query_string() {
-                $this-&gt;query_string = '';
-                foreach ( (array) array_keys($this-&gt;query_vars) as $wpvar) {
-                        if ( '' != $this-&gt;query_vars[$wpvar] ) {
-                                $this-&gt;query_string .= (strlen($this-&gt;query_string) &lt; 1) ? '' : '&amp;';
-                                if ( !is_scalar($this-&gt;query_vars[$wpvar]) ) // Discard non-scalars.
-                                        continue;
-                                $this-&gt;query_string .= $wpvar . '=' . rawurlencode($this-&gt;query_vars[$wpvar]);
-                        }
-                }
-
-                // query_string filter deprecated.  Use request filter instead.
-                if ( has_filter('query_string') ) {  // Don't bother filtering and parsing if no plugins are hooked in.
-                        $this-&gt;query_string = apply_filters('query_string', $this-&gt;query_string);
-                        parse_str($this-&gt;query_string, $this-&gt;query_vars);
-                }
-        }
-
-        /**
-         * Set up the WordPress Globals.
-         *
-         * The query_vars property will be extracted to the GLOBALS. So care should
-         * be taken when naming global variables that might interfere with the
-         * WordPress environment.
-         *
-         * @global string $query_string Query string for the loop.
-         * @global int $more Only set, if single page or post.
-         * @global int $single If single page or post. Only set, if single page or post.
-         *
-         * @since 2.0.0
-         */
-        function register_globals() {
-                global $wp_query;
-                // Extract updated query vars back into global namespace.
-                foreach ( (array) $wp_query-&gt;query_vars as $key =&gt; $value) {
-                        $GLOBALS[$key] = $value;
-                }
-
-                $GLOBALS['query_string'] = $this-&gt;query_string;
-                $GLOBALS['posts'] = &amp; $wp_query-&gt;posts;
-                $GLOBALS['post'] = (isset($wp_query-&gt;post)) ? $wp_query-&gt;post : null;
-                $GLOBALS['request'] = $wp_query-&gt;request;
-
-                if ( is_single() || is_page() ) {
-                        $GLOBALS['more'] = 1;
-                        $GLOBALS['single'] = 1;
-                }
-        }
-
-        /**
-         * Set up the current user.
-         *
-         * @since 2.0.0
-         */
-        function init() {
-                wp_get_current_user();
-        }
-
-        /**
-         * Set up the Loop based on the query variables.
-         *
-         * @uses WP::$query_vars
-         * @since 2.0.0
-         */
-        function query_posts() {
-                global $wp_the_query;
-                $this-&gt;build_query_string();
-                $wp_the_query-&gt;query($this-&gt;query_vars);
-         }
-
-         /**
-          * Set the Headers for 404, if nothing is found for requested URL.
-         *
-         * Issue a 404 if a request doesn't match any posts and doesn't match
-         * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already
-         * issued, and if the request was not a search or the homepage.
-         *
-         * Otherwise, issue a 200.
-         *
-         * @since 2.0.0
-          */
-        function handle_404() {
-                global $wp_query;
-
-                if ( !is_admin() &amp;&amp; ( 0 == count( $wp_query-&gt;posts ) ) &amp;&amp; !is_404() &amp;&amp; !is_robots() &amp;&amp; !is_search() &amp;&amp; !is_home() ) {
-                        // Don't 404 for these queries if they matched an object.
-                        if ( ( is_tag() || is_category() || is_tax() || is_author() ) &amp;&amp; $wp_query-&gt;get_queried_object() &amp;&amp; !is_paged() ) {
-                                if ( !is_404() )
-                                        status_header( 200 );
-                                return;
-                        }
-                        $wp_query-&gt;set_404();
-                        status_header( 404 );
-                        nocache_headers();
-                } elseif ( !is_404() ) {
-                        status_header( 200 );
-                }
-        }
-
-        /**
-         * Sets up all of the variables required by the WordPress environment.
-         *
-         * The action 'wp' has one parameter that references the WP object. It
-         * allows for accessing the properties and methods to further manipulate the
-         * object.
-         *
-         * @since 2.0.0
-         *
-         * @param string|array $query_args Passed to {@link parse_request()}
-         */
-        function main($query_args = '') {
-                $this-&gt;init();
-                $this-&gt;parse_request($query_args);
-                $this-&gt;send_headers();
-                $this-&gt;query_posts();
-                $this-&gt;handle_404();
-                $this-&gt;register_globals();
-                do_action_ref_array('wp', array(&amp;$this));
-        }
-
-        /**
-         * PHP4 Constructor - Does nothing.
-         *
-         * Call main() method when ready to run setup.
-         *
-         * @since 2.0.0
-         *
-         * @return WP
-         */
-        function WP() {
-                // Empty.
-        }
-}
-
-/**
- * WordPress Error class.
- *
- * Container for checking for WordPress errors and error messages. Return
- * WP_Error and use {@link is_wp_error()} to check if this class is returned.
- * Many core WordPress functions pass this class in the event of an error and
- * if not handled properly will result in code errors.
- *
- * @package WordPress
- * @since 2.1.0
- */
-class WP_Error {
-        /**
-         * Stores the list of errors.
-         *
-         * @since 2.1.0
-         * @var array
-         * @access private
-         */
-        var $errors = array();
-
-        /**
-         * Stores the list of data for error codes.
-         *
-         * @since 2.1.0
-         * @var array
-         * @access private
-         */
-        var $error_data = array();
-
-        /**
-         * PHP4 Constructor - Sets up error message.
-         *
-         * If code parameter is empty then nothing will be done. It is possible to
-         * add multiple messages to the same code, but with other methods in the
-         * class.
-         *
-         * All parameters are optional, but if the code parameter is set, then the
-         * data parameter is optional.
-         *
-         * @since 2.1.0
-         *
-         * @param string|int $code Error code
-         * @param string $message Error message
-         * @param mixed $data Optional. Error data.
-         * @return WP_Error
-         */
-        function WP_Error($code = '', $message = '', $data = '') {
-                if ( empty($code) )
-                        return;
-
-                $this-&gt;errors[$code][] = $message;
-
-                if ( ! empty($data) )
-                        $this-&gt;error_data[$code] = $data;
-        }
-
-        /**
-         * Retrieve all error codes.
-         *
-         * @since 2.1.0
-         * @access public
-         *
-         * @return array List of error codes, if avaiable.
-         */
-        function get_error_codes() {
-                if ( empty($this-&gt;errors) )
-                        return array();
-
-                return array_keys($this-&gt;errors);
-        }
-
-        /**
-         * Retrieve first error code available.
-         *
-         * @since 2.1.0
-         * @access public
-         *
-         * @return string|int Empty string, if no error codes.
-         */
-        function get_error_code() {
-                $codes = $this-&gt;get_error_codes();
-
-                if ( empty($codes) )
-                        return '';
-
-                return $codes[0];
-        }
-
-        /**
-         * Retrieve all error messages or error messages matching code.
-         *
-         * @since 2.1.0
-         *
-         * @param string|int $code Optional. Retrieve messages matching code, if exists.
-         * @return array Error strings on success, or empty array on failure (if using codee parameter).
-         */
-        function get_error_messages($code = '') {
-                // Return all messages if no code specified.
-                if ( empty($code) ) {
-                        $all_messages = array();
-                        foreach ( (array) $this-&gt;errors as $code =&gt; $messages )
-                                $all_messages = array_merge($all_messages, $messages);
-
-                        return $all_messages;
-                }
-
-                if ( isset($this-&gt;errors[$code]) )
-                        return $this-&gt;errors[$code];
-                else
-                        return array();
-        }
-
-        /**
-         * Get single error message.
-         *
-         * This will get the first message available for the code. If no code is
-         * given then the first code available will be used.
-         *
-         * @since 2.1.0
-         *
-         * @param string|int $code Optional. Error code to retrieve message.
-         * @return string
-         */
-        function get_error_message($code = '') {
-                if ( empty($code) )
-                        $code = $this-&gt;get_error_code();
-                $messages = $this-&gt;get_error_messages($code);
-                if ( empty($messages) )
-                        return '';
-                return $messages[0];
-        }
-
-        /**
-         * Retrieve error data for error code.
-         *
-         * @since 2.1.0
-         *
-         * @param string|int $code Optional. Error code.
-         * @return mixed Null, if no errors.
-         */
-        function get_error_data($code = '') {
-                if ( empty($code) )
-                        $code = $this-&gt;get_error_code();
-
-                if ( isset($this-&gt;error_data[$code]) )
-                        return $this-&gt;error_data[$code];
-                return null;
-        }
-
-        /**
-         * Append more error messages to list of error messages.
-         *
-         * @since 2.1.0
-         * @access public
-         *
-         * @param string|int $code Error code.
-         * @param string $message Error message.
-         * @param mixed $data Optional. Error data.
-         */
-        function add($code, $message, $data = '') {
-                $this-&gt;errors[$code][] = $message;
-                if ( ! empty($data) )
-                        $this-&gt;error_data[$code] = $data;
-        }
-
-        /**
-         * Add data for error code.
-         *
-         * The error code can only contain one error data.
-         *
-         * @since 2.1.0
-         *
-         * @param mixed $data Error data.
-         * @param string|int $code Error code.
-         */
-        function add_data($data, $code = '') {
-                if ( empty($code) )
-                        $code = $this-&gt;get_error_code();
-
-                $this-&gt;error_data[$code] = $data;
-        }
-}
-
-/**
- * Check whether variable is a WordPress Error.
- *
- * Looks at the object and if a WP_Error class. Does not check to see if the
- * parent is also WP_Error, so can't inherit WP_Error and still use this
- * function.
- *
- * @since 2.1.0
- *
- * @param mixed $thing Check if unknown variable is WordPress Error object.
- * @return bool True, if WP_Error. False, if not WP_Error.
- */
-function is_wp_error($thing) {
-        if ( is_object($thing) &amp;&amp; is_a($thing, 'WP_Error') )
-                return true;
-        return false;
-}
-
-/**
- * A class for displaying various tree-like structures.
- *
- * Extend the Walker class to use it, see examples at the below. Child classes
- * do not need to implement all of the abstract methods in the class. The child
- * only needs to implement the methods that are needed. Also, the methods are
- * not strictly abstract in that the parameter definition needs to be followed.
- * The child classes can have additional parameters.
- *
- * @package WordPress
- * @since 2.1.0
- * @abstract
- */
-class Walker {
-        /**
-         * What the class handles.
-         *
-         * @since 2.1.0
-         * @var string
-         * @access public
-         */
-        var $tree_type;
-
-        /**
-         * DB fields to use.
-         *
-         * @since 2.1.0
-         * @var array
-         * @access protected
-         */
-        var $db_fields;
-
-        /**
-         * Max number of pages walked by the paged walker
-         *
-         * @since 2.7.0
-         * @var int
-         * @access protected
-         */
-        var $max_pages = 1;
-
-        /**
-         * Starts the list before the elements are added.
-         *
-         * Additional parameters are used in child classes. The args parameter holds
-         * additional values that may be used with the child class methods. This
-         * method is called at the start of the output list.
-         *
-         * @since 2.1.0
-         * @abstract
-         *
-         * @param string $output Passed by reference. Used to append additional content.
-         */
-        function start_lvl(&amp;$output) {}
-
-        /**
-         * Ends the list of after the elements are added.
-         *
-         * Additional parameters are used in child classes. The args parameter holds
-         * additional values that may be used with the child class methods. This
-         * method finishes the list at the end of output of the elements.
-         *
-         * @since 2.1.0
-         * @abstract
-         *
-         * @param string $output Passed by reference. Used to append additional content.
-         */
-        function end_lvl(&amp;$output)   {}
-
-        /**
-         * Start the element output.
-         *
-         * Additional parameters are used in child classes. The args parameter holds
-         * additional values that may be used with the child class methods. Includes
-         * the element output also.
-         *
-         * @since 2.1.0
-         * @abstract
-         *
-         * @param string $output Passed by reference. Used to append additional content.
-         */
-        function start_el(&amp;$output)  {}
-
-        /**
-         * Ends the element output, if needed.
-         *
-         * Additional parameters are used in child classes. The args parameter holds
-         * additional values that may be used with the child class methods.
-         *
-         * @since 2.1.0
-         * @abstract
-         *
-         * @param string $output Passed by reference. Used to append additional content.
-         */
-        function end_el(&amp;$output)    {}
-
-        /**
-         * Traverse elements to create list from elements.
-         *
-         * Display one element if the element doesn't have any children otherwise,
-         * display the element and its children. Will only traverse up to the max
-         * depth and no ignore elements under that depth. It is possible to set the
-         * max depth to include all depths, see walk() method.
-         *
-         * This method shouldn't be called directly, use the walk() method instead.
-         *
-         * @since 2.5.0
-         *
-         * @param object $element Data object
-         * @param array $children_elements List of elements to continue traversing.
-         * @param int $max_depth Max depth to traverse.
-         * @param int $depth Depth of current element.
-         * @param array $args
-         * @param string $output Passed by reference. Used to append additional content.
-         * @return null Null on failure with no changes to parameters.
-         */
-        function display_element( $element, &amp;$children_elements, $max_depth, $depth=0, $args, &amp;$output ) {
-
-                if ( !$element )
-                        return;
-
-                $id_field = $this-&gt;db_fields['id'];
-
-                //display this element
-                if ( is_array( $args[0] ) )
-                        $args[0]['has_children'] = ! empty( $children_elements[$element-&gt;$id_field] );
-                $cb_args = array_merge( array(&amp;$output, $element, $depth), $args);
-                call_user_func_array(array(&amp;$this, 'start_el'), $cb_args);
-
-                $id = $element-&gt;$id_field;
-
-                // descend only when the depth is right and there are childrens for this element
-                if ( ($max_depth == 0 || $max_depth &gt; $depth+1 ) &amp;&amp; isset( $children_elements[$id]) ) {
-
-                        foreach( $children_elements[ $id ] as $child ){
-
-                                if ( !isset($newlevel) ) {
-                                        $newlevel = true;
-                                        //start the child delimiter
-                                        $cb_args = array_merge( array(&amp;$output, $depth), $args);
-                                        call_user_func_array(array(&amp;$this, 'start_lvl'), $cb_args);
-                                }
-                                $this-&gt;display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
-                        }
-                        unset( $children_elements[ $id ] );
-                }
-
-                if ( isset($newlevel) &amp;&amp; $newlevel ){
-                        //end the child delimiter
-                        $cb_args = array_merge( array(&amp;$output, $depth), $args);
-                        call_user_func_array(array(&amp;$this, 'end_lvl'), $cb_args);
-                }
-
-                //end this element
-                $cb_args = array_merge( array(&amp;$output, $element, $depth), $args);
-                call_user_func_array(array(&amp;$this, 'end_el'), $cb_args);
-        }
-
-        /**
-         * Display array of elements hierarchically.
-         *
-         * It is a generic function which does not assume any existing order of
-         * elements. max_depth = -1 means flatly display every element. max_depth =
-         * 0 means display all levels. max_depth &gt; 0  specifies the number of
-         * display levels.
-         *
-         * @since 2.1.0
-         *
-         * @param array $elements
-         * @param int $max_depth
-         * @return string
-         */
-        function walk( $elements, $max_depth) {
-
-                $args = array_slice(func_get_args(), 2);
-                $output = '';
-
-                if ($max_depth &lt; -1) //invalid parameter
-                        return $output;
-
-                if (empty($elements)) //nothing to walk
-                        return $output;
-
-                $id_field = $this-&gt;db_fields['id'];
-                $parent_field = $this-&gt;db_fields['parent'];
-
-                // flat display
-                if ( -1 == $max_depth ) {
-                        $empty_array = array();
-                        foreach ( $elements as $e )
-                                $this-&gt;display_element( $e, $empty_array, 1, 0, $args, $output );
-                        return $output;
-                }
-
-                /*
-                 * need to display in hierarchical order
-                 * separate elements into two buckets: top level and children elements
-                 * children_elements is two dimensional array, eg.
-                 * children_elements[10][] contains all sub-elements whose parent is 10.
-                 */
-                $top_level_elements = array();
-                $children_elements  = array();
-                foreach ( $elements as $e) {
-                        if ( 0 == $e-&gt;$parent_field )
-                                $top_level_elements[] = $e;
-                        else
-                                $children_elements[ $e-&gt;$parent_field ][] = $e;
-                }
-
-                /*
-                 * when none of the elements is top level
-                 * assume the first one must be root of the sub elements
-                 */
-                if ( empty($top_level_elements) ) {
-
-                        $first = array_slice( $elements, 0, 1 );
-                        $root = $first[0];
-
-                        $top_level_elements = array();
-                        $children_elements  = array();
-                        foreach ( $elements as $e) {
-                                if ( $root-&gt;$parent_field == $e-&gt;$parent_field )
-                                        $top_level_elements[] = $e;
-                                else
-                                        $children_elements[ $e-&gt;$parent_field ][] = $e;
-                        }
-                }
-
-                foreach ( $top_level_elements as $e )
-                        $this-&gt;display_element( $e, $children_elements, $max_depth, 0, $args, $output );
-
-                /*
-                 * if we are displaying all levels, and remaining children_elements is not empty,
-                 * then we got orphans, which should be displayed regardless
-                 */
-                if ( ( $max_depth == 0 ) &amp;&amp; count( $children_elements ) &gt; 0 ) {
-                        $empty_array = array();
-                        foreach ( $children_elements as $orphans )
-                                foreach( $orphans as $op )
-                                        $this-&gt;display_element( $op, $empty_array, 1, 0, $args, $output );
-                 }
-
-                 return $output;
-        }
-
-        /**
-          * paged_walk() - produce a page of nested elements
-          *
-          * Given an array of hierarchical elements, the maximum depth, a specific page number,
-          * and number of elements per page, this function first determines all top level root elements
-          * belonging to that page, then lists them and all of their children in hierarchical order.
-          *
-          * @package WordPress
-          * @since 2.7
-          * @param int $max_depth = 0 means display all levels; $max_depth &gt; 0 specifies the number of display levels.
-          * @param int $page_num the specific page number, beginning with 1.
-          * @return XHTML of the specified page of elements
-          */
-        function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
-
-                /* sanity check */
-                if ( empty($elements) || $max_depth &lt; -1 )
-                        return '';
-
-                $args = array_slice( func_get_args(), 4 );
-                $output = '';
-
-                $id_field = $this-&gt;db_fields['id'];
-                $parent_field = $this-&gt;db_fields['parent'];
-
-                $count = -1;
-                if ( -1 == $max_depth )
-                        $total_top = count( $elements );
-                if ( $page_num &lt; 1 || $per_page &lt; 0  ) {
-                        // No paging
-                        $paging = false;
-                        $start = 0;
-                        if ( -1 == $max_depth )
-                                $end = $total_top;
-                        $this-&gt;max_pages = 1;
-                } else {
-                        $paging = true;
-                        $start = ( (int)$page_num - 1 ) * (int)$per_page;
-                        $end   = $start + $per_page;
-                        if ( -1 == $max_depth )
-                                $this-&gt;max_pages = ceil($total_top / $per_page);
-                }
-
-                // flat display
-                if ( -1 == $max_depth ) {
-                        if ( !empty($args[0]['reverse_top_level']) ) {
-                                $elements = array_reverse( $elements );
-                                $oldstart = $start;
-                                $start = $total_top - $end;
-                                $end = $total_top - $oldstart;
-                        }
-
-                        $empty_array = array();
-                        foreach ( $elements as $e ) {
-                                $count++;
-                                if ( $count &lt; $start )
-                                        continue;
-                                if ( $count &gt;= $end )
-                                        break;
-                                $this-&gt;display_element( $e, $empty_array, 1, 0, $args, $output );
-                        }
-                        return $output;
-                }
-
-                /*
-                 * separate elements into two buckets: top level and children elements
-                 * children_elements is two dimensional array, eg.
-                 * children_elements[10][] contains all sub-elements whose parent is 10.
-                 */
-                $top_level_elements = array();
-                $children_elements  = array();
-                foreach ( $elements as $e) {
-                        if ( 0 == $e-&gt;$parent_field )
-                                $top_level_elements[] = $e;
-                        else
-                                $children_elements[ $e-&gt;$parent_field ][] = $e;
-                }
-
-                $total_top = count( $top_level_elements );
-                if ( $paging )
-                        $this-&gt;max_pages = ceil($total_top / $per_page);
-                else
-                        $end = $total_top;
-
-                if ( !empty($args[0]['reverse_top_level']) ) {
-                        $top_level_elements = array_reverse( $top_level_elements );
-                        $oldstart = $start;
-                        $start = $total_top - $end;
-                        $end = $total_top - $oldstart;
-                }
-                if ( !empty($args[0]['reverse_children']) ) {
-                        foreach ( $children_elements as $parent =&gt; $children )
-                                $children_elements[$parent] = array_reverse( $children );
-                }
-
-                foreach ( $top_level_elements as $e ) {
-                        $count++;
-
-                        //for the last page, need to unset earlier children in order to keep track of orphans
-                        if ( $end &gt;= $total_top &amp;&amp; $count &lt; $start )
-                                        $this-&gt;unset_children( $e, $children_elements );
-
-                        if ( $count &lt; $start )
-                                continue;
-
-                        if ( $count &gt;= $end )
-                                break;
-
-                        $this-&gt;display_element( $e, $children_elements, $max_depth, 0, $args, $output );
-                }
-
-                if ( $end &gt;= $total_top &amp;&amp; count( $children_elements ) &gt; 0 ) {
-                        $empty_array = array();
-                        foreach ( $children_elements as $orphans )
-                                foreach( $orphans as $op )
-                                        $this-&gt;display_element( $op, $empty_array, 1, 0, $args, $output );
-                }
-
-                return $output;
-        }
-
-        function get_number_of_root_elements( $elements ){
-
-                $num = 0;
-                $parent_field = $this-&gt;db_fields['parent'];
-
-                foreach ( $elements as $e) {
-                        if ( 0 == $e-&gt;$parent_field )
-                                $num++;
-                }
-                return $num;
-        }
-
-        // unset all the children for a given top level element
-        function unset_children( $e, &amp;$children_elements ){
-
-                if ( !$e || !$children_elements )
-                        return;
-
-                $id_field = $this-&gt;db_fields['id'];
-                $id = $e-&gt;$id_field;
-
-                if ( !empty($children_elements[$id]) &amp;&amp; is_array($children_elements[$id]) )
-                        foreach ( (array) $children_elements[$id] as $child )
-                                $this-&gt;unset_children( $child, $children_elements );
-
-                if ( isset($children_elements[$id]) )
-                        unset( $children_elements[$id] );
-
-        }
-}
-
-/**
</del><span class="cx">  * Create HTML list of pages.
</span><span class="cx">  *
</span><span class="cx">  * @package WordPress
</span><span class="lines">@@ -1472,230 +359,4 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/**
- * Send XML response back to AJAX request.
- *
- * @package WordPress
- * @since 2.1.0
- */
-class WP_Ajax_Response {
-        /**
-         * Store XML responses to send.
-         *
-         * @since 2.1.0
-         * @var array
-         * @access private
-         */
-        var $responses = array();
-
-        /**
-         * PHP4 Constructor - Passes args to {@link WP_Ajax_Response::add()}.
-         *
-         * @since 2.1.0
-         * @see WP_Ajax_Response::add()
-         *
-         * @param string|array $args Optional. Will be passed to add() method.
-         * @return WP_Ajax_Response
-         */
-        function WP_Ajax_Response( $args = '' ) {
-                if ( !empty($args) )
-                        $this-&gt;add($args);
-        }
-
-        /**
-         * Append to XML response based on given arguments.
-         *
-         * The arguments that can be passed in the $args parameter are below. It is
-         * also possible to pass a WP_Error object in either the 'id' or 'data'
-         * argument. The parameter isn't actually optional, content should be given
-         * in order to send the correct response.
-         *
-         * 'what' argument is a string that is the XMLRPC response type.
-         * 'action' argument is a boolean or string that acts like a nonce.
-         * 'id' argument can be WP_Error or an integer.
-         * 'old_id' argument is false by default or an integer of the previous ID.
-         * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
-         * html ID = after, -html ID = before.
-         * 'data' argument is a string with the content or message.
-         * 'supplemental' argument is an array of strings that will be children of
-         * the supplemental element.
-         *
-         * @since 2.1.0
-         *
-         * @param string|array $args Override defaults.
-         * @return string XML response.
-         */
-        function add( $args = '' ) {
-                $defaults = array(
-                        'what' =&gt; 'object', 'action' =&gt; false,
-                        'id' =&gt; '0', 'old_id' =&gt; false,
-                        'position' =&gt; 1,
-                        'data' =&gt; '', 'supplemental' =&gt; array()
-                );
-
-                $r = wp_parse_args( $args, $defaults );
-                extract( $r, EXTR_SKIP );
-                $position = preg_replace( '/[^a-z0-9:_-]/i', '', $position );
-
-                if ( is_wp_error($id) ) {
-                        $data = $id;
-                        $id = 0;
-                }
-
-                $response = '';
-                if ( is_wp_error($data) ) {
-                        foreach ( (array) $data-&gt;get_error_codes() as $code ) {
-                                $response .= &quot;&lt;wp_error code='$code'&gt;&lt;![CDATA[&quot; . $data-&gt;get_error_message($code) . &quot;]]&gt;&lt;/wp_error&gt;&quot;;
-                                if ( !$error_data = $data-&gt;get_error_data($code) )
-                                        continue;
-                                $class = '';
-                                if ( is_object($error_data) ) {
-                                        $class = ' class=&quot;' . get_class($error_data) . '&quot;';
-                                        $error_data = get_object_vars($error_data);
-                                }
-
-                                $response .= &quot;&lt;wp_error_data code='$code'$class&gt;&quot;;
-
-                                if ( is_scalar($error_data) ) {
-                                        $response .= &quot;&lt;![CDATA[$error_data]]&gt;&quot;;
-                                } elseif ( is_array($error_data) ) {
-                                        foreach ( $error_data as $k =&gt; $v )
-                                                $response .= &quot;&lt;$k&gt;&lt;![CDATA[$v]]&gt;&lt;/$k&gt;&quot;;
-                                }
-
-                                $response .= &quot;&lt;/wp_error_data&gt;&quot;;
-                        }
-                } else {
-                        $response = &quot;&lt;response_data&gt;&lt;![CDATA[$data]]&gt;&lt;/response_data&gt;&quot;;
-                }
-
-                $s = '';
-                if ( is_array($supplemental) ) {
-                        foreach ( $supplemental as $k =&gt; $v )
-                                $s .= &quot;&lt;$k&gt;&lt;![CDATA[$v]]&gt;&lt;/$k&gt;&quot;;
-                        $s = &quot;&lt;supplemental&gt;$s&lt;/supplemental&gt;&quot;;
-                }
-
-                if ( false === $action )
-                        $action = $_POST['action'];
-
-                $x = '';
-                $x .= &quot;&lt;response action='{$action}_$id'&gt;&quot;; // The action attribute in the xml output is formatted like a nonce action
-                $x .=        &quot;&lt;$what id='$id' &quot; . ( false === $old_id ? '' : &quot;old_id='$old_id' &quot; ) . &quot;position='$position'&gt;&quot;;
-                $x .=                $response;
-                $x .=                $s;
-                $x .=        &quot;&lt;/$what&gt;&quot;;
-                $x .= &quot;&lt;/response&gt;&quot;;
-
-                $this-&gt;responses[] = $x;
-                return $x;
-        }
-
-        /**
-         * Display XML formatted responses.
-         *
-         * Sets the content type header to text/xml.
-         *
-         * @since 2.1.0
-         */
-        function send() {
-                header('Content-Type: text/xml');
-                echo &quot;&lt;?xml version='1.0' standalone='yes'?&gt;&lt;wp_ajax&gt;&quot;;
-                foreach ( (array) $this-&gt;responses as $response )
-                        echo $response;
-                echo '&lt;/wp_ajax&gt;';
-                die();
-        }
-}
-
-/**
- * Helper class to remove the need to use eval to replace $matches[] in query strings.
- *
- * @since 2.9.0
- */
-class WP_MatchesMapRegex {
-        /**
-         * store for matches
-         *
-         * @access private
-         * @var array
-         */
-        var $_matches;
-
-        /**
-         * store for mapping result
-         *
-         * @access public
-         * @var string
-         */
-        var $output;
-
-        /**
-         * subject to perform mapping on (query string containing $matches[] references
-         *
-         * @access private
-         * @var string
-         */
-        var $_subject;
-
-        /**
-         * regexp pattern to match $matches[] references
-         *
-         * @var string
-         */
-        var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
-
-        /**
-         * constructor
-         *
-         * @param string $subject subject if regex
-         * @param array  $matches data to use in map
-         * @return self
-         */
-        function WP_MatchesMapRegex($subject, $matches) {
-                $this-&gt;_subject = $subject;
-                $this-&gt;_matches = $matches;
-                $this-&gt;output = $this-&gt;_map();
-        }
-
-        /**
-         * Substitute substring matches in subject.
-         *
-         * static helper function to ease use
-         *
-         * @access public
-         * @param string $subject subject
-         * @param array  $matches data used for subsitution
-         * @return string
-         */
-        function apply($subject, $matches) {
-                $oSelf =&amp; new WP_MatchesMapRegex($subject, $matches);
-                return $oSelf-&gt;output;
-        }
-
-        /**
-         * do the actual mapping
-         *
-         * @access private
-         * @return string
-         */
-        function _map() {
-                $callback = array(&amp;$this, 'callback');
-                return preg_replace_callback($this-&gt;_pattern, $callback, $this-&gt;_subject);
-        }
-
-        /**
-         * preg_replace_callback hook
-         *
-         * @access public
-         * @param  array $matches preg_replace regexp matches
-         * @return string
-         */
-        function callback($matches) {
-                $index = intval(substr($matches[0], 9, -1));
-                return ( isset( $this-&gt;_matches[$index] ) ? urlencode($this-&gt;_matches[$index]) : '' );
-        }
-
-}
-
</del><span class="cx"> ?&gt;
</span></span></pre></div>
<a id="trunkwploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-load.php (16098 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-load.php        2010-10-30 06:40:04 UTC (rev 16098)
+++ trunk/wp-load.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">                 $path = 'wp-admin/';
</span><span class="cx"> 
</span><span class="cx">         // Die with an error message
</span><del>-        require_once( ABSPATH . '/wp-includes/classes.php' );
</del><ins>+        require_once( ABSPATH . '/wp-includes/class-wp-error.php' );
</ins><span class="cx">         require_once( ABSPATH . '/wp-includes/functions.php' );
</span><span class="cx">         require_once( ABSPATH . '/wp-includes/plugin.php' );
</span><span class="cx">         $text_direction = /*WP_I18N_TEXT_DIRECTION*/&quot;ltr&quot;/*/WP_I18N_TEXT_DIRECTION*/;
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (16098 => 16099)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2010-10-30 06:40:04 UTC (rev 16098)
+++ trunk/wp-settings.php        2010-10-30 07:02:06 UTC (rev 16099)
</span><span class="lines">@@ -65,7 +65,11 @@
</span><span class="cx"> // Load early WordPress files.
</span><span class="cx"> require( ABSPATH . WPINC . '/compat.php' );
</span><span class="cx"> require( ABSPATH . WPINC . '/functions.php' );
</span><ins>+require( ABSPATH . WPINC . '/class-wp.php' );
+require( ABSPATH . WPINC . '/class-wp-error.php' );
+require( ABSPATH . WPINC . '/class-wp-walker.php' );
</ins><span class="cx"> require( ABSPATH . WPINC . '/classes.php' );
</span><ins>+require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
</ins><span class="cx"> require( ABSPATH . WPINC . '/plugin.php' );
</span><span class="cx"> 
</span><span class="cx"> // Include the wpdb class and, if present, a db.php database drop-in.
</span></span></pre>
</div>
</div>

</body>
</html>