From 72e9496bfc2f7a962cf4f428ccab25c7a0175aaa Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 16 Jan 2007 21:27:04 +0000 Subject: WP Merge to rev 4753 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@849 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/admin-db.php | 7 ++++--- wp-admin/admin-functions.php | 10 +++++----- wp-admin/link-import.php | 2 +- wp-admin/options-discussion.php | 2 +- wp-admin/upgrade-functions.php | 13 +++++++++++-- wp-admin/upload-js.php | 12 ++++++------ wp-includes/category.php | 4 ++-- wp-includes/classes.php | 6 ++++-- wp-includes/deprecated.php | 15 +++++++++++++++ wp-includes/functions.php | 18 +++++++++++++++--- wp-includes/gettext.php | 6 +++++- wp-includes/js/tinymce/plugins/autosave/langs/cs.js | 0 wp-includes/js/tinymce/plugins/autosave/langs/sv.js | 0 .../tinymce/plugins/inlinepopups/editor_plugin_src.js | 0 wp-includes/js/tinymce/plugins/inlinepopups/readme.txt | 0 wp-includes/js/tinymce/plugins/paste/editor_plugin.js | 1 - wp-includes/js/tinymce/tiny_mce_config.php | 4 ---- wp-includes/js/tinymce/wp-mce-help.php | 2 +- wp-includes/post-template.php | 5 +++-- wp-includes/post.php | 4 ++-- wp-includes/registration-functions.php | 4 ++++ wp-includes/rss-functions.php | 4 ++++ wp-includes/script-loader.php | 7 ++----- 23 files changed, 85 insertions(+), 41 deletions(-) delete mode 100644 wp-includes/js/tinymce/plugins/autosave/langs/cs.js delete mode 100644 wp-includes/js/tinymce/plugins/autosave/langs/sv.js delete mode 100644 wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js delete mode 100644 wp-includes/js/tinymce/plugins/inlinepopups/readme.txt create mode 100644 wp-includes/registration-functions.php create mode 100644 wp-includes/rss-functions.php diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index 40b4556..eab830e 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -141,9 +141,6 @@ function wp_insert_category($catarr) { // Keep in mind when using this filter and altering the cat_ID that the two queries above // have already taken place with the OLD cat_ID // Also note that you may have post2cat entries with the old cat_ID if this is an update - $cat_ID = apply_filters('cat_id_filter', $cat_ID, $update); - - clean_category_cache($cat_ID); if ($update) { do_action('edit_category', $cat_ID); @@ -152,6 +149,10 @@ function wp_insert_category($catarr) { do_action('add_category', $cat_ID); } + $cat_ID = apply_filters('cat_id_filter', $cat_ID, $update); + + clean_category_cache($cat_ID); + return $cat_ID; } diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 7a33aca..4f90c28 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -2090,11 +2090,11 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) { $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'"; $metadata['file'] = $file; - if ( $metadata['width'] * $metadata['height'] < 3 * 1024 * 1024 ) { - if ( $metadata['width'] > 128 && $metadata['width'] >= $metadata['height'] * 4 / 3 ) - $thumb = wp_create_thumbnail($file, 128); - elseif ( $metadata['height'] > 96 ) - $thumb = wp_create_thumbnail($file, 96); + $max = apply_filters( 'wp_thumbnail_creation_size_limit', 3 * 1024 * 1024, $attachment_id, $file ); + + if ( $max > 0 && $metadata['width'] * $metadata['height'] < $max ) { + $max_side = apply_filters( 'wp_thumbnail_max_side_length', 128, $attachment_id, $file ); + $thumb = wp_create_thumbnail( $file, $max_side ); if ( @file_exists($thumb) ) $metadata['thumb'] = basename($thumb); diff --git a/wp-admin/link-import.php b/wp-admin/link-import.php index 9f1e0c0..6484dbb 100644 --- a/wp-admin/link-import.php +++ b/wp-admin/link-import.php @@ -26,7 +26,7 @@ switch ($step) {
-

+

diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index 51b3122..5791bc0 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.php @@ -70,7 +70,7 @@ include('admin-header.php');
-

+

diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index ce4e62c..87249f9 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -517,10 +517,12 @@ function upgrade_210() { foreach ( $posts as $post ) wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID)); } + if ( $wp_current_db_version < 3570 ) { // Create categories for link categories if a category with the same // name doesn't exist. Create a map of link cat IDs to cat IDs. - $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories"); + $link_cat_id_map = array(); + $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM " . $wpdb->prefix . 'linkcategories'); foreach ( $link_cats as $link_cat) { if ( $cat_id = category_exists($link_cat->cat_name) ) { $link_cat_id_map[$link_cat->cat_id] = $cat_id; @@ -534,9 +536,13 @@ function upgrade_210() { // Associate links to cats. $links = $wpdb->get_results("SELECT link_id, link_category FROM $wpdb->links"); if ( !empty($links) ) foreach ( $links as $link ) { + if ( 0 == $link->link_category ) + continue; + if ( ! isset($link_cat_id_map[$link->link_category]) ) + continue; $link_cat = $link_cat_id_map[$link->link_category]; $cat = $wpdb->get_row("SELECT * FROM $wpdb->link2cat WHERE link_id = '$link->link_id' AND category_id = '$link_cat'"); - if (!$cat && 0 != $link->link_category) { + if ( !$cat ) { $wpdb->query("INSERT INTO $wpdb->link2cat (link_id, category_id) VALUES ('$link->link_id', '$link_cat')"); } @@ -553,6 +559,9 @@ function upgrade_210() { $wpdb->query("UPDATE $wpdb->categories SET link_count = '$count' WHERE cat_ID = '$cat_id'"); } } + + // Obsolete linkcategories table + $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories'); } } diff --git a/wp-admin/upload-js.php b/wp-admin/upload-js.php index 67d7a9e..bdf3d1c 100644 --- a/wp-admin/upload-js.php +++ b/wp-admin/upload-js.php @@ -56,7 +56,7 @@ addLoadEvent( function() { this.currentImage.width = false; this.currentImage.height = false; } - this.currentImage.isImage = ( 0 == id ? '' : $('attachment-is-image-' + id).value ); + this.currentImage.isImage = ( 0 == id ? 0 : $('attachment-is-image-' + id).value ); this.currentImage.ID = id; }, @@ -74,7 +74,7 @@ addLoadEvent( function() { h += "' class='back'>"; } h += "
" - if ( !this.currentImage.isImage ) + if ( 0 == this.currentImage.isImage ) h += "

'>" + this.currentImage.title + "

"; else h += "

" + this.currentImage.title + "

"; @@ -83,7 +83,7 @@ addLoadEvent( function() { h += ""; h += '
' h += "
"; - if ( this.currentImage.isImage ) { + if ( 1 == this.currentImage.isImage ) { h += "'>"; h += "" + this.currentImage.title + ""; h += ""; @@ -152,7 +152,7 @@ addLoadEvent( function() { h += "' class='back'>"; } h += "
" - if ( !this.currentImage.isImage ) + if ( 0 == this.currentImage.isImage ) h += "

'>" + this.currentImage.title + "

"; else h += "

" + this.currentImage.title + "

"; @@ -161,7 +161,7 @@ addLoadEvent( function() { h += ""; h += '
' h += "
"; - if ( this.currentImage.isImage ) { + if ( 1 == this.currentImage.isImage ) { h += "'>"; h += "" + this.currentImage.title + ""; h += ""; @@ -230,7 +230,7 @@ addLoadEvent( function() { displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } ) if ( displayEl ) display = displayEl.value; - else if ( this.currentImage.isImage ) + else if ( 1 == this.currentImage.isImage ) display = 'full'; if ( 'none' != link ) diff --git a/wp-includes/category.php b/wp-includes/category.php index 7f47161..7fdc334 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -5,7 +5,7 @@ function get_all_category_ids() { if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); - wp_cache_add('all_category_ids', $cat_ids, 'category'); + wp_cache_set('all_category_ids', $cat_ids, 'category'); } return $cat_ids; @@ -148,7 +148,7 @@ function &get_category(&$category, $output = OBJECT) { } else { if ( ! $_category = wp_cache_get($category, 'category') ) { $_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1"); - wp_cache_add($category, $_category, 'category'); + wp_cache_set($category, $_category, 'category'); } } diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 62cee05..47470d3 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -224,6 +224,8 @@ class WP { foreach (array_keys($this->query_vars) as $wpvar) { if ( '' != $this->query_vars[$wpvar] ) { $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; + if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars. + continue; $this->query_string .= $wpvar . '=' . rawurlencode($this->query_vars[$wpvar]); } } @@ -498,10 +500,10 @@ class Walker_Page extends Walker { return $output; } - function start_el($output, $page, $depth, $current_page, $show_date, $date_format) { + function start_el($output, $page, $depth, $current_page, $args) { if ( $depth ) $indent = str_repeat("\t", $depth); - + extract($args); $css_class = 'page_item'; $_current_page = get_page( $current_page ); if ( $page->ID == $current_page ) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 6afe8d2..d0027a5 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -1,4 +1,19 @@ posts; +$tableusers = $wpdb->users; +$tablecategories = $wpdb->categories; +$tablepost2cat = $wpdb->post2cat; +$tablecomments = $wpdb->comments; +$tablelinks = $wpdb->links; +$tablelinkcategories = 'linkcategories_is_gone'; +$tableoptions = $wpdb->options; +$tablepostmeta = $wpdb->postmeta; + /* * Deprecated functios come here to die. */ diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 4f103e9..bb7965e 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -791,10 +791,21 @@ function add_magic_quotes($array) { } function wp_remote_fopen( $uri ) { + $timeout = 10; + $parsed_url = @parse_url($uri); + + if ( !$parsed_url || !is_array($parsed_url) ) + return false; + + if ( !isset($parsed_url['scheme']) || !in_array($parsed_url['scheme'], array('http','https')) ) + $uri = 'http://' . $uri; + if ( ini_get('allow_url_fopen') ) { $fp = @fopen( $uri, 'r' ); if ( !$fp ) return false; + + //stream_set_timeout($fp, $timeout); // Requires php 4.3 $linea = ''; while( $remote_read = fread($fp, 4096) ) $linea .= $remote_read; @@ -805,6 +816,7 @@ function wp_remote_fopen( $uri ) { curl_setopt ($handle, CURLOPT_URL, $uri); curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1); curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1); + curl_setopt ($handle, CURLOPT_TIMEOUT, $timeout); $buffer = curl_exec($handle); curl_close($handle); return $buffer; @@ -833,10 +845,10 @@ function status_header( $header ) { elseif ( 410 == $header ) $text = 'Gone'; -// if ( substr(php_sapi_name(), 0, 3) == 'cgi' ) + if ( version_compare(phpversion(), '4.3.0', '>=') ) + @header("HTTP/1.1 $header $text", true, $header); + else @header("HTTP/1.1 $header $text"); -// else -// @header("Status: $header $text"); } function nocache_headers() { diff --git a/wp-includes/gettext.php b/wp-includes/gettext.php index ed94ca9..a35b0b9 100644 --- a/wp-includes/gettext.php +++ b/wp-includes/gettext.php @@ -302,7 +302,11 @@ class gettext_reader { $string = str_replace('nplurals',"\$total",$string); $string = str_replace("n",$n,$string); $string = str_replace('plural',"\$plural",$string); - + + # poEdit doesn't put any semicolons, which + # results in parse error in eval + $string .= ';'; + $total = 0; $plural = 0; diff --git a/wp-includes/js/tinymce/plugins/autosave/langs/cs.js b/wp-includes/js/tinymce/plugins/autosave/langs/cs.js deleted file mode 100644 index e69de29..0000000 diff --git a/wp-includes/js/tinymce/plugins/autosave/langs/sv.js b/wp-includes/js/tinymce/plugins/autosave/langs/sv.js deleted file mode 100644 index e69de29..0000000 diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js deleted file mode 100644 index e69de29..0000000 diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt deleted file mode 100644 index e69de29..0000000 diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js index de5edbe..1306c0b 100644 --- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -383,4 +383,3 @@ var TinyMCE_PastePlugin = { }; tinyMCE.addPlugin("paste", TinyMCE_PastePlugin); - diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php index 01f5ccd..808cfb6 100644 --- a/wp-includes/js/tinymce/tiny_mce_config.php +++ b/wp-includes/js/tinymce/tiny_mce_config.php @@ -31,9 +31,6 @@ $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end')); $mce_buttons = implode($mce_buttons, ','); - if ( !user_can_richedit() ) - $mce_buttons = str_replace('wp_help', 'wp_help,code', $mce_buttons); - $mce_buttons_2 = apply_filters('mce_buttons_2', array()); $mce_buttons_2 = implode($mce_buttons_2, ','); @@ -65,7 +62,6 @@ initArray = { theme_advanced_toolbar_align : "left", theme_advanced_path_location : "bottom", theme_advanced_resizing : true, - theme_advanced_source_editor_wrap : true, browsers : "", dialog_type : "modal", theme_advanced_resize_horizontal : false, diff --git a/wp-includes/js/tinymce/wp-mce-help.php b/wp-includes/js/tinymce/wp-mce-help.php index 2daf7ef..0893127 100644 --- a/wp-includes/js/tinymce/wp-mce-help.php +++ b/wp-includes/js/tinymce/wp-mce-help.php @@ -140,7 +140,7 @@

-

') ?> +

diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 5ecebd9..4951baa 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -289,7 +289,7 @@ function wp_list_pages($args = '') { global $wp_query; $current_page = $wp_query->get_queried_object_id(); - $output .= walk_page_tree($pages, $r['depth'], $current_page, $r['show_date'], $r['date_format']); + $output .= walk_page_tree($pages, $r['depth'], $current_page, $r); if ( $r['title_li'] ) $output .= ''; @@ -368,8 +368,9 @@ function get_attachment_icon_src( $id = 0, $fullsize = false ) { $src_file = $icon_dir . '/' . basename($src); } - if ( !isset($src) ) + if ( !isset($src) || !$src ) return false; + return array($src, $src_file); } diff --git a/wp-includes/post.php b/wp-includes/post.php index c3d3b6a..058db08 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -904,7 +904,7 @@ function get_all_page_ids() { if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) { $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); - wp_cache_add('all_page_ids', $page_ids, 'pages'); + wp_cache_set('all_page_ids', $page_ids, 'pages'); } return $page_ids; @@ -946,7 +946,7 @@ function &get_page(&$page, $output = OBJECT) { return get_post($_page, $output); // Potential issue: we're not checking to see if the post_type = 'page' // So all non-'post' posts will get cached as pages. - wp_cache_add($_page->ID, $_page, 'pages'); + wp_cache_set($_page->ID, $_page, 'pages'); } } } diff --git a/wp-includes/registration-functions.php b/wp-includes/registration-functions.php new file mode 100644 index 0000000..d270cd2 --- /dev/null +++ b/wp-includes/registration-functions.php @@ -0,0 +1,4 @@ + diff --git a/wp-includes/rss-functions.php b/wp-includes/rss-functions.php new file mode 100644 index 0000000..c07f867 --- /dev/null +++ b/wp-includes/rss-functions.php @@ -0,0 +1,4 @@ + diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 43e076d..bcc8bc5 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -38,7 +38,7 @@ class WP_Scripts { $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' ); $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'), '20061223' ); + $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '20070116' ); } } @@ -146,10 +146,7 @@ class WP_Scripts { foreach ( (array) $handles as $handle ) { $handle = explode('?', $handle); if ( !in_array($handle[0], $this->queue) && isset($this->scripts[$handle[0]]) ) { - if ( 'wp_tiny_mce' == $handle[0] ) // HACK: Put tinyMCE first. - array_unshift($this->queue, $handle[0]); - else - $this->queue[] = $handle[0]; + $this->queue[] = $handle[0]; if ( isset($handle[1]) ) $this->args[$handle[0]] = $handle[1]; } -- cgit