summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-26 15:45:20 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-26 15:45:20 +0000
commit28781ebb081ab8d99b30a33f5cd911b3b050bcc9 (patch)
treef21e6b7d3dd06002c58dd52ae2eae10d64d62d85 /wp-includes
parentcbd939114d362bfece3839d7d5d5e07367fd6be8 (diff)
downloadwordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.gz
wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.xz
wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.zip
WP Merge to rev 4254
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@770 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/bookmark-template.php4
-rw-r--r--wp-includes/capabilities.php4
-rw-r--r--wp-includes/classes.php82
-rw-r--r--wp-includes/cron.php14
-rw-r--r--wp-includes/general-template.php101
-rw-r--r--wp-includes/js/autosave.js.php5
-rw-r--r--wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js30
-rw-r--r--wp-includes/js/tinymce/plugins/autosave/readme.txt1
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js0
-rw-r--r--wp-includes/js/tinymce/plugins/inlinepopups/readme.txt0
-rw-r--r--wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js142
-rw-r--r--wp-includes/js/tinymce/tiny_mce_config.php2
-rw-r--r--wp-includes/js/tinymce/tiny_mce_gzip.php5
-rw-r--r--wp-includes/l10n.php14
-rw-r--r--wp-includes/link-template.php2
-rw-r--r--wp-includes/pluggable.php34
-rw-r--r--wp-includes/query.php47
-rw-r--r--wp-includes/script-loader.php6
-rw-r--r--wp-includes/wp-db.php6
19 files changed, 367 insertions, 132 deletions
diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php
index 3c14c3c..d16f6a0 100644
--- a/wp-includes/bookmark-template.php
+++ b/wp-includes/bookmark-template.php
@@ -230,7 +230,7 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
// Handle each category.
// Display the category name
- echo ' <li id="linkcat-' . $cat->cat_ID . '"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n";
+ echo ' <li id="linkcat-' . $cat->cat_ID . '" class="linkcat"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n";
// Call get_links() with all the appropriate params
get_links($cat->cat_ID, '<li>', "</li>", "\n", true, 'name', false);
@@ -340,7 +340,7 @@ function wp_list_bookmarks($args = '') {
$bookmarks = get_bookmarks($r);
if ( empty($bookmarks) )
continue;
- $output .= "<li id=\"linkcat-$cat->cat_ID\">$title_before$cat->cat_name$title_after\n\t<ul>\n";
+ $output .= "<li id='linkcat-$cat->cat_ID' class='linkcat'>$title_before$cat->cat_name$title_after\n\t<ul>\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t</ul>\n</li>\n";
}
diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index b2d2662..adc1827 100644
--- a/wp-includes/capabilities.php
+++ b/wp-includes/capabilities.php
@@ -324,7 +324,7 @@ function map_meta_cap($cap, $user_id) {
$author_data = get_userdata($user_id);
//echo "post ID: {$args[0]}<br/>";
$page = get_page($args[0]);
- $page_author_data = get_userdata($post->post_author);
+ $page_author_data = get_userdata($page->post_author);
//echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br/>";
// If the user is the author...
if ($user_id == $page_author_data->ID) {
@@ -378,7 +378,7 @@ function map_meta_cap($cap, $user_id) {
$author_data = get_userdata($user_id);
//echo "post ID: {$args[0]}<br/>";
$page = get_page($args[0]);
- $page_author_data = get_userdata($post->post_author);
+ $page_author_data = get_userdata($page->post_author);
//echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br/>";
// If the user is the author...
if ($user_id == $page_author_data->ID) {
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index b5f0a68..6d5fec7 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -1,77 +1,5 @@
<?php
-class retrospam_mgr {
- var $spam_words;
- var $comments_list;
- var $found_comments;
-
- function retrospam_mgr() {
- global $wpdb;
-
- $list = explode("\n", get_option('moderation_keys') );
- $list = array_unique( $list );
- $this->spam_words = $list;
-
- $this->comment_list = $wpdb->get_results("SELECT comment_ID AS ID, comment_content AS text, comment_approved AS approved, comment_author_url AS url, comment_author_ip AS ip, comment_author_email AS email FROM $wpdb->comments ORDER BY comment_ID ASC");
- } // End of class constructor
-
- function move_spam( $id_list ) {
- global $wpdb;
- $cnt = 0;
- $id_list = explode( ',', $id_list );
-
- foreach ( $id_list as $comment ) {
- if ( $wpdb->query("update $wpdb->comments set comment_approved = '0' where comment_ID = '$comment'") ) {
- $cnt++;
- }
- }
- echo "<div class='updated'><p> ";
- printf(__('%d comment(s) moved to the moderation queue.'), $cnt);
- echo "</p></div>\n";
- } // End function move_spam
-
- function find_spam() {
- $in_queue = 0;
-
- foreach( $this->comment_list as $comment ) {
- if( $comment->approved == 1 ) {
- foreach( $this->spam_words as $word ) {
- $word = trim($word);
- if ( empty( $word ) )
- continue;
- $fulltext = strtolower($comment->email.' '.$comment->url.' '.$comment->ip.' '.$comment->text);
- if( false !== strpos( $fulltext, strtolower($word) ) ) {
- $this->found_comments[] = $comment->ID;
- break;
- }
- }
- } else {
- $in_queue++;
- }
- }
- return array( 'found' => $this->found_comments, 'in_queue' => $in_queue );
- } // End function find_spam
-
- function display_edit_form( $counters ) {
- $numfound = count($counters[found]);
- $numqueue = $counters[in_queue];
-
- $body = '<p>' . sprintf(__('Suspected spam comments: %s'), "<strong>$numfound</strong>") . '</p>';
-
- if ( count($counters[found]) > 0 ) {
- $id_list = implode( ',', $counters[found] );
- $body .= '<p><a href="options-discussion.php?action=retrospam&amp;move=true&amp;ids='.$id_list.'">'. __('Move suspect comments to moderation queue &raquo;') . '</a></p>';
-
- }
- $head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
-
- $foot .= '<p><a href="options-discussion.php">' . __('&laquo; Return to Discussion Options page.') . '</a></p></div>';
-
- return $head . $body . $foot;
- } // End function display_edit_form
-
-}
-
class WP {
var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots');
@@ -109,7 +37,10 @@ class WP {
$error = '404';
$this->did_permalink = true;
- $pathinfo = $_SERVER['PATH_INFO'];
+ if ( isset($_SERVER['PATH_INFO']) )
+ $pathinfo = $_SERVER['PATH_INFO'];
+ else
+ $pathinfo = '';
$pathinfo_array = explode('?', $pathinfo);
$pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
$req_uri = $_SERVER['REQUEST_URI'];
@@ -117,7 +48,10 @@ class WP {
$req_uri = $req_uri_array[0];
$self = $_SERVER['PHP_SELF'];
$home_path = parse_url(get_option('home'));
- $home_path = $home_path['path'];
+ 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
diff --git a/wp-includes/cron.php b/wp-includes/cron.php
index 677fc3c..dd72d82 100644
--- a/wp-includes/cron.php
+++ b/wp-includes/cron.php
@@ -102,7 +102,7 @@ function wp_cron() {
return;
$keys = array_keys( $crons );
- if ( $keys[0] > time() )
+ if ( isset($keys[0]) && $keys[0] > time() )
return;
$schedules = wp_get_schedules();
@@ -125,6 +125,18 @@ function wp_get_schedules() {
return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
}
+function wp_get_schedule($hook, $args = array()) {
+ $crons = _get_cron_array();
+ $key = md5(serialize($args));
+ if ( empty($crons) )
+ return false;
+ foreach ( $crons as $timestamp => $cron ) {
+ if ( isset( $cron[$hook][$key] ) )
+ return $cron[$hook][$key]['schedule'];
+ }
+ return false;
+}
+
//
// Private functions
//
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index dd390aa..2cb5c02 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -127,6 +127,14 @@ function get_bloginfo($show='') {
global $wp_version;
$output = $wp_version;
break;
+ case 'language':
+ $output = get_locale();
+ $output = str_replace('_', '-', $output);
+ break;
+ case 'text_direction':
+ global $wp_locale;
+ $output = $wp_locale->text_direction;
+ break;
case 'name':
default:
$output = get_option('blogname');
@@ -736,13 +744,15 @@ function noindex() {
echo "<meta name='robots' content='noindex,nofollow' />\n";
}
-/**
- * Places a textarea according to the current user's preferences, filled with $content.
- * Also places a script block that enables tabbing between Title and Content.
- *
- * @param string Editor contents
- * @param string (optional) Previous form field's ID (for tabbing support)
- */
+function user_can_richedit() {
+ $can = true;
+
+ if ( 'true' != get_user_option('rich_editing') || preg_match('!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT']) )
+ $can = false;
+
+ return apply_filters('user_can_richedit', $can);
+}
+
function the_editor($content, $id = 'content', $prev_id = 'title') {
$rows = get_option('default_post_edit_rows');
if (($rows < 3) || ($rows > 100))
@@ -750,11 +760,61 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
$rows = "rows='$rows'";
- the_quicktags();
-
- if ( user_can_richedit() )
+ if ( user_can_richedit() ) :
add_filter('the_editor_content', 'wp_richedit_pre');
+ // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
+ ?>
+ <style type="text/css">
+ #postdivrich table, #postdivrich #quicktags {border-top: none;}
+ #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
+ #edButtons {border-bottom: 1px solid #ccc;}
+ </style>
+ <div id='edButtons' style='display:none;'>
+ <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div>
+ <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' />
+ <input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('HTML'); ?>' onclick='switchEditors("<?php echo $id; ?>")' />
+ </div>
+ <script type="text/javascript">
+ if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 )
+ document.getElementById('edButtons').style.display = 'block';
+ </script>
+
+ <?php endif; ?>
+ <div id="quicktags">
+ <?php wp_print_scripts( 'quicktags' ); ?>
+ <script type="text/javascript">edToolbar()</script>
+ </div>
+ <script type="text/javascript">
+ if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 )
+ document.getElementById("quicktags").style.display="none";
+
+ function edInsertContent(myField, myValue) {
+ //IE support
+ if (document.selection) {
+ myField.focus();
+ sel = document.selection.createRange();
+ sel.text = myValue;
+ myField.focus();
+ }
+ //MOZILLA/NETSCAPE support
+ else if (myField.selectionStart || myField.selectionStart == "0") {
+ var startPos = myField.selectionStart;
+ var endPos = myField.selectionEnd;
+ myField.value = myField.value.substring(0, startPos)
+ + myValue
+ + myField.value.substring(endPos, myField.value.length);
+ myField.focus();
+ myField.selectionStart = startPos + myValue.length;
+ myField.selectionEnd = startPos + myValue.length;
+ } else {
+ myField.value += myValue;
+ myField.focus();
+ }
+ }
+ </script>
+ <?php
+
$the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
$the_editor_content = apply_filters('the_editor_content', $content);
@@ -764,17 +824,17 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
<script type="text/javascript">
//<!--
edCanvas = document.getElementById('<?php echo $id; ?>');
- <?php if ( user_can_richedit() ) : ?>
+ <?php if ( $prev_id && user_can_richedit() ) : ?>
// This code is meant to allow tabbing from Title to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
- var i = tinyMCE.selectedInstance;
+ var i = tinyMCE.getInstanceById('<?php echo $id; ?>');
if(typeof i == 'undefined')
return true;
- tinyMCE.execCommand("mceStartTyping");
+ tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
@@ -786,10 +846,10 @@ function the_editor($content, $id = 'content', $prev_id = 'title') {
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
- var i = tinyMCE.selectedInstance;
+ var i = tinyMCE.getInstanceById('<?php echo $id; ?>');
if(typeof i == 'undefined')
return true;
- tinyMCE.execCommand("mceStartTyping");
+ tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
@@ -807,4 +867,15 @@ function the_search_query() {
echo wp_specialchars( stripslashes($s), 1 );
}
+function language_attributes() {
+ $output = '';
+ if ( $dir = get_bloginfo('text_direction') )
+ $output = "dir=\"$dir\"";
+ if ( $lang = get_bloginfo('language') ) {
+ if ( $dir ) $output .= ' ';
+ $output .= "lang=\"$lang\" xml:lang=\"$lang\"";
+ }
+
+ echo $output;
+}
?>
diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave.js.php
index cbd8e57..a8648f0 100644
--- a/wp-includes/js/autosave.js.php
+++ b/wp-includes/js/autosave.js.php
@@ -72,11 +72,12 @@ function autosave_saved() {
function autosave() {
var form = $('post');
+ var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false;
autosaveAjax = new sack();
/* Gotta do this up here so we can check the length when tinyMCE is in use */
- if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) {
+ if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
autosaveAjax.setVar("content", form.content.value);
} else {
if(tinyMCE.selectedInstance.spellcheckerOn) return;
@@ -110,7 +111,7 @@ function autosave() {
if(form.excerpt)
autosaveAjax.setVar("excerpt", form.excerpt.value);
- if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) {
+ if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
autosaveAjax.setVar("content", form.content.value);
} else {
tinyMCE.wpTriggerSave();
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js
new file mode 100644
index 0000000..102d69b
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js
@@ -0,0 +1,30 @@
+/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
+
+function TinyMCE_autosave_getInfo() {
+ return {
+ longname : 'Auto save',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+};
+
+function TinyMCE_autosave_beforeUnloadHandler() {
+ var msg = tinyMCE.getLang("lang_autosave_unload_msg");
+
+ var anyDirty = false;
+ for (var n in tinyMCE.instances) {
+ var inst = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(inst))
+ continue;
+
+ if (inst.isDirty())
+ return msg;
+ }
+
+ return;
+}
+
+window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
diff --git a/wp-includes/js/tinymce/plugins/autosave/readme.txt b/wp-includes/js/tinymce/plugins/autosave/readme.txt
new file mode 100644
index 0000000..4fdb78a
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/autosave/readme.txt
@@ -0,0 +1 @@
+Check the TinyMCE documentation for details on this plugin.
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
index 9a118f9..a596b83 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
@@ -38,9 +38,9 @@ var TinyMCE_wordpressPlugin = {
+ '<input type="button" accesskey="g" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpPage\');" />'
+ '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
+ '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
- + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
+ '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />'
- + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />'
+ + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
+ + '<input type="button" accesskey="v" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />'
+ '</div>';
return buttons+hiddenControls;
case "wp_adv":
@@ -241,18 +241,18 @@ var TinyMCE_wordpressPlugin = {
// Remove anonymous, empty paragraphs.
content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');
-
+
// Handle table badness.
content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');
content = content.replace(new RegExp('<(tr|thead|tfoot)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>');
content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>');
content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');
content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');
-
+
// Pretty it up for the source editor.
var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';
content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
- content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>');
+ content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');
content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
@@ -294,9 +294,9 @@ var TinyMCE_wordpressPlugin = {
// content = content.replace(new RegExp('&amp;', 'g'), '&');
// Get it ready for wpautop.
- content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), '');
- content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n');
- content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n');
+ content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
+ content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
+ content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
// Fix some block element newline issues
@@ -309,8 +309,7 @@ var TinyMCE_wordpressPlugin = {
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
- // Trim any whitespace
- content = content.replace(new RegExp('^\\s*', ''), '');
+ // Trim trailing whitespace
content = content.replace(new RegExp('\\s*$', ''), '');
// Hope.
@@ -468,3 +467,126 @@ tinyMCE.wpTriggerSave = function () {
inst.wpTriggerSave(false, false);
}
}
+
+function switchEditors(id) {
+ var inst = tinyMCE.getInstanceById(id);
+ var qt = document.getElementById('quicktags');
+ var H = document.getElementById('edButtonHTML');
+ var P = document.getElementById('edButtonPreview');
+ var ta = document.getElementById(id);
+ var pdr = ta.parentNode;
+
+ if ( inst ) {
+ edToggle(H, P);
+
+ if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
+ // IE rejects the later overflow assignment so we skip this step.
+ // Alternate code might be nice. Until then, IE reflows.
+ } else {
+ // Lock the fieldset's height to prevent reflow/flicker
+ pdr.style.height = pdr.clientHeight + 'px';
+ pdr.style.overflow = 'hidden';
+ }
+
+ // Save the coords of the bottom right corner of the rich editor
+ var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0];
+ var y1 = table.offsetTop + table.offsetHeight;
+
+ if ( TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height") == null ) {
+ var expires = new Date();
+ expires.setTime(expires.getTime() + 3600000 * 24 * 30);
+ var offset = tinyMCE.isMSIE ? 1 : 2;
+ TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires);
+ }
+
+ // Unload the rich editor
+ inst.triggerSave(false, false);
+ htm = inst.formElement.value;
+ tinyMCE.removeMCEControl(id);
+ document.getElementById(id).value = htm;
+ --tinyMCE.idCounter;
+
+ // Reveal Quicktags and textarea
+ qt.style.display = 'block';
+ ta.style.display = 'inline';
+
+ // Set the textarea height to match the rich editor
+ y2 = ta.offsetTop + ta.offsetHeight;
+ ta.style.height = (ta.clientHeight + y1 - y2) + 'px';
+
+ // Tweak the widths
+ ta.parentNode.style.paddingRight = '2px';
+
+ if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
+ } else {
+ // Unlock the fieldset's height
+ pdr.style.height = 'auto';
+ pdr.style.overflow = 'display';
+ }
+ } else {
+ edToggle(P, H);
+ edCloseAllTags(); // :-(
+
+ if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
+ } else {
+ // Lock the fieldset's height
+ pdr.style.height = pdr.clientHeight + 'px';
+ pdr.style.overflow = 'hidden';
+ }
+
+ // Hide Quicktags and textarea
+ qt.style.display = 'none';
+ ta.style.display = 'none';
+
+ // Tweak the widths
+ ta.parentNode.style.paddingRight = '0px';
+
+ // Load the rich editor with formatted html
+ if ( tinyMCE.isMSIE ) {
+ ta.value = wpautop(ta.value);
+ tinyMCE.addMCEControl(ta, id);
+ } else {
+ htm = wpautop(ta.value);
+ tinyMCE.addMCEControl(ta, id);
+ tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm);
+ }
+
+ if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
+ } else {
+ // Unlock the fieldset's height
+ pdr.style.height = 'auto';
+ pdr.style.overflow = 'display';
+ }
+ }
+}
+
+function edToggle(A, B) {
+ A.className = 'edButtonFore';
+ B.className = 'edButtonBack';
+
+ B.onclick = A.onclick;
+ A.onclick = null;
+}
+
+function wpautop(pee) {
+ pee = pee + "\n\n";
+ pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
+ pee = pee.replace(new RegExp('(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "\n$1");
+ pee = pee.replace(new RegExp('(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)', 'gi'), "$1\n\n");
+ pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
+ pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
+ pee = pee.replace(new RegExp('\n*([^\Z]+?)\\n{2}', 'mg'), "<p>$1</p>\n");
+ pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
+ pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1");
+ pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
+ pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
+ pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>');
+ pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "$1");
+ pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1");
+ pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
+ pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*<br />', 'gi'), "$1");
+ pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
+ pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
+ //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' "); // Hmm...
+ return pee;
+}
diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php
index dad3aff..808cfb6 100644
--- a/wp-includes/js/tinymce/tiny_mce_config.php
+++ b/wp-includes/js/tinymce/tiny_mce_config.php
@@ -28,7 +28,7 @@
$plugins = apply_filters('mce_plugins', $plugins);
$plugins = implode($plugins, ',');
- $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', 'code', '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 = 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, ',');
$mce_buttons_2 = apply_filters('mce_buttons_2', array());
diff --git a/wp-includes/js/tinymce/tiny_mce_gzip.php b/wp-includes/js/tinymce/tiny_mce_gzip.php
index d92e08e..686fb61 100644
--- a/wp-includes/js/tinymce/tiny_mce_gzip.php
+++ b/wp-includes/js/tinymce/tiny_mce_gzip.php
@@ -35,8 +35,9 @@ function wp_tinymce_lang($path) {
// Fall back on en.js
- if ( empty($text) )
- $text = file_get_contents(realpath(sprintf($path, 'en')));
+ $file = realpath(sprintf($path, 'en'));
+ if ( empty($text) && file_exists($file) )
+ $text = file_get_contents($file);
// Send lang file through gettext
if ( function_exists('__') && strtolower(substr($language, 0, 2)) != 'en' ) {
diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php
index ba77c23..b2b099c 100644
--- a/wp-includes/l10n.php
+++ b/wp-includes/l10n.php
@@ -1,10 +1,4 @@
<?php
-
-if ( defined('WPLANG') && '' != constant('WPLANG') ) {
- include_once(ABSPATH . 'wp-includes/streams.php');
- include_once(ABSPATH . 'wp-includes/gettext.php');
-}
-
function get_locale() {
global $locale;
@@ -75,13 +69,15 @@ function load_default_textdomain() {
global $l10n;
$locale = get_locale();
- $mofile = ABSPATH . "wp-includes/languages/$locale.mo";
+ $mofile = ABSPATH . LANGDIR . "/$locale.mo";
load_textdomain('default', $mofile);
}
-function load_plugin_textdomain($domain, $path = 'wp-content/plugins') {
+function load_plugin_textdomain($domain, $path = false) {
$locale = get_locale();
+ if ( false === $path )
+ $path = PLUGINDIR;
$mofile = ABSPATH . "$path/$domain-$locale.mo";
load_textdomain($domain, $mofile);
@@ -94,4 +90,4 @@ function load_theme_textdomain($domain) {
load_textdomain($domain, $mofile);
}
-?> \ No newline at end of file
+?>
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 965c4e4..78e789f 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -482,7 +482,7 @@ function _max_num_pages() {
if ( 'posts' == get_query_var('what_to_show') ) {
preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches);
$fromwhere = $matches[1];
- $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
+ $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT $wpdb->posts.ID) FROM $fromwhere");
$max_num_pages = ceil($numposts / $posts_per);
} else {
preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches);
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index 2750942..0c33ad7 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -263,7 +263,7 @@ endif;
// Cookie safe redirect. Works around IIS Set-Cookie bug.
// http://support.microsoft.com/kb/q176113/
if ( !function_exists('wp_redirect') ) :
-function wp_redirect($location) {
+function wp_redirect($location, $status = 302) {
global $is_IIS;
$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
@@ -272,6 +272,8 @@ function wp_redirect($location) {
$strip = array('%0d', '%0a');
$location = str_replace($strip, '', $location);
+ status_header($status);
+
if ($is_IIS)
header("Refresh: 0;url=$location");
else
@@ -294,22 +296,40 @@ function wp_setcookie($username, $password, $already_md5 = false, $home = '', $s
if ( !$already_md5 )
$password = md5( md5($password) ); // Double hash the password in the cookie.
+ if ( empty($home) )
+ $cookiepath = COOKIEPATH;
+ else
+ $cookiepath = preg_replace('|https?://[^/]+|i', '', $home . '/' );
+
+ if ( empty($siteurl) ) {
+ $sitecookiepath = SITECOOKIEPATH;
+ $cookiehash = COOKIEHASH;
+ } else {
+ $sitecookiepath = preg_replace('|https?://[^/]+|i', '', $siteurl . '/' );
+ $cookiehash = md5($siteurl);
+ }
+
if ( $remember )
$expire = time() + 31536000;
else
$expire = 0;
- global $base;
- setcookie(USER_COOKIE, $username, $expire, $base, COOKIE_DOMAIN);
- setcookie(PASS_COOKIE, $password, $expire, $base, COOKIE_DOMAIN);
+ setcookie(USER_COOKIE, $username, $expire, $cookiepath, COOKIE_DOMAIN);
+ setcookie(PASS_COOKIE, $password, $expire, $cookiepath, COOKIE_DOMAIN);
+
+ if ( $cookiepath != $sitecookiepath ) {
+ setcookie(USER_COOKIE, $username, $expire, $sitecookiepath, COOKIE_DOMAIN);
+ setcookie(PASS_COOKIE, $password, $expire, $sitecookiepath, COOKIE_DOMAIN);
+ }
}
endif;
if ( !function_exists('wp_clearcookie') ) :
function wp_clearcookie() {
- global $base;
- setcookie(USER_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN);
- setcookie(PASS_COOKIE, ' ', time() - 31536000, $base, COOKIE_DOMAIN);
+ setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
+ setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
+ setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
+ setcookie(PASS_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
}
endif;
diff --git a/wp-includes/query.php b/wp-includes/query.php
index 689b27f..c1b88ec 100644
--- a/wp-includes/query.php
+++ b/wp-includes/query.php
@@ -329,6 +329,44 @@ class WP_Query {
function parse_query_vars() {
$this->parse_query('');
}
+
+ function fill_query_vars($array) {
+ $keys = array(
+ 'error'
+ , 'm'
+ , 'p'
+ , 'subpost'
+ , 'subpost_id'
+ , 'attachment'
+ , 'attachment_id'
+ , 'name'
+ , 'hour'
+ , 'static'
+ , 'pagename'
+ , 'page_id'
+ , 'second'
+ , 'minute'
+ , 'hour'
+ , 'day'
+ , 'monthnum'
+ , 'year'
+ , 'w'
+ , 'category_name'
+ , 'author_name'
+ , 'feed'
+ , 'tb'
+ , 'paged'
+ , 'comments_popup'
+ , 'preview'
+ );
+
+ foreach ($keys as $key) {
+ if ( !isset($array[$key]))
+ $array[$key] = '';
+ }
+
+ return $array;
+ }
// Parse a query string and set query type booleans.
function parse_query ($query) {
@@ -341,7 +379,9 @@ class WP_Query {
$this->query = $query;
$this->query_vars = $qv;
}
-
+
+ $qv = $this->fill_query_vars($qv);
+
if ( ! empty($qv['robots']) ) {
$this->is_robots = true;
return;
@@ -530,6 +570,8 @@ class WP_Query {
// Shorthand.
$q = &$this->query_vars;
+
+ $q = $this->fill_query_vars($q);
// First let's clear some variables
$distinct = '';
@@ -540,6 +582,7 @@ class WP_Query {
$where = '';
$limits = '';
$join = '';
+ $search = '';
if ( !isset($q['post_type']) )
$q['post_type'] = 'post';
@@ -909,12 +952,12 @@ class WP_Query {
}
if (($q['what_to_show'] == 'posts')) {
- $q['offset'] = abs(intval($q['offset']));
if ( empty($q['offset']) ) {
$pgstrt = '';
$pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
$limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
} else { // we're ignoring $page and using 'offset'
+ $q['offset'] = abs(intval($q['offset']));
$pgstrt = $q['offset'] . ', ';
$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
}
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 6fc2bdd..6d069c6 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -15,10 +15,10 @@ class WP_Scripts {
$this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
$this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' );
$this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
- $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '08152006' );
- $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' );
+ $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006' );
+ $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '09212006' );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
- $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4183');
+ $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4206');
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4187');
$this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4187');
$this->add( 'scriptaculous', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.6.1');
diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php
index d02606b..f543099 100644
--- a/wp-includes/wp-db.php
+++ b/wp-includes/wp-db.php
@@ -283,6 +283,9 @@ class wpdb {
$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
if ( $query )
$this->query($query);
+
+ if ( !isset($this->last_result[$y]) )
+ return null;
if ( $output == OBJECT ) {
return $this->last_result[$y] ? $this->last_result[$y] : null;
@@ -433,5 +436,6 @@ class wpdb {
}
}
-$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
+if ( ! isset($wpdb) )
+ $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
?>