summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-20 10:56:56 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-20 10:56:56 +0000
commit9336db3a63ff73ea10fb075df21be226a64629f3 (patch)
tree2b8d73ef4e2e78559165410171b6d64db8267d8b /wp-includes
parentfdbaa07fe5fd78cd691aba3dd32d9222bfdb0a9f (diff)
wp merge to rev 4896
Ryan's nooption fixes jquery filename is different git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@890 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/classes.php2
-rw-r--r--wp-includes/formatting.php3
-rw-r--r--wp-includes/functions.php83
-rw-r--r--wp-includes/script-loader.php1
4 files changed, 57 insertions, 32 deletions
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index 931eb43..223780f 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -58,7 +58,7 @@ class WP {
// 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 = str_replace($pathinfo, '', urldecode($req_uri));
$req_uri = trim($req_uri, '/');
$req_uri = preg_replace("|^$home_path|", '', $req_uri);
$req_uri = trim($req_uri, '/');
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 26b8158..dad5e78 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -63,7 +63,6 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
- $pee = preg_replace( '|<p>(<div[^>]*>\s*)|', "$1<p>", $pee );
$pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
$pee = preg_replace( '|<p>|', "$1<p>", $pee );
$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
@@ -82,7 +81,7 @@ function wpautop($pee, $br = 1) {
if ( strstr( $pee, '<pre' ) )
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
-/**/
+
return $pee;
}
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index afd5470..0a43602 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -208,7 +208,12 @@ function get_option($setting) {
if ( $pre )
return $pre;
- if ( $switched == false && defined('WP_INSTALLING') == false ) {
+ if ( $switched != false || defined('WP_INSTALLING') != false ) {
+ wp_cache_delete($setting, 'options');
+ wp_cache_delete('notoptions', 'options');
+ wp_cache_delete('alloptions', 'options');
+ }
+
// prevent non-existent options from triggering multiple queries
$notoptions = wp_cache_get('notoptions', 'options');
if ( isset($notoptions[$setting]) )
@@ -220,33 +225,22 @@ function get_option($setting) {
$value = $alloptions[$setting];
} else {
$value = wp_cache_get($setting, 'options');
- }
- } else {
- $value = false;
- wp_cache_delete($setting, 'options');
- }
-// Uncomment if we get any page not found or rewrite errors
-// if( $setting == 'rewrite_rules' )
-// $value = false;
- if ( $value == 'novalueindb' )
- return false;
- if ( $value == 'emptystringindb' )
- return '';
-
- if ( false === $value ) {
- if ( defined('WP_INSTALLING') )
- $wpdb->hide_errors();
- $row = $wpdb->get_row("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting' LIMIT 1");
- if ( defined('WP_INSTALLING') )
- $wpdb->show_errors();
-
- if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
- $value = $row->option_value;
+
+ if ( false === $value ) {
+ if ( defined('WP_INSTALLING') )
+ $wpdb->hide_errors();
+ $row = $wpdb->get_row("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting' LIMIT 1");
+ if ( defined('WP_INSTALLING') )
+ $wpdb->show_errors();
+
+ if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
+ $value = $row->option_value;
wp_cache_set($setting, $value, 'options');
} else { // option does not exist, so we must cache its non-existence
$notoptions[$setting] = true;
wp_cache_set('notoptions', $notoptions, 'options');
return false;
+ }
}
}
@@ -259,6 +253,7 @@ function get_option($setting) {
if (! unserialize($value) )
$value = stripslashes( $value );
+
return apply_filters( 'option_' . $setting, maybe_unserialize($value) );
}
@@ -399,7 +394,14 @@ function delete_option($name) {
// Get the ID, if no ID then return
$option = $wpdb->get_row("SELECT option_id, autoload FROM $wpdb->options WHERE option_name = '$name'");
- if ( !$option->option_id ) return false;
+ if ( !$option->option_id ) {
+ $alloptions = wp_load_alloptions();
+ if ( isset($alloptions[$name]) ) {
+ unset($alloptions[$name]);
+ wp_cache_set('alloptions', $alloptions, 'options');
+ }
+ return false;
+ }
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = '$name'");
if ( 'yes' == $option->autoload ) {
$alloptions = wp_load_alloptions();
@@ -407,9 +409,10 @@ function delete_option($name) {
unset($alloptions[$name]);
wp_cache_set('alloptions', $alloptions, 'options');
}
- } else {
- wp_cache_delete($name, 'options');
}
+
+ wp_cache_delete($name, 'options');
+
return true;
}
@@ -1309,9 +1312,31 @@ function wp_nonce_ays($action) {
wp_die($html, $title);
}
-function wp_die($message, $title = '') {
+function wp_die( $message, $title = '' ) {
global $wp_locale;
+ if ( is_wp_error( $message ) ) {
+ if ( empty($title) ) {
+ $error_data = $message->get_error_data();
+ if ( is_array($error_data) && isset($error_data['title']) )
+ $title = $error_data['title'];
+ }
+ $errors = $message->get_error_messages();
+ switch ( count($errors) ) :
+ case 0 :
+ $message = '';
+ break;
+ case 1 :
+ $message = "<p>{$errors[0]}</p>";
+ break;
+ default :
+ $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
+ break;
+ endswitch;
+ } elseif ( is_string($message) ) {
+ $message = "<p>$message</p>";
+ }
+
header('Content-Type: text/html; charset=utf-8');
if ( empty($title) )
@@ -1335,11 +1360,11 @@ function wp_die($message, $title = '') {
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="<?php echo $admin_dir; ?>images/wordpress-logo.png" /></h1>
- <p><?php echo $message; ?></p>
+ <?php echo $message; ?>
+
</body>
</html>
<?php
-
die();
}
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 983556b..7ecbc21 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -39,6 +39,7 @@ class WP_Scripts {
$this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' );
$this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' );
$this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '20070118' );
+ $this->add( 'jquery', '/wp-includes/js/jquery-latest.pack.js', false, '1.0.3' );
}
}