diff options
Diffstat (limited to 'wp-includes')
-rw-r--r-- | wp-includes/cache.php | 13 | ||||
-rw-r--r-- | wp-includes/functions.php | 6 | ||||
-rw-r--r-- | wp-includes/general-template.php | 4 | ||||
-rw-r--r-- | wp-includes/js/autosave-js.php (renamed from wp-includes/js/autosave.js.php) | 0 | ||||
-rw-r--r-- | wp-includes/locale.php | 16 | ||||
-rw-r--r-- | wp-includes/post-template.php | 7 | ||||
-rw-r--r-- | wp-includes/post.php | 38 | ||||
-rw-r--r-- | wp-includes/script-loader.php | 27 | ||||
-rw-r--r-- | wp-includes/wp-db.php | 22 |
9 files changed, 83 insertions, 50 deletions
diff --git a/wp-includes/cache.php b/wp-includes/cache.php index 6880624..b4c5b89 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -8,6 +8,8 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) { function wp_cache_close() {
global $wp_object_cache;
+ if ( ! isset($wp_object_cache) )
+ return;
return $wp_object_cache->save();
}
@@ -415,8 +417,14 @@ class WP_Object_Cache { }
function WP_Object_Cache() {
+ return $this->__construct();
+ }
+
+ function __construct() {
global $blog_id;
+ register_shutdown_function(array(&$this, "__destruct"));
+
if (defined('DISABLE_CACHE'))
return;
@@ -451,5 +459,10 @@ class WP_Object_Cache { $this->blog_id = $this->hash($blog_id);
}
+
+ function __destruct() {
+ $this->save();
+ return true;
+ }
}
?>
diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 102f12d..4f103e9 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -833,10 +833,10 @@ function status_header( $header ) { elseif ( 410 == $header ) $text = 'Gone'; - if ( substr(php_sapi_name(), 0, 3) == 'cgi' ) +// if ( substr(php_sapi_name(), 0, 3) == 'cgi' ) @header("HTTP/1.1 $header $text"); - else - @header("Status: $header $text"); +// else +// @header("Status: $header $text"); } function nocache_headers() { diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 9032c79..69470db 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -818,8 +818,10 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { <input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('Code'); ?>' onclick='switchEditors("<?php echo $id; ?>")' /> </div> <script type="text/javascript"> + // <![CDATA[ if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 ) document.getElementById('edButtons').style.display = 'block'; + // ]]> </script> <?php endif; ?> @@ -828,6 +830,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { <script type="text/javascript">edToolbar()</script> </div> <script type="text/javascript"> + // <![CDATA[ if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 ) document.getElementById("quicktags").style.display="none"; @@ -854,6 +857,7 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { myField.focus(); } } + // ]]> </script> <?php diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave-js.php index 67fcde7..67fcde7 100644 --- a/wp-includes/js/autosave.js.php +++ b/wp-includes/js/autosave-js.php diff --git a/wp-includes/locale.php b/wp-includes/locale.php index 4b6c654..11903fc 100644 --- a/wp-includes/locale.php +++ b/wp-includes/locale.php @@ -87,20 +87,12 @@ class WP_Locale { $this->meridiem['AM'] = __('AM'); $this->meridiem['PM'] = __('PM'); - $this->_load_locale_data(); - } - - function _load_locale_data() { - $locale = get_locale(); - $locale_file = ABSPATH . "wp-includes/languages/$locale.php"; - if ( !file_exists($locale_file) ) - return; - - include($locale_file); - + // Import global locale vars set during inclusion of $locale.php. foreach ( $this->locale_vars as $var ) { - $this->$var = $$var; + if ( isset($GLOBALS[$var]) ) + $this->$var = $GLOBALS[$var]; } + } function get_weekday($weekday_number) { diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 443f0c6..5ecebd9 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -378,7 +378,7 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { if ( !$post = & get_post($id) ) return false; - if ( !$src = get_attachment_icon_src( $id, $fullsize ) ) + if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) return false; list($src, $src_file) = $src; @@ -415,11 +415,12 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { $id = (int) $id; + if ( !$post = & get_post($id) ) + return false; - if ( $innerHTML = get_attachment_icon($id, $fullsize, $max_dims)) + if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) return $innerHTML; - $post = & get_post($id); $innerHTML = attribute_escape($post->post_title); diff --git a/wp-includes/post.php b/wp-includes/post.php index 904b2ee..c3d3b6a 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1404,26 +1404,28 @@ function wp_delete_attachment($postid) { function wp_get_attachment_metadata( $post_id, $unfiltered = false ) { $post_id = (int) $post_id; + if ( !$post =& get_post( $post_id ) ) + return false; - $data = get_post_meta( $post_id, '_wp_attachment_metadata', true ); + $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); if ( $unfiltered ) return $data; - return apply_filters( 'wp_get_attachment_metadata', $data, $post_id ); + return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); } function wp_update_attachment_metadata( $post_id, $data ) { $post_id = (int) $post_id; - if ( !get_post( $post_id ) ) + if ( !$post =& get_post( $post_id ) ) return false; - $old_data = wp_get_attachment_metadata( $post_id, true ); + $old_data = wp_get_attachment_metadata( $post->ID, true ); - $data = apply_filters( 'wp_update_attachment_metadata', $data, $post_id ); + $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); if ( $old_data ) - return update_post_meta( $post_id, '_wp_attachment_metadata', $data, $old_data ); + return update_post_meta( $post->ID, '_wp_attachment_metadata', $data, $old_data ); else - return add_post_meta( $post_id, '_wp_attachment_metadata', $data ); + return add_post_meta( $post->ID, '_wp_attachment_metadata', $data ); } function wp_get_attachment_url( $post_id = 0 ) { @@ -1431,37 +1433,41 @@ function wp_get_attachment_url( $post_id = 0 ) { if ( !$post =& get_post( $post_id ) ) return false; - $url = get_the_guid( $post_id ); + $url = get_the_guid( $post->ID ); if ( 'attachment' != $post->post_type || !$url ) return false; - return apply_filters( 'wp_get_attachment_url', $url, $post_id ); + return apply_filters( 'wp_get_attachment_url', $url, $post->ID ); } -function wp_get_attachment_thumb_file( $post_id ) { +function wp_get_attachment_thumb_file( $post_id = 0 ) { $post_id = (int) $post_id; - if ( !$imagedata = wp_get_attachment_metadata( $post_id ) ) + if ( !$post =& get_post( $post_id ) ) + return false; + if ( !$imagedata = wp_get_attachment_metadata( $post->ID ) ) return false; - $file = get_attached_file( $post_id ); + $file = get_attached_file( $post->ID ); if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) - return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post_id ); + return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID ); return false; } function wp_get_attachment_thumb_url( $post_id = 0 ) { $post_id = (int) $post_id; - if ( !$url = wp_get_attachment_url( $post_id ) ) + if ( !$post =& get_post( $post_id ) ) + return false; + if ( !$url = wp_get_attachment_url( $post->ID ) ) return false; - if ( !$thumb = wp_get_attachment_thumb_file( $post_id ) ) + if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) ) return false; $url = str_replace(basename($url), basename($thumb), $url); - return apply_filters( 'wp_get_attachment_thumb_url', $url, $post_id ); + return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID ); } function wp_attachment_is_image( $post_id = 0 ) { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index cc6c7aa..43e076d 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -19,13 +19,16 @@ class WP_Scripts { $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061113' ); $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); - $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4508'); + $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '4508'); $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459'); $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4583'); - $this->add( 'scriptaculous', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.6.1'); - $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/scriptaculous.js?load=builder,dragdrop', array('prototype'), '1.6.1'); - $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/scriptaculous.js?load=slider,effects', array('prototype'), '1.6.1'); - $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/scriptaculous.js?load=controls', array('prototype'), '1.6.1'); + $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.6.1'); + $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.6.1'); + $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder'), '1.6.1'); + $this->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.6.1'); + $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.6.1'); + $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.6.1'); + $this->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.6.1'); $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '1'); if ( is_admin() ) { $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); @@ -70,12 +73,14 @@ class WP_Scripts { elseif ( is_array($handles[$handle]) ) $this->_print_scripts( $handles[$handle] ); if ( !in_array($handle, $this->printed) && isset($this->scripts[$handle]) ) { - $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version; - if ( isset($this->args[$handle]) ) - $ver .= '&' . $this->args[$handle]; - $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src; - $src = add_query_arg('ver', $ver, $src); - echo "<script type='text/javascript' src='$src'></script>\n"; + if ( $this->scripts[$handle]->src ) { // Else it defines a group. + $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version; + if ( isset($this->args[$handle]) ) + $ver .= '&' . $this->args[$handle]; + $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src; + $src = add_query_arg('ver', $ver, $src); + echo "<script type='text/javascript' src='$src'></script>\n"; + } $this->printed[] = $handle; } } diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index ceab53f..1ed50b4 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -45,11 +45,13 @@ class wpdb { * @param string $dbhost */ function wpdb($dbuser, $dbpassword, $dbname, $dbhost) { - - if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) { + if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) $this->db_connect(); - return true; - } + return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost); + } + + function __construct($dbuser, $dbpassword, $dbname, $dbhost) { + register_shutdown_function(array(&$this, "__destruct")); $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword); if (!$this->dbh) { @@ -68,6 +70,10 @@ class wpdb { $this->select($dbname, $this->dbh); } + function __destruct() { + return true; + } + /** * Selects a database using the current class's $this->dbh * @param string $db name @@ -420,6 +426,12 @@ class wpdb { return false; header('Content-Type: text/html; charset=utf-8'); + + if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) + $admin_dir = ''; + else + $admin_dir = 'wp-admin/'; + ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> @@ -465,7 +477,7 @@ class wpdb { </style> </head> <body> - <h1 id="logo"><img alt="WordPress" src="<?php echo "wp-admin/images/wordpress-logo.png" ?>/></h1> + <h1 id="logo"><img alt="WordPress" src="<?php echo $admin_dir; ?>images/wordpress-logo.png" /></h1> <p><?php echo $message; ?></p> </body> </html> |