diff options
Diffstat (limited to 'wp-includes/classes.php')
| -rw-r--r-- | wp-includes/classes.php | 70 |
1 files changed, 47 insertions, 23 deletions
diff --git a/wp-includes/classes.php b/wp-includes/classes.php index f2d823f..bf6caba 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -8,7 +8,7 @@ class retrospam_mgr { function retrospam_mgr() { global $wpdb; - $list = explode("\n", get_settings('moderation_keys') ); + $list = explode("\n", get_option('moderation_keys') ); $list = array_unique( $list ); $this->spam_words = $list; @@ -94,7 +94,9 @@ class WP { $this->query_vars = array(); - if (! empty($extra_query_vars)) + if ( is_array($extra_query_vars) ) + $this->extra_query_vars = & $extra_query_vars; + else if (! empty($extra_query_vars)) parse_str($extra_query_vars, $this->extra_query_vars); // Process PATH_INFO, REQUEST_URI, and 404 for permalinks. @@ -114,7 +116,7 @@ class WP { $req_uri_array = explode('?', $req_uri); $req_uri = $req_uri_array[0]; $self = $_SERVER['PHP_SELF']; - $home_path = parse_url(get_settings('home')); + $home_path = parse_url(get_option('home')); $home_path = $home_path['path']; $home_path = trim($home_path, '/'); @@ -212,19 +214,20 @@ class WP { $this->query_vars[$wpvar] = $_GET[$wpvar]; elseif (!empty($perma_query_vars[$wpvar])) $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; - else - $this->query_vars[$wpvar] = ''; } - for ($i=0; $i<count($this->private_query_vars); $i += 1) { - $wpvar = $this->private_query_vars[$i]; - if (isset($this->extra_query_vars[$wpvar])) - $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar]; + foreach ($this->private_query_vars as $var) { + if (isset($this->extra_query_vars[$var])) + $this->query_vars[$var] = $this->extra_query_vars[$var]; + elseif (isset($GLOBALS[$var]) && '' != $GLOBALS[$var]) + $this->query_vars[$var] = $GLOBALS[$var]; } if ( isset($error) ) $this->query_vars['error'] = $error; + $this->query_vars = apply_filters('request', $this->query_vars); + do_action('parse_request', array(&$this)); } @@ -272,7 +275,6 @@ class WP { function build_query_string() { $this->query_string = ''; - foreach (array_keys($this->query_vars) as $wpvar) { if ( '' != $this->query_vars[$wpvar] ) { $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; @@ -280,14 +282,12 @@ class WP { } } - foreach ($this->private_query_vars as $wpvar) { - if (isset($GLOBALS[$wpvar]) && '' != $GLOBALS[$wpvar] && ! isset($this->extra_query_vars[$wpvar]) ) { - $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; - $this->query_string .= $wpvar . '=' . rawurlencode($GLOBALS[$wpvar]); - } + // query_string filter deprecated. Use request filter instead. + global $wp_filter; + if ( isset($wp_filter['query_string']) ) { // Don't bother filtering and parsing if no plugins are hooked in. + $this->query_string = apply_filters('query_string', $this->query_string); + parse_str($this->query_string, $this->query_vars); } - - $this->query_string = apply_filters('query_string', $this->query_string); } function register_globals() { @@ -314,7 +314,7 @@ class WP { function query_posts() { $this->build_query_string(); - query_posts($this->query_string); + query_posts($this->query_vars); } function handle_404() { @@ -348,10 +348,16 @@ class WP { class WP_Error { var $errors = array(); + var $error_data = array(); + + function WP_Error($code = '', $message = '', $data = '') { + if ( empty($code) ) + return; + + $this->errors[$code][] = $message; - function WP_Error($code = '', $message = '') { - if ( ! empty($code) ) - $this->errors[$code][] = $message; + if ( ! empty($data) ) + $this->error_data[$code] = $data; } function get_error_codes() { @@ -395,8 +401,26 @@ class WP_Error { return $messages[0]; } - function add($code, $message) { - $this->errors[$code][] = $message; + function get_error_data($code = '') { + if ( empty($code) ) + $code = $this->get_error_code(); + + if ( isset($this->error_data[$code]) ) + return $this->error_data[$code]; + return null; + } + + function add($code, $message, $data = '') { + $this->errors[$code][] = $message; + if ( ! empty($data) ) + $this->error_data[$code] = $data; + } + + function add_data($data, $code = '') { + if ( empty($code) ) + $code = $this->get_error_code(); + + $this->error_data[$code] = $data; } } |
