]> scripts.mit.edu Git - autoinstalls/wordpress.git/commitdiff
Wordpress 2.8 wordpress-2.8
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:51:53 +0000 (20:51 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:51:53 +0000 (20:51 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
448 files changed:
readme.html
wp-admin/admin-ajax.php
wp-admin/admin-footer.php
wp-admin/admin-header.php
wp-admin/admin-post.php
wp-admin/admin.php
wp-admin/async-upload.php
wp-admin/categories.php
wp-admin/comment.php
wp-admin/css/colors-classic-rtl.css
wp-admin/css/colors-classic.css
wp-admin/css/colors-fresh.css
wp-admin/css/dashboard.css
wp-admin/css/farbtastic-rtl.css
wp-admin/css/global-rtl.css
wp-admin/css/global.css
wp-admin/css/ie-rtl.css
wp-admin/css/ie.css
wp-admin/css/login.css
wp-admin/css/media.css
wp-admin/css/plugin-install.css
wp-admin/css/press-this-rtl.css
wp-admin/css/press-this.css
wp-admin/css/theme-editor.css
wp-admin/css/theme-install.css [new file with mode: 0644]
wp-admin/css/widgets-rtl.css
wp-admin/css/widgets.css
wp-admin/custom-header.php
wp-admin/edit-attachment-rows.php
wp-admin/edit-category-form.php
wp-admin/edit-comments.php
wp-admin/edit-form-advanced.php
wp-admin/edit-form-comment.php
wp-admin/edit-link-categories.php
wp-admin/edit-link-category-form.php
wp-admin/edit-link-form.php
wp-admin/edit-page-form.php
wp-admin/edit-pages.php
wp-admin/edit-tag-form.php
wp-admin/edit-tags.php
wp-admin/edit.php
wp-admin/export.php
wp-admin/gears-manifest.php
wp-admin/images/blue-grad.png
wp-admin/images/button-grad-active-vs.png [new file with mode: 0644]
wp-admin/images/button-grad-vs.png [new file with mode: 0644]
wp-admin/images/ed-bg-vs.gif [new file with mode: 0644]
wp-admin/images/fav-arrow-vs.gif [new file with mode: 0644]
wp-admin/images/fav-top-vs.gif [new file with mode: 0644]
wp-admin/images/fav-vs.png [new file with mode: 0644]
wp-admin/images/menu-bits-rtl-vs.gif [new file with mode: 0644]
wp-admin/images/menu-bits-vs.gif [new file with mode: 0644]
wp-admin/images/menu.png
wp-admin/images/visit-site-button-grad-vs.gif [new file with mode: 0644]
wp-admin/images/visit-site-button-grad.gif [new file with mode: 0644]
wp-admin/images/wp-logo-vs.gif [new file with mode: 0644]
wp-admin/images/wpspin_dark.gif [new file with mode: 0644]
wp-admin/images/wpspin_light.gif [new file with mode: 0644]
wp-admin/import.php
wp-admin/import/blogger.php
wp-admin/import/blogware.php
wp-admin/import/btt.php
wp-admin/import/dotclear.php
wp-admin/import/greymatter.php
wp-admin/import/jkw.php
wp-admin/import/livejournal.php
wp-admin/import/mt.php
wp-admin/import/opml.php
wp-admin/import/rss.php
wp-admin/import/stp.php
wp-admin/import/textpattern.php
wp-admin/import/utw.php
wp-admin/import/wordpress.php
wp-admin/import/wp-cat2tag.php
wp-admin/includes/bookmark.php
wp-admin/includes/class-pclzip.php
wp-admin/includes/class-wp-filesystem-base.php
wp-admin/includes/class-wp-filesystem-direct.php
wp-admin/includes/class-wp-filesystem-ftpext.php
wp-admin/includes/class-wp-filesystem-ftpsockets.php
wp-admin/includes/class-wp-filesystem-ssh2.php
wp-admin/includes/class-wp-upgrader.php [new file with mode: 0644]
wp-admin/includes/comment.php
wp-admin/includes/continents-cities.php [new file with mode: 0644]
wp-admin/includes/dashboard.php
wp-admin/includes/export.php
wp-admin/includes/file.php
wp-admin/includes/image.php
wp-admin/includes/import.php
wp-admin/includes/manifest.php [new file with mode: 0644]
wp-admin/includes/media.php
wp-admin/includes/misc.php
wp-admin/includes/plugin-install.php
wp-admin/includes/plugin.php
wp-admin/includes/post.php
wp-admin/includes/schema.php
wp-admin/includes/taxonomy.php
wp-admin/includes/template.php
wp-admin/includes/theme-install.php [new file with mode: 0644]
wp-admin/includes/theme.php
wp-admin/includes/update-core.php
wp-admin/includes/update.php
wp-admin/includes/upgrade.php
wp-admin/includes/user.php
wp-admin/includes/widgets.php
wp-admin/index.php
wp-admin/install.php
wp-admin/js/cat.dev.js [new file with mode: 0644]
wp-admin/js/cat.js
wp-admin/js/categories.dev.js [new file with mode: 0644]
wp-admin/js/categories.js
wp-admin/js/comment.dev.js [new file with mode: 0644]
wp-admin/js/comment.js
wp-admin/js/common.dev.js [new file with mode: 0644]
wp-admin/js/common.js
wp-admin/js/custom-fields.dev.js [new file with mode: 0644]
wp-admin/js/custom-fields.js
wp-admin/js/dashboard.dev.js [new file with mode: 0644]
wp-admin/js/dashboard.js
wp-admin/js/edit-comments.dev.js [new file with mode: 0644]
wp-admin/js/edit-comments.js
wp-admin/js/editor.dev.js [new file with mode: 0644]
wp-admin/js/editor.js
wp-admin/js/gallery.dev.js [new file with mode: 0644]
wp-admin/js/gallery.js
wp-admin/js/inline-edit-post.dev.js [new file with mode: 0644]
wp-admin/js/inline-edit-post.js
wp-admin/js/inline-edit-tax.dev.js [new file with mode: 0644]
wp-admin/js/inline-edit-tax.js
wp-admin/js/link.dev.js [new file with mode: 0644]
wp-admin/js/link.js
wp-admin/js/media-upload.dev.js [new file with mode: 0644]
wp-admin/js/media-upload.js
wp-admin/js/media.dev.js [new file with mode: 0644]
wp-admin/js/media.js [new file with mode: 0644]
wp-admin/js/page.dev.js [new file with mode: 0644]
wp-admin/js/page.js
wp-admin/js/password-strength-meter.dev.js [new file with mode: 0644]
wp-admin/js/password-strength-meter.js
wp-admin/js/plugin-install.dev.js [new file with mode: 0644]
wp-admin/js/plugin-install.js
wp-admin/js/post.dev.js [new file with mode: 0644]
wp-admin/js/post.js
wp-admin/js/postbox.dev.js [new file with mode: 0644]
wp-admin/js/postbox.js
wp-admin/js/revisions-js.php
wp-admin/js/slug.dev.js [new file with mode: 0644]
wp-admin/js/slug.js
wp-admin/js/tags.dev.js [new file with mode: 0644]
wp-admin/js/tags.js
wp-admin/js/theme-preview.dev.js [new file with mode: 0644]
wp-admin/js/theme-preview.js
wp-admin/js/user-profile.dev.js [new file with mode: 0644]
wp-admin/js/user-profile.js [new file with mode: 0644]
wp-admin/js/users.js [deleted file]
wp-admin/js/utils.dev.js [new file with mode: 0644]
wp-admin/js/utils.js [new file with mode: 0644]
wp-admin/js/widgets.dev.js [new file with mode: 0644]
wp-admin/js/widgets.js
wp-admin/js/word-count.dev.js [new file with mode: 0644]
wp-admin/js/word-count.js
wp-admin/js/wp-gears.dev.js [new file with mode: 0644]
wp-admin/js/wp-gears.js
wp-admin/js/xfn.dev.js [new file with mode: 0644]
wp-admin/js/xfn.js
wp-admin/link-manager.php
wp-admin/load-scripts.php [new file with mode: 0644]
wp-admin/load-styles.php [new file with mode: 0644]
wp-admin/media-upload.php
wp-admin/media.php
wp-admin/menu-header.php
wp-admin/menu.php
wp-admin/options-discussion.php
wp-admin/options-general.php
wp-admin/options-media.php
wp-admin/options-misc.php
wp-admin/options-permalink.php
wp-admin/options-privacy.php
wp-admin/options-reading.php
wp-admin/options-writing.php
wp-admin/options.php
wp-admin/page.php
wp-admin/plugin-editor.php
wp-admin/plugin-install.php
wp-admin/plugins.php
wp-admin/post.php
wp-admin/press-this.php
wp-admin/revision.php
wp-admin/rtl.css
wp-admin/setup-config.php
wp-admin/sidebar.php
wp-admin/theme-editor.php
wp-admin/theme-install.php [new file with mode: 0644]
wp-admin/themes.php
wp-admin/tools.php
wp-admin/update-core.php
wp-admin/update-links.php
wp-admin/update.php
wp-admin/upgrade.php
wp-admin/upload.php
wp-admin/user-edit.php
wp-admin/user-new.php
wp-admin/users.php
wp-admin/widgets.php
wp-admin/wp-admin.css
wp-app.php
wp-comments-post.php
wp-config-sample.php
wp-content/plugins/akismet/akismet.php
wp-content/plugins/index.php [new file with mode: 0644]
wp-content/themes/classic/comments-popup.php
wp-content/themes/classic/comments.php
wp-content/themes/classic/functions.php
wp-content/themes/classic/header.php
wp-content/themes/classic/sidebar.php
wp-content/themes/classic/style.css
wp-content/themes/default/archive.php
wp-content/themes/default/comments-popup.php
wp-content/themes/default/comments.php
wp-content/themes/default/footer.php
wp-content/themes/default/functions.php
wp-content/themes/default/header.php
wp-content/themes/default/image.php
wp-content/themes/default/index.php
wp-content/themes/default/page.php
wp-content/themes/default/rtl.css
wp-content/themes/default/search.php
wp-content/themes/default/sidebar.php
wp-content/themes/default/single.php
wp-content/themes/default/style.css
wp-content/themes/index.php [new file with mode: 0644]
wp-cron.php
wp-includes/author-template.php
wp-includes/bookmark-template.php
wp-includes/bookmark.php
wp-includes/canonical.php
wp-includes/capabilities.php
wp-includes/category-template.php
wp-includes/category.php
wp-includes/class-IXR.php
wp-includes/class-feed.php [new file with mode: 0644]
wp-includes/class-phpmailer.php
wp-includes/class-simplepie.php [new file with mode: 0644]
wp-includes/class-smtp.php
wp-includes/class.wp-dependencies.php
wp-includes/class.wp-scripts.php
wp-includes/class.wp-styles.php
wp-includes/classes.php
wp-includes/comment-template.php
wp-includes/comment.php
wp-includes/compat.php
wp-includes/cron.php
wp-includes/default-filters.php
wp-includes/default-widgets.php [new file with mode: 0644]
wp-includes/deprecated.php
wp-includes/feed-atom-comments.php
wp-includes/feed-atom.php
wp-includes/feed-rdf.php
wp-includes/feed-rss.php
wp-includes/feed-rss2-comments.php
wp-includes/feed-rss2.php
wp-includes/feed.php
wp-includes/formatting.php
wp-includes/functions.php
wp-includes/functions.wp-scripts.php
wp-includes/functions.wp-styles.php
wp-includes/general-template.php
wp-includes/http.php
wp-includes/js/autosave.dev.js [new file with mode: 0644]
wp-includes/js/autosave.js
wp-includes/js/codepress/codepress.css [new file with mode: 0644]
wp-includes/js/codepress/codepress.html [new file with mode: 0644]
wp-includes/js/codepress/codepress.js [new file with mode: 0644]
wp-includes/js/codepress/engines/gecko.js [new file with mode: 0644]
wp-includes/js/codepress/engines/khtml.js [new file with mode: 0644]
wp-includes/js/codepress/engines/msie.js [new file with mode: 0644]
wp-includes/js/codepress/engines/older.js [new file with mode: 0644]
wp-includes/js/codepress/engines/opera.js [new file with mode: 0644]
wp-includes/js/codepress/images/line-numbers.png [new file with mode: 0644]
wp-includes/js/codepress/languages/asp.css [new file with mode: 0644]
wp-includes/js/codepress/languages/asp.js [new file with mode: 0644]
wp-includes/js/codepress/languages/autoit.css [new file with mode: 0644]
wp-includes/js/codepress/languages/autoit.js [new file with mode: 0644]
wp-includes/js/codepress/languages/csharp.css [new file with mode: 0644]
wp-includes/js/codepress/languages/csharp.js [new file with mode: 0644]
wp-includes/js/codepress/languages/css.css [new file with mode: 0644]
wp-includes/js/codepress/languages/css.js [new file with mode: 0644]
wp-includes/js/codepress/languages/generic.css [new file with mode: 0644]
wp-includes/js/codepress/languages/generic.js [new file with mode: 0644]
wp-includes/js/codepress/languages/html.css [new file with mode: 0644]
wp-includes/js/codepress/languages/html.js [new file with mode: 0644]
wp-includes/js/codepress/languages/java.css [new file with mode: 0644]
wp-includes/js/codepress/languages/java.js [new file with mode: 0644]
wp-includes/js/codepress/languages/javascript.css [new file with mode: 0644]
wp-includes/js/codepress/languages/javascript.js [new file with mode: 0644]
wp-includes/js/codepress/languages/perl.css [new file with mode: 0644]
wp-includes/js/codepress/languages/perl.js [new file with mode: 0644]
wp-includes/js/codepress/languages/php.css [new file with mode: 0644]
wp-includes/js/codepress/languages/php.js [new file with mode: 0644]
wp-includes/js/codepress/languages/ruby.css [new file with mode: 0644]
wp-includes/js/codepress/languages/ruby.js [new file with mode: 0644]
wp-includes/js/codepress/languages/sql.css [new file with mode: 0644]
wp-includes/js/codepress/languages/sql.js [new file with mode: 0644]
wp-includes/js/codepress/languages/text.css [new file with mode: 0644]
wp-includes/js/codepress/languages/text.js [new file with mode: 0644]
wp-includes/js/codepress/languages/vbscript.css [new file with mode: 0644]
wp-includes/js/codepress/languages/vbscript.js [new file with mode: 0644]
wp-includes/js/codepress/languages/xsl.css [new file with mode: 0644]
wp-includes/js/codepress/languages/xsl.js [new file with mode: 0644]
wp-includes/js/codepress/license.txt [new file with mode: 0644]
wp-includes/js/colorpicker.dev.js [new file with mode: 0644]
wp-includes/js/colorpicker.js
wp-includes/js/comment-reply.dev.js [new file with mode: 0644]
wp-includes/js/comment-reply.js
wp-includes/js/hoverIntent.dev.js [new file with mode: 0644]
wp-includes/js/hoverIntent.js
wp-includes/js/jcrop/Jcrop.gif [new file with mode: 0644]
wp-includes/js/jcrop/jquery.Jcrop.css [new file with mode: 0644]
wp-includes/js/jcrop/jquery.Jcrop.dev.js [new file with mode: 0644]
wp-includes/js/jcrop/jquery.Jcrop.js [new file with mode: 0644]
wp-includes/js/jquery/interface.js
wp-includes/js/jquery/jquery.color.dev.js [new file with mode: 0644]
wp-includes/js/jquery/jquery.color.js
wp-includes/js/jquery/jquery.form.dev.js [new file with mode: 0644]
wp-includes/js/jquery/jquery.form.js
wp-includes/js/jquery/jquery.hotkeys.dev.js [new file with mode: 0644]
wp-includes/js/jquery/jquery.hotkeys.js
wp-includes/js/jquery/jquery.js
wp-includes/js/jquery/jquery.table-hotkeys.dev.js [new file with mode: 0644]
wp-includes/js/jquery/jquery.table-hotkeys.js
wp-includes/js/jquery/suggest.dev.js [new file with mode: 0644]
wp-includes/js/jquery/suggest.js
wp-includes/js/jquery/ui.core.js
wp-includes/js/jquery/ui.dialog.js
wp-includes/js/jquery/ui.draggable.js
wp-includes/js/jquery/ui.droppable.js [new file with mode: 0644]
wp-includes/js/jquery/ui.resizable.js
wp-includes/js/jquery/ui.selectable.js [new file with mode: 0644]
wp-includes/js/jquery/ui.sortable.js
wp-includes/js/jquery/ui.tabs.js
wp-includes/js/quicktags.dev.js [new file with mode: 0644]
wp-includes/js/quicktags.js
wp-includes/js/swfobject.js [new file with mode: 0644]
wp-includes/js/swfupload/handlers.dev.js [new file with mode: 0644]
wp-includes/js/swfupload/handlers.js
wp-includes/js/swfupload/plugins/swfupload.documentready.js [deleted file]
wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js [deleted file]
wp-includes/js/swfupload/plugins/swfupload.queue.js
wp-includes/js/swfupload/plugins/swfupload.speed.js [new file with mode: 0644]
wp-includes/js/swfupload/plugins/swfupload.swfobject.js
wp-includes/js/swfupload/swfupload-all.js [new file with mode: 0644]
wp-includes/js/swfupload/swfupload.js
wp-includes/js/swfupload/swfupload.swf
wp-includes/js/swfupload/swfupload_f9.swf [deleted file]
wp-includes/js/thickbox/thickbox.js
wp-includes/js/tinymce/langs/wp-langs.php
wp-includes/js/tinymce/plugins/autosave/editor_plugin.js [deleted file]
wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js
wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css
wp-includes/js/tinymce/plugins/inlinepopups/template.htm
wp-includes/js/tinymce/plugins/media/editor_plugin.js
wp-includes/js/tinymce/plugins/media/js/media.js
wp-includes/js/tinymce/plugins/media/media.htm
wp-includes/js/tinymce/plugins/paste/blank.htm
wp-includes/js/tinymce/plugins/paste/css/blank.css [deleted file]
wp-includes/js/tinymce/plugins/paste/css/pasteword.css [deleted file]
wp-includes/js/tinymce/plugins/paste/editor_plugin.js
wp-includes/js/tinymce/plugins/paste/js/pastetext.js
wp-includes/js/tinymce/plugins/paste/js/pasteword.js
wp-includes/js/tinymce/plugins/paste/pastetext.htm
wp-includes/js/tinymce/plugins/paste/pasteword.htm
wp-includes/js/tinymce/plugins/safari/editor_plugin.js
wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js
wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js
wp-includes/js/tinymce/themes/advanced/about.htm
wp-includes/js/tinymce/themes/advanced/anchor.htm
wp-includes/js/tinymce/themes/advanced/charmap.htm
wp-includes/js/tinymce/themes/advanced/color_picker.htm
wp-includes/js/tinymce/themes/advanced/editor_template.js
wp-includes/js/tinymce/themes/advanced/image.htm
wp-includes/js/tinymce/themes/advanced/js/link.js
wp-includes/js/tinymce/themes/advanced/js/source_editor.js
wp-includes/js/tinymce/themes/advanced/link.htm
wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css
wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css
wp-includes/js/tinymce/themes/advanced/source_editor.htm
wp-includes/js/tinymce/tiny_mce.js
wp-includes/js/tinymce/tiny_mce_popup.js
wp-includes/js/tinymce/utils/form_utils.js
wp-includes/js/tinymce/utils/mclayer.js [deleted file]
wp-includes/js/tinymce/wordpress.css [deleted file]
wp-includes/js/tinymce/wp-mce-help.php
wp-includes/js/tinymce/wp-tinymce.js [new file with mode: 0644]
wp-includes/js/tinymce/wp-tinymce.js.gz [new file with mode: 0644]
wp-includes/js/tinymce/wp-tinymce.php [new file with mode: 0644]
wp-includes/js/tw-sack.dev.js [new file with mode: 0644]
wp-includes/js/tw-sack.js
wp-includes/js/wp-ajax-response.dev.js [new file with mode: 0644]
wp-includes/js/wp-ajax-response.js
wp-includes/js/wp-lists.dev.js [new file with mode: 0644]
wp-includes/js/wp-lists.js
wp-includes/l10n.php
wp-includes/link-template.php
wp-includes/locale.php
wp-includes/media.php
wp-includes/pluggable.php
wp-includes/plugin.php
wp-includes/pomo/entry.php [new file with mode: 0644]
wp-includes/pomo/mo.php [new file with mode: 0644]
wp-includes/pomo/po.php [new file with mode: 0644]
wp-includes/pomo/streams.php [new file with mode: 0644]
wp-includes/pomo/translations.php [new file with mode: 0644]
wp-includes/post-template.php
wp-includes/post.php
wp-includes/query.php
wp-includes/registration.php
wp-includes/rewrite.php
wp-includes/rss.php
wp-includes/script-loader.php
wp-includes/shortcodes.php
wp-includes/taxonomy.php
wp-includes/theme.php
wp-includes/update.php
wp-includes/user.php
wp-includes/vars.php
wp-includes/version.php
wp-includes/widgets.php
wp-includes/wp-db.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-pass.php
wp-settings.php
xmlrpc.php

index 5f8c13dfc02292f8e7c8dff512a3fc867e09d8ab..3b5b51d874cb2e255fde276457f4ed2b9817ba6d 100644 (file)
@@ -8,7 +8,7 @@
 <body>
 <h1 id="logo" style="text-align: center">
        <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
 <body>
 <h1 id="logo" style="text-align: center">
        <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
-       <br /> Version 2.7
+       <br /> Version 2.8
 </h1>
 <p style="text-align: center">Semantic Personal Publishing Platform</p>
 
 </h1>
 <p style="text-align: center">Semantic Personal Publishing Platform</p>
 
@@ -29,7 +29,7 @@
 
 <h1>Upgrading</h1>
 <p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
 
 <h1>Upgrading</h1>
 <p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
-<h2>Upgrading from any previous WordPress to 2.7:</h2>
+<h2>Upgrading from any previous WordPress to 2.8:</h2>
 <ol>
        <li>Delete your old WP files, saving ones you've modified.</li>
        <li>Upload the new files.</li>
 <ol>
        <li>Delete your old WP files, saving ones you've modified.</li>
        <li>Upload the new files.</li>
index b72ff61dcddb7bef04b72eee29910ced2527d0b9..1fd0df5342c40c498be99d785b196a9733b8091e 100644 (file)
@@ -16,6 +16,9 @@ define('WP_ADMIN', true);
 
 require_once('../wp-load.php');
 require_once('includes/admin.php');
 
 require_once('../wp-load.php');
 require_once('includes/admin.php');
+@header('Content-Type: text/html; charset=' . get_option('blog_charset'));
+
+do_action('admin_init');
 
 if ( ! is_user_logged_in() ) {
 
 
 if ( ! is_user_logged_in() ) {
 
@@ -34,17 +37,25 @@ if ( ! is_user_logged_in() ) {
                        $x->send();
        }
 
                        $x->send();
        }
 
+       if ( !empty( $_POST['action']) )
+               do_action( 'wp_ajax_nopriv_' . $_POST['action'] );
+
        die('-1');
 }
 
 if ( isset( $_GET['action'] ) ) :
 switch ( $action = $_GET['action'] ) :
 case 'ajax-tag-search' :
        die('-1');
 }
 
 if ( isset( $_GET['action'] ) ) :
 switch ( $action = $_GET['action'] ) :
 case 'ajax-tag-search' :
-       if ( !current_user_can( 'manage_categories' ) )
+       if ( !current_user_can( 'edit_posts' ) )
                die('-1');
 
        $s = $_GET['q']; // is this slashed already?
 
                die('-1');
 
        $s = $_GET['q']; // is this slashed already?
 
+       if ( isset($_GET['tax']) )
+               $taxonomy = sanitize_title($_GET['tax']);
+       else
+               die('0');
+
        if ( false !== strpos( $s, ',' ) ) {
                $s = explode( ',', $s );
                $s = $s[count( $s ) - 1];
        if ( false !== strpos( $s, ',' ) ) {
                $s = explode( ',', $s );
                $s = $s[count( $s ) - 1];
@@ -52,10 +63,54 @@ case 'ajax-tag-search' :
        $s = trim( $s );
        if ( strlen( $s ) < 2 )
                die; // require 2 chars for matching
        $s = trim( $s );
        if ( strlen( $s ) < 2 )
                die; // require 2 chars for matching
-       $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = 'post_tag' AND t.name LIKE ('%". $s . "%')" );
+
+       $results = $wpdb->get_col( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = '$taxonomy' AND t.name LIKE ('%" . $s . "%')" );
+
        echo join( $results, "\n" );
        die;
        break;
        echo join( $results, "\n" );
        die;
        break;
+case 'wp-compression-test' :
+       if ( !current_user_can( 'manage_options' ) )
+               die('-1');
+
+       if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) {
+               update_site_option('can_compress_scripts', 0);
+               die('0');
+       }
+
+       if ( isset($_GET['test']) ) {
+               header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
+               header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
+               header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
+               header( 'Pragma: no-cache' );
+               header('Content-Type: application/x-javascript; charset=UTF-8');
+               $force_gzip = ( defined('ENFORCE_GZIP') && ENFORCE_GZIP );
+               $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."';
+
+                if ( 1 == $_GET['test'] ) {
+                       echo $test_str;
+                       die;
+                } elseif ( 2 == $_GET['test'] ) {
+                       if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
+                               header('Content-Encoding: deflate');
+                               $out = gzdeflate( $test_str, 1 );
+                       } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
+                               header('Content-Encoding: gzip');
+                               $out = gzencode( $test_str, 1 );
+                       } else {
+                               die('-1');
+                       }
+                       echo $out;
+                       die;
+               } elseif ( 'no' == $_GET['test'] ) {
+                       update_site_option('can_compress_scripts', 0);
+               } elseif ( 'yes' == $_GET['test'] ) {
+                       update_site_option('can_compress_scripts', 1);
+               }
+       }
+
+       die('0');
+       break;
 default :
        do_action( 'wp_ajax_' . $_GET['action'] );
        die('0');
 default :
        do_action( 'wp_ajax_' . $_GET['action'] );
        die('0');
@@ -63,24 +118,85 @@ default :
 endswitch;
 endif;
 
 endswitch;
 endif;
 
+/**
+ * Sends back current comment total and new page links if they need to be updated.
+ *
+ * Contrary to normal success AJAX response ("1"), die with time() on success.
+ *
+ * @since 2.7
+ *
+ * @param int $comment_id
+ * @return die
+ */
+function _wp_ajax_delete_comment_response( $comment_id ) {
+       $total = (int) @$_POST['_total'];
+       $per_page = (int) @$_POST['_per_page'];
+       $page = (int) @$_POST['_page'];
+       $url = esc_url_raw( @$_POST['_url'] );
+       // JS didn't send us everything we need to know. Just die with success message
+       if ( !$total || !$per_page || !$page || !$url )
+               die( (string) time() );
+
+       if ( --$total < 0 ) // Take the total from POST and decrement it (since we just deleted one)
+               $total = 0;
+
+       if ( 0 != $total % $per_page && 1 != mt_rand( 1, $per_page ) ) // Only do the expensive stuff on a page-break, and about 1 other time per page
+               die( (string) time() );
+
+       $status = 'total_comments'; // What type of comment count are we looking for?
+       $parsed = parse_url( $url );
+       if ( isset( $parsed['query'] ) ) {
+               parse_str( $parsed['query'], $query_vars );
+               if ( !empty( $query_vars['comment_status'] ) )
+                       $status = $query_vars['comment_status'];
+       }
+
+       $comment_count = wp_count_comments();
+       $time = time(); // The time since the last comment count
+
+       if ( isset( $comment_count->$status ) ) // We're looking for a known type of comment count
+               $total = $comment_count->$status;
+       // else use the decremented value from above
+
+       $page_links = paginate_links( array(
+               'base' => add_query_arg( 'apage', '%#%', $url ),
+               'format' => '',
+               'prev_text' => __('&laquo;'),
+               'next_text' => __('&raquo;'),
+               'total' => ceil($total / $per_page),
+               'current' => $page
+       ) );
+       $x = new WP_Ajax_Response( array(
+               'what' => 'comment',
+               'id' => $comment_id, // here for completeness - not used
+               'supplemental' => array(
+                       'pageLinks' => $page_links,
+                       'total' => $total,
+                       'time' => $time
+               )
+       ) );
+       $x->send();
+}
+
 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
 switch ( $action = $_POST['action'] ) :
 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
 switch ( $action = $_POST['action'] ) :
-case 'delete-comment' :
+case 'delete-comment' : // On success, die with time() instead of 1
        check_ajax_referer( "delete-comment_$id" );
        if ( !$comment = get_comment( $id ) )
        check_ajax_referer( "delete-comment_$id" );
        if ( !$comment = get_comment( $id ) )
-               die('1');
+               die( (string) time() );
        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
                die('-1');
 
        if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
                if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
                die('-1');
 
        if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
                if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
-                       die('1');
+                       die( (string) time() );
                $r = wp_set_comment_status( $comment->comment_ID, 'spam' );
        } else {
                $r = wp_delete_comment( $comment->comment_ID );
        }
                $r = wp_set_comment_status( $comment->comment_ID, 'spam' );
        } else {
                $r = wp_delete_comment( $comment->comment_ID );
        }
-
-       die( $r ? '1' : '0' );
+       if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
+               _wp_ajax_delete_comment_response( $comment->comment_ID );
+       die( '0' );
        break;
 case 'delete-cat' :
        check_ajax_referer( "delete-category_$id" );
        break;
 case 'delete-cat' :
        check_ajax_referer( "delete-category_$id" );
@@ -101,11 +217,16 @@ case 'delete-tag' :
        if ( !current_user_can( 'manage_categories' ) )
                die('-1');
 
        if ( !current_user_can( 'manage_categories' ) )
                die('-1');
 
-       $tag = get_term( $id, 'post_tag' );
+       if ( !empty($_POST['taxonomy']) )
+               $taxonomy = $_POST['taxonomy'];
+       else
+               $taxonomy = 'post_tag';
+
+       $tag = get_term( $id, $taxonomy );
        if ( !$tag || is_wp_error( $tag ) )
                die('1');
 
        if ( !$tag || is_wp_error( $tag ) )
                die('1');
 
-       if ( wp_delete_term($id, 'post_tag'))
+       if ( wp_delete_term($id, $taxonomy))
                die('1');
        else
                die('0');
                die('1');
        else
                die('0');
@@ -121,8 +242,10 @@ case 'delete-link-cat' :
 
        $cat_name = get_term_field('name', $id, 'link_category');
 
 
        $cat_name = get_term_field('name', $id, 'link_category');
 
+       $default = get_option('default_link_category');
+
        // Don't delete the default cats.
        // Don't delete the default cats.
-       if ( $id == get_option('default_link_category') ) {
+       if ( $id == $default ) {
                $x = new WP_AJAX_Response( array(
                        'what' => 'link-cat',
                        'id' => $id,
                $x = new WP_AJAX_Response( array(
                        'what' => 'link-cat',
                        'id' => $id,
@@ -131,7 +254,7 @@ case 'delete-link-cat' :
                $x->send();
        }
 
                $x->send();
        }
 
-       $r = wp_delete_term($id, 'link_category');
+       $r = wp_delete_term($id, 'link_category', array('default' => $default));
        if ( !$r )
                die('0');
        if ( is_wp_error($r) ) {
        if ( !$r )
                die('0');
        if ( is_wp_error($r) ) {
@@ -195,9 +318,15 @@ case 'delete-page' :
        else
                die('0');
        break;
        else
                die('0');
        break;
-case 'dim-comment' :
-       if ( !$comment = get_comment( $id ) )
-               die('0');
+case 'dim-comment' : // On success, die with time() instead of 1
+
+       if ( !$comment = get_comment( $id ) ) {
+               $x = new WP_Ajax_Response( array(
+                       'what' => 'comment',
+                       'id' => new WP_Error('invalid_comment', sprintf(__('Comment %d does not exist'), $id))
+               ) );
+               $x->send();
+       }
 
        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
                die('-1');
 
        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
                die('-1');
@@ -206,18 +335,27 @@ case 'dim-comment' :
 
        $current = wp_get_comment_status( $comment->comment_ID );
        if ( $_POST['new'] == $current )
 
        $current = wp_get_comment_status( $comment->comment_ID );
        if ( $_POST['new'] == $current )
-               die('1');
+               die( (string) time() );
 
 
+       $r = 0;
        if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
                check_ajax_referer( "approve-comment_$id" );
        if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
                check_ajax_referer( "approve-comment_$id" );
-               if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
-                       die('1');
+               $result = wp_set_comment_status( $comment->comment_ID, 'approve', true );
        } else {
                check_ajax_referer( "unapprove-comment_$id" );
        } else {
                check_ajax_referer( "unapprove-comment_$id" );
-               if ( wp_set_comment_status( $comment->comment_ID, 'hold' ) )
-                       die('1');
+               $result = wp_set_comment_status( $comment->comment_ID, 'hold', true );
        }
        }
-       die('0');
+       if ( is_wp_error($result) ) {
+               $x = new WP_Ajax_Response( array(
+                       'what' => 'comment',
+                       'id' => $result
+               ) );
+               $x->send();
+       }
+
+       // Decide if we need to send back '1' or a more complicated response including page links and comment counts
+       _wp_ajax_delete_comment_response( $comment->comment_ID );
+       die( '0' );
        break;
 case 'add-category' : // On the Fly
        check_ajax_referer( $action );
        break;
 case 'add-category' : // On the Fly
        check_ajax_referer( $action );
@@ -286,11 +424,11 @@ case 'add-link-category' : // On the Fly
                        $cat_id = wp_insert_term( $cat_name, 'link_category' );
                }
                $cat_id = $cat_id['term_id'];
                        $cat_id = wp_insert_term( $cat_name, 'link_category' );
                }
                $cat_id = $cat_id['term_id'];
-               $cat_name = wp_specialchars(stripslashes($cat_name));
+               $cat_name = esc_html(stripslashes($cat_name));
                $x->add( array(
                        'what' => 'link-category',
                        'id' => $cat_id,
                $x->add( array(
                        'what' => 'link-category',
                        'id' => $cat_id,
-                       'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='$cat_id' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>",
+                       'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='" . esc_attr($cat_id) . "' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>",
                        'position' => -1
                ) );
        }
                        'position' => -1
                ) );
        }
@@ -309,7 +447,7 @@ case 'add-cat' : // From Manage->Categories
                $x->send();
        }
 
                $x->send();
        }
 
-       if ( category_exists( trim( $_POST['cat_name'] ) ) ) {
+       if ( category_exists( trim( $_POST['cat_name'] ), $_POST['category_parent'] ) ) {
                $x = new WP_Ajax_Response( array(
                        'what' => 'cat',
                        'id' => new WP_Error( 'cat_exists', __('The category you are trying to create already exists.'), array( 'form-field' => 'cat_name' ) ),
                $x = new WP_Ajax_Response( array(
                        'what' => 'cat',
                        'id' => new WP_Error( 'cat_exists', __('The category you are trying to create already exists.'), array( 'form-field' => 'cat_name' ) ),
@@ -338,7 +476,7 @@ case 'add-cat' : // From Manage->Categories
                $cat_full_name = $_cat->name . ' &#8212; ' . $cat_full_name;
                $level++;
        }
                $cat_full_name = $_cat->name . ' &#8212; ' . $cat_full_name;
                $level++;
        }
-       $cat_full_name = attribute_escape($cat_full_name);
+       $cat_full_name = esc_attr($cat_full_name);
 
        $x = new WP_Ajax_Response( array(
                'what' => 'cat',
 
        $x = new WP_Ajax_Response( array(
                'what' => 'cat',
@@ -397,7 +535,12 @@ case 'add-tag' : // From Manage->Tags
                $x->send();
        }
 
                $x->send();
        }
 
-       $tag = wp_insert_term($_POST['name'], 'post_tag', $_POST );
+       if ( !empty($_POST['taxonomy']) )
+               $taxonomy = $_POST['taxonomy'];
+       else
+               $taxonomy = 'post_tag';
+
+       $tag = wp_insert_term($_POST['name'], $taxonomy, $_POST );
 
        if ( is_wp_error($tag) ) {
                $x = new WP_Ajax_Response( array(
 
        if ( is_wp_error($tag) ) {
                $x = new WP_Ajax_Response( array(
@@ -407,26 +550,31 @@ case 'add-tag' : // From Manage->Tags
                $x->send();
        }
 
                $x->send();
        }
 
-       if ( !$tag || (!$tag = get_term( $tag['term_id'], 'post_tag' )) )
+       if ( !$tag || (!$tag = get_term( $tag['term_id'], $taxonomy )) )
                die('0');
 
        $tag_full_name = $tag->name;
                die('0');
 
        $tag_full_name = $tag->name;
-       $tag_full_name = attribute_escape($tag_full_name);
+       $tag_full_name = esc_attr($tag_full_name);
 
        $x = new WP_Ajax_Response( array(
                'what' => 'tag',
                'id' => $tag->term_id,
                'position' => '-1',
 
        $x = new WP_Ajax_Response( array(
                'what' => 'tag',
                'id' => $tag->term_id,
                'position' => '-1',
-               'data' => _tag_row( $tag ),
+               'data' => _tag_row( $tag, '', $taxonomy ),
                'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__( 'Tag <a href="#%s">%s</a> added' ), "tag-$tag->term_id", $tag_full_name))
        ) );
        $x->send();
        break;
 case 'get-tagcloud' :
                'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__( 'Tag <a href="#%s">%s</a> added' ), "tag-$tag->term_id", $tag_full_name))
        ) );
        $x->send();
        break;
 case 'get-tagcloud' :
-       if ( !current_user_can( 'manage_categories' ) )
+       if ( !current_user_can( 'edit_posts' ) )
                die('-1');
 
                die('-1');
 
-       $tags = get_tags( array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
+       if ( isset($_POST['tax']) )
+               $taxonomy = sanitize_title($_POST['tax']);
+       else
+               die('0');
+
+       $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
 
        if ( empty( $tags ) )
                die( __('No tags found!') );
 
        if ( empty( $tags ) )
                die( __('No tags found!') );
@@ -439,7 +587,8 @@ case 'get-tagcloud' :
                $tags[ $key ]->id = $tag->term_id;
        }
 
                $tags[ $key ]->id = $tag->term_id;
        }
 
-       $return = wp_generate_tag_cloud( $tags );
+       // We need raw tag names here, so don't filter the output
+       $return = wp_generate_tag_cloud( $tags, array('filter' => 0) );
 
        if ( empty($return) )
                die('0');
 
        if ( empty($return) )
                die('0');
@@ -596,6 +745,7 @@ case 'edit-comment' :
        $mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
        $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
        $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
        $mode = ( isset($_POST['mode']) && 'single' == $_POST['mode'] ) ? 'single' : 'detail';
        $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
        $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
+       $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
 
        if ( get_option('show_avatars') && 'single' != $mode )
                add_filter( 'comment_author', 'floated_admin_avatar' );
 
        if ( get_option('show_avatars') && 'single' != $mode )
                add_filter( 'comment_author', 'floated_admin_avatar' );
@@ -603,7 +753,7 @@ case 'edit-comment' :
        $x = new WP_Ajax_Response();
 
        ob_start();
        $x = new WP_Ajax_Response();
 
        ob_start();
-               _wp_comment_row( $comment_id, $mode, true, $checkbox );
+               _wp_comment_row( $comment_id, $mode, $comments_listing, $checkbox );
                $comment_list_item = ob_get_contents();
        ob_end_clean();
 
                $comment_list_item = ob_get_contents();
        ob_end_clean();
 
@@ -623,7 +773,7 @@ case 'add-meta' :
        if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) {
                if ( !current_user_can( 'edit_post', $pid ) )
                        die('-1');
        if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) {
                if ( !current_user_can( 'edit_post', $pid ) )
                        die('-1');
-               if ( '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
+               if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
                        die('1');
                if ( $pid < 0 ) {
                        $now = current_time('timestamp', 1);
                        die('1');
                if ( $pid < 0 ) {
                        $now = current_time('timestamp', 1);
@@ -637,12 +787,13 @@ case 'add-meta' :
                                        ) );
                                        $x->send();
                                }
                                        ) );
                                        $x->send();
                                }
-                               $mid = add_meta( $pid );
+                               if ( !$mid = add_meta( $pid ) )
+                                       die(__('Please provide a custom field value.'));
                        } else {
                                die('0');
                        }
                } else if ( !$mid = add_meta( $pid ) ) {
                        } else {
                                die('0');
                        }
                } else if ( !$mid = add_meta( $pid ) ) {
-                       die('0');
+                       die(__('Please provide a custom field value.'));
                }
 
                $meta = get_post_meta_by_id( $mid );
                }
 
                $meta = get_post_meta_by_id( $mid );
@@ -664,7 +815,8 @@ case 'add-meta' :
                if ( !current_user_can( 'edit_post', $meta->post_id ) )
                        die('-1');
                if ( !$u = update_meta( $mid, $key, $value ) )
                if ( !current_user_can( 'edit_post', $meta->post_id ) )
                        die('-1');
                if ( !$u = update_meta( $mid, $key, $value ) )
-                       die('1'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
+                       die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
+
                $key = stripslashes($key);
                $value = stripslashes($value);
                $x = new WP_Ajax_Response( array(
                $key = stripslashes($key);
                $value = stripslashes($value);
                $x = new WP_Ajax_Response( array(
@@ -715,7 +867,6 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
        global $current_user;
 
        $_POST['post_category'] = explode(",", $_POST['catslist']);
        global $current_user;
 
        $_POST['post_category'] = explode(",", $_POST['catslist']);
-       $_POST['tags_input'] = explode(",", $_POST['tags_input']);
        if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
                unset($_POST['post_category']);
 
        if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
                unset($_POST['post_category']);
 
@@ -723,7 +874,9 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
        $do_lock = true;
 
        $data = '';
        $do_lock = true;
 
        $data = '';
-       $message = sprintf( __('Draft Saved at %s.'), date_i18n( __('g:i:s a') ) );
+       /* translators: draft saved date format, see http://php.net/date */
+       $draft_saved_date_format = __('g:i:s a');
+       $message = sprintf( __('Draft Saved at %s.'), date_i18n( $draft_saved_date_format ) );
 
        $supplemental = array();
 
 
        $supplemental = array();
 
@@ -747,7 +900,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
                        $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
                        $data = new WP_Error( 'locked', sprintf(
                                $_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
                        $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
                        $data = new WP_Error( 'locked', sprintf(
                                $_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
-                               wp_specialchars( $last_user_name )
+                               esc_html( $last_user_name )
                        ) );
 
                        $supplemental['disable_autosave'] = 'disable';
                        ) );
 
                        $supplemental['disable_autosave'] = 'disable';
@@ -818,32 +971,65 @@ case 'autosave-generate-nonces' :
 break;
 case 'closed-postboxes' :
        check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
 break;
 case 'closed-postboxes' :
        check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
-       $closed = isset( $_POST['closed'] )? $_POST['closed'] : '';
+       $closed = isset( $_POST['closed'] ) ? $_POST['closed'] : '';
        $closed = explode( ',', $_POST['closed'] );
        $closed = explode( ',', $_POST['closed'] );
-       $hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : '';
+       $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
        $hidden = explode( ',', $_POST['hidden'] );
        $hidden = explode( ',', $_POST['hidden'] );
-       $page = isset( $_POST['page'] )? $_POST['page'] : '';
-       if ( !preg_match( '/^[a-z-_]+$/', $page ) ) {
-               die(-1);
-       }
-       $current_user = wp_get_current_user();
+       $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
+
+       if ( !preg_match( '/^[a-z_-]+$/', $page ) )
+               die('-1');
+
+       if ( ! $user = wp_get_current_user() )
+               die('-1');
+
        if ( is_array($closed) )
        if ( is_array($closed) )
-               update_usermeta($current_user->ID, 'closedpostboxes_'.$page, $closed);
-       if ( is_array($hidden) )
-               update_usermeta($current_user->ID, 'meta-box-hidden_'.$page, $hidden);
-break;
+               update_usermeta($user->ID, 'closedpostboxes_'.$page, $closed);
+
+       if ( is_array($hidden) ) {
+               $hidden = array_diff( $hidden, array('submitdiv', 'pagesubmitdiv', 'linksubmitdiv') ); // postboxes that are always shown
+               update_usermeta($user->ID, 'meta-box-hidden_'.$page, $hidden);
+       }
+
+       die('1');
+       break;
 case 'hidden-columns' :
 case 'hidden-columns' :
-       check_ajax_referer( 'hiddencolumns', 'hiddencolumnsnonce' );
-       $hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : '';
+       check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
+       $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
        $hidden = explode( ',', $_POST['hidden'] );
        $hidden = explode( ',', $_POST['hidden'] );
-       $page = isset( $_POST['page'] )? $_POST['page'] : '';
-       if ( !preg_match( '/^[a-z-_]+$/', $page ) ) {
-               die(-1);
-       }
-       $current_user = wp_get_current_user();
+       $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
+
+       if ( !preg_match( '/^[a-z_-]+$/', $page ) )
+               die('-1');
+
+       if ( ! $user = wp_get_current_user() )
+               die('-1');
+
        if ( is_array($hidden) )
        if ( is_array($hidden) )
-               update_usermeta($current_user->ID, "manage-$page-columns-hidden", $hidden);
-break;
+               update_usermeta($user->ID, "manage-$page-columns-hidden", $hidden);
+
+       die('1');
+       break;
+case 'meta-box-order':
+       check_ajax_referer( 'meta-box-order' );
+       $order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false;
+       $page_columns = isset( $_POST['page_columns'] ) ? (int) $_POST['page_columns'] : 0;
+       $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
+
+       if ( !preg_match( '/^[a-z_-]+$/', $page ) )
+               die('-1');
+
+       if ( ! $user = wp_get_current_user() )
+               die('-1');
+
+       if ( $order )
+               update_user_option($user->ID, "meta-box-order_$page", $order);
+
+       if ( $page_columns )
+               update_usermeta($user->ID, "screen_layout_$page", $page_columns);
+
+       die('1');
+       break;
 case 'get-permalink':
        check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
        $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
 case 'get-permalink':
        check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
        $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
@@ -873,12 +1059,15 @@ case 'inline-save':
        if ( $last = wp_check_post_lock( $post_ID ) ) {
                $last_user = get_userdata( $last );
                $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
        if ( $last = wp_check_post_lock( $post_ID ) ) {
                $last_user = get_userdata( $last );
                $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
-               printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),        wp_specialchars( $last_user_name ) );
+               printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),        esc_html( $last_user_name ) );
                exit;
        }
 
        $data = &$_POST;
                exit;
        }
 
        $data = &$_POST;
+
        $post = get_post( $post_ID, ARRAY_A );
        $post = get_post( $post_ID, ARRAY_A );
+       $post = add_magic_quotes($post); //since it is from db
+
        $data['content'] = $post['post_content'];
        $data['excerpt'] = $post['post_excerpt'];
 
        $data['content'] = $post['post_content'];
        $data['excerpt'] = $post['post_excerpt'];
 
@@ -900,7 +1089,6 @@ case 'inline-save':
                $data['ping_status'] = 'closed';
 
        // update the post
                $data['ping_status'] = 'closed';
 
        // update the post
-       $_POST = $data;
        edit_post();
 
        $post = array();
        edit_post();
 
        $post = array();
@@ -954,9 +1142,17 @@ case 'inline-save-tax':
 
                        break;
                case 'tag' :
 
                        break;
                case 'tag' :
-                       $updated = wp_update_term($id, 'post_tag', $_POST);
+                       if ( !empty($_POST['taxonomy']) )
+                               $taxonomy = $_POST['taxonomy'];
+                       else
+                               $taxonomy = 'post_tag';
+
+                       $tag = get_term( $id, $taxonomy );
+                       $_POST['description'] = $tag->description;
+
+                       $updated = wp_update_term($id, $taxonomy, $_POST);
                        if ( $updated && !is_wp_error($updated) ) {
                        if ( $updated && !is_wp_error($updated) ) {
-                               $tag = get_term( $updated['term_id'], 'post_tag' );
+                               $tag = get_term( $updated['term_id'], $taxonomy );
                                if ( !$tag || is_wp_error( $tag ) )
                                        die( __('Tag not updated.') );
 
                                if ( !$tag || is_wp_error( $tag ) )
                                        die( __('Tag not updated.') );
 
@@ -970,11 +1166,6 @@ case 'inline-save-tax':
 
        exit;
        break;
 
        exit;
        break;
-case 'meta-box-order':
-       check_ajax_referer( 'meta-box-order' );
-       update_user_option( $GLOBALS['current_user']->ID, "meta-box-order_$_POST[page]", $_POST['order'] );
-       die('1');
-       break;
 case 'find_posts':
        check_ajax_referer( 'find-posts' );
 
 case 'find_posts':
        check_ajax_referer( 'find-posts' );
 
@@ -1001,7 +1192,7 @@ case 'find_posts':
        if ( ! $posts )
                exit( __('No posts found.') );
 
        if ( ! $posts )
                exit( __('No posts found.') );
 
-       $html = '<table class="widefat"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th>'.__('Time').'</th><th>'.__('Status').'</th></tr></thead><tbody>';
+       $html = '<table class="widefat" cellspacing="0"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th>'.__('Time').'</th><th>'.__('Status').'</th></tr></thead><tbody>';
        foreach ( $posts as $post ) {
 
                switch ( $post->post_status ) {
        foreach ( $posts as $post ) {
 
                switch ( $post->post_status ) {
@@ -1023,11 +1214,12 @@ case 'find_posts':
                if ( '0000-00-00 00:00:00' == $post->post_date ) {
                        $time = '';
                } else {
                if ( '0000-00-00 00:00:00' == $post->post_date ) {
                        $time = '';
                } else {
+                       /* translators: date format in table columns, see http://php.net/date */
                        $time = mysql2date(__('Y/m/d'), $post->post_date);
                }
 
                        $time = mysql2date(__('Y/m/d'), $post->post_date);
                }
 
-               $html .= '<tr class="found-posts"><td class="found-radio"><input type="radio" id="found-'.$post->ID.'" name="found_post_id" value="'.$post->ID.'"></td>';
-               $html .= '<td><label for="found-'.$post->ID.'">'.wp_specialchars($post->post_title, true).'</label></td><td>'.wp_specialchars($time, true).'</td><td>'.wp_specialchars($stat, true).'</td></tr>'."\n\n";
+               $html .= '<tr class="found-posts"><td class="found-radio"><input type="radio" id="found-'.$post->ID.'" name="found_post_id" value="' . esc_attr($post->ID) . '"></td>';
+               $html .= '<td><label for="found-'.$post->ID.'">'.esc_html( $post->post_title ).'</label></td><td>'.esc_html( $time ).'</td><td>'.esc_html( $stat ).'</td></tr>'."\n\n";
        }
        $html .= '</tbody></table>';
 
        }
        $html .= '</tbody></table>';
 
@@ -1038,6 +1230,117 @@ case 'find_posts':
        ));
        $x->send();
 
        ));
        $x->send();
 
+       break;
+case 'lj-importer' :
+       check_ajax_referer( 'lj-api-import' );
+       if ( !current_user_can( 'publish_posts' ) )
+               die('-1');
+       if ( empty( $_POST['step'] ) )
+               die( '-1' );
+       define('WP_IMPORTING', true);
+       include( ABSPATH . 'wp-admin/import/livejournal.php' );
+       $result = $lj_api_import->{ 'step' . ( (int) $_POST['step'] ) }();
+       if ( is_wp_error( $result ) )
+               echo $result->get_error_message();
+       die;
+       break;
+case 'widgets-order' :
+       check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
+
+       if ( !current_user_can('switch_themes') )
+               die('-1');
+
+       unset( $_POST['savewidgets'], $_POST['action'] );
+
+       // save widgets order for all sidebars
+       if ( is_array($_POST['sidebars']) ) {
+               $sidebars = array();
+               foreach ( $_POST['sidebars'] as $key => $val ) {
+                       $sb = array();
+                       if ( !empty($val) ) {
+                               $val = explode(',', $val);
+                               foreach ( $val as $k => $v ) {
+                                       if ( strpos($v, 'widget-') === false )
+                                               continue;
+
+                                       $sb[$k] = substr($v, strpos($v, '_') + 1);
+                               }
+                       }
+                       $sidebars[$key] = $sb;
+               }
+               wp_set_sidebars_widgets($sidebars);
+               die('1');
+       }
+
+       die('-1');
+       break;
+case 'save-widget' :
+       check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
+
+       if ( !current_user_can('switch_themes') || !isset($_POST['id_base']) )
+               die('-1');
+
+       unset( $_POST['savewidgets'], $_POST['action'] );
+
+       do_action('load-widgets.php');
+       do_action('widgets.php');
+       do_action('sidebar_admin_setup');
+
+       $id_base = $_POST['id_base'];
+       $widget_id = $_POST['widget-id'];
+       $sidebar_id = $_POST['sidebar'];
+       $multi_number = !empty($_POST['multi_number']) ? (int) $_POST['multi_number'] : 0;
+       $settings = isset($_POST['widget-' . $id_base]) && is_array($_POST['widget-' . $id_base]) ? $_POST['widget-' . $id_base] : false;
+       $error = '<p>' . __('An error has occured. Please reload the page and try again.') . '</p>';
+
+       $sidebars = wp_get_sidebars_widgets();
+       $sidebar = isset($sidebars[$sidebar_id]) ? $sidebars[$sidebar_id] : array();
+
+       // delete
+       if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
+
+               if ( !isset($wp_registered_widgets[$widget_id]) )
+                       die($error);
+
+               $sidebar = array_diff( $sidebar, array($widget_id) );
+               $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
+       } elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) {
+               if ( !$multi_number )
+                       die($error);
+
+               $_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) );
+               $widget_id = $id_base . '-' . $multi_number;
+               $sidebar[] = $widget_id;
+       }
+       $_POST['widget-id'] = $sidebar;
+
+       foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
+
+               if ( $name == $id_base ) {
+                       if ( !is_callable( $control['callback'] ) )
+                               continue;
+
+                       ob_start();
+                               call_user_func_array( $control['callback'], $control['params'] );
+                       ob_end_clean();
+                       break;
+               }
+       }
+
+       if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
+               $sidebars[$sidebar_id] = $sidebar;
+               wp_set_sidebars_widgets($sidebars);
+               echo "deleted:$widget_id";
+               die();
+       }
+
+       if ( !empty($_POST['add_new']) )
+               die();
+
+       if ( $form = $wp_registered_widget_controls[$widget_id] )
+               call_user_func_array( $form['callback'], $form['params'] );
+
+       die();
        break;
 default :
        do_action( 'wp_ajax_' . $_POST['action'] );
        break;
 default :
        do_action( 'wp_ajax_' . $_POST['action'] );
index 87d953fa22bdb75a5ca5ddb5d0bd06b8f7060092..7c2bcd29406a48b5e23bab92c73621cf66cf24c1 100644 (file)
 <p id="footer-left" class="alignleft"><?php
 do_action( 'in_admin_footer' );
 $upgrade = apply_filters( 'update_footer', '' );
 <p id="footer-left" class="alignleft"><?php
 do_action( 'in_admin_footer' );
 $upgrade = apply_filters( 'update_footer', '' );
-echo '<span id="footer-thankyou">' . __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.').'</span> | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>'); ?>
+echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.').'</span> | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>') ); ?>
 </p>
 <?php // if ( $is_IE ) browse_happy(); ?>
 <p id="footer-upgrade" class="alignright"><?php echo $upgrade; ?></p>
 <div class="clear"></div>
 </div>
 </p>
 <?php // if ( $is_IE ) browse_happy(); ?>
 <p id="footer-upgrade" class="alignright"><?php echo $upgrade; ?></p>
 <div class="clear"></div>
 </div>
-<?php do_action('admin_footer', ''); ?>
+<?php
+do_action('admin_footer', '');
+do_action('admin_print_footer_scripts');
+do_action("admin_footer-$hook_suffix");
+
+// get_site_option() won't exist when auto upgrading from <= 2.7
+if ( function_exists('get_site_option') ) {
+       if ( false === get_site_option('can_compress_scripts') )
+               compression_test();
+}
+
+?>
+
 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
 </body>
 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
 </body>
-</html>
\ No newline at end of file
+</html>
index 33e88732c3af25d946396bf65c7c9df02ac97d86..27c496a710d1f2c0da42c5e4df66aa852c8d5e82 100644 (file)
 if (!isset($_GET["page"])) require_once('admin.php');
 
 get_admin_page_title();
 if (!isset($_GET["page"])) require_once('admin.php');
 
 get_admin_page_title();
-$title = wp_specialchars( strip_tags( $title ) );
+$title = esc_html( strip_tags( $title ) );
 wp_user_settings();
 wp_user_settings();
+wp_menu_unfold();
 ?>
 <!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
 <head>
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
 ?>
 <!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
 <head>
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
-<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
+<title><?php echo $title; ?> &lsaquo; <?php bloginfo('name') ?>  &#8212; WordPress</title>
 <?php
 
 wp_admin_css( 'css/global' );
 wp_admin_css();
 wp_admin_css( 'css/colors' );
 wp_admin_css( 'css/ie' );
 <?php
 
 wp_admin_css( 'css/global' );
 wp_admin_css();
 wp_admin_css( 'css/colors' );
 wp_admin_css( 'css/ie' );
+wp_enqueue_script('utils');
 
 
+$hook_suffix = '';
+if ( isset($page_hook) )
+       $hook_suffix = "$page_hook";
+else if ( isset($plugin_page) )
+       $hook_suffix = "$plugin_page";
+else if ( isset($pagenow) )
+       $hook_suffix = "$pagenow";
+
+$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
 ?>
 <script type="text/javascript">
 //<![CDATA[
 ?>
 <script type="text/javascript">
 //<![CDATA[
-addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
-
-function convertEntities(o) {
-       var c = function(s) {
-               if (/&[^;]+;/.test(s)) {
-                       var e = document.createElement("div");
-                       e.innerHTML = s;
-                       return !e.firstChild ? s : e.firstChild.nodeValue;
-               }
-               return s;
-       }
-
-       if ( typeof o === 'string' )
-               return c(o);
-       else if ( typeof o === 'object' )
-               for (var v in o) {
-                       if ( typeof o[v] === 'string' )
-                               o[v] = c(o[v]);
-               }
-       return o;
-};
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
+var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>';
 //]]>
 </script>
 <?php
 
 if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
 //]]>
 </script>
 <?php
 
 if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
-       add_action( 'admin_head', 'wp_tiny_mce' );
+       add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
+       wp_enqueue_script('quicktags');
 }
 
 }
 
-$hook_suffix = '';
-if ( isset($page_hook) )
-       $hook_suffix = "$page_hook";
-else if ( isset($plugin_page) )
-       $hook_suffix = "$plugin_page";
-else if ( isset($pagenow) )
-       $hook_suffix = "$pagenow";
-
+do_action('admin_enqueue_scripts', $hook_suffix);
 do_action("admin_print_styles-$hook_suffix");
 do_action('admin_print_styles');
 do_action("admin_print_scripts-$hook_suffix");
 do_action("admin_print_styles-$hook_suffix");
 do_action('admin_print_styles');
 do_action("admin_print_scripts-$hook_suffix");
@@ -72,11 +59,24 @@ do_action('admin_print_scripts');
 do_action("admin_head-$hook_suffix");
 do_action('admin_head');
 
 do_action("admin_head-$hook_suffix");
 do_action('admin_head');
 
+if ( get_user_setting('mfold') == 'f' ) {
+       $admin_body_class .= ' folded';
+}
+
 if ( $is_iphone ) { ?>
 <style type="text/css">.row-actions{visibility:visible;}</style>
 <?php } ?>
 </head>
 if ( $is_iphone ) { ?>
 <style type="text/css">.row-actions{visibility:visible;}</style>
 <?php } ?>
 </head>
-<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
+<body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
+<script type="text/javascript">
+//<![CDATA[
+(function(){
+var c = document.body.className;
+c = c.replace(/no-js/, 'js');
+document.body.className = c;
+})();
+//]]>
+</script>
 
 <div id="wpwrap">
 <div id="wpcontent">
 
 <div id="wpwrap">
 <div id="wpcontent">
@@ -101,7 +101,7 @@ if ( function_exists('mb_strlen') ) {
 }
 ?>
 
 }
 ?>
 
-<img id="header-logo" src="../wp-includes/images/blank.gif" alt="" width="32" height="32" /> <h1 <?php echo $title_class ?>><a href="<?php echo trailingslashit( get_bloginfo('url') ); ?>" title="<?php _e('Visit site') ?>"><?php echo $blog_name ?> <span>&larr; <?php _e('Visit site') ?></span></a></h1>
+<img id="header-logo" src="../wp-includes/images/blank.gif" alt="" width="32" height="32" /> <h1 id="site-heading" <?php echo $title_class ?>><a href="<?php echo trailingslashit( get_bloginfo('url') ); ?>" title="<?php _e('Visit Site') ?>"><span id="site-title"><?php echo $blog_name ?></span> <em id="site-visit-button"><?php _e('Visit Site') ?></em></a></h1>
 
 <div id="wphead-info">
 <div id="user_info">
 
 <div id="wphead-info">
 <div id="user_info">
@@ -110,14 +110,10 @@ if ( function_exists('mb_strlen') ) {
 <a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
 </div>
 
 <a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
 </div>
 
-<?php favorite_actions(); ?>
+<?php favorite_actions($hook_suffix); ?>
 </div>
 </div>
 
 </div>
 </div>
 
-<?php if ( get_user_setting('mfold') == 'f' ) { ?>
-<script type="text/javascript">jQuery('#wpcontent').addClass('folded');</script>
-<?php } ?>
-
 <div id="wpbody">
 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
 
 <div id="wpbody">
 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
 
index 55c7d9f3686d20053637b8e28b957dd8ee97cd22..d18bf711b357a22f9239b15949c610b22a5b95f9 100644 (file)
@@ -16,14 +16,15 @@ else
 
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
 
 
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
 
-if ( !wp_validate_auth_cookie() )
-       wp_die(__('Cheatin&#8217; uh?'));
-
 nocache_headers();
 
 do_action('admin_init');
 
 $action = 'admin_post';
 nocache_headers();
 
 do_action('admin_init');
 
 $action = 'admin_post';
+
+if ( !wp_validate_auth_cookie() )
+       $action .= '_nopriv';
+
 if ( !empty($_REQUEST['action']) )
        $action .= '_' . $_REQUEST['action'];
 
 if ( !empty($_REQUEST['action']) )
        $action .= '_' . $_REQUEST['action'];
 
index fc6f70780dd028c91f4499eac976210f0e313249..2c216386dd9f880112c785a5eddcb9aac5888876 100644 (file)
  *
  * @since unknown
  */
  *
  * @since unknown
  */
-define('WP_ADMIN', TRUE);
+if ( !defined('WP_ADMIN') )
+       define('WP_ADMIN', TRUE);
 
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
 else
        require_once('../wp-load.php');
 
 
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
 else
        require_once('../wp-load.php');
 
-if ( get_option('db_version') != $wp_db_version ) {
+if ( get_option('db_upgraded') ) {
+       $wp_rewrite->flush_rules();
+       update_option( 'db_upgraded',  false );
+
+       /**
+        * Runs on the next page load after successful upgrade
+        *
+        * @since 2.8
+        */
+       do_action('after_db_upgrade');
+} elseif ( get_option('db_version') != $wp_db_version ) {
        wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
        exit;
 }
        wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
        exit;
 }
@@ -31,8 +42,9 @@ nocache_headers();
 
 update_category_cache();
 
 
 update_category_cache();
 
+set_screen_options();
+
 $posts_per_page = get_option('posts_per_page');
 $posts_per_page = get_option('posts_per_page');
-$what_to_show = get_option('what_to_show');
 $date_format = get_option('date_format');
 $time_format = get_option('time_format');
 
 $date_format = get_option('date_format');
 $time_format = get_option('time_format');
 
index 8ee85fc1f838924581e9fe78efcba146389d5145..4197c8686e331468103d1aa76c29a6e364b10156 100644 (file)
@@ -6,6 +6,8 @@
  * @subpackage Administration
  */
 
  * @subpackage Administration
  */
 
+define('WP_ADMIN', true);
+
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
 else
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
 else
@@ -28,8 +30,9 @@ if ( !current_user_can('upload_files') )
 if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
        if ( 2 == $_REQUEST['fetch'] ) {
                add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
 if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
        if ( 2 == $_REQUEST['fetch'] ) {
                add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
-               echo get_media_item($id, array( 'send' => false, 'delete' => false ));
+               echo get_media_item($id, array( 'send' => false, 'delete' => true ));
        } else {
        } else {
+               add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
                echo get_media_item($id);
        }
        exit;
                echo get_media_item($id);
        }
        exit;
@@ -39,7 +42,7 @@ check_admin_referer('media-form');
 
 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
 if (is_wp_error($id)) {
 
 $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
 if (is_wp_error($id)) {
-       echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
+       echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div>';
        exit;
 }
 
        exit;
 }
 
@@ -53,4 +56,4 @@ else {
        echo apply_filters("async_upload_{$type}", $id);
 }
 
        echo apply_filters("async_upload_{$type}", $id);
 }
 
-?>
\ No newline at end of file
+?>
index e704248025e668eae37a0e8a882079b25a58710f..8d26b9e134480d5b861f99c22cfa785d3614753a 100644 (file)
@@ -25,11 +25,11 @@ case 'addcat':
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
-       if( wp_insert_category($_POST ) ) {
-               wp_redirect('categories.php?message=1#addcat');
-       } else {
-               wp_redirect('categories.php?message=4#addcat');
-       }
+       if ( wp_insert_category($_POST ) )
+               wp_safe_redirect( add_query_arg( 'message', 1, wp_get_referer() ) . '#addcat' );
+       else
+               wp_safe_redirect( add_query_arg( 'message', 4, wp_get_referer() ) . '#addcat' );
+
        exit;
 break;
 
        exit;
 break;
 
@@ -40,15 +40,15 @@ case 'delete':
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
-       $cat_name = get_catname($cat_ID);
+       $cat_name = get_cat_name($cat_ID);
 
        // Don't delete the default cats.
 
        // Don't delete the default cats.
-    if ( $cat_ID == get_option('default_category') )
+       if ( $cat_ID == get_option('default_category') )
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
        wp_delete_category($cat_ID);
 
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
        wp_delete_category($cat_ID);
 
-       wp_redirect('categories.php?message=2');
+       wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) );
        exit;
 
 break;
        exit;
 
 break;
@@ -60,7 +60,7 @@ case 'bulk-delete':
                wp_die( __('You are not allowed to delete categories.') );
 
        foreach ( (array) $_GET['delete'] as $cat_ID ) {
                wp_die( __('You are not allowed to delete categories.') );
 
        foreach ( (array) $_GET['delete'] as $cat_ID ) {
-               $cat_name = get_catname($cat_ID);
+               $cat_name = get_cat_name($cat_ID);
 
                // Don't delete the default cats.
                if ( $cat_ID == get_option('default_category') )
 
                // Don't delete the default cats.
                if ( $cat_ID == get_option('default_category') )
@@ -69,9 +69,7 @@ case 'bulk-delete':
                wp_delete_category($cat_ID);
        }
 
                wp_delete_category($cat_ID);
        }
 
-       $sendback = wp_get_referer();
-
-       wp_redirect($sendback);
+       wp_safe_redirect( wp_get_referer() );
        exit();
 
 break;
        exit();
 
 break;
@@ -131,9 +129,9 @@ $messages[5] = __('Category not updated.');
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_GET['s']) ) ); ?>
 </h2>
 
 <?php
 </h2>
 
 <?php
@@ -144,9 +142,9 @@ endif; ?>
 
 <form class="search-form topmargin" action="" method="get">
 <p class="search-box">
 
 <form class="search-form topmargin" action="" method="get">
 <p class="search-box">
-       <label class="hidden" for="category-search-input"><?php _e('Search Categories'); ?>:</label>
-       <input type="text" class="search-input" id="category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
+       <label class="screen-reader-text" for="category-search-input"><?php _e('Search Categories'); ?>:</label>
+       <input type="text" id="category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Categories' ); ?>" class="button" />
 </p>
 </form>
 <br class="clear" />
 </p>
 </form>
 <br class="clear" />
@@ -162,15 +160,23 @@ endif; ?>
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
-if( ! isset( $catsperpage ) || $catsperpage < 0 )
-       $catsperpage = 20;
+
+$cats_per_page = get_user_option('categories_per_page');
+if ( empty($cats_per_page) )
+       $cats_per_page = 20;
+$cats_per_page = apply_filters('edit_categories_per_page', $cats_per_page);
+
+if ( !empty($_GET['s']) )
+       $num_cats = count(get_categories(array('hide_empty' => 0, 'search' => $_GET['s'])));
+else
+       $num_cats = wp_count_terms('category');
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
        'prev_text' => __('&laquo;'),
        'next_text' => __('&raquo;'),
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
        'prev_text' => __('&laquo;'),
        'next_text' => __('&raquo;'),
-       'total' => ceil(wp_count_terms('category') / $catsperpage),
+       'total' => ceil($num_cats / $cats_per_page),
        'current' => $pagenum
 ));
 
        'current' => $pagenum
 ));
 
@@ -183,7 +189,7 @@ if ( $page_links )
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-categories'); ?>
 </div>
 
 <?php wp_nonce_field('bulk-categories'); ?>
 </div>
 
@@ -207,7 +213,7 @@ if ( $page_links )
 
        <tbody id="the-list" class="list:cat">
 <?php
 
        <tbody id="the-list" class="list:cat">
 <?php
-cat_rows(0, 0, 0, $pagenum, $catsperpage);
+cat_rows(0, 0, 0, $pagenum, $cats_per_page);
 ?>
        </tbody>
 </table>
 ?>
        </tbody>
 </table>
@@ -223,7 +229,7 @@ if ( $page_links )
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 <?php wp_nonce_field('bulk-categories'); ?>
 </div>
 
 <?php wp_nonce_field('bulk-categories'); ?>
 </div>
 
@@ -233,7 +239,7 @@ if ( $page_links )
 </form>
 
 <div class="form-wrap">
 </form>
 
 <div class="form-wrap">
-<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_catname(get_option('default_category')))) ?></p>
+<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), apply_filters('the_category', get_cat_name(get_option('default_category')))) ?></p>
 <p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
 </div>
 
 <p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
 </div>
 
@@ -277,7 +283,7 @@ if ( $page_links )
     <p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
 </div>
 
     <p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
 </div>
 
-<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Category'); ?>" /></p>
+<p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Category'); ?>" /></p>
 <?php do_action('edit_category_form', $category); ?>
 </form></div>
 
 <?php do_action('edit_category_form', $category); ?>
 </form></div>
 
@@ -289,21 +295,6 @@ if ( $page_links )
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected categories.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       }
-               });
-       });
-})(jQuery);
-/* ]]> */
-</script>
-
 <?php
 inline_edit_term_row('categories');
 
 <?php
 inline_edit_term_row('categories');
 
index 129d62113770b37146873e2231c5a7f25d4f809c..f6437e575eaa56f356b2b57bf8868d1fed322ef7 100644 (file)
@@ -90,18 +90,18 @@ if ( 'spam' == $_GET['dt'] ) {
 
 <table width="100%">
 <tr>
 
 <table width="100%">
 <tr>
-<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>" /></td>
-<td class="textright"><input type='submit' class="button" value='<?php echo $button; ?>' /></td>
+<td><input type='button' class="button" value='<?php esc_attr_e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>" /></td>
+<td class="textright"><input type='submit' class="button" value='<?php echo esc_attr($button); ?>' /></td>
 </tr>
 </table>
 
 <?php wp_nonce_field( $nonce_action ); ?>
 </tr>
 </table>
 
 <?php wp_nonce_field( $nonce_action ); ?>
-<input type='hidden' name='action' value='<?php echo $formaction; ?>' />
+<input type='hidden' name='action' value='<?php echo esc_attr($formaction); ?>' />
 <?php if ( 'spam' == $_GET['dt'] ) { ?>
 <input type='hidden' name='dt' value='spam' />
 <?php } ?>
 <?php if ( 'spam' == $_GET['dt'] ) { ?>
 <input type='hidden' name='dt' value='spam' />
 <?php } ?>
-<input type='hidden' name='p' value='<?php echo $comment->comment_post_ID; ?>' />
-<input type='hidden' name='c' value='<?php echo $comment->comment_ID; ?>' />
+<input type='hidden' name='p' value='<?php echo esc_attr($comment->comment_post_ID); ?>' />
+<input type='hidden' name='c' value='<?php echo esc_attr($comment->comment_ID); ?>' />
 <input type='hidden' name='noredir' value='1' />
 </form>
 
 <input type='hidden' name='noredir' value='1' />
 </form>
 
@@ -123,7 +123,7 @@ if ( 'spam' == $_GET['dt'] ) {
 </tr>
 <?php } ?>
 <tr>
 </tr>
 <?php } ?>
 <tr>
-<th scope="row" valign="top"><?php echo _c('Comment|noun'); ?></th>
+<th scope="row" valign="top"><?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th>
 <td><?php echo $comment->comment_content; ?></td>
 </tr>
 </table>
 <td><?php echo $comment->comment_content; ?></td>
 </tr>
 </table>
@@ -216,7 +216,7 @@ case 'approvecomment' :
 case 'editedcomment' :
 
        $comment_id = absint( $_POST['comment_ID'] );
 case 'editedcomment' :
 
        $comment_id = absint( $_POST['comment_ID'] );
-       $comment_post_id = absint( $_POST['comment_post_id'] );
+       $comment_post_id = absint( $_POST['comment_post_ID'] );
 
        check_admin_referer( 'update-comment_' . $comment_id );
 
 
        check_admin_referer( 'update-comment_' . $comment_id );
 
index 4a550afdc10211e002b9026be7e8066afc92da33..99239be4291c9e249c0e455ffb6ebe317f5e37a4 100644 (file)
@@ -12,7 +12,7 @@
        background-image: url(../images/bubble_bg-rtl.gif);
 }
 .tablenav .tablenav-pages a {
        background-image: url(../images/bubble_bg-rtl.gif);
 }
 .tablenav .tablenav-pages a {
-       background: #eee url('../images/menu-bits-rtl.gif') repeat-x scroll right -379px;
+       background: #eee url('../images/menu-bits-rtl-vs.gif') repeat-x scroll right -379px;
 }
 #upload-menu li.current {
        border-right-color: transparent;
 }
 #upload-menu li.current {
        border-right-color: transparent;
@@ -20,7 +20,7 @@
 }
 
 #adminmenu .wp-submenu .current a.current {
 }
 
 #adminmenu .wp-submenu .current a.current {
-       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
+       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll  right -289px;
 }
 
 #adminmenu li.wp-menu-separator {
 }
 
 #adminmenu li.wp-menu-separator {
@@ -33,7 +33,7 @@
 
 #adminmenu li.wp-has-current-submenu .wp-menu-toggle,
 #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
 
 #adminmenu li.wp-has-current-submenu .wp-menu-toggle,
 #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
-       background: transparent url(../images/menu-bits-rtl.gif) repeat-x scroll right -207px;
+       background: transparent url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right -207px;
 }
 
 #adminmenu .wp-has-current-submenu ul li a.current {
 }
 
 #adminmenu .wp-has-current-submenu ul li a.current {
@@ -42,7 +42,7 @@
 
 #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
 #adminmenu .menu-top .current {
 
 #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
 #adminmenu .menu-top .current {
-       background: url(../images/menu-bits-rtl.gif) top right repeat-x;
+       background: url(../images/menu-bits-rtl-vs.gif) top right repeat-x;
 }
 
 #adminmenu li.wp-has-current-submenu ul li a {
 }
 
 #adminmenu li.wp-has-current-submenu ul li a {
 }
 
 #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
 }
 
 #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle, #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
-       background: transparent url(../images/menu-bits-rtl.gif) no-repeat right -207px;
+       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat right -207px;
 }
 
 #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
 #adminmenu .wp-menu-open .wp-menu-toggle {
 }
 
 #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
 #adminmenu .wp-menu-open .wp-menu-toggle {
-       background: transparent url(../images/menu-bits-rtl.gif) repeat-x scroll right -109px;
+       background: transparent url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right -109px;
 }
 
 #adminmenu a.wp-has-submenu {
 }
 
 #adminmenu a.wp-has-submenu {
-       background: #f1f1f1 url(../images/menu-bits-rtl.gif) repeat-x scroll right -379px;
+       background: #f1f1f1 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right -379px;
 }
 
 #adminmenu .wp-submenu a {
 }
 
 #adminmenu .wp-submenu a {
-       background: #FFFFFF url(../images/menu-bits-rtl.gif) no-repeat scroll right -310px;
+       background: #FFFFFF url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -310px;
 }
 
 #adminmenu li.current a,
 #adminmenu .wp-submenu a:hover {
 }
 
 #adminmenu li.current a,
 #adminmenu .wp-submenu a:hover {
-       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
+       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll  right -289px;
 }
 
 #adminmenu li.wp-has-current-submenu a.wp-has-submenu {
 }
 
 #adminmenu li.wp-has-current-submenu a.wp-has-submenu {
-       background: #b5b5b5 url(../images/menu-bits-rtl.gif) repeat-x scroll right top;
+       background: #b5b5b5 url(../images/menu-bits-rtl-vs.gif) repeat-x scroll right top;
 }
 
 .meta-box-sortables .postbox:hover .handlediv {
 }
 
 .meta-box-sortables .postbox:hover .handlediv {
-       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll right -111px;
+       background: transparent url(../images/menu-bits-rtl-vs.gif) no-repeat scroll right -111px;
 }
 }
index 49ba5f8f7021a247553a6c25f2dd49beebddcdbd..d02fb62b5c2b2f113f56c7603c645d3ceae86158 100644 (file)
@@ -1,5 +1,25 @@
 html {
 html {
-       background-color: #F5FCFD;
+       background-color: #f7f6f1;
+}
+
+* html input,
+* html .widget {
+    border-color: #8cbdd5;
+}
+
+textarea,
+input,
+select {
+       border-color: #dfdfdf;
+}
+
+kbd,
+code {
+       background: #eaeaea;
+}
+
+input[readonly] {
+       background-color: #eee;
 }
 
 .find-box-search {
 }
 
 .find-box-search {
@@ -29,11 +49,6 @@ body > #upload-menu {
        border-bottom-color: #fff;
 }
 
        border-bottom-color: #fff;
 }
 
-kbd, code {
-       background: #eaeaea;
-}
-
-div#current-widgets,
 #postcustomstuff table,
 #your-profile fieldset,
 #rightnow,
 #postcustomstuff table,
 #your-profile fieldset,
 #rightnow,
@@ -57,11 +72,11 @@ div.dashboard-widget,
 
 #postcustomstuff table {
        border-color: #dfdfdf;
 
 #postcustomstuff table {
        border-color: #dfdfdf;
-       background-color: #F9F9F9;
+       background-color: #f9f9f9;
 }
 
 #postcustomstuff thead th {
 }
 
 #postcustomstuff thead th {
-       background-color: #F1F1F1;
+       background-color: #f1f1f1;
 }
 
 #postcustomstuff table input,
 }
 
 #postcustomstuff table input,
@@ -71,7 +86,7 @@ div.dashboard-widget,
 }
 
 .widefat {
 }
 
 .widefat {
-       border-color: #BBD8E7;
+       border-color: #dfdfdf;
        background-color: #fff;
 }
 
        background-color: #fff;
 }
 
@@ -83,16 +98,16 @@ div.dashboard-widget-notice {
        background-color: #cfe1ef;
 }
 
        background-color: #cfe1ef;
 }
 
-div.dashboard-widget-submit,
-ul.widget-control-list div.widget-control-actions {
+div.dashboard-widget-submit {
        border-top-color: #ccc;
 }
 
        border-top-color: #ccc;
 }
 
-div.ui-tabs-panel {
-       border-color: #f1f1f1;
+div.tabs-panel,
+ul#category-tabs li.tabs {
+       border-color: #dfdfdf;
 }
 
 }
 
-ul#category-tabs li.ui-tabs-selected {
+ul#category-tabs li.tabs {
        background-color: #f1f1f1;
 }
 
        background-color: #f1f1f1;
 }
 
@@ -101,10 +116,6 @@ textarea.disabled {
        background-color: #ccc;
 }
 /* #upload-menu li a.upload-tab-link, */
        background-color: #ccc;
 }
 /* #upload-menu li a.upload-tab-link, */
-li.widget-list-control-item h4.widget-title a:hover,
-li.widget-list-control-item h4.widget-title a,
-#dragHelper li.widget-list-control-item h4.widget-title a,
-#draghelper li.widget-list-control-item h4.widget-title a:visited,
 .login #backtoblog a:hover,
 #plugin-information .action-button a,
 #plugin-information .action-button a:hover,
 .login #backtoblog a:hover,
 #plugin-information .action-button a,
 #plugin-information .action-button a:hover,
@@ -112,15 +123,10 @@ li.widget-list-control-item h4.widget-title a,
        color: #fff;
 }
 
        color: #fff;
 }
 
-li.widget-list-control-item div.widget-control {
-       background-color: #fff;
-       border-color: #dfdfdf;
-}
-
-.metabox-holder .postbox h3,
-#poststuff .postbox h3,
-#poststuff .stuffbox h3 {
-       background: #dfdfdf url("../images/blue-grad.png") repeat-x left top;
+.widget .widget-top,
+.postbox h3,
+.stuffbox h3 {
+       background: #d5e6f2 url("../images/blue-grad.png") repeat-x left top;
        text-shadow: #fff 0 1px 0;
 }
 
        text-shadow: #fff 0 1px 0;
 }
 
@@ -130,34 +136,26 @@ li.widget-list-control-item div.widget-control {
        text-shadow: #fff 0 1px 0;
 }
 
        text-shadow: #fff 0 1px 0;
 }
 
-.setting-description, .form-wrap p {
+.description,
+.form-wrap p {
        color: #666;
 }
 
        color: #666;
 }
 
-select {
-       background-color: #fff;
-       border-color: #8CBDD5;
-}
-
 strong .post-com-count span {
        background-color: #21759b;
 }
 
 strong .post-com-count span {
        background-color: #21759b;
 }
 
-ul#widget-list li.widget-list-item h4.widget-title {
-       background-color: #f0f0f0;
-       color: #000;
-}
-
 .sorthelper {
        background-color: #ccf3fa;
 }
 
 .sorthelper {
        background-color: #ccf3fa;
 }
 
-.ac_match, .subsubsub a.current {
+.ac_match,
+.subsubsub a.current {
        color: #000;
 }
 
 .wrap h2 {
        color: #000;
 }
 
 .wrap h2 {
-       color: #093E56;
+       color: #093e56;
 }
 
 .ac_over {
 }
 
 .ac_over {
@@ -173,8 +171,9 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #101010;
 }
 
        color: #101010;
 }
 
-.alternate, .alt {
-       background-color: #EDFBFC;
+.alt
+.alternate {
+       background-color: #edfbfc;
 }
 
 .available-theme a.screenshot {
 }
 
 .available-theme a.screenshot {
@@ -190,11 +189,13 @@ ul#widget-list li.widget-list-item h4.widget-title {
 #media-upload {
        background: #fff;
 }
 #media-upload {
        background: #fff;
 }
+
 #media-upload .slidetoggle {
        border-top-color: #dfdfdf;
 }
 
 #media-upload .slidetoggle {
        border-top-color: #dfdfdf;
 }
 
-.error, #login #login_error {
+.error,
+#login #login_error {
        background-color: #ffebe8;
        border-color: #c00;
 }
        background-color: #ffebe8;
        border-color: #c00;
 }
@@ -211,13 +212,8 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-color: #c00 !important;
 }
 
        border-color: #c00 !important;
 }
 
-.form-table input,
-.form-table textarea,
-.search-input,
-.form-field input,
-.form-field textarea,
 .submit {
 .submit {
-       border-color: #8CBDD5;
+       border-color: #8cbdd5;
 }
 
 .highlight {
 }
 
 .highlight {
@@ -275,7 +271,7 @@ td.help {
        border-bottom-color: #dadada;
 }
 
        border-bottom-color: #dadada;
 }
 
-.side-info ul, .widget-description {
+.side-info ul {
        color: #666;
 }
 
        color: #666;
 }
 
@@ -284,8 +280,8 @@ td.help {
 .submit input,
 input[type=button],
 input[type=submit] {
 .submit input,
 input[type=button],
 input[type=submit] {
-       border-color: #8CBDD5;
-       color: #093E56;
+       border-color: #dfdfdf;
+       color: #464646;
 }
 
 .button:hover,
 }
 
 .button:hover,
@@ -294,7 +290,7 @@ input[type=submit] {
 input[type=button]:hover,
 input[type=submit]:hover {
        color: #000;
 input[type=button]:hover,
 input[type=submit]:hover {
        color: #000;
-       border-color: #21759B;
+       border-color: #adaca7;
 }
 
 .button,
 }
 
 .button,
@@ -312,15 +308,15 @@ input[type=submit]:hover {
 .button-primary,
 .submit .button-primary,
 #login form .submit input {
 .button-primary,
 .submit .button-primary,
 #login form .submit input {
-       border-color: #298cba !important;
+       border-color: #5b86ab !important;
        font-weight: bold;
        font-weight: bold;
-       color: #FFF !important;
-       background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
+       color: #fff !important;
+       background: #5580a6 url(../images/button-grad-vs.png) repeat-x scroll left top;
 }
 
 .button-primary:active,
 #login form .submit input:active {
 }
 
 .button-primary:active,
 #login form .submit input:active {
-       background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top !important;
+       background: #21759b url(../images/button-grad-active-vs.png) repeat-x scroll left top !important;
 }
 
 .button[disabled],
 }
 
 .button[disabled],
@@ -334,7 +330,7 @@ a.button.disabled {
 
 .button-primary[disabled],
 .button-primary:disabled {
 
 .button-primary[disabled],
 .button-primary:disabled {
-       color: #2fa0d5 !important;
+       color: #80a3d2 !important;
 }
 
 a:active,
 }
 
 a:active,
@@ -348,12 +344,15 @@ a:hover,
 #adminmenu ul.wp-submenu a:hover,
 #the-comment-list .comment a:hover,
 #rightnow a:hover,
 #adminmenu ul.wp-submenu a:hover,
 #the-comment-list .comment a:hover,
 #rightnow a:hover,
-.subsubsub a:hover,
-.subsubsub a.current:hover,
 #login form .submit input:hover,
 #login form .submit input:hover,
-div.dashboard-widget-submit input:hover,
 #media-upload a.del-link:hover,
 #media-upload a.del-link:hover,
-.ui-tabs-nav a:hover {
+div.dashboard-widget-submit input:hover,
+.subsubsub a:hover,
+.subsubsub a.current:hover,
+.ui-tabs-nav a:hover,
+.plugins .inactive a:hover,
+#all-plugins-table .plugins .inactive a:hover,
+#search-plugins-table .plugins .inactive a:hover {
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
@@ -362,13 +361,17 @@ div.dashboard-widget-submit input:hover,
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
+#dashboard_right_now .table {
+       background:#faf9f7 !important;
+}
+
 .button-primary:hover,
 #login form .submit input:hover {
 .button-primary:hover,
 #login form .submit input:hover {
-       border-color: #13455b !important;
-       color: #EAF2FA !important;
+       border-color: #2e5475 !important;
+       color: #eaf2fa !important;
 }
 
 }
 
-#side-info-column #category-tabs .ui-tabs-selected a {
+#side-sortables #category-tabs .tabs a {
        color: #333;
 }
 
        color: #333;
 }
 
@@ -382,13 +385,17 @@ div.dashboard-widget-submit input:hover,
        color: #ccc;
 }
 
        color: #ccc;
 }
 
-.submitbox .submitdelete, a.delete {
+.plugins a.delete:hover,
+#all-plugins-table .plugins a.delete:hover,
+#search-plugins-table .plugins a.delete:hover,
+.submitbox .submitdelete,
+a.delete {
        color: #f00;
        border-bottom-color: #f00;
 }
 
 .submitbox .submitdelete:hover,
        color: #f00;
        border-bottom-color: #f00;
 }
 
 .submitbox .submitdelete:hover,
-#media-upload a.delete:hover {
+#media-items a.delete:hover {
        color: #fff;
        background-color: #f00;
        border-bottom-color: #f00;
        color: #fff;
        background-color: #f00;
        border-bottom-color: #f00;
@@ -423,19 +430,23 @@ div.dashboard-widget-submit input:hover,
        border-color: #e6db55;
 }
 
        border-color: #e6db55;
 }
 
+.update-message {
+       color: #000000;
+}
+
 a.page-numbers {
 a.page-numbers {
-       border-bottom-color: #B8D3E2;
+       border-bottom-color: #b8d3e2;
 }
 
 }
 
-div#available-widgets-filter,
-ul#widget-list li.widget-list-item,
 .commentlist li {
        border-bottom-color: #ccc;
 }
 
 .widefat td,
 .commentlist li {
        border-bottom-color: #ccc;
 }
 
 .widefat td,
-.widefat th {
-       border-bottom-color: #BBD8E7;
+.widefat th,
+#install-plugins .plugins td,
+#install-plugins .plugins th {
+       border-color: #dfdfdf;
 }
 
 .widefat th {
 }
 
 .widefat th {
@@ -449,7 +460,7 @@ h3.dashboard-widget-title span,
 h3.dashboard-widget-title small,
 .find-box-head {
        color: #333;
 h3.dashboard-widget-title small,
 .find-box-head {
        color: #333;
-       background: #dfdfdf url(../images/blue-grad.png) repeat-x scroll left top;
+       background: #d5e6f2 url(../images/blue-grad.png) repeat-x scroll left top;
 }
 
 h3.dashboard-widget-title small a {
 }
 
 h3.dashboard-widget-title small a {
@@ -460,19 +471,21 @@ h3.dashboard-widget-title small a:hover {
        color: #fff;
 }
 
        color: #fff;
 }
 
+a,
 #adminmenu a,
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML,
 #the-comment-list p.comment-author strong a,
 #media-upload a.del-link,
 #adminmenu a,
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML,
 #the-comment-list p.comment-author strong a,
 #media-upload a.del-link,
-#media-upload a.delete,
-.ui-tabs-nav a, a {
-       color: #1C6280;
+#media-items a.delete,
+.plugins a.delete,
+.ui-tabs-nav a {
+       color: #1c6280;
 }
 
 /* Because we don't want visited on these links */
 }
 
 /* Because we don't want visited on these links */
-body.press-this .ui-tabs-selected a,
-body.press-this .ui-tabs-selected a:hover {
+body.press-this .tabs a,
+body.press-this .tabs a:hover {
        background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
        background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
@@ -502,10 +515,10 @@ body.press-this .ui-tabs-selected a:hover {
        background-color: #ddd;
        color: #000;
        text-shadow: none;
        background-color: #ddd;
        color: #000;
        text-shadow: none;
-       -moz-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
-       -khtml-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
-       -webkit-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
-       box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
+       -moz-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
+       -khtml-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
+       -webkit-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
+       box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
 }
 
 #adminmenu li.current a:hover #awaiting-mod,
 }
 
 #adminmenu li.current a:hover #awaiting-mod,
@@ -516,24 +529,16 @@ body.press-this .ui-tabs-selected a:hover {
        color: #fff;
 }
 
        color: #fff;
 }
 
-div#media-upload-header {
+div#media-upload-header,
+div#plugin-information-header {
        background-color: #f9f9f9;
        border-bottom-color: #dfdfdf;
 }
 
        background-color: #f9f9f9;
        border-bottom-color: #dfdfdf;
 }
 
-div#plugin-information-header {
-       background-color: #e4f2fd;
-       border-bottom-color: #c6d9e9;
-}
-
 #currenttheme img {
        border-color: #666;
 }
 
 #currenttheme img {
        border-color: #666;
 }
 
-#current-widgets .drop-widget-here {
-       background-color: #ffc;
-}
-
 #dashboard_secondary div.dashboard-widget-content ul li a {
        background-color: #f9f9f9;
 }
 #dashboard_secondary div.dashboard-widget-content ul li a {
        background-color: #f9f9f9;
 }
@@ -542,13 +547,6 @@ input.readonly, textarea.readonly {
        background-color: #ddd;
 }
 
        background-color: #ddd;
 }
 
-#dragHelper h4.widget-title,
-li.widget-list-control-item h4,
-#dragHelper li.widget-list-control-item h4 {
-       background-color: #2683ae;
-       color: #fff;
-}
-
 #ed_toolbar input,
 #ed_reply_toolbar input {
        background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
 #ed_toolbar input,
 #ed_reply_toolbar input {
        background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
@@ -574,49 +572,42 @@ li.widget-list-control-item h4,
 
 #footer,
 #footer-upgrade {
 
 #footer,
 #footer-upgrade {
-       background: #073447;
-       color: #999;
+       background: #1d507d;
+       color: #b6d1e4;
 }
 
 #media-items {
        border-color: #dfdfdf;
 }
 
 }
 
 #media-items {
        border-color: #dfdfdf;
 }
 
-#pass-strength-result {
-       background-color: #eee;
-       border-color: #ddd !important;
-}
-
-#pass-strength-result.bad {
-       background-color: #ffb78c;
-       border-color: #ff853c !important;
-}
-
-#pass-strength-result.good {
-       background-color: #ffec8b;
-       border-color: #fc0 !important;
-}
-
-#pass-strength-result.short {
-       background-color: #ffa0a0;
-       border-color: #f04040 !important;
-}
-
-#pass-strength-result.strong {
-       background-color: #c3ff88;
-       border-color: #8dff1c !important;
-}
-
 .checkbox,
 .side-info,
 .checkbox,
 .side-info,
+.plugins tr,
+.postbox,
 #your-profile #rich_editing {
        background-color: #fff;
 }
 
 #your-profile #rich_editing {
        background-color: #fff;
 }
 
+.plugins .inactive,
+.plugins .inactive th,
+.plugins .inactive td,
+tr.inactive + tr.plugin-update-tr .plugin-update {
+       background-color: #ebeeef;
+}
+
+.plugin-update-tr .update-message {
+       background-color: #fffbe4;
+       border-color: #dfdfdf;
+}
+
 .plugins .active,
 .plugins .active th,
 .plugins .active td {
 .plugins .active,
 .plugins .active th,
 .plugins .active td {
-       background-color: #e7f7d3;
+       color: #000;
+}
+
+.plugins .inactive a { 
+       color: #557799;         
 }
 
 #the-comment-list .unapproved,
 }
 
 #the-comment-list .unapproved,
@@ -637,31 +628,25 @@ li.widget-list-control-item h4,
        color: #bc0b0b;
 }
 
        color: #bc0b0b;
 }
 
-.plugins tr {
-       background-color: #fff;
-}
-
-.metabox-holder .postbox,
-#poststuff .postbox,
+.widget,
+#widget-list .widget-top,
+.postbox,
 #titlediv,
 #poststuff .postarea,
 #titlediv,
 #poststuff .postarea,
-#poststuff .stuffbox,
-.postbox input[type="text"],
-.postbox textarea,
-.stuffbox input[type="text"],
-.stuffbox textarea {
-       border-color: #BBD8E7;
+.stuffbox {
+       border-color: #dfdfdf;
 }
 
 }
 
-.metabox-holder .postbox,
-#poststuff .postbox {
-       background-color: #FFF;
+.widget,
+.postbox {
+       background-color: #fff;
 }
 
 .ui-sortable .postbox h3 {
 }
 
 .ui-sortable .postbox h3 {
-       color: #093E56;
+       color: #093e56;
 }
 
 }
 
+.widget .widget-top,
 .ui-sortable .postbox h3:hover {
        color: #000;
 }
 .ui-sortable .postbox h3:hover {
        color: #000;
 }
@@ -682,20 +667,19 @@ li.widget-list-control-item h4,
        color: #448abd;
 }
 
        color: #448abd;
 }
 
-#tagchecklist span a,
+.tagchecklist span a,
 #bulk-titles div a {
        background: url(../images/xit.gif) no-repeat;
 }
 
 #bulk-titles div a {
        background: url(../images/xit.gif) no-repeat;
 }
 
-#tagchecklist span a:hover,
+.tagchecklist span a:hover,
 #bulk-titles div a:hover {
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
 #bulk-titles div a:hover {
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
-#update-nag, .plugin-update {
+#update-nag {
        background-color: #fffeeb;
        background-color: #fffeeb;
-       border-bottom-color: #ccc;
-       border-top-color: #ccc;
+       border-color: #ccc;
        color: #555;
 }
 
        color: #555;
 }
 
@@ -704,11 +688,11 @@ li.widget-list-control-item h4,
 }
 
 #wphead {
 }
 
 #wphead {
-       background-color: #073447;
+       background-color: #1d507d;
 }
 
 body.login {
 }
 
 body.login {
-       border-top-color: #093E56;
+       border-top-color: #093e56;
 }
 
 #wphead h1 a {
 }
 
 #wphead h1 a {
@@ -719,26 +703,23 @@ body.login {
        color: #555;
 }
 
        color: #555;
 }
 
-#wphead h1 a:hover {
-       text-decoration: underline;
-}
-
 #user_info {
 #user_info {
-       color: #999;
-}
-
-#user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited {
-       color: #ccc;
-       text-decoration: none;
+       color: #b6d1e4;
 }
 
 }
 
-#user_info a:hover, #footer a:hover {
+#user_info a:link,
+#user_info a:visited,
+#footer a:link,
+#footer a:visited {
        color: #fff;
        color: #fff;
-       text-decoration: underline !important;
+       text-decoration: none;
 }
 
 }
 
-#user_info a:active, #footer a:active {
-       color: #ccc !important;
+#user_info a:hover,
+#user_info a:active,
+#footer a:hover,
+#footer a:active  {
+       text-decoration: underline;
 }
 
 div#media-upload-error,
 }
 
 div#media-upload-error,
@@ -749,8 +730,30 @@ abbr.required,
        color: #f00;
 }
 
        color: #f00;
 }
 
-#media-upload a.delete {
-       color: #888;
+/* password strength meter */
+#pass-strength-result {
+       background-color: #eee;
+       border-color: #ddd !important;
+}
+
+#pass-strength-result.bad {
+       background-color: #ffb78c;
+       border-color: #ff853c !important;
+}
+
+#pass-strength-result.good {
+       background-color: #ffec8b;
+       border-color: #fc0 !important;
+}
+
+#pass-strength-result.short {
+       background-color: #ffa0a0;
+       border-color: #f04040 !important;
+}
+
+#pass-strength-result.strong {
+       background-color: #c3ff88;
+       border-color: #8dff1c !important;
 }
 
 /* editors */
 }
 
 /* editors */
@@ -760,7 +763,7 @@ abbr.required,
 }
 
 #ed_toolbar input {
 }
 
 #ed_toolbar input {
-       border-color: #C3C3C3;
+       border-color: #c3c3c3;
 }
 
 #ed_toolbar input:hover {
 }
 
 #ed_toolbar input:hover {
@@ -769,25 +772,25 @@ abbr.required,
 }
 
 #poststuff .wp_themeSkin .mceStatusbar {
 }
 
 #poststuff .wp_themeSkin .mceStatusbar {
-       border-color: #EDEDED;
+       border-color: #ededed;
 }
 
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML {
 }
 
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML {
-       background-color: #f1f1f1;
+       background-color: #f2f1eb;
        border-color: #dfdfdf;
        color: #999;
 }
 
 #poststuff #editor-toolbar .active {
        border-color: #dfdfdf;
        color: #999;
 }
 
 #poststuff #editor-toolbar .active {
-       border-bottom-color: #e9e9e9;
-       background-color: #e9e9e9;
+       border-bottom-color: #e3eef7;
+       background-color: #e3eef7;
        color: #333;
 }
 
 /* TinyMCE */
 #post-status-info {
        color: #333;
 }
 
 /* TinyMCE */
 #post-status-info {
-       background-color: #EDEDED;
+       background-color: #ededed;
 }
 
 .wp_themeSkin *,
 }
 
 .wp_themeSkin *,
@@ -795,7 +798,7 @@ abbr.required,
 .wp_themeSkin a:link,
 .wp_themeSkin a:visited,
 .wp_themeSkin a:active {
 .wp_themeSkin a:link,
 .wp_themeSkin a:visited,
 .wp_themeSkin a:active {
-        color: #000;
+       color: #000;
 }
 
 /* Containers */
 }
 
 /* Containers */
@@ -812,7 +815,7 @@ abbr.required,
 /* Button */
 .wp_themeSkin .mceButton {
        background-color: #e9e8e8;
 /* Button */
 .wp_themeSkin .mceButton {
        background-color: #e9e8e8;
-       border-color: #B2B2B2;
+       border-color: #b2b2b2;
 }
 
 .wp_themeSkin a.mceButtonEnabled:hover,
 }
 
 .wp_themeSkin a.mceButtonEnabled:hover,
@@ -829,7 +832,7 @@ abbr.required,
 /* ListBox */
 .wp_themeSkin .mceListBox .mceText,
 .wp_themeSkin .mceListBox .mceOpen  {
 /* ListBox */
 .wp_themeSkin .mceListBox .mceText,
 .wp_themeSkin .mceListBox .mceOpen  {
-       border-color: #B2B2B2;
+       border-color: #b2b2b2;
        background-color: #d5d5d5;
 }
 
        background-color: #d5d5d5;
 }
 
@@ -847,15 +850,14 @@ abbr.required,
 }
 
 .wp_themeSkin select.mceListBox {
 }
 
 .wp_themeSkin select.mceListBox {
-       border-color: #B2B2B2;
+       border-color: #b2b2b2;
        background-color: #fff;
 }
 
 /* SplitButton */
 .wp_themeSkin .mceSplitButton a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceOpen {
        background-color: #fff;
 }
 
 /* SplitButton */
 .wp_themeSkin .mceSplitButton a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceOpen {
-       background-color: #e8e8e8;
-       border-color: #B2B2B2;
+       border-color: #b2b2b2;
 }
 
 .wp_themeSkin .mceSplitButton a.mceOpen:hover,
 }
 
 .wp_themeSkin .mceSplitButton a.mceOpen:hover,
@@ -867,17 +869,17 @@ abbr.required,
 }
 
 .wp_themeSkin .mceSplitButtonActive {
 }
 
 .wp_themeSkin .mceSplitButtonActive {
-       background-color: #B2B2B2;
+       background-color: #b2b2b2;
 }
 
 /* ColorSplitButton */
 .wp_themeSkin div.mceColorSplitMenu table {
        background-color: #ebebeb;
 }
 
 /* ColorSplitButton */
 .wp_themeSkin div.mceColorSplitMenu table {
        background-color: #ebebeb;
-       border-color: #B2B2B2;
+       border-color: #b2b2b2;
 }
 
 .wp_themeSkin .mceColorSplitMenu a {
 }
 
 .wp_themeSkin .mceColorSplitMenu a {
-       border-color: #B2B2B2;
+       border-color: #b2b2b2;
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
@@ -885,12 +887,12 @@ abbr.required,
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {
-       border-color: #0A246A;
-       background-color: #B6BDD2;
+       border-color: #0a246a;
+       background-color: #b6bdd2;
 }
 
 .wp_themeSkin a.mceMoreColors:hover {
 }
 
 .wp_themeSkin a.mceMoreColors:hover {
-       border-color: #0A246A;
+       border-color: #0a246a;
 }
 
 /* Menu */
 }
 
 /* Menu */
@@ -924,8 +926,11 @@ abbr.required,
        color: #888;
 }
 
        color: #888;
 }
 
+#quicktags,
+.wp_themeSkin tr.mceFirst td.mceToolbar {
+       background: #e3eef7 url("../images/ed-bg-vs.gif") repeat-x scroll left top;
+}
 .wp_themeSkin tr.mceFirst td.mceToolbar {
 .wp_themeSkin tr.mceFirst td.mceToolbar {
-       background-color: #dfdfdf;
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
@@ -934,7 +939,7 @@ abbr.required,
 }
 
 .wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft {
 }
 
 .wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft {
-       background: #444444;
+       background: #444;
        border-left: 1px solid #999;
        border-top: 1px solid #999;
        -moz-border-radius: 4px 0 0 0;
        border-left: 1px solid #999;
        border-top: 1px solid #999;
        -moz-border-radius: 4px 0 0 0;
@@ -944,7 +949,7 @@ abbr.required,
 }
 
 .wp-admin .clearlooks2 .mceFocus .mceTop .mceRight {
 }
 
 .wp-admin .clearlooks2 .mceFocus .mceTop .mceRight {
-       background: #444444;
+       background: #444;
        border-right: 1px solid #999;
        border-top: 1px solid #999;
        border-top-right-radius: 4px;
        border-right: 1px solid #999;
        border-top: 1px solid #999;
        border-top-right-radius: 4px;
@@ -992,7 +997,8 @@ abbr.required,
 
 #editorcontainer,
 #post-status-info,
 
 #editorcontainer,
 #post-status-info,
-#titlediv #title {
+#titlediv #title,
+.editwidget .widget-inside {
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
@@ -1007,13 +1013,13 @@ abbr.required,
 
 #timestampdiv input,
 #namediv input,
 
 #timestampdiv input,
 #namediv input,
-#tagsdiv #the-tagcloud {
-       border-color: #ddd;
+#poststuff .inside .the-tagcloud {
+       border-color: #dfdfdf;
 }
 
 /* menu */
 #adminmenu * {
 }
 
 /* menu */
 #adminmenu * {
-       border-color: #BBD8E7;
+       border-color: #dfdfdf;
 }
 
 #adminmenu li.wp-menu-separator {
 }
 
 #adminmenu li.wp-menu-separator {
@@ -1026,20 +1032,20 @@ abbr.required,
 
 #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
 #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
 
 #adminmenu li.wp-has-current-submenu.wp-menu-open .wp-menu-toggle,
 #adminmenu li.wp-has-current-submenu:hover .wp-menu-toggle {
-       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -207px;
+       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -207px;
 }
 
 #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
 #adminmenu .wp-menu-open .wp-menu-toggle {
 }
 
 #adminmenu .wp-has-submenu:hover .wp-menu-toggle,
 #adminmenu .wp-menu-open .wp-menu-toggle {
-       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;
+       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -109px;
 }
 
 #adminmenu a.menu-top {
 }
 
 #adminmenu a.menu-top {
-       background: #EAF3FA url(../images/menu-bits.gif) repeat-x scroll left -379px;
+       background: #eaf3fa url(../images/menu-bits-vs.gif) repeat-x scroll left -379px;
 }
 
 #adminmenu .wp-submenu a {
 }
 
 #adminmenu .wp-submenu a {
-       background: #FFFFFF url(../images/menu-bits.gif) no-repeat scroll 0 -310px;
+       background: #fff url(../images/menu-bits-vs.gif) no-repeat scroll 0 -310px;
 }
 
 #adminmenu .wp-has-current-submenu ul li a {
 }
 
 #adminmenu .wp-has-current-submenu ul li a {
@@ -1052,10 +1058,10 @@ abbr.required,
 
 #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
 #adminmenu .menu-top .current {
 
 #adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
 #adminmenu .menu-top .current {
-       background: #6d6d6d url(../images/menu-bits.gif) top left repeat-x;
-       border-color: #6d6d6d;
+       background: #3c6b95 url(../images/menu-bits-vs.gif) top left repeat-x;
+       border-color: #1d507d;
        color: #fff;
        color: #fff;
-       text-shadow: rgba(0,0,0,0.4) 0px -1px 0px;
+       text-shadow: rgba(0,0,0,0.4) 0 -1px 0;
 }
 
 #adminmenu li.wp-has-current-submenu .wp-submenu,
 }
 
 #adminmenu li.wp-has-current-submenu .wp-submenu,
@@ -1072,15 +1078,15 @@ abbr.required,
 }
 
 #adminmenu li.menu-top .current:hover {
 }
 
 #adminmenu li.menu-top .current:hover {
-       border-color: #B5B5B5;
+       border-color: #6583c0;
 }
 
 #adminmenu .wp-submenu .current a.current {
 }
 
 #adminmenu .wp-submenu .current a.current {
-       background: transparent url(../images/menu-bits.gif) no-repeat scroll  0 -289px;
+       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll  0 -289px;
 }
 
 #adminmenu .wp-submenu a:hover {
 }
 
 #adminmenu .wp-submenu a:hover {
-       background-color: #EAF2FA !important;
+       background-color: #eaf2fa !important;
        color: #333 !important;
 }
 
        color: #333 !important;
 }
 
@@ -1091,7 +1097,7 @@ abbr.required,
        background-color: #f5f5f5;
        background-image: none;
        border-color: #e3e3e3;
        background-color: #f5f5f5;
        background-image: none;
        border-color: #e3e3e3;
-       text-shadow: rgba(255,255,255,1) 0px 1px 0px;
+       text-shadow: rgba(255,255,255,1) 0 1px 0;
 }
 
 #adminmenu .wp-submenu ul {
 }
 
 #adminmenu .wp-submenu ul {
@@ -1100,17 +1106,17 @@ abbr.required,
 
 .folded #adminmenu li.menu-top,
 #adminmenu .wp-submenu .wp-submenu-head {
 
 .folded #adminmenu li.menu-top,
 #adminmenu .wp-submenu .wp-submenu-head {
-       background-color: #EAF2FA;
+       background-color: #eaf2fa;
 }
 
 .folded #adminmenu li.wp-has-current-submenu,
 .folded #adminmenu li.menu-top.current {
 }
 
 .folded #adminmenu li.wp-has-current-submenu,
 .folded #adminmenu li.menu-top.current {
-       background-color: #BBD8E7;
+       background-color: #bbd8e7;
 }
 
 #adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head {
 }
 
 #adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head {
-       background-color: #BBD8E7;
-       border-color: #8CBDD5;
+       background-color: #bbd8e7;
+       border-color: #8cbdd5;
 }
 
 #adminmenu div.wp-submenu {
 }
 
 #adminmenu div.wp-submenu {
@@ -1223,20 +1229,23 @@ abbr.required,
 
 /* Diff */
 table.diff .diff-deletedline {
 
 /* Diff */
 table.diff .diff-deletedline {
-       background-color: #ffdddd;
+       background-color: #fdd;
 }
 }
+
 table.diff .diff-deletedline del {
 table.diff .diff-deletedline del {
-       background-color: #ff9999;
+       background-color: #f99;
 }
 }
+
 table.diff .diff-addedline {
 table.diff .diff-addedline {
-       background-color: #ddffdd;
+       background-color: #dfd;
 }
 }
+
 table.diff .diff-addedline ins {
 table.diff .diff-addedline ins {
-       background-color: #99ff99;
+       background-color: #9f9;
 }
 
 #att-info {
 }
 
 #att-info {
-       background-color: #E4F2FD;
+       background-color: #e4f2fd;
 }
 
 /* edit image */
 }
 
 /* edit image */
@@ -1249,13 +1258,12 @@ table.diff .diff-addedline ins {
 #sidemenu a.current {
        background-color: #fff;
        border-color: #dfdfdf #dfdfdf #fff;
 #sidemenu a.current {
        background-color: #fff;
        border-color: #dfdfdf #dfdfdf #fff;
-       color: #D54E21;
+       color: #d54e21;
 }
 
 }
 
-
 #screen-options-wrap,
 #contextual-help-wrap {
 #screen-options-wrap,
 #contextual-help-wrap {
-       background-color: #f1f1f1;
+       background-color: #eae9e4;
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
@@ -1287,8 +1295,10 @@ table.diff .diff-addedline ins {
 }
 
 /* table vim shortcuts */
 }
 
 /* table vim shortcuts */
-.vim-current {
-       background-color: #E4F2FD !important;
+.vim-current,
+.vim-current th,
+.vim-current td {
+       background-color: #e4f2fd !important;
 }
 
 /* Install Plugins */
 }
 
 /* Install Plugins */
@@ -1327,18 +1337,14 @@ div.star.select:hover {
 }
 
 .inline-editor div.title {
 }
 
 .inline-editor div.title {
-       background-color: #EAF3FA;
+       background-color: #eaf3fa;
 }
 
 .inline-editor ul.cat-checklist {
 }
 
 .inline-editor ul.cat-checklist {
-       background-color: #FFFFFF;
+       background-color: #fff;
        border-color: #ddd;
 }
 
        border-color: #ddd;
 }
 
-.inline-edit-row p.submit {
-       background-color: #f1f1f1;
-}
-
 .inline-editor .categories .catshow,
 .inline-editor .categories .cathide {
        color: #21759b;
 .inline-editor .categories .catshow,
 .inline-editor .categories .cathide {
        color: #21759b;
@@ -1358,11 +1364,11 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 .attention {
 }
 
 .attention {
-       color: #D54E21;
+       color: #d54e21;
 }
 
 .meta-box-sortables .postbox:hover .handlediv {
 }
 
 .meta-box-sortables .postbox:hover .handlediv {
-       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -111px;
+       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;
 }
 
 #major-publishing-actions {
 }
 
 #major-publishing-actions {
@@ -1375,7 +1381,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
 
 .tablenav .tablenav-pages a {
        border-color: #e3e3e3;
 
 .tablenav .tablenav-pages a {
        border-color: #e3e3e3;
-       background: #eee url('../images/menu-bits.gif') repeat-x scroll left -379px;
+       background: #eee url('../images/menu-bits-vs.gif') repeat-x scroll left -379px;
 }
 
 .tablenav .tablenav-pages a:hover {
 }
 
 .tablenav .tablenav-pages a:hover {
@@ -1436,7 +1442,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
        background-color: #f5f5f5;
 }
 
        background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.ui-tabs-selected a {
+#post-body ul#category-tabs li.tabs a {
        color: #333;
 }
 
        color: #333;
 }
 
@@ -1457,18 +1463,24 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 #favorite-first {
 }
 
 #favorite-first {
-       background: #797979 url(../images/fav.png) repeat-x 0 center;
-       border-color: #777 !important;
-       border-bottom-color: #666 !important;
+       background: #5580a6 url(../images/fav-vs.png) repeat-x 0 center;
+       border-color: #517ea5 !important;
+       border-bottom-color: #416686 !important;
+}
+
+#favorite-actions .slide-down {
+       background-image: url(../images/fav-top-vs.gif);
+       background-position:0 0;
+       background-repeat: repeat-x;
 }
 
 #favorite-inside {
 }
 
 #favorite-inside {
-       border-color: #797979;
-       background-color: #797979;
+       border-color: #5b86ac;
+       background-color: #5580a6;
 }
 
 #favorite-toggle {
 }
 
 #favorite-toggle {
-       background: transparent url(../images/fav-arrow.gif) no-repeat 0 -4px;
+       background: transparent url(../images/fav-arrow-vs.gif) no-repeat 0 -4px;
 }
 
 #favorite-actions a {
 }
 
 #favorite-actions a {
@@ -1543,6 +1555,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 #icon-users,
 }
 
 #icon-users,
+#icon-profile,
 #icon-user-edit {
        background: transparent url(../images/icons32-vs.png) no-repeat -600px -5px;
 }
 #icon-user-edit {
        background: transparent url(../images/icons32-vs.png) no-repeat -600px -5px;
 }
@@ -1573,5 +1586,86 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 #header-logo {
 }
 
 #header-logo {
-       background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
+       background: transparent url(../images/wp-logo-vs.gif) no-repeat scroll center center;
+}
+
+#wphead #site-visit-button {
+       background-color: #3c6b95;
+       background-image: url(../images/visit-site-button-grad-vs.gif);
+       color: #b6d1e4;
+       text-shadow: #3f3f3f 0 -1px 0;
+}
+
+#wphead a:hover #site-visit-button {
+       color: #fff;
+}
+
+#wphead a:focus #site-visit-button,
+#wphead a:active #site-visit-button {
+       background-position: 0 -27px;
+}
+
+.popular-tags,
+.feature-filter {
+       background-color: #fff;
+       border-color: #dfdfdf;
+}
+
+#theme-information .action-button {
+       border-top-color: #dfdfdf;
+}
+
+.theme-listing br.line {
+       border-bottom-color: #ccc;
+}
+
+div.widgets-sortables,
+#widgets-left .inactive {
+       background-color: #f1f1f1;
+    border-color: #ddd;
+}
+
+#available-widgets .widget-holder {
+    background-color: #fff;
+    border-color: #ddd;
+}
+
+#widgets-left .sidebar-name {
+       background-color: #aaa;
+       background-image: url(../images/ed-bg-vs.gif);
+       text-shadow: #FFFFFF 0 1px 0;
+       border-color: #dfdfdf;
+}
+
+#widgets-right .sidebar-name {
+       background-image: url(../images/fav-vs.png);
+       text-shadow: #3f3f3f 0 -1px 0;
+       background-color: #636363;
+       border-color: #636363;
+       color: #fff;
+}
+
+.sidebar-name:hover,
+#removing-widget {
+       color: #d54e21;
+}
+
+#removing-widget span {
+       color: black;
+}
+
+#widgets-left .sidebar-name-arrow {
+       background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -109px;
+}
+
+#widgets-right .sidebar-name-arrow {
+       background: transparent url(../images/fav-arrow-vs.gif) no-repeat scroll 0 -1px;
+}
+
+.in-widget-title {
+       color: #606060;
+}
+
+.deleting .widget-title * {
+       color: #aaa;
 }
 }
index 2a42c71248da44ec62604f738a7fff9e435f90f2..9142cd94fa7958d5237125498c703f6f8d6b1e19 100644 (file)
@@ -2,6 +2,26 @@ html {
        background-color: #f9f9f9;
 }
 
        background-color: #f9f9f9;
 }
 
+* html input,
+* html .widget {
+    border-color: #dfdfdf;
+}
+
+textarea,
+input,
+select {
+       border-color: #DFDFDF;
+}
+
+kbd,
+code {
+       background: #eaeaea;
+}
+
+input[readonly] {
+       background-color: #eee;
+}
+
 .find-box-search {
        border-color: #dfdfdf;
        background-color: #f1f1f1;
 .find-box-search {
        border-color: #dfdfdf;
        background-color: #f1f1f1;
@@ -29,11 +49,6 @@ body > #upload-menu {
        border-bottom-color: #fff;
 }
 
        border-bottom-color: #fff;
 }
 
-kbd, code {
-       background: #eaeaea;
-}
-
-div#current-widgets,
 #postcustomstuff table,
 #your-profile fieldset,
 #rightnow,
 #postcustomstuff table,
 #your-profile fieldset,
 #rightnow,
@@ -83,16 +98,16 @@ div.dashboard-widget-notice {
        background-color: #cfe1ef;
 }
 
        background-color: #cfe1ef;
 }
 
-div.dashboard-widget-submit,
-ul.widget-control-list div.widget-control-actions {
+div.dashboard-widget-submit {
        border-top-color: #ccc;
 }
 
        border-top-color: #ccc;
 }
 
-div.ui-tabs-panel {
-       border-color: #f1f1f1;
+div.tabs-panel,
+ul#category-tabs li.tabs {
+       border-color: #dfdfdf;
 }
 
 }
 
-ul#category-tabs li.ui-tabs-selected {
+ul#category-tabs li.tabs {
        background-color: #f1f1f1;
 }
 
        background-color: #f1f1f1;
 }
 
@@ -101,10 +116,6 @@ textarea.disabled {
        background-color: #ccc;
 }
 /* #upload-menu li a.upload-tab-link, */
        background-color: #ccc;
 }
 /* #upload-menu li a.upload-tab-link, */
-li.widget-list-control-item h4.widget-title a:hover,
-li.widget-list-control-item h4.widget-title a,
-#dragHelper li.widget-list-control-item h4.widget-title a,
-#draghelper li.widget-list-control-item h4.widget-title a:visited,
 .login #backtoblog a:hover,
 #plugin-information .action-button a,
 #plugin-information .action-button a:hover,
 .login #backtoblog a:hover,
 #plugin-information .action-button a,
 #plugin-information .action-button a:hover,
@@ -112,14 +123,9 @@ li.widget-list-control-item h4.widget-title a,
        color: #fff;
 }
 
        color: #fff;
 }
 
-li.widget-list-control-item div.widget-control {
-       background-color: #fff;
-       border-color: #dfdfdf;
-}
-
-.metabox-holder .postbox h3,
-#poststuff .postbox h3,
-#poststuff .stuffbox h3 {
+.widget .widget-top,
+.postbox h3,
+.stuffbox h3 {
        background: #dfdfdf url("../images/gray-grad.png") repeat-x left top;
        text-shadow: #fff 0 1px 0;
 }
        background: #dfdfdf url("../images/gray-grad.png") repeat-x left top;
        text-shadow: #fff 0 1px 0;
 }
@@ -130,29 +136,21 @@ li.widget-list-control-item div.widget-control {
        text-shadow: #fff 0 1px 0;
 }
 
        text-shadow: #fff 0 1px 0;
 }
 
-.setting-description, .form-wrap p {
+.description,
+.form-wrap p {
        color: #666;
 }
 
        color: #666;
 }
 
-select {
-       background-color: #fff;
-       border-color: #ddd;
-}
-
 strong .post-com-count span {
        background-color: #21759b;
 }
 
 strong .post-com-count span {
        background-color: #21759b;
 }
 
-ul#widget-list li.widget-list-item h4.widget-title {
-       background-color: #f0f0f0;
-       color: #000;
-}
-
 .sorthelper {
        background-color: #ccf3fa;
 }
 
 .sorthelper {
        background-color: #ccf3fa;
 }
 
-.ac_match, .subsubsub a.current {
+.ac_match,
+.subsubsub a.current {
        color: #000;
 }
 
        color: #000;
 }
 
@@ -173,7 +171,8 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #101010;
 }
 
        color: #101010;
 }
 
-.alternate, .alt {
+.alternate,
+.alt {
        background-color: #f9f9f9;
 }
 
        background-color: #f9f9f9;
 }
 
@@ -190,11 +189,13 @@ ul#widget-list li.widget-list-item h4.widget-title {
 #media-upload {
        background: #fff;
 }
 #media-upload {
        background: #fff;
 }
+
 #media-upload .slidetoggle {
        border-top-color: #dfdfdf;
 }
 
 #media-upload .slidetoggle {
        border-top-color: #dfdfdf;
 }
 
-.error, #login #login_error {
+.error,
+#login #login_error {
        background-color: #ffebe8;
        border-color: #c00;
 }
        background-color: #ffebe8;
        border-color: #c00;
 }
@@ -211,11 +212,6 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-color: #c00 !important;
 }
 
        border-color: #c00 !important;
 }
 
-.form-table input,
-.form-table textarea,
-.search-input,
-.form-field input,
-.form-field textarea,
 .submit {
        border-color: #DFDFDF;
 }
 .submit {
        border-color: #DFDFDF;
 }
@@ -275,7 +271,7 @@ td.help {
        border-bottom-color: #dadada;
 }
 
        border-bottom-color: #dadada;
 }
 
-.side-info ul, .widget-description {
+.side-info ul {
        color: #666;
 }
 
        color: #666;
 }
 
@@ -348,12 +344,15 @@ a:hover,
 #adminmenu ul.wp-submenu a:hover,
 #the-comment-list .comment a:hover,
 #rightnow a:hover,
 #adminmenu ul.wp-submenu a:hover,
 #the-comment-list .comment a:hover,
 #rightnow a:hover,
-.subsubsub a:hover,
-.subsubsub a.current:hover,
 #login form .submit input:hover,
 #login form .submit input:hover,
-div.dashboard-widget-submit input:hover,
 #media-upload a.del-link:hover,
 #media-upload a.del-link:hover,
-.ui-tabs-nav a:hover {
+div.dashboard-widget-submit input:hover,
+.subsubsub a:hover,
+.subsubsub a.current:hover,
+.ui-tabs-nav a:hover,
+.plugins .inactive a:hover,
+#all-plugins-table .plugins .inactive a:hover,
+#search-plugins-table .plugins .inactive a:hover {
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
@@ -368,7 +367,7 @@ div.dashboard-widget-submit input:hover,
        color: #EAF2FA !important;
 }
 
        color: #EAF2FA !important;
 }
 
-#side-info-column #category-tabs .ui-tabs-selected a {
+#side-sortables #category-tabs .tabs a {
        color: #333;
 }
 
        color: #333;
 }
 
@@ -382,13 +381,17 @@ div.dashboard-widget-submit input:hover,
        color: #ccc;
 }
 
        color: #ccc;
 }
 
-.submitbox .submitdelete, a.delete {
+.plugins a.delete:hover,
+#all-plugins-table .plugins a.delete:hover,
+#search-plugins-table .plugins a.delete:hover,
+.submitbox .submitdelete,
+a.delete {
        color: #f00;
        border-bottom-color: #f00;
 }
 
 .submitbox .submitdelete:hover,
        color: #f00;
        border-bottom-color: #f00;
 }
 
 .submitbox .submitdelete:hover,
-#media-upload a.delete:hover {
+#media-items a.delete:hover {
        color: #fff;
        background-color: #f00;
        border-bottom-color: #f00;
        color: #fff;
        background-color: #f00;
        border-bottom-color: #f00;
@@ -423,18 +426,22 @@ div.dashboard-widget-submit input:hover,
        border-color: #e6db55;
 }
 
        border-color: #e6db55;
 }
 
+.update-message {
+       color: #000000;
+}
+
 a.page-numbers {
        border-bottom-color: #B8D3E2;
 }
 
 a.page-numbers {
        border-bottom-color: #B8D3E2;
 }
 
-div#available-widgets-filter,
-ul#widget-list li.widget-list-item,
 .commentlist li {
        border-bottom-color: #ccc;
 }
 
 .widefat td,
 .commentlist li {
        border-bottom-color: #ccc;
 }
 
 .widefat td,
-.widefat th {
+.widefat th,
+#install-plugins .plugins td,
+#install-plugins .plugins th {
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
@@ -460,19 +467,21 @@ h3.dashboard-widget-title small a:hover {
        color: #fff;
 }
 
        color: #fff;
 }
 
+a,
 #adminmenu a,
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML,
 #the-comment-list p.comment-author strong a,
 #media-upload a.del-link,
 #adminmenu a,
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML,
 #the-comment-list p.comment-author strong a,
 #media-upload a.del-link,
-#media-upload a.delete,
-.ui-tabs-nav a, a {
+#media-items a.delete,
+.plugins a.delete,
+.ui-tabs-nav a {
        color: #21759b;
 }
 
 /* Because we don't want visited on these links */
        color: #21759b;
 }
 
 /* Because we don't want visited on these links */
-body.press-this .ui-tabs-selected a,
-body.press-this .ui-tabs-selected a:hover {
+body.press-this .tabs a,
+body.press-this .tabs a:hover {
        background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
        background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
@@ -502,10 +511,10 @@ body.press-this .ui-tabs-selected a:hover {
        background-color: #ddd;
        color: #000;
        text-shadow: none;
        background-color: #ddd;
        color: #000;
        text-shadow: none;
-       -moz-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
-       -khtml-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
-       -webkit-box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
-       box-shadow: rgba(0,0,0,0.2) 0px -1px 0px;
+       -moz-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
+       -khtml-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
+       -webkit-box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
+       box-shadow: rgba(0,0,0,0.2) 0 -1px 0;
 }
 
 #adminmenu li.current a:hover #awaiting-mod,
 }
 
 #adminmenu li.current a:hover #awaiting-mod,
@@ -516,24 +525,16 @@ body.press-this .ui-tabs-selected a:hover {
        color: #fff;
 }
 
        color: #fff;
 }
 
-div#media-upload-header {
+div#media-upload-header,
+div#plugin-information-header {
        background-color: #f9f9f9;
        border-bottom-color: #dfdfdf;
 }
 
        background-color: #f9f9f9;
        border-bottom-color: #dfdfdf;
 }
 
-div#plugin-information-header {
-       background-color: #e4f2fd;
-       border-bottom-color: #c6d9e9;
-}
-
 #currenttheme img {
        border-color: #666;
 }
 
 #currenttheme img {
        border-color: #666;
 }
 
-#current-widgets .drop-widget-here {
-       background-color: #ffc;
-}
-
 #dashboard_secondary div.dashboard-widget-content ul li a {
        background-color: #f9f9f9;
 }
 #dashboard_secondary div.dashboard-widget-content ul li a {
        background-color: #f9f9f9;
 }
@@ -542,13 +543,6 @@ input.readonly, textarea.readonly {
        background-color: #ddd;
 }
 
        background-color: #ddd;
 }
 
-#dragHelper h4.widget-title,
-li.widget-list-control-item h4,
-#dragHelper li.widget-list-control-item h4 {
-       background-color: #2683ae;
-       color: #fff;
-}
-
 #ed_toolbar input,
 #ed_reply_toolbar input {
        background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
 #ed_toolbar input,
 #ed_reply_toolbar input {
        background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
@@ -582,41 +576,33 @@ li.widget-list-control-item h4,
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
-#pass-strength-result {
-       background-color: #eee;
-       border-color: #ddd !important;
-}
-
-#pass-strength-result.bad {
-       background-color: #ffb78c;
-       border-color: #ff853c !important;
-}
-
-#pass-strength-result.good {
-       background-color: #ffec8b;
-       border-color: #fc0 !important;
-}
-
-#pass-strength-result.short {
-       background-color: #ffa0a0;
-       border-color: #f04040 !important;
-}
-
-#pass-strength-result.strong {
-       background-color: #c3ff88;
-       border-color: #8dff1c !important;
-}
-
 .checkbox,
 .side-info,
 .checkbox,
 .side-info,
+.plugins tr,
 #your-profile #rich_editing {
        background-color: #fff;
 }
 
 #your-profile #rich_editing {
        background-color: #fff;
 }
 
+.plugins .inactive,
+.plugins .inactive th,
+.plugins .inactive td,
+tr.inactive + tr.plugin-update-tr .plugin-update {
+       background-color: #eee;
+}
+
+.plugin-update-tr .update-message {
+       background-color: #fffbe4;
+       border-color: #dfdfdf;
+}
+
 .plugins .active,
 .plugins .active th,
 .plugins .active td {
 .plugins .active,
 .plugins .active th,
 .plugins .active td {
-       background-color: #e7f7d3;
+       color: #000;
+}
+
+.plugins .inactive a { 
+       color: #557799;         
 }
 
 #the-comment-list .unapproved,
 }
 
 #the-comment-list .unapproved,
@@ -637,31 +623,25 @@ li.widget-list-control-item h4,
        color: #bc0b0b;
 }
 
        color: #bc0b0b;
 }
 
-.plugins tr {
-       background-color: #fff;
-}
-
-.metabox-holder .postbox,
-#poststuff .postbox,
+.widget,
+#widget-list .widget-top,
+.postbox,
 #titlediv,
 #poststuff .postarea,
 #titlediv,
 #poststuff .postarea,
-#poststuff .stuffbox,
-.postbox input[type="text"],
-.postbox textarea,
-.stuffbox input[type="text"],
-.stuffbox textarea {
+.stuffbox {
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
-.metabox-holder .postbox,
-#poststuff .postbox {
-       background-color: #FFF;
+.widget,
+.postbox {
+       background-color: #fff;
 }
 
 .ui-sortable .postbox h3 {
        color: #464646;
 }
 
 }
 
 .ui-sortable .postbox h3 {
        color: #464646;
 }
 
+.widget .widget-top,
 .ui-sortable .postbox h3:hover {
        color: #000;
 }
 .ui-sortable .postbox h3:hover {
        color: #000;
 }
@@ -682,20 +662,19 @@ li.widget-list-control-item h4,
        color: #448abd;
 }
 
        color: #448abd;
 }
 
-#tagchecklist span a,
+.tagchecklist span a,
 #bulk-titles div a {
        background: url(../images/xit.gif) no-repeat;
 }
 
 #bulk-titles div a {
        background: url(../images/xit.gif) no-repeat;
 }
 
-#tagchecklist span a:hover,
+.tagchecklist span a:hover,
 #bulk-titles div a:hover {
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
 #bulk-titles div a:hover {
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
-#update-nag, .plugin-update {
+#update-nag {
        background-color: #fffeeb;
        background-color: #fffeeb;
-       border-bottom-color: #ccc;
-       border-top-color: #ccc;
+       border-color: #ccc;
        color: #555;
 }
 
        color: #555;
 }
 
@@ -719,25 +698,26 @@ body.login {
        color: #555;
 }
 
        color: #555;
 }
 
-#wphead h1 a:hover {
-       text-decoration: underline;
-}
-
 #user_info {
        color: #999;
 }
 
 #user_info {
        color: #999;
 }
 
-#user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited {
+#user_info a:link,
+#user_info a:visited,
+#footer a:link,
+#footer a:visited {
        color: #ccc;
        text-decoration: none;
 }
 
        color: #ccc;
        text-decoration: none;
 }
 
-#user_info a:hover, #footer a:hover {
+#user_info a:hover,
+#footer a:hover {
        color: #fff;
        text-decoration: underline !important;
 }
 
        color: #fff;
        text-decoration: underline !important;
 }
 
-#user_info a:active, #footer a:active {
+#user_info a:active,
+#footer a:active {
        color: #ccc !important;
 }
 
        color: #ccc !important;
 }
 
@@ -749,8 +729,29 @@ abbr.required,
        color: #f00;
 }
 
        color: #f00;
 }
 
-#media-upload a.delete {
-       color: #888;
+#pass-strength-result {
+       background-color: #eee;
+       border-color: #ddd !important;
+}
+
+#pass-strength-result.bad {
+       background-color: #ffb78c;
+       border-color: #ff853c !important;
+}
+
+#pass-strength-result.good {
+       background-color: #ffec8b;
+       border-color: #fc0 !important;
+}
+
+#pass-strength-result.short {
+       background-color: #ffa0a0;
+       border-color: #f04040 !important;
+}
+
+#pass-strength-result.strong {
+       background-color: #c3ff88;
+       border-color: #8dff1c !important;
 }
 
 /* editors */
 }
 
 /* editors */
@@ -854,7 +855,6 @@ abbr.required,
 /* SplitButton */
 .wp_themeSkin .mceSplitButton a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceOpen {
 /* SplitButton */
 .wp_themeSkin .mceSplitButton a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceOpen {
-       background-color: #e8e8e8;
        border-color: #B2B2B2;
 }
 
        border-color: #B2B2B2;
 }
 
@@ -925,7 +925,7 @@ abbr.required,
 }
 
 .wp_themeSkin tr.mceFirst td.mceToolbar {
 }
 
 .wp_themeSkin tr.mceFirst td.mceToolbar {
-       background-color: #dfdfdf;
+       background: #dfdfdf url("../images/ed-bg.gif") repeat-x scroll left top;
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
@@ -992,7 +992,8 @@ abbr.required,
 
 #editorcontainer,
 #post-status-info,
 
 #editorcontainer,
 #post-status-info,
-#titlediv #title {
+#titlediv #title,
+.editwidget .widget-inside {
        border-color: #dfdfdf;
 }
 
        border-color: #dfdfdf;
 }
 
@@ -1007,7 +1008,7 @@ abbr.required,
 
 #timestampdiv input,
 #namediv input,
 
 #timestampdiv input,
 #namediv input,
-#tagsdiv #the-tagcloud {
+#poststuff .inside .the-tagcloud {
        border-color: #ddd;
 }
 
        border-color: #ddd;
 }
 
@@ -1225,12 +1226,15 @@ abbr.required,
 table.diff .diff-deletedline {
        background-color: #ffdddd;
 }
 table.diff .diff-deletedline {
        background-color: #ffdddd;
 }
+
 table.diff .diff-deletedline del {
        background-color: #ff9999;
 }
 table.diff .diff-deletedline del {
        background-color: #ff9999;
 }
+
 table.diff .diff-addedline {
        background-color: #ddffdd;
 }
 table.diff .diff-addedline {
        background-color: #ddffdd;
 }
+
 table.diff .diff-addedline ins {
        background-color: #99ff99;
 }
 table.diff .diff-addedline ins {
        background-color: #99ff99;
 }
@@ -1252,7 +1256,6 @@ table.diff .diff-addedline ins {
        color: #D54E21;
 }
 
        color: #D54E21;
 }
 
-
 #screen-options-wrap,
 #contextual-help-wrap {
        background-color: #f1f1f1;
 #screen-options-wrap,
 #contextual-help-wrap {
        background-color: #f1f1f1;
@@ -1287,7 +1290,9 @@ table.diff .diff-addedline ins {
 }
 
 /* table vim shortcuts */
 }
 
 /* table vim shortcuts */
-.vim-current {
+.vim-current,
+.vim-current th,
+.vim-current td {
        background-color: #E4F2FD !important;
 }
 
        background-color: #E4F2FD !important;
 }
 
@@ -1335,10 +1340,6 @@ div.star.select:hover {
        border-color: #ddd;
 }
 
        border-color: #ddd;
 }
 
-.inline-edit-row p.submit {
-       background-color: #f1f1f1;
-}
-
 .inline-editor .categories .catshow,
 .inline-editor .categories .cathide {
        color: #21759b;
 .inline-editor .categories .catshow,
 .inline-editor .categories .cathide {
        color: #21759b;
@@ -1436,7 +1437,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
        background-color: #f5f5f5;
 }
 
        background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.ui-tabs-selected a {
+#post-body ul#category-tabs li.tabs a {
        color: #333;
 }
 
        color: #333;
 }
 
@@ -1543,6 +1544,7 @@ fieldset.inline-edit-col-right .inline-edit-col {
 }
 
 #icon-users,
 }
 
 #icon-users,
+#icon-profile,
 #icon-user-edit {
        background: transparent url(../images/icons32.png) no-repeat -600px -5px;
 }
 #icon-user-edit {
        background: transparent url(../images/icons32.png) no-repeat -600px -5px;
 }
@@ -1575,3 +1577,84 @@ fieldset.inline-edit-col-right .inline-edit-col {
 #header-logo {
        background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
 }
 #header-logo {
        background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
 }
+
+#wphead #site-visit-button {
+       background-color:#585858;
+       background-image: url(../images/visit-site-button-grad.gif);
+       color:#aaa;
+       text-shadow: #3F3F3F 0 -1px 0;
+}
+
+#wphead a:hover #site-visit-button {
+       color:#fff;
+}
+
+#wphead a:focus #site-visit-button,
+#wphead a:active #site-visit-button {
+       background-position:0 -27px;
+}
+
+.popular-tags,
+.feature-filter {
+       background-color: #FFFFFF;
+       border-color: #DFDFDF;
+}
+
+#theme-information .action-button {
+       border-top-color: #DFDFDF;
+}
+
+.theme-listing br.line {
+       border-bottom-color: #ccc;
+}
+
+div.widgets-sortables,
+#widgets-left .inactive {
+       background-color: #f1f1f1;
+    border-color: #ddd;
+}
+
+#available-widgets .widget-holder {
+    background-color: #fff;
+    border-color: #ddd;
+}
+
+#widgets-left .sidebar-name {
+       background-color: #aaa;
+       background-image: url(../images/ed-bg.gif);
+       text-shadow: #FFFFFF 0 1px 0;
+       border-color: #dfdfdf;
+}
+
+#widgets-right .sidebar-name {
+       background-image: url(../images/fav.png);
+       text-shadow: #3f3f3f 0 -1px 0;
+       background-color: #636363;
+       border-color: #636363;
+       color: #fff;
+}
+
+.sidebar-name:hover,
+#removing-widget {
+       color: #d54e21;
+}
+
+#removing-widget span {
+       color: black;
+}
+
+#widgets-left .sidebar-name-arrow {
+       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;
+}
+
+#widgets-right .sidebar-name-arrow {
+       background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px;
+}
+
+.in-widget-title {
+       color: #606060;
+}
+
+.deleting .widget-title * {
+       color: #aaa;
+}
index fcadcf994fc69d5318f9480e54a65d1f5b4ff463..2784301ee19509a0ebe20774dd1322a62da77ea2 100644 (file)
@@ -56,18 +56,6 @@ form .textarea-wrap {
        min-width: 0;
 }
 
        min-width: 0;
 }
 
-#dashboard-widgets-wrap .has-sidebar {
-       margin-right: -51%;
-}
-
-#dashboard-widgets-wrap .inner-sidebar {
-       width: 49%;
-}
-
-#dashboard-widgets-wrap .has-sidebar .has-sidebar-content {
-       margin-right: 51%;
-}
-
 div.postbox div.inside {
        margin: 10px;
        position: relative;
 div.postbox div.inside {
        margin: 10px;
        position: relative;
@@ -167,7 +155,7 @@ div.postbox div.inside {
 }
 
 #dashboard_right_now .waiting {
 }
 
 #dashboard_right_now .waiting {
-       color: orange;
+       color: #e66f00;
 }
 
 #dashboard_right_now .approved {
 }
 
 #dashboard_right_now .approved {
@@ -210,7 +198,7 @@ div.postbox div.inside {
 }
 
 #the-comment-list .comment-item {
 }
 
 #the-comment-list .comment-item {
-       padding: 1em 10px 1em 70px;
+       padding: 1em 10px;
        border-top: 1px solid;
 }
 
        border-top: 1px solid;
 }
 
@@ -229,7 +217,7 @@ div.postbox div.inside {
 
 #the-comment-list .comment-item .avatar {
        float: left;
 
 #the-comment-list .comment-item .avatar {
        float: left;
-       margin-left: -60px;
+       margin: 0 10px 5px 0;
 }
 
 #the-comment-list .comment-item h4 {
 }
 
 #the-comment-list .comment-item h4 {
@@ -394,3 +382,9 @@ a.rsswidget {
        margin: 0 0 1.4em;
        line-height: 1.4em;
 }
        margin: 0 0 1.4em;
        line-height: 1.4em;
 }
+
+.dashboard-comment-wrap {
+       overflow: hidden;
+       word-wrap: break-word;
+}
+
index 81f1c9e5cb86fa924c7e25796906151dacb3741b..7a8badb434c4b6bacf4cb93a5ee1731677294e20 100644 (file)
@@ -1,7 +1,7 @@
-.farbtastic .color, .farbtastic .overlay {\r
-       left: 0;\r
-       right: 47px;\r
-}\r
-.farbtastic .marker {\r
-       margin: -8px -8px 0 0;\r
-}\r
+.farbtastic .color, .farbtastic .overlay {
+       left: 0;
+       right: 47px;
+}
+.farbtastic .marker {
+       margin: -8px -8px 0 0;
+}
index 0526d9d21b22417f22c2f671dca9b8d87b5338cc..78b2c408742efe67da7d96f0c6b332138725358e 100644 (file)
@@ -5,7 +5,7 @@
        margin-right:-160px;
        margin-left: 5px;
 }
        margin-right:-160px;
        margin-left: 5px;
 }
-div.folded #adminmenu {
+body.folded #adminmenu {
        margin-left: 0;
        margin-right: -45px;
 }
        margin-left: 0;
        margin-right: -45px;
 }
@@ -14,16 +14,19 @@ div.folded #adminmenu {
        float: left;
        clear: left;
 }
        float: left;
        clear: left;
 }
-.has-sidebar {
-       float: right;
-       clear: right;
-       margin-right: 0;
-       margin-left: -340px;
+
+.has-right-sidebar #post-body {
+       clear:right;
+       float:right;
+       margin-right:0;
+       margin-left:-340px;
 }
 }
-.has-sidebar .has-sidebar-content {
-       margin-right: 0;
-       margin-left: 305px;
+
+.has-right-sidebar #post-body-content {
+       margin-left: 300px;
+       margin-right:0;
 }
 }
+
 #wpbody {
        margin-left:0;
        margin-right: 175px;
 #wpbody {
        margin-left:0;
        margin-right: 175px;
@@ -72,3 +75,9 @@ body, td, textarea, input, select {
 .updated, .error {
        clear: both;
 }
 .updated, .error {
        clear: both;
 }
+
+.screen-reader-text, .screen-reader-text span {
+       left:auto;
+       right:-1000em;
+}
+}
\ No newline at end of file
index d9c91a343c97fbcf1c7dd5beae50d5a8b0e526f6..3afbd2f6f6d905d5b2972315f0b40dfe906bc30b 100644 (file)
@@ -112,23 +112,32 @@ table {
 }
 
 /* inner 2 column liquid layout */
 }
 
 /* inner 2 column liquid layout */
-
 .inner-sidebar {
        float: right;
        clear: right;
 .inner-sidebar {
        float: right;
        clear: right;
-       width: 280px;
+       display: none;
+       width: 281px;
        position: relative;
 }
 
        position: relative;
 }
 
-.has-sidebar {
+.inner-sidebar #side-sortables {
+       width: 280px;
+       min-height: 300px;
+}
+
+.has-right-sidebar .inner-sidebar {
+       display: block;
+}
+
+.has-right-sidebar #post-body {
        float: left;
        clear: left;
        width: 100%;
        margin-right: -340px;
 }
 
        float: left;
        clear: left;
        width: 100%;
        margin-right: -340px;
 }
 
-.has-sidebar .has-sidebar-content {
-       margin-right: 305px;
+.has-right-sidebar #post-body-content {
+       margin-right: 300px;
 }
 
 /* 2 columns main area */
 }
 
 /* 2 columns main area */
@@ -176,14 +185,26 @@ table {
        clear: both;
 }
 
        clear: both;
 }
 
+/* Hide visually but not from screen readers */
+.screen-reader-text,
+.screen-reader-text span {
+       position: absolute;
+       left: -1000em;
+       height: 1px;
+       width: 1px;
+       overflow: hidden;
+}
+
 .hidden,
 .hidden,
-.closed .inside,
-.hide-if-no-js {
+.js .closed .inside,
+.js .hide-if-js,
+.no-js .hide-if-no-js {
        display: none;
 }
 
 /* include margin and padding in the width calculation of input and textarea */
 input[type="text"],
        display: none;
 }
 
 /* include margin and padding in the width calculation of input and textarea */
 input[type="text"],
+input[type="password"],
 textarea {
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
 textarea {
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
@@ -193,7 +214,7 @@ textarea {
 
 input[type="checkbox"],
 input[type="radio"] {
 
 input[type="checkbox"],
 input[type="radio"] {
-       vertical-align: text-top;
+       vertical-align: middle;
 }
 
 /* styles for use by people extending the WordPress interface */
 }
 
 /* styles for use by people extending the WordPress interface */
@@ -203,8 +224,22 @@ body {
 }
 
 body,
 }
 
 body,
-td {
-       font: 13px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+td,
+textarea,
+input,
+select {
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       font-size: 13px;
+}
+
+body,
+textarea {
+       line-height: 1.4em;
+}
+
+input,
+select {
+       line-height: 1em;
 }
 
 p {
 }
 
 p {
@@ -235,7 +270,6 @@ dt {
 textarea,
 input,
 select {
 textarea,
 input,
 select {
-       font: 13px/19px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
        margin: 1px;
        padding: 3px;
 }
        margin: 1px;
        padding: 3px;
 }
@@ -263,6 +297,7 @@ h3 {
 
 h4 {
   display: block;
 
 h4 {
   display: block;
+  font-size: 1em;
   font-weight: bold;
   margin: 1.33em 0;
 }
   font-weight: bold;
   margin: 1.33em 0;
 }
@@ -281,6 +316,30 @@ h6 {
   margin: 2.33em 0;
 }
 
   margin: 2.33em 0;
 }
 
+ul.ul-disc {
+       list-style: disc outside;
+}
+
+ul.ul-square {
+       list-style: square outside;
+}
+
+ol.ol-decimal {
+       list-style: decimal outside;
+}
+
+ul.ul-disc,
+ul.ul-square,
+ol.ol-decimal {
+       margin-left: 1.8em;
+}
+
+ul.ul-disc > li,
+ul.ul-square > li,
+ol.ol-decimal > li {
+       margin: 0 0 0.5em;
+}
+
 .subsubsub {
        list-style: none;
        margin: 8px 0 5px;
 .subsubsub {
        list-style: none;
        margin: 8px 0 5px;
@@ -344,39 +403,13 @@ h6 {
 }
 
 .widefat td {
 }
 
 .widefat td {
-       padding: 7px 7px 5px;
+       padding: 3px 7px;
        vertical-align: top;
 }
 
        vertical-align: top;
 }
 
-.widefat thead tr th:first {
-       -moz-border-radius-topleft: 4px;
-       -webkit-border-top-left-radius: 4px;
-       -khtml-border-top-left-radius: 4px;
-       border-top-left-radius: 4px;
-}
-
-.widefat thead tr th:last {
-       -moz-border-radius-topright: 4px;
-       -webkit-border-top-right-radius: 4px;
-       -khtml-border-top-right-radius: 4px;
-       border-top-right-radius: 4px;
-}
-
-.widefat tfoot tr th:first {
-       -moz-border-radius-bottomleft: 4px;
-       -webkit-border-bottom-left-radius: 4px;
-       -khtml-border-bottom-left-radius: 4px;
-       border-bottom-left-radius: 4px;
-}
-
-.widefat tfoot tr th:last {
-       -moz-border-radius-bottomright: 4px;
-       -webkit-border-bottom-right-radius: 4px;
-       -khtml-border-bottom-right-radius: 4px;
-       border-bottom-right-radius: 4px;
-}
-
-.widefat td p {
+.widefat td p,
+.widefat td ol,
+.widefat td ul {
        font-size: 11px;
 }
 
        font-size: 11px;
 }
 
@@ -439,7 +472,7 @@ h6 {
 
 .wrap .updated,
 .wrap .error {
 
 .wrap .updated,
 .wrap .error {
-       margin: 5px 0;
+       margin: 5px 0 15px;
 }
 
 .wrap h2 {
 }
 
 .wrap h2 {
index f66409e1d288a4d84e71ad82a2074b4ff93a99aa..1a6db4867f03df5880d3cf561185c78e1130fe3a 100644 (file)
@@ -44,7 +44,7 @@ div#dashboard-widgets {
        padding-right: 0;
        padding-left: 1px;
 }
        padding-right: 0;
        padding-left: 1px;
 }
-#tagchecklist span a {
+.tagchecklist span a {
        margin: 4px -9px 0 0;
 }
 .widefat th input {
        margin: 4px -9px 0 0;
 }
 .widefat th input {
index c6c03106b1c65a843e0d566efa8ad0b1933e0364..6c59c93ad41953924d7aaa29bc9605dae35551b9 100644 (file)
@@ -7,8 +7,7 @@ input.button-highlighted {
 }
 
 #minor-publishing-actions input,
 }
 
 #minor-publishing-actions input,
-#major-publishing-actions input,
-#minor-publishing-actions .preview {
+#major-publishing-actions input {
        min-width: auto;
        padding-left: 0;
        padding-right: 0;
        min-width: auto;
        padding-left: 0;
        padding-right: 0;
@@ -22,8 +21,9 @@ input.button-highlighted {
        margin-bottom: -1px;
 }
 
        margin-bottom: -1px;
 }
 
-* html #side-info-column {
-       height: auto;
+* html .inner-sidebar #side-sortables,
+* html .postbox-container .meta-box-sortables {
+       height: 300px;
 }
 
 * html #wpbody-content #screen-options-link-wrap {
 }
 
 * html #wpbody-content #screen-options-link-wrap {
@@ -38,21 +38,11 @@ input.button-highlighted {
        text-align: center;
 }
 
        text-align: center;
 }
 
-/*
-* html body.minwidth {
-       _width: expression(document.documentElement.clientWidth < 810 ? "808px" : "99.9%");
-}
-
-* html #wpbody {
-       _width: expression(document.documentElement.clientWidth > 982 ? "980px" : "99.9%");
-}
-*/
-
 * html #adminmenu {
        margin-left: -80px;
 }
 
 * html #adminmenu {
        margin-left: -80px;
 }
 
-* html div.folded #adminmenu {
+* html .folded #adminmenu {
        margin-left: -22px;
 }
 
        margin-left: -22px;
 }
 
@@ -62,8 +52,13 @@ input.button-highlighted {
        margin: 0;
 }
 
        margin: 0;
 }
 
-#wpcontent.folded #adminmenu li.menu-top {
+* html #footer {
+       margin: 0;
+}
+
+.folded #adminmenu li.menu-top {
        display: block;
        display: block;
+       zoom: 100%;
 }
 
 ul#adminmenu {
 }
 
 ul#adminmenu {
@@ -106,7 +101,7 @@ ul#adminmenu {
        zoom: 100%;
 }
 
        zoom: 100%;
 }
 
-#wpcontent.folded #adminmenu li.wp-menu-separator {
+.folded #adminmenu li.wp-menu-separator {
        width: 28px;
 }
 
        width: 28px;
 }
 
@@ -115,7 +110,7 @@ ul#adminmenu {
        zoom: 100%;
 }
 
        zoom: 100%;
 }
 
-#wpcontent.folded #adminmenu .menu-top {
+.folded #adminmenu .menu-top {
        height: 30px;
 }
 
        height: 30px;
 }
 
@@ -126,7 +121,8 @@ ul#adminmenu {
 #template,
 #template div,
 #editcat,
 #template,
 #template div,
 #editcat,
-#addcat {
+#addcat,
+* html .stuffbox h3 {
        zoom: 100%;
 }
 
        zoom: 100%;
 }
 
@@ -192,11 +188,6 @@ input {
        line-height: 20px;
 }
 
        line-height: 20px;
 }
 
-#the-comment-list .comment-item,
-ul#widget-list li.widget-list-item {
-       zoom: 100%;
-}
-
 #wphead-info {
        float: right;
 }
 #wphead-info {
        float: right;
 }
@@ -208,9 +199,10 @@ ul#widget-list li.widget-list-item {
 a.button {
        line-height: 1.4em;
        margin: 1px;
 a.button {
        line-height: 1.4em;
        margin: 1px;
+       padding: 4px 6px;
 }
 
 }
 
-* html div.widget-liquid-left-holder,
+* html div.widget-liquid-left,
 * html div.widget-liquid-right {
        display: block;
        position: relative;
 * html div.widget-liquid-right {
        display: block;
        position: relative;
@@ -230,10 +222,10 @@ a.button {
        zoom: 100%;
 }
 
        zoom: 100%;
 }
 
+#the-comment-list .comment-item,
 #post-status-info,
 #wpwrap,
 #wpcontent,
 #post-status-info,
 #wpwrap,
 #wpcontent,
-#post,
 #wrap,
 #postdivrich,
 #postdiv,
 #wrap,
 #postdivrich,
 #postdiv,
@@ -243,13 +235,15 @@ a.button {
 #post-body,
 #editorcontainer,
 .tablenav,
 #post-body,
 #editorcontainer,
 .tablenav,
-.widget-control-list,
-li.widget-list-control-item,
+.widget-liquid-left,
+.widget-liquid-right,
+#widgets-left,
+.widgets-sortables,
 #dragHelper,
 #dragHelper,
-li.widget-list-control-item h4,
-.widget-sortable,
+.widget .widget-top,
+.widget,
 .widget-control-actions,
 .widget-control-actions,
-#tagchecklist,
+.tagchecklist,
 #col-container,
 #col-left,
 #col-right {
 #col-container,
 #col-left,
 #col-right {
@@ -301,12 +295,12 @@ div#dashboard-widgets {
        padding-right: 1px;
 }
 
        padding-right: 1px;
 }
 
-#tagchecklist span, #tagchecklist span a {
+.tagchecklist span, .tagchecklist span a {
        display: inline-block;
        display: block;
 }
 
        display: inline-block;
        display: block;
 }
 
-#tagchecklist span a {
+.tagchecklist span a {
        margin: 4px 0 0 -9px;
 }
 
        margin: 4px 0 0 -9px;
 }
 
@@ -347,3 +341,55 @@ table.ie-fixed {
        display: inline-block;
        padding: 2px 5px;
 }
        display: inline-block;
        padding: 2px 5px;
 }
+
+* html .stuffbox,
+* html .stuffbox input,
+* html .stuffbox textarea {
+       border: 1px solid #DFDFDF;
+}
+
+* html .feature-filter .feature-group li {
+       width: 145px;
+}
+
+* html .widget-top .widget-title-action a {
+    background: url("../images/menu-bits.gif") no-repeat scroll 0 -110px;
+}
+
+* html div.widget-liquid-left {
+    width: 99%;
+}
+
+#wp_inactive_widgets {
+       padding-bottom: 8px;
+}
+
+* html .widgets-sortables {
+       height: 50px;
+}
+
+* html a#content_resize {
+       right: -2px;
+}
+
+* html .widget-title h4 {
+       width: 205px;
+}
+
+* html #removing-widget .in-widget-title {
+       display: none;
+}
+
+#available-widgets .widget-holder {
+       padding-bottom: 65px;
+}
+
+#widgets-left .inactive {
+       padding-bottom: 10px;
+}
+
+.widget-liquid-right .widget,
+#wp_inactive_widgets .widget {
+       position: relative;
+}
+
index 9f806e79ea69c6cade4cad8bb2a906c69a6d4c17..bd89d91a4c2225e59fa4b0776d1c3a3bf61c4778 100644 (file)
@@ -105,3 +105,7 @@ h1 a {
        border: 1px solid #e5e5e5;
        background: #fbfbfb;
 }
        border: 1px solid #e5e5e5;
        background: #fbfbfb;
 }
+
+.clear {
+       clear: both;
+}
index 7c082700b07da2f6cd6ea34c32b01c3147cf0ff7..f3ccaf0813198e1667de7cc882b04c4430adcbc2 100644 (file)
@@ -104,46 +104,6 @@ tr.image-size label {
        max-height: 40px;
 }
 
        max-height: 40px;
 }
 
-.filename.original {
-       float: left;
-}
-
-.crunching {
-       display: block;
-       line-height: 32px;
-       text-align: right;
-       margin-right: 5px;
-}
-
-button.dismiss {
-       position: absolute;
-       top: 7px;
-       right: 5px;
-       z-index: 4;
-       width: 8em;
-}
-
-.file-error {
-       float: left;
-       font-weight: bold;
-       padding: 10px;
-}
-
-.progress {
-       position: absolute;
-       top: 0;
-       left: 0;
-       width: 623px;
-       height: 36px;
-}
-
-.bar {
-       width: 0;
-       height: 100%;
-       border-right-width: 3px;
-       border-right-style: solid;
-}
-
 #library-form .progress,
 #gallery-form .progress,
 #flash-upload-ui,
 #library-form .progress,
 #gallery-form .progress,
 #flash-upload-ui,
@@ -229,7 +189,7 @@ abbr.required {
        margin: 0 1em 1em 0;
 }
 
        margin: 0 1em 1em 0;
 }
 
-#media-upload .media-upload-form p.ml-submit {
+#media-upload p.ml-submit {
        padding: 1em 0;
 }
 
        padding: 1em 0;
 }
 
@@ -252,7 +212,6 @@ abbr.required {
 }
 
 #media-upload .media-item {
 }
 
 #media-upload .media-item {
-       position: relative;
        border-bottom-width: 1px;
        border-bottom-style: solid;
        min-height: 36px;
        border-bottom-width: 1px;
        border-bottom-style: solid;
        min-height: 36px;
@@ -264,11 +223,9 @@ abbr.required {
 }
 
 .filename {
 }
 
 .filename {
-       float: left;
        line-height: 36px;
        line-height: 36px;
-       margin-left: 10px;
+       padding: 0 10px;
        overflow: hidden;
        overflow: hidden;
-       max-width: 430px;
 }
 
 #media-upload .describe {
 }
 
 #media-upload .describe {
@@ -314,11 +271,6 @@ abbr.required {
        width: auto;
 }
 
        width: auto;
 }
 
-#media-upload a.delete,
-#media-upload a.del-link {
-       padding: 0 3px 1px;
-}
-
 #media-upload .del-attachment {
        display: none;
        margin: 5px 0;
 #media-upload .del-attachment {
        display: none;
        margin: 5px 0;
@@ -355,7 +307,9 @@ abbr.required {
 }
 
 .sorthelper {
 }
 
 .sorthelper {
-       z-index: -1;
+       height: 37px;
+       width: 623px;
+       display: block;
 }
 
 #gallery-settings th.label {
 }
 
 #gallery-settings th.label {
@@ -424,3 +378,23 @@ h3.media-title  {
 #gallery-settings select#columns {
        width: 6em;
 }
 #gallery-settings select#columns {
        width: 6em;
 }
+
+#sort-buttons {
+       font-size: 0.8em;
+       margin: 3px 25px -8px 0;
+       text-align: right;
+       max-width: 625px;
+}
+
+#sort-buttons a {
+       text-decoration: none;
+}
+
+#sort-buttons #asc,
+#sort-buttons #showall {
+       padding-left: 5px;
+}
+
+#sort-buttons span {
+       margin-right: 25px;
+}
index 2441840bbb250046009b72920ca8bd8fc3ad1e31..645972bff70ec41147e2e52423990b39eaca460a 100644 (file)
@@ -85,8 +85,7 @@ div.star img {
 }
 
 #plugin-information .fyi {
 }
 
 #plugin-information .fyi {
-       margin-left: 10px;
-       margin-bottom: 50px;
+       margin: 0 10px 50px;
        width: 210px;
 }
 
        width: 210px;
 }
 
@@ -146,4 +145,4 @@ div.star img {
 
 #plugin-information pre {
        padding: 7px;
 
 #plugin-information pre {
        padding: 7px;
-}
\ No newline at end of file
+}
index b15e8455521fbabf01a4bf7039693c584a9e6eaa..9f4a37ef92dc951c2c265109a3fceadc5cd1700b 100644 (file)
@@ -1,22 +1,26 @@
 body {
        font-family: Tahoma, Arial;
 }
 body {
        font-family: Tahoma, Arial;
 }
+
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML {
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML {
-       margin: 0px 0 0 5px;
+       margin: 0 0 0 5px;
        float: right;
 }
        float: right;
 }
+
 /* Editor/Main Column */
 div#poststuff {
        padding-left: 0;
        padding-right: 10px;
 }
 /* Editor/Main Column */
 div#poststuff {
        padding-left: 0;
        padding-right: 10px;
 }
+
 .posting {
        margin-right: 0;
        margin-left: 228px;
 .posting {
        margin-right: 0;
        margin-left: 228px;
-       left:auto;
+       left: auto;
        right: 0;
 }
        right: 0;
 }
+
 #side-info-column {
        float: left;
        right: auto;
 #side-info-column {
        float: left;
        right: auto;
@@ -24,50 +28,62 @@ div#poststuff {
        margin-right: 0;
        margin-left: 10px;
 }
        margin-right: 0;
        margin-left: 10px;
 }
+
 #side-info-column .sleeve {
        padding-left: 0;
        padding-right: 10px;
 }
 #side-info-column .sleeve {
        padding-left: 0;
        padding-right: 10px;
 }
+
 h3.tb {
        margin-left: 0;
        margin-right: 5px;
 }
 h3.tb {
        margin-left: 0;
        margin-right: 5px;
 }
+
 #actions {
        float: left;
 }
 #actions {
        float: left;
 }
+
 #extra_fields #actions {
        right: auto;
        left: 4px;
 }
 #extra_fields #actions {
        right: auto;
        left: 4px;
 }
+
 #actions li {
        float: right;
        margin-right: 0;
        margin-left: 10px;
 }
 #actions li {
        float: right;
        margin-right: 0;
        margin-left: 10px;
 }
+
 #extra_fields .button {
        margin-right: 0;
        margin-left: 5px;
 }
 #extra_fields .button {
        margin-right: 0;
        margin-left: 5px;
 }
+
 /* Photo Styles */
 #img_container a {
        float: right;
 }
 /* Photo Styles */
 #img_container a {
        float: right;
 }
+
 #category-add input, #category-add select {
        font-family: Tahoma, Arial;
 }
 #category-add input, #category-add select {
        font-family: Tahoma, Arial;
 }
+
 #categorydiv ul.categorychecklist ul {
        margin-left: 0;
        margin-right: 18px;
 }
 #categorydiv ul.categorychecklist ul {
        margin-left: 0;
        margin-right: 18px;
 }
+
 /* Tags */
 #tagsdiv #newtag {
        margin-right: 0;
        margin-left: 5px;
 }
 /* Tags */
 #tagsdiv #newtag {
        margin-right: 0;
        margin-left: 5px;
 }
+
 #tagadd {
        margin-left: 0;
        margin-right: 3px;
 }
 #tagadd {
        margin-left: 0;
        margin-right: 3px;
 }
+
 #tagchecklist span {
        margin-left: .5em;
        margin-right: 10px;
 #tagchecklist span {
        margin-left: .5em;
        margin-right: 10px;
@@ -77,29 +93,35 @@ h3.tb {
        margin: 6px -9px 0 0;
        float: right;
 }
        margin: 6px -9px 0 0;
        float: right;
 }
+
 #content {
        margin-left: 0;
        margin-right: 1%;
 }
 #content {
        margin-left: 0;
        margin-right: 1%;
 }
+
 .submit input,
 .button,
 .button-primary,
 .button-secondary,
 .button-highlighted,
 #postcustomstuff .submit input {
 .submit input,
 .button,
 .button-primary,
 .button-secondary,
 .button-highlighted,
 #postcustomstuff .submit input {
-       font-family: tahoma;
+       font-family: Tahoma, Arial, sans-serif;
 }
 }
+
 .ac_results li {
        text-align: right;
 }
 .ac_results li {
        text-align: right;
 }
+
 #TB_ajaxContent #options {
        right: auto;
        left: 25px;
 }
 #TB_ajaxContent #options {
        right: auto;
        left: 25px;
 }
+
 #post_status {
        margin-left: 0;
        margin-right: 10px;
 }
 #post_status {
        margin-left: 0;
        margin-right: 10px;
 }
+
 /* Footer */
 #footer {
        padding: 10px 60px 0 0;
 /* Footer */
 #footer {
        padding: 10px 60px 0 0;
index 6a4fbc1cb01dbd8cffd10553dcd136a1cc68b741..2b453567ecc825f121b0c27efbf75801c0b81e58 100644 (file)
@@ -1,5 +1,5 @@
 body {
 body {
-       font: 13px "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
+       font: 13px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
        color: #333;
        margin: 0;
        padding: 0;
        color: #333;
        margin: 0;
        padding: 0;
@@ -16,34 +16,26 @@ img {
        background: #444 !important;
 }
 
        background: #444 !important;
 }
 
+.tagchecklist span a {
+background: transparent url(../images/xit.gif) no-repeat 0 0;
+}
+
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML {
 #poststuff #edButtonPreview,
 #poststuff #edButtonHTML {
-       -moz-border-radius-bottomleft: 0;
-       -moz-border-radius-bottomright: 0;
-       -moz-border-radius-topleft: 3px;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-radius-bottomleft: 0;
-       -khtml-border-radius-bottomright: 0;
-       -khtml-border-radius-topleft: 3px;
-       -khtml-border-radius-topright: 3px;
-       -webkit-border-radius-bottomleft: 0;
-       -webkit-border-radius-bottomright: 0;
-       -webkit-border-radius-topleft: 3px;
-       -webkit-border-radius-topright: 3px;
-       border-radius-bottomleft: 0;
-       border-radius-bottomright: 0;
-       border-radius-topleft: 3px;
-       border-radius-topright: 3px;
+       -moz-border-radius: 3px 3px 0 0;
+       -webkit-border-top-right-radius: 3px;
+       -webkit-border-top-left-radius: 3px;
+       -khtml-border-top-right-radius: 3px;
+       -khtml-border-top-left-radius: 3px;
+       border-top-right-radius: 3px;
+       border-top-left-radius: 3px;
        border-style: solid;
        border-width: 1px;
        cursor: pointer;
        display: block;
        height: 18px;
        border-style: solid;
        border-width: 1px;
        cursor: pointer;
        display: block;
        height: 18px;
-       margin: 0px 5px 0 0;
-       padding: 0px 5px 0px;
-       background-color: #E9E9E9;
-       border-bottom-color: #E9E9E9;
-       color: #333333;
+       margin: 0 5px 0 0;
+       padding: 0 5px 0;
        font-size: 10px;
        line-height: 18px;
        float: left;
        font-size: 10px;
        line-height: 18px;
        float: left;
@@ -107,6 +99,7 @@ div.zerosize {
 }
 
 #side-info-column .sleeve {
 }
 
 #side-info-column .sleeve {
+       padding-top: 5px;
        padding-left: 10px;
 }
 
        padding-left: 10px;
 }
 
@@ -116,21 +109,15 @@ div.zerosize {
 }
 
 #poststuff h2, #poststuff h3 {
 }
 
 #poststuff h2, #poststuff h3 {
-       font-size: 14px;
-       font-weight: bold;
-       padding: 7px;
-       margin: 0 0 10px;
-       background: #dfdfdf url("../images/gray-grad.png") repeat-x left top;
        font-size: 12px;
        font-weight: bold;
        line-height: 1;
        margin: 0 0 10px;
        padding: 7px 9px;
        font-size: 12px;
        font-weight: bold;
        line-height: 1;
        margin: 0 0 10px;
        padding: 7px 9px;
-       text-shadow: 0 1px 0 #FFFFFF;
 }
 
 h3.tb {
 }
 
 h3.tb {
-       text-shadow: 0 1px 0 #FFFFFF;
+       text-shadow: 0 1px 0 #fff;
        font-weight: bold;
        font-size: 12px;
        margin-left: 5px;
        font-weight: bold;
        font-size: 12px;
        margin-left: 5px;
@@ -144,7 +131,6 @@ h3.tb {
        border-radius: 6px;
 }
 
        border-radius: 6px;
 }
 
-.metabox-holder .postbox,
 .postbox,
 .stuffbox {
        margin-bottom: 10px;
 .postbox,
 .stuffbox {
        margin-bottom: 10px;
@@ -155,14 +141,10 @@ h3.tb {
        -khtml-border-radius: 6px;
        -webkit-border-radius: 6px;
        border-radius: 6px;
        -khtml-border-radius: 6px;
        -webkit-border-radius: 6px;
        border-radius: 6px;
-       border-color: #DFDFDF;
 }
 
 }
 
-.titlediv {
-       border-color: #DFDFDF;
-}
-
-#title, .tbtitle {
+#title,
+.tbtitle {
        -moz-border-radius: 6px;
        -khtml-border-radius: 6px;
        -webkit-border-radius: 6px;
        -moz-border-radius: 6px;
        -khtml-border-radius: 6px;
        -webkit-border-radius: 6px;
@@ -172,7 +154,7 @@ h3.tb {
        font-size: 1.7em;
        outline: none;
        padding: 3px 4px;
        font-size: 1.7em;
        outline: none;
        padding: 3px 4px;
-       border-color: #DFDFDF;
+       border-color: #dfdfdf;
 }
 
 .tbtitle {
 }
 
 .tbtitle {
@@ -184,22 +166,13 @@ h3.tb {
        width: 98%;
 }
 
        width: 98%;
 }
 
-.postbox h2 {
-       background-image: url(../images/postbox-bg.gif);
-       background-position: left top;
-       background-repeat: repeat-x;
-       background-color: #DFDFDF;
-}
-
 .editor-container {
        -moz-border-radius: 6px;
        -khtml-border-radius: 6px;
        -webkit-border-radius: 6px;
        border-radius: 6px;
 .editor-container {
        -moz-border-radius: 6px;
        -khtml-border-radius: 6px;
        -webkit-border-radius: 6px;
        border-radius: 6px;
-       border-collapse: separate;
-       border-style: solid;
-       border-width: 1px;
-       border-color: #DFDFDF;
+       border: 1px solid #dfdfdf;
+       background-color: #fff;
 }
 
 .postdivrich {
 }
 
 .postdivrich {
@@ -213,12 +186,12 @@ h3.tb {
        margin-top: -19px;
        position: relative;
 }
        margin-top: -19px;
        position: relative;
 }
+
 #extra_fields #actions {
        clear: both;
 #extra_fields #actions {
        clear: both;
-       position: absolute;
-       right: 4px;
-       top: 6px;
-       margin: 0;
+       position: relative;
+       right: 0px;
+       margin: -24px 0 0;
 }
 
 #actions li {
 }
 
 #actions li {
@@ -226,8 +199,14 @@ h3.tb {
        list-style: none;
        margin-right: 10px;
 }
        list-style: none;
        margin-right: 10px;
 }
+
 #extra_fields .button {
        margin-right: 5px;
 #extra_fields .button {
        margin-right: 5px;
+       padding: 3px 6px;
+       border-radius: 10px; 
+       -webkit-border-radius: 10px; 
+       -khtml-border-radius: 10px;
+       -moz-border-radius: 10px;
 }
 
 /* Photo Styles */
 }
 
 /* Photo Styles */
@@ -242,8 +221,9 @@ h3.tb {
 
 #img_container {
        background-color: #fff;
 
 #img_container {
        background-color: #fff;
-       height: 101px;
-       width: 100%;
+}
+#img_container_container {
+       overflow: auto;
 }
 
 #extra_fields {
 }
 
 #extra_fields {
@@ -272,14 +252,13 @@ h3.tb {
        vertical-align: center;
 }
 
        vertical-align: center;
 }
 
-#img_container img, #img_container a {
+#img_container img,
+#img_container a {
        width: 68px;
        height: 68px;
 }
 
 #img_container img {
        width: 68px;
        height: 68px;
 }
 
 #img_container img {
-       width: 68px;
-       height: 68px;
        border: none;
        background-color: #f4f4f4;
        cursor: pointer;
        border: none;
        background-color: #f4f4f4;
        cursor: pointer;
@@ -316,11 +295,12 @@ h3.tb {
 }
 
 #viewsite .button {
 }
 
 #viewsite .button {
-       margin: 0 0 0px 0;
+       margin: 0;
        display: block;
 }
 
        display: block;
 }
 
-.wp-hidden-children .wp-hidden-child {
+.wp-hidden-children
+.wp-hidden-child {
        display: none;
 }
 
        display: none;
 }
 
@@ -354,12 +334,14 @@ h3.tb {
        vertical-align: top;
 }
 
        vertical-align: top;
 }
 
-#category-add input#category-add-sumbit {
+#category-add input,
+#category-add-sumbit {
        width: auto;
 }
 
 /* Categories */
        width: auto;
 }
 
 /* Categories */
-#categorydiv ul, #linkcategorydiv ul {
+#categorydiv ul,
+#linkcategorydiv ul {
        list-style: none;
        padding: 0;
        margin: 0;
        list-style: none;
        padding: 0;
        margin: 0;
@@ -369,8 +351,8 @@ h3.tb {
        margin-left: 18px;
 }
 
        margin-left: 18px;
 }
 
-#categorydiv div.ui-tabs-panel {
-       height: 150px;
+#categorydiv div.tabs-panel {
+       height: 140px;
        overflow: auto;
 }
 
        overflow: auto;
 }
 
@@ -381,34 +363,32 @@ ul.categorychecklist li {
 }
 
 /* Tags */
 }
 
 /* Tags */
-#tagsdiv #newtag {
-       padding: 3px;
+.tagsdiv .newtag {
        margin-right: 5px;
        margin-right: 5px;
-       width: 16em;
 }
 
 }
 
-#jaxtag {
+.jaxtag {
        clear: both;
        margin: 0;
 }
 
        clear: both;
        margin: 0;
 }
 
-#tagadd {
+.tagadd {
        margin-left: 3px;
 }
 
        margin-left: 3px;
 }
 
-#tagchecklist {
+.tagchecklist {
        margin-top: 3px;
        margin-bottom: 1em;
        font-size: 12px;
        overflow: auto;
 }
 
        margin-top: 3px;
        margin-bottom: 1em;
        font-size: 12px;
        overflow: auto;
 }
 
-#tagchecklist strong {
+.tagchecklist strong {
        position: absolute;
        font-size: .75em;
 }
 
        position: absolute;
        font-size: .75em;
 }
 
-#tagchecklist span {
+.tagchecklist span {
        margin-right: .5em;
        margin-left: 10px;
        display: block;
        margin-right: .5em;
        margin-left: 10px;
        display: block;
@@ -419,7 +399,7 @@ ul.categorychecklist li {
        cursor: default;
 }
 
        cursor: default;
 }
 
-#tagchecklist span a {
+.tagchecklist span a {
        margin: 6px 0 0 -9px;
        cursor: pointer;
        width: 10px;
        margin: 6px 0 0 -9px;
        cursor: pointer;
        width: 10px;
@@ -435,13 +415,15 @@ ul.categorychecklist li {
        width: 96% !important;
        margin-left: 1%;
        margin-bottom: 10px;
        width: 96% !important;
        margin-left: 1%;
        margin-bottom: 10px;
-       border: 1px solid #f1f1f1;
+       border: 0 none;
+       height: 365px;
 }
 
 /* Submit */
 
 #saving {
        display: inline;
 }
 
 /* Submit */
 
 #saving {
        display: inline;
+       vertical-align: middle;
 }
 
 .submit input,
 }
 
 .submit input,
@@ -450,7 +432,7 @@ ul.categorychecklist li {
 .button-secondary,
 .button-highlighted,
 #postcustomstuff .submit input {
 .button-secondary,
 .button-highlighted,
 #postcustomstuff .submit input {
-       font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
        text-decoration: none;
        font-size: 11px !important;
        line-height: 16px;
        text-decoration: none;
        font-size: 11px !important;
        line-height: 16px;
@@ -467,7 +449,7 @@ ul.categorychecklist li {
 .button-primary {
        background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
        border-color: #21759B;
 .button-primary {
        background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
        border-color: #21759B;
-       color: #FFFFFF;
+       color: #fff;
 }
 
 .ac_results {
 }
 
 .ac_results {
@@ -567,3 +549,11 @@ ul.categorychecklist li {
 .hidden {
        display: none;
 }
 .hidden {
        display: none;
 }
+
+.postbox input[type="text"],
+.postbox textarea,
+.stuffbox input[type="text"],
+.stuffbox textarea {
+       border-width: 1px;
+       border-style: solid;
+}
index 486f5c1925e1d70328eada934118748bb9cdcdd1..2f938d84fe507accaefa00a7415ec372688d6ca9 100644 (file)
@@ -64,3 +64,12 @@ div.bordertitle h2 {
 div.tablenav {
        margin-right: 210px;
 }
 div.tablenav {
        margin-right: 210px;
 }
+
+#documentation {
+       margin-top: 10px;
+}
+#documentation label {
+       line-height: 22px;
+       vertical-align: top;
+       font-weight: bold;
+}
\ No newline at end of file
diff --git a/wp-admin/css/theme-install.css b/wp-admin/css/theme-install.css
new file mode 100644 (file)
index 0000000..576dec4
--- /dev/null
@@ -0,0 +1,142 @@
+/* NOTE: the following CSS rules(.star*) are taken more or less straight from the bbPress rating plugin. */
+div.star-holder {
+       position: relative;
+       height: 19px;
+       width: 100px;
+       font-size: 19px;
+}
+
+div.star {
+       height: 100%;
+       position: absolute;
+       top: 0;
+       left: 0;
+       background-color: transparent;
+       letter-spacing: 1ex;
+       border: none;
+}
+
+.star1 { width: 20%; }
+.star2 { width: 40%; }
+.star3 { width: 60%; }
+.star4 { width: 80%; }
+.star5 { width: 100%; }
+
+.star img, div.star a, div.star a:hover, div.star a:visited {
+       display: block;
+       position: absolute;
+       right: 0;
+       border: none;
+       text-decoration: none;
+}
+
+div.star img {
+       width: 19px;
+       height: 19px;
+       border-left: 1px solid #fff;
+       border-right: 1px solid #fff;
+}
+
+.theme-listing .theme-item {
+       display: inline-block;
+       width: 200px;
+       border: thin solid #ccc;
+       vertical-align: top;
+}
+
+.theme-listing .theme-item h3 {
+       text-align: center;
+       font-size: 14px;
+       font-style: italic;
+       margin: 0;
+       padding: 0;
+}
+
+.theme-listing .theme-item img {
+       max-width: 150px;
+       max-height: 150px;
+}
+
+.theme-listing .theme-item-info span {
+       display: none;
+}
+.theme-listing .theme-item:hover .theme-item-info span {
+       display: inline;
+}
+.theme-listing .theme-item:hover .theme-item-info span.dots {
+       display: none;
+}
+.theme-listing .theme-item-info span.action-links {
+       font-weight: bold;
+       text-align: center;
+}
+
+.theme-listing br.line {
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+       margin-bottom: 3px;
+}
+
+.available-theme {
+       padding: 20px 15px;
+}
+
+#theme-information .theme-preview-img {
+       float: left;
+       margin: 5px 25px 10px 15px;
+       width: 300px;
+}
+
+#theme-information .action-button {
+       border-top-width: 1px;
+       border-top-style: solid;
+       margin: 10px 5px 20px;
+}
+
+#theme-information .action-button #cancel {
+       float: left;
+       margin: 10px 15px;
+}
+
+#theme-information .action-button #install {
+       float: right;
+       margin: 10px 15px;
+}
+
+#theme-information .available-theme h3 {
+       margin: 1em 0;
+}
+
+body#theme-information {
+       height: auto;
+}
+
+.feature-filter {
+       -moz-border-radius: 8px;
+       -khtml-border-radius: 8px;
+       -webkit-border-radius: 8px;
+       border-radius: 8px;
+       border-width: 1px;
+       border-style: solid;
+       padding: 8px 12px 0;
+}
+
+.feature-filter .feature-group {
+       float: left;
+       margin-bottom: 20px;
+       width: 695px;
+}
+
+.feature-filter .feature-name {
+       float: left;
+       text-align: right;
+       width: 95px;
+}
+
+.feature-filter .feature-group li {
+       display: inline;
+       float: left;
+       list-style-type: none;
+       padding-right: 25px;
+       min-width: 145px;
+}
index 8d0fc3aae2eaff40dd1265c8217b394f40f5c2ea..b3499722254641a5968a642b4ace86d542265623 100644 (file)
@@ -1,14 +1,4 @@
-h4.widget-title span {
-       float: right;
-}
-h4.widget-title a {
-       float: left;
-       margin-left: 0;
-       margin-right: 1em;
-}
-ul#widget-list li.widget-list-item h4.widget-title {
-       float: right;
-}
+
 ul#widget-list li.widget-list-item div.widget-description {
        margin: 0 200px 0 0;
        padding: 0 4em 0 0;
 ul#widget-list li.widget-list-item div.widget-description {
        margin: 0 200px 0 0;
        padding: 0 4em 0 0;
@@ -19,9 +9,3 @@ ul#widget-list li.widget-list-item div.widget-description {
        margin-left: 8px;
        float: right;
 }
        margin-left: 8px;
        float: right;
 }
-li.widget-list-control-item h4.widget-title a,
-#dragHelper li.widget-list-control-item h4.widget-title a,
-#draghelper li.widget-list-control-item h4.widget-title a:visited {
-       right: auto;
-       left: 1em;
-}
index 41db0b33deaa197b24488bf880197171e7c173c5..c896f5b086d1d838010b70b3100fad74f0b8d874 100644 (file)
+html,
+body {
+       min-width: 950px;
+}
+
 /* 2 column liquid layout */
 /* 2 column liquid layout */
-div.widget-liquid-left-holder {
+div.widget-liquid-left {
        float: left;
        clear: left;
        width: 100%;
        float: left;
        clear: left;
        width: 100%;
-       margin-right: -310px;
+       margin-right: -325px;
 }
 
 }
 
-div.widget-liquid-left {
-       margin-right: 320px;
+div#widgets-left {
+       margin-left: 5px;
+       margin-right: 325px;
+}
+
+div#widgets-right {
+       width: 285px;
+       margin: 0 auto;
 }
 
 div.widget-liquid-right {
        float: right;
        clear: right;
        width: 300px;
 }
 
 div.widget-liquid-right {
        float: right;
        clear: right;
        width: 300px;
-       position: relative;
 }
 
 }
 
-/* pasitioning etc. */
-form#widgets-filter {
-       position: relative;
+.widget-liquid-right .widget,
+#wp_inactive_widgets .widget {
+       width: 250px;
+       margin: 0 auto 20px;
+       overflow: hidden;
 }
 
 }
 
-div#available-widgets-filter {
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+#wp_inactive_widgets .widget {
+       margin: 0 10px 20px;
+       float: left;
 }
 
 }
 
-ul#widget-list {
-       list-style: none;
+div.sidebar-name h3 {
        margin: 0;
        margin: 0;
-       padding: 0;
+       padding: 5px 12px;
+       font-size: 13px;
+       height: 19px;
+       overflow: hidden;
+       white-space: nowrap;
 }
 
 }
 
-ul#widget-list li.widget-list-item {
-       padding: .7em 0.9em;
-       margin: 0;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
-       line-height: 1;
+div.sidebar-name {
+       background-repeat: repeat-x;
+       background-position: 0 0;
+       cursor: pointer;
+       font-size: 13px;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius-topleft: 8px;
+       -moz-border-radius-topright: 8px;
+       -webkit-border-top-right-radius: 8px;
+       -webkit-border-top-left-radius: 8px;
+       -khtml-border-top-right-radius: 8px;
+       -khtml-border-top-left-radius: 8px;
+       border-top-right-radius: 8px;
+       border-top-left-radius: 8px;
+}
+
+.js .closed .sidebar-name {
+       -moz-border-radius-bottomleft: 8px;
+       -moz-border-radius-bottomright: 8px;
+       -webkit-border-bottom-right-radius: 8px;
+       -webkit-border-bottom-left-radius: 8px;
+       -khtml-border-bottom-right-radius: 8px;
+       -khtml-border-bottom-left-radius: 8px;
+       border-bottom-right-radius: 8px;
+       border-bottom-left-radius: 8px;
 }
 
 }
 
-h4.widget-title span {
+.widget-liquid-right .widgets-sortables,
+#widgets-left .widget-holder {
+       border-width: 0 1px 1px;
+       border-style: none solid solid;
+    -moz-border-radius-bottomleft: 8px;
+       -moz-border-radius-bottomright: 8px;
+       -webkit-border-bottom-right-radius: 8px;
+       -webkit-border-bottom-left-radius: 8px;
+       -khtml-border-bottom-right-radius: 8px;
+       -khtml-border-bottom-left-radius: 8px;
+       border-bottom-right-radius: 8px;
+       border-bottom-left-radius: 8px;
+}
+
+.js .closed .widgets-sortables,
+.js .closed .widget-holder {
+       display: none;
+}
+
+.widget-liquid-right .widgets-sortables {
+       padding: 15px 0 0;
+}
+
+#available-widgets .widget-holder {
+       padding: 7px 5px 0;
+}
+
+#wp_inactive_widgets {
+       padding: 5px 5px 0;
+}
+
+#widget-list .widget {
+       width: 250px;
+       margin: 0 10px 15px;
+       border: 0 none;
        float: left;
 }
 
        float: left;
 }
 
-h4.widget-title a {
-       float: right;
-       text-decoration: underline;
-       border-bottom: none;
-       margin-left: 1em;
+#widget-list .widget-description {
+       padding: 5px 8px;
 }
 
 }
 
-ul#widget-list li.widget-list-item h4.widget-title {
-       position: relative;
-       margin: 0;
-       padding: .5em 1em;
-       width: 200px;
+#widget-list .widget-top {
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
+}
+
+.widget-placeholder {
+       border-width: 1px;
+       border-style: dashed;
+       margin: 0 auto 20px;
+       height: 26px;
+       width: 250px;
+}
+
+#wp_inactive_widgets .widget-placeholder {
+       margin: 0 10px 20px;
        float: left;
        float: left;
-       font-size: 13px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
 }
 
 }
 
-#dragHelper h4.widget-title {
-       padding: .5em 1em;
+div.widgets-holder-wrap {
+       padding: 0;
+       margin: 10px 0 20px;
+}
+
+#widgets-left #available-widgets {
+    background-color: transparent;
+    border: 0 none;
+}
+
+ul#widget-list {
+       list-style: none;
        margin: 0;
        margin: 0;
+       padding: 0;
+       min-height: 100px;
 }
 
 }
 
-ul#widget-list li.widget-list-item div.widget-description {
-       display: block;
-       margin: 0 0 0 200px;
-       padding: 0 0 0 4em;
-       font-size: 11px;
+.widget .widget-top {
+       font-size: 12px;
+       font-weight: bold;
+       height: 26px;
+       overflow: hidden;
 }
 
 }
 
-ul#widget-list li.widget-list-item ul.widget-control-info {
+.widget-top .widget-title {
+       padding: 5px 9px;
+}
+
+.widget-top .widget-title-action {
+       float: right;
+}
+
+a.widget-action {
+    display: block;
+    width: 24px;
+    height: 26px;
+}
+
+#available-widgets a.widget-action {
        display: none;
 }
 
        display: none;
 }
 
-div#sidebar-info {
-       padding: 0 1em;
-       margin-bottom: 1em;
+.widget-top a.widget-action {
+    background: url("../images/menu-bits.gif") no-repeat scroll 0 -110px;
+}
+
+.widget .widget-inside,
+.widget .widget-description {
+       padding: 12px 12px 10px;
        font-size: 11px;
        font-size: 11px;
+       line-height: 16px;
 }
 
 }
 
-ul.widget-control-list {
-       list-style: none;
-       margin: 0;
-       padding: 0 1em;
+.widget-inside,
+.widget-description {
+       display: none;
 }
 
 }
 
-div#current-widgets p.submit {
-       padding: 1em;
+#available-widgets .widget-description {
+       display: block;
 }
 
 }
 
-li.widget-list-control-item {
-       margin: 1em 0;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
+.widget .widget-inside p {
+       margin: 0 0 1em;
+       padding: 0;
 }
 
 }
 
-li.widget-list-control-item h4,
-#dragHelper li.widget-list-control-item h4,
-li.widget-sortable h4 {
+.widget-title h4 {
        margin: 0;
        margin: 0;
-       cursor: move;
-       font-size: 13px;
-       padding: 0.4em 0.8em;
-       position: relative;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
+       line-height: 1.3;
+       overflow: hidden;
+       white-space: nowrap;
 }
 
 }
 
-.widget-control-save,
-.widget-control-remove {
-       margin-right: 8px;
-       float: left;
+.widgets-sortables {
+    min-height: 90px;
+}
+
+.widget-control-actions {
+    margin-top: 8px;
+}
+
+.widget-control-actions a {
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
-li.widget-list-control-item h4.widget-title a,
-#dragHelper li.widget-list-control-item h4.widget-title a,
-#draghelper li.widget-list-control-item h4.widget-title a:visited {
-       right: 1em;
+.widget-control-actions a:hover {
+       text-decoration: underline;
+}
+
+.widget-control-actions .ajax-feedback {
+       padding-bottom: 3px;
+}
+
+.widget-control-actions div.alignleft {
+       margin-top: 6px;
 }
 
 }
 
-li.widget-list-control-item h4.widget-title a:hover {
+div#sidebar-info {
+       padding: 0 1em;
+       margin-bottom: 1em;
+       font-size: 11px;
+}
+
+.widget-title a,
+.widget-title a:hover {
        text-decoration: none;
        border-bottom: none;
 }
 
        text-decoration: none;
        border-bottom: none;
 }
 
-li.widget-list-control-item div.widget-control {
-       border-width: 0 1px 1px;
-       border-style: none solid solid;
-       display: none;
-       padding: 15px;
+.widget-control-edit {
+       display: block;
        font-size: 11px;
        font-size: 11px;
-       position: relative;
+       font-weight: normal;
+       line-height: 26px;
+       padding: 0 8px 0 0;
 }
 
 }
 
-li.widget-list-control-item div.widget-control p {
-       margin: 0 0 1em;
-       padding: 0;
+a.widget-control-edit {
+       text-decoration: none;
+}
+
+.widget-control-edit .add,
+.widget-control-edit .edit {
+       display: none;
 }
 
 }
 
-ul.widget-control-list div.widget-control-actions {
-       padding: 0.5em 0 0;
+#available-widgets .widget-control-edit .add,
+#widgets-right .widget-control-edit .edit,
+#wp_inactive_widgets .widget-control-edit .edit {
+       display: inline;
 }
 
 }
 
-.widget-control-edit {
-       font-size: 10px;
+.editwidget {
+       margin: 0 auto 15px;
+}
+
+.editwidget .widget-inside {
+       display: block;
+       border-width: 1px;
+       border-style: solid;
+       padding: 10px;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
+}
+
+.inactive p.description {
+       margin: 5px 15px 8px;
+}
+
+#available-widgets p.description {
+       margin: 0 12px 12px;
+}
+
+.widget-position {
+       margin-top: 8px;
+}
+
+.inactive {
+       padding-top: 2px;
+}
+
+.sidebar-name-arrow {
+       float: right;
+       height: 29px;
+       width: 26px;
+}
+
+.widget-title .in-widget-title {
+       font-size: 11px;
+       white-space: nowrap;
+}
+
+#removing-widget {
+       display: none;
        font-weight: normal;
        font-weight: normal;
+       padding-left: 15px;
+       font-size: 12px;
 }
 
 }
 
-div#current-widgets {
-       padding-top: 1em;
-       border-width: 1px 0 0;
-       border-style: solid none none;
+.widget-control-noform,
+#access-off,
+.widgets_access .widget-action,
+.widgets_access .sidebar-name-arrow,
+.widgets_access #access-on,
+.widgets_access .widget-holder .description {
+       display: none;
 }
 
 }
 
-#widget-controls .widefat {
-       width: 92%;
-       padding: 3px;
+.widgets_access .widget-holder,
+.widgets_access #widget-list {
+       padding-top: 10px;
 }
 
 }
 
-#widget-controls select.widefat {
-       width: auto;
+.widgets_access #access-off {
+       display: inline;
+}
+
+.widgets_access #wpbody-content .widget-title-action,
+.widgets_access #wpbody-content .widget-control-edit,
+.widgets_access .closed .widgets-sortables,
+.widgets_access .closed .widget-holder {
        display: block;
 }
        display: block;
 }
+
+.widgets_access .closed .sidebar-name {
+       -moz-border-radius-bottomleft: 0;
+       -moz-border-radius-bottomright: 0;
+       -webkit-border-bottom-right-radius: 0;
+       -webkit-border-bottom-left-radius: 0;
+       -khtml-border-bottom-right-radius: 0;
+       -khtml-border-bottom-left-radius: 0;
+       border-bottom-right-radius: 0;
+       border-bottom-left-radius: 0;
+}
+
+.widgets_access .sidebar-name,
+.widgets_access .widget .widget-top {
+       cursor: default;
+}
+
index bd78e8a961eb9d87be61bc10f3eb43b69f49a42e..fb07fe8013af3e5d6a7e2cb14b55ffe8b53a590b 100644 (file)
@@ -41,7 +41,7 @@ class Custom_Image_Header {
         * @since unknown
         */
        function init() {
         * @since unknown
         */
        function init() {
-               $page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));
+               $page = add_theme_page(__('Custom Header'), __('Custom Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));
 
                add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
                add_action("admin_print_styles-$page", array(&$this, 'css_includes'));
 
                add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
                add_action("admin_print_styles-$page", array(&$this, 'css_includes'));
@@ -79,7 +79,7 @@ class Custom_Image_Header {
                if ( 1 == $step )
                        wp_enqueue_script('farbtastic');
                elseif ( 2 == $step )
                if ( 1 == $step )
                        wp_enqueue_script('farbtastic');
                elseif ( 2 == $step )
-                       wp_enqueue_script('cropper');
+                       wp_enqueue_script('jcrop');
        }
 
        /**
        }
 
        /**
@@ -90,9 +90,10 @@ class Custom_Image_Header {
        function css_includes() {
                $step = $this->step();
 
        function css_includes() {
                $step = $this->step();
 
-               if ( 1 == $step ) {
+               if ( 1 == $step )
                        wp_enqueue_style('farbtastic');
                        wp_enqueue_style('farbtastic');
-               }
+               elseif ( 2 == $step )
+                       wp_enqueue_style('jcrop');
        }
 
        /**
        }
 
        /**
@@ -215,13 +216,13 @@ class Custom_Image_Header {
         */
        function js_2() { ?>
 <script type="text/javascript">
         */
        function js_2() { ?>
 <script type="text/javascript">
-       function onEndCrop( coords, dimensions ) {
-               jQuery( '#x1' ).val(coords.x1);
-               jQuery( '#y1' ).val(coords.y1);
+       function onEndCrop( coords ) {
+               jQuery( '#x1' ).val(coords.x);
+               jQuery( '#y1' ).val(coords.y);
                jQuery( '#x2' ).val(coords.x2);
                jQuery( '#y2' ).val(coords.y2);
                jQuery( '#x2' ).val(coords.x2);
                jQuery( '#y2' ).val(coords.y2);
-               jQuery( '#width' ).val(dimensions.width);
-               jQuery( '#height' ).val(dimensions.height);
+               jQuery( '#width' ).val(coords.w);
+               jQuery( '#height' ).val(coords.h);
        }
 
        // with a supplied ratio
        }
 
        // with a supplied ratio
@@ -231,6 +232,15 @@ class Custom_Image_Header {
                var ratio = xinit / yinit;
                var ximg = jQuery('#upload').width();
                var yimg = jQuery('#upload').height();
                var ratio = xinit / yinit;
                var ximg = jQuery('#upload').width();
                var yimg = jQuery('#upload').height();
+
+               //set up default values
+               jQuery( '#x1' ).val(0);
+               jQuery( '#y1' ).val(0);
+               jQuery( '#x2' ).val(xinit);
+               jQuery( '#y2' ).val(yinit);
+               jQuery( '#width' ).val(xinit);
+               jQuery( '#height' ).val(yinit);
+
                if ( yimg < yinit || ximg < xinit ) {
                        if ( ximg / yimg > ratio ) {
                                yinit = yimg;
                if ( yimg < yinit || ximg < xinit ) {
                        if ( ximg / yimg > ratio ) {
                                yinit = yimg;
@@ -240,14 +250,12 @@ class Custom_Image_Header {
                                yinit = xinit / ratio;
                        }
                }
                                yinit = xinit / ratio;
                        }
                }
-               new Cropper.Img(
-                       'upload',
-                       {
-                               ratioDim: { x: xinit, y: yinit },
-                               displayOnInit: true,
-                               onEndCrop: onEndCrop
-                       }
-               )
+
+               jQuery('#upload').Jcrop({
+                       aspectRatio: ratio,
+                       setSelect: [ 0, 0, xinit, yinit ],
+                       onSelect: onEndCrop
+               });
        });
 </script>
 <?php
        });
 </script>
 <?php
@@ -270,16 +278,16 @@ class Custom_Image_Header {
 <h2><?php _e('Your Header Image'); ?></h2>
 <p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
 
 <h2><?php _e('Your Header Image'); ?></h2>
 <p><?php _e('This is your header image. You can change the text color or upload and crop a new image.'); ?></p>
 
-<div id="headimg" style="background-image: url(<?php clean_url(header_image()) ?>);">
+<div id="headimg" style="background-image: url(<?php esc_url(header_image()) ?>);">
 <h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
 <div id="desc"><?php bloginfo('description');?></div>
 </div>
 <?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
 <form method="post" action="<?php echo admin_url('themes.php?page=custom-header&amp;updated=true') ?>">
 <h1><a onclick="return false;" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" id="name"><?php bloginfo('name'); ?></a></h1>
 <div id="desc"><?php bloginfo('description');?></div>
 </div>
 <?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
 <form method="post" action="<?php echo admin_url('themes.php?page=custom-header&amp;updated=true') ?>">
-<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
-<input type="button" value="<?php _e('Select a Text Color'); ?>" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
+<input type="button" class="button" value="<?php esc_attr_e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
+<input type="button" class="button" value="<?php esc_attr_e('Select a Text Color'); ?>" id="pickcolor" /><input type="button" class="button" value="<?php esc_attr_e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
 <?php wp_nonce_field('custom-header') ?>
 <?php wp_nonce_field('custom-header') ?>
-<input type="hidden" name="textcolor" id="textcolor" value="#<?php attribute_escape(header_textcolor()) ?>" /><input name="submit" type="submit" value="<?php _e('Save Changes'); ?>" /></form>
+<input type="hidden" name="textcolor" id="textcolor" value="#<?php esc_attr(header_textcolor()) ?>" /><input name="submit" type="submit" class="button" value="<?php esc_attr_e('Save Changes'); ?>" /></form>
 <?php } ?>
 
 <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"> </div>
 <?php } ?>
 
 <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"> </div>
@@ -288,12 +296,12 @@ class Custom_Image_Header {
 <h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p>
 <p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>
 
 <h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p>
 <p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p>
 
-<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
+<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo esc_attr(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;">
 <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
 <input type="hidden" name="action" value="save" />
 <?php wp_nonce_field('custom-header') ?>
 <p class="submit">
 <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" />
 <input type="hidden" name="action" value="save" />
 <?php wp_nonce_field('custom-header') ?>
 <p class="submit">
-<input type="submit" value="<?php _e('Upload'); ?>" />
+<input type="submit" value="<?php esc_attr_e('Upload'); ?>" />
 </p>
 </form>
 
 </p>
 </form>
 
@@ -303,9 +311,9 @@ class Custom_Image_Header {
 <div class="wrap">
 <h2><?php _e('Reset Header Image and Color'); ?></h2>
 <p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
 <div class="wrap">
 <h2><?php _e('Reset Header Image and Color'); ?></h2>
 <p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p>
-<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>">
+<form method="post" action="<?php echo esc_attr(add_query_arg('step', 1)) ?>">
 <?php wp_nonce_field('custom-header'); ?>
 <?php wp_nonce_field('custom-header'); ?>
-<input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" />
+<input type="submit" class="button" name="resetheader" value="<?php esc_attr_e('Restore Original Header'); ?>" />
 </form>
 </div>
                <?php endif;
 </form>
 </div>
                <?php endif;
@@ -346,7 +354,7 @@ class Custom_Image_Header {
                        // Add the meta-data
                        wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
 
                        // Add the meta-data
                        wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
 
-                       set_theme_mod('header_image', clean_url($url));
+                       set_theme_mod('header_image', esc_url($url));
                        do_action('wp_create_file_in_uploads', $file, $id); // For replication
                        return $this->finished();
                } elseif ( $width > HEADER_IMAGE_WIDTH ) {
                        do_action('wp_create_file_in_uploads', $file, $id); // For replication
                        return $this->finished();
                } elseif ( $width > HEADER_IMAGE_WIDTH ) {
@@ -364,7 +372,7 @@ class Custom_Image_Header {
 
 <div class="wrap">
 
 
 <div class="wrap">
 
-<form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>">
+<form method="POST" action="<?php echo esc_attr(add_query_arg('step', 3)) ?>">
 
 <p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
 <div id="testWrap" style="position: relative">
 
 <p><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
 <div id="testWrap" style="position: relative">
@@ -378,10 +386,10 @@ class Custom_Image_Header {
 <input type="hidden" name="y2" id="y2" />
 <input type="hidden" name="width" id="width" />
 <input type="hidden" name="height" id="height" />
 <input type="hidden" name="y2" id="y2" />
 <input type="hidden" name="width" id="width" />
 <input type="hidden" name="height" id="height" />
-<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $id; ?>" />
-<input type="hidden" name="oitar" id="oitar" value="<?php echo $oitar; ?>" />
+<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($id); ?>" />
+<input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr($oitar); ?>" />
 <?php wp_nonce_field('custom-header') ?>
 <?php wp_nonce_field('custom-header') ?>
-<input type="submit" value="<?php _e('Crop Header'); ?>" />
+<input type="submit" value="<?php esc_attr_e('Crop Header'); ?>" />
 </p>
 
 </form>
 </p>
 
 </form>
index 42cd3df0246ecf3e38e80bc60e0f01eeedbb16e7..af62b1cb8fbe45352bde2dcf8e477666cfd2755f 100644 (file)
@@ -24,7 +24,7 @@ if ( have_posts() ) { ?>
 
        <tbody id="the-list" class="list:post">
 <?php
 
        <tbody id="the-list" class="list:post">
 <?php
-add_filter('the_title','wp_specialchars');
+add_filter('the_title','esc_html');
 $alt = '';
 $posts_columns = get_column_headers('upload');
 $hidden = get_hidden_columns('upload');
 $alt = '';
 $posts_columns = get_column_headers('upload');
 $hidden = get_hidden_columns('upload');
@@ -62,7 +62,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
                        if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
 ?>
 
                        if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
 ?>
 
-                               <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>">
+                               <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>">
                                        <?php echo $thumb; ?>
                                </a>
 
                                        <?php echo $thumb; ?>
                                </a>
 
@@ -74,7 +74,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
 
        case 'media':
                ?>
 
        case 'media':
                ?>
-               <td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
+               <td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
                <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
                <p>
                <?php
                <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
                <p>
                <?php
@@ -82,8 +82,8 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
                if ( current_user_can('edit_post', $post->ID) )
                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
                if ( current_user_can('delete_post', $post->ID) )
                if ( current_user_can('edit_post', $post->ID) )
                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
                if ( current_user_can('delete_post', $post->ID) )
-                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
-               $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+               $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                $action_count = count($actions);
                $i = 0;
                echo '<div class="row-actions">';
                $action_count = count($actions);
                $i = 0;
                echo '<div class="row-actions">';
@@ -110,7 +110,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
                if ( !empty( $tags ) ) {
                        $out = array();
                        foreach ( $tags as $c )
                if ( !empty( $tags ) ) {
                        $out = array();
                        foreach ( $tags as $c )
-                               $out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
+                               $out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
                        echo join( ', ', $out );
                } else {
                        _e('No Tags');
                        echo join( ', ', $out );
                } else {
                        _e('No Tags');
@@ -131,7 +131,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
                } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A'));
                        $m_time = $post->post_date;
                } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A'));
                        $m_time = $post->post_date;
-                       $time = get_post_time( 'G', true, $post );
+                       $time = get_post_time( 'G', true, $post, false );
                        if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
                                if ( $t_diff < 0 )
                                        $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
                        if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
                                if ( $t_diff < 0 )
                                        $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
@@ -171,7 +171,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
                if ( $left )
                        echo '<strong>';
                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
                if ( $left )
                        echo '<strong>';
-               comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
+               comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
                if ( $left )
                        echo '</strong>';
                ?>
                if ( $left )
                        echo '</strong>';
                ?>
@@ -182,7 +182,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
        case 'actions':
                ?>
                <td <?php echo $attributes ?>>
        case 'actions':
                ?>
                <td <?php echo $attributes ?>>
-               <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
+               <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
                <a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
                </td>
                <?php
                <a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
                </td>
                <?php
@@ -202,7 +202,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
 </table>
 <?php } else { ?>
 
 </table>
 <?php } else { ?>
 
-<p><?php _e('No posts found.') ?></p>
+<p><?php _e('No media attachments found.') ?></p>
 
 <?php
 } // end if ( have_posts() )
 
 <?php
 } // end if ( have_posts() )
index d84f30f981effd61b1494f24b193c459b394fa7a..02289aa5c255334d5adb6e31fbdc1d20562324cb 100644 (file)
@@ -44,33 +44,33 @@ _fill_empty_category($category);
 <div id="ajax-response"></div>
 <form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
 <input type="hidden" name="action" value="editedcat" />
 <div id="ajax-response"></div>
 <form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
 <input type="hidden" name="action" value="editedcat" />
-<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
+<input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
        <table class="form-table">
                <tr class="form-field form-required">
                        <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
        <table class="form-table">
                <tr class="form-field form-required">
                        <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
-                       <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br />
-            <?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td>
+                       <td><input name="cat_name" id="cat_name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /><br />
+            <span class="description"><?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></span></td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
-                       <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
-            <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
+                       <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
+            <span class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></span></td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
                        <td>
                                <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
                        <td>
                                <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
-                <?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?>
+                <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></span>
                        </td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
                        </td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
-                       <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->description); ?></textarea><br />
-            <?php _e('The description is not prominent by default, however some themes may show it.'); ?></td>
+                       <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($category->description); ?></textarea><br />
+            <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
                </tr>
        </table>
                </tr>
        </table>
-<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Category'); ?>" /></p>
+<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Category'); ?>" /></p>
 <?php do_action('edit_category_form', $category); ?>
 </form>
 </div>
 <?php do_action('edit_category_form', $category); ?>
 </form>
 </div>
index 43eecffc87dd9f54097ce1f18f6a7c99f0f428db..da5ce02048a282e223ea74ddc73f7cc61b0bbc2a 100644 (file)
@@ -83,20 +83,22 @@ else
 
 require_once('admin-header.php');
 
 
 require_once('admin-header.php');
 
-$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']);
+$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
 
 
-$comment_status = !empty($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : '';
+$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
+if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam')) )
+       $comment_status = 'all';
 
 
-$comment_type = !empty($_GET['comment_type']) ? attribute_escape($_GET['comment_type']) : '';
+$comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : '';
 
 $search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
 
 $search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
-$search = attribute_escape( $search_dirty ); ?>
+$search = esc_attr( $search_dirty ); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( wp_specialchars( stripslashes( $_GET['s'] ) ), 50 ) ) . '</span>' ); ?>
+       printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( stripslashes( $_GET['s'] ) ), 50 ) ) . '</span>' ); ?>
 </h2>
 
 <?php
 </h2>
 
 <?php
@@ -109,17 +111,17 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
                echo '<div id="moderated" class="updated fade"><p>';
 
                if ( $approved > 0 ) {
                echo '<div id="moderated" class="updated fade"><p>';
 
                if ( $approved > 0 ) {
-                       printf( __ngettext( '%s comment approved', '%s comments approved', $approved ), $approved );
+                       printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
                        echo '<br />';
                }
 
                if ( $deleted > 0 ) {
                        echo '<br />';
                }
 
                if ( $deleted > 0 ) {
-                       printf( __ngettext( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
+                       printf( _n( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
                        echo '<br />';
                }
 
                if ( $spam > 0 ) {
                        echo '<br />';
                }
 
                if ( $spam > 0 ) {
-                       printf( __ngettext( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
+                       printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
                        echo '<br />';
                }
 
                        echo '<br />';
                }
 
@@ -136,34 +138,31 @@ $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments
 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
 //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
 $stati = array(
 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
 //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
 $stati = array(
-               'all' => __ngettext_noop('All', 'All'), // singular not used
-               'moderated' => __ngettext_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'),
-               'approved' => __ngettext_noop('Approved', 'Approved'), // singular not used
-               'spam' => __ngettext_noop('Spam (<span class="spam-count">%s</span>)', 'Spam (<span class="spam-count">%s</span>)')
+               'all' => _n_noop('All', 'All'), // singular not used
+               'moderated' => _n_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'),
+               'approved' => _n_noop('Approved', 'Approved'), // singular not used
+               'spam' => _n_noop('Spam (<span class="spam-count">%s</span>)', 'Spam (<span class="spam-count">%s</span>)')
        );
        );
-$class = ( '' === $comment_status ) ? ' class="current"' : '';
-// $status_links[] = "<li><a href='edit-comments.php'$class>" . __( 'All' ) . '</a>';
 $link = 'edit-comments.php';
 if ( !empty($comment_type) && 'all' != $comment_type )
        $link = add_query_arg( 'comment_type', $comment_type, $link );
 foreach ( $stati as $status => $label ) {
        $class = '';
 
 $link = 'edit-comments.php';
 if ( !empty($comment_type) && 'all' != $comment_type )
        $link = add_query_arg( 'comment_type', $comment_type, $link );
 foreach ( $stati as $status => $label ) {
        $class = '';
 
-       if ( str_replace( 'all', '', $status ) == $comment_status )
+       if ( $status == $comment_status )
                $class = ' class="current"';
        if ( !isset( $num_comments->$status ) )
                $num_comments->$status = 10;
                $class = ' class="current"';
        if ( !isset( $num_comments->$status ) )
                $num_comments->$status = 10;
-       if ( 'all' != $status )
-               $link = add_query_arg( 'comment_status', $status, $link );
+       $link = add_query_arg( 'comment_status', $status, $link );
        if ( $post_id )
                $link = add_query_arg( 'p', absint( $post_id ), $link );
        /*
        // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
        if ( !empty( $_GET['s'] ) )
        if ( $post_id )
                $link = add_query_arg( 'p', absint( $post_id ), $link );
        /*
        // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
        if ( !empty( $_GET['s'] ) )
-               $link = add_query_arg( 's', attribute_escape( stripslashes( $_GET['s'] ) ), $link );
+               $link = add_query_arg( 's', esc_attr( stripslashes( $_GET['s'] ) ), $link );
        */
        $status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
        */
        $status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
-               __ngettext( $label[0], $label[1], $num_comments->$status ),
+               _n( $label[0], $label[1], $num_comments->$status ),
                number_format_i18n( $num_comments->$status )
        ) . '</a>';
 }
                number_format_i18n( $num_comments->$status )
        ) . '</a>';
 }
@@ -176,13 +175,16 @@ unset($status_links);
 </ul>
 
 <p class="search-box">
 </ul>
 
 <p class="search-box">
-       <label class="hidden" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
-       <input type="text" class="search-input" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
+       <label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
+       <input type="text" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Comments' ); ?>" class="button" />
 </p>
 
 <?php
 </p>
 
 <?php
-$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
+$comments_per_page = get_user_option('edit_comments_per_page');
+if ( empty($comments_per_page) )
+       $comments_per_page = 20;
+$comments_per_page = apply_filters('comments_per_page', $comments_per_page, $comment_status);
 
 if ( isset( $_GET['apage'] ) )
        $page = abs( (int) $_GET['apage'] );
 
 if ( isset( $_GET['apage'] ) )
        $page = abs( (int) $_GET['apage'] );
@@ -217,12 +219,12 @@ $page_links = paginate_links( array(
 
 ?>
 
 
 ?>
 
-<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
+<input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
 <?php if ( $post_id ) : ?>
 <?php if ( $post_id ) : ?>
-<input type="hidden" name="p" value="<?php echo intval( $post_id ); ?>" />
+<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
 <?php endif; ?>
 <?php endif; ?>
-<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
-<input type="hidden" name="pagegen_timestamp" value="<?php echo current_time('mysql', 1); ?>" />
+<input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
+<input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" />
 
 <div class="tablenav">
 
 
 <div class="tablenav">
 
@@ -230,18 +232,21 @@ $page_links = paginate_links( array(
 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
        number_format_i18n( $start + 1 ),
        number_format_i18n( min( $page * $comments_per_page, $total ) ),
 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
        number_format_i18n( $start + 1 ),
        number_format_i18n( min( $page * $comments_per_page, $total ) ),
-       number_format_i18n( $total ),
+       '<span class="total-type-count">' . number_format_i18n( $total ) . '</span>',
        $page_links
 ); echo $page_links_text; ?></div>
        $page_links
 ); echo $page_links_text; ?></div>
+<input type="hidden" name="_total" value="<?php echo esc_attr($total); ?>" />
+<input type="hidden" name="_per_page" value="<?php echo esc_attr($comments_per_page); ?>" />
+<input type="hidden" name="_page" value="<?php echo esc_attr($page); ?>" />
 <?php endif; ?>
 
 <div class="alignleft actions">
 <select name="action">
 <option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
 <?php endif; ?>
 
 <div class="alignleft actions">
 <select name="action">
 <option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
-<?php if ( empty($comment_status) || 'approved' == $comment_status ): ?>
+<?php if ( 'all' == $comment_status || 'approved' == $comment_status ): ?>
 <option value="unapprove"><?php _e('Unapprove'); ?></option>
 <?php endif; ?>
 <option value="unapprove"><?php _e('Unapprove'); ?></option>
 <?php endif; ?>
-<?php if ( empty($comment_status) || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
+<?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
 <option value="approve"><?php _e('Approve'); ?></option>
 <?php endif; ?>
 <?php if ( 'spam' != $comment_status ): ?>
 <option value="approve"><?php _e('Approve'); ?></option>
 <?php endif; ?>
 <?php if ( 'spam' != $comment_status ): ?>
@@ -249,10 +254,9 @@ $page_links = paginate_links( array(
 <?php endif; ?>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <?php endif; ?>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" name="doaction" id="doaction" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
+<input type="submit" name="doaction" id="doaction" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
 <?php wp_nonce_field('bulk-comments'); ?>
 
 <?php wp_nonce_field('bulk-comments'); ?>
 
-<?php if ( $comment_status ) echo "<input type='hidden' name='comment_status' value='$comment_status' />\n"; ?>
 <select name="comment_type">
        <option value="all"><?php _e('Show all comment types'); ?></option>
 <?php
 <select name="comment_type">
        <option value="all"><?php _e('Show all comment types'); ?></option>
 <?php
@@ -262,22 +266,22 @@ $page_links = paginate_links( array(
        ) );
 
        foreach ( $comment_types as $type => $label ) {
        ) );
 
        foreach ( $comment_types as $type => $label ) {
-               echo "  <option value='$type'";
+               echo "  <option value='" . esc_attr($type) . "'";
                selected( $comment_type, $type );
                echo ">$label</option>\n";
        }
 ?>
 </select>
                selected( $comment_type, $type );
                echo ">$label</option>\n";
        }
 ?>
 </select>
-<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
+<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
 
 <?php if ( isset($_GET['apage']) ) { ?>
 
 <?php if ( isset($_GET['apage']) ) { ?>
-       <input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
+       <input type="hidden" name="apage" value="<?php echo esc_attr( absint( $_GET['apage'] ) ); ?>" />
 <?php }
 
 if ( 'spam' == $comment_status ) {
 <?php }
 
 if ( 'spam' == $comment_status ) {
-       wp_nonce_field('bulk-spam-delete', '_spam_nonce'); 
+       wp_nonce_field('bulk-spam-delete', '_spam_nonce');
         if ( current_user_can ('moderate_comments')) { ?>
         if ( current_user_can ('moderate_comments')) { ?>
-               <input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
+               <input type="submit" name="delete_all_spam" value="<?php esc_attr_e('Delete All Spam'); ?>" class="button-secondary apply" />
 <?php  }
 } ?>
 <?php do_action('manage_comments_nav', $comment_status); ?>
 <?php  }
 } ?>
 <?php do_action('manage_comments_nav', $comment_status); ?>
@@ -326,10 +330,10 @@ if ( $page_links )
 <div class="alignleft actions">
 <select name="action2">
 <option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
 <div class="alignleft actions">
 <select name="action2">
 <option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
-<?php if ( empty($comment_status) || 'approved' == $comment_status ): ?>
+<?php if ( 'all' == $comment_status || 'approved' == $comment_status ): ?>
 <option value="unapprove"><?php _e('Unapprove'); ?></option>
 <?php endif; ?>
 <option value="unapprove"><?php _e('Unapprove'); ?></option>
 <?php endif; ?>
-<?php if ( empty($comment_status) || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
+<?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
 <option value="approve"><?php _e('Approve'); ?></option>
 <?php endif; ?>
 <?php if ( 'spam' != $comment_status ): ?>
 <option value="approve"><?php _e('Approve'); ?></option>
 <?php endif; ?>
 <?php if ( 'spam' != $comment_status ): ?>
@@ -337,10 +341,10 @@ if ( $page_links )
 <?php endif; ?>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <?php endif; ?>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" name="doaction2" id="doaction2" value="<?php _e('Apply'); ?>" class="button-secondary apply" />
+<input type="submit" name="doaction2" id="doaction2" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
 
 <?php if ( 'spam' == $comment_status ) { ?>
 
 <?php if ( 'spam' == $comment_status ) { ?>
-<input type="submit" name="delete_all_spam2" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
+<input type="submit" name="delete_all_spam2" value="<?php esc_attr_e('Delete All Spam'); ?>" class="button-secondary apply" />
 <?php } ?>
 <?php do_action('manage_comments_nav', $comment_status); ?>
 </div>
 <?php } ?>
 <?php do_action('manage_comments_nav', $comment_status); ?>
 </div>
@@ -351,18 +355,18 @@ if ( $page_links )
 </form>
 
 <form id="get-extra-comments" method="post" action="" class="add:the-extra-comment-list:" style="display: none;">
 </form>
 
 <form id="get-extra-comments" method="post" action="" class="add:the-extra-comment-list:" style="display: none;">
-       <input type="hidden" name="s" value="<?php echo $search; ?>" />
-       <input type="hidden" name="mode" value="<?php echo $mode; ?>" />
-       <input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
+       <input type="hidden" name="s" value="<?php echo esc_attr($search); ?>" />
+       <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
+       <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
        <input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" />
        <input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" />
-       <input type="hidden" name="p" value="<?php echo attribute_escape( $post_id ); ?>" />
-       <input type="hidden" name="comment_type" value="<?php echo attribute_escape( $comment_type ); ?>" />
+       <input type="hidden" name="p" value="<?php echo esc_attr( $post_id ); ?>" />
+       <input type="hidden" name="comment_type" value="<?php echo esc_attr( $comment_type ); ?>" />
        <?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
 </form>
 
 <div id="ajax-response"></div>
 
        <?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
 </form>
 
 <div id="ajax-response"></div>
 
-<?php } elseif ( 'moderated' == $_GET['comment_status'] ) { ?>
+<?php } elseif ( 'moderated' == $comment_status ) { ?>
 <p><?php _e('No comments awaiting moderation&hellip; yet.') ?></p>
 </form>
 
 <p><?php _e('No comments awaiting moderation&hellip; yet.') ?></p>
 </form>
 
@@ -373,21 +377,6 @@ if ( $page_links )
 <?php } ?>
 </div>
 
 <?php } ?>
 </div>
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected comments.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       }
-               });
-       });
-})(jQuery);
-/* ]]> */
-</script>
-
 <?php
 wp_comment_reply('-1', true, 'detail');
 include('admin-footer.php'); ?>
 <?php
 wp_comment_reply('-1', true, 'detail');
 include('admin-footer.php'); ?>
index 904b9831c557531db21582dbb7597e7b04dfd082..a246ea543b9f46f7e822027f1acd650d27975db6 100644 (file)
  * @name $post_ID
  * @var int
  */
  * @name $post_ID
  * @var int
  */
-if ( ! isset( $post_ID ) )
-       $post_ID = 0;
-else
-       $post_ID = (int) $post_ID;
+$post_ID = isset($post_ID) ? (int) $post_ID : 0;
 
 $action = isset($action) ? $action : '';
 if ( isset($_GET['message']) )
        $_GET['message'] = absint( $_GET['message'] );
 
 $action = isset($action) ? $action : '';
 if ( isset($_GET['message']) )
        $_GET['message'] = absint( $_GET['message'] );
-$messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) );
+$messages[1] = sprintf(__('Post updated. <a href="%s">View post</a>'), get_permalink($post_ID));
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[4] = __('Post updated.');
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[4] = __('Post updated.');
@@ -36,15 +33,15 @@ $notices[1] = __( 'There is an autosave of this post that is more recent than th
 if ( 0 == $post_ID ) {
        $form_action = 'post';
        $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
 if ( 0 == $post_ID ) {
        $form_action = 'post';
        $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
-       $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
+       $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='" . esc_attr($temp_ID) . "' />";
        $autosave = false;
 } else {
        $form_action = 'editpost';
        $autosave = false;
 } else {
        $form_action = 'editpost';
-       $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+       $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";
        $autosave = wp_get_post_autosave( $post_ID );
 
        // Detect if there exists an autosave newer than the post and if that autosave is different than the post
        $autosave = wp_get_post_autosave( $post_ID );
 
        // Detect if there exists an autosave newer than the post and if that autosave is different than the post
-       if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
+       if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
                foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
                        if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
                                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
                foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
                        if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
                                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
@@ -75,22 +72,29 @@ function post_submit_meta_box($post) {
 
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
 <div style="display:none;">
 
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
 <div style="display:none;">
-<input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
+<input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />
 </div>
 
 <div id="minor-publishing-actions">
 <div id="save-action">
 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
 </div>
 
 <div id="minor-publishing-actions">
 <div id="save-action">
 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
-<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
+<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" tabindex="4" class="button button-highlighted" />
 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
-<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save as Pending') ); ?>" tabindex="4" class="button button-highlighted" />
+<input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" />
 <?php } ?>
 </div>
 
 <div id="preview-action">
 <?php } ?>
 </div>
 
 <div id="preview-action">
-<?php $preview_link = 'publish' == $post->post_status ? clean_url(get_permalink($post->ID)) : clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>
-
-<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
+<?php
+if ( 'publish' == $post->post_status ) {
+       $preview_link = esc_url(get_permalink($post->ID));
+       $preview_button = __('Preview Changes');
+} else {
+       $preview_link = esc_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID))));
+       $preview_button = __('Preview');
+}
+?>
+<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a>
 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
 </div>
 
 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
 </div>
 
@@ -100,7 +104,7 @@ function post_submit_meta_box($post) {
 <div id="misc-publishing-actions">
 
 <div class="misc-pub-section<?php if ( !$can_publish ) { echo '  misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
 <div id="misc-publishing-actions">
 
 <div class="misc-pub-section<?php if ( !$can_publish ) { echo '  misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
-<b><span id="post-status-display">
+<span id="post-status-display">
 <?php
 switch ( $post->post_status ) {
        case 'private':
 <?php
 switch ( $post->post_status ) {
        case 'private':
@@ -120,12 +124,12 @@ switch ( $post->post_status ) {
                break;
 }
 ?>
                break;
 }
 ?>
-</span></b>
+</span>
 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
 
 <div id="post-status-select" class="hide-if-js">
 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
 
 <div id="post-status-select" class="hide-if-js">
-<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
+<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr($post->post_status); ?>" />
 <select name='post_status' id='post_status' tabindex='4'>
 <?php if ( 'publish' == $post->post_status ) : ?>
 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
 <select name='post_status' id='post_status' tabindex='4'>
 <?php if ( 'publish' == $post->post_status ) : ?>
 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
@@ -145,7 +149,7 @@ switch ( $post->post_status ) {
 </div><?php // /misc-pub-section ?>
 
 <div class="misc-pub-section " id="visibility">
 </div><?php // /misc-pub-section ?>
 
 <div class="misc-pub-section " id="visibility">
-<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php
+<?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
 
 if ( 'private' == $post->post_status ) {
        $post->post_password = '';
 
 if ( 'private' == $post->post_status ) {
        $post->post_password = '';
@@ -162,18 +166,18 @@ if ( 'private' == $post->post_status ) {
        $visibility_trans = __('Public');
 }
 
        $visibility_trans = __('Public');
 }
 
-?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>
+?><?php echo esc_html( $visibility_trans ); ?></span> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>
 
 <div id="post-visibility-select" class="hide-if-js">
 
 <div id="post-visibility-select" class="hide-if-js">
-<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attribute_escape($post->post_password); ?>" />
-<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID), true); ?> />
-<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attribute_escape( $visibility ); ?>" />
+<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
+<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
+<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
 
 
 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
 
 
 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
-<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span>
+<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span>
 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
-<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attribute_escape($post->post_password); ?>" /><br /></span>
+<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" /><br /></span>
 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
 
 <p>
 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
 
 <p>
@@ -187,7 +191,8 @@ if ( 'private' == $post->post_status ) {
 
 
 <?php
 
 
 <?php
-$datef = _c( 'M j, Y @ G:i|Publish box date format');
+// translators: Publish box date formt, see http://php.net/date
+$datef = __( 'M j, Y @ G:i' );
 if ( 0 != $post->ID ) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
                $stamp = __('Scheduled for: <b>%1$s</b>');
 if ( 0 != $post->ID ) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
                $stamp = __('Scheduled for: <b>%1$s</b>');
@@ -205,8 +210,8 @@ if ( 0 != $post->ID ) {
        $stamp = __('Publish <b>immediately</b>');
        $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
 }
        $stamp = __('Publish <b>immediately</b>');
        $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
 }
-?>
-<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
+
+if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
 <div class="misc-pub-section curtime misc-pub-section-last">
        <span id="timestamp">
        <?php printf($stamp, $date); ?></span>
 <div class="misc-pub-section curtime misc-pub-section-last">
        <span id="timestamp">
        <?php printf($stamp, $date); ?></span>
@@ -224,29 +229,31 @@ if ( 0 != $post->ID ) {
 <div id="delete-action">
 <?php
 if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
 <div id="delete-action">
 <?php
 if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
-<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
+<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
 <?php } ?>
 </div>
 
 <div id="publishing-action">
 <?php
 <?php } ?>
 </div>
 
 <div id="publishing-action">
 <?php
-if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
-<?php if ( current_user_can('publish_posts') ) : ?>
-       <?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
-               <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Schedule') ?>" />
-               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
-       <?php else : ?>
-               <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Publish') ?>" />
-               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
-       <?php endif; ?>
-<?php else : ?>
-       <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Submit for Review') ?>" />
-       <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
-<?php endif; ?>
-<?php } else { ?>
-       <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Update Post') ?>" />
-       <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Update Post') ?>" />
-<?php } ?>
+if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
+       if ( current_user_can('publish_posts') ) :
+               if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
+               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
+               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" />
+<?php  else : ?>
+               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
+               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Publish') ?>" />
+<?php  endif;
+       else : ?>
+               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
+               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Submit for Review') ?>" />
+<?php
+       endif;
+} else { ?>
+               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update Post') ?>" />
+               <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update Post') ?>" />
+<?php
+} ?>
 </div>
 <div class="clear"></div>
 </div>
 </div>
 <div class="clear"></div>
 </div>
@@ -263,14 +270,38 @@ add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side',
  *
  * @param object $post
  */
  *
  * @param object $post
  */
-function post_tags_meta_box($post) {
+function post_tags_meta_box($post, $box) {
+       $tax_name = esc_attr(substr($box['id'], 8));
+       $taxonomy = get_taxonomy($tax_name);
+       $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');
 ?>
 ?>
-<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
-<div id="tagchecklist"></div>
-<p id="tagcloud-link" class="hide-if-no-js"><a href='#'><?php _e( 'Choose from the most popular tags' ); ?></a></p>
+<div class="tagsdiv" id="<?php echo $tax_name; ?>">
+       <div class="jaxtag">
+       <div class="nojs-tags hide-if-js">
+       <p><?php _e('Add or remove tags'); ?></p>
+       <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
+
+       <span class="ajaxtag hide-if-no-js">
+               <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
+               <input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php esc_attr_e('Add new tag'); ?>" />
+               <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
+       </span></div>
+       <p class="howto"><?php echo $helps; ?></p>
+       <div class="tagchecklist"></div>
+</div>
+<p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>
 <?php
 }
 <?php
 }
-add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core');
+
+// all tag-style post taxonomies
+foreach ( get_object_taxonomies('post') as $tax_name ) {
+       if ( !is_taxonomy_hierarchical($tax_name) ) {
+               $taxonomy = get_taxonomy($tax_name);
+               $label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
+
+               add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
+       }
+}
 
 /**
  * Display post categories form fields.
 
 /**
  * Display post categories form fields.
@@ -282,19 +313,19 @@ add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core'
 function post_categories_meta_box($post) {
 ?>
 <ul id="category-tabs">
 function post_categories_meta_box($post) {
 ?>
 <ul id="category-tabs">
-       <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
+       <li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
        <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
 </ul>
 
        <li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
 </ul>
 
-<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
+<div id="categories-pop" class="tabs-panel" style="display: none;">
        <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
        <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
-               <?php $popular_ids = wp_popular_terms_checklist('category'); ?>
+<?php $popular_ids = wp_popular_terms_checklist('category'); ?>
        </ul>
 </div>
 
        </ul>
 </div>
 
-<div id="categories-all" class="ui-tabs-panel">
+<div id="categories-all" class="tabs-panel">
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-               <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
+<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
        </ul>
 </div>
 
        </ul>
 </div>
 
@@ -302,12 +333,11 @@ function post_categories_meta_box($post) {
 <div id="category-adder" class="wp-hidden-children">
        <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
        <p id="category-add" class="wp-hidden-child">
 <div id="category-adder" class="wp-hidden-children">
        <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
        <p id="category-add" class="wp-hidden-child">
-               <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
-               <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
-               <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
-               <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
-               <span id="category-ajax-response"></span>
-       </p>
+       <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
+       <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
+       <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
+<?php  wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
+       <span id="category-ajax-response"></span></p>
 </div>
 <?php
 endif;
 </div>
 <?php
 endif;
@@ -324,11 +354,9 @@ add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post'
  */
 function post_password_meta_box($post) {
 ?>
  */
 function post_password_meta_box($post) {
 ?>
-<p>
-       <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label>
-</p>
+<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p>
 <h4><?php _e( 'Post Password' ); ?></h4>
 <h4><?php _e( 'Post Password' ); ?></h4>
-<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
+<p><label class="screen-reader-text" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
 <?php
 }
 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
 <?php
 }
@@ -343,8 +371,8 @@ function post_password_meta_box($post) {
  */
 function post_excerpt_meta_box($post) {
 ?>
  */
 function post_excerpt_meta_box($post) {
 ?>
-<label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
-<p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p>
+<label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
+<p><?php _e('Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="http://codex.wordpress.org/Excerpt" target="_blank">Learn more about manual excerpts.</a>'); ?></p>
 <?php
 }
 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
 <?php
 }
 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
@@ -357,12 +385,12 @@ add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'nor
  * @param object $post
  */
 function post_trackback_meta_box($post) {
  * @param object $post
  */
 function post_trackback_meta_box($post) {
-       $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
+       $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" tabindex="7" value="'. esc_attr( str_replace("\n", ' ', $post->to_ping) ) .'" />';
        if ('' != $post->pinged) {
                $pings = '<p>'. __('Already pinged:') . '</p><ul>';
                $already_pinged = explode("\n", trim($post->pinged));
                foreach ($already_pinged as $pinged_url) {
        if ('' != $post->pinged) {
                $pings = '<p>'. __('Already pinged:') . '</p><ul>';
                $already_pinged = explode("\n", trim($post->pinged));
                foreach ($already_pinged as $pinged_url) {
-                       $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
+                       $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";
                }
                $pings .= '</ul>';
        }
                }
                $pings .= '</ul>';
        }
@@ -390,8 +418,7 @@ function post_custom_meta_box($post) {
 <?php
 $metadata = has_meta($post->ID);
 list_meta($metadata);
 <?php
 $metadata = has_meta($post->ID);
 list_meta($metadata);
-meta_form();
-?>
+meta_form(); ?>
 </div>
 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
 <?php
 </div>
 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
 <?php
@@ -408,41 +435,53 @@ do_action('dbx_post_advanced');
  * @param object $post
  */
 function post_comment_status_meta_box($post) {
  * @param object $post
  */
 function post_comment_status_meta_box($post) {
-       global $wpdb, $post_ID;
 ?>
 <input name="advanced_view" type="hidden" value="1" />
 <p class="meta-options">
        <label for="comment_status" class="selectit"> <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments on this post') ?></label><br />
 ?>
 <input name="advanced_view" type="hidden" value="1" />
 <p class="meta-options">
        <label for="comment_status" class="selectit"> <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments on this post') ?></label><br />
-       <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a> on this post') ?></label>
-</p>
+       <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a> on this post') ?></label></p>
 <?php
 <?php
+}
+add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
+
+/**
+ * Display comments for post.
+ *
+ * @since 2.8.0
+ *
+ * @param object $post
+ */
+function post_comment_meta_box($post) {
+       global $wpdb, $post_ID;
+
        $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));
 
        $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));
 
-       if ( !$post_ID || $post_ID < 0 || 1 > $total )
+       if ( 1 > $total ) {
+               echo '<p>' . __('No comments yet.') . '</p>';
                return;
                return;
+       }
 
 
-wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
+       wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
 ?>
 
 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
 ?>
 
 <table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
-<thead>
-       <tr>
+<thead><tr>
     <th scope="col" class="column-author"><?php _e('Author') ?></th>
     <th scope="col" class="column-author"><?php _e('Author') ?></th>
-    <th scope="col" class="column-comment"><?php echo _c('Comment|noun') ?></th>
-  </tr>
-</thead>
-<tbody id="the-comment-list" class="list:comment">
-</tbody>
+    <th scope="col" class="column-comment">
+<?php /* translators: field name in comment form */ echo _x('Comment', 'noun'); ?></th>
+</tr></thead>
+<tbody id="the-comment-list" class="list:comment"></tbody>
 </table>
 </table>
-<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
+<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /></p>
 <?php
        $hidden = get_hidden_meta_boxes('post');
 <?php
        $hidden = get_hidden_meta_boxes('post');
-       if ( ! in_array('commentstatusdiv', $hidden) ) { ?>
-               <script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script>
+       if ( ! in_array('commentsdiv', $hidden) ) { ?>
+               <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
 <?php
        }
 }
 <?php
        }
 }
-add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
+if ( 'publish' == $post->post_status || 'private' == $post->post_status )
+       add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core');
 
 /**
  * Display post slug form fields.
 
 /**
  * Display post slug form fields.
@@ -453,7 +492,7 @@ add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box
  */
 function post_slug_meta_box($post) {
 ?>
  */
 function post_slug_meta_box($post) {
 ?>
-<label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
+<label class="screen-reader-text" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $post->post_name ); ?>" />
 <?php
 }
 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
 <?php
 }
 if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
@@ -476,7 +515,7 @@ function post_author_meta_box($post) {
        if ( $post->post_author && !in_array($post->post_author, $authors) )
                $authors[] = $post->post_author;
 ?>
        if ( $post->post_author && !in_array($post->post_author, $authors) )
                $authors[] = $post->post_author;
 ?>
-<label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<label class="screen-reader-text" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
 <?php
 }
 add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
 <?php
 }
 add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
@@ -510,7 +549,7 @@ require_once('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 <?php if ( $notice ) : ?>
 <div id="notice" class="error"><p><?php echo $notice ?></p></div>
 <?php endif; ?>
 <?php if ( $notice ) : ?>
 <div id="notice" class="error"><p><?php echo $notice ?></p></div>
 <?php endif; ?>
@@ -528,18 +567,19 @@ else
 ?>
 
 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
 ?>
 
 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
-<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
-<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
-<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
-<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
-<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
-<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
-
-<?php echo $form_extra ?>
+<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" />
+<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
+<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
+<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" />
+<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
+<?php
+if ( 'draft' != $post->post_status )
+       wp_original_referer_field(true, 'previous');
 
 
-<div id="poststuff" class="metabox-holder">
+echo $form_extra ?>
 
 
+<div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
 <div id="side-info-column" class="inner-sidebar">
 
 <?php do_action('submitpost_box'); ?>
 <div id="side-info-column" class="inner-sidebar">
 
 <?php do_action('submitpost_box'); ?>
@@ -547,21 +587,25 @@ else
 <?php $side_meta_boxes = do_meta_boxes('post', 'side', $post); ?>
 </div>
 
 <?php $side_meta_boxes = do_meta_boxes('post', 'side', $post); ?>
 </div>
 
-<div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
-<div id="post-body-content" class="has-sidebar-content">
+<div id="post-body">
+<div id="post-body-content">
 <div id="titlediv">
 <div id="titlewrap">
 <div id="titlediv">
 <div id="titlewrap">
-       <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" autocomplete="off" />
+       <label class="screen-reader-text" for="title"><?php _e('Title') ?></label>
+       <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
 </div>
 <div class="inside">
 </div>
 <div class="inside">
-<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
-<?php if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) { ?>
+<?php
+$sample_permalink_html = get_sample_permalink_html($post->ID);
+if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) ) { ?>
        <div id="edit-slug-box">
        <div id="edit-slug-box">
-<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
-       echo $sample_permalink_html;
+<?php
+       if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
+               echo $sample_permalink_html;
 endif; ?>
        </div>
 endif; ?>
        </div>
-<?php } ?>
+<?php
+} ?>
 </div>
 </div>
 
 </div>
 </div>
 
@@ -569,32 +613,30 @@ endif; ?>
 
 <?php the_editor($post->post_content); ?>
 
 
 <?php the_editor($post->post_content); ?>
 
-<div id="post-status-info">
-       <span id="wp-word-count" class="alignleft"></span>
-       <span class="alignright">
+<table id="post-status-info" cellspacing="0"><tbody><tr>
+       <td id="wp-word-count"></td>
+       <td class="autosave-info">
        <span id="autosave">&nbsp;</span>
 <?php
        if ( $post_ID ) {
                echo '<span id="last-edit">';
                if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
                        $last_user = get_userdata($last_id);
        <span id="autosave">&nbsp;</span>
 <?php
        if ( $post_ID ) {
                echo '<span id="last-edit">';
                if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
                        $last_user = get_userdata($last_id);
-                       printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
+                       printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
                } else {
                        printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
                }
                echo '</span>';
                } else {
                        printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
                }
                echo '</span>';
-       }
-?>
-       </span>
-       <br class="clear" />
-</div>
-
+       } ?>
+       </td>
+</tr></tbody></table>
 
 
-<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
-<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
-<?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
-<?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
-<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
+<?php
+wp_nonce_field( 'autosave', 'autosavenonce', false );
+wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+wp_nonce_field( 'getpermalink', 'getpermalinknonce', false );
+wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
+wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
 </div>
 
 <?php
 </div>
 
 <?php
@@ -605,9 +647,7 @@ do_action('edit_form_advanced');
 
 do_meta_boxes('post', 'advanced', $post);
 
 
 do_meta_boxes('post', 'advanced', $post);
 
-do_action('dbx_post_sidebar');
-
-?>
+do_action('dbx_post_sidebar'); ?>
 
 </div>
 </div>
 
 </div>
 </div>
index 531db65b08a6afd5d22251a4b16411b0bb857fe8..022c39011da2a1304ee5d9a5d06dd8e08a9bbcae 100644 (file)
@@ -12,7 +12,7 @@
 $submitbutton_text = __('Edit Comment');
 $toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
 $form_action = 'editedcomment';
 $submitbutton_text = __('Edit Comment');
 $toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
 $form_action = 'editedcomment';
-$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='" . $comment->comment_post_ID;
+$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . esc_attr($comment->comment_ID) . "' />\n<input type='hidden' name='comment_post_ID' value='" . esc_attr($comment->comment_post_ID);
 ?>
 
 <form name="post" action="comment.php" method="post" id="post">
 ?>
 
 <form name="post" action="comment.php" method="post" id="post">
@@ -21,13 +21,13 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment-
 <?php screen_icon(); ?>
 <h2><?php _e('Edit Comment'); ?></h2>
 
 <?php screen_icon(); ?>
 <h2><?php _e('Edit Comment'); ?></h2>
 
-<div id="poststuff" class="metabox-holder">
+<div id="poststuff" class="metabox-holder has-right-sidebar">
 <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
 <input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
 <?php
 
 <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
 <input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
 <?php
 
-$email = attribute_escape( $comment->comment_author_email );
-$url = attribute_escape( $comment->comment_author_url );
+$email = esc_attr( $comment->comment_author_email );
+$url = esc_attr( $comment->comment_author_url );
 // add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core');
 ?>
 
 // add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core');
 ?>
 
@@ -48,14 +48,15 @@ $url = attribute_escape( $comment->comment_author_url );
 <div id="misc-publishing-actions">
 
 <div class="misc-pub-section" id="comment-status-radio">
 <div id="misc-publishing-actions">
 
 <div class="misc-pub-section" id="comment-status-radio">
-<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php echo _c('Approved|adjective') ?></label><br />
-<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php echo _c('Pending|adjective') ?></label><br />
-<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php echo _c('Spam|adjective'); ?></label>
+<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ echo _x('Approved', 'adjective') ?></label><br />
+<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ echo _x('Pending', 'adjective') ?></label><br />
+<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ echo _x('Spam', 'adjective'); ?></label>
 </div>
 
 <div class="misc-pub-section curtime misc-pub-section-last">
 <?php
 </div>
 
 <div class="misc-pub-section curtime misc-pub-section-last">
 <?php
-$datef = _c( 'M j, Y @ G:i|Publish box date format');
+// translators: Publish box date formt, see http://php.net/date
+$datef = __( 'M j, Y @ G:i' );
 $stamp = __('Submitted on: <b>%1$s</b>');
 $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 ?>
 $stamp = __('Submitted on: <b>%1$s</b>');
 $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 ?>
@@ -68,10 +69,10 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 
 <div id="major-publishing-actions">
 <div id="delete-action">
 
 <div id="major-publishing-actions">
 <div id="delete-action">
-<a class='submitdelete deletion' href='<?php echo wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete'); ?></a>
+<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . esc_js(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ){return true;}return false;\">" . __('Delete') . "</a>\n"; ?>
 </div>
 <div id="publishing-action">
 </div>
 <div id="publishing-action">
-<input type="submit" name="save" value="<?php _e('Update Comment'); ?>" tabindex="4" class="button-primary" />
+<input type="submit" name="save" value="<?php esc_attr_e('Update Comment'); ?>" tabindex="4" class="button-primary" />
 </div>
 <div class="clear"></div>
 </div>
 </div>
 <div class="clear"></div>
 </div>
@@ -80,17 +81,16 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 </div>
 </div>
 
 </div>
 </div>
 
-<div id="post-body" class="has-sidebar">
-<div id="post-body-content" class="has-sidebar-content">
-
+<div id="post-body">
+<div id="post-body-content">
 <div id="namediv" class="stuffbox">
 <h3><label for="name"><?php _e( 'Author' ) ?></label></h3>
 <div class="inside">
 <div id="namediv" class="stuffbox">
 <h3><label for="name"><?php _e( 'Author' ) ?></label></h3>
 <div class="inside">
-<table class="form-table">
+<table class="form-table editcomment">
 <tbody>
 <tr valign="top">
        <td class="first"><?php _e( 'Name:' ); ?></td>
 <tbody>
 <tr valign="top">
        <td class="first"><?php _e( 'Name:' ); ?></td>
-       <td><input type="text" name="newcomment_author" size="30" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" /></td>
+       <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" tabindex="1" id="name" /></td>
 </tr>
 <tr valign="top">
        <td class="first">
 </tr>
 <tr valign="top">
        <td class="first">
@@ -101,7 +101,7 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
                        _e( 'E-mail:' );
                }
 ?></td>
                        _e( 'E-mail:' );
                }
 ?></td>
-       <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $email; ?>" tabindex="2" id="email" /></td>
+       <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo esc_attr($email); ?>" tabindex="2" id="email" /></td>
 </tr>
 <tr valign="top">
        <td class="first">
 </tr>
 <tr valign="top">
        <td class="first">
@@ -113,7 +113,7 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
                } else {
                        _e( 'URL:' );
                } ?></td>
                } else {
                        _e( 'URL:' );
                } ?></td>
-       <td><input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" value="<?php echo $url; ?>" tabindex="3" /></td>
+       <td><input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($url); ?>" tabindex="3" /></td>
 </tr>
 </tbody>
 </table>
 </tr>
 </tbody>
 </table>
@@ -128,9 +128,9 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 
 <?php do_meta_boxes('comment', 'normal', $comment); ?>
 
 
 <?php do_meta_boxes('comment', 'normal', $comment); ?>
 
-<input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
-<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
+<input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" />
+<input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
 <?php wp_original_referer_field(true, 'previous'); ?>
 <input type="hidden" name="noredir" value="1" />
 
 <?php wp_original_referer_field(true, 'previous'); ?>
 <input type="hidden" name="noredir" value="1" />
 
index 3636635cac0ecb8260ba9b69c5be6d271f91c16a..691f326697dd06dca856ab23794cced2c6915c08 100644 (file)
@@ -61,9 +61,9 @@ $messages[6] = __('Categories deleted.'); ?>
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_GET['s']) ) ); ?>
 </h2>
 
 <?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
 </h2>
 
 <?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
@@ -73,9 +73,9 @@ endif; ?>
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
-       <label class="hidden" for="link-category-search-input"><?php _e( 'Search Categories' ); ?>:</label>
-       <input type="text" class="search-input" id="link-category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
+       <label class="screen-reader-text" for="link-category-search-input"><?php _e( 'Search Categories' ); ?>:</label>
+       <input type="text" id="link-category-search-input" name="s" value="<?php _admin_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Categories' ); ?>" class="button" />
 </p>
 </form>
 <br class="clear" />
 </p>
 </form>
 <br class="clear" />
@@ -112,7 +112,7 @@ if ( $page_links )
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-link-categories'); ?>
 </div>
 
 <?php wp_nonce_field('bulk-link-categories'); ?>
 </div>
 
@@ -166,7 +166,7 @@ if ( $page_links )
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
 <br class="clear" />
 </div>
 
 <br class="clear" />
@@ -189,19 +189,19 @@ if ( $page_links )
        $category = (object) array(); $category->parent = 0; do_action('add_link_category_form_pre', $category); ?>
 
 <div class="form-wrap">
        $category = (object) array(); $category->parent = 0; do_action('add_link_category_form_pre', $category); ?>
 
 <div class="form-wrap">
-<h3><?php _e('Add Category'); ?></h3>
+<h3><?php _e('Add Link Category'); ?></h3>
 <div id="ajax-response"></div>
 <form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">
 <input type="hidden" name="action" value="addcat" />
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-link-category'); ?>
 
 <div class="form-field form-required">
 <div id="ajax-response"></div>
 <form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">
 <input type="hidden" name="action" value="addcat" />
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-link-category'); ?>
 
 <div class="form-field form-required">
-       <label for="name"><?php _e('Category name') ?></label>
+       <label for="name"><?php _e('Link Category name') ?></label>
        <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
 </div>
 
 <div class="form-field">
        <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
 </div>
 
 <div class="form-field">
-       <label for="slug"><?php _e('Category slug') ?></label>
+       <label for="slug"><?php _e('Link Category slug') ?></label>
        <input name="slug" id="slug" type="text" value="" size="40" />
        <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
 </div>
        <input name="slug" id="slug" type="text" value="" size="40" />
        <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
 </div>
@@ -211,7 +211,7 @@ if ( $page_links )
        <textarea name="description" id="description" rows="5" cols="40"></textarea>
 </div>
 
        <textarea name="description" id="description" rows="5" cols="40"></textarea>
 </div>
 
-<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Category'); ?>" /></p>
+<p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Category'); ?>" /></p>
 <?php do_action('edit_link_category_form', $category); ?>
 </form>
 </div>
 <?php do_action('edit_link_category_form', $category); ?>
 </form>
 </div>
@@ -224,20 +224,5 @@ if ( $page_links )
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected link categories.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       }
-               });
-       });
-})(jQuery);
-/* ]]> */
-</script>
-
 <?php inline_edit_term_row('edit-link-categories'); ?>
 <?php include('admin-footer.php'); ?>
 <?php inline_edit_term_row('edit-link-categories'); ?>
 <?php include('admin-footer.php'); ?>
index 3a420c3c72f3066f3113485e13abcd3c31abf5e1..be52d1c01c65614bf0a9260384604a343ac21d93 100644 (file)
@@ -57,17 +57,17 @@ _fill_empty_link_category($category);
 <?php echo $heading ?>
 <div id="ajax-response"></div>
 <?php echo $form ?>
 <?php echo $heading ?>
 <div id="ajax-response"></div>
 <?php echo $form ?>
-<input type="hidden" name="action" value="<?php echo $action ?>" />
-<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
+<input type="hidden" name="action" value="<?php echo esc_attr($action) ?>" />
+<input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
        <table class="form-table">
                <tr class="form-field form-required">
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
        <table class="form-table">
                <tr class="form-field form-required">
-                       <th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th>
-                       <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" aria-required="true" /></td>
+                       <th scope="row" valign="top"><label for="name"><?php _e('Link Category name') ?></label></th>
+                       <td><input name="name" id="name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
                </tr>
                <tr class="form-field">
                </tr>
                <tr class="form-field">
-                       <th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th>
-                       <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
+                       <th scope="row" valign="top"><label for="slug"><?php _e('Link Category slug') ?></label></th>
+                       <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
             <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
                </tr>
                <tr class="form-field">
             <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
                </tr>
                <tr class="form-field">
@@ -75,7 +75,7 @@ _fill_empty_link_category($category);
                        <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
                </tr>
        </table>
                        <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
                </tr>
        </table>
-<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo $submit_text ?>" /></p>
+<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr($submit_text) ?>" /></p>
 <?php do_action('edit_link_category_form', $category); ?>
 </form>
 </div>
 <?php do_action('edit_link_category_form', $category); ?>
 </form>
 </div>
index 189a8b7e436366ce584a328e48213cd59597b263..32b06a87f61fe5695cd38579a3cae1ddab3dc887 100644 (file)
@@ -60,7 +60,7 @@ function link_submit_meta_box($link) {
 
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
 <div style="display:none;">
 
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
 <div style="display:none;">
-<input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
+<input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />
 </div>
 
 <div id="minor-publishing-actions">
 </div>
 
 <div id="minor-publishing-actions">
@@ -85,15 +85,15 @@ function link_submit_meta_box($link) {
 <div id="delete-action">
 <?php
 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
 <div id="delete-action">
 <?php
 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
-       <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
+       <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
 <?php } ?>
 </div>
 
 <div id="publishing-action">
 <?php if ( !empty($link->link_id) ) { ?>
 <?php } ?>
 </div>
 
 <div id="publishing-action">
 <?php if ( !empty($link->link_id) ) { ?>
-       <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Update Link') ?>" />
+       <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" />
 <?php } else { ?>
 <?php } else { ?>
-       <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Add Link') ?>" />
+       <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" />
 <?php } ?>
 </div>
 <div class="clear"></div>
 <?php } ?>
 </div>
 <div class="clear"></div>
@@ -113,23 +113,12 @@ add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side'
  * @param object $link
  */
 function link_categories_meta_box($link) { ?>
  * @param object $link
  */
 function link_categories_meta_box($link) { ?>
-<div id="category-adder" class="wp-hidden-children">
-       <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
-       <p id="link-category-add" class="wp-hidden-child">
-               <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
-               <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
-               <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
-               <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
-               <span id="category-ajax-response"></span>
-       </p>
-</div>
-
 <ul id="category-tabs">
 <ul id="category-tabs">
-       <li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
+       <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
        <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
 </ul>
 
        <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
 </ul>
 
-<div id="categories-all" class="ui-tabs-panel">
+<div id="categories-all" class="tabs-panel">
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
                <?php
                if ( isset($link->link_id) )
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
                <?php
                if ( isset($link->link_id) )
@@ -140,11 +129,22 @@ function link_categories_meta_box($link) { ?>
        </ul>
 </div>
 
        </ul>
 </div>
 
-<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
+<div id="categories-pop" class="tabs-panel" style="display: none;">
        <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
                <?php wp_popular_terms_checklist('link_category'); ?>
        </ul>
 </div>
        <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
                <?php wp_popular_terms_checklist('link_category'); ?>
        </ul>
 </div>
+
+<div id="category-adder" class="wp-hidden-children">
+       <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
+       <p id="link-category-add" class="wp-hidden-child">
+               <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
+               <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
+               <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" />
+               <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
+               <span id="category-ajax-response"></span>
+       </p>
+</div>
 <?php
 }
 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
 <?php
 }
 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
@@ -157,18 +157,18 @@ add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'l
  * @param object $link
  */
 function link_target_meta_box($link) { ?>
  * @param object $link
  */
 function link_target_meta_box($link) { ?>
-<fieldset><legend class="hidden"><?php _e('Target') ?></legend>
-<label for="link_target_blank" class="selectit">
+<fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
+<p><label for="link_target_blank" class="selectit">
 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
-<code>_blank</code></label><br />
-<label for="link_target_top" class="selectit">
+<?php _e('<code>_blank</code> - new window or tab.'); ?></label></p>
+<p><label for="link_target_top" class="selectit">
 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
-<code>_top</code></label><br />
-<label for="link_target_none" class="selectit">
+<?php _e('<code>_top</code> - current window or tab, with no frames.'); ?></label></p>
+<p><label for="link_target_none" class="selectit">
 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
-<?php _e('none') ?></label>
+<?php _e('<code>_none</code> - same window or tab.'); ?></label></p>
 </fieldset>
 </fieldset>
-<p><?php _e('Choose the frame your link targets. Essentially this means if you choose <code>_blank</code> your link will open in a new window.'); ?></p>
+<p><?php _e('Choose the target frame for your link.'); ?></p>
 <?php
 }
 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core');
 <?php
 }
 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core');
@@ -184,104 +184,104 @@ function link_xfn_meta_box($link) {
 ?>
 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
        <tr>
 ?>
 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
        <tr>
-               <th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
-               <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? $link->link_rel : ''); ?>" /></td>
+               <th style="width: 20%;" scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
+               <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>
        </tr>
        <tr>
                <td colspan="2">
                        <table cellpadding="3" cellspacing="5" class="form-table">
                                <tr>
        </tr>
        <tr>
                <td colspan="2">
                        <table cellpadding="3" cellspacing="5" class="form-table">
                                <tr>
-                                       <th scope="row"> <?php _e('identity') ?> </th>
-                                       <td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
+                                       <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </th>
+                                       <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </span></legend>
                                                <label for="me">
                                                <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
                                                <?php _e('another web address of mine') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
                                                <label for="me">
                                                <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
                                                <?php _e('another web address of mine') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
-                                       <th scope="row"> <?php _e('friendship') ?> </th>
-                                       <td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
+                                       <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </th>
+                                       <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </span></legend>
                                                <label for="contact">
                                                <label for="contact">
-                                               <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
+                                               <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>
                                                <label for="acquaintance">
                                                <label for="acquaintance">
-                                               <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label>
+                                               <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>
                                                <label for="friend">
                                                <label for="friend">
-                                               <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
+                                               <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>
                                                <label for="friendship">
                                                <label for="friendship">
-                                               <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
+                                               <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
                                        </fieldset></td>
                                </tr>
                                <tr>
-                                       <th scope="row"> <?php _e('physical') ?> </th>
-                                       <td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
+                                       <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>
+                                       <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </span></legend>
                                                <label for="met">
                                                <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
                                                <label for="met">
                                                <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
-                                               <?php _e('met') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
                                        </fieldset></td>
                                </tr>
                                <tr>
-                                       <th scope="row"> <?php _e('professional') ?> </th>
-                                       <td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
+                                       <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>
+                                       <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </span></legend>
                                                <label for="co-worker">
                                                <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
                                                <label for="co-worker">
                                                <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
-                                               <?php _e('co-worker') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?></label>
                                                <label for="colleague">
                                                <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
                                                <label for="colleague">
                                                <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
-                                               <?php _e('colleague') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
                                        </fieldset></td>
                                </tr>
                                <tr>
-                                       <th scope="row"> <?php _e('geographical') ?> </th>
-                                       <td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </legend>
+                                       <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </th>
+                                       <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
                                                <label for="co-resident">
                                                <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
                                                <label for="co-resident">
                                                <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
-                                               <?php _e('co-resident') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?></label>
                                                <label for="neighbor">
                                                <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
                                                <label for="neighbor">
                                                <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
-                                               <?php _e('neighbor') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?></label>
                                                <label for="geographical">
                                                <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
                                                <label for="geographical">
                                                <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
-                                               <?php _e('none') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
                                        </fieldset></td>
                                </tr>
                                <tr>
-                                       <th scope="row"> <?php _e('family') ?> </th>
-                                       <td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
+                                       <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </th>
+                                       <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
                                                <label for="child">
                                                <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
                                                <label for="child">
                                                <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
-                                               <?php _e('child') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?></label>
                                                <label for="kin">
                                                <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
                                                <label for="kin">
                                                <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
-                                               <?php _e('kin') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?></label>
                                                <label for="parent">
                                                <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
                                                <label for="parent">
                                                <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
-                                               <?php _e('parent') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?></label>
                                                <label for="sibling">
                                                <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
                                                <label for="sibling">
                                                <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
-                                               <?php _e('sibling') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?></label>
                                                <label for="spouse">
                                                <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
                                                <label for="spouse">
                                                <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
-                                               <?php _e('spouse') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?></label>
                                                <label for="family">
                                                <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
                                                <label for="family">
                                                <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
-                                               <?php _e('none') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>
                                        </fieldset></td>
                                </tr>
                                <tr>
                                        </fieldset></td>
                                </tr>
                                <tr>
-                                       <th scope="row"> <?php _e('romantic') ?> </th>
-                                       <td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
+                                       <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </th>
+                                       <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>
                                                <label for="muse">
                                                <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
                                                <label for="muse">
                                                <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
-                                               <?php _e('muse') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?></label>
                                                <label for="crush">
                                                <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
                                                <label for="crush">
                                                <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
-                                               <?php _e('crush') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?></label>
                                                <label for="date">
                                                <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
                                                <label for="date">
                                                <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
-                                               <?php _e('date') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?></label>
                                                <label for="romantic">
                                                <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
                                                <label for="romantic">
                                                <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
-                                               <?php _e('sweetheart') ?></label>
+                                               <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?></label>
                                        </fieldset></td>
                                </tr>
                        </table>
                                        </fieldset></td>
                                </tr>
                        </table>
@@ -305,11 +305,11 @@ function link_advanced_meta_box($link) {
 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
-               <td><input type="text" name="link_image" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? $link->link_image : ''); ?>" style="width: 95%" /></td>
+               <td><input type="text" name="link_image" class="code" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" style="width: 95%" /></td>
        </tr>
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
        </tr>
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
-               <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo  ( isset( $link->link_rss ) ? $link->link_rss : ''); ?>" size="50" style="width: 95%" /></td>
+               <td><input name="link_rss" class="code" type="text" id="rss_uri" value="<?php echo  ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" size="50" style="width: 95%" /></td>
        </tr>
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
        </tr>
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
@@ -320,7 +320,7 @@ function link_advanced_meta_box($link) {
                <td><select name="link_rating" id="link_rating" size="1">
                <?php
                        for ($r = 0; $r < 10; $r++) {
                <td><select name="link_rating" id="link_rating" size="1">
                <?php
                        for ($r = 0; $r < 10; $r++) {
-                               echo('            <option value="'.$r.'" ');
+                               echo('            <option value="'. esc_attr($r) .'" ');
                                if ( isset($link->link_rating) && $link->link_rating == $r)
                                        echo 'selected="selected"';
                                echo('>'.$r.'</option>');
                                if ( isset($link->link_rating) && $link->link_rating == $r)
                                        echo 'selected="selected"';
                                echo('>'.$r.'</option>');
@@ -340,11 +340,9 @@ do_action('do_meta_boxes', 'link', 'side', $link);
 require_once ('admin-header.php');
 
 ?>
 require_once ('admin-header.php');
 
 ?>
-
-
 <div class="wrap">
 <?php screen_icon(); ?>
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <?php if ( isset( $_GET['added'] ) ) : ?>
 <div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
 
 <?php if ( isset( $_GET['added'] ) ) : ?>
 <div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
@@ -360,7 +358,7 @@ wp_nonce_field( $nonce_action );
 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
 
 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
 
-<div id="poststuff" class="metabox-holder">
+<div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
 
 <div id="side-info-column" class="inner-sidebar">
 <?php
 
 <div id="side-info-column" class="inner-sidebar">
 <?php
@@ -371,12 +369,12 @@ $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
 ?>
 </div>
 
 ?>
 </div>
 
-<div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
-<div id="post-body-content" class="has-sidebar-content">
+<div id="post-body">
+<div id="post-body-content">
 <div id="namediv" class="stuffbox">
 <h3><label for="link_name"><?php _e('Name') ?></label></h3>
 <div class="inside">
 <div id="namediv" class="stuffbox">
 <h3><label for="link_name"><?php _e('Name') ?></label></h3>
 <div class="inside">
-       <input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" />
+       <input type="text" name="link_name" size="30" tabindex="1" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" />
     <p><?php _e('Example: Nifty blogging software'); ?></p>
 </div>
 </div>
     <p><?php _e('Example: Nifty blogging software'); ?></p>
 </div>
 </div>
@@ -384,7 +382,7 @@ $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
 <div id="addressdiv" class="stuffbox">
 <h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
 <div class="inside">
 <div id="addressdiv" class="stuffbox">
 <h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
 <div class="inside">
-       <input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" />
+       <input type="text" name="link_url" size="30" class="code" tabindex="1" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" />
     <p><?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?></p>
 </div>
 </div>
     <p><?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?></p>
 </div>
 </div>
@@ -392,7 +390,7 @@ $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
 <div id="descriptiondiv" class="stuffbox">
 <h3><label for="link_description"><?php _e('Description') ?></label></h3>
 <div class="inside">
 <div id="descriptiondiv" class="stuffbox">
 <h3><label for="link_description"><?php _e('Description') ?></label></h3>
 <div class="inside">
-       <input type="text" name="link_description" size="30" tabindex="1" value="<?php echo isset($link->link_description) ? $link->link_description : ''; ?>" id="link_description" />
+       <input type="text" name="link_description" size="30" tabindex="1" value="<?php echo isset($link->link_description) ? esc_attr($link->link_description) : ''; ?>" id="link_description" />
     <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
 </div>
 </div>
     <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
 </div>
 </div>
@@ -406,7 +404,7 @@ do_meta_boxes('link', 'advanced', $link);
 if ( $link_id ) : ?>
 <input type="hidden" name="action" value="save" />
 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
 if ( $link_id ) : ?>
 <input type="hidden" name="action" value="save" />
 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
-<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
+<input type="hidden" name="order_by" value="<?php echo esc_attr($order_by); ?>" />
 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
 <?php else: ?>
 <input type="hidden" name="action" value="add" />
 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
 <?php else: ?>
 <input type="hidden" name="action" value="add" />
index 5d1caea078ca9b3e612936716cfd9d78bf66cb8f..2d436be76bb331cd9c6874869ba2597d70ffce27 100644 (file)
@@ -18,10 +18,9 @@ if ( ! isset( $temp_ID ) )
 
 if ( isset($_GET['message']) )
        $_GET['message'] = absint( $_GET['message'] );
 
 if ( isset($_GET['message']) )
        $_GET['message'] = absint( $_GET['message'] );
-$messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( ( isset( $_GET['_wp_original_http_referer'] ) ? $_GET['_wp_original_http_referer'] : '') ) ) );
+$messages[1] = sprintf(__('Page updated. <a href="%s">View page</a>'), get_permalink($post_ID));
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
-$messages[4] = __('Page updated.');
 $messages[5] = sprintf(__('Page published. <a href="%s">View page</a>'), get_permalink($post_ID));
 $messages[6] = sprintf(__('Page submitted. <a href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
 
 $messages[5] = sprintf(__('Page published. <a href="%s">View page</a>'), get_permalink($post_ID));
 $messages[6] = sprintf(__('Page submitted. <a href="%s">Preview page</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
 
@@ -42,7 +41,7 @@ if ( 0 == $post_ID) {
        $nonce_action = 'update-page_' . $post_ID;
        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
        $autosave = wp_get_post_autosave( $post_ID );
        $nonce_action = 'update-page_' . $post_ID;
        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
        $autosave = wp_get_post_autosave( $post_ID );
-       if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
+       if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) )
                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
 }
 
                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
 }
 
@@ -67,22 +66,29 @@ function page_submit_meta_box($post) {
 
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
 <div style="display:none;">
 
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
 <div style="display:none;">
-<input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
+<input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />
 </div>
 
 <div id="minor-publishing-actions">
 <div id="save-action">
 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
 </div>
 
 <div id="minor-publishing-actions">
 <div id="save-action">
 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
-<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
+<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" tabindex="4" class="button button-highlighted" />
 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
-<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save as Pending') ); ?>" tabindex="4" class="button button-highlighted" />
+<input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" tabindex="4" class="button button-highlighted" />
 <?php } ?>
 </div>
 
 <div id="preview-action">
 <?php } ?>
 </div>
 
 <div id="preview-action">
-<?php $preview_link = 'publish' == $post->post_status ? clean_url(get_permalink($post->ID)) : clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>
-
-<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
+<?php
+if ( 'publish' == $post->post_status ) {
+       $preview_link = esc_url(get_permalink($post->ID));
+       $preview_button = __('Preview Changes');
+} else {
+       $preview_link = esc_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID))));
+       $preview_button = __('Preview');
+}
+?>
+<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php echo $preview_button; ?></a>
 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
 </div>
 
 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
 </div>
 
@@ -92,7 +98,7 @@ function page_submit_meta_box($post) {
 <div id="misc-publishing-actions">
 
 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
 <div id="misc-publishing-actions">
 
 <div class="misc-pub-section<?php if ( !$can_publish ) { echo ' misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
-<b><span id="post-status-display">
+<span id="post-status-display">
 <?php
 switch ( $post->post_status ) {
        case 'private':
 <?php
 switch ( $post->post_status ) {
        case 'private':
@@ -112,12 +118,12 @@ switch ( $post->post_status ) {
                break;
 }
 ?>
                break;
 }
 ?>
-</span></b>
+</span>
 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
 
 <div id="post-status-select" class="hide-if-js">
 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
 
 <div id="post-status-select" class="hide-if-js">
-<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo $post->post_status; ?>" />
+<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr($post->post_status); ?>" />
 <select name='post_status' id='post_status' tabindex='4'>
 <?php if ( 'publish' == $post->post_status ) : ?>
 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
 <select name='post_status' id='post_status' tabindex='4'>
 <?php if ( 'publish' == $post->post_status ) : ?>
 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
@@ -138,7 +144,7 @@ switch ( $post->post_status ) {
 </div><?php // /misc-pub-section ?>
 
 <div class="misc-pub-section " id="visibility">
 </div><?php // /misc-pub-section ?>
 
 <div class="misc-pub-section " id="visibility">
-<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php
+<?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
 
 if ( 'private' == $post->post_status ) {
        $post->post_password = '';
 
 if ( 'private' == $post->post_status ) {
        $post->post_password = '';
@@ -152,29 +158,29 @@ if ( 'private' == $post->post_status ) {
        $visibility_trans = __('Public');
 }
 
        $visibility_trans = __('Public');
 }
 
-?><?php echo wp_specialchars( $visibility_trans ); ?></span></b> <?php if ( $can_publish ) { ?> <a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>
+echo esc_html( $visibility_trans ); ?></span>
+<?php if ( $can_publish ) { ?>
+<a href="#visibility" class="edit-visibility hide-if-no-js"><?php _e('Edit'); ?></a>
 
 <div id="post-visibility-select" class="hide-if-js">
 
 <div id="post-visibility-select" class="hide-if-js">
-<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo attribute_escape($post->post_password); ?>" />
-<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo attribute_escape( $visibility ); ?>" />
-
+<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
+<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
 
 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
 
 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
-<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo attribute_escape($post->post_password); ?>" /><br /></span>
+<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" /><br /></span>
 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
 
 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
 
-<p>
- <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
- <a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a>
-</p>
+<p><a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
+<a href="#visibility" class="cancel-post-visibility hide-if-no-js"><?php _e('Cancel'); ?></a></p>
 </div>
 <?php } ?>
 
 </div><?php // /misc-pub-section ?>
 
 <?php
 </div>
 <?php } ?>
 
 </div><?php // /misc-pub-section ?>
 
 <?php
-$datef = _c( 'M j, Y @ G:i|Publish box date format');
+// translators: Publish box date formt, see http://php.net/date
+$datef = __( 'M j, Y @ G:i' );
 if ( 0 != $post->ID ) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
                $stamp = __('Scheduled for: <b>%1$s</b>');
 if ( 0 != $post->ID ) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
                $stamp = __('Scheduled for: <b>%1$s</b>');
@@ -192,15 +198,14 @@ if ( 0 != $post->ID ) {
        $stamp = __('Publish <b>immediately</b>');
        $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
 }
        $stamp = __('Publish <b>immediately</b>');
        $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
 }
-?>
-<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
+
+if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
 <div class="misc-pub-section curtime misc-pub-section-last">
 <div class="misc-pub-section curtime misc-pub-section-last">
-       <span id="timestamp">
-       <?php printf($stamp, $date); ?></span>
+       <span id="timestamp"><?php printf($stamp, $date); ?></span>
        <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
        <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
        <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
        <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
-</div><?php // /misc-pub-section ?>
-<?php endif; ?>
+</div><?php // /misc-pub-section
+endif; ?>
 
 </div>
 <div class="clear"></div>
 
 </div>
 <div class="clear"></div>
@@ -211,29 +216,32 @@ if ( 0 != $post->ID ) {
 <div id="delete-action">
 <?php
 if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
 <div id="delete-action">
 <?php
 if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
-<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
+<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
 <?php } ?>
 </div>
 
 <div id="publishing-action">
 <?php
 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
 <?php } ?>
 </div>
 
 <div id="publishing-action">
 <?php
 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { ?>
-<?php if ( $can_publish ) : ?>
-       <?php if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
-               <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Schedule') ?>" />
-               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Schedule') ?>" />
-       <?php else : ?>
-               <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Publish') ?>" />
-               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
-       <?php endif; ?>
-<?php else : ?>
-       <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Submit for Review') ?>" />
-       <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
-<?php endif; ?>
-<?php } else { ?>
-       <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Update Page') ?>" />
-       <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php _e('Update Page') ?>" />
-<?php } ?>
+<?php
+       if ( $can_publish ) :
+               if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
+               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
+               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Schedule') ?>" />
+<?php  else : ?>
+               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
+               <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Publish') ?>" />
+<?php  endif;
+       else : ?>
+       <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
+       <input name="publish" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Submit for Review') ?>" />
+<?php
+       endif;
+} else { ?>
+       <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update Page') ?>" />
+       <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="<?php esc_attr_e('Update Page') ?>" />
+<?php
+} ?>
 </div>
 <div class="clear"></div>
 </div>
 </div>
 <div class="clear"></div>
 </div>
@@ -253,7 +261,7 @@ function page_password_meta_box($post){
 ?>
 <p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
 <h4><?php _e( 'Page Password' ); ?></h4>
 ?>
 <p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
 <h4><?php _e( 'Page Password' ); ?></h4>
-<p><label class="hidden" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
+<p><label class="screen-reader-text" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php the_post_password(); ?>" /></p>
 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
 <?php
 }
 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
 <?php
 }
@@ -269,23 +277,21 @@ function page_password_meta_box($post){
 function page_attributes_meta_box($post){
 ?>
 <h5><?php _e('Parent') ?></h5>
 function page_attributes_meta_box($post){
 ?>
 <h5><?php _e('Parent') ?></h5>
-<label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label>
+<label class="screen-reader-text" for="parent_id"><?php _e('Page Parent') ?></label>
 <?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?>
 <p><?php _e('You can arrange your pages in hierarchies, for example you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
 <?php
 <?php wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column'=> 'menu_order, post_title')); ?>
 <p><?php _e('You can arrange your pages in hierarchies, for example you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
 <?php
-       if ( 0 != count( get_page_templates() ) ) {
-?>
+       if ( 0 != count( get_page_templates() ) ) { ?>
 <h5><?php _e('Template') ?></h5>
 <h5><?php _e('Template') ?></h5>
-<label class="hidden" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
+<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
 <option value='default'><?php _e('Default Template'); ?></option>
 <?php page_template_dropdown($post->page_template); ?>
 </select>
 <p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them above.'); ?></p>
 <?php
 <option value='default'><?php _e('Default Template'); ?></option>
 <?php page_template_dropdown($post->page_template); ?>
 </select>
 <p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them above.'); ?></p>
 <?php
-       }
-?>
+       } ?>
 <h5><?php _e('Order') ?></h5>
 <h5><?php _e('Order') ?></h5>
-<p><label class="hidden" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
+<p><label class="screen-reader-text" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)'); ?></p>
 <?php
 }
 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)'); ?></p>
 <?php
 }
@@ -302,11 +308,10 @@ function page_custom_meta_box($post){
 ?>
 <div id="postcustomstuff">
 <?php
 ?>
 <div id="postcustomstuff">
 <?php
-$metadata = has_meta($post->ID);
-list_meta($metadata);
-meta_form();
-?>
-<div id="ajax-response"></div>
+       $metadata = has_meta($post->ID);
+       list_meta($metadata);
+       meta_form(); ?>
+       <div id="ajax-response"></div>
 </div>
 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
 <?php
 </div>
 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
 <?php
@@ -341,7 +346,7 @@ add_meta_box('pagecommentstatusdiv', __('Discussion'), 'page_comments_status_met
  */
 function page_slug_meta_box($post){
 ?>
  */
 function page_slug_meta_box($post){
 ?>
-<label class="hidden" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
+<label class="screen-reader-text" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $post->post_name ); ?>" />
 <?php
 }
 add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');
 <?php
 }
 add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');
@@ -363,7 +368,7 @@ if ( $authors && count( $authors ) > 1 ) {
                if ( $post->post_author && !in_array($post->post_author, $authors) )
                        $authors[] = $post->post_author;
 ?>
                if ( $post->post_author && !in_array($post->post_author, $authors) )
                        $authors[] = $post->post_author;
 ?>
-<label class="hidden" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<label class="screen-reader-text" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
 <?php
        }
        add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'normal', 'core');
 <?php
        }
        add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'normal', 'core');
@@ -392,7 +397,7 @@ require_once('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form name="post" action="page.php" method="post" id="post">
 <?php if ( $notice ) : ?>
 
 <form name="post" action="page.php" method="post" id="post">
 <?php if ( $notice ) : ?>
@@ -409,33 +414,29 @@ if (isset($mode) && 'bookmarklet' == $mode)
        echo '<input type="hidden" name="mode" value="bookmarklet" />';
 ?>
 <input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
        echo '<input type="hidden" name="mode" value="bookmarklet" />';
 ?>
 <input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
-<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
-<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
-<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
+<input type="hidden" id="hiddenaction" name="action" value='<?php echo esc_attr($form_action) ?>' />
+<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
+<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
 <?php echo $form_extra ?>
 <?php echo $form_extra ?>
-<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
-<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
+<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post->post_type) ?>" />
+<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
 <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
 
 <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
 
-<div id="poststuff" class="metabox-holder">
+<div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
 
 <div id="side-info-column" class="inner-sidebar">
 
 <div id="side-info-column" class="inner-sidebar">
-
 <?php
 <?php
-
 do_action('submitpage_box');
 do_action('submitpage_box');
-$side_meta_boxes = do_meta_boxes('page', 'side', $post);
-
-?>
+$side_meta_boxes = do_meta_boxes('page', 'side', $post); ?>
 </div>
 
 </div>
 
-<div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
-<div id="post-body-content" class="has-sidebar-content">
-
+<div id="post-body">
+<div id="post-body-content">
 <div id="titlediv">
 <div id="titlewrap">
 <div id="titlediv">
 <div id="titlewrap">
-  <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" autocomplete="off" />
+       <label class="screen-reader-text" for="title"><?php _e('Title') ?></label>
+       <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
 </div>
 <div class="inside">
 <?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
 </div>
 <div class="inside">
 <?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
@@ -450,38 +451,36 @@ endif; ?>
 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
 
 <?php the_editor($post->post_content); ?>
 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
 
 <?php the_editor($post->post_content); ?>
-<div id="post-status-info">
-       <span id="wp-word-count" class="alignleft"></span>
-       <span class="alignright">
+<table id="post-status-info" cellspacing="0"><tbody><tr>
+       <td id="wp-word-count"></td>
+       <td class="autosave-info">
        <span id="autosave">&nbsp;</span>
 
 <?php
        if ($post_ID) {
                if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
                        $last_user = get_userdata($last_id);
        <span id="autosave">&nbsp;</span>
 
 <?php
        if ($post_ID) {
                if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
                        $last_user = get_userdata($last_id);
-                       printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
+                       printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
                } else {
                        printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
                }
        }
 ?>
                } else {
                        printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
                }
        }
 ?>
-       </span>
-       <br class="clear" />
-</div>
+       </td>
+</tr></tbody></table>
 
 
-<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
-<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
-<?php wp_nonce_field( 'getpermalink', 'getpermalinknonce', false ); ?>
-<?php wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); ?>
-<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
+<?php
+wp_nonce_field( 'autosave', 'autosavenonce', false );
+wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+wp_nonce_field( 'getpermalink', 'getpermalinknonce', false );
+wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
+wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
 </div>
 
 <?php
 </div>
 
 <?php
-
 do_meta_boxes('page', 'normal', $post);
 do_action('edit_page_form');
 do_meta_boxes('page', 'advanced', $post);
 do_meta_boxes('page', 'normal', $post);
 do_action('edit_page_form');
 do_meta_boxes('page', 'advanced', $post);
-
 ?>
 
 </div>
 ?>
 
 </div>
index fd817e3ad14b8558d5ac311939e7ec7e6acf5deb..0cf1680e10a0c378b76082d6f02df8f99cb5883c 100644 (file)
@@ -75,14 +75,16 @@ $parent_file = 'edit-pages.php';
 wp_enqueue_script('inline-edit-post');
 
 $post_stati  = array(  //      array( adj, noun )
 wp_enqueue_script('inline-edit-post');
 
 $post_stati  = array(  //      array( adj, noun )
-               'publish' => array(__('Published|page'), __('Published pages'), _n_noop('Published <span class="count">(%s)</span>|page', 'Published <span class="count">(%s)</span>')),
-               'future' => array(__('Scheduled|page'), __('Scheduled pages'), _n_noop('Scheduled <span class="count">(%s)</span>|page', 'Scheduled <span class="count">(%s)</span>')),
-               'pending' => array(__('Pending Review|page'), __('Pending pages'), _n_noop('Pending Review <span class="count">(%s)</span>|page', 'Pending Review <span class="count">(%s)</span>')),
-               'draft' => array(__('Draft|page'), _c('Drafts|manage posts header'), _n_noop('Draft <span class="count">(%s)</span>|page', 'Drafts <span class="count">(%s)</span>')),
-               'private' => array(__('Private|page'), __('Private pages'), _n_noop('Private <span class="count">(%s)</span>|page', 'Private <span class="count">(%s)</span>'))
+               'publish' => array(_x('Published', 'page'), __('Published pages'), _nx_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>', 'page')),
+               'future' => array(_x('Scheduled', 'page'), __('Scheduled pages'), _nx_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>', 'page')),
+               'pending' => array(_x('Pending Review', 'page'), __('Pending pages'), _nx_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>', 'page')),
+               'draft' => array(_x('Draft', 'page'), _x('Drafts', 'manage posts header'), _nx_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'page')),
+               'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page'))
        );
 
        );
 
-$query = array('post_type' => 'page', 'orderby' => 'menu_order title', 'what_to_show' => 'posts',
+$post_stati = apply_filters('page_stati', $post_stati);
+
+$query = array('post_type' => 'page', 'orderby' => 'menu_order title',
        'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
 
 $post_status_label = __('Pages');
        'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
 
 $post_status_label = __('Pages');
@@ -104,30 +106,30 @@ require_once('admin-header.php'); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( get_search_query() ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
 </h2>
 
 <?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
 <div id="message" class="updated fade"><p>
 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
 </h2>
 
 <?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
 <div id="message" class="updated fade"><p>
 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
-       printf( __ngettext( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
+       printf( _n( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
        unset($_GET['updated']);
 }
 
 if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {
        unset($_GET['updated']);
 }
 
 if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {
-       printf( __ngettext( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
+       printf( _n( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
        unset($_GET['skipped']);
 }
 
 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
        unset($_GET['skipped']);
 }
 
 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
-       printf( __ngettext( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
+       printf( _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
        unset($_GET['locked']);
 }
 
 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
        unset($_GET['locked']);
 }
 
 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
-       printf( __ngettext( 'Page deleted.', '%s pages deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
+       printf( _n( 'Page deleted.', '%s pages deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
        unset($_GET['deleted']);
 }
 $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
        unset($_GET['deleted']);
 }
 $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
@@ -150,7 +152,7 @@ $status_links = array();
 $num_posts = wp_count_posts('page', 'readable');
 $total_posts = array_sum( (array) $num_posts );
 $class = empty($_GET['post_status']) ? ' class="current"' : '';
 $num_posts = wp_count_posts('page', 'readable');
 $total_posts = array_sum( (array) $num_posts );
 $class = empty($_GET['post_status']) ? ' class="current"' : '';
-$status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>';
+$status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'pages' ), number_format_i18n( $total_posts ) ) . '</a>';
 foreach ( $post_stati as $status => $label ) {
        $class = '';
 
 foreach ( $post_stati as $status => $label ) {
        $class = '';
 
@@ -160,7 +162,7 @@ foreach ( $post_stati as $status => $label ) {
        if ( isset( $_GET['post_status'] ) && $status == $_GET['post_status'] )
                $class = ' class="current"';
 
        if ( isset( $_GET['post_status'] ) && $status == $_GET['post_status'] )
                $class = ' class="current"';
 
-       $status_links[] = "<li><a href='edit-pages.php?post_status=$status'$class>" . sprintf( _nc( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
+       $status_links[] = "<li><a href='edit-pages.php?post_status=$status'$class>" . sprintf( _nx( $label[2][0], $label[2][1], $num_posts->$status, $label[2][2] ), number_format_i18n( $num_posts->$status ) ) . '</a>';
 }
 echo implode( " |</li>\n", $status_links ) . '</li>';
 unset($status_links);
 }
 echo implode( " |</li>\n", $status_links ) . '</li>';
 unset($status_links);
@@ -169,13 +171,13 @@ endif;
 </ul>
 
 <p class="search-box">
 </ul>
 
 <p class="search-box">
-       <label class="hidden" for="page-search-input"><?php _e( 'Search Pages' ); ?>:</label>
-       <input type="text" class="search-input" id="page-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
+       <label class="screen-reader-text" for="page-search-input"><?php _e( 'Search Pages' ); ?>:</label>
+       <input type="text" id="page-search-input" name="s" value="<?php _admin_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Pages' ); ?>" class="button" />
 </p>
 
 <?php if ( isset($_GET['post_status'] ) ) : ?>
 </p>
 
 <?php if ( isset($_GET['post_status'] ) ) : ?>
-<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
+<input type="hidden" name="post_status" value="<?php echo esc_attr($_GET['post_status']) ?>" />
 <?php endif; ?>
 
 <?php if ($posts) { ?>
 <?php endif; ?>
 
 <?php if ($posts) { ?>
@@ -186,7 +188,8 @@ endif;
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
-if( ! isset( $per_page ) || $per_page < 0 )
+$per_page = get_user_option('edit_pages_per_page');
+if ( empty( $per_page ) || $per_page < 0 )
        $per_page = 20;
 
 $num_pages = ceil($wp_query->post_count / $per_page);
        $per_page = 20;
 
 $num_pages = ceil($wp_query->post_count / $per_page);
@@ -214,7 +217,7 @@ if ( $page_links ) : ?>
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-pages'); ?>
 </div>
 
 <?php wp_nonce_field('bulk-pages'); ?>
 </div>
 
@@ -253,7 +256,7 @@ if ( $page_links )
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
 <br class="clear" />
 </div>
 
 <br class="clear" />
@@ -290,7 +293,9 @@ if ( 1 == count($posts) && is_singular() ) :
 <table class="widefat" cellspacing="0">
 <thead>
   <tr>
 <table class="widefat" cellspacing="0">
 <thead>
   <tr>
-    <th scope="col" class="column-comment"><?php echo _c('Comment|noun') ?></th>
+    <th scope="col" class="column-comment">
+               <?php  /* translators: column name */ echo _x('Comment', 'column name') ?>
+       </th>
     <th scope="col" class="column-author"><?php _e('Author') ?></th>
     <th scope="col" class="column-date"><?php _e('Submitted') ?></th>
   </tr>
     <th scope="col" class="column-author"><?php _e('Author') ?></th>
     <th scope="col" class="column-date"><?php _e('Submitted') ?></th>
   </tr>
@@ -312,20 +317,5 @@ endif; // posts;
 
 </div>
 
 
 </div>
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected pages.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       }
-               });
-       });
-})(jQuery);
-columns.init('edit-pages');
-/* ]]> */
-</script>
-
-<?php include('admin-footer.php'); ?>
+<?php
+include('admin-footer.php');
index f2218ac067433cf2ddd37771fe998b2b62e11e89..f1cc536600c858ffa11bcf495130c9252ea19fd9 100644 (file)
@@ -20,21 +20,27 @@ do_action('edit_tag_form_pre', $tag); ?>
 <div id="ajax-response"></div>
 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
 <input type="hidden" name="action" value="editedtag" />
 <div id="ajax-response"></div>
 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">
 <input type="hidden" name="action" value="editedtag" />
-<input type="hidden" name="tag_ID" value="<?php echo $tag->term_id ?>" />
+<input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
        <table class="form-table">
                <tr class="form-field form-required">
                        <th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
        <table class="form-table">
                <tr class="form-field form-required">
                        <th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
-                       <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
-            <p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
+                       <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
+            <p class="description"><?php _e('The name is how the tag appears on your site.'); ?></p></td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
-                       <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
-            <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
+                       <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
+            <p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
+               </tr>
+               <tr class="form-field">
+                       <th scope="row" valign="top"><label for="description"><?php _e('Description') ?></label></th>
+                       <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($tag->description); ?></textarea><br />
+            <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
                </tr>
        </table>
                </tr>
        </table>
-<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Tag'); ?>" /></p>
+<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Tag'); ?>" /></p>
 <?php do_action('edit_tag_form', $tag); ?>
 </form>
 </div>
 <?php do_action('edit_tag_form', $tag); ?>
 </form>
 </div>
index 41467ecb9a81de15ed8789dff98ab35dc09f3e74..9f083b985e5cd5c7cd2d7efa5bafbc59cc0eb5ed 100644 (file)
@@ -11,7 +11,16 @@ require_once('admin.php');
 
 $title = __('Tags');
 
 
 $title = __('Tags');
 
-wp_reset_vars( array('action', 'tag') );
+wp_reset_vars( array('action', 'tag', 'taxonomy') );
+
+if ( empty($taxonomy) )
+       $taxonomy = 'post_tag';
+
+if ( !is_taxonomy($taxonomy) )
+       wp_die(__('Invalid taxonomy'));
+
+$parent_file = 'edit.php';
+$submenu_file = "edit-tags.php?taxonomy=$taxonomy";
 
 if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
        $action = 'bulk-delete';
 
 if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
        $action = 'bulk-delete';
@@ -25,7 +34,7 @@ case 'addtag':
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
-       $ret = wp_insert_term($_POST['name'], 'post_tag', $_POST);
+       $ret = wp_insert_term($_POST['name'], $taxonomy, $_POST);
        if ( $ret && !is_wp_error( $ret ) ) {
                wp_redirect('edit-tags.php?message=1#addtag');
        } else {
        if ( $ret && !is_wp_error( $ret ) ) {
                wp_redirect('edit-tags.php?message=1#addtag');
        } else {
@@ -41,9 +50,16 @@ case 'delete':
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
-       wp_delete_term( $tag_ID, 'post_tag');
+       wp_delete_term( $tag_ID, $taxonomy);
+
+       $location = 'edit-tags.php';
+       if ( $referer = wp_get_referer() ) {
+               if ( false !== strpos($referer, 'edit-tags.php') )
+                       $location = $referer;
+       }
 
 
-       wp_redirect('edit-tags.php?message=2');
+       $location = add_query_arg('message', 2, $location);
+       wp_redirect($location);
        exit;
 
 break;
        exit;
 
 break;
@@ -56,7 +72,7 @@ case 'bulk-delete':
 
        $tags = $_GET['delete_tags'];
        foreach( (array) $tags as $tag_ID ) {
 
        $tags = $_GET['delete_tags'];
        foreach( (array) $tags as $tag_ID ) {
-               wp_delete_term( $tag_ID, 'post_tag');
+               wp_delete_term( $tag_ID, $taxonomy);
        }
 
        $location = 'edit-tags.php';
        }
 
        $location = 'edit-tags.php';
@@ -77,7 +93,7 @@ case 'edit':
        require_once ('admin-header.php');
        $tag_ID = (int) $_GET['tag_ID'];
 
        require_once ('admin-header.php');
        $tag_ID = (int) $_GET['tag_ID'];
 
-       $tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit');
+       $tag = get_term($tag_ID, $taxonomy, OBJECT, 'edit');
        include('edit-tag-form.php');
 
 break;
        include('edit-tag-form.php');
 
 break;
@@ -89,7 +105,7 @@ case 'editedtag':
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
-       $ret = wp_update_term($tag_ID, 'post_tag', $_POST);
+       $ret = wp_update_term($tag_ID, $taxonomy, $_POST);
 
        $location = 'edit-tags.php';
        if ( $referer = wp_get_original_referer() ) {
 
        $location = 'edit-tags.php';
        if ( $referer = wp_get_original_referer() ) {
@@ -130,9 +146,9 @@ $messages[6] = __('Tags deleted.'); ?>
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_GET['s']) ) ); ?>
 </h2>
 
 <?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
 </h2>
 
 <?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
@@ -141,10 +157,11 @@ if ( isset($_GET['s']) && $_GET['s'] )
 endif; ?>
 
 <form class="search-form" action="" method="get">
 endif; ?>
 
 <form class="search-form" action="" method="get">
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
 <p class="search-box">
 <p class="search-box">
-       <label class="hidden" for="tag-search-input"><?php _e( 'Search Tags' ); ?>:</label>
-       <input type="text" class="search-input" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
+       <label class="screen-reader-text" for="tag-search-input"><?php _e( 'Search Tags' ); ?>:</label>
+       <input type="text" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Tags' ); ?>" class="button" />
 </p>
 </form>
 <br class="clear" />
 </p>
 </form>
 <br class="clear" />
@@ -154,20 +171,25 @@ endif; ?>
 <div id="col-right">
 <div class="col-wrap">
 <form id="posts-filter" action="" method="get">
 <div id="col-right">
 <div class="col-wrap">
 <form id="posts-filter" action="" method="get">
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
 <div class="tablenav">
 <?php
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 
 <div class="tablenav">
 <?php
 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 
-$tagsperpage = apply_filters("tagsperpage",20);
+$tags_per_page = get_user_option('edit_tags_per_page');
+if ( empty($tags_per_page) )
+       $tags_per_page = 20;
+$tags_per_page = apply_filters('edit_tags_per_page', $tags_per_page);
+$tags_per_page = apply_filters('tagsperpage', $tags_per_page); // Old filter
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
        'prev_text' => __('&laquo;'),
        'next_text' => __('&raquo;'),
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
        'prev_text' => __('&laquo;'),
        'next_text' => __('&raquo;'),
-       'total' => ceil(wp_count_terms('post_tag') / $tagsperpage),
+       'total' => ceil(wp_count_terms($taxonomy) / $tags_per_page),
        'current' => $pagenum
 ));
 
        'current' => $pagenum
 ));
 
@@ -180,7 +202,7 @@ if ( $page_links )
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-tags'); ?>
 </div>
 
 <?php wp_nonce_field('bulk-tags'); ?>
 </div>
 
@@ -207,7 +229,7 @@ if ( $page_links )
 
 $searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
 
 
 $searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
 
-$count = tag_rows( $pagenum, $tagsperpage, $searchterms );
+$count = tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy );
 ?>
        </tbody>
 </table>
 ?>
        </tbody>
 </table>
@@ -223,7 +245,7 @@ if ( $page_links )
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
 <br class="clear" />
 </div>
 
 <br class="clear" />
@@ -241,9 +263,9 @@ if ( $page_links )
 <h3><?php _e('Popular Tags'); ?></h3>
 <?php
 if ( $can_manage )
 <h3><?php _e('Popular Tags'); ?></h3>
 <?php
 if ( $can_manage )
-       wp_tag_cloud(array('link' => 'edit'));
+       wp_tag_cloud(array('taxonomy' => $taxonomy, 'link' => 'edit'));
 else
 else
-       wp_tag_cloud();
+       wp_tag_cloud(array('taxonomy' => $taxonomy));
 ?>
 </div>
 
 ?>
 </div>
 
@@ -255,21 +277,28 @@ else
 <div id="ajax-response"></div>
 <form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">
 <input type="hidden" name="action" value="addtag" />
 <div id="ajax-response"></div>
 <form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">
 <input type="hidden" name="action" value="addtag" />
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-tag'); ?>
 
 <div class="form-field form-required">
        <label for="name"><?php _e('Tag name') ?></label>
        <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-tag'); ?>
 
 <div class="form-field form-required">
        <label for="name"><?php _e('Tag name') ?></label>
        <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
-    <p><?php _e('The name is how the tag appears on your site.'); ?></p>
+       <p><?php _e('The name is how the tag appears on your site.'); ?></p>
 </div>
 
 <div class="form-field">
        <label for="slug"><?php _e('Tag slug') ?></label>
        <input name="slug" id="slug" type="text" value="" size="40" />
 </div>
 
 <div class="form-field">
        <label for="slug"><?php _e('Tag slug') ?></label>
        <input name="slug" id="slug" type="text" value="" size="40" />
-    <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
+       <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
 </div>
 
 </div>
 
-<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p>
+<div class="form-field">
+       <label for="description"><?php _e('Description') ?></label>
+       <textarea name="description" id="description" rows="5" cols="40"></textarea>
+    <p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
+</div>
+
+<p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Tag'); ?>" /></p>
 <?php do_action('add_tag_form'); ?>
 </form></div>
 <?php } ?>
 <?php do_action('add_tag_form'); ?>
 </form></div>
 <?php } ?>
@@ -280,21 +309,6 @@ else
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
 </div><!-- /col-container -->
 </div><!-- /wrap -->
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected tags.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       }
-               });
-       });
-})(jQuery);
-/* ]]> */
-</script>
-
 <?php inline_edit_term_row('edit-tags'); ?>
 
 <?php
 <?php inline_edit_term_row('edit-tags'); ?>
 
 <?php
index 9d148a81a82e482eca8eaad46c22821314ca2f9d..eb6b9f1c4911075a23640958ab2ef831854c6ac9 100644 (file)
@@ -92,13 +92,13 @@ if ( !isset( $_GET['paged'] ) )
 if ( empty($_GET['mode']) )
        $mode = 'list';
 else
 if ( empty($_GET['mode']) )
        $mode = 'list';
 else
-       $mode = attribute_escape($_GET['mode']); ?>
+       $mode = esc_attr($_GET['mode']); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( get_search_query() ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
 </h2>
 
 <?php
 </h2>
 
 <?php
@@ -110,7 +110,7 @@ endif; ?>
 <?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
 <div id="message" class="updated fade"><p>
 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
 <?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
 <div id="message" class="updated fade"><p>
 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
-       printf( __ngettext( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
+       printf( _n( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
        unset($_GET['updated']);
 }
 
        unset($_GET['updated']);
 }
 
@@ -118,12 +118,12 @@ if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
        unset($_GET['skipped']);
 
 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
        unset($_GET['skipped']);
 
 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
-       printf( __ngettext( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
+       printf( _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
        unset($_GET['locked']);
 }
 
 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
        unset($_GET['locked']);
 }
 
 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
-       printf( __ngettext( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
+       printf( _n( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
        unset($_GET['deleted']);
 }
 
        unset($_GET['deleted']);
 }
 
@@ -141,7 +141,7 @@ $status_links = array();
 $num_posts = wp_count_posts( 'post', 'readable' );
 $total_posts = array_sum( (array) $num_posts );
 $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
 $num_posts = wp_count_posts( 'post', 'readable' );
 $total_posts = array_sum( (array) $num_posts );
 $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
-$status_links[] = "<li><a href='edit.php' $class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>';
+$status_links[] = "<li><a href='edit.php' $class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
 
 
 foreach ( $post_stati as $status => $label ) {
 
 
 foreach ( $post_stati as $status => $label ) {
@@ -155,7 +155,7 @@ foreach ( $post_stati as $status => $label ) {
        if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
                $class = ' class="current"';
 
        if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
                $class = ' class="current"';
 
-       $status_links[] = "<li><a href='edit.php?post_status=$status' $class>" . sprintf( __ngettext( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
+       $status_links[] = "<li><a href='edit.php?post_status=$status' $class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
 }
 echo implode( " |</li>\n", $status_links ) . '</li>';
 unset( $status_links );
 }
 echo implode( " |</li>\n", $status_links ) . '</li>';
 unset( $status_links );
@@ -164,15 +164,15 @@ endif;
 </ul>
 
 <p class="search-box">
 </ul>
 
 <p class="search-box">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
-       <input type="text" class="search-input" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
+       <label class="screen-reader-text" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
+       <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Posts' ); ?>" class="button" />
 </p>
 
 <?php if ( isset($_GET['post_status'] ) ) : ?>
 </p>
 
 <?php if ( isset($_GET['post_status'] ) ) : ?>
-<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
+<input type="hidden" name="post_status" value="<?php echo esc_attr($_GET['post_status']) ?>" />
 <?php endif; ?>
 <?php endif; ?>
-<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
+<input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
 
 <?php if ( have_posts() ) { ?>
 
 
 <?php if ( have_posts() ) { ?>
 
@@ -195,7 +195,7 @@ $page_links = paginate_links( array(
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-posts'); ?>
 
 <?php // view filters
 <?php wp_nonce_field('bulk-posts'); ?>
 
 <?php // view filters
@@ -222,7 +222,7 @@ foreach ($arc_result as $arc_row) {
        else
                $default = '';
 
        else
                $default = '';
 
-       echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
+       echo "<option$default value='" . esc_attr("$arc_row->yyear$arc_row->mmonth") . "'>";
        echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
        echo "</option>\n";
 }
        echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
        echo "</option>\n";
 }
@@ -236,7 +236,7 @@ $dropdown_options = array('show_option_all' => __('View all categories'), 'hide_
 wp_dropdown_categories($dropdown_options);
 do_action('restrict_manage_posts');
 ?>
 wp_dropdown_categories($dropdown_options);
 do_action('restrict_manage_posts');
 ?>
-<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
+<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
 
 <?php } ?>
 </div>
 
 <?php } ?>
 </div>
@@ -251,8 +251,8 @@ do_action('restrict_manage_posts');
 <?php } ?>
 
 <div class="view-switch">
 <?php } ?>
 
 <div class="view-switch">
-       <a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
-       <a href="<?php echo clean_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
+       <a href="<?php echo esc_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
+       <a href="<?php echo esc_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
 </div>
 
 <div class="clear"></div>
 </div>
 
 <div class="clear"></div>
@@ -275,7 +275,7 @@ if ( $page_links )
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="edit"><?php _e('Edit'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 <br class="clear" />
 </div>
 <br class="clear" />
 <br class="clear" />
 </div>
 <br class="clear" />
@@ -296,20 +296,5 @@ if ( $page_links )
 
 </div>
 
 
 </div>
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected posts.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       }
-               });
-       });
-})(jQuery);
-columns.init('edit');
-/* ]]> */
-</script>
-
-<?php include('admin-footer.php'); ?>
+<?php
+include('admin-footer.php');
index dbe1b143c8c70ce25dfba846bbdc02dc0991d2ad..4e5f80d1f449902f8c5107bd8994b54d49b4e3d7 100644 (file)
@@ -24,7 +24,7 @@ require_once ('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
 <p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
 
 <p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
 <p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
@@ -42,14 +42,14 @@ require_once ('admin-header.php');
 $authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
 foreach ( $authors as $id ) {
        $o = get_userdata( $id );
 $authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
 foreach ( $authors as $id ) {
        $o = get_userdata( $id );
-       echo "<option value='$o->ID'>$o->display_name</option>";
+       echo "<option value='" . esc_attr($o->ID) . "'>$o->display_name</option>";
 }
 ?>
 </select>
 </td>
 </tr>
 </table>
 }
 ?>
 </select>
 </td>
 </tr>
 </table>
-<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Download Export File'); ?>" />
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php esc_attr_e('Download Export File'); ?>" />
 <input type="hidden" name="download" value="true" />
 </p>
 </form>
 <input type="hidden" name="download" value="true" />
 </p>
 </form>
index 65a2ee6b9bb24ec6f0587a09dfba4d74caedf3ab..6bd926b813004f9549e3655b2803cbc4120ffac7 100644 (file)
  * @subpackage Administration
  */
 
  * @subpackage Administration
  */
 
-/** Set ABSPATH for execution */
-define( 'ABSPATH', dirname(dirname(__FILE__)) );
-define( 'WPINC', '/wp-includes' );
-
-/**
- * @ignore
- */
-function __() {}
-
-/**
- * @ignore
- */
-function _c() {}
-
-/**
- * @ignore
- */
-function add_filter() {}
-
-/**
- * @ignore
- */
-function attribute_escape() {}
-
-/**
- * @ignore
- */
-function apply_filters() {}
-
 /**
 /**
- * @ignore
- */
-function get_option() {}
-
-/**
- * @ignore
- */
-function is_lighttpd_before_150() {}
-
-/**
- * @ignore
- */
-function add_action() {}
-
-/**
- * @ignore
- */
-function do_action_ref_array() {}
-
-/**
- * @ignore
- */
-function get_bloginfo() {}
-
-/**
- * @ignore
- */
-function is_admin() {return true;}
-
-/**
- * @ignore
- */
-function site_url() {}
-
-/**
- * @ignore
- */
-function admin_url() {}
-
-/**
- * @ignore
+ * Disable error reporting
+ *
+ * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
  */
  */
-function wp_guess_url() {}
-
-require(ABSPATH . '/wp-includes/script-loader.php');
-require(ABSPATH . '/wp-includes/version.php');
+error_reporting(0);
 
 
-$wp_scripts = new WP_Scripts();
-wp_default_scripts($wp_scripts);
-
-$wp_styles = new WP_Styles();
-wp_default_styles($wp_styles);
-
-$defaults = $man_version = '';
-foreach ( $wp_scripts->registered as $script ) {
-       if ( empty($script->src) ) continue;
-       $ver = empty($script->ver) ? $wp_version : $script->ver;
-       if ( 'editor' == $script->handle ) $mce_ver = $script->ver;
-       $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $script->src );
-       $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
-       $man_version .= $ver;
-}
-
-foreach ( $wp_styles->registered as $style ) {
-       if ( empty($style->src) ) continue;
-
-       $ver = empty($style->ver) ? $wp_version : $style->ver;
-       $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->src );
-       if ( 'colors' == $style->handle ) $src = 'css/colors-classic.css';
-       $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
-
-       if ( isset($style->extra['rtl']) && $style->extra['rtl'] ) {
-               if ( is_bool( $style->extra['rtl'] ) )
-                       $rtl_href = str_replace( '.css', '-rtl.css', $src );
-               else
-                       $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
+/** Set ABSPATH for execution */
+define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
 
 
-               $defaults .= '{ "url" : "' . $rtl_href . '?ver=' . $ver . '" },' . "\n";
-       }
-       $man_version .= $ver;
-}
+require(ABSPATH . '/wp-admin/includes/manifest.php');
 
 
-$man_version = md5($man_version);
+$files = get_manifest();
 
 header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
 header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
 
 header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
 header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
@@ -128,190 +28,24 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
 ?>
 {
 "betaManifestVersion" : 1,
 ?>
 {
 "betaManifestVersion" : 1,
-"version" : "<?php echo $man_version; ?>_20081201",
+"version" : "<?php echo $man_version; ?>",
 "entries" : [
 "entries" : [
-<?php echo $defaults; ?>
-
-{ "url" : "images/align-center.png" },
-{ "url" : "images/align-left.png" },
-{ "url" : "images/align-none.png" },
-{ "url" : "images/align-right.png" },
-{ "url" : "images/archive-link.png" },
-{ "url" : "images/blue-grad.png" },
-{ "url" : "images/browse-happy.gif" },
-{ "url" : "images/bubble_bg.gif" },
-{ "url" : "images/bubble_bg-rtl.gif" },
-{ "url" : "images/button-grad.png" },
-{ "url" : "images/button-grad-active.png" },
-{ "url" : "images/comment-grey-bubble.png" },
-{ "url" : "images/date-button.gif" },
-{ "url" : "images/ed-bg.gif" },
-{ "url" : "images/fade-butt.png" },
-{ "url" : "images/fav.png" },
-{ "url" : "images/fav-arrow.gif" },
-{ "url" : "images/fav-arrow-rtl.gif" },
-{ "url" : "images/fav-top.png" },
-{ "url" : "images/generic.png" },
-{ "url" : "images/gray-grad.png" },
-{ "url" : "images/icons32.png" },
-{ "url" : "images/icons32-vs.png" },
-{ "url" : "images/list.png" },
-{ "url" : "images/list-vs.png" },
-{ "url" : "images/loading.gif" },
-{ "url" : "images/loading-publish.gif" },
-{ "url" : "images/logo.gif" },
-{ "url" : "images/logo-ghost.png" },
-{ "url" : "images/logo-login.gif" },
-{ "url" : "images/media-button-image.gif" },
-{ "url" : "images/media-button-music.gif" },
-{ "url" : "images/media-button-other.gif" },
-{ "url" : "images/media-button-video.gif" },
-{ "url" : "images/menu.png" },
-{ "url" : "images/menu-vs.png" },
-{ "url" : "images/menu-arrows.gif" },
-{ "url" : "images/menu-bits.gif" },
-{ "url" : "images/menu-bits-rtl.gif" },
-{ "url" : "images/menu-dark.gif" },
-{ "url" : "images/menu-dark-rtl.gif" },
-{ "url" : "images/no.png" },
-{ "url" : "images/required.gif" },
-{ "url" : "images/resize.gif" },
-{ "url" : "images/screen-options-left.gif" },
-{ "url" : "images/screen-options-right.gif" },
-{ "url" : "images/screen-options-right-up.gif" },
-{ "url" : "images/se.png" },
-{ "url" : "images/star.gif" },
-{ "url" : "images/toggle-arrow.gif" },
-{ "url" : "images/toggle-arrow-rtl.gif" },
-{ "url" : "images/white-grad.png" },
-{ "url" : "images/white-grad-active.png" },
-{ "url" : "images/wordpress-logo.png" },
-{ "url" : "images/wp-logo.gif" },
-{ "url" : "images/xit.gif" },
-{ "url" : "images/yes.png" },
-
-<?php if ( is_file('../wp-includes/js/tinymce/tiny_mce.js') ) { ?>
-{ "url" : "../wp-includes/js/tinymce/tiny_mce.js", "src" : "../wp-includes/js/tinymce/tiny_mce.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/langs/wp-langs-en.js", "src" : "../wp-includes/js/tinymce/langs/wp-langs-en.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/wordpress.css", "src" : "../wp-includes/js/tinymce/wordpress.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js", "src" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/utils/validate.js", "src" : "../wp-includes/js/tinymce/utils/validate.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js", "src" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js", "src" : "../wp-includes/js/tinymce/utils/editable_selects.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js", "src" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js", "src" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm", "src" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm", "src" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm", "src" : "../wp-includes/js/tinymce/themes/advanced/image.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm", "src" : "../wp-includes/js/tinymce/themes/advanced/link.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm", "src" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm", "src" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js", "src" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js", "src" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js", "src" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js", "src" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js", "src" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js", "src" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css", "src" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css", "src" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css", "src" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/autosave/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/autosave/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm", "src" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm", "src" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css", "src" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/media/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/media/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js", "src" : "../wp-includes/js/tinymce/plugins/media/js/media.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm", "src" : "../wp-includes/js/tinymce/plugins/media/media.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css", "src" : "../wp-includes/js/tinymce/plugins/media/css/content.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css", "src" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/paste/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js", "src" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js", "src" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm", "src" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm", "src" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm", "src" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css", "src" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css", "src" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/safari/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/safari/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css", "src" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css", "src" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html", "src" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js", "src" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css", "src" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css", "src" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
-
-{ "url" : "../wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js", "src" : "../wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js?ver=<?php echo $mce_ver; ?>", "ignoreQuery" : true },
+<?php
+$entries = '';
+
+foreach ( $files as $file ) {
+       // If version is not set, just output the file
+       if ( !isset($file[1]) )
+               $entries .= '{ "url" : "' . $file[0] . '" },' . "\n";
+       // If ver is set but ignoreQuery is not, output file with ver tacked on
+       elseif ( !isset($file[2]) )
+               $entries .= '{ "url" : "' . $file[0] . '?' . $file[1] . '" },' . "\n";
+       // Output url, src, and ignoreQuery
+       else
+               $entries .= '{ "url" : "' . $file[0] . '", "src" : "' . $file[0] . '?' . $file[1] . '", "ignoreQuery" : true },' . "\n";
+}
 
 
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/fm.gif" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/sflogo.png" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flash.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flv_player.swf" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/img/quicktime.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/img/realmedia.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/img/shockwave.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/img/trans.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/image.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/media.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/video.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/audio.gif" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpgallery/img/delete.png" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpgallery/img/edit.png" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png" },
-<?php } ?>
+echo trim( trim($entries), ',' );
+?>
 
 
-{ "url" : "../wp-includes/images/crystal/archive.png" },
-{ "url" : "../wp-includes/images/crystal/audio.png" },
-{ "url" : "../wp-includes/images/crystal/code.png" },
-{ "url" : "../wp-includes/images/crystal/default.png" },
-{ "url" : "../wp-includes/images/crystal/document.png" },
-{ "url" : "../wp-includes/images/crystal/interactive.png" },
-{ "url" : "../wp-includes/images/crystal/text.png" },
-{ "url" : "../wp-includes/images/crystal/video.png" },
-{ "url" : "../wp-includes/images/crystal/spreadsheet.png" },
-{ "url" : "../wp-includes/images/rss.png" },
-{ "url" : "../wp-includes/js/thickbox/loadingAnimation.gif" },
-{ "url" : "../wp-includes/js/thickbox/tb-close.png" }
 ]}
 ]}
index 3d338d7131c1651eb53368ed2363cd05eb18492e..36e0f6bc25b10ca27ca968108563518fe5dc49db 100644 (file)
Binary files a/wp-admin/images/blue-grad.png and b/wp-admin/images/blue-grad.png differ
diff --git a/wp-admin/images/button-grad-active-vs.png b/wp-admin/images/button-grad-active-vs.png
new file mode 100644 (file)
index 0000000..dc64172
Binary files /dev/null and b/wp-admin/images/button-grad-active-vs.png differ
diff --git a/wp-admin/images/button-grad-vs.png b/wp-admin/images/button-grad-vs.png
new file mode 100644 (file)
index 0000000..51c55a3
Binary files /dev/null and b/wp-admin/images/button-grad-vs.png differ
diff --git a/wp-admin/images/ed-bg-vs.gif b/wp-admin/images/ed-bg-vs.gif
new file mode 100644 (file)
index 0000000..0b3d2ba
Binary files /dev/null and b/wp-admin/images/ed-bg-vs.gif differ
diff --git a/wp-admin/images/fav-arrow-vs.gif b/wp-admin/images/fav-arrow-vs.gif
new file mode 100644 (file)
index 0000000..73d59fd
Binary files /dev/null and b/wp-admin/images/fav-arrow-vs.gif differ
diff --git a/wp-admin/images/fav-top-vs.gif b/wp-admin/images/fav-top-vs.gif
new file mode 100644 (file)
index 0000000..b9aa3d3
Binary files /dev/null and b/wp-admin/images/fav-top-vs.gif differ
diff --git a/wp-admin/images/fav-vs.png b/wp-admin/images/fav-vs.png
new file mode 100644 (file)
index 0000000..51a2186
Binary files /dev/null and b/wp-admin/images/fav-vs.png differ
diff --git a/wp-admin/images/menu-bits-rtl-vs.gif b/wp-admin/images/menu-bits-rtl-vs.gif
new file mode 100644 (file)
index 0000000..15bca80
Binary files /dev/null and b/wp-admin/images/menu-bits-rtl-vs.gif differ
diff --git a/wp-admin/images/menu-bits-vs.gif b/wp-admin/images/menu-bits-vs.gif
new file mode 100644 (file)
index 0000000..c6ad931
Binary files /dev/null and b/wp-admin/images/menu-bits-vs.gif differ
index 2696d7c39c9c13a52bc112e03c6e8679c448cc8b..cc299fc63bef440d466d7bea9940fc8b4b218149 100644 (file)
Binary files a/wp-admin/images/menu.png and b/wp-admin/images/menu.png differ
diff --git a/wp-admin/images/visit-site-button-grad-vs.gif b/wp-admin/images/visit-site-button-grad-vs.gif
new file mode 100644 (file)
index 0000000..34eb814
Binary files /dev/null and b/wp-admin/images/visit-site-button-grad-vs.gif differ
diff --git a/wp-admin/images/visit-site-button-grad.gif b/wp-admin/images/visit-site-button-grad.gif
new file mode 100644 (file)
index 0000000..a7b703e
Binary files /dev/null and b/wp-admin/images/visit-site-button-grad.gif differ
diff --git a/wp-admin/images/wp-logo-vs.gif b/wp-admin/images/wp-logo-vs.gif
new file mode 100644 (file)
index 0000000..7154d49
Binary files /dev/null and b/wp-admin/images/wp-logo-vs.gif differ
diff --git a/wp-admin/images/wpspin_dark.gif b/wp-admin/images/wpspin_dark.gif
new file mode 100644 (file)
index 0000000..daebe0d
Binary files /dev/null and b/wp-admin/images/wpspin_dark.gif differ
diff --git a/wp-admin/images/wpspin_light.gif b/wp-admin/images/wpspin_light.gif
new file mode 100644 (file)
index 0000000..e10b97f
Binary files /dev/null and b/wp-admin/images/wpspin_light.gif differ
index 9c321e43dee09eaaac354b2e60e8f901a30a5ce0..8b10fc844095b581c717cef5a8ba60bf112c05c6 100644 (file)
@@ -15,7 +15,7 @@ $parent_file = 'tools.php';
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 <p><?php _e('If you have posts or comments in another system, WordPress can import those into this blog. To get started, choose a system to import from below:'); ?></p>
 
 <?php
 <p><?php _e('If you have posts or comments in another system, WordPress can import those into this blog. To get started, choose a system to import from below:'); ?></p>
 
 <?php
index 0879cd11b0cb4ad96654f0b03618ae57786a8f8b..57fc06657e2db010d8b66f1fbe41796fc8ed6ef5 100644 (file)
@@ -51,7 +51,7 @@ class Blogger_Import {
                $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
                $prereqs = __('To use this importer, you must have a Google account and an upgraded (New, was Beta) blog hosted on blogspot.com or a custom domain (not FTP).');
                $stepone = __('The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.');
                $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
                $prereqs = __('To use this importer, you must have a Google account and an upgraded (New, was Beta) blog hosted on blogspot.com or a custom domain (not FTP).');
                $stepone = __('The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.');
-               $auth = __('Authorize');
+               $auth = esc_attr__('Authorize');
 
                echo "
                <div class='wrap'>
 
                echo "
                <div class='wrap'>
@@ -190,20 +190,20 @@ class Blogger_Import {
                        }
                }
 //echo '<pre>'.print_r($this,1).'</pre>';
                        }
                }
 //echo '<pre>'.print_r($this,1).'</pre>';
-               $start    = js_escape( __('Import') );
-               $continue = js_escape( __('Continue') );
-               $stop     = js_escape( __('Importing...') );
-               $authors  = js_escape( __('Set Authors') );
-               $loadauth = js_escape( __('Preparing author mapping form...') );
-               $authhead = js_escape( __('Final Step: Author Mapping') );
-               $nothing  = js_escape( __('Nothing was imported. Had you already imported this blog?') );
+               $start    = esc_js( __('Import') );
+               $continue = esc_js( __('Continue') );
+               $stop     = esc_js( __('Importing...') );
+               $authors  = esc_js( __('Set Authors') );
+               $loadauth = esc_js( __('Preparing author mapping form...') );
+               $authhead = esc_js( __('Final Step: Author Mapping') );
+               $nothing  = esc_js( __('Nothing was imported. Had you already imported this blog?') );
                $title    = __('Blogger Blogs');
                $name     = __('Blog Name');
                $url      = __('Blog URL');
                $action   = __('The Magic Button');
                $posts    = __('Posts');
                $comments = __('Comments');
                $title    = __('Blogger Blogs');
                $name     = __('Blog Name');
                $url      = __('Blog URL');
                $action   = __('The Magic Button');
                $posts    = __('Posts');
                $comments = __('Comments');
-               $noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don\'t worry, you can turn it back off when you\'re done.');
+               $noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don&#8217;t worry, you can turn it back off when you&#8217;re done.');
 
                $interval = STATUS_INTERVAL * 1000;
 
 
                $interval = STATUS_INTERVAL * 1000;
 
@@ -214,7 +214,8 @@ class Blogger_Import {
                                $value = $continue;
                        else
                                $value = $authors;
                                $value = $continue;
                        else
                                $value = $authors;
-                       $blogtitle = js_escape( $blog['title'] );
+                       $value = esc_attr($value);
+                       $blogtitle = esc_js( $blog['title'] );
                        $pdone = isset($blog['posts_done']) ? (int) $blog['posts_done'] : 0;
                        $cdone = isset($blog['comments_done']) ? (int) $blog['comments_done'] : 0;
                        $init .= "blogs[$i]=new blog($i,'$blogtitle','{$blog['mode']}'," . $this->get_js_status($i) . ');';
                        $pdone = isset($blog['posts_done']) ? (int) $blog['posts_done'] : 0;
                        $cdone = isset($blog['comments_done']) ? (int) $blog['comments_done'] : 0;
                        $init .= "blogs[$i]=new blog($i,'$blogtitle','{$blog['mode']}'," . $this->get_js_status($i) . ');';
@@ -437,7 +438,7 @@ class Blogger_Import {
                                if ( count( $matches[1] ) )
                                        foreach ( $matches[1] as $match )
                                                if ( preg_match('/rel=.previous./', $match) )
                                if ( count( $matches[1] ) )
                                        foreach ( $matches[1] as $match )
                                                if ( preg_match('/rel=.previous./', $match) )
-                                                       $query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) );
+                                                       $query = @html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match), ENT_COMPAT, get_option('blog_charset') );
 
                                if ( $query ) {
                                        parse_str($query, $q);
 
                                if ( $query ) {
                                        parse_str($query, $q);
@@ -495,7 +496,7 @@ class Blogger_Import {
                                if ( count( $matches[1] ) )
                                        foreach ( $matches[1] as $match )
                                                if ( preg_match('/rel=.previous./', $match) )
                                if ( count( $matches[1] ) )
                                        foreach ( $matches[1] as $match )
                                                if ( preg_match('/rel=.previous./', $match) )
-                                                       $query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) );
+                                                       $query = @html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match), ENT_COMPAT, get_option('blog_charset') );
 
                                parse_str($query, $q);
 
 
                                parse_str($query, $q);
 
@@ -545,7 +546,7 @@ class Blogger_Import {
                }
 
                $post_date    = $this->convert_date( $entry->published );
                }
 
                $post_date    = $this->convert_date( $entry->published );
-               $post_content = trim( addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) ) );
+               $post_content = trim( addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) ) );
                $post_title   = trim( addslashes( $this->no_apos( $this->min_whitespace( $entry->title ) ) ) );
                $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
 
                $post_title   = trim( addslashes( $this->no_apos( $this->min_whitespace( $entry->title ) ) ) );
                $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
 
@@ -600,7 +601,7 @@ class Blogger_Import {
                $comment_author  = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) );
                $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) );
                $comment_date    = $this->convert_date( $entry->updated );
                $comment_author  = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) );
                $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) );
                $comment_date    = $this->convert_date( $entry->updated );
-               $comment_content = addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) );
+               $comment_content = addslashes( $this->no_apos( @html_entity_decode( $entry->content, ENT_COMPAT, get_option('blog_charset') ) ) );
 
                // Clean up content
                $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
 
                // Clean up content
                $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
@@ -652,17 +653,17 @@ class Blogger_Import {
                        $this->save_vars();
                }
 
                        $this->save_vars();
                }
 
-               $directions = __('All posts were imported with the current user as author. Use this form to move each Blogger user\'s posts to a different WordPress user. You may <a href="users.php">add users</a> and then return to this page and complete the user mapping. This form may be used as many times as you like until you activate the "Restart" function below.');
+               $directions = __('All posts were imported with the current user as author. Use this form to move each Blogger user&#8217;s posts to a different WordPress user. You may <a href="users.php">add users</a> and then return to this page and complete the user mapping. This form may be used as many times as you like until you activate the &#8220;Restart&#8221; function below.');
                $heading = __('Author mapping');
                $blogtitle = "{$blog['title']} ({$blog['host']})";
                $mapthis = __('Blogger username');
                $tothis = __('WordPress login');
                $heading = __('Author mapping');
                $blogtitle = "{$blog['title']} ({$blog['host']})";
                $mapthis = __('Blogger username');
                $tothis = __('WordPress login');
-               $submit = js_escape( __('Save Changes') );
+               $submit = esc_js( __('Save Changes') );
 
                foreach ( $blog['authors'] as $i => $author )
                        $rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>";
 
 
                foreach ( $blog['authors'] as $i => $author )
                        $rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>";
 
-               return "<div class='wrap'><h2>$heading</h2><h3>$blogtitle</h3><p>$directions</p><form action='index.php?import=blogger&amp;noheader=true&saveauthors=1' method='post'><input type='hidden' name='blog' value='$importing_blog' /><table cellpadding='5'><thead><td>$mapthis</td><td>$tothis</td></thead>$rows<tr><td></td><td class='submit'><input type='submit' class='button authorsubmit' value='$submit' /></td></tr></table></form></div>";
+               return "<div class='wrap'><h2>$heading</h2><h3>$blogtitle</h3><p>$directions</p><form action='index.php?import=blogger&amp;noheader=true&saveauthors=1' method='post'><input type='hidden' name='blog' value='" . esc_attr($importing_blog) . "' /><table cellpadding='5'><thead><td>$mapthis</td><td>$tothis</td></thead>$rows<tr><td></td><td class='submit'><input type='submit' class='button authorsubmit' value='$submit' /></td></tr></table></form></div>";
        }
 
        function get_user_options($current) {
        }
 
        function get_user_options($current) {
@@ -795,7 +796,7 @@ class Blogger_Import {
                $blog = (int) $_GET['blog'];
                echo '<h1>'.__('Congratulations!').'</h1><p>'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'</p><ul><li>'.__('That was hard work! Take a break.').'</li>';
                if ( count($this->import['blogs']) > 1 )
                $blog = (int) $_GET['blog'];
                echo '<h1>'.__('Congratulations!').'</h1><p>'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'</p><ul><li>'.__('That was hard work! Take a break.').'</li>';
                if ( count($this->import['blogs']) > 1 )
-                       echo '<li>'.__('In case you haven\'t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>';
+                       echo '<li>'.__('In case you haven&#8217;t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>';
                if ( $n = count($this->import['blogs'][$blog]['newusers']) )
                        echo '<li>'.sprintf(__('Go to <a href="%s" target="%s">Authors &amp; Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>';
                echo '<li>'.__('For security, click the link below to reset this importer.').'</li>';
                if ( $n = count($this->import['blogs'][$blog]['newusers']) )
                        echo '<li>'.sprintf(__('Go to <a href="%s" target="%s">Authors &amp; Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>';
                echo '<li>'.__('For security, click the link below to reset this importer.').'</li>';
@@ -831,7 +832,7 @@ class Blogger_Import {
                if ( $saved && !isset($_GET['noheader']) ) {
                        $restart = __('Restart');
                        $message = __('We have saved some information about your Blogger account in your WordPress database. Clearing this information will allow you to start over. Restarting will not affect any posts you have already imported. If you attempt to re-import a blog, duplicate posts and comments will be skipped.');
                if ( $saved && !isset($_GET['noheader']) ) {
                        $restart = __('Restart');
                        $message = __('We have saved some information about your Blogger account in your WordPress database. Clearing this information will allow you to start over. Restarting will not affect any posts you have already imported. If you attempt to re-import a blog, duplicate posts and comments will be skipped.');
-                       $submit = __('Clear account information');
+                       $submit = esc_attr__('Clear account information');
                        echo "<div class='wrap'><h2>$restart</h2><p>$message</p><form method='post' action='?import=blogger&amp;noheader=true'><p class='submit' style='text-align:left;'><input type='submit' class='button' value='$submit' name='restart' /></p></form></div>";
                }
        }
                        echo "<div class='wrap'><h2>$restart</h2><p>$message</p><form method='post' action='?import=blogger&amp;noheader=true'><p class='submit' style='text-align:left;'><input type='submit' class='button' value='$submit' name='restart' /></p></form></div>";
                }
        }
index afec323c3bc80619ef69a6deb90ecf29a74f2c0f..500a08ba240efe9348a3a78375a7e786cb0bdc3d 100644 (file)
@@ -109,7 +109,7 @@ class BW_Import {
                                        return $post_id;
                                }
                                if (!$post_id) {
                                        return $post_id;
                                }
                                if (!$post_id) {
-                                       _e("Couldn't get post ID");
+                                       _e('Couldn&#8217;t get post ID');
                                        echo '</li>';
                                        break;
                                }
                                        echo '</li>';
                                        break;
                                }
@@ -155,7 +155,7 @@ class BW_Import {
                        }
                        if ( $num_comments ) {
                                echo ' ';
                        }
                        if ( $num_comments ) {
                                echo ' ';
-                               printf( __ngettext('%s comment', '%s comments', $num_comments), $num_comments );
+                               printf( _n('%s comment', '%s comments', $num_comments), $num_comments );
                        }
                        echo '</li>';
                        flush();
                        }
                        echo '</li>';
                        flush();
index c528c2251c8324206b276120a15257484c6b81d3..a2aab3ffd05307351bf4767d76293ff4457b7821 100644 (file)
@@ -35,7 +35,7 @@ class BunnyTags_Import {
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=btt&amp;step=1" method="post">';
                wp_nonce_field('import-btt');
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=btt&amp;step=1" method="post">';
                wp_nonce_field('import-btt');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Import Tags').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import Tags').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -83,7 +83,7 @@ class BunnyTags_Import {
                        return false;
                } else {
                        $count = count($metakeys);
                        return false;
                } else {
                        $count = count($metakeys);
-                       echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
+                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
                        echo '<ul>';
                        foreach ( $metakeys as $post_meta ) {
                                if ( $post_meta->meta_value != '' ) {
                        echo '<ul>';
                        foreach ( $metakeys as $post_meta ) {
                                if ( $post_meta->meta_value != '' ) {
@@ -105,7 +105,7 @@ class BunnyTags_Import {
 
                echo '<form action="admin.php?import=btt&amp;step='.($precheck? 2:3).'" method="post">';
                wp_nonce_field('import-btt');
 
                echo '<form action="admin.php?import=btt&amp;step='.($precheck? 2:3).'" method="post">';
                wp_nonce_field('import-btt');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Next').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
index d51f04172aa0a1a52faa54abba1407902bfb8cf1..d6552f76e9c05141c4404df18bd311bfcdbb6051 100644 (file)
@@ -48,115 +48,9 @@ if(!function_exists('link_exists'))
        }
 }
 
        }
 }
 
-/*
- Identify UTF-8 text
- Taken from http://www.php.net/manual/fr/function.mb-detect-encoding.php#50087
-*/
-//
-//    utf8 encoding validation developed based on Wikipedia entry at:
-//    http://en.wikipedia.org/wiki/UTF-8
-//
-//    Implemented as a recursive descent parser based on a simple state machine
-//    copyright 2005 Maarten Meijer
-//
-//    This cries out for a C-implementation to be included in PHP core
-//
-
 /**
 /**
- * @package WordPress
- * @subpackage Dotclear_Import
+ * Convert from dotclear charset to utf8 if required
  *
  *
- * @param string $char
- * @return string
- */
-function valid_1byte($char) {
-       if(!is_int($char)) return false;
-               return ($char & 0x80) == 0x00;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_2byte($char) {
-       if(!is_int($char)) return false;
-               return ($char & 0xE0) == 0xC0;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_3byte($char) {
-       if(!is_int($char)) return false;
-               return ($char & 0xF0) == 0xE0;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_4byte($char) {
-       if(!is_int($char)) return false;
-               return ($char & 0xF8) == 0xF0;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $char
- * @return string
- */
-function valid_nextbyte($char) {
-       if(!is_int($char)) return false;
-               return ($char & 0xC0) == 0x80;
-}
-
-/**
- * @package WordPress
- * @subpackage Dotclear_Import
- *
- * @param string $string
- * @return string
- */
-function valid_utf8($string) {
-       $len = strlen($string);
-       $i = 0;
-       while( $i < $len ) {
-               $char = ord(substr($string, $i++, 1));
-               if(valid_1byte($char)) {    // continue
-                       continue;
-               } else if(valid_2byte($char)) { // check 1 byte
-                       if(!valid_nextbyte(ord(substr($string, $i++, 1))))
-                               return false;
-               } else if(valid_3byte($char)) { // check 2 bytes
-                       if(!valid_nextbyte(ord(substr($string, $i++, 1))))
-                               return false;
-                       if(!valid_nextbyte(ord(substr($string, $i++, 1))))
-                               return false;
-               } else if(valid_4byte($char)) { // check 3 bytes
-                       if(!valid_nextbyte(ord(substr($string, $i++, 1))))
-                               return false;
-                       if(!valid_nextbyte(ord(substr($string, $i++, 1))))
-                               return false;
-                       if(!valid_nextbyte(ord(substr($string, $i++, 1))))
-                               return false;
-               } // goto next char
-       }
-       return true; // done
-}
-
-/**
  * @package WordPress
  * @subpackage Dotclear_Import
  *
  * @package WordPress
  * @subpackage Dotclear_Import
  *
@@ -164,7 +58,7 @@ function valid_utf8($string) {
  * @return string
  */
 function csc ($s) {
  * @return string
  */
 function csc ($s) {
-       if (valid_utf8 ($s)) {
+       if (seems_utf8 ($s)) {
                return $s;
        } else {
                return iconv(get_option ("dccharset"),"UTF-8",$s);
                return $s;
        } else {
                return iconv(get_option ("dccharset"),"UTF-8",$s);
@@ -215,7 +109,7 @@ class Dotclear_Import {
                echo '<form action="admin.php?import=dotclear&amp;step=1" method="post">';
                wp_nonce_field('import-dotclear');
                $this->db_form();
                echo '<form action="admin.php?import=dotclear&amp;step=1" method="post">';
                wp_nonce_field('import-dotclear');
                $this->db_form();
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.attribute_escape(__('Import Categories')).'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import Categories').'" /></p>';
                echo '</form></div>';
        }
 
                echo '</form></div>';
        }
 
@@ -312,7 +206,7 @@ class Dotclear_Import {
 
                        // Store category translation for future use
                        add_option('dccat2wpcat',$dccat2wpcat);
 
                        // Store category translation for future use
                        add_option('dccat2wpcat',$dccat2wpcat);
-                       echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
+                       echo '<p>'.sprintf(_n('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
                        return true;
                }
                echo __('No Categories to Import!');
                        return true;
                }
                echo __('No Categories to Import!');
@@ -613,7 +507,7 @@ class Dotclear_Import {
                        }
                        add_option('dclinks2wplinks',$dclinks2wplinks);
                        echo '<p>';
                        }
                        add_option('dclinks2wplinks',$dclinks2wplinks);
                        echo '<p>';
-                       printf(__ngettext('Done! <strong>%s</strong> link or link category imported.', 'Done! <strong>%s</strong> links or link categories imported.', $count), $count);
+                       printf(_n('Done! <strong>%s</strong> link or link category imported.', 'Done! <strong>%s</strong> links or link categories imported.', $count), $count);
                        echo '<br /><br /></p>';
                        return true;
                }
                        echo '<br /><br /></p>';
                        return true;
                }
@@ -632,7 +526,7 @@ class Dotclear_Import {
 
                echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
                wp_nonce_field('import-dotclear');
 
                echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
                wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Users')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Users'));
                echo '</form>';
 
        }
                echo '</form>';
 
        }
@@ -645,7 +539,7 @@ class Dotclear_Import {
 
                echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
                wp_nonce_field('import-dotclear');
 
                echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
                wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Posts')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Posts'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -659,7 +553,7 @@ class Dotclear_Import {
 
                echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
                wp_nonce_field('import-dotclear');
 
                echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
                wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Comments')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Comments'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -671,7 +565,7 @@ class Dotclear_Import {
 
                echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
                wp_nonce_field('import-dotclear');
 
                echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
                wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Links')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Links'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -684,7 +578,7 @@ class Dotclear_Import {
 
                echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
                wp_nonce_field('import-dotclear');
 
                echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
                wp_nonce_field('import-dotclear');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Finish')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Finish'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -710,11 +604,11 @@ class Dotclear_Import {
        {
                echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from DotClear, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
                echo '<h3>'.__('Users').'</h3>';
        {
                echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from DotClear, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
                echo '<h3>'.__('Users').'</h3>';
-               echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn\'t have that login in DotClear, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
+               echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn&#8217;t have that login in DotClear, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>';
                echo '<h3>'.__('Preserving Authors').'</h3>';
                echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
                echo '<h3>'.__('Textile').'</h3>';
                echo '<h3>'.__('Preserving Authors').'</h3>';
                echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>';
                echo '<h3>'.__('Textile').'</h3>';
-               echo '<p>'.__('Also, since you\'re coming from DotClear, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me... You\'ll want it.').'</p>';
+               echo '<p>'.__('Also, since you&#8217;re coming from DotClear, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me&#8230; You&#8217;ll want it.').'</p>';
                echo '<h3>'.__('WordPress Resources').'</h3>';
                echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>';
                echo '<ul>';
                echo '<h3>'.__('WordPress Resources').'</h3>';
                echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>';
                echo '<ul>';
@@ -722,7 +616,7 @@ class Dotclear_Import {
                echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
                echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
                echo '</ul>';
                echo '<li>'.__('<a href="http://wordpress.org/support/">The WordPress support forums</a>').'</li>';
                echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>';
                echo '</ul>';
-               echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '../wp-login.php').'</p>';
+               echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '../wp-login.php').'</p>';
        }
 
        function db_form()
        }
 
        function db_form()
index 5ff91edfdae27280d7ab20469a450f171f5e5e51..7e06f67ce75f5de96d4cfbfa468409d7b4e650b4 100644 (file)
@@ -61,12 +61,12 @@ class GM_Import {
 <td><input type="text" style="width:300px" name="archivespath" id="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
 </tr>
 <tr>
 <td><input type="text" style="width:300px" name="archivespath" id="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
 </tr>
 <tr>
-<td><label for="lastentry"><?php _e("Last entry's number:") ?></label></td>
+<td><label for="lastentry"><?php _e('Last entry&#8217;s number:') ?></label></td>
 <td><input type="text" name="lastentry" id="lastentry" value="00000001" /><br />
 <td><input type="text" name="lastentry" id="lastentry" value="00000001" /><br />
-       <?php _e("This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)") ?></td>
+       <?php _e('This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don&#8217;t know that number, just log into your FTP and look it out<br />in the entries&#8217; folder)') ?></td>
 </tr>
 </table>
 </tr>
 </table>
-<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Start Importing') ?>" /></p>
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php esc_attr_e('Start Importing') ?>" /></p>
 </form>
 <?php
                $this->footer();
 </form>
 <?php
                $this->footer();
@@ -283,12 +283,12 @@ class GM_Import {
                                }
                                if ($numAddedComments > 0) {
                                        echo ': ';
                                }
                                if ($numAddedComments > 0) {
                                        echo ': ';
-                               printf( __ngettext('imported %s comment', 'imported %s comments', $numAddedComments) , $numAddedComments);
+                               printf( _n('imported %s comment', 'imported %s comments', $numAddedComments) , $numAddedComments);
                                }
                                $preExisting = $numComments - numAddedComments;
                                if ($preExisting > 0) {
                                        echo ' ';
                                }
                                $preExisting = $numComments - numAddedComments;
                                if ($preExisting > 0) {
                                        echo ' ';
-                                       printf( __ngettext( 'ignored %s pre-existing comment', 'ignored %s pre-existing comments', $preExisting ) , $preExisting);
+                                       printf( _n( 'ignored %s pre-existing comment', 'ignored %s pre-existing comments', $preExisting ) , $preExisting);
                                }
                        }
                        echo '... <strong>'.__('Done').'</strong></li>';
                                }
                        }
                        echo '... <strong>'.__('Done').'</strong></li>';
index ba479528b91a22d485b8fd8d337571044631e3f5..d21d79a352e7ab6172dba1cc4c70897ba47fc6f9 100644 (file)
@@ -34,11 +34,11 @@ class JeromesKeyword_Import {
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=jkw&amp;step=1" method="post">';
                wp_nonce_field('import-jkw');
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=jkw&amp;step=1" method="post">';
                wp_nonce_field('import-jkw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Import Version 1.x').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import Version 1.x').'" /></p>';
                echo '</form>';
                echo '<form action="admin.php?import=jkw&amp;step=3" method="post">';
                wp_nonce_field('import-jkw');
                echo '</form>';
                echo '<form action="admin.php?import=jkw&amp;step=3" method="post">';
                wp_nonce_field('import-jkw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Import Version 2.0a').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import Version 2.0a').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -98,7 +98,7 @@ class JeromesKeyword_Import {
                        return false;
                } else {
                        $count = count($metakeys);
                        return false;
                } else {
                        $count = count($metakeys);
-                       echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
+                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
                        echo '<ul>';
                        foreach ( $metakeys as $post_meta ) {
                                if ( $post_meta->meta_value != '' ) {
                        echo '<ul>';
                        foreach ( $metakeys as $post_meta ) {
                                if ( $post_meta->meta_value != '' ) {
@@ -120,7 +120,7 @@ class JeromesKeyword_Import {
 
                echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 2:6).'" method="post">';
                wp_nonce_field('import-jkw');
 
                echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 2:6).'" method="post">';
                wp_nonce_field('import-jkw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Next').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -139,7 +139,7 @@ class JeromesKeyword_Import {
                        return false;
                } else {
                        $count = count($metakeys);
                        return false;
                } else {
                        $count = count($metakeys);
-                       echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
+                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
                        echo '<ul>';
                        foreach ( $metakeys as $post_meta ) {
                                $keyword = addslashes(trim($post_meta->tag_name));
                        echo '<ul>';
                        foreach ( $metakeys as $post_meta ) {
                                $keyword = addslashes(trim($post_meta->tag_name));
@@ -153,7 +153,7 @@ class JeromesKeyword_Import {
                }
                echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 4:5).'" method="post">';
                wp_nonce_field('import-jkw');
                }
                echo '<form action="admin.php?import=jkw&amp;step='.($precheck? 4:5).'" method="post">';
                wp_nonce_field('import-jkw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Next').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
index 294750c30fa64b7a8dd5d8c522b2c7b82b42656b..bfebe718b9ff9c53a824186e7d3b0a402b548a32 100644 (file)
 <?php
 <?php
+
 /**
 /**
- * LiveJournal Importer
+ * LiveJournal API Importer
  *
  * @package WordPress
  * @subpackage Importer
  */
 
  *
  * @package WordPress
  * @subpackage Importer
  */
 
+// XML-RPC library for communicating with LiveJournal API
+require_once( ABSPATH . WPINC . '/class-IXR.php' );
+
 /**
 /**
- * LiveJournal Importer class
+ * LiveJournal API Importer class
  *
  *
- * Imports your LiveJournal XML exported file into WordPress.
+ * Imports your LiveJournal contents into WordPress using the LJ API
  *
  *
- * @since unknown
+ * @since 2.8
  */
  */
-class LJ_Import {
+class LJ_API_Import {
+
+       var $comments_url = 'http://www.livejournal.com/export_comments.bml';
+       var $ixr_url      = 'http://www.livejournal.com/interface/xmlrpc';
+       var $ixr;
+       var $username;
+       var $password;
+       var $comment_meta;
+       var $comments;
+       var $usermap;
+       var $postmap;
+       var $commentmap;
+       var $pointers = array();
 
 
-       var $file;
+       // This list taken from LJ, they don't appear to have an API for it
+       var $moods = array( '1' => 'aggravated',
+                                               '10' => 'discontent',
+                                               '100' => 'rushed',
+                                               '101' => 'contemplative',
+                                               '102' => 'nerdy',
+                                               '103' => 'geeky',
+                                               '104' => 'cynical',
+                                               '105' => 'quixotic',
+                                               '106' => 'crazy',
+                                               '107' => 'creative',
+                                               '108' => 'artistic',
+                                               '109' => 'pleased',
+                                               '11' => 'energetic',
+                                               '110' => 'bitchy',
+                                               '111' => 'guilty',
+                                               '112' => 'irritated',
+                                               '113' => 'blank',
+                                               '114' => 'apathetic',
+                                               '115' => 'dorky',
+                                               '116' => 'impressed',
+                                               '117' => 'naughty',
+                                               '118' => 'predatory',
+                                               '119' => 'dirty',
+                                               '12' => 'enraged',
+                                               '120' => 'giddy',
+                                               '121' => 'surprised',
+                                               '122' => 'shocked',
+                                               '123' => 'rejected',
+                                               '124' => 'numb',
+                                               '125' => 'cheerful',
+                                               '126' => 'good',
+                                               '127' => 'distressed',
+                                               '128' => 'intimidated',
+                                               '129' => 'crushed',
+                                               '13' => 'enthralled',
+                                               '130' => 'devious',
+                                               '131' => 'thankful',
+                                               '132' => 'grateful',
+                                               '133' => 'jealous',
+                                               '134' => 'nervous',
+                                               '14' => 'exhausted',
+                                               '15' => 'happy',
+                                               '16' => 'high',
+                                               '17' => 'horny',
+                                               '18' => 'hungry',
+                                               '19' => 'infuriated',
+                                               '2' => 'angry',
+                                               '20' => 'irate',
+                                               '21' => 'jubilant',
+                                               '22' => 'lonely',
+                                               '23' => 'moody',
+                                               '24' => 'pissed off',
+                                               '25' => 'sad',
+                                               '26' => 'satisfied',
+                                               '27' => 'sore',
+                                               '28' => 'stressed',
+                                               '29' => 'thirsty',
+                                               '3' => 'annoyed',
+                                               '30' => 'thoughtful',
+                                               '31' => 'tired',
+                                               '32' => 'touched',
+                                               '33' => 'lazy',
+                                               '34' => 'drunk',
+                                               '35' => 'ditzy',
+                                               '36' => 'mischievous',
+                                               '37' => 'morose',
+                                               '38' => 'gloomy',
+                                               '39' => 'melancholy',
+                                               '4' => 'anxious',
+                                               '40' => 'drained',
+                                               '41' => 'excited',
+                                               '42' => 'relieved',
+                                               '43' => 'hopeful',
+                                               '44' => 'amused',
+                                               '45' => 'determined',
+                                               '46' => 'scared',
+                                               '47' => 'frustrated',
+                                               '48' => 'indescribable',
+                                               '49' => 'sleepy',
+                                               '5' => 'bored',
+                                               '51' => 'groggy',
+                                               '52' => 'hyper',
+                                               '53' => 'relaxed',
+                                               '54' => 'restless',
+                                               '55' => 'disappointed',
+                                               '56' => 'curious',
+                                               '57' => 'mellow',
+                                               '58' => 'peaceful',
+                                               '59' => 'bouncy',
+                                               '6' => 'confused',
+                                               '60' => 'nostalgic',
+                                               '61' => 'okay',
+                                               '62' => 'rejuvenated',
+                                               '63' => 'complacent',
+                                               '64' => 'content',
+                                               '65' => 'indifferent',
+                                               '66' => 'silly',
+                                               '67' => 'flirty',
+                                               '68' => 'calm',
+                                               '69' => 'refreshed',
+                                               '7' => 'crappy',
+                                               '70' => 'optimistic',
+                                               '71' => 'pessimistic',
+                                               '72' => 'giggly',
+                                               '73' => 'pensive',
+                                               '74' => 'uncomfortable',
+                                               '75' => 'lethargic',
+                                               '76' => 'listless',
+                                               '77' => 'recumbent',
+                                               '78' => 'exanimate',
+                                               '79' => 'embarrassed',
+                                               '8' => 'cranky',
+                                               '80' => 'envious',
+                                               '81' => 'sympathetic',
+                                               '82' => 'sick',
+                                               '83' => 'hot',
+                                               '84' => 'cold',
+                                               '85' => 'worried',
+                                               '86' => 'loved',
+                                               '87' => 'awake',
+                                               '88' => 'working',
+                                               '89' => 'productive',
+                                               '9' => 'depressed',
+                                               '90' => 'accomplished',
+                                               '91' => 'busy',
+                                               '92' => 'blah',
+                                               '93' => 'full',
+                                               '95' => 'grumpy',
+                                               '96' => 'weird',
+                                               '97' => 'nauseated',
+                                               '98' => 'ecstatic',
+                                               '99' => 'chipper' );
 
        function header() {
                echo '<div class="wrap">';
                screen_icon();
 
        function header() {
                echo '<div class="wrap">';
                screen_icon();
-               echo '<h2>'.__('Import LiveJournal').'</h2>';
+               echo '<h2>' . __( 'Import LiveJournal' ) . '</h2>';
        }
 
        function footer() {
                echo '</div>';
        }
 
        }
 
        function footer() {
                echo '</div>';
        }
 
-       function unhtmlentities($string) { // From php.net for < 4.3 compat
-               $trans_tbl = get_html_translation_table(HTML_ENTITIES);
-               $trans_tbl = array_flip($trans_tbl);
-               return strtr($string, $trans_tbl);
-       }
-
        function greet() {
        function greet() {
-               echo '<div class="narrow">';
-               echo '<p>'.__('Howdy! Upload your LiveJournal XML export file and we&#8217;ll import the posts into this blog.').'</p>';
-               echo '<p>'.__('Choose a LiveJournal XML file to upload, then click Upload file and import.').'</p>';
-               wp_import_upload_form("admin.php?import=livejournal&amp;step=1");
-               echo '</div>';
+               ?>
+               <div class="narrow">
+               <form action="admin.php?import=livejournal" method="post">
+               <?php wp_nonce_field( 'lj-api-import' ) ?>
+               <?php if ( get_option( 'ljapi_username' ) && get_option( 'ljapi_password' ) ) : ?>
+                       <input type="hidden" name="step" value="<?php echo esc_attr( get_option( 'ljapi_step' ) ) ?>" />
+                       <p><?php _e( 'It looks like you attempted to import your LiveJournal posts previously and got interrupted.' ) ?></p>
+                       <p class="submit">
+                               <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Continue previous import' ) ?>" />
+                       </p>
+                       <p class="submitbox"><a href="<?php echo esc_url($_SERVER['PHP_SELF'] . '?import=livejournal&amp;step=-1&amp;_wpnonce=' . wp_create_nonce( 'lj-api-import' ) . '&amp;_wp_http_referer=' . esc_attr( $_SERVER['REQUEST_URI'] )) ?>" class="deletion submitdelete"><?php _e( 'Cancel &amp; start a new import' ) ?></a></p>
+                       <p>
+               <?php else : ?>
+                       <input type="hidden" name="step" value="1" />
+                       <input type="hidden" name="login" value="true" />
+                       <p><?php _e( 'Howdy! This importer allows you to connect directly to LiveJournal and download all your entries and comments' ) ?></p>
+                       <p><?php _e( 'Enter your LiveJournal username and password below so we can connect to your account:' ) ?></p>
+
+                       <table class="form-table">
+
+                       <tr>
+                       <th scope="row"><label for="lj_username"><?php _e( 'LiveJournal Username' ) ?></label></th>
+                       <td><input type="text" name="lj_username" id="lj_username" class="regular-text" /></td>
+                       </tr>
+
+                       <tr>
+                       <th scope="row"><label for="lj_password"><?php _e( 'LiveJournal Password' ) ?></label></th>
+                       <td><input type="password" name="lj_password" id="lj_password" class="regular-text" /></td>
+                       </tr>
+
+                       </table>
+
+                       <p><?php _e( 'If you have any entries on LiveJournal which are marked as private, they will be password-protected when they are imported so that only people who know the password can see them.' ) ?></p>
+                       <p><?php _e( 'If you don&#8217;t enter a password, ALL ENTRIES from your LiveJournal will be imported as public posts in WordPress.' ) ?></p>
+                       <p><?php _e( 'Enter the password you would like to use for all protected entries here:' ) ?></p>
+                       <table class="form-table">
+
+                       <tr>
+                       <th scope="row"><label for="protected_password"><?php _e( 'Protected Post Password' ) ?></label></th>
+                       <td><input type="text" name="protected_password" id="protected_password" class="regular-text" /></td>
+                       </tr>
+
+                       </table>
+
+                       <p><?php _e( "<strong>WARNING:</strong> This can take a really long time if you have a lot of entries in your LiveJournal, or a lot of comments. Ideally, you should only start this process if you can leave your computer alone while it finishes the import." ) ?></p>
+
+                       <p class="submit">
+                               <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Connect to LiveJournal and Import' ) ?>" />
+                       </p>
+
+                       <p><?php _e( '<strong>NOTE:</strong> If the import process is interrupted for <em>any</em> reason, come back to this page and it will continue from where it stopped automatically.' ) ?></p>
+
+                       <noscript>
+                               <p><?php _e( '<strong>NOTE:</strong> You appear to have JavaScript disabled, so you will need to manually click through each step of this importer. If you enable JavaScript, it will step through automatically.' ) ?></p>
+                       </noscript>
+               <?php endif; ?>
+               </form>
+               </div>
+               <?php
        }
 
        }
 
-       function import_posts() {
-               global $wpdb, $current_user;
+       function download_post_meta() {
+               $total           = (int) get_option( 'ljapi_total' );
+               $count           = (int) get_option( 'ljapi_count' );
+               $lastsync        = get_option( 'ljapi_lastsync' );
+               if ( !$lastsync ) {
+                       update_option( 'ljapi_lastsync', '1900-01-01 00:00:00' );
+               }
+               $sync_item_times = get_option( 'ljapi_sync_item_times' );
+               if ( !is_array( $sync_item_times ) )
+                       $sync_item_times = array();
+
+               do {
+                       $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync' ) ) );
+                       $synclist = $this->lj_ixr( 'syncitems', array( 'ver' => 1, 'lastsync' => $lastsync ) );
+                       if ( is_wp_error( $synclist ) )
+                               return $synclist;
+
+                       // Keep track of if we've downloaded everything
+                       $total = $synclist['total'];
+                       $count = $synclist['count'];
 
 
-               set_magic_quotes_runtime(0);
-               $importdata = file($this->file); // Read the file into an array
-               $importdata = implode('', $importdata); // squish it
-               $importdata = str_replace(array ("\r\n", "\r"), "\n", $importdata);
+                       foreach ( $synclist['syncitems'] as $event ) {
+                               if ( substr( $event['item'], 0, 2 ) == 'L-' ) {
+                                       $sync_item_times[ str_replace( 'L-', '', $event['item'] ) ] = $event['time'];
+                                       if ( $event['time'] > $lastsync ) {
+                                               $lastsync = $event['time'];
+                                               update_option( 'ljapi_lastsync', $lastsync );
+                                       }
+                               }
+                       }
+               } while ( $total > $count );
+               // endwhile - all post meta is cached locally
+               unset( $synclist );
+               update_option( 'ljapi_sync_item_times', $sync_item_times );
+               update_option( 'ljapi_total', $total );
+               update_option( 'ljapi_count', $count );
 
 
-               preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts);
-               $posts = $posts[1];
-               unset($importdata);
+               echo '<p>' . __( 'Post metadata has been downloaded, proceeding with posts...' ) . '</p>';
+       }
+
+       function download_post_bodies() {
+               $imported_count  = (int) get_option( 'ljapi_imported_count' );
+               $sync_item_times = get_option( 'ljapi_sync_item_times' );
+               $lastsync        = get_option( 'ljapi_lastsync_posts' );
+               if ( !$lastsync )
+                       update_option( 'ljapi_lastsync_posts', date( 'Y-m-d H:i:s', 0 ) );
+
+               $count = 0;
                echo '<ol>';
                echo '<ol>';
-               foreach ($posts as $post) {
-                       preg_match('|<subject>(.*?)</subject>|is', $post, $post_title);
-                       $post_title = $wpdb->escape(trim($post_title[1]));
-                       if ( empty($post_title) ) {
-                               preg_match('|<itemid>(.*?)</itemid>|is', $post, $post_title);
-                               $post_title = $wpdb->escape(trim($post_title[1]));
-                       }
-
-                       preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date);
-                       $post_date = strtotime($post_date[1]);
-                       $post_date = date('Y-m-d H:i:s', $post_date);
-
-                       preg_match('|<event>(.*?)</event>|is', $post, $post_content);
-                       $post_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($post_content[1]));
-                       $post_content = $this->unhtmlentities($post_content);
-
-                       // Clean up content
-                       $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content);
-                       $post_content = str_replace('<br>', '<br />', $post_content);
-                       $post_content = str_replace('<hr>', '<hr />', $post_content);
-                       $post_content = $wpdb->escape($post_content);
-
-                       $post_author = $current_user->ID;
-                       $post_status = 'publish';
-
-                       echo '<li>';
-                       if ($post_id = post_exists($post_title, $post_content, $post_date)) {
-                               printf(__('Post <em>%s</em> already exists.'), stripslashes($post_title));
-                       } else {
-                               printf(__('Importing post <em>%s</em>...'), stripslashes($post_title));
-                               $postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
-                               $post_id = wp_insert_post($postdata);
-                               if ( is_wp_error( $post_id ) )
-                                       return $post_id;
-                               if (!$post_id) {
-                                       _e("Couldn't get post ID");
-                                       echo '</li>';
-                                       break;
+               do {
+                       $lastsync = date( 'Y-m-d H:i:s', strtotime( get_option( 'ljapi_lastsync_posts' ) ) );
+
+                       // Get the batch of items that match up with the syncitems list
+                       $itemlist = $this->lj_ixr( 'getevents', array( 'ver' => 1,
+                                                                                                                       'selecttype' => 'syncitems',
+                                                                                                                       'lineendings' => 'pc',
+                                                                                                                       'lastsync' => $lastsync ) );
+                       if ( is_wp_error( $itemlist ) )
+                               return $itemlist;
+
+                       if ( $num = count( $itemlist['events'] ) ) {
+                               for ( $e = 0; $e < count( $itemlist['events'] ); $e++ ) {
+                                       $event = $itemlist['events'][$e];
+                                       $imported_count++;
+                                       $inserted = $this->import_post( $event );
+                                       if ( is_wp_error( $inserted ) )
+                                               return $inserted;
+                                       if ( $sync_item_times[ $event['itemid'] ] > $lastsync )
+                                               $lastsync = $sync_item_times[ $event['itemid'] ];
+                                       wp_cache_flush();
                                }
                                }
+                               update_option( 'ljapi_lastsync_posts',  $lastsync );
+                               update_option( 'ljapi_imported_count',  $imported_count );
+                               update_option( 'ljapi_last_sync_count', $num );
                        }
                        }
+                       $count++;
+               } while ( $num > 0 && $count < 3 ); // Doing up to 3 requests at a time to avoid memory problems
 
 
-                       preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
-                       $comments = $comments[1];
-
-                       if ( $comments ) {
-                               $comment_post_ID = (int) $post_id;
-                               $num_comments = 0;
-                               foreach ($comments as $comment) {
-                                       preg_match('|<event>(.*?)</event>|is', $comment, $comment_content);
-                                       $comment_content = str_replace(array ('<![CDATA[', ']]>'), '', trim($comment_content[1]));
-                                       $comment_content = $this->unhtmlentities($comment_content);
-
-                                       // Clean up content
-                                       $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content);
-                                       $comment_content = str_replace('<br>', '<br />', $comment_content);
-                                       $comment_content = str_replace('<hr>', '<hr />', $comment_content);
-                                       $comment_content = $wpdb->escape($comment_content);
-
-                                       preg_match('|<eventtime>(.*?)</eventtime>|is', $comment, $comment_date);
-                                       $comment_date = trim($comment_date[1]);
-                                       $comment_date = date('Y-m-d H:i:s', strtotime($comment_date));
-
-                                       preg_match('|<name>(.*?)</name>|is', $comment, $comment_author);
-                                       $comment_author = $wpdb->escape(trim($comment_author[1]));
-
-                                       preg_match('|<email>(.*?)</email>|is', $comment, $comment_author_email);
-                                       $comment_author_email = $wpdb->escape(trim($comment_author_email[1]));
-
-                                       $comment_approved = 1;
-                                       // Check if it's already there
-                                       if (!comment_exists($comment_author, $comment_date)) {
-                                               $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_date', 'comment_content', 'comment_approved');
-                                               $commentdata = wp_filter_comment($commentdata);
-                                               wp_insert_comment($commentdata);
-                                               $num_comments++;
-                                       }
+               // Used so that step1 knows when to stop posting back on itself
+               update_option( 'ljapi_last_sync_count', $num );
+
+               // Counter just used to show progress to user
+               update_option( 'ljapi_post_batch', ( (int) get_option( 'ljapi_post_batch' ) + 1 ) );
+
+               echo '</ol>';
+       }
+
+       function import_post( $post ) {
+               global $wpdb;
+
+               // Make sure we haven't already imported this one
+               if ( $this->get_wp_post_ID( $post['itemid'] ) )
+                       return;
+
+               $user = wp_get_current_user();
+               $post_author      = $user->ID;
+               $post['security'] = !empty( $post['security'] ) ? $post['security'] : '';
+               $post_status      = ( 'private' == trim( $post['security'] ) ) ? 'private' : 'publish'; // Only me
+               $post_password    = ( 'usemask' == trim( $post['security'] ) ) ? $this->protected_password : ''; // "Friends" via password
+
+               // For some reason, LJ sometimes sends a date as "2004-04-1408:38:00" (no space btwn date/time)
+               $post_date = $post['eventtime'];
+               if ( 18 == strlen( $post_date ) )
+                       $post_date = substr( $post_date, 0, 10 ) . ' ' . substr( $post_date, 10 );
+
+               // Cleaning up and linking the title
+               $post_title = isset( $post['subject'] ) ? trim( $post['subject'] ) : '';
+               $post_title = $this->translate_lj_user( $post_title ); // Translate it, but then we'll strip the link
+               $post_title = strip_tags( $post_title ); // Can't have tags in the title in WP
+               $post_title = $wpdb->escape( $post_title );
+
+               // Clean up content
+               $post_content = $post['event'];
+               $post_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $post_content );
+               // XHTMLize some tags
+               $post_content = str_replace( '<br>', '<br />', $post_content );
+               $post_content = str_replace( '<hr>', '<hr />', $post_content );
+               // lj-cut ==>  <!--more-->
+               $post_content = preg_replace( '|<lj-cut text="([^"]*)">|is', '<!--more $1-->', $post_content );
+               $post_content = str_replace( array( '<lj-cut>', '</lj-cut>' ), array( '<!--more-->', '' ), $post_content );
+               $first = strpos( $post_content, '<!--more' );
+               $post_content = substr( $post_content, 0, $first + 1 ) . preg_replace( '|<!--more(.*)?-->|sUi', '', substr( $post_content, $first + 1 ) );
+               // lj-user ==>  a href
+               $post_content = $this->translate_lj_user( $post_content );
+               //$post_content = force_balance_tags( $post_content );
+               $post_content = $wpdb->escape( $post_content );
+
+               // Handle any tags associated with the post
+               $tags_input = !empty( $post['props']['taglist'] ) ? $post['props']['taglist'] : '';
+
+               // Check if comments are closed on this post
+               $comment_status = !empty( $post['props']['opt_nocomments'] ) ? 'closed' : 'open';
+
+               echo '<li>';
+               if ( $post_id = post_exists( $post_title, $post_content, $post_date ) ) {
+                       printf( __( 'Post <strong>%s</strong> already exists.' ), stripslashes( $post_title ) );
+               } else {
+                       printf( __( 'Imported post <strong>%s</strong>...' ), stripslashes( $post_title ) );
+                       $postdata = compact( 'post_author', 'post_date', 'post_content', 'post_title', 'post_status', 'post_password', 'tags_input', 'comment_status' );
+                       $post_id = wp_insert_post( $postdata, true );
+                       if ( is_wp_error( $post_id ) ) {
+                               if ( 'empty_content' == $post_id->get_error_code() )
+                                       return; // Silent skip on "empty" posts
+                               return $post_id;
+                       }
+                       if ( !$post_id ) {
+                               _e( 'Couldn&#8217;t get post ID (creating post failed!)' );
+                               echo '</li>';
+                               return new WP_Error( 'insert_post_failed', __( 'Failed to create post.' ) );
+                       }
+
+                       // Handle all the metadata for this post
+                       $this->insert_postmeta( $post_id, $post );
+               }
+               echo '</li>';
+       }
+
+       // Convert lj-user tags to links to that user
+       function translate_lj_user( $str ) {
+               return preg_replace( '|<lj\s+user\s*=\s*["\']([\w-]+)["\']>|', '<a href="http://$1.livejournal.com/" class="lj-user">$1</a>', $str );
+       }
+
+       function insert_postmeta( $post_id, $post ) {
+               // Need the original LJ id for comments
+               add_post_meta( $post_id, 'lj_itemid', $post['itemid'] );
+
+               // And save the permalink on LJ in case we want to link back or something
+               add_post_meta( $post_id, 'lj_permalink', $post['url'] );
+
+               // Supports the following "props" from LJ, saved as lj_<prop_name> in wp_postmeta
+               //              Adult Content - adult_content
+               //              Location - current_coords + current_location
+               //              Mood - current_mood (translated from current_moodid)
+               //              Music - current_music
+               //              Userpic - picture_keyword
+               foreach ( array( 'adult_content', 'current_coords', 'current_location', 'current_moodid', 'current_music', 'picture_keyword' ) as $prop ) {
+                       if ( !empty( $post['props'][$prop] ) ) {
+                               if ( 'current_moodid' == $prop ) {
+                                       $prop = 'current_mood';
+                                       $val = $this->moods[ $post['props']['current_moodid'] ];
+                               } else {
+                                       $val = $post['props'][$prop];
                                }
                                }
+                               add_post_meta( $post_id, 'lj_' . $prop, $val );
                        }
                        }
-                       if ( $num_comments ) {
-                               echo ' ';
-                               printf(__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);
+               }
+       }
+
+       // Set up a session (authenticate) with LJ
+       function get_session() {
+               // Get a session via XMLRPC
+               $cookie = $this->lj_ixr( 'sessiongenerate', array( 'ver' => 1, 'expiration' => 'short' ) );
+               if ( is_wp_error( $cookie ) )
+                       return new WP_Error( 'cookie', __( 'Could not get a cookie from LiveJournal. Please try again soon.' ) );
+               return new WP_Http_Cookie( array( 'name' => 'ljsession', 'value' => $cookie['ljsession'] ) );
+       }
+
+       // Loops through and gets comment meta from LJ in batches
+       function download_comment_meta() {
+               $cookie = $this->get_session();
+               if ( is_wp_error( $cookie ) )
+                       return $cookie;
+
+               // Load previous state (if any)
+               $this->usermap = (array) get_option( 'ljapi_usermap' );
+               $maxid         = get_option( 'ljapi_maxid' ) ? get_option( 'ljapi_maxid' ) : 1;
+               $highest_id    = get_option( 'ljapi_highest_id' ) ? get_option( 'ljapi_highest_id' ) : 0;
+
+               // We need to loop over the metadata request until we have it all
+               while ( $maxid > $highest_id ) {
+                       // Now get the meta listing
+                       $results = wp_remote_get( $this->comments_url . '?get=comment_meta&startid=' . ( $highest_id + 1 ),
+                                                                               array( 'cookies' => array( $cookie ), 'timeout' => 20 ) );
+                       if ( is_wp_error( $results ) )
+                               return new WP_Error( 'comment_meta', __( 'Failed to retrieve comment meta information from LiveJournal. Please try again soon.' ) );
+
+                       $results = wp_remote_retrieve_body( $results );
+
+                       // Get the maxid so we know if we have them all yet
+                       preg_match( '|<maxid>(\d+)</maxid>|', $results, $matches );
+                       if ( 0 == $matches[1] ) {
+                               // No comment meta = no comments for this journal
+                               echo '<p>' . __( 'You have no comments to import!' ) . '</p>';
+                               update_option( 'ljapi_highest_id', 1 );
+                               update_option( 'ljapi_highest_comment_id', 1 );
+                               return false; // Bail out of comment importing entirely
+                       }
+                       $maxid = !empty( $matches[1] ) ? $matches[1] : $maxid;
+
+                       // Parse comments and get highest id available
+                       preg_match_all( '|<comment id=\'(\d+)\'|is', $results, $matches );
+                       foreach ( $matches[1] as $id ) {
+                               if ( $id > $highest_id )
+                                       $highest_id = $id;
                        }
                        }
-                       echo '</li>';
+
+                       // Parse out the list of user mappings, and add it to the known list
+                       preg_match_all( '|<usermap id=\'(\d+)\' user=\'([^\']+)\' />|', $results, $matches );
+                       foreach ( $matches[1] as $count => $userid )
+                               $this->usermap[$userid] = $matches[2][$count]; // need this in memory for translating ids => names
+
+                       wp_cache_flush();
                }
                }
-               echo '</ol>';
+               // endwhile - should have seen all comment meta at this point
+
+               update_option( 'ljapi_usermap',    $this->usermap );
+               update_option( 'ljapi_maxid',      $maxid );
+               update_option( 'ljapi_highest_id', $highest_id );
+
+               echo '<p>' . __( ' Comment metadata downloaded successfully, proceeding with comment bodies...' ) . '</p>';
+
+               return true;
        }
 
        }
 
-       function import() {
-               $file = wp_import_handle_upload();
-               if ( isset($file['error']) ) {
-                       echo $file['error'];
-                       return;
+       // Downloads actual comment bodies from LJ
+       // Inserts them all directly to the DB, with additional info stored in "spare" fields
+       function download_comment_bodies() {
+               global $wpdb;
+               $cookie = $this->get_session();
+               if ( is_wp_error( $cookie ) )
+                       return $cookie;
+
+               // Load previous state (if any)
+               $this->usermap = (array) get_option( 'ljapi_usermap' );
+               $maxid         = get_option( 'ljapi_maxid' ) ? (int) get_option( 'ljapi_maxid' ) : 1;
+               $highest_id    = (int) get_option( 'ljapi_highest_comment_id' );
+               $loop = 0;
+               while ( $maxid > $highest_id && $loop < 5 ) { // We do 5 loops per call to avoid memory limits
+                       $loop++;
+
+                       // Get a batch of comments, using the highest_id we've already got as a starting point
+                       $results = wp_remote_get( $this->comments_url . '?get=comment_body&startid=' . ( $highest_id + 1 ),
+                                                                               array( 'cookies' => array( $cookie ), 'timeout' => 20 ) );
+                       if ( is_wp_error( $results ) )
+                               return new WP_Error( 'comment_bodies', __( 'Failed to retrieve comment bodies from LiveJournal. Please try again soon.' ) );
+
+                       $results = wp_remote_retrieve_body( $results );
+
+                       // Parse out each comment and insert directly
+                       preg_match_all( '|<comment id=\'(\d+)\'.*</comment>|iUs', $results, $matches );
+                       for ( $c = 0; $c < count( $matches[0] ); $c++ ) {
+                               // Keep track of highest id seen
+                               if ( $matches[1][$c] > $highest_id ) {
+                                       $highest_id = $matches[1][$c];
+                                       update_option( 'ljapi_highest_comment_id', $highest_id );
+                               }
+
+                               $comment = $matches[0][$c];
+
+                               // Filter out any captured, deleted comments (nothing useful to import)
+                               $comment = preg_replace( '|<comment id=\'\d+\' jitemid=\'\d+\' posterid=\'\d+\' state=\'D\'[^/]*/>|is', '', $comment );
+
+                               // Parse this comment into an array and insert
+                               $comment = $this->parse_comment( $comment );
+                               $id = wp_insert_comment( $comment );
+
+                               // Clear cache
+                               clean_comment_cache( $id );
+                       }
+
+                       // Clear cache to preseve memory
+                       wp_cache_flush();
                }
                }
+               // endwhile - all comments downloaded and ready for bulk processing
 
 
-               $this->file = $file['file'];
-               $result = $this->import_posts();
-               if ( is_wp_error( $result ) )
-                       return $result;
-               wp_import_cleanup($file['id']);
-               do_action('import_done', 'livejournal');
+               // Counter just used to show progress to user
+               update_option( 'ljapi_comment_batch', ( (int) get_option( 'ljapi_comment_batch' ) + 1 ) );
 
 
-               echo '<h3>';
-               printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
-               echo '</h3>';
+               return true;
+       }
+
+       // Takes a block of XML and parses out all the elements of the comment
+       function parse_comment( $comment ) {
+               global $wpdb;
+
+               // Get the top-level attributes
+               preg_match( '|<comment([^>]+)>|i', $comment, $attribs );
+               preg_match( '| id=\'(\d+)\'|i', $attribs[1], $matches );
+               $lj_comment_ID = $matches[1];
+               preg_match( '| jitemid=\'(\d+)\'|i', $attribs[1], $matches );
+               $lj_comment_post_ID = $matches[1];
+               preg_match( '| posterid=\'(\d+)\'|i', $attribs[1], $matches );
+               $comment_author_ID = isset( $matches[1] ) ? $matches[1] : 0;
+               preg_match( '| parentid=\'(\d+)\'|i', $attribs[1], $matches ); // optional
+               $lj_comment_parent = isset( $matches[1] ) ? $matches[1] : 0;
+               preg_match( '| state=\'([SDFA])\'|i', $attribs[1], $matches ); // optional
+               $lj_comment_state = isset( $matches[1] ) ? $matches[1] : 'A';
+
+               // Clean up "subject" - this will become the first line of the comment in WP
+               preg_match( '|<subject>(.*)</subject>|is', $comment, $matches );
+               if ( isset( $matches[1] ) ) {
+                       $comment_subject = $wpdb->escape( trim( $matches[1] ) );
+                       if ( 'Re:' == $comment_subject )
+                               $comment_subject = '';
+               }
+
+               // Get the body and HTMLize it
+               preg_match( '|<body>(.*)</body>|is', $comment, $matches );
+               $comment_content = !empty( $comment_subject ) ? $comment_subject . "\n\n" . $matches[1] : $matches[1];
+               $comment_content = @html_entity_decode( $comment_content, ENT_COMPAT, get_option('blog_charset') );
+               $comment_content = str_replace( '&apos;', "'", $comment_content );
+               $comment_content = wpautop( $comment_content );
+               $comment_content = str_replace( '<br>', '<br />', $comment_content );
+               $comment_content = str_replace( '<hr>', '<hr />', $comment_content );
+               $comment_content = preg_replace_callback( '|<(/?[A-Z]+)|', create_function( '$match', 'return "<" . strtolower( $match[1] );' ), $comment_content );
+               $comment_content = $wpdb->escape( trim( $comment_content ) );
+
+               // Get and convert the date
+               preg_match( '|<date>(.*)</date>|i', $comment, $matches );
+               $comment_date = trim( str_replace( array( 'T', 'Z' ), ' ', $matches[1] ) );
+
+               // Grab IP if available
+               preg_match( '|<property name=\'poster_ip\'>(.*)</property>|i', $comment, $matches ); // optional
+               $comment_author_IP = isset( $matches[1] ) ? $matches[1] : '';
+
+               // Try to get something useful for the comment author, especially if it was "my" comment
+               $author = ( empty( $comment_author_ID ) || empty( $this->usermap[$comment_author_ID] ) || substr( $this->usermap[$comment_author_ID], 0, 4 ) == 'ext_' ) ? __( 'Anonymous' ) : $this->usermap[$comment_author_ID];
+               if ( get_option( 'ljapi_username' ) == $author ) {
+                       $user    = wp_get_current_user();
+                       $user_id = $user->ID;
+                       $author  = $user->display_name;
+                       $url     = trailingslashit( get_option( 'home' ) );
+               } else {
+                       $user_id = 0;
+                       $url     = ( __( 'Anonymous' ) == $author ) ? '' : 'http://' . $author . '.livejournal.com/';
+               }
+
+               // Send back the array of details
+               return array( 'lj_comment_ID' => $lj_comment_ID,
+                                               'lj_comment_post_ID' => $lj_comment_post_ID,
+                                               'lj_comment_parent' => ( !empty( $lj_comment_parent ) ? $lj_comment_parent : 0 ),
+                                               'lj_comment_state' => $lj_comment_state,
+                                               'comment_post_ID' => $this->get_wp_post_ID( $lj_comment_post_ID ),
+                                               'comment_author' => $author,
+                                               'comment_author_url' => $url,
+                                               'comment_author_email' => '',
+                                               'comment_content' => $comment_content,
+                                               'comment_date' => $comment_date,
+                                               'comment_author_IP' => ( !empty( $comment_author_IP ) ? $comment_author_IP : '' ),
+                                               'comment_approved' => ( in_array( $lj_comment_state, array( 'A', 'F' ) ) ? 1 : 0 ),
+                                               'comment_karma' => $lj_comment_ID, // Need this and next value until rethreading is done
+                                               'comment_agent' => $lj_comment_parent,
+                                               'comment_type' => 'livejournal',  // Custom type, so we can find it later for processing
+                                               'user_ID' => $user_id
+                                       );
+       }
+
+
+       // Gets the post_ID that a LJ post has been saved as within WP
+       function get_wp_post_ID( $post ) {
+               global $wpdb;
+
+               if ( empty( $this->postmap[$post] ) )
+                       $this->postmap[$post] = (int) $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'lj_itemid' AND meta_value = %d", $post ) );
+
+               return $this->postmap[$post];
+       }
+
+       // Gets the comment_ID that a LJ comment has been saved as within WP
+       function get_wp_comment_ID( $comment ) {
+               global $wpdb;
+               if ( empty( $this->commentmap[$comment] ) )
+                       $this->commentmap[$comment] = $wpdb->get_var( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_karma = %d", $comment ) );
+               return $this->commentmap[$comment];
+       }
+
+       function lj_ixr() {
+               if ( $challenge = $this->ixr->query( 'LJ.XMLRPC.getchallenge' ) ) {
+                       $challenge = $this->ixr->getResponse();
+               }
+               if ( isset( $challenge['challenge'] ) ) {
+                       $params = array( 'username' => $this->username,
+                                                       'auth_method' => 'challenge',
+                                                       'auth_challenge' => $challenge['challenge'],
+                                                       'auth_response' => md5( $challenge['challenge'] . md5( $this->password ) ) );
+               } else {
+                       return new WP_Error( 'IXR', __( 'LiveJournal is not responding to authentication requests. Please wait a while and then try again.' ) );
+               }
+
+               $args = func_get_args();
+        $method = array_shift( $args );
+               if ( isset( $args[0] ) )
+                       $params = array_merge( $params, $args[0] );
+               if ( $this->ixr->query( 'LJ.XMLRPC.' . $method, $params ) ) {
+                       return $this->ixr->getResponse();
+               } else {
+                       return new WP_Error( 'IXR', __( 'XML-RPC Request Failed -- ' ) . $this->ixr->getErrorCode() . ': ' . $this->ixr->getErrorMessage() );
+               }
        }
 
        function dispatch() {
        }
 
        function dispatch() {
-               if (empty ($_GET['step']))
+               if ( empty( $_REQUEST['step'] ) )
                        $step = 0;
                else
                        $step = 0;
                else
-                       $step = (int) $_GET['step'];
+                       $step = (int) $_REQUEST['step'];
 
                $this->header();
 
 
                $this->header();
 
-               switch ($step) {
+               switch ( $step ) {
+                       case -1 :
+                               $this->cleanup();
+                               // Intentional no break
                        case 0 :
                                $this->greet();
                                break;
                        case 1 :
                        case 0 :
                                $this->greet();
                                break;
                        case 1 :
-                               check_admin_referer('import-upload');
-                               $result = $this->import();
-                               if ( is_wp_error( $result ) )
-                                       echo $result->get_error_message();
+                       case 2 :
+                       case 3 :
+                               check_admin_referer( 'lj-api-import' );
+                               $result = $this->{ 'step' . $step }();
+                               if ( is_wp_error( $result ) ) {
+                                       $this->throw_error( $result, $step );
+                               }
                                break;
                }
 
                $this->footer();
        }
 
                                break;
                }
 
                $this->footer();
        }
 
-       function LJ_Import() {
-               // Nothing.
+       // Technically the first half of step 1, this is separated to allow for AJAX
+       // calls. Sets up some variables and options and confirms authentication.
+       function setup() {
+               global $verified;
+               // Get details from form or from DB
+               if ( !empty( $_POST['lj_username'] ) && !empty( $_POST['lj_password'] ) ) {
+                       // Store details for later
+                       $this->username = $_POST['lj_username'];
+                       $this->password = $_POST['lj_password'];
+                       update_option( 'ljapi_username', $this->username );
+                       update_option( 'ljapi_password', $this->password );
+               } else {
+                       $this->username = get_option( 'ljapi_username' );
+                       $this->password = get_option( 'ljapi_password' );
+               }
+
+               // This is the password to set on protected posts
+               if ( !empty( $_POST['protected_password'] ) ) {
+                       $this->protected_password = $_POST['protected_password'];
+                       update_option( 'ljapi_protected_password', $this->protected_password );
+               } else {
+                       $this->protected_password = get_option( 'ljapi_protected_password' );
+               }
+
+               // Login to confirm the details are correct
+               if ( empty( $this->username ) || empty( $this->password ) ) {
+                       ?>
+                       <p><?php _e( 'Please enter your LiveJournal username <em>and</em> password so we can download your posts and comments.' ) ?></p>
+                       <p><a href="<?php echo esc_url($_SERVER['PHP_SELF'] . '?import=livejournal&amp;step=-1&amp;_wpnonce=' . wp_create_nonce( 'lj-api-import' ) . '&amp;_wp_http_referer=' . esc_attr( str_replace( '&step=1', '', $_SERVER['REQUEST_URI'] ) ) ) ?>"><?php _e( 'Start again' ) ?></a></p>
+                       <?php
+                       return false;
+               }
+               $verified = $this->lj_ixr( 'login' );
+               if ( is_wp_error( $verified ) ) {
+                       if ( 100 == $this->ixr->getErrorCode() || 101 == $this->ixr->getErrorCode() ) {
+                               delete_option( 'ljapi_username' );
+                               delete_option( 'ljapi_password' );
+                               delete_option( 'ljapi_protected_password' );
+                               ?>
+                               <p><?php _e( 'Logging in to LiveJournal failed. Check your username and password and try again.' ) ?></p>
+                               <p><a href="<?php echo esc_url($_SERVER['PHP_SELF'] . '?import=livejournal&amp;step=-1&amp;_wpnonce=' . wp_create_nonce( 'lj-api-import' ) . '&amp;_wp_http_referer=' . esc_attr( str_replace( '&step=1', '', $_SERVER['REQUEST_URI'] ) ) ) ?>"><?php _e( 'Start again' ) ?></a></p>
+                               <?php
+                               return false;
+                       } else {
+                               return $verified;
+                       }
+               } else {
+                       update_option( 'ljapi_verified', 'yes' );
+               }
+
+               // Set up some options to avoid them autoloading (these ones get big)
+               add_option( 'ljapi_sync_item_times',  '', '', 'no' );
+               add_option( 'ljapi_usermap',          '', '', 'no' );
+               update_option( 'ljapi_comment_batch', 0 );
+
+               return true;
+       }
+
+       // Check form inputs and start importing posts
+       function step1() {
+               global $verified;
+               set_time_limit( 0 );
+               update_option( 'ljapi_step', 1 );
+               if ( !$this->ixr ) $this->ixr = new IXR_Client( $this->ixr_url, false, 80, 30 );
+               if ( empty( $_POST['login'] ) ) {
+                       // We're looping -- load some details from DB
+                       $this->username = get_option( 'ljapi_username' );
+                       $this->password = get_option( 'ljapi_password' );
+                       $this->protected_password = get_option( 'ljapi_protected_password' );
+               } else {
+                       // First run (non-AJAX)
+                       $setup = $this->setup();
+                       if ( !$setup ) {
+                               return false;
+                       } else if ( is_wp_error( $setup ) ) {
+                               $this->throw_error( $setup, 1 );
+                               return false;
+                       }
+               }
+
+               echo '<div id="ljapi-status">';
+               echo '<h3>' . __( 'Importing Posts' ) . '</h3>';
+               echo '<p>' . __( 'We&#8217;re downloading and importing your LiveJournal posts...' ) . '</p>';
+               if ( get_option( 'ljapi_post_batch' ) && count( get_option( 'ljapi_sync_item_times' ) ) ) {
+                       $batch = count( get_option( 'ljapi_sync_item_times' ) );
+                       $batch = $count > 300 ? ceil( $batch / 300 ) : 1;
+                       echo '<p><strong>' . sprintf( __( 'Imported post batch %d of <strong>approximately</strong> %d' ), ( get_option( 'ljapi_post_batch' ) + 1 ), $batch ) . '</strong></p>';
+               }
+               ob_flush(); flush();
+
+               if ( !get_option( 'ljapi_lastsync' ) || '1900-01-01 00:00:00' == get_option( 'ljapi_lastsync' ) ) {
+                       // We haven't downloaded meta yet, so do that first
+                       $result = $this->download_post_meta();
+                       if ( is_wp_error( $result ) ) {
+                               $this->throw_error( $result, 1 );
+                               return false;
+                       }
+               }
+
+               // Download a batch of actual posts
+               $result = $this->download_post_bodies();
+               if ( is_wp_error( $result ) ) {
+                       if ( 406 == $this->ixr->getErrorCode() ) {
+                               ?>
+                               <p><strong><?php _e( 'Uh oh &ndash; LiveJournal has disconnected us because we made too many requests to their servers too quickly.' ) ?></strong></p>
+                               <p><strong><?php _e( 'We&#8217;ve saved where you were up to though, so if you come back to this importer in about 30 minutes, you should be able to continue from where you were.' ) ?></strong></p>
+                               <?php
+                               echo $this->next_step( 1, __( 'Try Again' ) );
+                               return false;
+                       } else {
+                               $this->throw_error( $result, 1 );
+                               return false;
+                       }
+               }
+
+               if ( get_option( 'ljapi_last_sync_count' ) > 0 ) {
+               ?>
+                       <form action="admin.php?import=livejournal" method="post" id="ljapi-auto-repost">
+                       <?php wp_nonce_field( 'lj-api-import' ) ?>
+                       <input type="hidden" name="step" id="step" value="1" />
+                       <p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Import the next batch' ) ?>" /> <span id="auto-message"></span></p>
+                       </form>
+                       <?php $this->auto_ajax( 'ljapi-auto-repost', 'auto-message', 0 ); ?>
+               <?php
+               } else {
+                       echo '<p>' . __( 'Your posts have all been imported, but wait &#8211; there&#8217;s more! Now we need to download &amp; import your comments.' ) . '</p>';
+                       echo $this->next_step( 2, __( 'Download my comments &raquo;' ) );
+                       $this->auto_submit();
+               }
+               echo '</div>';
+       }
+
+       // Download comments to local XML
+       function step2() {
+               set_time_limit( 0 );
+               update_option( 'ljapi_step', 2 );
+               $this->username = get_option( 'ljapi_username' );
+               $this->password = get_option( 'ljapi_password' );
+               $this->ixr = new IXR_Client( $this->ixr_url, false, 80, 30 );
+
+               echo '<div id="ljapi-status">';
+               echo '<h3>' . __( 'Downloading Comments' ) . '</h3>';
+               echo '<p>' . __( 'Now we will download your comments so we can import them (this could take a <strong>long</strong> time if you have lots of comments)...' ) . '</p>';
+               ob_flush(); flush();
+
+               if ( !get_option( 'ljapi_usermap' ) ) {
+                       // We haven't downloaded meta yet, so do that first
+                       $result = $this->download_comment_meta();
+                       if ( is_wp_error( $result ) ) {
+                               $this->throw_error( $result, 2 );
+                               return false;
+                       }
+               }
+
+               // Download a batch of actual comments
+               $result = $this->download_comment_bodies();
+               if ( is_wp_error( $result ) ) {
+                       $this->throw_error( $result, 2 );
+                       return false;
+               }
+
+               $maxid      = get_option( 'ljapi_maxid' ) ? (int) get_option( 'ljapi_maxid' ) : 1;
+               $highest_id = (int) get_option( 'ljapi_highest_comment_id' );
+               if ( $maxid > $highest_id ) {
+                       $batch = $maxid > 5000 ? ceil( $maxid / 5000 ) : 1;
+               ?>
+                       <form action="admin.php?import=livejournal" method="post" id="ljapi-auto-repost">
+                       <p><strong><?php printf( __( 'Imported comment batch %d of <strong>approximately</strong> %d' ), get_option( 'ljapi_comment_batch' ), $batch ) ?></strong></p>
+                       <?php wp_nonce_field( 'lj-api-import' ) ?>
+                       <input type="hidden" name="step" id="step" value="2" />
+                       <p><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Import the next batch' ) ?>" /> <span id="auto-message"></span></p>
+                       </form>
+                       <?php $this->auto_ajax( 'ljapi-auto-repost', 'auto-message', 0 ); ?>
+               <?php
+               } else {
+                       echo '<p>' . __( 'Your comments have all been imported now, but we still need to rebuild your conversation threads.' ) . '</p>';
+                       echo $this->next_step( 3, __( 'Rebuild my comment threads &raquo;' ) );
+                       $this->auto_submit();
+               }
+               echo '</div>';
+       }
+
+       // Re-thread comments already in the DB
+       function step3() {
+               global $wpdb;
+               set_time_limit( 0 );
+               update_option( 'ljapi_step', 3 );
+
+               echo '<div id="ljapi-status">';
+               echo '<h3>' . __( 'Threading Comments' ) . '</h3>';
+               echo '<p>' . __( 'We are now re-building the threading of your comments (this can also take a while if you have lots of comments)...' ) . '</p>';
+               ob_flush(); flush();
+
+               // Only bother adding indexes if they have over 5000 comments (arbitrary number)
+               $imported_comments = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_type = 'livejournal'" );
+               $added_indices = false;
+               if ( 5000 < $imported_comments ) {
+                       include_once(ABSPATH . 'wp-admin/includes/upgrade.php');
+                       $added_indices = true;
+                       add_clean_index( $wpdb->comments, 'comment_type'  );
+                       add_clean_index( $wpdb->comments, 'comment_karma' );
+                       add_clean_index( $wpdb->comments, 'comment_agent' );
+               }
+
+               // Get LJ comments, which haven't been threaded yet, 5000 at a time and thread them
+               while ( $comments = $wpdb->get_results( "SELECT comment_ID, comment_agent FROM {$wpdb->comments} WHERE comment_type = 'livejournal' AND comment_agent != '0' LIMIT 5000", OBJECT ) ) {
+                       foreach ( $comments as $comment ) {
+                               $wpdb->update( $wpdb->comments,
+                                                               array( 'comment_parent' => $this->get_wp_comment_ID( $comment->comment_agent ), 'comment_type' => 'livejournal-done' ),
+                                                               array( 'comment_ID' => $comment->comment_ID ) );
+                       }
+                       wp_cache_flush();
+                       $wpdb->flush();
+               }
+
+               // Revert the comments table back to normal and optimize it to reclaim space
+               if ( $added_indices ) {
+                       drop_index( $wpdb->comments, 'comment_type'  );
+                       drop_index( $wpdb->comments, 'comment_karma' );
+                       drop_index( $wpdb->comments, 'comment_agent' );
+                       $wpdb->query( "OPTIMIZE TABLE {$wpdb->comments}" );
+               }
+
+               // Clean up database and we're out
+               $this->cleanup();
+               do_action( 'import_done', 'livejournal' );
+               if ( $imported_comments > 1 )
+                       echo '<p>' . sprintf( __( "Successfully re-threaded %s comments." ), number_format( $imported_comments ) ) . '</p>';
+               echo '<h3>';
+               printf( __( 'All done. <a href="%s">Have fun!</a>' ), get_option( 'home' ) );
+               echo '</h3>';
+               echo '</div>';
+       }
+
+       // Output an error message with a button to try again.
+       function throw_error( $error, $step ) {
+               echo '<p><strong>' . $error->get_error_message() . '</strong></p>';
+               echo $this->next_step( $step, __( 'Try Again' ) );
+       }
+
+       // Returns the HTML for a link to the next page
+       function next_step( $next_step, $label, $id = 'ljapi-next-form' ) {
+               $str  = '<form action="admin.php?import=livejournal" method="post" id="' . $id . '">';
+               $str .= wp_nonce_field( 'lj-api-import', '_wpnonce', true, false );
+               $str .= wp_referer_field( false );
+               $str .= '<input type="hidden" name="step" id="step" value="' . esc_attr($next_step) . '" />';
+               $str .= '<p><input type="submit" class="button-primary" value="' . esc_attr( $label ) . '" /> <span id="auto-message"></span></p>';
+               $str .= '</form>';
+
+               return $str;
+       }
+
+       // Automatically submit the specified form after $seconds
+       // Include a friendly countdown in the element with id=$msg
+       function auto_submit( $id = 'ljapi-next-form', $msg = 'auto-message', $seconds = 10 ) {
+               ?><script type="text/javascript">
+                       next_counter = <?php echo $seconds ?>;
+                       jQuery(document).ready(function(){
+                               ljapi_msg();
+                       });
+
+                       function ljapi_msg() {
+                               str = '<?php _e( "Continuing in %d" ) ?>';
+                               jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) );
+                               if ( next_counter <= 0 ) {
+                                       if ( jQuery( '#<?php echo $id ?>' ).length ) {
+                                               jQuery( "#<?php echo $id ?> input[type='submit']" ).hide();
+                                               str = '<?php _e( "Continuing" ) ?> <img src="images/wpspin_light.gif" alt="" id="processing" align="top" />';
+                                               jQuery( '#<?php echo $msg ?>' ).html( str );
+                                               jQuery( '#<?php echo $id ?>' ).submit();
+                                               return;
+                                       }
+                               }
+                               next_counter = next_counter - 1;
+                               setTimeout('ljapi_msg()', 1000);
+                       }
+               </script><?php
+       }
+
+       // Automatically submit the form with #id to continue the process
+       // Hide any submit buttons to avoid people clicking them
+       // Display a countdown in the element indicated by $msg for "Continuing in x"
+       function auto_ajax( $id = 'ljapi-next-form', $msg = 'auto-message', $seconds = 5 ) {
+               ?><script type="text/javascript">
+                       next_counter = <?php echo $seconds ?>;
+                       jQuery(document).ready(function(){
+                               ljapi_msg();
+                       });
+
+                       function ljapi_msg() {
+                               str = '<?php _e( "Continuing in %d" ) ?>';
+                               jQuery( '#<?php echo $msg ?>' ).text( str.replace( /%d/, next_counter ) );
+                               if ( next_counter <= 0 ) {
+                                       if ( jQuery( '#<?php echo $id ?>' ).length ) {
+                                               jQuery( "#<?php echo $id ?> input[type='submit']" ).hide();
+                                               jQuery.ajaxSetup({'timeout':3600000});
+                                               str = '<?php _e( "Processing next batch." ) ?> <img src="images/wpspin_light.gif" alt="" id="processing" align="top" />';
+                                               jQuery( '#<?php echo $msg ?>' ).html( str );
+                                               jQuery('#ljapi-status').load(ajaxurl, {'action':'lj-importer',
+                                                                                                                               'step':jQuery('#step').val(),
+                                                                                                                               '_wpnonce':'<?php echo wp_create_nonce( 'lj-api-import' ) ?>',
+                                                                                                                               '_wp_http_referer':'<?php echo $_SERVER['REQUEST_URI'] ?>'});
+                                               return;
+                                       }
+                               }
+                               next_counter = next_counter - 1;
+                               setTimeout('ljapi_msg()', 1000);
+                       }
+               </script><?php
+       }
+
+       // Remove all options used during import process and
+       // set wp_comments entries back to "normal" values
+       function cleanup() {
+               global $wpdb;
+
+               delete_option( 'ljapi_username' );
+               delete_option( 'ljapi_password' );
+               delete_option( 'ljapi_protected_password' );
+               delete_option( 'ljapi_verified' );
+               delete_option( 'ljapi_total' );
+               delete_option( 'ljapi_count' );
+               delete_option( 'ljapi_lastsync' );
+               delete_option( 'ljapi_last_sync_count' );
+               delete_option( 'ljapi_sync_item_times' );
+               delete_option( 'ljapi_lastsync_posts' );
+               delete_option( 'ljapi_post_batch' );
+               delete_option( 'ljapi_imported_count' );
+               delete_option( 'ljapi_maxid' );
+               delete_option( 'ljapi_usermap' );
+               delete_option( 'ljapi_highest_id' );
+               delete_option( 'ljapi_highest_comment_id' );
+               delete_option( 'ljapi_comment_batch' );
+               delete_option( 'ljapi_step' );
+
+               $wpdb->update( $wpdb->comments,
+                                               array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ),
+                                               array( 'comment_type' => 'livejournal-done' ) );
+               $wpdb->update( $wpdb->comments,
+                                               array( 'comment_karma' => 0, 'comment_agent' => 'WP LJ Importer', 'comment_type' => '' ),
+                                               array( 'comment_type' => 'livejournal' ) );
+       }
+
+       function LJ_API_Import() {
+               $this->__construct();
+       }
+
+       function __construct() {
+               // Nothing
        }
 }
 
        }
 }
 
-$livejournal_import = new LJ_Import();
+$lj_api_import = new LJ_API_Import();
 
 
-register_importer('livejournal', __('LiveJournal'), __('Import posts from a LiveJournal XML export file.'), array ($livejournal_import, 'dispatch'));
+register_importer( 'livejournal', __( 'LiveJournal' ), __( 'Import posts from LiveJournal using their API.' ), array( $lj_api_import, 'dispatch' ) );
 ?>
 ?>
index 48d4de3b694afbd1bd46012422d6727649a4eb1b..7b7502040fdca804dc178764651c0173e10a09a8 100644 (file)
@@ -36,20 +36,20 @@ class MT_Import {
                $this->header();
 ?>
 <div class="narrow">
                $this->header();
 ?>
 <div class="narrow">
-<p><?php _e('Howdy! We&#8217;re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, either choose a file to upload and click "Upload file and import," or use FTP to upload your MT export file as <code>mt-export.txt</code> in your <code>/wp-content/</code> directory and then click "Import mt-export.txt"'); ?></p>
+<p><?php _e('Howdy! We&#8217;re about to begin importing all of your Movable Type or Typepad entries into WordPress. To begin, either choose a file to upload and click &#8220;Upload file and import&#8221;, or use FTP to upload your MT export file as <code>mt-export.txt</code> in your <code>/wp-content/</code> directory and then click "Import mt-export.txt"'); ?></p>
 
 <?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
 
 <?php wp_import_upload_form( add_query_arg('step', 1) ); ?>
-<form method="post" action="<?php echo add_query_arg('step', 1); ?>" class="import-upload-form">
+<form method="post" action="<?php echo esc_attr(add_query_arg('step', 1)); ?>" class="import-upload-form">
 
 <?php wp_nonce_field('import-upload'); ?>
 <p>
        <input type="hidden" name="upload_type" value="ftp" />
 <?php _e('Or use <code>mt-export.txt</code> in your <code>/wp-content/</code> directory'); ?></p>
 <p class="submit">
 
 <?php wp_nonce_field('import-upload'); ?>
 <p>
        <input type="hidden" name="upload_type" value="ftp" />
 <?php _e('Or use <code>mt-export.txt</code> in your <code>/wp-content/</code> directory'); ?></p>
 <p class="submit">
-<input type="submit" class="button" value="<?php echo attribute_escape(__('Import mt-export.txt')); ?>" />
+<input type="submit" class="button" value="<?php esc_attr_e('Import mt-export.txt'); ?>" />
 </p>
 </form>
 </p>
 </form>
-<p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
+<p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn&#8217;t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
 </div>
 <?php
                $this->footer();
 </div>
 <?php
                $this->footer();
@@ -194,9 +194,9 @@ class MT_Import {
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php _e('Assign Authors'); ?></h2>
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php _e('Assign Authors'); ?></h2>
-<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as admin\'s entries.'); ?></p>
+<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as admin&#8217;s entries.'); ?></p>
 <p><?php _e('Below, you can see the names of the authors of the MovableType posts in <em>italics</em>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
 <p><?php _e('Below, you can see the names of the authors of the MovableType posts in <em>italics</em>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
-<p><?php _e('If a new user is created by WordPress, a password will be randomly generated. Manually change the user\'s details if necessary.'); ?></p>
+<p><?php _e('If a new user is created by WordPress, a password will be randomly generated. Manually change the user&#8217;s details if necessary.'); ?></p>
        <?php
 
 
        <?php
 
 
@@ -207,12 +207,12 @@ class MT_Import {
                $j = -1;
                foreach ($authors as $author) {
                        ++ $j;
                $j = -1;
                foreach ($authors as $author) {
                        ++ $j;
-                       echo '<li><label>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
+                       echo '<li><label>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'. esc_attr($author) .'" name="'.'user[]'.'" maxlength="30"> <br />');
                        $this->users_form($j);
                        echo '</label></li>';
                }
 
                        $this->users_form($j);
                        echo '</label></li>';
                }
 
-               echo '<p class="submit"><input type="submit" class="button" value="'.__('Submit').'"></p>'.'<br />';
+               echo '<p class="submit"><input type="submit" class="button" value="'.esc_attr__('Submit').'"></p>'.'<br />';
                echo '</form>';
                echo '</ol></div>';
 
                echo '</form>';
                echo '</ol></div>';
 
@@ -288,7 +288,7 @@ class MT_Import {
                }
 
                if ( $num_comments )
                }
 
                if ( $num_comments )
-                       printf(' '.__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);
+                       printf(' '._n('(%s comment)', '(%s comments)', $num_comments), $num_comments);
 
                $num_pings = 0;
                foreach ( $pings as $ping ) {
 
                $num_pings = 0;
                foreach ( $pings as $ping ) {
@@ -305,7 +305,7 @@ class MT_Import {
                }
 
                if ( $num_pings )
                }
 
                if ( $num_pings )
-                       printf(' '.__ngettext('(%s ping)', '(%s pings)', $num_pings), $num_pings);
+                       printf(' '._n('(%s ping)', '(%s pings)', $num_pings), $num_pings);
 
                echo "</li>";
                //ob_flush();flush();
 
                echo "</li>";
                //ob_flush();flush();
@@ -438,10 +438,10 @@ class MT_Import {
                                $ping->comment_author = $blog;
                        } else {
                                // Processing multi-line field, check context.
                                $ping->comment_author = $blog;
                        } else {
                                // Processing multi-line field, check context.
-                               
+
                                if( !empty($line) )
                                        $line .= "\n";
                                if( !empty($line) )
                                        $line .= "\n";
-                                       
+
                                if ( 'body' == $context ) {
                                        $post->post_content .= $line;
                                } else if ( 'extended' ==  $context ) {
                                if ( 'body' == $context ) {
                                        $post->post_content .= $line;
                                } else if ( 'extended' ==  $context ) {
index 8148acf6f42a2dabf00df5acb5dc2434298a7f43..7f2e1dc1aef295a18a2d8f2dcd842593867c6599 100644 (file)
@@ -42,7 +42,7 @@ switch ($step) {
 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
 <div style="width: 48%;" class="alignleft">
 <h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
 <div style="width: 48%;" class="alignleft">
 <h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
-<input type="text" name="opml_url" id="opml_url" size="50" style="width: 90%;" value="http://" />
+<input type="text" name="opml_url" id="opml_url" size="50" class="code" style="width: 90%;" value="http://" />
 </div>
 
 <div style="width: 48%;" class="alignleft">
 </div>
 
 <div style="width: 48%;" class="alignleft">
@@ -58,13 +58,13 @@ switch ($step) {
 $categories = get_terms('link_category', 'get=all');
 foreach ($categories as $category) {
 ?>
 $categories = get_terms('link_category', 'get=all');
 foreach ($categories as $category) {
 ?>
-<option value="<?php echo $category->term_id; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->name)); ?></option>
+<option value="<?php echo $category->term_id; ?>"><?php echo esc_html(apply_filters('link_category', $category->name)); ?></option>
 <?php
 } // end foreach
 ?>
 </select></p>
 
 <?php
 } // end foreach
 ?>
 </select></p>
 
-<p class="submit"><input type="submit" name="submit" value="<?php _e('Import OPML File') ?>" /></p>
+<p class="submit"><input type="submit" name="submit" value="<?php esc_attr_e('Import OPML File') ?>" /></p>
 </form>
 
 </div>
 </form>
 
 </div>
@@ -92,6 +92,7 @@ foreach ($categories as $category) {
                        $blogrolling = true;
                } else { // try to get the upload file.
                        $overrides = array('test_form' => false, 'test_type' => false);
                        $blogrolling = true;
                } else { // try to get the upload file.
                        $overrides = array('test_form' => false, 'test_type' => false);
+                       $_FILES['userfile']['name'] .= '.txt';
                        $file = wp_handle_upload($_FILES['userfile'], $overrides);
 
                        if ( isset($file['error']) )
                        $file = wp_handle_upload($_FILES['userfile'], $overrides);
 
                        if ( isset($file['error']) )
index 832396f50efeed1c08b48f597e210241acfaafb0..9a85df36b4c74a3af698c6841f8cacdaef2a94f0 100644 (file)
@@ -129,7 +129,7 @@ class RSS_Import {
                                if ( is_wp_error( $post_id ) )
                                        return $post_id;
                                if (!$post_id) {
                                if ( is_wp_error( $post_id ) )
                                        return $post_id;
                                if (!$post_id) {
-                                       _e("Couldn't get post ID");
+                                       _e('Couldn&#8217;t get post ID');
                                        return;
                                }
 
                                        return;
                                }
 
index 54c501f817624ea7123a82f47a3ace3f0edd923e..4568428c992b5c47cd3a0282fe4431f42e603aae 100644 (file)
@@ -33,7 +33,7 @@ class STP_Import {
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=stp&amp;step=1" method="post">';
                wp_nonce_field('import-stp');
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=stp&amp;step=1" method="post">';
                wp_nonce_field('import-stp');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 1').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 1').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -88,12 +88,12 @@ class STP_Import {
 
                        add_option('stpimp_posts', $posts);
                        $count = count($posts);
 
                        add_option('stpimp_posts', $posts);
                        $count = count($posts);
-                       echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
+                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
                }
 
                echo '<form action="admin.php?import=stp&amp;step=2" method="post">';
                wp_nonce_field('import-stp');
                }
 
                echo '<form action="admin.php?import=stp&amp;step=2" method="post">';
                wp_nonce_field('import-stp');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 2').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 2').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -106,10 +106,10 @@ class STP_Import {
                // run that funky magic!
                $tags_added = $this->tag2post();
 
                // run that funky magic!
                $tags_added = $this->tag2post();
 
-               echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag was added!', 'Done! <strong>%s</strong> tags were added!', $tags_added), $tags_added ) . '<br /></p>';
+               echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag was added!', 'Done! <strong>%s</strong> tags were added!', $tags_added), $tags_added ) . '<br /></p>';
                echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
                wp_nonce_field('import-stp');
                echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
                wp_nonce_field('import-stp');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 3').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 3').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
index 413f0331ef59584ac827c4e4aab287e8d6954836..2cbf36e0e0dcf3784523cb5a30229141dac5b8d3 100644 (file)
@@ -70,7 +70,7 @@ class Textpattern_Import {
                echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
                wp_nonce_field('import-textpattern');
                $this->db_form();
                echo '<form action="admin.php?import=textpattern&amp;step=1" method="post">';
                wp_nonce_field('import-textpattern');
                $this->db_form();
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.attribute_escape(__('Import')).'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Import').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -201,7 +201,7 @@ class Textpattern_Import {
 
                        // Store category translation for future use
                        add_option('txpcat2wpcat',$txpcat2wpcat);
 
                        // Store category translation for future use
                        add_option('txpcat2wpcat',$txpcat2wpcat);
-                       echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
+                       echo '<p>'.sprintf(_n('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
                        return true;
                }
                echo __('No Categories to Import!');
                        return true;
                }
                echo __('No Categories to Import!');
@@ -486,7 +486,7 @@ class Textpattern_Import {
                        }
                        add_option('txplinks2wplinks',$txplinks2wplinks);
                        echo '<p>';
                        }
                        add_option('txplinks2wplinks',$txplinks2wplinks);
                        echo '<p>';
-                       printf(__ngettext('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
+                       printf(_n('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
                        echo '<br /><br /></p>';
                        return true;
                }
                        echo '<br /><br /></p>';
                        return true;
                }
@@ -505,7 +505,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
                wp_nonce_field('import-textpattern');
 
                echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Users')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Users'));
                echo '</form>';
 
        }
                echo '</form>';
 
        }
@@ -518,7 +518,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
                wp_nonce_field('import-textpattern');
 
                echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Posts')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Posts'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -532,7 +532,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
                wp_nonce_field('import-textpattern');
 
                echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Comments')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Comments'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -544,7 +544,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
                wp_nonce_field('import-textpattern');
 
                echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Links')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Import Links'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -557,7 +557,7 @@ class Textpattern_Import {
 
                echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
                wp_nonce_field('import-textpattern');
 
                echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
                wp_nonce_field('import-textpattern');
-               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Finish')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', esc_attr__('Finish'));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
index 7478fe46f1e4e9671d021dfe18697124460ac7c2..3add5b63628902bfe350add7aaeda0e22e69a4f5 100644 (file)
@@ -33,7 +33,7 @@ class UTW_Import {
                echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 5-step program to help you kick that nasty UTW habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=utw&amp;step=1" method="post">';
                echo '<p>'.__('To accommodate larger databases for those tag-crazy authors out there, we have made this into an easy 5-step program to help you kick that nasty UTW habit. Just keep clicking along and we will let you know when you are in the clear!').'</p>';
                echo '<p><strong>'.__('Don&#8217;t be stupid - backup your database before proceeding!').'</strong></p>';
                echo '<form action="admin.php?import=utw&amp;step=1" method="post">';
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 1').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 1').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -98,7 +98,7 @@ class UTW_Import {
 
                        $count = count($tags);
 
 
                        $count = count($tags);
 
-                       echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
+                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
                        echo '<p>' . __('The following tags were found:') . '</p>';
 
                        echo '<ul>';
                        echo '<p>' . __('The following tags were found:') . '</p>';
 
                        echo '<ul>';
@@ -120,7 +120,7 @@ class UTW_Import {
 
                echo '<form action="admin.php?import=utw&amp;step=2" method="post">';
                wp_nonce_field('import-utw');
 
                echo '<form action="admin.php?import=utw&amp;step=2" method="post">';
                wp_nonce_field('import-utw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 2').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 2').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -150,13 +150,13 @@ class UTW_Import {
 
                        $count = count($posts);
 
 
                        $count = count($posts);
 
-                       echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
+                       echo '<p>' . sprintf( _n('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
 
                }
 
                echo '<form action="admin.php?import=utw&amp;step=3" method="post">';
                wp_nonce_field('import-utw');
 
                }
 
                echo '<form action="admin.php?import=utw&amp;step=3" method="post">';
                wp_nonce_field('import-utw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 3').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 3').'" /></p>';
                echo '</form>';
                echo '</div>';
 
                echo '</form>';
                echo '</div>';
 
@@ -171,11 +171,11 @@ class UTW_Import {
                // run that funky magic!
                $tags_added = $this->tag2post();
 
                // run that funky magic!
                $tags_added = $this->tag2post();
 
-               echo '<p>' . sprintf( __ngettext( 'Done! <strong>%s</strong> tag were added!', 'Done! <strong>%s</strong> tags were added!', $tags_added ), $tags_added ) . '<br /></p>';
+               echo '<p>' . sprintf( _n( 'Done! <strong>%s</strong> tag were added!', 'Done! <strong>%s</strong> tags were added!', $tags_added ), $tags_added ) . '<br /></p>';
 
                echo '<form action="admin.php?import=utw&amp;step=4" method="post">';
                wp_nonce_field('import-utw');
 
                echo '<form action="admin.php?import=utw&amp;step=4" method="post">';
                wp_nonce_field('import-utw');
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 4').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.esc_attr__('Step 4').'" /></p>';
                echo '</form>';
                echo '</div>';
 
                echo '</form>';
                echo '</div>';
 
index 762ccb3f2c647e07456d8199492c7fc7d105291c..99903487f7af31c49414a5cd827e50ecf6fa6c2a 100644 (file)
@@ -203,7 +203,7 @@ class WP_Import {
 <p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
 <?php
        if ( $this->allow_create_users() ) {
 <p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
 <?php
        if ( $this->allow_create_users() ) {
-               echo '<p>'.__('If a new user is created by WordPress, a password will be randomly generated. Manually change the user\'s details if necessary.')."</p>\n";
+               echo '<p>'.__('If a new user is created by WordPress, a password will be randomly generated. Manually change the user&#8217;s details if necessary.')."</p>\n";
        }
 
 
        }
 
 
@@ -233,7 +233,7 @@ class WP_Import {
                }
 
                echo '<p class="submit">';
                }
 
                echo '<p class="submit">';
-               echo '<input type="submit" class="button" value="'.attribute_escape( __('Submit') ).'" />'.'<br />';
+               echo '<input type="submit" class="button" value="'. esc_attr__('Submit') .'" />'.'<br />';
                echo '</p>';
                echo '</form>';
 
                echo '</p>';
                echo '</form>';
 
@@ -242,14 +242,14 @@ class WP_Import {
        function users_form($n, $author) {
 
                if ( $this->allow_create_users() ) {
        function users_form($n, $author) {
 
                if ( $this->allow_create_users() ) {
-                       printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30" /></label> <br />');
+                       printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'. esc_attr($author) .'" name="'.'user_create['.intval($n).']'.'" maxlength="30" /></label> <br />');
                }
                else {
                        echo __('Map to existing').'<br />';
                }
 
                // keep track of $n => $author name
                }
                else {
                        echo __('Map to existing').'<br />';
                }
 
                // keep track of $n => $author name
-               echo '<input type="hidden" name="author_in['.intval($n).']" value="'.htmlspecialchars($author).'" />';
+               echo '<input type="hidden" name="author_in['.intval($n).']" value="' . esc_attr($author).'" />';
 
                $users = get_users_of_blog();
 ?><select name="user_select[<?php echo $n; ?>]">
 
                $users = get_users_of_blog();
 ?><select name="user_select[<?php echo $n; ?>]">
@@ -300,6 +300,7 @@ class WP_Import {
                                continue;
 
                        $category_nicename      = $this->get_tag( $c, 'wp:category_nicename' );
                                continue;
 
                        $category_nicename      = $this->get_tag( $c, 'wp:category_nicename' );
+                       $category_description = $this->get_tag( $c, 'wp:category_description' );
                        $posts_private          = (int) $this->get_tag( $c, 'wp:posts_private' );
                        $links_private          = (int) $this->get_tag( $c, 'wp:links_private' );
 
                        $posts_private          = (int) $this->get_tag( $c, 'wp:posts_private' );
                        $links_private          = (int) $this->get_tag( $c, 'wp:links_private' );
 
@@ -310,7 +311,7 @@ class WP_Import {
                        else
                                $category_parent = category_exists($parent);
 
                        else
                                $category_parent = category_exists($parent);
 
-                       $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name');
+                       $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name', 'category_description');
 
                        $cat_ID = wp_insert_category($catarr);
                }
 
                        $cat_ID = wp_insert_category($catarr);
                }
@@ -528,7 +529,7 @@ class WP_Import {
                } }
 
                if ( $num_comments )
                } }
 
                if ( $num_comments )
-                       printf(' '.__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);
+                       printf(' '._n('(%s comment)', '(%s comments)', $num_comments), $num_comments);
 
                // Now for post meta
                preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
 
                // Now for post meta
                preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
index 90098ee2f0bbf5ab6a80b615c14cdd31a6b601ea..b4312b61516676e0d51471ea4d08b53412d7fa49 100644 (file)
@@ -65,7 +65,7 @@ class WP_Categories_to_Tags {
 
                if ( $cat_num > 0 ) {
                        screen_icon();
 
                if ( $cat_num > 0 ) {
                        screen_icon();
-                       echo '<h2>' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
+                       echo '<h2>' . sprintf( _n( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
                        echo '<div class="narrow">';
                        echo '<p>' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
                        echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';
                        echo '<div class="narrow">';
                        echo '<p>' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
                        echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';
@@ -103,7 +103,7 @@ function check_all_rows() {
 </script>
 
 <form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
 </script>
 
 <form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
-<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()" />
+<p><input type="button" class="button-secondary" value="<?php esc_attr_e('Check All'); ?>" onclick="this.value=check_all_rows()" />
 <?php wp_nonce_field('import-cat2tag'); ?></p>
 <ul style="list-style:none">
 
 <?php wp_nonce_field('import-cat2tag'); ?></p>
 <ul style="list-style:none">
 
@@ -128,7 +128,7 @@ function check_all_rows() {
 <?php  if ( ! empty($this->hybrids_ids) )
                        echo '<p><a name="note"></a>' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '</p>'; ?>
 
 <?php  if ( ! empty($this->hybrids_ids) )
                        echo '<p><a name="note"></a>' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '</p>'; ?>
 
-<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php esc_attr_e('Convert Categories to Tags'); ?>" /></p>
 </form>
 
 <?php }
 </form>
 
 <?php }
@@ -141,9 +141,9 @@ function check_all_rows() {
 
                if ( $tags_num > 0 ) {
                        screen_icon();
 
                if ( $tags_num > 0 ) {
                        screen_icon();
-                       echo '<h2>' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
+                       echo '<h2>' . sprintf( _n( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
                        echo '<div class="narrow">';
                        echo '<div class="narrow">';
-                       echo '<p>' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
+                       echo '<p>' . __('Here you can selectively convert existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
                        echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
 
                        $this->tags_form();
                        echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
 
                        $this->tags_form();
@@ -179,12 +179,12 @@ function check_all_tagrows() {
 </script>
 
 <form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
 </script>
 
 <form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
-<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
+<p><input type="button" class="button-secondary" value="<?php esc_attr_e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
 <?php wp_nonce_field('import-cat2tag'); ?></p>
 <ul style="list-style:none">
 
 <?php  foreach ( $this->all_tags as $tag ) { ?>
 <?php wp_nonce_field('import-cat2tag'); ?></p>
 <ul style="list-style:none">
 
 <?php  foreach ( $this->all_tags as $tag ) { ?>
-       <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id),  $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>
+       <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo esc_attr($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id),  $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>
 
 <?php  } ?>
 </ul>
 
 <?php  } ?>
 </ul>
@@ -192,7 +192,7 @@ function check_all_tagrows() {
 <?php  if ( ! empty($this->hybrids_ids) )
                        echo '<p><a name="note"></a>' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '</p>'; ?>
 
 <?php  if ( ! empty($this->hybrids_ids) )
                        echo '<p><a name="note"></a>' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '</p>'; ?>
 
-<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php _e('Convert Tags to Categories'); ?>" /></p>
+<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php esc_attr_e('Convert Tags to Categories'); ?>" /></p>
 </form>
 
 <?php }
 </form>
 
 <?php }
@@ -249,7 +249,7 @@ function check_all_tagrows() {
                        $cat_id = (int) $cat_id;
 
                        if ( ! $this->_category_exists($cat_id) ) {
                        $cat_id = (int) $cat_id;
 
                        if ( ! $this->_category_exists($cat_id) ) {
-                               echo '<li>' . sprintf( __('Category %s doesn\'t exist!'),  $cat_id ) . "</li>\n";
+                               echo '<li>' . sprintf( __('Category %s doesn&#8217;t exist!'),  $cat_id ) . "</li>\n";
                        } else {
                                $category =& get_category($cat_id);
                                echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '),  $category->name);
                        } else {
                                $category =& get_category($cat_id);
                                echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '),  $category->name);
@@ -325,14 +325,12 @@ function check_all_tagrows() {
 
                if ( ! empty($clean_term_cache) ) {
                        $clean_term_cache = array_unique(array_values($clean_term_cache));
 
                if ( ! empty($clean_term_cache) ) {
                        $clean_term_cache = array_unique(array_values($clean_term_cache));
-                       foreach ( $clean_term_cache as $id )
-                               wp_cache_delete($id, 'post_tag');
+                       clean_term_cache($clean_term_cache, 'post_tag');
                }
 
                if ( ! empty($clean_cat_cache) ) {
                        $clean_cat_cache = array_unique(array_values($clean_cat_cache));
                }
 
                if ( ! empty($clean_cat_cache) ) {
                        $clean_cat_cache = array_unique(array_values($clean_cat_cache));
-                       foreach ( $clean_cat_cache as $id )
-                               wp_cache_delete($id, 'category');
+                       clean_term_cache($clean_cat_cache, 'category');
                }
 
                if ( $clear_parents ) delete_option('category_children');
                }
 
                if ( $clear_parents ) delete_option('category_children');
@@ -408,20 +406,18 @@ function check_all_tagrows() {
                                echo __('Converted successfully.') . "</li>\n";
 
                        } else {
                                echo __('Converted successfully.') . "</li>\n";
 
                        } else {
-                               printf( '<li>' . __('Tag #%s doesn\'t exist!') . "</li>\n",  $tag_id );
+                               printf( '<li>' . __('Tag #%s doesn&#8217;t exist!') . "</li>\n",  $tag_id );
                        }
                }
 
                if ( ! empty($clean_term_cache) ) {
                        $clean_term_cache = array_unique(array_values($clean_term_cache));
                        }
                }
 
                if ( ! empty($clean_term_cache) ) {
                        $clean_term_cache = array_unique(array_values($clean_term_cache));
-                       foreach ( $clean_term_cache as $id )
-                               wp_cache_delete($id, 'post_tag');
+                       clean_term_cache($clean_term_cache, 'post_tag');
                }
 
                if ( ! empty($clean_cat_cache) ) {
                        $clean_cat_cache = array_unique(array_values($clean_cat_cache));
                }
 
                if ( ! empty($clean_cat_cache) ) {
                        $clean_cat_cache = array_unique(array_values($clean_cat_cache));
-                       foreach ( $clean_cat_cache as $id )
-                               wp_cache_delete($id, 'category');
+                       clean_term_cache($clean_term_cache, 'category');
                }
 
                if ( $clear_parents ) delete_option('category_children');
                }
 
                if ( $clear_parents ) delete_option('category_children');
index a0077a10b067362d24dcfa11a2a257b095722713..64621fdc6677166a8e383caf196d72e68b4ec8fe 100644 (file)
@@ -29,11 +29,11 @@ function edit_link( $link_id = '' ) {
        if (!current_user_can( 'manage_links' ))
                wp_die( __( 'Cheatin&#8217; uh?' ));
 
        if (!current_user_can( 'manage_links' ))
                wp_die( __( 'Cheatin&#8217; uh?' ));
 
-       $_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
-       $_POST['link_url'] = clean_url($_POST['link_url']);
-       $_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
-       $_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
-       $_POST['link_rss'] = clean_url($_POST['link_rss']);
+       $_POST['link_url'] = esc_html( $_POST['link_url'] );
+       $_POST['link_url'] = esc_url($_POST['link_url']);
+       $_POST['link_name'] = esc_html( $_POST['link_name'] );
+       $_POST['link_image'] = esc_html( $_POST['link_image'] );
+       $_POST['link_rss'] = esc_url($_POST['link_rss']);
        if ( !isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )
                $_POST['link_visible'] = 'Y';
 
        if ( !isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )
                $_POST['link_visible'] = 'Y';
 
@@ -54,12 +54,12 @@ function edit_link( $link_id = '' ) {
  */
 function get_default_link_to_edit() {
        if ( isset( $_GET['linkurl'] ) )
  */
 function get_default_link_to_edit() {
        if ( isset( $_GET['linkurl'] ) )
-               $link->link_url = clean_url( $_GET['linkurl']);
+               $link->link_url = esc_url( $_GET['linkurl']);
        else
                $link->link_url = '';
 
        if ( isset( $_GET['name'] ) )
        else
                $link->link_url = '';
 
        if ( isset( $_GET['name'] ) )
-               $link->link_name = attribute_escape( $_GET['name']);
+               $link->link_name = esc_attr( $_GET['name']);
        else
                $link->link_name = '';
 
        else
                $link->link_name = '';
 
index fcc5351c52503db198d5aee09a82516894c89e72..082442dd589d085b600f0a8c3911c4e926381af8 100644 (file)
@@ -1,60 +1,57 @@
 <?php
 <?php
-/**
- * PhpConcept Library - Zip Module 2.5
- *
- * Presentation :
- *   PclZip is a PHP library that manage ZIP archives.
- *   So far tests show that archives generated by PclZip are readable by
- *   WinZip application and other tools.
- *
- * Warning :
- *   This library and the associated files are non commercial, non professional
- *   work.
- *   It should not have unexpected results. However if any damage is caused by
- *   this software the author can not be responsible.
- *   The use of this software is at the risk of the user.
- *
- * @package External
- * @subpackage PclZip
- *
- * @license License GNU/LGPL
- * @copyright March 2006 Vincent Blavet
- * @author Vincent Blavet
- * @link http://www.phpconcept.net
- * @version $Id: pclzip.lib.php,v 1.44 2006/03/08 21:23:59 vblavet Exp $
- */
-
-/**
- * The read block size for reading zip files.
- *
- * @since 2.5
- */
-define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
-
-/**
- * File list separator
- *
- * In version 1.x of PclZip, the separator for file list is a space(which is not
- * a very smart choice, specifically for windows paths !). A better separator
- * should be a comma (,). This constant gives you the abilty to change that.
- *
- * However notice that changing this value, may have impact on existing scripts,
- * using space separated filenames. Recommanded values for compatibility with
- * older versions :
- * <code>define( 'PCLZIP_SEPARATOR', ' ' );</code>
- * Recommanded values for smart separation of filenames.
- */
-define( 'PCLZIP_SEPARATOR', ',' );
-
-/**
- * Error configuration
- *
- * 0 : PclZip Class integrated error handling
- * 1 : PclError external library error handling. By enabling this you must
- *     ensure that you have included PclError library.
- * [2,...] : reserved for future use
- */
-define( 'PCLZIP_ERROR_EXTERNAL', 0 );
+// --------------------------------------------------------------------------------
+// PhpConcept Library - Zip Module 2.8
+// --------------------------------------------------------------------------------
+// License GNU/LGPL - Vincent Blavet - March 2006
+// http://www.phpconcept.net
+// --------------------------------------------------------------------------------
+//
+// Presentation :
+//   PclZip is a PHP library that manage ZIP archives.
+//   So far tests show that archives generated by PclZip are readable by
+//   WinZip application and other tools.
+//
+// Description :
+//   See readme.txt and http://www.phpconcept.net
+//
+// Warning :
+//   This library and the associated files are non commercial, non professional
+//   work.
+//   It should not have unexpected results. However if any damage is caused by
+//   this software the author can not be responsible.
+//   The use of this software is at the risk of the user.
+//
+// --------------------------------------------------------------------------------
+// $Id: pclzip.lib.php,v 1.55 2009/04/22 07:38:36 vblavet Exp $
+// --------------------------------------------------------------------------------
+
+  // ----- Constants
+  if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
+    define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
+  }
+  
+  // ----- File list separator
+  // In version 1.x of PclZip, the separator for file list is a space
+  // (which is not a very smart choice, specifically for windows paths !).
+  // A better separator should be a comma (,). This constant gives you the
+  // abilty to change that.
+  // However notice that changing this value, may have impact on existing
+  // scripts, using space separated filenames.
+  // Recommanded values for compatibility with older versions :
+  //define( 'PCLZIP_SEPARATOR', ' ' );
+  // Recommanded values for smart separation of filenames.
+  if (!defined('PCLZIP_SEPARATOR')) {
+    define( 'PCLZIP_SEPARATOR', ',' );
+  }
+
+  // ----- Error configuration
+  // 0 : PclZip Class integrated error handling
+  // 1 : PclError external library error handling. By enabling this
+  //     you must ensure that you have included PclError library.
+  // [2,...] : reserved for futur use
+  if (!defined('PCLZIP_ERROR_EXTERNAL')) {
+    define( 'PCLZIP_ERROR_EXTERNAL', 0 );
+  }
 
   // ----- Optional static temporary directory
   //       By default temporary files are generated in the script current
 
   // ----- Optional static temporary directory
   //       By default temporary files are generated in the script current
@@ -65,14 +62,28 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   //       Samples :
   // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
   // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
   //       Samples :
   // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
   // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
-  define( 'PCLZIP_TEMPORARY_DIR', '' );
+  if (!defined('PCLZIP_TEMPORARY_DIR')) {
+    define( 'PCLZIP_TEMPORARY_DIR', '' );
+  }
+
+  // ----- Optional threshold ratio for use of temporary files
+  //       Pclzip sense the size of the file to add/extract and decide to
+  //       use or not temporary file. The algorythm is looking for 
+  //       memory_limit of PHP and apply a ratio.
+  //       threshold = memory_limit * ratio.
+  //       Recommended values are under 0.5. Default 0.47.
+  //       Samples :
+  // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
+  if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
+    define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
+  }
 
 // --------------------------------------------------------------------------------
 // ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
 // --------------------------------------------------------------------------------
 
   // ----- Global variables
 
 // --------------------------------------------------------------------------------
 // ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
 // --------------------------------------------------------------------------------
 
   // ----- Global variables
-  $g_pclzip_version = "2.5";
+  $g_pclzip_version = "2.8";
 
   // ----- Error codes
   //   -1 : Unable to open file in binary write mode
 
   // ----- Error codes
   //   -1 : Unable to open file in binary write mode
@@ -135,18 +146,27 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   // which is not correctly supported by PHP ...
   //define( 'PCLZIP_OPT_CRYPT', 77018 );
   define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
   // which is not correctly supported by PHP ...
   //define( 'PCLZIP_OPT_CRYPT', 77018 );
   define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
-
+  define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
+  define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
+  define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
+  
   // ----- File description attributes
   define( 'PCLZIP_ATT_FILE_NAME', 79001 );
   define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
   define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
   // ----- File description attributes
   define( 'PCLZIP_ATT_FILE_NAME', 79001 );
   define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
   define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
+  define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
+  define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
+  define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
 
   // ----- Call backs values
   define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
   define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
   define( 'PCLZIP_CB_PRE_ADD', 78003 );
   define( 'PCLZIP_CB_POST_ADD', 78004 );
 
   // ----- Call backs values
   define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
   define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
   define( 'PCLZIP_CB_PRE_ADD', 78003 );
   define( 'PCLZIP_CB_POST_ADD', 78004 );
-  /* For future use
+  /* For futur use
   define( 'PCLZIP_CB_PRE_LIST', 78005 );
   define( 'PCLZIP_CB_POST_LIST', 78006 );
   define( 'PCLZIP_CB_PRE_DELETE', 78007 );
   define( 'PCLZIP_CB_PRE_LIST', 78005 );
   define( 'PCLZIP_CB_POST_LIST', 78006 );
   define( 'PCLZIP_CB_PRE_DELETE', 78007 );
@@ -178,7 +198,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     // ----- Internal error handling
     var $error_code = 1;
     var $error_string = '';
     // ----- Internal error handling
     var $error_code = 1;
     var $error_string = '';
-
+    
     // ----- Current status of the magic_quotes_runtime
     // This value store the php configuration for magic_quotes
     // The class can then disable the magic_quotes and reset it after
     // ----- Current status of the magic_quotes_runtime
     // This value store the php configuration for magic_quotes
     // The class can then disable the magic_quotes and reset it after
@@ -288,7 +308,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
                                                    PCLZIP_CB_PRE_ADD => 'optional',
                                                    PCLZIP_CB_POST_ADD => 'optional',
                                                    PCLZIP_OPT_NO_COMPRESSION => 'optional',
                                                    PCLZIP_CB_PRE_ADD => 'optional',
                                                    PCLZIP_CB_POST_ADD => 'optional',
                                                    PCLZIP_OPT_NO_COMPRESSION => 'optional',
-                                                   PCLZIP_OPT_COMMENT => 'optional'
+                                                   PCLZIP_OPT_COMMENT => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
                                                    //, PCLZIP_OPT_CRYPT => 'optional'
                                              ));
         if ($v_result != 1) {
                                                    //, PCLZIP_OPT_CRYPT => 'optional'
                                              ));
         if ($v_result != 1) {
@@ -318,22 +341,25 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         }
       }
     }
         }
       }
     }
+    
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
 
     // ----- Init
     $v_string_list = array();
     $v_att_list = array();
     $v_filedescr_list = array();
     $p_result_list = array();
 
     // ----- Init
     $v_string_list = array();
     $v_att_list = array();
     $v_filedescr_list = array();
     $p_result_list = array();
-
+    
     // ----- Look if the $p_filelist is really an array
     if (is_array($p_filelist)) {
     // ----- Look if the $p_filelist is really an array
     if (is_array($p_filelist)) {
-
+    
       // ----- Look if the first element is also an array
       //       This will mean that this is a file description entry
       if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
         $v_att_list = $p_filelist;
       }
       // ----- Look if the first element is also an array
       //       This will mean that this is a file description entry
       if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
         $v_att_list = $p_filelist;
       }
-
+      
       // ----- The list is a list of string names
       else {
         $v_string_list = $p_filelist;
       // ----- The list is a list of string names
       else {
         $v_string_list = $p_filelist;
@@ -352,7 +378,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
       return 0;
     }
       //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
       return 0;
     }
-
+    
     // ----- Reformat the string list
     if (sizeof($v_string_list) != 0) {
       foreach ($v_string_list as $v_string) {
     // ----- Reformat the string list
     if (sizeof($v_string_list) != 0) {
       foreach ($v_string_list as $v_string) {
@@ -364,12 +390,15 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         }
       }
     }
         }
       }
     }
-
+    
     // ----- For each file in the list check the attributes
     $v_supported_attributes
     = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
              ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
              ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
     // ----- For each file in the list check the attributes
     $v_supported_attributes
     = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
              ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
              ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
+             ,PCLZIP_ATT_FILE_MTIME => 'optional'
+             ,PCLZIP_ATT_FILE_CONTENT => 'optional'
+             ,PCLZIP_ATT_FILE_COMMENT => 'optional'
                                                );
     foreach ($v_att_list as $v_entry) {
       $v_result = $this->privFileDescrParseAtt($v_entry,
                                                );
     foreach ($v_att_list as $v_entry) {
       $v_result = $this->privFileDescrParseAtt($v_entry,
@@ -476,7 +505,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
                                                    PCLZIP_OPT_NO_COMPRESSION => 'optional',
                                                    PCLZIP_OPT_COMMENT => 'optional',
                                                    PCLZIP_OPT_ADD_COMMENT => 'optional',
                                                    PCLZIP_OPT_NO_COMPRESSION => 'optional',
                                                    PCLZIP_OPT_COMMENT => 'optional',
                                                    PCLZIP_OPT_ADD_COMMENT => 'optional',
-                                                   PCLZIP_OPT_PREPEND_COMMENT => 'optional'
+                                                   PCLZIP_OPT_PREPEND_COMMENT => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
                                                    //, PCLZIP_OPT_CRYPT => 'optional'
                                                                                                   ));
         if ($v_result != 1) {
                                                    //, PCLZIP_OPT_CRYPT => 'optional'
                                                                                                   ));
         if ($v_result != 1) {
@@ -509,21 +541,24 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       }
     }
 
       }
     }
 
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
+
     // ----- Init
     $v_string_list = array();
     $v_att_list = array();
     $v_filedescr_list = array();
     $p_result_list = array();
     // ----- Init
     $v_string_list = array();
     $v_att_list = array();
     $v_filedescr_list = array();
     $p_result_list = array();
-
+    
     // ----- Look if the $p_filelist is really an array
     if (is_array($p_filelist)) {
     // ----- Look if the $p_filelist is really an array
     if (is_array($p_filelist)) {
-
+    
       // ----- Look if the first element is also an array
       //       This will mean that this is a file description entry
       if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
         $v_att_list = $p_filelist;
       }
       // ----- Look if the first element is also an array
       //       This will mean that this is a file description entry
       if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
         $v_att_list = $p_filelist;
       }
-
+      
       // ----- The list is a list of string names
       else {
         $v_string_list = $p_filelist;
       // ----- The list is a list of string names
       else {
         $v_string_list = $p_filelist;
@@ -542,19 +577,22 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
       return 0;
     }
       //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
       return 0;
     }
-
+    
     // ----- Reformat the string list
     if (sizeof($v_string_list) != 0) {
       foreach ($v_string_list as $v_string) {
         $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
       }
     }
     // ----- Reformat the string list
     if (sizeof($v_string_list) != 0) {
       foreach ($v_string_list as $v_string) {
         $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
       }
     }
-
+    
     // ----- For each file in the list check the attributes
     $v_supported_attributes
     = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
              ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
              ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
     // ----- For each file in the list check the attributes
     $v_supported_attributes
     = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
              ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
              ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
+             ,PCLZIP_ATT_FILE_MTIME => 'optional'
+             ,PCLZIP_ATT_FILE_CONTENT => 'optional'
+             ,PCLZIP_ATT_FILE_COMMENT => 'optional'
                                                );
     foreach ($v_att_list as $v_entry) {
       $v_result = $this->privFileDescrParseAtt($v_entry,
                                                );
     foreach ($v_att_list as $v_entry) {
       $v_result = $this->privFileDescrParseAtt($v_entry,
@@ -615,7 +653,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   //                                  write protected
   //                newer_exist : the file was not extracted because a newer file exists
   //                path_creation_fail : the file is not extracted because the folder
   //                                  write protected
   //                newer_exist : the file was not extracted because a newer file exists
   //                path_creation_fail : the file is not extracted because the folder
-  //                                     does not exists and can not be created
+  //                                     does not exist and can not be created
   //                write_error : the file was not extracted because there was a
   //                              error while writing the file
   //                read_error : the file was not extracted because there was a error
   //                write_error : the file was not extracted because there was a
   //                              error while writing the file
   //                read_error : the file was not extracted because there was a error
@@ -743,7 +781,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
                                                    PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
                                                    PCLZIP_OPT_REPLACE_NEWER => 'optional'
                                                    ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
                                                    PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
                                                    PCLZIP_OPT_REPLACE_NEWER => 'optional'
                                                    ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
-                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
+                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
                                                                                                    ));
         if ($v_result != 1) {
           //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
                                                                                                    ));
         if ($v_result != 1) {
           //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
@@ -793,6 +834,9 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       }
     }
 
       }
     }
 
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
+
     // ----- Trace
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
 
     // ----- Trace
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
 
@@ -903,7 +947,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
                                                    PCLZIP_OPT_SET_CHMOD => 'optional',
                                                    PCLZIP_OPT_REPLACE_NEWER => 'optional'
                                                    ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
                                                    PCLZIP_OPT_SET_CHMOD => 'optional',
                                                    PCLZIP_OPT_REPLACE_NEWER => 'optional'
                                                    ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
-                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
+                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
                                                                                                   ));
         if ($v_result != 1) {
           //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
                                                                                                   ));
         if ($v_result != 1) {
           //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
@@ -976,6 +1023,9 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     }
     $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
 
     }
     $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
 
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
+
     // ----- Call the extracting fct
     if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
     // ----- Call the extracting fct
     if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
@@ -999,7 +1049,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   // Options :
   //   PCLZIP_OPT_BY_INDEX :
   //   PCLZIP_OPT_BY_NAME :
   // Options :
   //   PCLZIP_OPT_BY_INDEX :
   //   PCLZIP_OPT_BY_NAME :
-  //   PCLZIP_OPT_BY_EREG :
+  //   PCLZIP_OPT_BY_EREG : 
   //   PCLZIP_OPT_BY_PREG :
   // Return Values :
   //   0 on failure,
   //   PCLZIP_OPT_BY_PREG :
   // Return Values :
   //   0 on failure,
@@ -1074,7 +1124,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   function deleteByIndex($p_index)
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
   function deleteByIndex($p_index)
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
-
+    
     $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
 
     // ----- Return
     $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
 
     // ----- Return
@@ -1128,7 +1178,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
       {
         $this->privSwapBackMagicQuotes();
       if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
       {
         $this->privSwapBackMagicQuotes();
-
+        
         // ----- Error log
         PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
 
         // ----- Error log
         PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
 
@@ -1457,7 +1507,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
     $v_result=1;
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
     $v_result=1;
-
+    
     // ----- Read the options
     $i=0;
     while ($i<$p_size) {
     // ----- Read the options
     $i=0;
     while ($i<$p_size) {
@@ -1490,11 +1540,70 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
           }
 
           // ----- Get the value
           }
 
           // ----- Get the value
-          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
+          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
           $i++;
         break;
 
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
           $i++;
         break;
 
+        case PCLZIP_OPT_TEMP_FILE_THRESHOLD :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          
+          // ----- Check the value
+          $v_value = $p_options_list[$i+1];
+          if ((!is_integer($v_value)) || ($v_value<0)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value (and convert it in bytes)
+          $v_result_list[$p_options_list[$i]] = $v_value*1048576;
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+          $i++;
+        break;
+
+        case PCLZIP_OPT_TEMP_FILE_ON :
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          
+          $v_result_list[$p_options_list[$i]] = true;
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+        break;
+
+        case PCLZIP_OPT_TEMP_FILE_OFF :
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+          
+          $v_result_list[$p_options_list[$i]] = true;
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
+        break;
+
         case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
           // ----- Check the number of parameters
           if (($i+1) >= $p_size) {
         case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
           // ----- Check the number of parameters
           if (($i+1) >= $p_size) {
@@ -1509,7 +1618,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
           // ----- Get the value
           if (   is_string($p_options_list[$i+1])
               && ($p_options_list[$i+1] != '')) {
           // ----- Get the value
           if (   is_string($p_options_list[$i+1])
               && ($p_options_list[$i+1] != '')) {
-            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
+            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
             $i++;
           }
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
             $i++;
           }
@@ -1654,7 +1763,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
           }
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
           }
-
+          
           // ----- Reduce the index list
           // each index item in the list must be a couple with a start and
           // an end value : [0,3], [5-5], [8-10], ...
           // ----- Reduce the index list
           // each index item in the list must be a couple with a start and
           // an end value : [0,3], [5-5], [8-10], ...
@@ -1665,10 +1774,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
               // ----- Explode the item
               $v_item_list = explode("-", $v_work_list[$j]);
               $v_size_item_list = sizeof($v_item_list);
               // ----- Explode the item
               $v_item_list = explode("-", $v_work_list[$j]);
               $v_size_item_list = sizeof($v_item_list);
-
+              
               // ----- TBC : Here we might check that each item is a
               // real integer ...
               // ----- TBC : Here we might check that each item is a
               // real integer ...
-
+              
               // ----- Look for single value
               if ($v_size_item_list == 1) {
                   // ----- Set the option value
               // ----- Look for single value
               if ($v_size_item_list == 1) {
                   // ----- Set the option value
@@ -1706,7 +1815,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
               }
               $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
           }
               }
               $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
           }
-
+          
           // ----- Sort the items
           if ($v_sort_flag) {
               // TBC : To Be Completed
           // ----- Sort the items
           if ($v_sort_flag) {
               // TBC : To Be Completed
@@ -1819,7 +1928,62 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         }
       }
     }
         }
       }
     }
+    
+    // ----- Look for default values
+    if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Calculate auto threshold");
+      
+    }
+
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
 
 
+  // --------------------------------------------------------------------------------
+  // Function : privOptionDefaultThreshold()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privOptionDefaultThreshold(&$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOptionDefaultThreshold", "");
+    $v_result=1;
+    
+    if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
+        || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+    
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Create an auto-threshold for use of temporay files");
+    // ----- Get 'memory_limit' configuration value
+    $v_memory_limit = ini_get('memory_limit');
+    $v_memory_limit = trim($v_memory_limit);
+    $last = strtolower(substr($v_memory_limit, -1));
+    if($last == 'g')
+        //$v_memory_limit = $v_memory_limit*1024*1024*1024;
+        $v_memory_limit = $v_memory_limit*1073741824;
+    if($last == 'm')
+        //$v_memory_limit = $v_memory_limit*1024*1024;
+        $v_memory_limit = $v_memory_limit*1048576;
+    if($last == 'k')
+        $v_memory_limit = $v_memory_limit*1024;
+            
+    $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
+    
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Threshold value is : ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]." bytes");
+
+    // ----- Sanity check : No threshold if value lower than 1M
+    if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Unset the threshold (value ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD].") because under 1Mo sanity check)");
+      unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
+    }
+          
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
@@ -1838,10 +2002,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
     $v_result=1;
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
     $v_result=1;
-
+    
     // ----- For each file in the list check the attributes
     foreach ($p_file_list as $v_key => $v_value) {
     // ----- For each file in the list check the attributes
     foreach ($p_file_list as $v_key => $v_value) {
-
+    
       // ----- Check if the option is supported
       if (!isset($v_requested_options[$v_key])) {
         // ----- Error log
       // ----- Check if the option is supported
       if (!isset($v_requested_options[$v_key])) {
         // ----- Error log
@@ -1863,7 +2027,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
           $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
 
           $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
-
+          
           if ($p_filedescr['filename'] == '') {
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
           if ($p_filedescr['filename'] == '') {
             PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
@@ -1906,6 +2070,34 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
           }
         break;
 
           }
         break;
 
+        // ----- Look for options that takes a string
+        case PCLZIP_ATT_FILE_COMMENT :
+          if (!is_string($v_value)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          $p_filedescr['comment'] = $v_value;
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
+        break;
+
+        case PCLZIP_ATT_FILE_MTIME :
+          if (!is_integer($v_value)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
+          }
+
+          $p_filedescr['mtime'] = $v_value;
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
+        break;
+
+        case PCLZIP_ATT_FILE_CONTENT :
+          $p_filedescr['content'] = $v_value;
+          ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
+        break;
+
         default :
           // ----- Error log
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
         default :
           // ----- Error log
           PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
@@ -1931,10 +2123,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
           }
         }
       }
           }
         }
       }
-
+    
     // end foreach
     }
     // end foreach
     }
-
+    
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
@@ -1944,6 +2136,12 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   // --------------------------------------------------------------------------------
   // Function : privFileDescrExpand()
   // Description :
   // --------------------------------------------------------------------------------
   // Function : privFileDescrExpand()
   // Description :
+  //   This method look for each item of the list to see if its a file, a folder
+  //   or a string to be added as file. For any other type of files (link, other)
+  //   just ignore the item.
+  //   Then prepare the information that will be stored for that file.
+  //   When its a folder, expand the folder with all the files that are in that 
+  //   folder (recursively).
   // Parameters :
   // Return Values :
   //   1 on success.
   // Parameters :
   // Return Values :
   //   1 on success.
@@ -1953,56 +2151,68 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
     $v_result=1;
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
     $v_result=1;
-
+    
     // ----- Create a result list
     $v_result_list = array();
     // ----- Create a result list
     $v_result_list = array();
-
+    
     // ----- Look each entry
     for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
     // ----- Look each entry
     for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for file ".$i.".");
+      
       // ----- Get filedescr
       $v_descr = $p_filedescr_list[$i];
       // ----- Get filedescr
       $v_descr = $p_filedescr_list[$i];
-
+      
       // ----- Reduce the filename
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
       // ----- Reduce the filename
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
-      $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']);
+      $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
       $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
       $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
-
-      // ----- Get type of descr
-      if (!file_exists($v_descr['filename'])) {
+      
+      // ----- Look for real file or folder
+      if (file_exists($v_descr['filename'])) {
+        if (@is_file($v_descr['filename'])) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
+          $v_descr['type'] = 'file';
+        }
+        else if (@is_dir($v_descr['filename'])) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
+          $v_descr['type'] = 'folder';
+        }
+        else if (@is_link($v_descr['filename'])) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
+          // skip
+          continue;
+        }
+        else {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
+          // skip
+          continue;
+        }
+      }
+      
+      // ----- Look for string added as file
+      else if (isset($v_descr['content'])) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a string added as a file");
+        $v_descr['type'] = 'virtual_file';
+      }
+      
+      // ----- Missing file
+      else {
         // ----- Error log
         // ----- Error log
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exists");
-        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exists");
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exist");
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
 
         // ----- Return
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
         return PclZip::errorCode();
       }
 
         // ----- Return
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
         return PclZip::errorCode();
       }
-      if (@is_file($v_descr['filename'])) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
-        $v_descr['type'] = 'file';
-      }
-      else if (@is_dir($v_descr['filename'])) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
-        $v_descr['type'] = 'folder';
-      }
-      else if (@is_link($v_descr['filename'])) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
-        // skip
-        continue;
-      }
-      else {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
-        // skip
-        continue;
-      }
-
+      
       // ----- Calculate the stored filename
       $this->privCalculateStoredFilename($v_descr, $p_options);
       // ----- Calculate the stored filename
       $this->privCalculateStoredFilename($v_descr, $p_options);
-
+      
       // ----- Add the descriptor in result list
       $v_result_list[sizeof($v_result_list)] = $v_descr;
       // ----- Add the descriptor in result list
       $v_result_list[sizeof($v_result_list)] = $v_descr;
-
+      
       // ----- Look for folder
       if ($v_descr['type'] == 'folder') {
         // ----- List of items in folder
       // ----- Look for folder
       if ($v_descr['type'] == 'folder') {
         // ----- List of items in folder
@@ -2016,25 +2226,32 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
             if (($v_item_handler == '.') || ($v_item_handler == '..')) {
                 continue;
             }
             if (($v_item_handler == '.') || ($v_item_handler == '..')) {
                 continue;
             }
-
+            
             // ----- Compose the full filename
             $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
             // ----- Compose the full filename
             $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
-
+            
             // ----- Look for different stored filename
             // Because the name of the folder was changed, the name of the
             // files/sub-folders also change
             if ($v_descr['stored_filename'] != $v_descr['filename']) {
             // ----- Look for different stored filename
             // Because the name of the folder was changed, the name of the
             // files/sub-folders also change
             if ($v_descr['stored_filename'] != $v_descr['filename']) {
-              $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
+              if ($v_descr['stored_filename'] != '') {
+                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
+              }
+              else {
+                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
+              }
             }
             }
-
+      
             $v_dirlist_nb++;
           }
             $v_dirlist_nb++;
           }
+          
+          @closedir($v_folder_handler);
         }
         else {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
           // TBC : unable to open folder in read mode
         }
         }
         else {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
           // TBC : unable to open folder in read mode
         }
-
+        
         // ----- Expand each element of the list
         if ($v_dirlist_nb != 0) {
           // ----- Expand
         // ----- Expand each element of the list
         if ($v_dirlist_nb != 0) {
           // ----- Expand
@@ -2042,7 +2259,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
           }
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
             return $v_result;
           }
-
+          
           // ----- Concat the resulting list
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
           $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
           // ----- Concat the resulting list
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
           $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
@@ -2051,12 +2268,12 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         else {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
         }
         else {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
         }
-
+          
         // ----- Free local array
         unset($v_dirlist_descr);
       }
     }
         // ----- Free local array
         unset($v_dirlist_descr);
       }
     }
-
+    
     // ----- Get the result list
     $p_filedescr_list = $v_result_list;
 
     // ----- Get the result list
     $p_filedescr_list = $v_result_list;
 
@@ -2077,7 +2294,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
     $v_result=1;
     $v_list_detail = array();
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
     $v_result=1;
     $v_list_detail = array();
-
+    
     // ----- Magic quotes trick
     $this->privDisableMagicQuotes();
 
     // ----- Magic quotes trick
     $this->privDisableMagicQuotes();
 
@@ -2438,7 +2655,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   // Function : privAddFileList()
   // Description :
   // Parameters :
   // Function : privAddFileList()
   // Description :
   // Parameters :
-  //   $p_filedescr_list : An array containing the file description
+  //   $p_filedescr_list : An array containing the file description 
   //                      or directory names to add in the zip
   //   $p_result_list : list of added files with their properties (specially the status field)
   // Return Values :
   //                      or directory names to add in the zip
   //   $p_result_list : list of added files with their properties (specially the status field)
   // Return Values :
@@ -2458,7 +2675,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       // ----- Format the filename
       $p_filedescr_list[$j]['filename']
       = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
       // ----- Format the filename
       $p_filedescr_list[$j]['filename']
       = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
-
+      
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
 
       // ----- Skip empty file names
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
 
       // ----- Skip empty file names
@@ -2469,18 +2686,24 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       }
 
       // ----- Check the filename
       }
 
       // ----- Check the filename
-      if (!file_exists($p_filedescr_list[$j]['filename'])) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
-        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
+      if (   ($p_filedescr_list[$j]['type'] != 'virtual_file')
+          && (!file_exists($p_filedescr_list[$j]['filename']))) {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
         return PclZip::errorCode();
       }
 
       // ----- Look if it is a file or a dir with no all path remove option
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
         return PclZip::errorCode();
       }
 
       // ----- Look if it is a file or a dir with no all path remove option
-      if (   (is_file($p_filedescr_list[$j]['filename']))
-          || (   is_dir($p_filedescr_list[$j]['filename'])
+      // or a dir with all its path removed
+//      if (   (is_file($p_filedescr_list[$j]['filename']))
+//          || (   is_dir($p_filedescr_list[$j]['filename'])
+      if (   ($p_filedescr_list[$j]['type'] == 'file')
+          || ($p_filedescr_list[$j]['type'] == 'virtual_file')
+          || (   ($p_filedescr_list[$j]['type'] == 'folder')
               && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
               && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
-                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
+                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
+          ) {
 
         // ----- Add the file
         $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
 
         // ----- Add the file
         $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
@@ -2512,7 +2735,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
     $v_result=1;
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
     $v_result=1;
-
+    
     // ----- Working variable
     $p_filename = $p_filedescr['filename'];
 
     // ----- Working variable
     $p_filename = $p_filedescr['filename'];
 
@@ -2525,8 +2748,9 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
       return PclZip::errorCode();
     }
       //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
       return PclZip::errorCode();
     }
-
-    // ----- Look for a stored different filename
+  
+    // ----- Look for a stored different filename 
+    /* TBC : Removed
     if (isset($p_filedescr['stored_filename'])) {
       $v_stored_filename = $p_filedescr['stored_filename'];
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
     if (isset($p_filedescr['stored_filename'])) {
       $v_stored_filename = $p_filedescr['stored_filename'];
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
@@ -2535,6 +2759,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       $v_stored_filename = $p_filedescr['stored_filename'];
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
     }
       $v_stored_filename = $p_filedescr['stored_filename'];
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
     }
+    */
 
     // ----- Set the file properties
     clearstatcache();
 
     // ----- Set the file properties
     clearstatcache();
@@ -2542,26 +2767,64 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     $p_header['version_extracted'] = 10;
     $p_header['flag'] = 0;
     $p_header['compression'] = 0;
     $p_header['version_extracted'] = 10;
     $p_header['flag'] = 0;
     $p_header['compression'] = 0;
-    $p_header['mtime'] = filemtime($p_filename);
     $p_header['crc'] = 0;
     $p_header['compressed_size'] = 0;
     $p_header['crc'] = 0;
     $p_header['compressed_size'] = 0;
-    $p_header['size'] = filesize($p_filename);
     $p_header['filename_len'] = strlen($p_filename);
     $p_header['extra_len'] = 0;
     $p_header['filename_len'] = strlen($p_filename);
     $p_header['extra_len'] = 0;
-    $p_header['comment_len'] = 0;
     $p_header['disk'] = 0;
     $p_header['internal'] = 0;
     $p_header['disk'] = 0;
     $p_header['internal'] = 0;
-//    $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
-    $p_header['external'] = (is_file($p_filename)?0x00000000:0x00000010);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
     $p_header['offset'] = 0;
     $p_header['filename'] = $p_filename;
     $p_header['offset'] = 0;
     $p_header['filename'] = $p_filename;
-    $p_header['stored_filename'] = $v_stored_filename;
+// TBC : Removed    $p_header['stored_filename'] = $v_stored_filename;
+    $p_header['stored_filename'] = $p_filedescr['stored_filename'];
     $p_header['extra'] = '';
     $p_header['extra'] = '';
-    $p_header['comment'] = '';
     $p_header['status'] = 'ok';
     $p_header['index'] = -1;
 
     $p_header['status'] = 'ok';
     $p_header['index'] = -1;
 
+    // ----- Look for regular file
+    if ($p_filedescr['type']=='file') {
+      $p_header['external'] = 0x00000000;
+      $p_header['size'] = filesize($p_filename);
+    }
+    
+    // ----- Look for regular folder
+    else if ($p_filedescr['type']=='folder') {
+      $p_header['external'] = 0x00000010;
+      $p_header['mtime'] = filemtime($p_filename);
+      $p_header['size'] = filesize($p_filename);
+    }
+    
+    // ----- Look for virtual file
+    else if ($p_filedescr['type'] == 'virtual_file') {
+      $p_header['external'] = 0x00000000;
+      $p_header['size'] = strlen($p_filedescr['content']);
+    }
+    
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
+
+    // ----- Look for filetime
+    if (isset($p_filedescr['mtime'])) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Overload mtime value with :'".$p_filedescr['mtime']."'");
+      $p_header['mtime'] = $p_filedescr['mtime'];
+    }
+    else if ($p_filedescr['type'] == 'virtual_file') {
+      $p_header['mtime'] = time();
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Virtual file : use current time '".$p_header['mtime']."' for mtime value.");
+    }
+    else {
+      $p_header['mtime'] = filemtime($p_filename);
+    }
+
+    // ------ Look for file comment
+    if (isset($p_filedescr['comment'])) {
+      $p_header['comment_len'] = strlen($p_filedescr['comment']);
+      $p_header['comment'] = $p_filedescr['comment'];
+    }
+    else {
+      $p_header['comment_len'] = 0;
+      $p_header['comment'] = '';
+    }
+
     // ----- Look for pre-add callback
     if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
     // ----- Look for pre-add callback
     if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
@@ -2592,7 +2855,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     if ($p_header['stored_filename'] == "") {
       $p_header['status'] = "filtered";
     }
     if ($p_header['stored_filename'] == "") {
       $p_header['status'] = "filtered";
     }
-
+    
     // ----- Check the path length
     if (strlen($p_header['stored_filename']) > 0xFF) {
       $p_header['status'] = 'filename_too_long';
     // ----- Check the path length
     if (strlen($p_header['stored_filename']) > 0xFF) {
       $p_header['status'] = 'filename_too_long';
@@ -2602,9 +2865,25 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     if ($p_header['status'] == 'ok') {
 
       // ----- Look for a file
     if ($p_header['status'] == 'ok') {
 
       // ----- Look for a file
-      if (is_file($p_filename))
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
+      if ($p_filedescr['type'] == 'file') {
+        // ----- Look for using temporary file to zip
+        if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
+            && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
+                || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
+                    && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
+          $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
+          if ($v_result < PCLZIP_ERR_NO_ERROR) {
+            return $v_result;
+          }
+        }
+        
+        // ----- Use "in memory" zip algo
+        else {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");      
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");      
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");      
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
+
         // ----- Open the source file
         if (($v_file = @fopen($p_filename, "rb")) == 0) {
           PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
         // ----- Open the source file
         if (($v_file = @fopen($p_filename, "rb")) == 0) {
           PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
@@ -2612,57 +2891,80 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
           return PclZip::errorCode();
         }
 
           return PclZip::errorCode();
         }
 
-        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
-          // ----- Read the file content
-          $v_content_compressed = @fread($v_file, $p_header['size']);
+        // ----- Read the file content
+        $v_content = @fread($v_file, $p_header['size']);
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");      
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");      
 
 
-          // ----- Calculate the CRC
-          $p_header['crc'] = @crc32($v_content_compressed);
+        // ----- Close the file
+        @fclose($v_file);
 
 
+        // ----- Calculate the CRC
+        $p_header['crc'] = @crc32($v_content);
+        
+        // ----- Look for no compression
+        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
           // ----- Set header parameters
           $p_header['compressed_size'] = $p_header['size'];
           $p_header['compression'] = 0;
         }
           // ----- Set header parameters
           $p_header['compressed_size'] = $p_header['size'];
           $p_header['compression'] = 0;
         }
+        
+        // ----- Look for normal compression
         else {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
         else {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
-          // ----- Read the file content
-          $v_content = @fread($v_file, $p_header['size']);
-
-          // ----- Calculate the CRC
-          $p_header['crc'] = @crc32($v_content);
-
-          // ----- Compress the file
-          $v_content_compressed = @gzdeflate($v_content);
+          // ----- Compress the content
+          $v_content = @gzdeflate($v_content);
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");      
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");      
 
           // ----- Set header parameters
 
           // ----- Set header parameters
-          $p_header['compressed_size'] = strlen($v_content_compressed);
+          $p_header['compressed_size'] = strlen($v_content);
           $p_header['compression'] = 8;
         }
           $p_header['compression'] = 8;
         }
+        
+        // ----- Call the header generation
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+          @fclose($v_file);
+          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+          return $v_result;
+        }
+
+        // ----- Write the compressed (or not) content
+        @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
 
 
-        // ----- Look for encryption
-        /*
-        if ((isset($p_options[PCLZIP_OPT_CRYPT]))
-                   && ($p_options[PCLZIP_OPT_CRYPT] != "")) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");
-
-          // Should be a random header
-          $v_header = 'xxxxxxxxxxxx';
-             $v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed,
-                                                          $p_header['compressed_size'],
-                                                      $v_header,
-                                                                                                  $p_header['crc'],
-                                                                                                  "test");
-
-          $p_header['compressed_size'] += 12;
-          $p_header['flag'] = 1;
-
-          // ----- Add the header to the data
-          $v_content_compressed = $v_header.$v_content_compressed;
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed)."");
         }
         }
-        */
 
 
+      }
+
+      // ----- Look for a virtual file (a file from string)
+      else if ($p_filedescr['type'] == 'virtual_file') {
+          
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Add by string");
+        $v_content = $p_filedescr['content'];
+
+        // ----- Calculate the CRC
+        $p_header['crc'] = @crc32($v_content);
+        
+        // ----- Look for no compression
+        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
+          // ----- Set header parameters
+          $p_header['compressed_size'] = $p_header['size'];
+          $p_header['compression'] = 0;
+        }
+        
+        // ----- Look for normal compression
+        else {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
+          // ----- Compress the content
+          $v_content = @gzdeflate($v_content);
+
+          // ----- Set header parameters
+          $p_header['compressed_size'] = strlen($v_content);
+          $p_header['compression'] = 8;
+        }
+        
         // ----- Call the header generation
         if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
           @fclose($v_file);
         // ----- Call the header generation
         if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
           @fclose($v_file);
@@ -2671,15 +2973,11 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         }
 
         // ----- Write the compressed (or not) content
         }
 
         // ----- Write the compressed (or not) content
-        @fwrite($this->zip_fd,
-                           $v_content_compressed, $p_header['compressed_size']);
-
-        // ----- Close the file
-        @fclose($v_file);
+        @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
       }
 
       // ----- Look for a directory
       }
 
       // ----- Look for a directory
-      else {
+      else if ($p_filedescr['type'] == 'folder') {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
         // ----- Look for directory last '/'
         if (@substr($p_header['stored_filename'], -1) != '/') {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
         // ----- Look for directory last '/'
         if (@substr($p_header['stored_filename'], -1) != '/') {
@@ -2727,6 +3025,141 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   }
   // --------------------------------------------------------------------------------
 
   }
   // --------------------------------------------------------------------------------
 
+  // --------------------------------------------------------------------------------
+  // Function : privAddFileUsingTempFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileUsingTempFile", "filename='".$p_filedescr['filename']."'");
+    $v_result=PCLZIP_ERR_NO_ERROR;
+    
+    // ----- Working variable
+    $p_filename = $p_filedescr['filename'];
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
+
+    // ----- Open the source file
+    if (($v_file = @fopen($p_filename, "rb")) == 0) {
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Creates a compressed temporary file
+    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
+    if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
+      fclose($v_file);
+      PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    $v_size = filesize($p_filename);
+    while ($v_size != 0) {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v_read_size." bytes");
+      $v_buffer = @fread($v_file, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @gzputs($v_file_compressed, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Close the file
+    @fclose($v_file);
+    @gzclose($v_file_compressed);
+
+    // ----- Check the minimum file size
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "gzip file size ".filesize($v_gzip_temp_name));
+    if (filesize($v_gzip_temp_name) < 18) {
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the compressed attributes
+    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the gzip file header
+    $v_binary_data = @fread($v_file_compressed, 10);
+    $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
+
+    // ----- Check some parameters
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[id1]='.bin2hex($v_data_header['id1']));
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[id2]='.bin2hex($v_data_header['id2']));
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[cm]='.bin2hex($v_data_header['cm']));
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[flag]='.bin2hex($v_data_header['flag']));
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[mtime]='.$v_data_header['mtime']);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[xfl]='.bin2hex($v_data_header['xfl']));
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[os]='.bin2hex($v_data_header['os']));
+    $v_data_header['os'] = bin2hex($v_data_header['os']);
+
+    // ----- Read the gzip file footer
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after header ".ftell($v_file_compressed));
+    @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position at beginning of footer ".ftell($v_file_compressed));
+    $v_binary_data = @fread($v_file_compressed, 8);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after footer ".ftell($v_file_compressed));
+    $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
+
+    // ----- Set the attributes
+    $p_header['compression'] = ord($v_data_header['cm']);
+    //$p_header['mtime'] = $v_data_header['mtime'];
+    $p_header['crc'] = $v_data_footer['crc'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Compressed size ".(filesize($v_gzip_temp_name)-18));
+    $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
+
+    // ----- Close the file
+    @fclose($v_file_compressed);
+
+    // ----- Call the header generation
+    if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Add the compressed data
+    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
+    {
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    fseek($v_file_compressed, 10);
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position before reading compressed data ".ftell($v_file_compressed));
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, ' '.$p_header['compressed_size'].' bytes to read');
+    $v_size = $p_header['compressed_size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v_read_size." bytes");
+      $v_buffer = @fread($v_file_compressed, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Close the file
+    @fclose($v_file_compressed);
+
+    // ----- Unlink the temporary file
+    @unlink($v_gzip_temp_name);
+    
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
   // --------------------------------------------------------------------------------
   // Function : privCalculateStoredFilename()
   // Description :
   // --------------------------------------------------------------------------------
   // Function : privCalculateStoredFilename()
   // Description :
@@ -2739,7 +3172,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
     $v_result=1;
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
     $v_result=1;
-
+    
     // ----- Working variables
     $p_filename = $p_filedescr['filename'];
     if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
     // ----- Working variables
     $p_filename = $p_filedescr['filename'];
     if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
@@ -2754,6 +3187,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     else {
       $p_remove_dir = '';
     }
     else {
       $p_remove_dir = '';
     }
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Remove path ='".$p_remove_dir."'");
     if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
       $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
     }
     if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
       $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
     }
@@ -2763,14 +3197,16 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
     // ----- Look for full name change
     if (isset($p_filedescr['new_full_name'])) {
 
     // ----- Look for full name change
     if (isset($p_filedescr['new_full_name'])) {
-      $v_stored_filename = $p_filedescr['new_full_name'];
+      // ----- Remove drive letter if any
+      $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
     }
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
     }
-
+    
     // ----- Look for path and/or short name change
     else {
 
       // ----- Look for short name change
     // ----- Look for path and/or short name change
     else {
 
       // ----- Look for short name change
+      // Its when we cahnge just the filename but not the path
       if (isset($p_filedescr['new_short_name'])) {
         $v_path_info = pathinfo($p_filename);
         $v_dir = '';
       if (isset($p_filedescr['new_short_name'])) {
         $v_path_info = pathinfo($p_filename);
         $v_dir = '';
@@ -2792,12 +3228,13 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       }
       // ----- Look for partial path remove
       else if ($p_remove_dir != "") {
       }
       // ----- Look for partial path remove
       else if ($p_remove_dir != "") {
+        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Partial path to remove");
         if (substr($p_remove_dir, -1) != '/')
           $p_remove_dir .= "/";
 
         if (   (substr($p_filename, 0, 2) == "./")
             || (substr($p_remove_dir, 0, 2) == "./")) {
         if (substr($p_remove_dir, -1) != '/')
           $p_remove_dir .= "/";
 
         if (   (substr($p_filename, 0, 2) == "./")
             || (substr($p_remove_dir, 0, 2) == "./")) {
-
+            
           if (   (substr($p_filename, 0, 2) == "./")
               && (substr($p_remove_dir, 0, 2) != "./")) {
             $p_remove_dir = "./".$p_remove_dir;
           if (   (substr($p_filename, 0, 2) == "./")
               && (substr($p_remove_dir, 0, 2) != "./")) {
             $p_remove_dir = "./".$p_remove_dir;
@@ -2823,6 +3260,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
           }
         }
       }
           }
         }
       }
+      
+      // ----- Remove drive letter if any
+      $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
+      
       // ----- Look for path to add
       if ($p_add_dir != "") {
         if (substr($p_add_dir, -1) == "/")
       // ----- Look for path to add
       if ($p_add_dir != "") {
         if (substr($p_add_dir, -1) == "/")
@@ -2837,7 +3278,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
     $p_filedescr['stored_filename'] = $v_stored_filename;
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
     $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
     $p_filedescr['stored_filename'] = $v_stored_filename;
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
-
+    
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     return $v_result;
@@ -2915,6 +3356,8 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
     $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
 
     $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
     $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
 
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$p_header['comment_len'].'\'');
+
     // ----- Packed data
     $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
                              $p_header['version'], $p_header['version_extracted'],
     // ----- Packed data
     $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
                              $p_header['version'], $p_header['version_extracted'],
@@ -3000,7 +3443,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     {
       // ----- Magic quotes trick
       $this->privSwapBackMagicQuotes();
     {
       // ----- Magic quotes trick
       $this->privSwapBackMagicQuotes();
-
+      
       // ----- Error log
       PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
 
       // ----- Error log
       PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
 
@@ -3080,6 +3523,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   //     $p_info['comment'] = Comment associated with the file.
   //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.
   //     $p_info['status'] = status of the action on the file.
   //     $p_info['comment'] = Comment associated with the file.
   //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.
   //     $p_info['status'] = status of the action on the file.
+  //     $p_info['crc'] = CRC of the file content.
   // Parameters :
   // Return Values :
   // --------------------------------------------------------------------------------
   // Parameters :
   // Return Values :
   // --------------------------------------------------------------------------------
@@ -3089,8 +3533,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     $v_result=1;
 
     // ----- Get the interesting attributes
     $v_result=1;
 
     // ----- Get the interesting attributes
-    $p_info['filename'] = $p_header['filename'];
-    $p_info['stored_filename'] = $p_header['stored_filename'];
+    $v_temp_path = PclZipUtilPathReduction($p_header['filename']);
+    $p_info['filename'] = $v_temp_path;
+    $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']);
+    $p_info['stored_filename'] = $v_temp_path;
     $p_info['size'] = $p_header['size'];
     $p_info['compressed_size'] = $p_header['compressed_size'];
     $p_info['mtime'] = $p_header['mtime'];
     $p_info['size'] = $p_header['size'];
     $p_info['compressed_size'] = $p_header['compressed_size'];
     $p_info['mtime'] = $p_header['mtime'];
@@ -3098,6 +3544,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
     $p_info['index'] = $p_header['index'];
     $p_info['status'] = $p_header['status'];
     $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
     $p_info['index'] = $p_header['index'];
     $p_info['status'] = $p_header['status'];
+    $p_info['crc'] = $p_header['crc'];
 
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
 
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
@@ -3279,7 +3726,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
                && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
       else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
                && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
-
+          
           // ----- Look if the index is in the list
           for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
               //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
           // ----- Look if the index is in the list
           for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
               //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
@@ -3319,7 +3766,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
               //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
 
               $this->privSwapBackMagicQuotes();
               //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
 
               $this->privSwapBackMagicQuotes();
-
+              
               PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
                                               "Filename '".$v_header['stored_filename']."' is "
                                                           ."compressed by an unsupported compression "
               PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
                                               "Filename '".$v_header['stored_filename']."' is "
                                                           ."compressed by an unsupported compression "
@@ -3329,7 +3776,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
               return PclZip::errorCode();
                  }
          }
               return PclZip::errorCode();
                  }
          }
-
+         
          // ----- Check encrypted files
          if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
          // ----- Check encrypted files
          if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
@@ -3366,7 +3813,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
           $v_extract = false;
       }
 
           $v_extract = false;
       }
-
+      
       // ----- Look for real extraction
       if ($v_extract)
       {
       // ----- Look for real extraction
       if ($v_extract)
       {
@@ -3420,7 +3867,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
           // ----- Next extracted file
           $v_nb_extracted++;
 
           // ----- Next extracted file
           $v_nb_extracted++;
-
+          
           // ----- Look for user callback abort
           if ($v_result1 == 2) {
                break;
           // ----- Look for user callback abort
           if ($v_result1 == 2) {
                break;
@@ -3572,13 +4019,13 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     if ($p_path != '') {
       $p_entry['filename'] = $p_path."/".$p_entry['filename'];
     }
     if ($p_path != '') {
       $p_entry['filename'] = $p_path."/".$p_entry['filename'];
     }
-
+    
     // ----- Check a base_dir_restriction
     if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
       $v_inclusion
       = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
     // ----- Check a base_dir_restriction
     if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
       $v_inclusion
       = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
-                                $p_entry['filename']);
+                                $p_entry['filename']); 
       if ($v_inclusion == 0) {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
 
       if ($v_inclusion == 0) {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
 
@@ -3608,7 +4055,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         $p_entry['status'] = "skipped";
         $v_result = 1;
       }
         $p_entry['status'] = "skipped";
         $v_result = 1;
       }
-
+      
       // ----- Look for abort result
       if ($v_result == 2) {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
       // ----- Look for abort result
       if ($v_result == 2) {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
@@ -3640,7 +4087,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
         // ----- Change the file status
         $p_entry['status'] = "already_a_directory";
 
         // ----- Change the file status
         $p_entry['status'] = "already_a_directory";
-
+        
         // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
         // For historical reason first PclZip implementation does not stop
         // when this kind of error occurs.
         // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
         // For historical reason first PclZip implementation does not stop
         // when this kind of error occurs.
@@ -3654,7 +4101,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
 
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
-               }
+                   }
       }
       // ----- Look if file is write protected
       else if (!is_writeable($p_entry['filename']))
       }
       // ----- Look if file is write protected
       else if (!is_writeable($p_entry['filename']))
@@ -3677,7 +4124,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
 
             //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
             return PclZip::errorCode();
-               }
+                   }
       }
 
       // ----- Look if the extracted file is older
       }
 
       // ----- Look if the extracted file is older
@@ -3688,8 +4135,8 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
                    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
         if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
                    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
-               }
-               else {
+                 }
+                   else {
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
             $p_entry['status'] = "newer_exist";
 
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
             $p_entry['status'] = "newer_exist";
 
@@ -3706,8 +4153,8 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                 return PclZip::errorCode();
 
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
                 return PclZip::errorCode();
+                     }
                    }
                    }
-               }
       }
       else {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
       }
       else {
         //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
@@ -3723,19 +4170,19 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       else
         $v_dir_to_check = dirname($p_entry['filename']);
 
       else
         $v_dir_to_check = dirname($p_entry['filename']);
 
-      if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
-
-        // ----- Change the file status
-        $p_entry['status'] = "path_creation_fail";
-
-        // ----- Return
-        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-        //return $v_result;
-        $v_result = 1;
+        if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
+  
+          // ----- Change the file status
+          $p_entry['status'] = "path_creation_fail";
+  
+          // ----- Return
+          ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+          //return $v_result;
+          $v_result = 1;
+        }
       }
     }
       }
     }
-    }
 
     // ----- Look if extraction should be done
     if ($p_entry['status'] == 'ok') {
 
     // ----- Look if extraction should be done
     if ($p_entry['status'] == 'ok') {
@@ -3747,7 +4194,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         if ($p_entry['compression'] == 0) {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
 
         if ($p_entry['compression'] == 0) {
           //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
 
-                 // ----- Opening destination file
+                 // ----- Opening destination file
           if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
           {
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
           if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
           {
             //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
@@ -3773,7 +4220,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
             $v_binary_data = pack('a'.$v_read_size, $v_buffer);
             @fwrite($v_dest_file, $v_binary_data, $v_read_size);
             */
             $v_binary_data = pack('a'.$v_read_size, $v_buffer);
             @fwrite($v_dest_file, $v_binary_data, $v_read_size);
             */
-            @fwrite($v_dest_file, $v_buffer, $v_read_size);
+            @fwrite($v_dest_file, $v_buffer, $v_read_size);            
             $v_size -= $v_read_size;
           }
 
             $v_size -= $v_read_size;
           }
 
@@ -3782,7 +4229,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
           // ----- Change the file mtime
           touch($p_entry['filename'], $p_entry['mtime']);
 
           // ----- Change the file mtime
           touch($p_entry['filename'], $p_entry['mtime']);
-
+          
 
         }
         else {
 
         }
         else {
@@ -3790,60 +4237,66 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
           // ----- TBC
           // Need to be finished
           if (($p_entry['flag'] & 1) == 1) {
           // ----- TBC
           // Need to be finished
           if (($p_entry['flag'] & 1) == 1) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
-            /*
-              // ----- Read the encryption header
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");
-              $v_encryption_header = @fread($this->zip_fd, 12);
-
-              // ----- Read the encrypted & compressed file in a buffer
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");
-              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);
-
-              // ----- Decrypt the buffer
-              $this->privDecrypt($v_encryption_header, $v_buffer,
-                                            $p_entry['compressed_size']-12, $p_entry['crc']);
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Buffer is '".$v_buffer."'");
-              */
-          }
-          else {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
-              // ----- Read the compressed file in a buffer (one shot)
-              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
+            PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
+            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+            return PclZip::errorCode();
           }
 
           }
 
-          // ----- Decompress the file
-          $v_file_content = @gzinflate($v_buffer);
-          unset($v_buffer);
-          if ($v_file_content === FALSE) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
-
-            // ----- Change the file status
-            // TBC
-            $p_entry['status'] = "error";
 
 
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
+          // ----- Look for using temporary file to unzip
+          if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
+              && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
+                  || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
+                      && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
+            $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
+            if ($v_result < PCLZIP_ERR_NO_ERROR) {
+              return $v_result;
+            }
           }
           }
+          
+          // ----- Look for extract in memory
+          else {
 
 
-          // ----- Opening destination file
-          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
-
-            // ----- Change the file status
-            $p_entry['status'] = "write_error";
-
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
+            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
+          
+            // ----- Read the compressed file in a buffer (one shot)
+            $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+            
+            // ----- Decompress the file
+            $v_file_content = @gzinflate($v_buffer);
+            unset($v_buffer);
+            if ($v_file_content === FALSE) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
+  
+              // ----- Change the file status
+              // TBC
+              $p_entry['status'] = "error";
+              
+              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+              return $v_result;
+            }
+            
+            // ----- Opening destination file
+            if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
+  
+              // ----- Change the file status
+              $p_entry['status'] = "write_error";
+  
+              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+              return $v_result;
+            }
+  
+            // ----- Write the uncompressed data
+            @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
+            unset($v_file_content);
+  
+            // ----- Closing the destination file
+            @fclose($v_dest_file);
+            
           }
 
           }
 
-          // ----- Write the uncompressed data
-          @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
-          unset($v_file_content);
-
-          // ----- Closing the destination file
-          @fclose($v_dest_file);
-
           // ----- Change the file mtime
           @touch($p_entry['filename'], $p_entry['mtime']);
         }
           // ----- Change the file mtime
           @touch($p_entry['filename'], $p_entry['mtime']);
         }
@@ -3864,7 +4317,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
        if ($p_entry['status'] == "aborted") {
       $p_entry['status'] = "skipped";
        }
        if ($p_entry['status'] == "aborted") {
       $p_entry['status'] = "skipped";
        }
-
+       
     // ----- Look for post-extract callback
     elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
     // ----- Look for post-extract callback
     elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
@@ -3891,6 +4344,95 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   }
   // --------------------------------------------------------------------------------
 
   }
   // --------------------------------------------------------------------------------
 
+  // --------------------------------------------------------------------------------
+  // Function : privExtractFileUsingTempFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privExtractFileUsingTempFile(&$p_entry, &$p_options)
+  {
+    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileUsingTempFile', "filename='".$p_entry['filename']."'");
+    $v_result=1;
+        
+    // ----- Creates a temporary file
+    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
+    if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
+      fclose($v_file);
+      PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Start extraction of '".$p_entry['filename']."'");
+
+    // ----- Write gz file format header
+    $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
+    @fwrite($v_dest_file, $v_binary_data, 10);
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    $v_size = $p_entry['compressed_size'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Compressed Size :".$v_size."");
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
+      $v_buffer = @fread($this->zip_fd, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @fwrite($v_dest_file, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Write gz file format footer
+    $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
+    @fwrite($v_dest_file, $v_binary_data, 8);
+
+    // ----- Close the temporary file
+    @fclose($v_dest_file);
+
+    // ----- Opening destination file
+    if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
+      $p_entry['status'] = "write_error";
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+      return $v_result;
+    }
+
+    // ----- Open the temporary gz file
+    if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
+      @fclose($v_dest_file);
+      $p_entry['status'] = "read_error";
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
+      return PclZip::errorCode();
+    }
+
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File size is '.filesize($v_gzip_temp_name));
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    $v_size = $p_entry['size'];
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size :".$v_size."");
+    while ($v_size != 0) {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
+      $v_buffer = @gzread($v_src_file, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @fwrite($v_dest_file, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+    @fclose($v_dest_file);
+    @gzclose($v_src_file);
+
+    // ----- Delete the temporary file
+    @unlink($v_gzip_temp_name);
+    
+    // ----- Return
+    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
   // --------------------------------------------------------------------------------
   // Function : privExtractFileInOutput()
   // Description :
   // --------------------------------------------------------------------------------
   // Function : privExtractFileInOutput()
   // Description :
@@ -3973,7 +4515,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
           // ----- Read the compressed file in a buffer (one shot)
           $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
 
           // ----- Read the compressed file in a buffer (one shot)
           $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
-
+          
           // ----- Decompress the file
           $v_file_content = gzinflate($v_buffer);
           unset($v_buffer);
           // ----- Decompress the file
           $v_file_content = gzinflate($v_buffer);
           unset($v_buffer);
@@ -4062,7 +4604,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
 
         // ----- Reading the file
         $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
 
         // ----- Reading the file
         $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
-
+        
         // ----- Decompress the file
         if (($p_string = @gzinflate($v_data)) === FALSE) {
             // TBC
         // ----- Decompress the file
         if (($p_string = @gzinflate($v_data)) === FALSE) {
             // TBC
@@ -4163,6 +4705,8 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
     $p_header['flag'] = $v_data['flag'];
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
     $p_header['flag'] = $v_data['flag'];
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from right) : \''.($p_header['flag']&0x0400).'\'');
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from left) : \''.($p_header['flag']&0x0020).'\'');
     $p_header['filename_len'] = $v_data['filename_len'];
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');
 
     $p_header['filename_len'] = $v_data['filename_len'];
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');
 
@@ -4182,7 +4726,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       $v_day = $p_header['mdate'] & 0x001F;
 
       // ----- Get UNIX date format
       $v_day = $p_header['mdate'] & 0x001F;
 
       // ----- Get UNIX date format
-      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+      $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
 
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
     }
 
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
     }
@@ -4296,7 +4840,9 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
 
     // ----- Recuperate date in UNIX format
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
 
     // ----- Recuperate date in UNIX format
-    if ($p_header['mdate'] && $p_header['mtime'])
+    //if ($p_header['mdate'] && $p_header['mtime'])
+    // TBC : bug : this was ignoring time with 0/0/0
+    if (1)
     {
       // ----- Extract time
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
     {
       // ----- Extract time
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
@@ -4309,7 +4855,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
       $v_day = $p_header['mdate'] & 0x001F;
 
       // ----- Get UNIX date format
       $v_day = $p_header['mdate'] & 0x001F;
 
       // ----- Get UNIX date format
-      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+      $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
 
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
     }
 
       //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
     }
@@ -4355,38 +4901,38 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
     $v_result=1;
 
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
     $v_result=1;
 
-       // ----- Check the static values
-       // TBC
-       if ($p_local_header['filename'] != $p_central_header['filename']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
-       }
-       if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
-       }
-       if ($p_local_header['flag'] != $p_central_header['flag']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
-       }
-       if ($p_local_header['compression'] != $p_central_header['compression']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
-       }
-       if ($p_local_header['mtime'] != $p_central_header['mtime']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
-       }
-       if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
-       }
-
-       // ----- Look for flag bit 3
-       if (($p_local_header['flag'] & 8) == 8) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
-        $p_local_header['size'] = $p_central_header['size'];
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
-        $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
-        $p_local_header['crc'] = $p_central_header['crc'];
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
-       }
+       // ----- Check the static values
+       // TBC
+       if ($p_local_header['filename'] != $p_central_header['filename']) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
+       }
+       if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
+       }
+       if ($p_local_header['flag'] != $p_central_header['flag']) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
+       }
+       if ($p_local_header['compression'] != $p_central_header['compression']) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
+       }
+       if ($p_local_header['mtime'] != $p_central_header['mtime']) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
+       }
+       if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
+       }
+  
+       // ----- Look for flag bit 3
+       if (($p_local_header['flag'] & 8) == 8) {
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
+          $p_local_header['size'] = $p_central_header['size'];
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
+          $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
+          $p_local_header['crc'] = $p_central_header['crc'];
+          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
+       }
 
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
 
     // ----- Return
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
@@ -4479,9 +5025,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         $v_byte = @fread($this->zip_fd, 1);
 
         // -----  Add the byte
         $v_byte = @fread($this->zip_fd, 1);
 
         // -----  Add the byte
-        // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
-        // Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
-        $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
+        // $v_bytes = ($v_bytes << 8) | Ord($v_byte);
+        // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number 
+        // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. 
+        $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 
 
         // ----- Compare the bytes
         if ($v_bytes == 0x504b0506)
 
         // ----- Compare the bytes
         if ($v_bytes == 0x504b0506)
@@ -4551,8 +5098,10 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
     }
 
     // ----- Get comment
     }
 
     // ----- Get comment
-    if ($v_data['comment_size'] != 0)
+    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$v_data['comment_size'].'\'');
+    if ($v_data['comment_size'] != 0) {
       $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
       $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
+    }
     else
       $p_central_dir['comment'] = '';
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
     else
       $p_central_dir['comment'] = '';
     //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
@@ -4814,7 +5363,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
                 //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
                 return $v_result;
             }
-
+            
             // ----- Check that local file header is same as central file header
             if ($this->privCheckFileHeaders($v_local_header,
                                                        $v_header_list[$i]) != 1) {
             // ----- Check that local file header is same as central file header
             if ($this->privCheckFileHeaders($v_local_header,
                                                        $v_header_list[$i]) != 1) {
@@ -4907,11 +5456,11 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
         // TBC : I should test the result ...
         //@rename($v_zip_temp_name, $this->zipname);
         PclZipUtilRename($v_zip_temp_name, $this->zipname);
         // TBC : I should test the result ...
         //@rename($v_zip_temp_name, $this->zipname);
         PclZipUtilRename($v_zip_temp_name, $this->zipname);
-
+    
         // ----- Destroy the temporary archive
         unset($v_temp_zip);
     }
         // ----- Destroy the temporary archive
         unset($v_temp_zip);
     }
-
+    
     // ----- Remove every files : reset the file
     else if ($v_central_dir['entries'] != 0) {
         $this->privCloseFd();
     // ----- Remove every files : reset the file
     else if ($v_central_dir['entries'] != 0) {
         $this->privCloseFd();
@@ -5316,29 +5865,6 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   }
   // --------------------------------------------------------------------------------
 
   }
   // --------------------------------------------------------------------------------
 
-  // --------------------------------------------------------------------------------
-  // Function : privDecrypt()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privDecrypt($p_encryption_header, &$p_buffer, $p_size, $p_crc)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");
-    $v_result=1;
-
-    // ----- To Be Modified ;-)
-    $v_pwd = "test";
-
-    $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,
-                                        $p_crc, $v_pwd);
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
   // --------------------------------------------------------------------------------
   // Function : privDisableMagicQuotes()
   // Description :
   // --------------------------------------------------------------------------------
   // Function : privDisableMagicQuotes()
   // Description :
@@ -5482,7 +6008,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
                  }
         }
       }
                  }
         }
       }
-
+      
       // ----- Look for skip
       if ($v_skip > 0) {
         while ($v_skip > 0) {
       // ----- Look for skip
       if ($v_skip > 0) {
         while ($v_skip > 0) {
@@ -5517,7 +6043,7 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
     $v_result = 1;
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
     $v_result = 1;
-
+    
     // ----- Look for path beginning by ./
     if (   ($p_dir == '.')
         || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
     // ----- Look for path beginning by ./
     if (   ($p_dir == '.')
         || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
@@ -5708,19 +6234,19 @@ define( 'PCLZIP_ERROR_EXTERNAL', 0 );
   function PclZipUtilOptionText($p_option)
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
   function PclZipUtilOptionText($p_option)
   {
     //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
-
+    
     $v_list = get_defined_constants();
     for (reset($v_list); $v_key = key($v_list); next($v_list)) {
     $v_list = get_defined_constants();
     for (reset($v_list); $v_key = key($v_list); next($v_list)) {
-         $v_prefix = substr($v_key, 0, 10);
-         if ((   ($v_prefix == 'PCLZIP_OPT')
-         || ($v_prefix == 'PCLZIP_CB_')
-         || ($v_prefix == 'PCLZIP_ATT'))
-             && ($v_list[$v_key] == $p_option)) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
-          return $v_key;
+           $v_prefix = substr($v_key, 0, 10);
+           if ((   ($v_prefix == 'PCLZIP_OPT')
+           || ($v_prefix == 'PCLZIP_CB_')
+           || ($v_prefix == 'PCLZIP_ATT'))
+               && ($v_list[$v_key] == $p_option)) {
+        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
+        return $v_key;
            }
     }
            }
     }
-
+    
     $v_result = 'Unknown';
 
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
     $v_result = 'Unknown';
 
     //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
index eefdd1c28aaaf1d9c666c31e346022aa11510c41..2569a8674ac69e65129f98183dbd64ad2ba387d9 100644 (file)
@@ -46,8 +46,6 @@ class WP_Filesystem_Base {
         * @return string The location of the remote path.
         */
        function abspath() {
         * @return string The location of the remote path.
         */
        function abspath() {
-               if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false )
-                       return FTP_BASE;
                $folder = $this->find_folder(ABSPATH);
                //Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
                if ( ! $folder && $this->is_dir('/wp-includes') )
                $folder = $this->find_folder(ABSPATH);
                //Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.
                if ( ! $folder && $this->is_dir('/wp-includes') )
@@ -62,8 +60,6 @@ class WP_Filesystem_Base {
         * @return string The location of the remote path.
         */
        function wp_content_dir() {
         * @return string The location of the remote path.
         */
        function wp_content_dir() {
-               if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false )
-                       return FTP_CONTENT_DIR;
                return $this->find_folder(WP_CONTENT_DIR);
        }
        /**
                return $this->find_folder(WP_CONTENT_DIR);
        }
        /**
@@ -75,8 +71,6 @@ class WP_Filesystem_Base {
         * @return string The location of the remote path.
         */
        function wp_plugins_dir() {
         * @return string The location of the remote path.
         */
        function wp_plugins_dir() {
-               if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false )
-                       return FTP_PLUGIN_DIR;
                return $this->find_folder(WP_PLUGIN_DIR);
        }
        /**
                return $this->find_folder(WP_PLUGIN_DIR);
        }
        /**
@@ -142,6 +136,15 @@ class WP_Filesystem_Base {
         */
        function find_folder($folder) {
 
         */
        function find_folder($folder) {
 
+               if ( strpos($this->method, 'ftp') !== false ) {
+                       $constant_overrides = array( 'FTP_BASE' => ABSPATH, 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR );
+                       foreach ( $constant_overrides as $constant => $dir )
+                               if ( defined($constant) && $folder === $dir )
+                                       return trailingslashit(constant($constant));
+               } elseif ( 'direct' == $this->method ) {
+                       return trailingslashit($folder);
+               }
+
                $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
                $folder = str_replace('\\', '/', $folder); //Windows path sanitiation
 
                $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
                $folder = str_replace('\\', '/', $folder); //Windows path sanitiation
 
@@ -149,6 +152,7 @@ class WP_Filesystem_Base {
                        return $this->cache[ $folder ];
 
                if ( $this->exists($folder) ) { //Folder exists at that absolute path.
                        return $this->cache[ $folder ];
 
                if ( $this->exists($folder) ) { //Folder exists at that absolute path.
+                       $folder = trailingslashit($folder);
                        $this->cache[ $folder ] = $folder;
                        return $folder;
                }
                        $this->cache[ $folder ] = $folder;
                        return $folder;
                }
@@ -189,23 +193,23 @@ class WP_Filesystem_Base {
                        // If its found, change into it and follow through looking for it.
                        // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
                        // If it reaches the end, and still cant find it, it'll return false for the entire function.
                        // If its found, change into it and follow through looking for it.
                        // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
                        // If it reaches the end, and still cant find it, it'll return false for the entire function.
-                       if( isset($files[ $key ]) ){
+                       if ( isset($files[ $key ]) ){
                                //Lets try that folder:
                                $newdir = trailingslashit(path_join($base, $key));
                                //Lets try that folder:
                                $newdir = trailingslashit(path_join($base, $key));
-                               if( $this->verbose )
+                               if ( $this->verbose )
                                        printf( __('Changing to %s') . '<br/>', $newdir );
                                        printf( __('Changing to %s') . '<br/>', $newdir );
-                               if( $ret = $this->search_for_folder( $folder, $newdir, $loop) )
+                               if ( $ret = $this->search_for_folder( $folder, $newdir, $loop) )
                                        return $ret;
                        }
                }
 
                //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
                                        return $ret;
                        }
                }
 
                //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
-               if(isset( $files[ $last_path ] ) ) {
-                       if( $this->verbose )
+               if (isset( $files[ $last_path ] ) ) {
+                       if ( $this->verbose )
                                printf( __('Found %s') . '<br/>',  $base . $last_path );
                                printf( __('Found %s') . '<br/>',  $base . $last_path );
-                       return $base . $last_path;
+                       return trailingslashit($base . $last_path);
                }
                }
-               if( $loop )
+               if ( $loop )
                        return false;//Prevent tihs function looping again.
                //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
                return $this->search_for_folder($folder, '/', true);
                        return false;//Prevent tihs function looping again.
                //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
                return $this->search_for_folder($folder, '/', true);
index 4801b5f83576b84ad0f76ee9fc0d49feb94d2e04..7878c2fa2b0eafb55a2f09b941263877ef7c2a82 100644 (file)
@@ -14,9 +14,9 @@
  * @subpackage Filesystem
  * @uses WP_Filesystem_Base Extends class
  */
  * @subpackage Filesystem
  * @uses WP_Filesystem_Base Extends class
  */
-class WP_Filesystem_Direct  extends WP_Filesystem_Base {
+class WP_Filesystem_Direct extends WP_Filesystem_Base {
        var $permission = null;
        var $permission = null;
-       var $errors = array();
+       var $errors = null;
        function WP_Filesystem_Direct($arg) {
                $this->method = 'direct';
                $this->errors = new WP_Error();
        function WP_Filesystem_Direct($arg) {
                $this->method = 'direct';
                $this->errors = new WP_Error();
@@ -49,82 +49,82 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
                return @chdir($dir);
        }
        function chgrp($file, $group, $recursive = false) {
                return @chdir($dir);
        }
        function chgrp($file, $group, $recursive = false) {
-               if( ! $this->exists($file) )
+               if ( ! $this->exists($file) )
                        return false;
                        return false;
-               if( ! $recursive )
+               if ( ! $recursive )
                        return @chgrp($file, $group);
                        return @chgrp($file, $group);
-               if( ! $this->is_dir($file) )
+               if ( ! $this->is_dir($file) )
                        return @chgrp($file, $group);
                //Is a directory, and we want recursive
                $file = trailingslashit($file);
                $filelist = $this->dirlist($file);
                        return @chgrp($file, $group);
                //Is a directory, and we want recursive
                $file = trailingslashit($file);
                $filelist = $this->dirlist($file);
-               foreach($filelist as $filename)
+               foreach ($filelist as $filename)
                        $this->chgrp($file . $filename, $group, $recursive);
 
                return true;
        }
        function chmod($file, $mode = false, $recursive = false) {
                        $this->chgrp($file . $filename, $group, $recursive);
 
                return true;
        }
        function chmod($file, $mode = false, $recursive = false) {
-               if( ! $mode )
+               if ( ! $mode )
                        $mode = $this->permission;
                        $mode = $this->permission;
-               if( ! $this->exists($file) )
+               if ( ! $this->exists($file) )
                        return false;
                        return false;
-               if( ! $recursive )
+               if ( ! $recursive )
                        return @chmod($file,$mode);
                        return @chmod($file,$mode);
-               if( ! $this->is_dir($file) )
+               if ( ! $this->is_dir($file) )
                        return @chmod($file, $mode);
                //Is a directory, and we want recursive
                $file = trailingslashit($file);
                $filelist = $this->dirlist($file);
                        return @chmod($file, $mode);
                //Is a directory, and we want recursive
                $file = trailingslashit($file);
                $filelist = $this->dirlist($file);
-               foreach($filelist as $filename)
+               foreach ($filelist as $filename)
                        $this->chmod($file . $filename, $mode, $recursive);
 
                return true;
        }
        function chown($file, $owner, $recursive = false) {
                        $this->chmod($file . $filename, $mode, $recursive);
 
                return true;
        }
        function chown($file, $owner, $recursive = false) {
-               if( ! $this->exists($file) )
+               if ( ! $this->exists($file) )
                        return false;
                        return false;
-               if( ! $recursive )
+               if ( ! $recursive )
                        return @chown($file, $owner);
                        return @chown($file, $owner);
-               if( ! $this->is_dir($file) )
+               if ( ! $this->is_dir($file) )
                        return @chown($file, $owner);
                //Is a directory, and we want recursive
                $filelist = $this->dirlist($file);
                        return @chown($file, $owner);
                //Is a directory, and we want recursive
                $filelist = $this->dirlist($file);
-               foreach($filelist as $filename){
+               foreach ($filelist as $filename){
                        $this->chown($file . '/' . $filename, $owner, $recursive);
                }
                return true;
        }
        function owner($file) {
                $owneruid = @fileowner($file);
                        $this->chown($file . '/' . $filename, $owner, $recursive);
                }
                return true;
        }
        function owner($file) {
                $owneruid = @fileowner($file);
-               if( ! $owneruid )
+               if ( ! $owneruid )
                        return false;
                        return false;
-               if( ! function_exists('posix_getpwuid') )
+               if ( ! function_exists('posix_getpwuid') )
                        return $owneruid;
                $ownerarray = posix_getpwuid($owneruid);
                return $ownerarray['name'];
        }
        function getchmod($file) {
                        return $owneruid;
                $ownerarray = posix_getpwuid($owneruid);
                return $ownerarray['name'];
        }
        function getchmod($file) {
-               return @fileperms($file);
+               return substr(decoct(@fileperms($file)),3);
        }
        function group($file) {
                $gid = @filegroup($file);
        }
        function group($file) {
                $gid = @filegroup($file);
-               if( ! $gid )
+               if ( ! $gid )
                        return false;
                        return false;
-               if( ! function_exists('posix_getgrgid') )
+               if ( ! function_exists('posix_getgrgid') )
                        return $gid;
                $grouparray = posix_getgrgid($gid);
                return $grouparray['name'];
        }
 
        function copy($source, $destination, $overwrite = false) {
                        return $gid;
                $grouparray = posix_getgrgid($gid);
                return $grouparray['name'];
        }
 
        function copy($source, $destination, $overwrite = false) {
-               if( ! $overwrite && $this->exists($destination) )
+               if ( ! $overwrite && $this->exists($destination) )
                        return false;
                return copy($source, $destination);
        }
 
        function move($source, $destination, $overwrite = false) {
                //Possible to use rename()?
                        return false;
                return copy($source, $destination);
        }
 
        function move($source, $destination, $overwrite = false) {
                //Possible to use rename()?
-               if( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ){
+               if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ){
                        $this->delete($source);
                        return true;
                } else {
                        $this->delete($source);
                        return true;
                } else {
@@ -133,11 +133,13 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
        }
 
        function delete($file, $recursive = false) {
        }
 
        function delete($file, $recursive = false) {
+               if ( empty($file) ) //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
+                       return false;
                $file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise
 
                $file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise
 
-               if( $this->is_file($file) )
+               if ( $this->is_file($file) )
                        return @unlink($file);
                        return @unlink($file);
-               if( ! $recursive && $this->is_dir($file) )
+               if ( ! $recursive && $this->is_dir($file) )
                        return @rmdir($file);
 
                //At this point its a folder, and we're in recursive mode
                        return @rmdir($file);
 
                //At this point its a folder, and we're in recursive mode
@@ -145,13 +147,13 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
                $filelist = $this->dirlist($file, true);
 
                $retval = true;
                $filelist = $this->dirlist($file, true);
 
                $retval = true;
-               if( is_array($filelist) ) //false if no files, So check first.
-                       foreach($filelist as $filename => $fileinfo)
-                               if( ! $this->delete($file . $filename, $recursive) )
+               if ( is_array($filelist) ) //false if no files, So check first.
+                       foreach ($filelist as $filename => $fileinfo)
+                               if ( ! $this->delete($file . $filename, $recursive) )
                                        $retval = false;
 
                                        $retval = false;
 
-               if( ! @rmdir($file) )
-                       return false;
+               if ( file_exists($file) && ! @rmdir($file) )
+                       $retval = false;
                return $retval;
        }
 
                return $retval;
        }
 
@@ -187,33 +189,33 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
        }
 
        function touch($file, $time = 0, $atime = 0){
        }
 
        function touch($file, $time = 0, $atime = 0){
-               if($time == 0)
+               if ($time == 0)
                        $time = time();
                        $time = time();
-               if($atime == 0)
+               if ($atime == 0)
                        $atime = time();
                return @touch($file, $time, $atime);
        }
 
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
                        $atime = time();
                return @touch($file, $time, $atime);
        }
 
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
-               if( ! $chmod)
+               if ( ! $chmod)
                        $chmod = $this->permission;
 
                        $chmod = $this->permission;
 
-               if( ! @mkdir($path, $chmod) )
+               if ( ! @mkdir($path, $chmod) )
                        return false;
                        return false;
-               if( $chown )
+               if ( $chown )
                        $this->chown($path, $chown);
                        $this->chown($path, $chown);
-               if( $chgrp )
+               if ( $chgrp )
                        $this->chgrp($path, $chgrp);
                return true;
        }
 
        function rmdir($path, $recursive = false) {
                //Currently unused and untested, Use delete() instead.
                        $this->chgrp($path, $chgrp);
                return true;
        }
 
        function rmdir($path, $recursive = false) {
                //Currently unused and untested, Use delete() instead.
-               if( ! $recursive )
+               if ( ! $recursive )
                        return @rmdir($path);
                //recursive:
                $filelist = $this->dirlist($path);
                        return @rmdir($path);
                //recursive:
                $filelist = $this->dirlist($path);
-               foreach($filelist as $filename => $det) {
+               foreach ($filelist as $filename => $det) {
                        if ( '/' == substr($filename, -1, 1) )
                                $this->rmdir($path . '/' . $filename, $recursive);
                        @rmdir($filename);
                        if ( '/' == substr($filename, -1, 1) )
                                $this->rmdir($path . '/' . $filename, $recursive);
                        @rmdir($filename);
@@ -222,13 +224,13 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
        }
 
        function dirlist($path, $incdot = false, $recursive = false) {
        }
 
        function dirlist($path, $incdot = false, $recursive = false) {
-               if( $this->is_file($path) ) {
+               if ( $this->is_file($path) ) {
                        $limitFile = basename($path);
                        $path = dirname($path);
                } else {
                        $limitFile = false;
                }
                        $limitFile = basename($path);
                        $path = dirname($path);
                } else {
                        $limitFile = false;
                }
-               if( ! $this->is_dir($path) )
+               if ( ! $this->is_dir($path) )
                        return false;
 
                $ret = array();
                        return false;
 
                $ret = array();
@@ -239,11 +241,11 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
                        $struc = array();
                        $struc['name'] = $entry;
 
                        $struc = array();
                        $struc['name'] = $entry;
 
-                       if( '.' == $struc['name'] || '..' == $struc['name'] )
+                       if ( '.' == $struc['name'] || '..' == $struc['name'] )
                                continue; //Do not care about these folders.
                                continue; //Do not care about these folders.
-                       if( '.' == $struc['name'][0] && !$incdot)
+                       if ( '.' == $struc['name'][0] && !$incdot)
                                continue;
                                continue;
-                       if( $limitFile && $struc['name'] != $limitFile)
+                       if ( $limitFile && $struc['name'] != $limitFile)
                                continue;
 
                        $struc['perms']         = $this->gethchmod($path.'/'.$entry);
                                continue;
 
                        $struc['perms']         = $this->gethchmod($path.'/'.$entry);
@@ -258,7 +260,7 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
                        $struc['type']          = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
 
                        if ( 'd' == $struc['type'] ) {
                        $struc['type']          = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
 
                        if ( 'd' == $struc['type'] ) {
-                               if( $recursive )
+                               if ( $recursive )
                                        $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
                                else
                                        $struc['files'] = array();
                                        $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
                                else
                                        $struc['files'] = array();
index a2805da80ddb992b351927e8f77403cb87b027bb..24611c9237b6602a9ea7a35beea23ddb9191b41e 100644 (file)
@@ -17,7 +17,7 @@
 class WP_Filesystem_FTPext extends WP_Filesystem_Base {
        var $link;
        var $timeout = 5;
 class WP_Filesystem_FTPext extends WP_Filesystem_Base {
        var $link;
        var $timeout = 5;
-       var $errors = array();
+       var $errors = null;
        var $options = array();
 
        var $permission = null;
        var $options = array();
 
        var $permission = null;
@@ -47,28 +47,26 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        $this->wp_base = $opt['base'];
 
                // Check if the options provided are OK.
                        $this->wp_base = $opt['base'];
 
                // Check if the options provided are OK.
-               if ( empty ($opt['username']) )
+               if ( empty($opt['username']) )
                        $this->errors->add('empty_username', __('FTP username is required'));
                else
                        $this->options['username'] = $opt['username'];
 
                        $this->errors->add('empty_username', __('FTP username is required'));
                else
                        $this->options['username'] = $opt['username'];
 
-               if ( empty ($opt['password']) )
+               if ( empty($opt['password']) )
                        $this->errors->add('empty_password', __('FTP password is required'));
                else
                        $this->options['password'] = $opt['password'];
 
                $this->options['ssl'] = false;
                        $this->errors->add('empty_password', __('FTP password is required'));
                else
                        $this->options['password'] = $opt['password'];
 
                $this->options['ssl'] = false;
-               if ( isset($opt['ssl']) )
-                       $this->options['ssl'] = ( !empty($opt['ssl']) );
-               elseif ( isset( $opt['connection_type']) )
-                       $this->options['ssl'] = ( 'ftps' == $opt['connection_type'] );
+               if ( isset($opt['connection_type']) && 'ftps' == $opt['connection_type'] )
+                       $this->options['ssl'] = true;
        }
 
        function connect() {
        }
 
        function connect() {
-               if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') )
-                       $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout);
+               if ( isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect') )
+                       $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], $this->timeout);
                else
                else
-                       $this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout);
+                       $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], $this->timeout);
 
                if ( ! $this->link ) {
                        $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
 
                if ( ! $this->link ) {
                        $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
@@ -146,7 +144,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                        $mode = $this->permission;
                if( ! $mode )
                        return false;
                        $mode = $this->permission;
                if( ! $mode )
                        return false;
-               if ( ! $this->exists($file) )
+               if ( ! $this->exists($file) && ! $this->is_dir($file) )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) ) {
                        if ( ! function_exists('ftp_chmod') )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) ) {
                        if ( ! function_exists('ftp_chmod') )
@@ -187,30 +185,31 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                return ftp_rename($this->link, $source, $destination);
        }
 
                return ftp_rename($this->link, $source, $destination);
        }
 
-       function delete($file,$recursive=false) {
+       function delete($file, $recursive = false ) {
+               if ( empty($file) )
+                       return false;
                if ( $this->is_file($file) )
                        return @ftp_delete($this->link, $file);
                if ( !$recursive )
                        return @ftp_rmdir($this->link, $file);
                if ( $this->is_file($file) )
                        return @ftp_delete($this->link, $file);
                if ( !$recursive )
                        return @ftp_rmdir($this->link, $file);
-               $filelist = $this->dirlist($file);
-               foreach ((array) $filelist as $filename => $fileinfo) {
-                       $this->delete($file . '/' . $filename, $recursive);
-               }
+
+               $filelist = $this->dirlist( trailingslashit($file) );
+               if ( !empty($filelist) )
+                       foreach ( $filelist as $delete_file )
+                               $this->delete( trailingslashit($file) . $delete_file['name'], $recursive);
                return @ftp_rmdir($this->link, $file);
        }
 
        function exists($file) {
                return @ftp_rmdir($this->link, $file);
        }
 
        function exists($file) {
-               $list = ftp_rawlist($this->link, $file, false);
-               if( ! $list )
-                       return false;
-               return count($list) == 1 ? true : false;
+               $list = @ftp_rawlist($this->link, $file, false);
+               return !empty($list); //empty list = no file, so invert.
        }
        function is_file($file) {
        }
        function is_file($file) {
-               return $this->is_dir($file) ? false : true;
+               return $this->exists($file) && !$this->is_dir($file);
        }
        function is_dir($path) {
                $cwd = $this->cwd();
        }
        function is_dir($path) {
                $cwd = $this->cwd();
-               $result = @ftp_chdir($this->link, $path);
+               $result = @ftp_chdir($this->link, trailingslashit($path) );
                if( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
                        @ftp_chdir($this->link, $cwd);
                        return true;
                if( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
                        @ftp_chdir($this->link, $cwd);
                        return true;
@@ -218,7 +217,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                return false;
        }
        function is_readable($file) {
                return false;
        }
        function is_readable($file) {
-               //Get dir list, Check if the file is writable by the current user??
+               //Get dir list, Check if the file is readable by the current user??
                return true;
        }
        function is_writable($file) {
                return true;
        }
        function is_writable($file) {
@@ -238,7 +237,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                return false;
        }
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
                return false;
        }
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
-               if( !@ftp_mkdir($this->link, $path) )
+               if( !ftp_mkdir($this->link, $path) )
                        return false;
                if( $chmod )
                        $this->chmod($path, $chmod);
                        return false;
                if( $chmod )
                        $this->chmod($path, $chmod);
@@ -249,17 +248,14 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
                return true;
        }
        function rmdir($path, $recursive = false) {
                return true;
        }
        function rmdir($path, $recursive = false) {
-               if( ! $recursive )
-                       return @ftp_rmdir($this->link, $path);
-
-               //TODO: Recursive Directory delete, Have to delete files from the folder first.
-               //$dir = $this->dirlist($path);
-               //foreach($dir as $file)
-
+               return $this->delete($path, $recursive);
        }
 
        function parselisting($line) {
        }
 
        function parselisting($line) {
-               $is_windows = ($this->OS_remote == FTP_OS_Windows);
+               static $is_windows;
+               if ( is_null($is_windows) )
+                       $is_windows = strpos( strtolower(ftp_systype($this->link)), 'win') !== false;
+
                if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
                        $b = array();
                        if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
                if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
                        $b = array();
                        if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
index d5ee3f97b4a4b4ad4c9b75f82b69e34d95935a0b..759eaa821cbd68cc4f4e60676cf3d0e288746851 100644 (file)
@@ -17,7 +17,7 @@
 class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        var $ftp = false;
        var $timeout = 5;
 class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        var $ftp = false;
        var $timeout = 5;
-       var $errors;
+       var $errors = null;
        var $options = array();
 
        var $permission = null;
        var $options = array();
 
        var $permission = null;
@@ -210,6 +210,8 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        }
 
        function delete($file, $recursive = false ) {
        }
 
        function delete($file, $recursive = false ) {
+               if ( empty($file) )
+                       return false;
                if ( $this->is_file($file) )
                        return $this->ftp->delete($file);
                if ( !$recursive )
                if ( $this->is_file($file) )
                        return $this->ftp->delete($file);
                if ( !$recursive )
index 6da852d7e51a22a5991997508c1a071f3e9b1504..7bcd4b74693c2b859d30284cf1d580c52ae9a228 100644 (file)
  */
 class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
 
  */
 class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
 
-       var $debugtest = false; //      set this to true only if your a debuging your connection
-
-       var $link = null;
-       var $sftp_link = null;
+       var $link = false;
+       var $sftp_link = false;
        var $keys = false;
        /*
         * This is the timeout value for ssh results to comeback.
        var $keys = false;
        /*
         * This is the timeout value for ssh results to comeback.
@@ -68,6 +66,10 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                        $this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available'));
                        return false;
                }
                        $this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available'));
                        return false;
                }
+               if ( ! version_compare(phpversion(), '5', '>=') ) {
+                       $this->errors->add('ssh2_php_requirement', __('The ssh2 PHP extension is available, however requires PHP 5+'));
+                       return false;
+               }
 
                // Set defaults:
                if ( empty($opt['port']) )
 
                // Set defaults:
                if ( empty($opt['port']) )
@@ -84,20 +86,19 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                        $this->wp_base = $opt['base'];
 
                // Check if the options provided are OK.
                        $this->wp_base = $opt['base'];
 
                // Check if the options provided are OK.
-               if ( empty ($opt['username']) )
-                       $this->errors->add('empty_username', __('SSH2 username is required'));
-               else
-                       $this->options['username'] = $opt['username'];
-
-               if ( ( !empty ($opt['public_key']) ) && ( !empty ($opt['private_key']) ) ) {
+               if ( !empty ($opt['public_key']) && !empty ($opt['private_key']) ) {
                        $this->options['public_key'] = $opt['public_key'];
                        $this->options['private_key'] = $opt['private_key'];
 
                        $this->options['public_key'] = $opt['public_key'];
                        $this->options['private_key'] = $opt['private_key'];
 
-                       $this->options['hostkey'] = array("hostkey" => "ssh-rsa");
+                       $this->options['hostkey'] = array('hostkey' => 'ssh-rsa');
 
                        $this->keys = true;
 
                        $this->keys = true;
+               } elseif ( empty ($opt['username']) ) {
+                       $this->errors->add('empty_username', __('SSH2 username is required'));
                }
 
                }
 
+               if ( !empty($opt['username']) )
+                       $this->options['username'] = $opt['username'];
 
                if ( empty ($opt['password']) ) {
                        if ( !$this->keys )     //       password can be blank if we are using keys
 
                if ( empty ($opt['password']) ) {
                        if ( !$this->keys )     //       password can be blank if we are using keys
@@ -109,8 +110,6 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        }
 
        function connect() {
        }
 
        function connect() {
-               $this->debug("connect();");
-
                if ( ! $this->keys ) {
                        $this->link = @ssh2_connect($this->options['hostname'], $this->options['port']);
                } else {
                if ( ! $this->keys ) {
                        $this->link = @ssh2_connect($this->options['hostname'], $this->options['port']);
                } else {
@@ -139,48 +138,26 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                return true;
        }
 
                return true;
        }
 
-       function run_command($link, $command, $returnbool = false) {
-               $this->debug("run_command();");
-               if(!($stream = @ssh2_exec( $link, $command . "; echo \"__COMMAND_FINISHED__\";"))) {
+       function run_command( $command, $returnbool = false) {
+
+               if ( ! $this->link )
+                       return false;
+
+               if ( ! ($stream = ssh2_exec($this->link, $command)) ) {
                        $this->errors->add('command', sprintf(__('Unable to perform command: %s'), $command));
                } else {
                        stream_set_blocking( $stream, true );
                        $this->errors->add('command', sprintf(__('Unable to perform command: %s'), $command));
                } else {
                        stream_set_blocking( $stream, true );
-                       $time_start = time();
-                       $data = null;
-                       while( true ) {
-                               if (strpos($data,"__COMMAND_FINISHED__") !== false){
-                                       break;  //      the command has finshed!
-                               }
-                               if( (time()-$time_start) > $this->timeout ){
-                                       $this->errors->add('command', sprintf(__('Connection to the server has timeout after %s seconds.'), $this->timeout));
-                                       unset($this->link);
-                                       unset($this->sftp_link); //     close connections
-                                       return false;
-                               }
-                               while( $buf = fread( $stream, strlen($stream) ) )
-                                       $data .= $buf;
-                       }
-                       fclose($stream);
-                       $data = trim(str_replace("__COMMAND_FINISHED__", "", $data));
-                       if (($returnbool) && ( (int) $data )) {
-                               return true;
-                       } elseif (($returnbool) && (! (int) $data )) {
-                               return false;
-                       } else {
+                       stream_set_timeout( $stream, $this->timeout );
+                       $data = stream_get_contents($stream);
+
+                       if ( $returnbool )
+                               return '' != trim($data);
+                       else
                                return $data;
                                return $data;
-                       }
                }
                return false;
        }
 
                }
                return false;
        }
 
-       function debug($text)
-       {
-               if ($this->debugtest)
-               {
-                       echo "<br/>" . $text . "<br/>";
-               }
-       }
-
        function setDefaultPermissions($perm) {
                $this->debug("setDefaultPermissions();");
                if ( $perm )
        function setDefaultPermissions($perm) {
                $this->debug("setDefaultPermissions();");
                if ( $perm )
@@ -188,59 +165,40 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        }
 
        function get_contents($file, $type = '', $resumepos = 0 ) {
        }
 
        function get_contents($file, $type = '', $resumepos = 0 ) {
-               $this->debug("get_contents();");
-               $tempfile = wp_tempnam( $file );
-               if ( ! $tempfile )
-                       return false;
-               if( ! ssh2_scp_recv($this->link, $file, $tempfile) )
-                       return false;
-               $contents = file_get_contents($tempfile);
-               unlink($tempfile);
-               return $contents;
+               $file = ltrim($file, '/');
+               return file_get_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function get_contents_array($file) {
        }
 
        function get_contents_array($file) {
-               $this->debug("get_contents_array();");
-               return explode("\n", $this->get_contents($file));
+               $file = ltrim($file, '/');
+               return file('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function put_contents($file, $contents, $type = '' ) {
        }
 
        function put_contents($file, $contents, $type = '' ) {
-               $this->debug("put_contents($file);");
-               $tempfile = wp_tempnam( $file );
-               $temp = fopen($tempfile, 'w');
-               if ( ! $temp )
-                       return false;
-               fwrite($temp, $contents);
-               fclose($temp);
-               $ret = ssh2_scp_send($this->link, $tempfile, $file, $this->permission);
-               unlink($tempfile);
-               return $ret;
+               $file = ltrim($file, '/');
+               return file_put_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file, $contents);
        }
 
        function cwd() {
        }
 
        function cwd() {
-               $this->debug("cwd();");
-               $cwd = $this->run_command($this->link, 'pwd');
+               $cwd = $this->run_command('pwd');
                if( $cwd )
                        $cwd = trailingslashit($cwd);
                return $cwd;
        }
 
        function chdir($dir) {
                if( $cwd )
                        $cwd = trailingslashit($cwd);
                return $cwd;
        }
 
        function chdir($dir) {
-               $this->debug("chdir();");
-               return $this->run_command($this->link, 'cd ' . $dir, true);
+               return $this->run_command('cd ' . $dir, true);
        }
 
        function chgrp($file, $group, $recursive = false ) {
        }
 
        function chgrp($file, $group, $recursive = false ) {
-               $this->debug("chgrp();");
                if ( ! $this->exists($file) )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) )
                if ( ! $this->exists($file) )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) )
-                       return $this->run_command($this->link, sprintf('chgrp %o %s', $mode, $file), true);
-               return $this->run_command($this->link, sprintf('chgrp -R %o %s', $mode, $file), true);
+                       return $this->run_command(sprintf('chgrp %o %s', $mode, escapeshellarg($file)), true);
+               return $this->run_command(sprintf('chgrp -R %o %s', $mode, escapeshellarg($file)), true);
        }
 
        function chmod($file, $mode = false, $recursive = false) {
        }
 
        function chmod($file, $mode = false, $recursive = false) {
-               $this->debug("chmod();");
                if( ! $mode )
                        $mode = $this->permission;
                if( ! $mode )
                if( ! $mode )
                        $mode = $this->permission;
                if( ! $mode )
@@ -248,39 +206,43 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                if ( ! $this->exists($file) )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) )
                if ( ! $this->exists($file) )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) )
-                       return $this->run_command($this->link, sprintf('chmod %o %s', $mode, $file), true);
-               return $this->run_command($this->link, sprintf('chmod -R %o %s', $mode, $file), true);
+                       return $this->run_command(sprintf('chmod %o %s', $mode, escapeshellarg($file)), true);
+               return $this->run_command(sprintf('chmod -R %o %s', $mode, escapeshellarg($file)), true);
        }
 
        function chown($file, $owner, $recursive = false ) {
        }
 
        function chown($file, $owner, $recursive = false ) {
-               $this->debug("chown();");
                if ( ! $this->exists($file) )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) )
                if ( ! $this->exists($file) )
                        return false;
                if ( ! $recursive || ! $this->is_dir($file) )
-                       return $this->run_command($this->link, sprintf('chown %o %s', $mode, $file), true);
-               return $this->run_command($this->link, sprintf('chown -R %o %s', $mode, $file), true);
+                       return $this->run_command(sprintf('chown %o %s', $mode, escapeshellarg($file)), true);
+               return $this->run_command(sprintf('chown -R %o %s', $mode, escapeshellarg($file)), true);
        }
 
        function owner($file) {
        }
 
        function owner($file) {
-               $this->debug("owner();");
-               $dir = $this->dirlist($file);
-               return $dir[$file]['owner'];
+               $owneruid = @fileowner('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/'));
+               if ( ! $owneruid )
+                       return false;
+               if ( ! function_exists('posix_getpwuid') )
+                       return $owneruid;
+               $ownerarray = posix_getpwuid($owneruid);
+               return $ownerarray['name'];
        }
 
        function getchmod($file) {
        }
 
        function getchmod($file) {
-               $this->debug("getchmod();");
-               $dir = $this->dirlist($file);
-               return $dir[$file]['permsn'];
+               return substr(decoct(@fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/') )),3);
        }
 
        function group($file) {
        }
 
        function group($file) {
-               $this->debug("group();");
-               $dir = $this->dirlist($file);
-               return $dir[$file]['group'];
+               $gid = @filegroup('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/'));
+               if ( ! $gid )
+                       return false;
+               if ( ! function_exists('posix_getgrgid') )
+                       return $gid;
+               $grouparray = posix_getgrgid($gid);
+               return $grouparray['name'];
        }
 
        function copy($source, $destination, $overwrite = false ) {
        }
 
        function copy($source, $destination, $overwrite = false ) {
-               $this->debug("copy();");
                if( ! $overwrite && $this->exists($destination) )
                        return false;
                $content = $this->get_contents($source);
                if( ! $overwrite && $this->exists($destination) )
                        return false;
                $content = $this->get_contents($source);
@@ -290,12 +252,10 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        }
 
        function move($source, $destination, $overwrite = false) {
        }
 
        function move($source, $destination, $overwrite = false) {
-               $this->debug("move();");
                return @ssh2_sftp_rename($this->link, $source, $destination);
        }
 
        function delete($file, $recursive = false) {
                return @ssh2_sftp_rename($this->link, $source, $destination);
        }
 
        function delete($file, $recursive = false) {
-               $this->debug("delete();");
                if ( $this->is_file($file) )
                        return ssh2_sftp_unlink($this->sftp_link, $file);
                if ( ! $recursive )
                if ( $this->is_file($file) )
                        return ssh2_sftp_unlink($this->sftp_link, $file);
                if ( ! $recursive )
@@ -310,49 +270,44 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        }
 
        function exists($file) {
        }
 
        function exists($file) {
-               $this->debug("exists();");
-               return $this->run_command($this->link, sprintf('ls -lad %s', $file), true);
+               //return $this->run_command(sprintf('ls -lad %s', escapeshellarg($file)), true);
+               $file = ltrim($file, '/');
+               return file_exists('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function is_file($file) {
        }
 
        function is_file($file) {
-               $this->debug("is_file();");
-               //DO NOT RELY ON dirlist()!
-               $list = $this->run_command($this->link, sprintf('ls -lad %s', $file));
-               $list = $this->parselisting($list);
-               if ( ! $list )
-                       return false;
-               else
-                       return ( !$list['isdir'] && !$list['islink'] ); //ie. not a file or link, yet exists, must be file.
+               $file = ltrim($file, '/');
+               return is_file('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function is_dir($path) {
        }
 
        function is_dir($path) {
-               $this->debug("is_dir();");
-               //DO NOT RELY ON dirlist()!
-               $list = $this->parselisting($this->run_command($this->link, sprintf('ls -lad %s', untrailingslashit($path))));
-               if ( ! $list )
-                       return false;
-               else
-                       return $list['isdir'];
+               $path = ltrim($path, '/');
+               return is_dir('ssh2.sftp://' . $this->sftp_link .'/' . $path);
        }
 
        function is_readable($file) {
        }
 
        function is_readable($file) {
-               //Not implmented.
+               $file = ltrim($file, '/');
+               return is_readable('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function is_writable($file) {
        }
 
        function is_writable($file) {
-               //Not implmented.
+               $file = ltrim($file, '/');
+               return is_writable('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function atime($file) {
        }
 
        function atime($file) {
-               //Not implmented.
+               $file = ltrim($file, '/');
+               return fileatime('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function mtime($file) {
        }
 
        function mtime($file) {
-               //Not implmented.
+               $file = ltrim($file, '/');
+               return filemtime('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function size($file) {
        }
 
        function size($file) {
-               //Not implmented.
+               $file = ltrim($file, '/');
+               return filesize('ssh2.sftp://' . $this->sftp_link .'/' . $file);
        }
 
        function touch($file, $time = 0, $atime = 0) {
        }
 
        function touch($file, $time = 0, $atime = 0) {
@@ -360,148 +315,68 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        }
 
        function mkdir($path, $chmod = null, $chown = false, $chgrp = false) {
        }
 
        function mkdir($path, $chmod = null, $chown = false, $chgrp = false) {
-               $this->debug("mkdir();");
                $path = untrailingslashit($path);
                $path = untrailingslashit($path);
-               if( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) )
+               $chmod = !empty($chmod) ? $chmod : $this->permission;
+               if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) )
                        return false;
                        return false;
-               if( $chown )
+               if ( $chown )
                        $this->chown($path, $chown);
                        $this->chown($path, $chown);
-               if( $chgrp )
+               if ( $chgrp )
                        $this->chgrp($path, $chgrp);
                return true;
        }
 
        function rmdir($path, $recursive = false) {
                        $this->chgrp($path, $chgrp);
                return true;
        }
 
        function rmdir($path, $recursive = false) {
-               $this->debug("rmdir();");
                return $this->delete($path, $recursive);
        }
 
                return $this->delete($path, $recursive);
        }
 
-       function parselisting($line) {
-       $this->debug("parselisting();");
-               $is_windows = ($this->OS_remote == FTP_OS_Windows);
-               if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
-                       $b = array();
-                       if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
-                       $b['isdir'] = ($lucifer[7]=="<DIR>");
-                       if ( $b['isdir'] )
-                               $b['type'] = 'd';
-                       else
-                               $b['type'] = 'f';
-                       $b['size'] = $lucifer[7];
-                       $b['month'] = $lucifer[1];
-                       $b['day'] = $lucifer[2];
-                       $b['year'] = $lucifer[3];
-                       $b['hour'] = $lucifer[4];
-                       $b['minute'] = $lucifer[5];
-                       $b['time'] = @mktime($lucifer[4]+(strcasecmp($lucifer[6],"PM")==0?12:0),$lucifer[5],0,$lucifer[1],$lucifer[2],$lucifer[3]);
-                       $b['am/pm'] = $lucifer[6];
-                       $b['name'] = $lucifer[8];
-               } else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
-                       //echo $line."\n";
-                       $lcount=count($lucifer);
-                       if ($lcount<8) return '';
-                       $b = array();
-                       $b['isdir'] = $lucifer[0]{0} === "d";
-                       $b['islink'] = $lucifer[0]{0} === "l";
-                       if ( $b['isdir'] )
-                               $b['type'] = 'd';
-                       elseif ( $b['islink'] )
-                               $b['type'] = 'l';
-                       else
-                               $b['type'] = 'f';
-                       $b['perms'] = $lucifer[0];
-                       $b['number'] = $lucifer[1];
-                       $b['owner'] = $lucifer[2];
-                       $b['group'] = $lucifer[3];
-                       $b['size'] = $lucifer[4];
-                       if ($lcount==8) {
-                               sscanf($lucifer[5],"%d-%d-%d",$b['year'],$b['month'],$b['day']);
-                               sscanf($lucifer[6],"%d:%d",$b['hour'],$b['minute']);
-                               $b['time'] = @mktime($b['hour'],$b['minute'],0,$b['month'],$b['day'],$b['year']);
-                               $b['name'] = $lucifer[7];
-                       } else {
-                               $b['month'] = $lucifer[5];
-                               $b['day'] = $lucifer[6];
-                               if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
-                                       $b['year'] = date("Y");
-                                       $b['hour'] = $l2[1];
-                                       $b['minute'] = $l2[2];
-                               } else {
-                                       $b['year'] = $lucifer[7];
-                                       $b['hour'] = 0;
-                                       $b['minute'] = 0;
-                               }
-                               $b['time'] = strtotime(sprintf("%d %s %d %02d:%02d",$b['day'],$b['month'],$b['year'],$b['hour'],$b['minute']));
-                               $b['name'] = $lucifer[8];
-                       }
-               }
-
-               return $b;
-       }
-
-       function dirlist($path = '.', $incdot = false, $recursive = false) {
-               $this->debug("dirlist();");
-               if( $this->is_file($path) ) {
+       function dirlist($path, $incdot = false, $recursive = false) {
+               if ( $this->is_file($path) ) {
                        $limitFile = basename($path);
                        $limitFile = basename($path);
-                       $path = trailingslashit(dirname($path));
+                       $path = dirname($path);
                } else {
                        $limitFile = false;
                }
                } else {
                        $limitFile = false;
                }
-
-               $list = $this->run_command($this->link, sprintf('ls -la %s', $path));
-
-               if ( $list === false )
+               if ( ! $this->is_dir($path) )
                        return false;
 
                        return false;
 
-               $list = explode("\n", $list);
+               $ret = array();
+               $dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') );
+               if ( ! $dir )
+                       return false;
+               while (false !== ($entry = $dir->read()) ) {
+                       $struc = array();
+                       $struc['name'] = $entry;
 
 
-               $dirlist = array();
-               foreach ( (array)$list as $k => $v ) {
-                       $entry = $this->parselisting($v);
-                       if ( empty($entry) )
+                       if ( '.' == $struc['name'] || '..' == $struc['name'] )
+                               continue; //Do not care about these folders.
+                       if ( '.' == $struc['name'][0] && !$incdot)
                                continue;
                                continue;
-
-                       if ( '.' == $entry['name'] || '..' == $entry['name'] )
+                       if ( $limitFile && $struc['name'] != $limitFile)
                                continue;
 
                                continue;
 
-                       $dirlist[ $entry['name'] ] = $entry;
-               }
-
-               if ( ! $dirlist )
-                       return false;
-
-               if ( empty($dirlist) )
-                       return array();
-
-               $ret = array();
-               foreach ( $dirlist as $struc ) {
+                       $struc['perms']         = $this->gethchmod($path.'/'.$entry);
+                       $struc['permsn']        = $this->getnumchmodfromh($struc['perms']);
+                       $struc['number']        = false;
+                       $struc['owner']         = $this->owner($path.'/'.$entry);
+                       $struc['group']         = $this->group($path.'/'.$entry);
+                       $struc['size']          = $this->size($path.'/'.$entry);
+                       $struc['lastmodunix']= $this->mtime($path.'/'.$entry);
+                       $struc['lastmod']   = date('M j',$struc['lastmodunix']);
+                       $struc['time']          = date('h:i:s',$struc['lastmodunix']);
+                       $struc['type']          = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
 
                        if ( 'd' == $struc['type'] ) {
 
                        if ( 'd' == $struc['type'] ) {
-                               $struc['files'] = array();
-
-                               if ( $incdot ){
-                                       //We're including the doted starts
-                                       if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
-                                               if ($recursive)
-                                                       $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
-                                       }
-                               } else { //No dots
-                                       if ( $recursive )
-                                               $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
-                               }
+                               if ( $recursive )
+                                       $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
+                               else
+                                       $struc['files'] = array();
                        }
                        }
-                       //File
-                       $ret[$struc['name']] = $struc;
+
+                       $ret[ $struc['name'] ] = $struc;
                }
                }
+               $dir->close();
+               unset($dir);
                return $ret;
        }
                return $ret;
        }
-       function __destruct() {
-               $this->debug("__destruct();");
-               if ( $this->link )
-                       unset($this->link);
-               if ( $this->sftp_link )
-                       unset($this->sftp_link);
-       }
-}
-
-?>
+}
\ No newline at end of file
diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php
new file mode 100644 (file)
index 0000000..76b11fe
--- /dev/null
@@ -0,0 +1,1059 @@
+<?php
+/**
+ * A File upgrader class for WordPress.
+ *
+ * This set of classes are designed to be used to upgrade/install a local set of files on the filesystem via the Filesystem Abstraction classes.
+ *
+ * @link http://trac.wordpress.org/ticket/7875 consolidate plugin/theme/core upgrade/install functions
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+
+/**
+ * WordPress Upgrader class for Upgrading/Installing a local set of files via the Filesystem Abstraction classes from a Zip file.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class WP_Upgrader {
+       var $strings = array();
+       var $skin = null;
+       var $result = array();
+
+       function WP_Upgrader($skin = null) {
+               return $this->__construct($skin);
+       }
+       function __construct($skin = null) {
+               if ( null == $skin )
+                       $this->skin = new WP_Upgrader_Skin();
+               else
+                       $this->skin = $skin;
+       }
+
+       function init() {
+               $this->skin->set_upgrader($this);
+               $this->generic_strings();
+       }
+
+       function generic_strings() {
+               $this->strings['bad_request'] = __('Invalid Data provided.');
+               $this->strings['fs_unavailable'] = __('Could not access filesystem.');
+               $this->strings['fs_error'] = __('Filesystem error');
+               $this->strings['fs_no_root_dir'] = __('Unable to locate WordPress Root directory.');
+               $this->strings['fs_no_content_dir'] = __('Unable to locate WordPress Content directory (wp-content).');
+               $this->strings['fs_no_plugins_dir'] = __('Unable to locate WordPress Plugin directory.');
+               $this->strings['fs_no_themes_dir'] = __('Unable to locate WordPress Theme directory.');
+               $this->strings['fs_no_folder'] = __('Unable to locate needed folder (%s).');
+
+               $this->strings['download_failed'] = __('Download failed.');
+               $this->strings['installing_package'] = __('Installing the latest version.');
+               $this->strings['folder_exists'] = __('Destination folder already exists.');
+               $this->strings['mkdir_failed'] = __('Could not create directory.');
+               $this->strings['bad_package'] = __('Incompatible Archive');
+
+               $this->strings['maintenance_start'] = __('Enabling Maintenance mode.');
+               $this->strings['maintenance_end'] = __('Disabling Maintenance mode.');
+       }
+
+       function fs_connect( $directories = array() ) {
+               global $wp_filesystem;
+
+               if ( false === ($credentials = $this->skin->request_filesystem_credentials()) )
+                       return false;
+
+               if ( ! WP_Filesystem($credentials) ) {
+                       $error = true;
+                       if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() )
+                               $error = $wp_filesystem->errors;
+                       $this->skin->request_filesystem_credentials($error); //Failed to connect, Error and request again
+                       return false;
+               }
+
+               if ( ! is_object($wp_filesystem) )
+                       return new WP_Error('fs_unavailable', $this->strings['fs_unavailable'] );
+
+               if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
+                       return new WP_Error('fs_error', $this->strings['fs_error'], $wp_filesystem->errors);
+
+               foreach ( (array)$directories as $dir ) {
+                       if ( ABSPATH == $dir && ! $wp_filesystem->abspath() )
+                               return new WP_Error('fs_no_root_dir', $this->strings['fs_no_root_dir']);
+
+                       elseif ( WP_CONTENT_DIR == $dir && ! $wp_filesystem->wp_content_dir() )
+                               return new WP_Error('fs_no_content_dir', $this->strings['fs_no_content_dir']);
+
+                       elseif ( WP_PLUGIN_DIR == $dir && ! $wp_filesystem->wp_plugins_dir() )
+                               return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']);
+
+                       elseif ( WP_CONTENT_DIR . '/themes' == $dir && ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') )
+                               return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']);
+
+                       elseif ( ! $wp_filesystem->find_folder($dir) )
+                               return new WP_Error('fs_no_folder', sprintf($strings['fs_no_folder'], $dir));
+               }
+               return true;
+       } //end fs_connect();
+
+       function download_package($package) {
+
+               if ( ! preg_match('!^(http|https|ftp)://!i', $package) && file_exists($package) ) //Local file or remote?
+                       return $package; //must be a local file..
+
+               if ( empty($package) )
+                       return new WP_Error('no_package', $this->strings['no_package']);
+
+               $this->skin->feedback('downloading_package', $package);
+
+               $download_file = download_url($package);
+
+               if ( is_wp_error($download_file) )
+                       return new WP_Error('download_failed', $this->strings['download_failed'], $download_file->get_error_message());
+
+               return $download_file;
+       }
+
+       function unpack_package($package, $delete_package = true) {
+               global $wp_filesystem;
+
+               $this->skin->feedback('unpack_package');
+
+               $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/';
+
+               //Clean up contents of upgrade directory beforehand.
+               $upgrade_files = $wp_filesystem->dirlist($upgrade_folder);
+               if ( !empty($upgrade_files) ) {
+                       foreach ( $upgrade_files as $file )
+                               $wp_filesystem->delete($upgrade_folder . $file['name'], true);
+               }
+
+               //We need a working directory
+               $working_dir = $upgrade_folder . basename($package, '.zip');
+
+               // Clean up working directory
+               if ( $wp_filesystem->is_dir($working_dir) )
+                       $wp_filesystem->delete($working_dir, true);
+
+               // Unzip package to working directory
+               $result = unzip_file($package, $working_dir); //TODO optimizations, Copy when Move/Rename would suffice?
+
+               // Once extracted, delete the package if required.
+               if ( $delete_package )
+                       unlink($package);
+
+               if ( is_wp_error($result) ) {
+                       $wp_filesystem->delete($working_dir, true);
+                       return $result;
+               }
+
+               return $working_dir;
+       }
+
+       function install_package($args = array()) {
+               global $wp_filesystem;
+               $defaults = array( 'source' => '', 'destination' => '', //Please always pass these
+                                               'clear_destination' => false, 'clear_working' => false,
+                                               'hook_extra' => array());
+
+               $args = wp_parse_args($args, $defaults);
+               extract($args);
+
+               @set_time_limit( 300 );
+
+               if ( empty($source) || empty($destination) )
+                       return new WP_Error('bad_request', $this->strings['bad_request']);
+
+               $this->skin->feedback('installing_package');
+
+               $res = apply_filters('upgrader_pre_install', true, $hook_extra);
+               if ( is_wp_error($res) )
+                       return $res;
+
+               //Retain the Original source and destinations
+               $remote_source = $source;
+               $local_destination = $destination;
+
+               $source_files = array_keys( $wp_filesystem->dirlist($remote_source) );
+               $remote_destination = $wp_filesystem->find_folder($local_destination);
+
+               //Locate which directory to copy to the new folder, This is based on the actual folder holding the files.
+               if ( 1 == count($source_files) && $wp_filesystem->is_dir( trailingslashit($source) . $source_files[0] . '/') ) //Only one folder? Then we want its contents.
+                       $source = trailingslashit($source) . trailingslashit($source_files[0]);
+               elseif ( count($source_files) == 0 )
+                       return new WP_Error('bad_package', $this->strings['bad_package']); //There are no files?
+               //else //Its only a single file, The upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename.
+
+               //Hook ability to change the source file location..
+               $source = apply_filters('upgrader_source_selection', $source, $remote_source, $this);
+               if ( is_wp_error($source) )
+                       return $source;
+
+               //Has the source location changed? If so, we need a new source_files list.
+               if ( $source !== $remote_source )
+                       $source_files = array_keys( $wp_filesystem->dirlist($source) );
+
+               //Protection against deleting files in any important base directories.
+               if ( in_array( $destination, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes') ) ) {
+                       $remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source));
+                       $destination = trailingslashit($destination) . trailingslashit(basename($source));
+               }
+
+               //If we're not clearing the destination folder, and something exists there allready, Bail.
+               if ( ! $clear_destination && $wp_filesystem->exists($remote_destination) ) {
+                       $wp_filesystem->delete($remote_source, true); //Clear out the source files.
+                       return new WP_Error('folder_exists', $this->strings['folder_exists'], $remote_destination );
+               } else if ( $clear_destination ) {
+                       //We're going to clear the destination if theres something there
+                       $this->skin->feedback('remove_old');
+
+                       $removed = true;
+                       if ( $wp_filesystem->exists($remote_destination) )
+                               $removed = $wp_filesystem->delete($remote_destination, true);
+
+                       $removed = apply_filters('upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra);
+
+                       if ( is_wp_error($removed) )
+                               return $removed;
+                       else if ( ! $removed )
+                               return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']);
+               }
+
+               //Create destination if needed
+               if ( !$wp_filesystem->exists($remote_destination) )
+                       if ( !$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR) )
+                               return new WP_Error('mkdir_failed', $this->strings['mkdir_failed'], $remote_destination);
+
+               // Copy new version of item into place.
+               $result = copy_dir($source, $remote_destination);
+               if ( is_wp_error($result) ) {
+                       if ( $clear_working )
+                               $wp_filesystem->delete($remote_source, true);
+                       return $result;
+               }
+
+               //Clear the Working folder?
+               if ( $clear_working )
+                       $wp_filesystem->delete($remote_source, true);
+
+               $destination_name = basename( str_replace($local_destination, '', $destination) );
+               if ( '.' == $destination_name )
+                       $destination_name = '';
+
+               $this->result = compact('local_source', 'source', 'source_name', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination', 'delete_source_dir');
+
+               $res = apply_filters('upgrader_post_install', true, $hook_extra, $this->result);
+               if ( is_wp_error($res) ) {
+                       $this->result = $res;
+                       return $res;
+               }
+
+               //Bombard the calling function will all the info which we've just used.
+               return $this->result;
+       }
+
+       function run($options) {
+
+               $defaults = array(      'package' => '', //Please always pass this.
+                                                       'destination' => '', //And this
+                                                       'clear_destination' => false,
+                                                       'clear_working' => true,
+                                                       'hook_extra' => array() //Pass any extra $hook_extra args here, this will be passed to any hooked filters.
+                                               );
+
+               $options = wp_parse_args($options, $defaults);
+               extract($options);
+
+               //Connect to the Filesystem first.
+               $res = $this->fs_connect( array(WP_CONTENT_DIR, $destination) );
+               if ( ! $res ) //Mainly for non-connected filesystem.
+                       return false;
+
+               if ( is_wp_error($res) ) {
+                       $this->skin->error($res);
+                       return $res;
+               }
+
+               $this->skin->header();
+               $this->skin->before();
+
+               //Download the package (Note, This just returns the filename of the file if the package is a local file)
+               $download = $this->download_package( $package );
+               if ( is_wp_error($download) ) {
+                       $this->skin->error($download);
+                       return $download;
+               }
+
+               //Unzip's the file into a temporary directory
+               $working_dir = $this->unpack_package( $download );
+               if ( is_wp_error($working_dir) ) {
+                       $this->skin->error($working_dir);
+                       return $working_dir;
+               }
+
+               //With the given options, this installs it to the destination directory.
+               $result = $this->install_package( array(
+                                                                                       'source' => $working_dir,
+                                                                                       'destination' => $destination,
+                                                                                       'clear_destination' => $clear_destination,
+                                                                                       'clear_working' => $clear_working,
+                                                                                       'hook_extra' => $hook_extra
+                                                                               ) );
+               $this->skin->set_result($result);
+               if ( is_wp_error($result) ) {
+                       $this->skin->error($result);
+                       $this->skin->feedback('process_failed');
+               } else {
+                       //Install Suceeded
+                       $this->skin->feedback('process_success');
+               }
+               $this->skin->after();
+               $this->skin->footer();
+               return $result;
+       }
+
+       function maintenance_mode($enable = false) {
+               global $wp_filesystem;
+               $file = $wp_filesystem->abspath() . '.maintenance';
+               if ( $enable ) {
+                       $this->skin->feedback('maintenance_start');
+                       // Create maintenance file to signal that we are upgrading
+                       $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
+                       $wp_filesystem->delete($file);
+                       $wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE);
+               } else if ( !$enable && $wp_filesystem->exists($file) ) {
+                       $this->skin->feedback('maintenance_end');
+                       $wp_filesystem->delete($file);
+               }
+       }
+
+}
+
+/**
+ * Plugin Upgrader class for WordPress Plugins, It is designed to upgrade/install plugins from a local zip, remote zip URL, or uploaded zip file.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Plugin_Upgrader extends WP_Upgrader {
+
+       var $result;
+
+       function upgrade_strings() {
+               $this->strings['up_to_date'] = __('The plugin is at the latest version.');
+               $this->strings['no_package'] = __('Upgrade package not available.');
+               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>.');
+               $this->strings['unpack_package'] = __('Unpacking the update.');
+               $this->strings['deactivate_plugin'] = __('Deactivating the plugin.');
+               $this->strings['remove_old'] = __('Removing the old version of the plugin.');
+               $this->strings['remove_old_failed'] = __('Could not remove the old plugin.');
+               $this->strings['process_failed'] = __('Plugin upgrade Failed.');
+               $this->strings['process_success'] = __('Plugin upgraded successfully.');
+       }
+
+       function install_strings() {
+               $this->strings['no_package'] = __('Install package not available.');
+               $this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>.');
+               $this->strings['unpack_package'] = __('Unpacking the package.');
+               $this->strings['installing_package'] = __('Installing the plugin.');
+               $this->strings['process_failed'] = __('Plugin Install Failed.');
+               $this->strings['process_success'] = __('Plugin Installed successfully.');
+       }
+
+       function install($package) {
+
+               $this->init();
+               $this->install_strings();
+
+               $this->run(array(
+                                       'package' => $package,
+                                       'destination' => WP_PLUGIN_DIR,
+                                       'clear_destination' => false, //Do not overwrite files.
+                                       'clear_working' => true,
+                                       'hook_extra' => array()
+                                       ));
+
+               // Force refresh of plugin update information
+               delete_transient('update_plugins');
+
+       }
+
+       function upgrade($plugin) {
+
+               $this->init();
+               $this->upgrade_strings();
+
+               $current = get_transient( 'update_plugins' );
+               if ( !isset( $current->response[ $plugin ] ) ) {
+                       $this->skin->set_result(false);
+                       $this->skin->error('up_to_date');
+                       $this->skin->after();
+                       return false;
+               }
+
+               // Get the URL to the zip file
+               $r = $current->response[ $plugin ];
+
+               add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2);
+               add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
+               //'source_selection' => array(&$this, 'source_selection'), //theres a track ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
+
+               $this->run(array(
+                                       'package' => $r->package,
+                                       'destination' => WP_PLUGIN_DIR,
+                                       'clear_destination' => true,
+                                       'clear_working' => true,
+                                       'hook_extra' => array(
+                                                               'plugin' => $plugin
+                                       )
+                               ));
+
+               //Cleanup our hooks, incase something else does a upgrade on this connection.
+               remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
+               remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
+
+               if ( ! $this->result || is_wp_error($this->result) )
+                       return $this->result;
+
+               // Force refresh of plugin update information
+               delete_transient('update_plugins');
+       }
+
+       //return plugin info.
+       function plugin_info() {
+               if ( ! is_array($this->result) )
+                       return false;
+               if ( empty($this->result['destination_name']) )
+                       return false;
+
+               $plugin = get_plugins('/' . $this->result['destination_name']); //Ensure to pass with leading slash
+               if ( empty($plugin) )
+                       return false;
+
+               $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
+
+               return $this->result['destination_name'] . '/' . $pluginfiles[0];
+       }
+
+       //Hooked to pre_install
+       function deactivate_plugin_before_upgrade($return, $plugin) {
+
+               if ( is_wp_error($return) ) //Bypass.
+                       return $return;
+
+               $plugin = isset($plugin['plugin']) ? $plugin['plugin'] : '';
+               if ( empty($plugin) )
+                       return new WP_Error('bad_request', $this->strings['bad_request']);
+
+               if ( is_plugin_active($plugin) ) {
+                       $this->skin->feedback('deactivate_plugin');
+                       //Deactivate the plugin silently, Prevent deactivation hooks from running.
+                       deactivate_plugins($plugin, true);
+               }
+       }
+
+       //Hooked to upgrade_clear_destination
+       function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) {
+               global $wp_filesystem;
+
+               if ( is_wp_error($removed) )
+                       return $removed; //Pass errors through.
+
+               $plugin = isset($plugin['plugin']) ? $plugin['plugin'] : '';
+               if ( empty($plugin) )
+                       return new WP_Error('bad_request', $this->strings['bad_request']);
+
+               $plugins_dir = $wp_filesystem->wp_plugins_dir();
+               $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
+
+               if ( ! $wp_filesystem->exists($this_plugin_dir) ) //If its already vanished.
+                       return $removed;
+
+               // If plugin is in its own directory, recursively delete the directory.
+               if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
+                       $deleted = $wp_filesystem->delete($this_plugin_dir, true);
+               else
+                       $deleted = $wp_filesystem->delete($plugins_dir . $plugin);
+
+               if ( ! $deleted )
+                       return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']);
+
+               return $removed;
+       }
+}
+
+/**
+ * Theme Upgrader class for WordPress Themes, It is designed to upgrade/install themes from a local zip, remote zip URL, or uploaded zip file.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Theme_Upgrader extends WP_Upgrader {
+
+       var $result;
+
+       function upgrade_strings() {
+               $this->strings['up_to_date'] = __('The theme is at the latest version.');
+               $this->strings['no_package'] = __('Upgrade package not available.');
+               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>.');
+               $this->strings['unpack_package'] = __('Unpacking the update.');
+               $this->strings['remove_old'] = __('Removing the old version of the theme.');
+               $this->strings['remove_old_failed'] = __('Could not remove the old theme.');
+               $this->strings['process_failed'] = __('Theme upgrade Failed.');
+               $this->strings['process_success'] = __('Theme upgraded successfully.');
+       }
+
+       function install_strings() {
+               $this->strings['no_package'] = __('Install package not available.');
+               $this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>.');
+               $this->strings['unpack_package'] = __('Unpacking the package.');
+               $this->strings['installing_package'] = __('Installing the theme.');
+               $this->strings['process_failed'] = __('Theme Install Failed.');
+               $this->strings['process_success'] = __('Theme Installed successfully.');
+       }
+
+       function install($package) {
+
+               $this->init();
+               $this->install_strings();
+
+               $options = array(
+                                               'package' => $package,
+                                               'destination' => WP_CONTENT_DIR . '/themes',
+                                               'clear_destination' => false, //Do not overwrite files.
+                                               'clear_working' => true
+                                               );
+
+               $this->run($options);
+
+               if ( ! $this->result || is_wp_error($this->result) )
+                       return $this->result;
+
+               // Force refresh of theme update information
+               delete_transient('update_themes');
+
+               if ( empty($result['destination_name']) )
+                       return false;
+               else
+                       return $result['destination_name'];
+       }
+
+       function upgrade($theme) {
+
+               $this->init();
+               $this->upgrade_strings();
+
+               // Is an update available?
+               $current = get_transient( 'update_themes' );
+               if ( !isset( $current->response[ $theme ] ) ) {
+                       $this->skin->set_result(false);
+                       $this->skin->error('up_to_date');
+                       $this->skin->after();
+                       return false;
+               }
+               
+               $r = $current->response[ $theme ];
+
+               add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
+               add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
+               add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
+
+               $options = array(
+                                               'package' => $r['package'],
+                                               'destination' => WP_CONTENT_DIR . '/themes',
+                                               'clear_destination' => true,
+                                               'clear_working' => true,
+                                               'hook_extra' => array(
+                                                                                       'theme' => $theme
+                                                                                       )
+                                               );
+
+               $this->run($options);
+
+               if ( ! $this->result || is_wp_error($this->result) )
+                       return $this->result;
+
+               // Force refresh of theme update information
+               delete_transient('update_themes');
+
+               return true;
+       }
+
+       function current_before($return, $theme) {
+
+               if ( is_wp_error($return) )
+                       return $return;
+
+               $theme = isset($theme['theme']) ? $theme['theme'] : '';
+
+               if ( $theme != get_stylesheet() ) //If not current
+                       return $return;
+               //Change to maintainence mode now.
+               $this->maintenance_mode(true);
+
+               return $return;
+       }
+       function current_after($return, $theme) {
+               if ( is_wp_error($return) )
+                       return $return;
+
+               $theme = isset($theme['theme']) ? $theme['theme'] : '';
+
+               if ( $theme != get_stylesheet() ) //If not current
+                       return $return;
+
+               //Ensure stylesheet name hasnt changed after the upgrade:
+               if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) {
+                       $theme_info = $this->theme_info();
+                       $stylesheet = $this->result['destination_name'];
+                       $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
+                       switch_theme($template, $stylesheet, true);
+               }
+
+               //Time to remove maintainence mode
+               $this->maintenance_mode(false);
+               return $return;
+       }
+
+       function delete_old_theme($removed, $local_destination, $remote_destination, $theme) {
+               global $wp_filesystem;
+
+               $theme = isset($theme['theme']) ? $theme['theme'] : '';
+
+               if ( is_wp_error($removed) || empty($theme) )
+                       return $removed; //Pass errors through.
+
+               $themes_dir = $wp_filesystem->wp_themes_dir();
+               if ( $wp_filesystem->exists( trailingslashit($themes_dir) . $theme ) )
+                       if ( ! $wp_filesystem->delete( trailingslashit($themes_dir) . $theme, true ) )
+                               return false;
+               return true;
+       }
+
+       function theme_info() {
+               if ( empty($this->result['destination_name']) )
+                       return false;
+               return get_theme_data(WP_CONTENT_DIR . '/themes/' . $this->result['destination_name'] . '/style.css');
+       }
+
+}
+
+/**
+ * Core Upgrader class for WordPress. It allows for WordPress to upgrade itself in combiantion with the wp-admin/includes/update-core.php file
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Core_Upgrader extends WP_Upgrader {
+
+       function upgrade_strings() {
+               $this->strings['up_to_date'] = __('WordPress is at the latest version.');
+               $this->strings['no_package'] = __('Upgrade package not available.');
+               $this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>.');
+               $this->strings['unpack_package'] = __('Unpacking the update.');
+               $this->strings['copy_failed'] = __('Could not copy files.');
+       }
+
+       function upgrade($current) {
+               global $wp_filesystem;
+
+               $this->init();
+               $this->upgrade_strings();
+
+               if ( !empty($feedback) )
+                       add_filter('update_feedback', $feedback);
+
+               // Is an update available?
+               if ( !isset( $current->response ) || $current->response == 'latest' )
+                       return new WP_Error('up_to_date', $this->strings['up_to_date']);
+
+               $res = $this->fs_connect( array(ABSPATH, WP_CONTENT_DIR) );
+               if ( is_wp_error($res) )
+                       return $res;
+
+               $wp_dir = trailingslashit($wp_filesystem->abspath());
+
+               $download = $this->download_package( $current->package );
+               if ( is_wp_error($download) )
+                       return $download;
+
+               $working_dir = $this->unpack_package( $download );
+               if ( is_wp_error($working_dir) )
+                       return $working_dir;
+
+               // Copy update-core.php from the new version into place.
+               if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) {
+                       $wp_filesystem->delete($working_dir, true);
+                       return new WP_Error('copy_failed', $this->strings['copy_failed']);
+               }
+               $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
+
+               require(ABSPATH . 'wp-admin/includes/update-core.php');
+
+               return update_core($working_dir, $wp_dir);
+       }
+
+}
+
+/**
+ * Generic Skin for the WordPress Upgrader classes. This skin is designed to be extended for specific purposes.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class WP_Upgrader_Skin {
+
+       var $upgrader;
+       var $done_header = false;
+
+       function WP_Upgrader_Skin($args = array()) {
+               return $this->__construct($args);
+       }
+       function __construct($args = array()) {
+               $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
+               $this->options = wp_parse_args($args, $defaults);
+       }
+
+       function set_upgrader(&$upgrader) {
+               if ( is_object($upgrader) )
+                       $this->upgrader =& $upgrader;
+       }
+       function set_result($result) {
+               $this->result = $result;
+       }
+
+       function request_filesystem_credentials($error = false) {
+               $url = $this->options['url'];
+               $context = $this->options['context'];
+               if ( !empty($this->options['nonce']) )
+                       $url = wp_nonce_url($url, $this->options['nonce']);
+               return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now.
+       }
+
+       function header() {
+               if ( $this->done_header )
+                       return;
+               $this->done_header = true;
+               echo '<div class="wrap">';
+               echo screen_icon();
+               echo '<h2>' . $this->options['title'] . '</h2>';
+       }
+       function footer() {
+               echo '</div>';
+       }
+
+       function error($errors) {
+               if ( ! $this->done_header )
+                       $this->header();
+               if ( is_string($errors) ) {
+                       $this->feedback($errors);
+               } elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
+                       foreach ( $errors->get_error_messages() as $message ) {
+                               if ( $errors->get_error_data() )
+                                       $this->feedback($message . ' ' . $errors->get_error_data() );
+                               else
+                                       $this->feedback($message);
+                       }
+               }
+       }
+
+       function feedback($string) {
+               if ( isset( $this->upgrader->strings[$string] ) )
+                       $string = $this->upgrader->strings[$string];
+
+               if ( strpos($string, '%') !== false ) {
+                       $args = func_get_args();
+                       $args = array_splice($args, 1);
+                       if ( !empty($args) )
+                               $string = vsprintf($string, $args);
+               }
+               if ( empty($string) )
+                       return;
+               show_message($string);
+       }
+       function before() {}
+       function after() {}
+
+}
+
+/**
+ * Plugin Upgrader Skin for WordPress Plugin Upgrades.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
+       var $plugin = '';
+       var $plugin_active = false;
+
+       function Plugin_Upgrader_Skin($args = array()) {
+               return $this->__construct($args);
+       }
+
+       function __construct($args = array()) {
+               $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Upgrade Plugin') );
+               $args = wp_parse_args($args, $defaults);
+
+               $this->plugin = $args['plugin'];
+
+               $this->plugin_active = is_plugin_active($this->plugin);
+
+               parent::__construct($args);
+       }
+
+       function after() {
+               $this->plugin = $this->upgrader->plugin_info();
+               if( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
+                       show_message(__('Attempting reactivation of the plugin'));
+                       echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) .'"></iframe>';
+               }
+               $update_actions =  array(
+                       'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
+                       'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
+               );
+               if ( $this->plugin_active )
+                       unset( $update_actions['activate_plugin'] );
+               if ( ! $this->result || is_wp_error($this->result) )
+                       unset( $update_actions['activate_plugin'] );
+
+               $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin);
+               if ( ! empty($update_actions) )
+                       $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
+       }
+}
+
+/**
+ * Plugin Installer Skin for WordPress Plugin Installer.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Plugin_Installer_Skin extends WP_Upgrader_Skin {
+       var $api;
+       var $type;
+
+       function Plugin_Installer_Skin($args = array()) {
+               return $this->__construct($args);
+       }
+
+       function __construct($args = array()) {
+               $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
+               $args = wp_parse_args($args, $defaults);
+
+               $this->type = $args['type'];
+               $this->api = isset($args['api']) ? $args['api'] : array();
+
+               parent::__construct($args);
+       }
+
+       function before() {
+               if ( !empty($this->api) )
+                       $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
+       }
+
+       function after() {
+
+               $plugin_file = $this->upgrader->plugin_info();
+
+               $install_actions = array(
+                       'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
+                                                       );
+
+               if ( $this->type == 'web' )
+                       $install_actions['plugins_page'] = '<a href="' . admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
+               else
+                       $install_actions['plugins_page'] = '<a href="' . admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
+
+
+               if ( ! $this->result || is_wp_error($this->result) )
+                       unset( $install_actions['activate_plugin'] );
+
+               $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
+               if ( ! empty($install_actions) )
+                       $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
+       }
+}
+
+/**
+ * Theme Installer Skin for the WordPress Theme Installer.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Theme_Installer_Skin extends WP_Upgrader_Skin {
+       var $api;
+       var $type;
+
+       function Theme_Installer_Skin($args = array()) {
+               return $this->__construct($args);
+       }
+
+       function __construct($args = array()) {
+               $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
+               $args = wp_parse_args($args, $defaults);
+
+               $this->type = $args['type'];
+               $this->api = isset($args['api']) ? $args['api'] : array();
+
+               parent::__construct($args);
+       }
+
+       function before() {
+               if ( !empty($this->api) ) {
+                       /* translators: 1: theme name, 2: version */
+                       $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the theme <strong>%1$s %2$s</strong>.'), $this->api->name, $this->api->version);
+               }
+       }
+
+       function after() {
+               if ( empty($this->upgrader->result['destination_name']) )
+                       return;
+
+               $theme_info = $this->upgrader->theme_info();
+               if ( empty($theme_info) )
+                       return;
+               $name = $theme_info['Name'];
+               $stylesheet = $this->upgrader->result['destination_name'];
+               $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
+
+               $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
+               $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
+
+               $install_actions = array(
+                       'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>',
+                       'activate' => '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>'
+                                                       );
+
+               if ( $this->type == 'web' )
+                       $install_actions['themes_page'] = '<a href="' . admin_url('theme-install.php') . '" title="' . esc_attr__('Return to Theme Installer') . '" target="_parent">' . __('Return to Theme Installer') . '</a>';
+               else
+                       $install_actions['themes_page'] = '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
+
+               if ( ! $this->result || is_wp_error($this->result) )
+                       unset( $install_actions['activate'], $install_actions['preview'] );
+
+               $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);
+               if ( ! empty($install_actions) )
+                       $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
+       }
+}
+
+/**
+ * Theme Upgrader Skin for WordPress Theme Upgrades.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
+       var $theme = '';
+
+       function Theme_Upgrader_Skin($args = array()) {
+               return $this->__construct($args);
+       }
+
+       function __construct($args = array()) {
+               $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Upgrade Theme') );
+               $args = wp_parse_args($args, $defaults);
+
+               $this->theme = $args['theme'];
+
+               parent::__construct($args);
+       }
+
+       function after() {
+
+               if ( !empty($this->upgrader->result['destination_name']) &&
+                       ($theme_info = $this->upgrader->theme_info()) &&
+                       !empty($theme_info) ) {
+
+                       $name = $theme_info['Name'];
+                       $stylesheet = $this->upgrader->result['destination_name'];
+                       $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
+       
+                       $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
+                       $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
+       
+                       $update_actions =  array(
+                               'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>',
+                               'activate' => '<a href="' . $activate_link .  '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>',
+                       );
+                       if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() )
+                               unset($update_actions['preview'], $update_actions['activate']);
+               }
+
+               $update_actions['themes_page'] = '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Return to Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
+
+               $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
+               if ( ! empty($update_actions) )
+                       $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
+       }
+}
+
+/**
+ * Upgrade Skin helper for File uploads. This class handles the upload process and passes it as if its a local file to the Upgrade/Installer functions.
+ *
+ * @TODO More Detailed docs, for methods as well.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class File_Upload_Upgrader {
+       var $package;
+       var $filename;
+
+       function File_Upload_Upgrader($form, $urlholder) {
+               return $this->__construct($form, $urlholder);
+       }
+       function __construct($form, $urlholder) {
+               if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
+                       wp_die($uploads['error']);
+
+               if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) )
+                       wp_die(__('Please select a file'));
+
+               if ( !empty($_FILES) )
+                       $this->filename = $_FILES[$form]['name'];
+               else if ( isset($_GET[$urlholder]) )
+                       $this->filename = $_GET[$urlholder];
+
+               //Handle a newly uploaded file, Else assume its already been uploaded
+               if ( !empty($_FILES) ) {
+                       $this->filename = wp_unique_filename( $uploads['basedir'], $this->filename );
+                       $this->package = $uploads['basedir'] . '/' . $this->filename;
+
+                       // Move the file to the uploads dir
+                       if ( false === @ move_uploaded_file( $_FILES[$form]['tmp_name'], $this->package) )
+                               wp_die( sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path']));
+               } else {
+                       $this->package = $uploads['basedir'] . '/' . $this->filename;
+               }
+       }
+}
index 0fd1533d2ba3e2669797050b9174bebd056a07e2..56e181afe6807f3152754836a9ad1b5961920152 100644 (file)
@@ -19,6 +19,9 @@
 function comment_exists($comment_author, $comment_date) {
        global $wpdb;
 
 function comment_exists($comment_author, $comment_date) {
        global $wpdb;
 
+       $comment_author = stripslashes($comment_author);
+       $comment_date = stripslashes($comment_date);
+
        return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
                        WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
 }
        return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
                        WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
 }
@@ -86,7 +89,7 @@ function get_comment_to_edit( $id ) {
 
        $comment->comment_author = format_to_edit( $comment->comment_author );
        $comment->comment_author_email = format_to_edit( $comment->comment_author_email );
 
        $comment->comment_author = format_to_edit( $comment->comment_author );
        $comment->comment_author_email = format_to_edit( $comment->comment_author_email );
-       $comment->comment_author_url = clean_url($comment->comment_author_url);
+       $comment->comment_author_url = esc_url($comment->comment_author_url);
        $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
 
        return $comment;
        $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
 
        return $comment;
@@ -156,7 +159,7 @@ function enqueue_comment_hotkeys_js() {
                wp_enqueue_script( 'jquery-table-hotkeys' );
 }
 
                wp_enqueue_script( 'jquery-table-hotkeys' );
 }
 
-if ( is_admin() && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
+if ( is_admin() && isset($pagenow) && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
        if ( get_option('show_avatars') )
                add_filter( 'comment_author', 'floated_admin_avatar' );
 }
        if ( get_option('show_avatars') )
                add_filter( 'comment_author', 'floated_admin_avatar' );
 }
diff --git a/wp-admin/includes/continents-cities.php b/wp-admin/includes/continents-cities.php
new file mode 100644 (file)
index 0000000..0ebc4f3
--- /dev/null
@@ -0,0 +1,493 @@
+<?php
+
+/* Continent and city translations for timezone selection.
+ * This file is not included anywhere. It exists solely for use by xgettext.
+ */
+
+__('Africa', 'continents-cities');
+__('Abidjan', 'continents-cities');
+__('Accra', 'continents-cities');
+__('Addis Ababa', 'continents-cities');
+__('Algiers', 'continents-cities');
+__('Asmara', 'continents-cities');
+__('Asmera', 'continents-cities');
+__('Bamako', 'continents-cities');
+__('Bangui', 'continents-cities');
+__('Banjul', 'continents-cities');
+__('Bissau', 'continents-cities');
+__('Blantyre', 'continents-cities');
+__('Brazzaville', 'continents-cities');
+__('Bujumbura', 'continents-cities');
+__('Cairo', 'continents-cities');
+__('Casablanca', 'continents-cities');
+__('Ceuta', 'continents-cities');
+__('Conakry', 'continents-cities');
+__('Dakar', 'continents-cities');
+__('Dar es Salaam', 'continents-cities');
+__('Djibouti', 'continents-cities');
+__('Douala', 'continents-cities');
+__('El Aaiun', 'continents-cities');
+__('Freetown', 'continents-cities');
+__('Gaborone', 'continents-cities');
+__('Harare', 'continents-cities');
+__('Johannesburg', 'continents-cities');
+__('Kampala', 'continents-cities');
+__('Khartoum', 'continents-cities');
+__('Kigali', 'continents-cities');
+__('Kinshasa', 'continents-cities');
+__('Lagos', 'continents-cities');
+__('Libreville', 'continents-cities');
+__('Lome', 'continents-cities');
+__('Luanda', 'continents-cities');
+__('Lubumbashi', 'continents-cities');
+__('Lusaka', 'continents-cities');
+__('Malabo', 'continents-cities');
+__('Maputo', 'continents-cities');
+__('Maseru', 'continents-cities');
+__('Mbabane', 'continents-cities');
+__('Mogadishu', 'continents-cities');
+__('Monrovia', 'continents-cities');
+__('Nairobi', 'continents-cities');
+__('Ndjamena', 'continents-cities');
+__('Niamey', 'continents-cities');
+__('Nouakchott', 'continents-cities');
+__('Ouagadougou', 'continents-cities');
+__('Porto-Novo', 'continents-cities');
+__('Sao Tome', 'continents-cities');
+__('Timbuktu', 'continents-cities');
+__('Tripoli', 'continents-cities');
+__('Tunis', 'continents-cities');
+__('Windhoek', 'continents-cities');
+__('America', 'continents-cities');
+__('Adak', 'continents-cities');
+__('Anchorage', 'continents-cities');
+__('Anguilla', 'continents-cities');
+__('Antigua', 'continents-cities');
+__('Araguaina', 'continents-cities');
+__('Argentina', 'continents-cities');
+__('Buenos Aires', 'continents-cities');
+__('Catamarca', 'continents-cities');
+__('ComodRivadavia', 'continents-cities');
+__('Cordoba', 'continents-cities');
+__('Jujuy', 'continents-cities');
+__('La Rioja', 'continents-cities');
+__('Mendoza', 'continents-cities');
+__('Rio Gallegos', 'continents-cities');
+__('San Juan', 'continents-cities');
+__('San Luis', 'continents-cities');
+__('Tucuman', 'continents-cities');
+__('Ushuaia', 'continents-cities');
+__('Aruba', 'continents-cities');
+__('Asuncion', 'continents-cities');
+__('Atikokan', 'continents-cities');
+__('Atka', 'continents-cities');
+__('Bahia', 'continents-cities');
+__('Barbados', 'continents-cities');
+__('Belem', 'continents-cities');
+__('Belize', 'continents-cities');
+__('Blanc-Sablon', 'continents-cities');
+__('Boa Vista', 'continents-cities');
+__('Bogota', 'continents-cities');
+__('Boise', 'continents-cities');
+__('Cambridge Bay', 'continents-cities');
+__('Campo Grande', 'continents-cities');
+__('Cancun', 'continents-cities');
+__('Caracas', 'continents-cities');
+__('Cayenne', 'continents-cities');
+__('Cayman', 'continents-cities');
+__('Chicago', 'continents-cities');
+__('Chihuahua', 'continents-cities');
+__('Coral Harbour', 'continents-cities');
+__('Costa Rica', 'continents-cities');
+__('Cuiaba', 'continents-cities');
+__('Curacao', 'continents-cities');
+__('Danmarkshavn', 'continents-cities');
+__('Dawson', 'continents-cities');
+__('Dawson Creek', 'continents-cities');
+__('Denver', 'continents-cities');
+__('Detroit', 'continents-cities');
+__('Dominica', 'continents-cities');
+__('Edmonton', 'continents-cities');
+__('Eirunepe', 'continents-cities');
+__('El Salvador', 'continents-cities');
+__('Ensenada', 'continents-cities');
+__('Fort Wayne', 'continents-cities');
+__('Fortaleza', 'continents-cities');
+__('Glace Bay', 'continents-cities');
+__('Godthab', 'continents-cities');
+__('Goose Bay', 'continents-cities');
+__('Grand Turk', 'continents-cities');
+__('Grenada', 'continents-cities');
+__('Guadeloupe', 'continents-cities');
+__('Guatemala', 'continents-cities');
+__('Guayaquil', 'continents-cities');
+__('Guyana', 'continents-cities');
+__('Halifax', 'continents-cities');
+__('Havana', 'continents-cities');
+__('Hermosillo', 'continents-cities');
+__('Indiana', 'continents-cities');
+__('Indianapolis', 'continents-cities');
+__('Knox', 'continents-cities');
+__('Marengo', 'continents-cities');
+__('Petersburg', 'continents-cities');
+__('Tell City', 'continents-cities');
+__('Vevay', 'continents-cities');
+__('Vincennes', 'continents-cities');
+__('Winamac', 'continents-cities');
+__('Inuvik', 'continents-cities');
+__('Iqaluit', 'continents-cities');
+__('Jamaica', 'continents-cities');
+__('Juneau', 'continents-cities');
+__('Kentucky', 'continents-cities');
+__('Louisville', 'continents-cities');
+__('Monticello', 'continents-cities');
+__('Knox IN', 'continents-cities');
+__('La Paz', 'continents-cities');
+__('Lima', 'continents-cities');
+__('Los Angeles', 'continents-cities');
+__('Maceio', 'continents-cities');
+__('Managua', 'continents-cities');
+__('Manaus', 'continents-cities');
+__('Marigot', 'continents-cities');
+__('Martinique', 'continents-cities');
+__('Mazatlan', 'continents-cities');
+__('Menominee', 'continents-cities');
+__('Merida', 'continents-cities');
+__('Mexico City', 'continents-cities');
+__('Miquelon', 'continents-cities');
+__('Moncton', 'continents-cities');
+__('Monterrey', 'continents-cities');
+__('Montevideo', 'continents-cities');
+__('Montreal', 'continents-cities');
+__('Montserrat', 'continents-cities');
+__('Nassau', 'continents-cities');
+__('New York', 'continents-cities');
+__('Nipigon', 'continents-cities');
+__('Nome', 'continents-cities');
+__('Noronha', 'continents-cities');
+__('North Dakota', 'continents-cities');
+__('Center', 'continents-cities');
+__('New Salem', 'continents-cities');
+__('Panama', 'continents-cities');
+__('Pangnirtung', 'continents-cities');
+__('Paramaribo', 'continents-cities');
+__('Phoenix', 'continents-cities');
+__('Port-au-Prince', 'continents-cities');
+__('Port of Spain', 'continents-cities');
+__('Porto Acre', 'continents-cities');
+__('Porto Velho', 'continents-cities');
+__('Puerto Rico', 'continents-cities');
+__('Rainy River', 'continents-cities');
+__('Rankin Inlet', 'continents-cities');
+__('Recife', 'continents-cities');
+__('Regina', 'continents-cities');
+__('Resolute', 'continents-cities');
+__('Rio Branco', 'continents-cities');
+__('Rosario', 'continents-cities');
+__('Santiago', 'continents-cities');
+__('Santo Domingo', 'continents-cities');
+__('Sao Paulo', 'continents-cities');
+__('Scoresbysund', 'continents-cities');
+__('Shiprock', 'continents-cities');
+__('St Barthelemy', 'continents-cities');
+__('St Johns', 'continents-cities');
+__('St Kitts', 'continents-cities');
+__('St Lucia', 'continents-cities');
+__('St Thomas', 'continents-cities');
+__('St Vincent', 'continents-cities');
+__('Swift Current', 'continents-cities');
+__('Tegucigalpa', 'continents-cities');
+__('Thule', 'continents-cities');
+__('Thunder Bay', 'continents-cities');
+__('Tijuana', 'continents-cities');
+__('Toronto', 'continents-cities');
+__('Tortola', 'continents-cities');
+__('Vancouver', 'continents-cities');
+__('Virgin', 'continents-cities');
+__('Whitehorse', 'continents-cities');
+__('Winnipeg', 'continents-cities');
+__('Yakutat', 'continents-cities');
+__('Yellowknife', 'continents-cities');
+__('Antarctica', 'continents-cities');
+__('Casey', 'continents-cities');
+__('Davis', 'continents-cities');
+__('DumontDUrville', 'continents-cities');
+__('Mawson', 'continents-cities');
+__('McMurdo', 'continents-cities');
+__('Palmer', 'continents-cities');
+__('Rothera', 'continents-cities');
+__('South Pole', 'continents-cities');
+__('Syowa', 'continents-cities');
+__('Vostok', 'continents-cities');
+__('Arctic', 'continents-cities');
+__('Longyearbyen', 'continents-cities');
+__('Asia', 'continents-cities');
+__('Aden', 'continents-cities');
+__('Almaty', 'continents-cities');
+__('Amman', 'continents-cities');
+__('Anadyr', 'continents-cities');
+__('Aqtau', 'continents-cities');
+__('Aqtobe', 'continents-cities');
+__('Ashgabat', 'continents-cities');
+__('Ashkhabad', 'continents-cities');
+__('Baghdad', 'continents-cities');
+__('Bahrain', 'continents-cities');
+__('Baku', 'continents-cities');
+__('Bangkok', 'continents-cities');
+__('Beirut', 'continents-cities');
+__('Bishkek', 'continents-cities');
+__('Brunei', 'continents-cities');
+__('Calcutta', 'continents-cities');
+__('Choibalsan', 'continents-cities');
+__('Chongqing', 'continents-cities');
+__('Chungking', 'continents-cities');
+__('Colombo', 'continents-cities');
+__('Dacca', 'continents-cities');
+__('Damascus', 'continents-cities');
+__('Dhaka', 'continents-cities');
+__('Dili', 'continents-cities');
+__('Dubai', 'continents-cities');
+__('Dushanbe', 'continents-cities');
+__('Gaza', 'continents-cities');
+__('Harbin', 'continents-cities');
+__('Ho Chi Minh', 'continents-cities');
+__('Hong Kong', 'continents-cities');
+__('Hovd', 'continents-cities');
+__('Irkutsk', 'continents-cities');
+__('Istanbul', 'continents-cities');
+__('Jakarta', 'continents-cities');
+__('Jayapura', 'continents-cities');
+__('Jerusalem', 'continents-cities');
+__('Kabul', 'continents-cities');
+__('Kamchatka', 'continents-cities');
+__('Karachi', 'continents-cities');
+__('Kashgar', 'continents-cities');
+__('Katmandu', 'continents-cities');
+__('Kolkata', 'continents-cities');
+__('Krasnoyarsk', 'continents-cities');
+__('Kuala Lumpur', 'continents-cities');
+__('Kuching', 'continents-cities');
+__('Kuwait', 'continents-cities');
+__('Macao', 'continents-cities');
+__('Macau', 'continents-cities');
+__('Magadan', 'continents-cities');
+__('Makassar', 'continents-cities');
+__('Manila', 'continents-cities');
+__('Muscat', 'continents-cities');
+__('Nicosia', 'continents-cities');
+__('Novosibirsk', 'continents-cities');
+__('Omsk', 'continents-cities');
+__('Oral', 'continents-cities');
+__('Phnom Penh', 'continents-cities');
+__('Pontianak', 'continents-cities');
+__('Pyongyang', 'continents-cities');
+__('Qatar', 'continents-cities');
+__('Qyzylorda', 'continents-cities');
+__('Rangoon', 'continents-cities');
+__('Riyadh', 'continents-cities');
+__('Saigon', 'continents-cities');
+__('Sakhalin', 'continents-cities');
+__('Samarkand', 'continents-cities');
+__('Seoul', 'continents-cities');
+__('Shanghai', 'continents-cities');
+__('Singapore', 'continents-cities');
+__('Taipei', 'continents-cities');
+__('Tashkent', 'continents-cities');
+__('Tbilisi', 'continents-cities');
+__('Tehran', 'continents-cities');
+__('Tel Aviv', 'continents-cities');
+__('Thimbu', 'continents-cities');
+__('Thimphu', 'continents-cities');
+__('Tokyo', 'continents-cities');
+__('Ujung Pandang', 'continents-cities');
+__('Ulaanbaatar', 'continents-cities');
+__('Ulan Bator', 'continents-cities');
+__('Urumqi', 'continents-cities');
+__('Vientiane', 'continents-cities');
+__('Vladivostok', 'continents-cities');
+__('Yakutsk', 'continents-cities');
+__('Yekaterinburg', 'continents-cities');
+__('Yerevan', 'continents-cities');
+__('Atlantic', 'continents-cities');
+__('Azores', 'continents-cities');
+__('Bermuda', 'continents-cities');
+__('Canary', 'continents-cities');
+__('Cape Verde', 'continents-cities');
+__('Faeroe', 'continents-cities');
+__('Faroe', 'continents-cities');
+__('Jan Mayen', 'continents-cities');
+__('Madeira', 'continents-cities');
+__('Reykjavik', 'continents-cities');
+__('South Georgia', 'continents-cities');
+__('St Helena', 'continents-cities');
+__('Stanley', 'continents-cities');
+__('Australia', 'continents-cities');
+__('ACT', 'continents-cities');
+__('Adelaide', 'continents-cities');
+__('Brisbane', 'continents-cities');
+__('Broken Hill', 'continents-cities');
+__('Canberra', 'continents-cities');
+__('Currie', 'continents-cities');
+__('Darwin', 'continents-cities');
+__('Eucla', 'continents-cities');
+__('Hobart', 'continents-cities');
+__('LHI', 'continents-cities');
+__('Lindeman', 'continents-cities');
+__('Lord Howe', 'continents-cities');
+__('Melbourne', 'continents-cities');
+__('North', 'continents-cities');
+__('NSW', 'continents-cities');
+__('Perth', 'continents-cities');
+__('Queensland', 'continents-cities');
+__('South', 'continents-cities');
+__('Sydney', 'continents-cities');
+__('Tasmania', 'continents-cities');
+__('Victoria', 'continents-cities');
+__('West', 'continents-cities');
+__('Yancowinna', 'continents-cities');
+__('Etc', 'continents-cities');
+__('GMT', 'continents-cities');
+__('GMT+0', 'continents-cities');
+__('GMT+1', 'continents-cities');
+__('GMT+10', 'continents-cities');
+__('GMT+11', 'continents-cities');
+__('GMT+12', 'continents-cities');
+__('GMT+2', 'continents-cities');
+__('GMT+3', 'continents-cities');
+__('GMT+4', 'continents-cities');
+__('GMT+5', 'continents-cities');
+__('GMT+6', 'continents-cities');
+__('GMT+7', 'continents-cities');
+__('GMT+8', 'continents-cities');
+__('GMT+9', 'continents-cities');
+__('GMT-0', 'continents-cities');
+__('GMT-1', 'continents-cities');
+__('GMT-10', 'continents-cities');
+__('GMT-11', 'continents-cities');
+__('GMT-12', 'continents-cities');
+__('GMT-13', 'continents-cities');
+__('GMT-14', 'continents-cities');
+__('GMT-2', 'continents-cities');
+__('GMT-3', 'continents-cities');
+__('GMT-4', 'continents-cities');
+__('GMT-5', 'continents-cities');
+__('GMT-6', 'continents-cities');
+__('GMT-7', 'continents-cities');
+__('GMT-8', 'continents-cities');
+__('GMT-9', 'continents-cities');
+__('GMT0', 'continents-cities');
+__('Greenwich', 'continents-cities');
+__('UCT', 'continents-cities');
+__('Universal', 'continents-cities');
+__('UTC', 'continents-cities');
+__('Zulu', 'continents-cities');
+__('Europe', 'continents-cities');
+__('Amsterdam', 'continents-cities');
+__('Andorra', 'continents-cities');
+__('Athens', 'continents-cities');
+__('Belfast', 'continents-cities');
+__('Belgrade', 'continents-cities');
+__('Berlin', 'continents-cities');
+__('Bratislava', 'continents-cities');
+__('Brussels', 'continents-cities');
+__('Bucharest', 'continents-cities');
+__('Budapest', 'continents-cities');
+__('Chisinau', 'continents-cities');
+__('Copenhagen', 'continents-cities');
+__('Dublin', 'continents-cities');
+__('Gibraltar', 'continents-cities');
+__('Guernsey', 'continents-cities');
+__('Helsinki', 'continents-cities');
+__('Isle of Man', 'continents-cities');
+__('Jersey', 'continents-cities');
+__('Kaliningrad', 'continents-cities');
+__('Kiev', 'continents-cities');
+__('Lisbon', 'continents-cities');
+__('Ljubljana', 'continents-cities');
+__('London', 'continents-cities');
+__('Luxembourg', 'continents-cities');
+__('Madrid', 'continents-cities');
+__('Malta', 'continents-cities');
+__('Mariehamn', 'continents-cities');
+__('Minsk', 'continents-cities');
+__('Monaco', 'continents-cities');
+__('Moscow', 'continents-cities');
+__('Oslo', 'continents-cities');
+__('Paris', 'continents-cities');
+__('Podgorica', 'continents-cities');
+__('Prague', 'continents-cities');
+__('Riga', 'continents-cities');
+__('Rome', 'continents-cities');
+__('Samara', 'continents-cities');
+__('San Marino', 'continents-cities');
+__('Sarajevo', 'continents-cities');
+__('Simferopol', 'continents-cities');
+__('Skopje', 'continents-cities');
+__('Sofia', 'continents-cities');
+__('Stockholm', 'continents-cities');
+__('Tallinn', 'continents-cities');
+__('Tirane', 'continents-cities');
+__('Tiraspol', 'continents-cities');
+__('Uzhgorod', 'continents-cities');
+__('Vaduz', 'continents-cities');
+__('Vatican', 'continents-cities');
+__('Vienna', 'continents-cities');
+__('Vilnius', 'continents-cities');
+__('Volgograd', 'continents-cities');
+__('Warsaw', 'continents-cities');
+__('Zagreb', 'continents-cities');
+__('Zaporozhye', 'continents-cities');
+__('Zurich', 'continents-cities');
+__('Indian', 'continents-cities');
+__('Antananarivo', 'continents-cities');
+__('Chagos', 'continents-cities');
+__('Christmas', 'continents-cities');
+__('Cocos', 'continents-cities');
+__('Comoro', 'continents-cities');
+__('Kerguelen', 'continents-cities');
+__('Mahe', 'continents-cities');
+__('Maldives', 'continents-cities');
+__('Mauritius', 'continents-cities');
+__('Mayotte', 'continents-cities');
+__('Reunion', 'continents-cities');
+__('Pacific', 'continents-cities');
+__('Apia', 'continents-cities');
+__('Auckland', 'continents-cities');
+__('Chatham', 'continents-cities');
+__('Easter', 'continents-cities');
+__('Efate', 'continents-cities');
+__('Enderbury', 'continents-cities');
+__('Fakaofo', 'continents-cities');
+__('Fiji', 'continents-cities');
+__('Funafuti', 'continents-cities');
+__('Galapagos', 'continents-cities');
+__('Gambier', 'continents-cities');
+__('Guadalcanal', 'continents-cities');
+__('Guam', 'continents-cities');
+__('Honolulu', 'continents-cities');
+__('Johnston', 'continents-cities');
+__('Kiritimati', 'continents-cities');
+__('Kosrae', 'continents-cities');
+__('Kwajalein', 'continents-cities');
+__('Majuro', 'continents-cities');
+__('Marquesas', 'continents-cities');
+__('Midway', 'continents-cities');
+__('Nauru', 'continents-cities');
+__('Niue', 'continents-cities');
+__('Norfolk', 'continents-cities');
+__('Noumea', 'continents-cities');
+__('Pago Pago', 'continents-cities');
+__('Palau', 'continents-cities');
+__('Pitcairn', 'continents-cities');
+__('Ponape', 'continents-cities');
+__('Port Moresby', 'continents-cities');
+__('Rarotonga', 'continents-cities');
+__('Saipan', 'continents-cities');
+__('Samoa', 'continents-cities');
+__('Tahiti', 'continents-cities');
+__('Tarawa', 'continents-cities');
+__('Tongatapu', 'continents-cities');
+__('Truk', 'continents-cities');
+__('Wake', 'continents-cities');
+__('Wallis', 'continents-cities');
+__('Yap', 'continents-cities');
index b08615f93d3768ea9c4fdb1b8225b37c28e4519a..ec93fb0d095d924f60223681eaf032521bfb4be0 100644 (file)
@@ -37,7 +37,7 @@ function wp_dashboard_setup() {
                $widget_options['dashboard_incoming_links'] = array(
                        'home' => get_option('home'),
                        'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
                $widget_options['dashboard_incoming_links'] = array(
                        'home' => get_option('home'),
                        'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
-                       'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
+                       'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=20&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
                        'items' => isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10,
                        'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
                );
                        'items' => isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10,
                        'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
                );
@@ -115,12 +115,12 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
                $wp_dashboard_control_callbacks[$widget_id] = $control_callback;
                if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
                        list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
                $wp_dashboard_control_callbacks[$widget_id] = $control_callback;
                if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
                        list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
-                       $widget_name .= ' <span class="postbox-title-action"><a href="' . clean_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
+                       $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
                        add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' );
                        return;
                }
                list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
                        add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' );
                        return;
                }
                list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
-               $widget_name .= ' <span class="postbox-title-action"><a href="' . clean_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
+               $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
        }
        $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
        $location = 'normal';
        }
        $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
        $location = 'normal';
@@ -132,7 +132,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
        echo '<form action="" method="post" class="dashboard-widget-control-form">';
        wp_dashboard_trigger_widget_control( $meta_box['id'] );
 function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
        echo '<form action="" method="post" class="dashboard-widget-control-form">';
        wp_dashboard_trigger_widget_control( $meta_box['id'] );
-       echo "<p class='submit'><input type='hidden' name='widget_id' value='$meta_box[id]' /><input type='submit' value='" . __( 'Submit' ) . "' /></p>";
+       echo "<p class='submit'><input type='hidden' name='widget_id' value='" . esc_attr($meta_box['id']) . "' /><input type='submit' value='" . esc_attr__( 'Submit' ) . "' /></p>";
 
        echo '</form>';
 }
 
        echo '</form>';
 }
@@ -143,29 +143,59 @@ function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
  * @since unknown
  */
 function wp_dashboard() {
  * @since unknown
  */
 function wp_dashboard() {
-       echo "<div id='dashboard-widgets' class='metabox-holder'>\n\n";
+       global $screen_layout_columns;
+
+       $hide2 = $hide3 = $hide4 = '';
+       switch ( $screen_layout_columns ) {
+               case 4:
+                       $width = 'width:24.5%;';
+                       break;
+               case 3:
+                       $width = 'width:32.67%;';
+                       $hide4 = 'display:none;';
+                       break;
+               case 2:
+                       $width = 'width:49%;';
+                       $hide3 = $hide4 = 'display:none;';
+                       break;
+               default:
+                       $width = 'width:98%;';
+                       $hide2 = $hide3 = $hide4 = 'display:none;';
+       }
+?>
+<div id='dashboard-widgets' class='metabox-holder'>
+<?php
+       echo "\t<div class='postbox-container' style='$width'>\n";
+       do_meta_boxes( 'dashboard', 'normal', '' );
 
 
-       echo "<div id='side-info-column' class='inner-sidebar'>\n\n";
-       $class = do_meta_boxes( 'dashboard', 'side', '' ) ? ' class="has-sidebar"' : '';
-       echo "</div>\n\n";
+       echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n";
+       do_meta_boxes( 'dashboard', 'side', '' );
 
 
-       echo "<div id='post-body'$class>\n\n";
-       echo "<div id='dashboard-widgets-main-content' class='has-sidebar-content'>\n\n";
-       do_meta_boxes( 'dashboard', 'normal', '' );
-       echo "</div>\n\n";
-       echo "</div>\n\n";
+       echo "\t</div><div class='postbox-container' style='{$hide3}$width'>\n";
+       do_meta_boxes( 'dashboard', 'column3', '' );
 
 
-       echo "<form style='display: none' method='get' action=''>\n<p>\n";
+       echo "\t</div><div class='postbox-container' style='{$hide4}$width'>\n";
+       do_meta_boxes( 'dashboard', 'column4', '' );
+?>
+</div></div>
+
+<form style='display: none' method='get' action=''>
+       <p>
+<?php
        wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
        wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
        wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
        wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
-       echo "</p>\n</form>\n";
+?>
+       </p>
+</form>
 
 
-       echo "</div>";
+<?php
 }
 
 /* Dashboard Widgets */
 
 function wp_dashboard_right_now() {
 }
 
 /* Dashboard Widgets */
 
 function wp_dashboard_right_now() {
+       global $wp_registered_sidebars;
+
        $num_posts = wp_count_posts( 'post' );
        $num_pages = wp_count_posts( 'page' );
 
        $num_posts = wp_count_posts( 'post' );
        $num_pages = wp_count_posts( 'page' );
 
@@ -181,7 +211,7 @@ function wp_dashboard_right_now() {
 
        // Posts
        $num = number_format_i18n( $num_posts->publish );
 
        // Posts
        $num = number_format_i18n( $num_posts->publish );
-       $text = __ngettext( 'Post', 'Posts', intval($num_posts->publish) );
+       $text = _n( 'Post', 'Posts', intval($num_posts->publish) );
        if ( current_user_can( 'edit_posts' ) ) {
                $num = "<a href='edit.php'>$num</a>";
                $text = "<a href='edit.php'>$text</a>";
        if ( current_user_can( 'edit_posts' ) ) {
                $num = "<a href='edit.php'>$num</a>";
                $text = "<a href='edit.php'>$text</a>";
@@ -190,16 +220,16 @@ function wp_dashboard_right_now() {
        echo '<td class="t posts">' . $text . '</td>';
        /* TODO: Show status breakdown on hover
        if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
        echo '<td class="t posts">' . $text . '</td>';
        /* TODO: Show status breakdown on hover
        if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
-               $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
+               $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
        }
        if ( $can_edit_posts && !empty($num_posts->draft) ) {
        }
        if ( $can_edit_posts && !empty($num_posts->draft) ) {
-               $post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
+               $post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( _n( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
        }
        if ( $can_edit_posts && !empty($num_posts->future) ) {
        }
        if ( $can_edit_posts && !empty($num_posts->future) ) {
-               $post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
+               $post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( _n( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
        }
        if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
        }
        if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
-               $pending_text = sprintf( __ngettext( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
+               $pending_text = sprintf( _n( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
        } else {
                $pending_text = '';
        }
        } else {
                $pending_text = '';
        }
@@ -207,7 +237,7 @@ function wp_dashboard_right_now() {
 
        // Total Comments
        $num = number_format_i18n($num_comm->total_comments);
 
        // Total Comments
        $num = number_format_i18n($num_comm->total_comments);
-       $text = __ngettext( 'Comment', 'Comments', $num_comm->total_comments );
+       $text = _n( 'Comment', 'Comments', $num_comm->total_comments );
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php'>$num</a>";
                $text = "<a href='edit-comments.php'>$text</a>";
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php'>$num</a>";
                $text = "<a href='edit-comments.php'>$text</a>";
@@ -219,7 +249,7 @@ function wp_dashboard_right_now() {
 
        // Pages
        $num = number_format_i18n( $num_pages->publish );
 
        // Pages
        $num = number_format_i18n( $num_pages->publish );
-       $text = __ngettext( 'Page', 'Pages', $num_pages->publish );
+       $text = _n( 'Page', 'Pages', $num_pages->publish );
        if ( current_user_can( 'edit_pages' ) ) {
                $num = "<a href='edit-pages.php'>$num</a>";
                $text = "<a href='edit-pages.php'>$text</a>";
        if ( current_user_can( 'edit_pages' ) ) {
                $num = "<a href='edit-pages.php'>$num</a>";
                $text = "<a href='edit-pages.php'>$text</a>";
@@ -229,7 +259,7 @@ function wp_dashboard_right_now() {
 
        // Approved Comments
        $num = number_format_i18n($num_comm->approved);
 
        // Approved Comments
        $num = number_format_i18n($num_comm->approved);
-       $text = __ngettext( 'Approved', 'Approved', $num_comm->approved );
+       $text = _nc( 'Approved|Right Now', 'Approved', $num_comm->approved );
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
                $text = "<a class='approved' href='edit-comments.php?comment_status=approved'>$text</a>";
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
                $text = "<a class='approved' href='edit-comments.php?comment_status=approved'>$text</a>";
@@ -241,7 +271,7 @@ function wp_dashboard_right_now() {
 
        // Categories
        $num = number_format_i18n( $num_cats );
 
        // Categories
        $num = number_format_i18n( $num_cats );
-       $text = __ngettext( 'Category', 'Categories', $num_cats );
+       $text = _n( 'Category', 'Categories', $num_cats );
        if ( current_user_can( 'manage_categories' ) ) {
                $num = "<a href='categories.php'>$num</a>";
                $text = "<a href='categories.php'>$text</a>";
        if ( current_user_can( 'manage_categories' ) ) {
                $num = "<a href='categories.php'>$num</a>";
                $text = "<a href='categories.php'>$text</a>";
@@ -251,7 +281,7 @@ function wp_dashboard_right_now() {
 
        // Pending Comments
        $num = number_format_i18n($num_comm->moderated);
 
        // Pending Comments
        $num = number_format_i18n($num_comm->moderated);
-       $text = __ngettext( 'Pending', 'Pending', $num_comm->moderated );
+       $text = _n( 'Pending', 'Pending', $num_comm->moderated );
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
                $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
                $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>$text</a>";
@@ -263,7 +293,7 @@ function wp_dashboard_right_now() {
 
        // Tags
        $num = number_format_i18n( $num_tags );
 
        // Tags
        $num = number_format_i18n( $num_tags );
-       $text = __ngettext( 'Tag', 'Tags', $num_tags );
+       $text = _n( 'Tag', 'Tags', $num_tags );
        if ( current_user_can( 'manage_categories' ) ) {
                $num = "<a href='edit-tags.php'>$num</a>";
                $text = "<a href='edit-tags.php'>$text</a>";
        if ( current_user_can( 'manage_categories' ) ) {
                $num = "<a href='edit-tags.php'>$num</a>";
                $text = "<a href='edit-tags.php'>$text</a>";
@@ -273,7 +303,7 @@ function wp_dashboard_right_now() {
 
        // Spam Comments
        $num = number_format_i18n($num_comm->spam);
 
        // Spam Comments
        $num = number_format_i18n($num_comm->spam);
-       $text = __ngettext( 'Spam', 'Spam', $num_comm->spam );
+       $text = _n( 'Spam', 'Spam', $num_comm->spam );
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>$num</span></a>";
                $text = "<a class='spam' href='edit-comments.php?comment_status=spam'>$text</a>";
        if ( current_user_can( 'moderate_comments' ) ) {
                $num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>$num</span></a>";
                $text = "<a class='spam' href='edit-comments.php?comment_status=spam'>$text</a>";
@@ -287,18 +317,33 @@ function wp_dashboard_right_now() {
 
        echo "\n\t".'<div class="versions">';
        $ct = current_theme_info();
 
        echo "\n\t".'<div class="versions">';
        $ct = current_theme_info();
-       $sidebars_widgets = wp_get_sidebars_widgets();
-       $num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
-       $num = number_format_i18n( $num_widgets );
 
        echo "\n\t<p>";
 
        echo "\n\t<p>";
-       if ( current_user_can( 'switch_themes' ) ) {
-               echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
-               printf(__ngettext('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
+       if ( !empty($wp_registered_sidebars) ) {
+               $sidebars_widgets = wp_get_sidebars_widgets();
+               $num_widgets = 0;
+               foreach ( (array) $sidebars_widgets as $k => $v ) {
+                       if ( 'wp_inactive_widgets' == $k )
+                               continue;
+                       if ( is_array($v) )
+                               $num_widgets = $num_widgets + count($v);
+               }
+               $num = number_format_i18n( $num_widgets );
+
+               if ( current_user_can( 'switch_themes' ) ) {
+                       echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
+                       printf(_n('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
+               } else {
+                       printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
+               }
        } else {
        } else {
-               printf(__ngettext('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
+               if ( current_user_can( 'switch_themes' ) ) {
+                       echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
+                       printf('Theme <span class="b"><a href="themes.php">%1$s</a></span>', $ct->title);
+               } else {
+                       printf('Theme <span class="b">%1$s</span>', $ct->title);
+               }
        }
        }
-
        echo '</p>';
 
        update_right_now_message();
        echo '</p>';
 
        update_right_now_message();
@@ -312,17 +357,16 @@ function wp_dashboard_quick_press() {
        $drafts = false;
        if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) {
                $view = get_permalink( $_POST['post_ID'] );
        $drafts = false;
        if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) {
                $view = get_permalink( $_POST['post_ID'] );
-               $edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) );
+               $edit = esc_url( get_edit_post_link( $_POST['post_ID'] ) );
                if ( 'post-quickpress-publish' == $_POST['action'] ) {
                        if ( current_user_can('publish_posts') )
                if ( 'post-quickpress-publish' == $_POST['action'] ) {
                        if ( current_user_can('publish_posts') )
-                               printf( '<div class="message"><p>' . __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', clean_url( $view ), $edit );
+                               printf( '<div class="message"><p>' . __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit );
                        else
                        else
-                               printf( '<div class="message"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', clean_url( add_query_arg( 'preview', 1, $view ) ), $edit );
+                               printf( '<div class="message"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
                } else {
                } else {
-                       printf( '<div class="message"><p>' . __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', clean_url( add_query_arg( 'preview', 1, $view ) ), $edit );
+                       printf( '<div class="message"><p>' . __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );
                        $drafts_query = new WP_Query( array(
                                'post_type' => 'post',
                        $drafts_query = new WP_Query( array(
                                'post_type' => 'post',
-                               'what_to_show' => 'posts',
                                'post_status' => 'draft',
                                'author' => $GLOBALS['current_user']->ID,
                                'posts_per_page' => 1,
                                'post_status' => 'draft',
                                'author' => $GLOBALS['current_user']->ID,
                                'posts_per_page' => 1,
@@ -340,10 +384,10 @@ function wp_dashboard_quick_press() {
        $post = get_default_post_to_edit();
 ?>
 
        $post = get_default_post_to_edit();
 ?>
 
-       <form name="post" action="<?php echo clean_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press">
+       <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press">
                <h4 id="quick-post-title"><label for="title"><?php _e('Title') ?></label></h4>
                <div class="input-text-wrap">
                <h4 id="quick-post-title"><label for="title"><?php _e('Title') ?></label></h4>
                <div class="input-text-wrap">
-                       <input type="text" name="post_title" id="title" tabindex="1" autocomplete="off" value="<?php echo attribute_escape( $post->post_title ); ?>" />
+                       <input type="text" name="post_title" id="title" tabindex="1" autocomplete="off" value="<?php echo esc_attr( $post->post_title ); ?>" />
                </div>
 
                <?php if ( current_user_can( 'upload_files' ) ) : ?>
                </div>
 
                <?php if ( current_user_can( 'upload_files' ) ) : ?>
@@ -368,12 +412,12 @@ function wp_dashboard_quick_press() {
                        <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" />
                        <input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" />
                        <?php wp_nonce_field('add-post'); ?>
                        <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" />
                        <input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" />
                        <?php wp_nonce_field('add-post'); ?>
-                       <input type="submit" name="save" id="save-post" class="button" tabindex="4" value="<?php _e('Save Draft'); ?>" />
-                       <input type="reset" value="<?php _e( 'Cancel' ); ?>" class="cancel" />
+                       <input type="submit" name="save" id="save-post" class="button" tabindex="4" value="<?php esc_attr_e('Save Draft'); ?>" />
+                       <input type="reset" value="<?php esc_attr_e( 'Reset' ); ?>" class="button" />
                        <?php if ( current_user_can('publish_posts') ) { ?>
                        <?php if ( current_user_can('publish_posts') ) { ?>
-                       <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php _e('Publish'); ?>" />
+                       <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php esc_attr_e('Publish'); ?>" />
                        <?php } else { ?>
                        <?php } else { ?>
-                       <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php _e('Submit for Review'); ?>" />
+                       <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php esc_attr_e('Submit for Review'); ?>" />
                        <?php } ?>
                        <br class="clear" />
                </p>
                        <?php } ?>
                        <br class="clear" />
                </p>
@@ -389,7 +433,6 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
        if ( !$drafts ) {
                $drafts_query = new WP_Query( array(
                        'post_type' => 'post',
        if ( !$drafts ) {
                $drafts_query = new WP_Query( array(
                        'post_type' => 'post',
-                       'what_to_show' => 'posts',
                        'post_status' => 'draft',
                        'author' => $GLOBALS['current_user']->ID,
                        'posts_per_page' => 5,
                        'post_status' => 'draft',
                        'author' => $GLOBALS['current_user']->ID,
                        'posts_per_page' => 5,
@@ -404,7 +447,7 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
                foreach ( $drafts as $draft ) {
                        $url = get_edit_post_link( $draft->ID );
                        $title = _draft_or_post_title( $draft->ID );
                foreach ( $drafts as $draft ) {
                        $url = get_edit_post_link( $draft->ID );
                        $title = _draft_or_post_title( $draft->ID );
-                       $item = "<h4><a href='$url' title='" . sprintf( __( 'Edit "%s"' ), attribute_escape( $title ) ) . "'>$title</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
+                       $item = "<h4><a href='$url' title='" . sprintf( __( 'Edit &#8220;%s&#8221;' ), esc_attr( $title ) ) . "'>$title</a> <abbr title='" . get_the_time(__('Y/m/d g:i:s A'), $draft) . "'>" . get_the_time( get_option( 'date_format' ), $draft ) . '</abbr></h4>';
                        if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
                                $item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '&hellip;' : '' ) . '</p>';
                        $list[] = $item;
                        if ( $the_content = preg_split( '#\s#', strip_tags( $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
                                $item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '&hellip;' : '' ) . '</p>';
                        $list[] = $item;
@@ -480,14 +523,14 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
        $GLOBALS['comment'] =& $comment;
 
        $comment_post_url = get_edit_post_link( $comment->comment_post_ID );
        $GLOBALS['comment'] =& $comment;
 
        $comment_post_url = get_edit_post_link( $comment->comment_post_ID );
-       $comment_post_title = get_the_title( $comment->comment_post_ID );
+       $comment_post_title = strip_tags(get_the_title( $comment->comment_post_ID ));
        $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
        $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
-       $comment_link = '<a class="comment-link" href="' . get_comment_link() . '">#</a>';
+       $comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
 
 
-       $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
-       $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
-       $unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
-       $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
+       $delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
+       $approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
+       $unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
+       $spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
 
        $actions = array();
 
 
        $actions = array();
 
@@ -498,7 +541,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
                //$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
                $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
                //$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
                $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
-               $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . _c( 'Spam|verb' ) . '</a>';
+               $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */  _x( 'Spam', 'verb' ) . '</a>';
                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
 
                $actions = apply_filters( 'comment_row_actions', $actions, $comment );
                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
 
                $actions = apply_filters( 'comment_row_actions', $actions, $comment );
@@ -522,6 +565,8 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
                        <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
 
                        <?php echo get_avatar( $comment, 50 ); ?>
                        <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
 
                        <?php echo get_avatar( $comment, 50 ); ?>
+
+                       <div class="dashboard-comment-wrap">
                        <h4 class="comment-meta"><?php printf( __( 'From %1$s on %2$s%3$s' ), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link." ".$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?></h4>
 
                        <?php
                        <h4 class="comment-meta"><?php printf( __( 'From %1$s on %2$s%3$s' ), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link." ".$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?></h4>
 
                        <?php
@@ -536,10 +581,11 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
                                default :
                                        $type = ucwords( $comment->comment_type );
                                endswitch;
                                default :
                                        $type = ucwords( $comment->comment_type );
                                endswitch;
-                               $type = wp_specialchars( $type );
+                               $type = esc_html( $type );
                        ?>
                        ?>
-
-                       <h4 class="comment-meta"><?php printf( __( '%1$s on %2$s' ), "<strong>$type</strong>", $comment_post_link ); ?></h4>
+                       <div class="dashboard-comment-wrap">
+                       <?php /* translators: %1$s is type of comment, %2$s is link to the post */ ?>
+                       <h4 class="comment-meta"><?php printf( _x( '%1$s on %2$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link ); ?></h4>
                        <p class="comment-author"><?php comment_author_link(); ?></p>
 
                        <?php endif; // comment_type ?>
                        <p class="comment-author"><?php comment_author_link(); ?></p>
 
                        <?php endif; // comment_type ?>
@@ -548,12 +594,12 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
 
                        <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
                                <textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
 
                        <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
                                <textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
-                               <div class="author-email"><?php echo attribute_escape( $comment->comment_author_email ); ?></div>
-                               <div class="author"><?php echo attribute_escape( $comment->comment_author ); ?></div>
-                               <div class="author-url"><?php echo attribute_escape( $comment->comment_author_url ); ?></div>
+                               <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
+                               <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
+                               <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
                                <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
                        </div>
                                <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
                        </div>
-
+                       </div>
                </div>
 <?php
 }
                </div>
 <?php
 }
@@ -570,60 +616,67 @@ function wp_dashboard_incoming_links() {
 function wp_dashboard_incoming_links_output() {
        $widgets = get_option( 'dashboard_widget_options' );
        @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
 function wp_dashboard_incoming_links_output() {
        $widgets = get_option( 'dashboard_widget_options' );
        @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
-       $rss = @fetch_rss( $url );
-       if ( isset($rss->items) && 0 < count($rss->items) )  {
-
-               echo "<ul>\n";
-
-               $rss->items = array_slice($rss->items, 0, $items);
-               foreach ( $rss->items as $item ) {
-                       $publisher = '';
-                       $site_link = '';
-                       $link = '';
-                       $content = '';
-                       $date = '';
-                       $link = clean_url( strip_tags( $item['link'] ) );
-
-                       if ( isset( $item['author_uri'] ) )
-                               $site_link = clean_url( strip_tags( $item['author_uri'] ) );
-
-                       if ( !$publisher = wp_specialchars( strip_tags( isset($item['dc']['publisher']) ? $item['dc']['publisher'] : $item['author_name'] ) ) )
-                               $publisher = __( 'Somebody' );
-                       if ( $site_link )
-                               $publisher = "<a href='$site_link'>$publisher</a>";
-                       else
-                               $publisher = "<strong>$publisher</strong>";
-
-                       if ( isset($item['description']) )
-                               $content = $item['description'];
-                       elseif ( isset($item['summary']) )
-                               $content = $item['summary'];
-                       elseif ( isset($item['atom_content']) )
-                               $content = $item['atom_content'];
-                       else
-                               $content = __( 'something' );
-                       $content = wp_html_excerpt($content, 50) . ' ...';
-                       if ( $link )
-                               $text = _c( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"|feed_display' );
-                       else
-                               $text = _c( '%1$s linked here saying, "%3$s"|feed_display' );
-
-                       if ( $show_date ) {
-                               if ( $show_author || $show_summary )
-                                       $text .= _c( ' on %4$s|feed_display' );
-                               $date = wp_specialchars( strip_tags( isset($item['pubdate']) ? $item['pubdate'] : $item['published'] ) );
-                               $date = strtotime( $date );
-                               $date = gmdate( get_option( 'date_format' ), $date );
-                       }
+       $rss = fetch_feed( $url );
 
 
-                       echo "\t<li>" . sprintf( _c( "$text|feed_display" ), $publisher, $link, $content, $date ) . "</li>\n";
+       if ( is_wp_error($rss) ) {
+               if ( is_admin() || current_user_can('manage_options') ) {
+                       echo '<p>';
+                       printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
+                       echo '</p>';
                }
                }
+               return;
+       }
 
 
-               echo "</ul>\n";
-
-       } else {
+       if ( !$rss->get_item_quantity() ) {
                echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
                echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
+               return;
+       }
+
+       echo "<ul>\n";
+
+       $count = 0;
+       foreach ( $rss->get_items() as $item ) {
+               $publisher = '';
+               $site_link = '';
+               $link = '';
+               $content = '';
+               $date = '';
+               $link = esc_url( strip_tags( $item->get_link() ) );
+
+               $author = $item->get_author();
+               $site_link = esc_url( strip_tags( $author->get_link() ) );
+
+               if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) )
+                       $publisher = __( 'Somebody' );
+               if ( $site_link )
+                       $publisher = "<a href='$site_link'>$publisher</a>";
+               else
+                       $publisher = "<strong>$publisher</strong>";
+
+               $content = $item->get_content();
+               $content = wp_html_excerpt($content, 50) . ' ...';
+
+               if ( $link )
+                       /* translators: incoming links feed, %1$s is other person, %3$s is content */
+                       $text = __( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"' );
+               else
+                       /* translators: incoming links feed, %1$s is other person, %3$s is content */
+                       $text = __( '%1$s linked here saying, "%3$s"' );
+
+               if ( $show_date ) {
+                       if ( $show_author || $show_summary )
+                               /* translators: incoming links feed, %4$s is the date */
+                               $text .= ' ' . __( 'on %4$s' );
+                       $date = esc_html( strip_tags( $item->get_date() ) );
+                       $date = strtotime( $date );
+                       $date = gmdate( get_option( 'date_format' ), $date );
+               }
+
+               echo "\t<li>" . sprintf( $text, $publisher, $link, $content, $date ) . "</li>\n";
        }
        }
+
+       echo "</ul>\n";
+
 }
 
 function wp_dashboard_incoming_links_control() {
 }
 
 function wp_dashboard_incoming_links_control() {
@@ -670,24 +723,21 @@ function wp_dashboard_secondary_control() {
 function wp_dashboard_secondary_output() {
        $widgets = get_option( 'dashboard_widget_options' );
        @extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
 function wp_dashboard_secondary_output() {
        $widgets = get_option( 'dashboard_widget_options' );
        @extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
-       $rss = @fetch_rss( $url );
-
-       if ( !isset($rss->items) || 0 == count($rss->items) )
-               return false;
-
-       $rss->items = array_slice($rss->items, 0, $items);
+       $rss = @fetch_feed( $url );
 
 
-       if ( 'http://planet.wordpress.org/' == $rss->channel['link'] ) {
-               foreach ( array_keys($rss->items) as $i ) {
-                       list($site, $description) = explode( ':', wp_specialchars($rss->items[$i]['title']), 2 );
-                       $rss->items[$i]['dc']['creator'] = trim($site);
-                       $rss->items[$i]['title'] = trim($description);
+       if ( is_wp_error($rss) ) {
+               if ( is_admin() || current_user_can('manage_options') ) {
+                       echo '<div class="rss-widget"><p>';
+                       printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
+                       echo '</p></div>';
                }
                }
+       } elseif ( !$rss->get_item_quantity() ) {
+               return false;
+       } else {
+               echo '<div class="rss-widget">';
+               wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
+               echo '</div>';
        }
        }
-
-       echo "<div class='rss-widget'>";
-       wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
-       echo "</div>";
 }
 
 function wp_dashboard_plugins() {
 }
 
 function wp_dashboard_plugins() {
@@ -704,42 +754,68 @@ function wp_dashboard_plugins() {
  * @since unknown
  */
 function wp_dashboard_plugins_output() {
  * @since unknown
  */
 function wp_dashboard_plugins_output() {
-       $popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
-       $new     = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
-       $updated = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
+       $popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
+       $new     = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
+       $updated = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
+
+       if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
+               $plugin_slugs = array_keys( get_plugins() );
+               set_transient( 'plugin_slugs', $plugin_slugs, 86400 );
+       }
 
        foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) {
 
        foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) {
-               if ( !isset($$feed->items) || 0 == count($$feed->items) )
+               if ( is_wp_error($$feed) || !$$feed->get_item_quantity() )
                        continue;
 
                        continue;
 
-               $$feed->items = array_slice($$feed->items, 0, 5);
-               $item_key = array_rand($$feed->items);
+               $items = $$feed->get_items(0, 5);
+
+               // Pick a random, non-installed plugin
+               while ( true ) {
+                       // Abort this foreach loop iteration if there's no plugins left of this type
+                       if ( 0 == count($items) )
+                               continue 2;
+
+                       $item_key = array_rand($items);
+                       $item = $items[$item_key];
+
+                       list($link, $frag) = explode( '#', $item->get_link() );
+
+                       $link = esc_url($link);
+                       if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
+                               $slug = $matches[1];
+                       else {
+                               unset( $items[$item_key] );
+                               continue;
+                       }
+
+                       // Is this random plugin's slug already installed? If so, try again.
+                       reset( $plugin_slugs );
+                       foreach ( $plugin_slugs as $plugin_slug ) {
+                               if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
+                                       unset( $items[$item_key] );
+                                       continue 2;
+                               }
+                       }
+
+                       // If we get to this point, then the random plugin isn't installed and we can stop the while().
+                       break;
+               }
 
                // Eliminate some common badly formed plugin descriptions
 
                // Eliminate some common badly formed plugin descriptions
-               while ( ( null !== $item_key = array_rand($$feed->items) ) && false !== strpos( $$feed->items[$item_key]['description'], 'Plugin Name:' ) )
-                       unset($$feed->items[$item_key]);
+               while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
+                       unset($items[$item_key]);
 
 
-               if ( !isset($$feed->items[$item_key]) )
+               if ( !isset($items[$item_key]) )
                        continue;
 
                        continue;
 
-               $item = $$feed->items[$item_key];
-
                // current bbPress feed item titles are: user on "topic title"
                // current bbPress feed item titles are: user on "topic title"
-               if ( preg_match( '/"(.*)"/s', $item['title'], $matches ) )
+               if ( preg_match( '/&quot;(.*)&quot;/s', $item->get_title(), $matches ) )
                        $title = $matches[1];
                else // but let's make it forward compatible if things change
                        $title = $matches[1];
                else // but let's make it forward compatible if things change
-                       $title = $item['title'];
-               $title = wp_specialchars( $title );
-
-               $description = wp_specialchars( strip_tags(html_entity_decode($item['description'], ENT_QUOTES)) );
+                       $title = $item->get_title();
+               $title = esc_html( $title );
 
 
-               list($link, $frag) = explode( '#', $item['link'] );
-
-               $link = clean_url($link);
-               if( preg_match('|/([^/]+?)/?$|', $link, $matches) )
-                       $slug = $matches[1];
-               else
-                       $slug = '';
+               $description = esc_html( strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))) );
 
                $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) .
                                                        '&amp;TB_iframe=true&amp;width=600&amp;height=800';
 
                $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) .
                                                        '&amp;TB_iframe=true&amp;width=600&amp;height=800';
@@ -777,15 +853,10 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
                $check_urls = array( $widgets[$widget_id]['url'] );
        }
 
                $check_urls = array( $widgets[$widget_id]['url'] );
        }
 
-
-       require_once( ABSPATH . WPINC . '/rss.php' );
-       init(); // initialize rss constants
-
-       $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
-
+       include_once ABSPATH . WPINC . '/class-feed.php';
        foreach ( $check_urls as $check_url ) {
        foreach ( $check_urls as $check_url ) {
-               $status = $cache->check_cache( $check_url );
-               if ( 'HIT' !== $status ) {
+               $cache = new WP_Feed_Cache_Transient('', md5($check_url), '');
+               if ( ! $cache->load() ) {
                        echo $loading;
                        return false;
                }
                        echo $loading;
                        return false;
                }
@@ -844,9 +915,11 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
                $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
                // title is optional.  If black, fill it if possible
                if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
                $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
                // title is optional.  If black, fill it if possible
                if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
-                       require_once(ABSPATH . WPINC . '/rss.php');
-                       $rss = fetch_rss($widget_options[$widget_id]['url']);
-                       $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->channel['title']));
+                       $rss = fetch_feed($widget_options[$widget_id]['url']);
+                       if ( ! is_wp_error($rss) )
+                               $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
+                       else
+                               $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
                }
                update_option( 'dashboard_widget_options', $widget_options );
        }
                }
                update_option( 'dashboard_widget_options', $widget_options );
        }
index 4905b975447f74eb7370a6866922d870ea82fc26..641e173881afd28946b892061964bbd208b8d1d7 100644 (file)
@@ -99,7 +99,7 @@ function wxr_cdata($str) {
        if ( seems_utf8($str) == false )
                $str = utf8_encode($str);
 
        if ( seems_utf8($str) == false )
                $str = utf8_encode($str);
 
-       // $str = ent2ncr(wp_specialchars($str));
+       // $str = ent2ncr(esc_html($str));
 
        $str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
 
 
        $str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
 
index cddfaa92f75759572f618933ee28eee07a90f569..77baecd2a2fa22ffc9da9204d77a7af279979300 100644 (file)
@@ -52,7 +52,7 @@ function get_file_description( $file ) {
        elseif ( file_exists( WP_CONTENT_DIR . $file ) && is_file( WP_CONTENT_DIR . $file ) ) {
                $template_data = implode( '', file( WP_CONTENT_DIR . $file ) );
                if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
        elseif ( file_exists( WP_CONTENT_DIR . $file ) && is_file( WP_CONTENT_DIR . $file ) ) {
                $template_data = implode( '', file( WP_CONTENT_DIR . $file ) );
                if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
-                       return $name[1] . ' Page Template';
+                       return _cleanup_header_comment($name[1]) . ' Page Template';
        }
 
        return basename( $file );
        }
 
        return basename( $file );
@@ -67,11 +67,12 @@ function get_file_description( $file ) {
  */
 function get_home_path() {
        $home = get_option( 'home' );
  */
 function get_home_path() {
        $home = get_option( 'home' );
-       if ( $home != '' && $home != get_option( 'siteurl' ) ) {
-               $home_path = parse_url( $home );
-               $home_path = $home_path['path'];
-               $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
-               $home_path = trailingslashit( $root.$home_path );
+       $siteurl = get_option( 'siteurl' );
+       if ( $home != '' && $home != $siteurl ) {
+               $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */
+               $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home);
+               $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos);
+               $home_path = trailingslashit( $home_path );
        } else {
                $home_path = ABSPATH;
        }
        } else {
                $home_path = ABSPATH;
        }
@@ -194,7 +195,7 @@ function validate_file_to_edit( $file, $allowed_files = '' ) {
 
        switch ( $code ) {
                case 1 :
 
        switch ( $code ) {
                case 1 :
-                       wp_die( __('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));
+                       wp_die( __('Sorry, can&#8217;t edit files with &#8220;..&#8221; in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.' ));
 
                case 2 :
                        wp_die( __('Sorry, can&#8217;t call files with their real path.' ));
 
                case 2 :
                        wp_die( __('Sorry, can&#8217;t call files with their real path.' ));
@@ -238,7 +239,8 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
                __( "No file was uploaded." ),
                '',
                __( "Missing a temporary folder." ),
                __( "No file was uploaded." ),
                '',
                __( "Missing a temporary folder." ),
-               __( "Failed to write file to disk." ));
+               __( "Failed to write file to disk." ),
+               __( "File upload stopped by extension." ));
 
        // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
        $test_form = true;
 
        // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
        $test_form = true;
@@ -282,6 +284,8 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
 
                if ( !$type )
                        $type = $file['type'];
 
                if ( !$type )
                        $type = $file['type'];
+       } else {
+               $type = '';
        }
 
        // A writable uploads dir will pass this test. Again, there's no point overriding this one.
        }
 
        // A writable uploads dir will pass this test. Again, there's no point overriding this one.
@@ -304,9 +308,7 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
        // Compute the URL
        $url = $uploads['url'] . "/$filename";
 
        // Compute the URL
        $url = $uploads['url'] . "/$filename";
 
-       $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
-
-       return $return;
+       return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
 }
 
 /**
 }
 
 /**
@@ -339,12 +341,14 @@ function wp_handle_sideload( &$file, $overrides = false ) {
 
        // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
        $upload_error_strings = array( false,
 
        // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
        $upload_error_strings = array( false,
-               __( "The file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
-               __( "The file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
-               __( "The file was only partially uploaded." ),
-               __( "No file was sent." ),
+               __( "The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
+               __( "The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
+               __( "The uploaded file was only partially uploaded." ),
+               __( "No file was uploaded." ),
+               '',
                __( "Missing a temporary folder." ),
                __( "Missing a temporary folder." ),
-               __( "Failed to write file to disk." ));
+               __( "Failed to write file to disk." ),
+               __( "File upload stopped by extension." ));
 
        // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
        $test_form = true;
 
        // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
        $test_form = true;
@@ -579,26 +583,28 @@ function copy_dir($from, $to) {
  * @param unknown_type $args
  * @return unknown
  */
  * @param unknown_type $args
  * @return unknown
  */
-function WP_Filesystem( $args = false ) {
+function WP_Filesystem( $args = false, $context = false ) {
        global $wp_filesystem;
 
        require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
 
        global $wp_filesystem;
 
        require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
 
-       $method = get_filesystem_method($args);
+       $method = get_filesystem_method($args, $context);
 
        if ( ! $method )
                return false;
 
 
        if ( ! $method )
                return false;
 
-       $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
-       if( ! file_exists($abstraction_file) )
-               return;
-
-       require_once($abstraction_file);
+       if ( ! class_exists("WP_Filesystem_$method") ) {
+               $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
+               if( ! file_exists($abstraction_file) )
+                       return;
+       
+               require_once($abstraction_file);
+       }
        $method = "WP_Filesystem_$method";
 
        $wp_filesystem = new $method($args);
 
        $method = "WP_Filesystem_$method";
 
        $wp_filesystem = new $method($args);
 
-       if ( $wp_filesystem->errors->get_error_code() )
+       if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
                return false;
 
        if ( !$wp_filesystem->connect() )
                return false;
 
        if ( !$wp_filesystem->connect() )
@@ -619,21 +625,30 @@ function WP_Filesystem( $args = false ) {
  * @since unknown
  *
  * @param unknown_type $args
  * @since unknown
  *
  * @param unknown_type $args
+ * @param string $context Full path to the directory that is tested for being writable.
  * @return unknown
  */
  * @return unknown
  */
-function get_filesystem_method($args = array()) {
-       $method = false;
-       if( function_exists('getmyuid') && function_exists('fileowner') ){
-               $temp_file = wp_tempnam();
-               if ( getmyuid() == fileowner($temp_file) )
-                       $method = 'direct';
-               unlink($temp_file);
-       }
+function get_filesystem_method($args = array(), $context = false) {
+       $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets'
+
+       if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
+               if ( !$context )
+                       $context = WP_CONTENT_DIR;
+               $context = trailingslashit($context);
+               $temp_file_name = $context . '.write-test-' . time();
+               $temp_handle = @fopen($temp_file_name, 'w');
+               if ( $temp_handle ) {
+                       if ( getmyuid() == fileowner($temp_file_name) )
+                               $method = 'direct';
+                       @fclose($temp_handle);
+                       unlink($temp_file_name);
+               }
+       }
 
 
-       if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') ) $method = 'ssh2';
+       if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2';
        if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
        if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
        if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
        if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
-       return apply_filters('filesystem_method', $method);
+       return apply_filters('filesystem_method', $method, $args);
 }
 
 /**
 }
 
 /**
@@ -646,26 +661,27 @@ function get_filesystem_method($args = array()) {
  * @param unknown_type $error
  * @return unknown
  */
  * @param unknown_type $error
  * @return unknown
  */
-function request_filesystem_credentials($form_post, $type = '', $error = false) {
-       $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
+function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) {
+       $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context);
        if ( '' !== $req_cred )
                return $req_cred;
 
        if ( empty($type) )
        if ( '' !== $req_cred )
                return $req_cred;
 
        if ( empty($type) )
-               $type = get_filesystem_method();
+               $type = get_filesystem_method(array(), $context);
 
        if ( 'direct' == $type )
                return true;
 
 
        if ( 'direct' == $type )
                return true;
 
-       $credentials = get_option('ftp_credentials', array());
+       $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => ''));
+
        // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
        // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
-       $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']);
+       $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : '');
 
        // Check to see if we are setting the public/private keys for ssh
 
        // Check to see if we are setting the public/private keys for ssh
-       $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : $credentials['public_key']);
-       $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : $credentials['private_key']);
+       $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : '');
+       $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : '');
 
        //sanitize the hostname, Some people might pass in odd-data:
        $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
 
        //sanitize the hostname, Some people might pass in odd-data:
        $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
@@ -675,14 +691,20 @@ function request_filesystem_credentials($form_post, $type = '', $error = false)
        else
                unset($credentials['port']);
 
        else
                unset($credentials['port']);
 
-       if ( defined('FTP_SSH') || (isset($_POST['connection_type']) && 'ssh' == $_POST['connection_type']) )
+       if ( defined('FTP_SSH') || (defined('FS_METHOD') && 'ssh' == FS_METHOD) )
                $credentials['connection_type'] = 'ssh';
                $credentials['connection_type'] = 'ssh';
-       else if ( defined('FTP_SSL') || (isset($_POST['connection_type']) && 'ftps' == $_POST['connection_type']) )
+       else if ( defined('FTP_SSL') && 'ftpext' == $type ) //Only the FTP Extension understands SSL
                $credentials['connection_type'] = 'ftps';
                $credentials['connection_type'] = 'ftps';
-       else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) )
+       else if ( !empty($_POST['connection_type']) )
+               $credentials['connection_type'] = $_POST['connection_type'];
+       else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP
                $credentials['connection_type'] = 'ftp';
 
                $credentials['connection_type'] = 'ftp';
 
-       if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {
+       if ( ! $error &&
+                       (
+                               ( !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) ||
+                               ( 'ssh' == $credentials['connection_type'] && !empty($credentials['public_key']) && !empty($credentials['private_key']) )
+                       ) ) {
                $stored_credentials = $credentials;
                if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code.
                        $stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
                $stored_credentials = $credentials;
                if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code.
                        $stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
@@ -713,60 +735,68 @@ jQuery(function($){
        jQuery("#ftp, #ftps").click(function () {
                jQuery("#ssh_keys").hide();
        });
        jQuery("#ftp, #ftps").click(function () {
                jQuery("#ssh_keys").hide();
        });
+       jQuery('form input[value=""]:first').focus();
 });
 -->
 </script>
 <form action="<?php echo $form_post ?>" method="post">
 <div class="wrap">
 });
 -->
 </script>
 <form action="<?php echo $form_post ?>" method="post">
 <div class="wrap">
+<?php screen_icon(); ?>
 <h2><?php _e('Connection Information') ?></h2>
 <p><?php _e('To perform the requested action, connection information is required.') ?></p>
 
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
 <h2><?php _e('Connection Information') ?></h2>
 <p><?php _e('To perform the requested action, connection information is required.') ?></p>
 
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
-<td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
+<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
 </tr>
 
 <tr valign="top">
 <th scope="row"><label for="username"><?php _e('Username') ?></label></th>
 </tr>
 
 <tr valign="top">
 <th scope="row"><label for="username"><?php _e('Username') ?></label></th>
-<td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
+<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
 </tr>
 
 <tr valign="top">
 <th scope="row"><label for="password"><?php _e('Password') ?></label></th>
 </tr>
 
 <tr valign="top">
 <th scope="row"><label for="password"><?php _e('Password') ?></label></th>
-<td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td>
+<td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td>
 </tr>
 
 </tr>
 
+<?php if ( extension_loaded('ssh2') ) : ?>
 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
 <th scope="row"><?php _e('Authentication Keys') ?>
 <div class="key-labels textright">
 <label for="public_key"><?php _e('Public Key:') ?></label ><br />
 <label for="private_key"><?php _e('Private Key:') ?></label>
 </div></th>
 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
 <th scope="row"><?php _e('Authentication Keys') ?>
 <div class="key-labels textright">
 <label for="public_key"><?php _e('Public Key:') ?></label ><br />
 <label for="private_key"><?php _e('Private Key:') ?></label>
 </div></th>
-<td><br /><input name="public_key" type="text" id="public_key" value=""<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value=""<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
+<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
 <div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
 </tr>
 <div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
 </tr>
+<?php endif; ?>
 
 <tr valign="top">
 <th scope="row"><?php _e('Connection Type') ?></th>
 <td>
 
 <tr valign="top">
 <th scope="row"><?php _e('Connection Type') ?></th>
 <td>
-<fieldset><legend class="hidden"><?php _e('Connection Type') ?></legend>
-<label><input id="ftp" name="connection_type"  type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label><br />
-<label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSH') || defined('FTP_SSH') ) echo ' disabled="disabled"';  ?>/> <?php _e('FTPS (SSL)') ?></label><br />
-<?php if ( extension_loaded('ssh2') ) { ?><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type);  if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label><?php } ?>
+<fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend>
+<label><input id="ftp" name="connection_type"  type="radio" value="ftp" <?php checked('ftp', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('FTP') ?></label>
+<?php if ( 'ftpext' == $type ) : ?>
+<br /><label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"';  ?>/> <?php _e('FTPS (SSL)') ?></label>
+<?php endif; ?>
+<?php if ( extension_loaded('ssh2') ) : ?>
+<br /><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type);  if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label>
+<?php endif; ?>
 </fieldset>
 </td>
 </tr>
 </table>
 
 <?php if ( isset( $_POST['version'] ) ) : ?>
 </fieldset>
 </td>
 </tr>
 </table>
 
 <?php if ( isset( $_POST['version'] ) ) : ?>
-<input type="hidden" name="version" value="<?php echo attribute_escape($_POST['version']) ?>" />
+<input type="hidden" name="version" value="<?php echo esc_attr($_POST['version']) ?>" />
 <?php endif; ?>
 <?php if ( isset( $_POST['locale'] ) ) : ?>
 <?php endif; ?>
 <?php if ( isset( $_POST['locale'] ) ) : ?>
-<input type="hidden" name="locale" value="<?php echo attribute_escape($_POST['locale']) ?>" />
+<input type="hidden" name="locale" value="<?php echo esc_attr($_POST['locale']) ?>" />
 <?php endif; ?>
 <p class="submit">
 <?php endif; ?>
 <p class="submit">
-<input id="upgrade" name="upgrade" type="submit" class="button" value="<?php _e('Proceed'); ?>" />
+<input id="upgrade" name="upgrade" type="submit" class="button" value="<?php esc_attr_e('Proceed'); ?>" />
 </p>
 </div>
 </form>
 </p>
 </div>
 </form>
index 8069b97784a578aa0f536f73b4585bb11ac0eb49..c0632ac5c2d2ad4f6eb9e36421ff48dce81891c8 100644 (file)
@@ -68,7 +68,7 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_
 
        $dst_file = preg_replace( '/\\.[^\\.]+$/', '.jpg', $dst_file );
 
 
        $dst_file = preg_replace( '/\\.[^\\.]+$/', '.jpg', $dst_file );
 
-       if ( imagejpeg( $dst, $dst_file ) )
+       if ( imagejpeg( $dst, $dst_file, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) )
                return $dst_file;
        else
                return false;
                return $dst_file;
        else
                return false;
@@ -137,7 +137,7 @@ function wp_load_image( $file ) {
                $file = get_attached_file( $file );
 
        if ( ! file_exists( $file ) )
                $file = get_attached_file( $file );
 
        if ( ! file_exists( $file ) )
-               return sprintf(__("File '%s' doesn't exist?"), $file);
+               return sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);
 
        if ( ! function_exists('imagecreatefromstring') )
                return __('The GD image library is not installed.');
 
        if ( ! function_exists('imagecreatefromstring') )
                return __('The GD image library is not installed.');
@@ -147,7 +147,7 @@ function wp_load_image( $file ) {
        $image = imagecreatefromstring( file_get_contents( $file ) );
 
        if ( !is_resource( $image ) )
        $image = imagecreatefromstring( file_get_contents( $file ) );
 
        if ( !is_resource( $image ) )
-               return sprintf(__("File '%s' is not an image."), $file);
+               return sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);
 
        return $image;
 }
 
        return $image;
 }
index c9cd71cb580920b44d9ad39bd14a529125ada973..820ee540e9daeedb45c21a67f2ea61bf07d604f8 100644 (file)
@@ -60,7 +60,7 @@ function wp_import_cleanup( $id ) {
  */
 function wp_import_handle_upload() {
        $overrides = array( 'test_form' => false, 'test_type' => false );
  */
 function wp_import_handle_upload() {
        $overrides = array( 'test_form' => false, 'test_type' => false );
-       $_FILES['import']['name'] .= '.import';
+       $_FILES['import']['name'] .= '.txt';
        $file = wp_handle_upload( $_FILES['import'], $overrides );
 
        if ( isset( $file['error'] ) )
        $file = wp_handle_upload( $_FILES['import'], $overrides );
 
        if ( isset( $file['error'] ) )
diff --git a/wp-admin/includes/manifest.php b/wp-admin/includes/manifest.php
new file mode 100644 (file)
index 0000000..bdff9fd
--- /dev/null
@@ -0,0 +1,209 @@
+<?php
+
+if ( !defined('ABSPATH') )
+       exit;
+
+require(ABSPATH . 'wp-includes/version.php');
+
+$man_version = md5( $tinymce_version . $manifest_version );
+$mce_ver = "ver=$tinymce_version";
+
+/**
+ * Retrieve list of all cacheable WP files
+ *
+ * Array format: file, version (optional), bool (whether to use src and set ignoreQuery)
+ */
+function &get_manifest() {
+       global $mce_ver;
+
+       $files = array(
+               array('images/align-center.png'),
+               array('images/align-left.png'),
+               array('images/align-none.png'),
+               array('images/align-right.png'),
+               array('images/archive-link.png'),
+               array('images/blue-grad.png'),
+               array('images/browse-happy.gif'),
+               array('images/bubble_bg.gif'),
+               array('images/bubble_bg-rtl.gif'),
+               array('images/button-grad.png'),
+               array('images/button-grad-active.png'),
+               array('images/comment-grey-bubble.png'),
+               array('images/date-button.gif'),
+               array('images/ed-bg.gif'),
+               array('images/fade-butt.png'),
+               array('images/fav.png'),
+               array('images/fav-arrow.gif'),
+               array('images/fav-arrow-rtl.gif'),
+               array('images/fav-top.png'),
+               array('images/generic.png'),
+               array('images/gray-grad.png'),
+               array('images/icons32.png'),
+               array('images/icons32-vs.png'),
+               array('images/list.png'),
+               array('images/list-vs.png'),
+               array('images/wpspin_light.gif'),
+               array('images/wpspin_dark.gif'),
+               array('images/logo.gif'),
+               array('images/logo-ghost.png'),
+               array('images/logo-login.gif'),
+               array('images/media-button-image.gif'),
+               array('images/media-button-music.gif'),
+               array('images/media-button-other.gif'),
+               array('images/media-button-video.gif'),
+               array('images/menu.png'),
+               array('images/menu-vs.png'),
+               array('images/menu-arrows.gif'),
+               array('images/menu-bits.gif'),
+               array('images/menu-bits-rtl.gif'),
+               array('images/menu-dark.gif'),
+               array('images/menu-dark-rtl.gif'),
+               array('images/no.png'),
+               array('images/required.gif'),
+               array('images/resize.gif'),
+               array('images/screen-options-left.gif'),
+               array('images/screen-options-right.gif'),
+               array('images/screen-options-right-up.gif'),
+               array('images/se.png'),
+               array('images/star.gif'),
+               array('images/toggle-arrow.gif'),
+               array('images/toggle-arrow-rtl.gif'),
+               array('images/white-grad.png'),
+               array('images/white-grad-active.png'),
+               array('images/wordpress-logo.png'),
+               array('images/wp-logo.gif'),
+               array('images/xit.gif'),
+               array('images/yes.png'),
+               array('../wp-includes/images/crystal/archive.png'),
+               array('../wp-includes/images/crystal/audio.png'),
+               array('../wp-includes/images/crystal/code.png'),
+               array('../wp-includes/images/crystal/default.png'),
+               array('../wp-includes/images/crystal/document.png'),
+               array('../wp-includes/images/crystal/interactive.png'),
+               array('../wp-includes/images/crystal/text.png'),
+               array('../wp-includes/images/crystal/video.png'),
+               array('../wp-includes/images/crystal/spreadsheet.png'),
+               array('../wp-includes/images/rss.png'),
+               array('../wp-includes/images/blank.gif'),
+               array('../wp-includes/images/upload.png'),
+               array('../wp-includes/js/thickbox/loadingAnimation.gif'),
+               array('../wp-includes/js/thickbox/tb-close.png'),
+       );
+
+       if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) :
+       $mce = array(
+               array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=1&' . $mce_ver, true),
+               array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=0&' . $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/tiny_mce.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/langs/wp-langs-en.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/utils/mctabs.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/utils/validate.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/utils/form_utils.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/utils/editable_selects.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/tiny_mce_popup.js', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/themes/advanced/editor_template.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/source_editor.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/anchor.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/image.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/link.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/color_picker.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/charmap.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/js/color_picker.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/js/charmap.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/js/image.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/js/link.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/js/source_editor.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/js/anchor.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css', $mce_ver, true),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/template.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/media/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/media/js/media.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/media/media.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/media/css/content.css', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/media/css/media.css', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/paste/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/paste/js/pasteword.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/paste/js/pastetext.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/paste/pasteword.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/paste/blank.htm', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/paste/pastetext.htm', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/safari/editor_plugin.js', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/spellchecker/css/content.css', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/wordpress/css/content.css', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css', $mce_ver, true),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js', $mce_ver, true),
+
+               array('../wp-includes/js/tinymce/themes/advanced/img/icons.gif'),
+               array('../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg'),
+               array('../wp-includes/js/tinymce/themes/advanced/img/fm.gif'),
+               array('../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png'),
+               array('../wp-includes/js/tinymce/themes/advanced/img/sflogo.png'),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png'),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png'),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif'),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif'),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif'),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif'),
+               array('../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif'),
+               array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif'),
+               array('../wp-includes/js/tinymce/plugins/media/img/flash.gif'),
+               array('../wp-includes/js/tinymce/plugins/media/img/flv_player.swf'),
+               array('../wp-includes/js/tinymce/plugins/media/img/quicktime.gif'),
+               array('../wp-includes/js/tinymce/plugins/media/img/realmedia.gif'),
+               array('../wp-includes/js/tinymce/plugins/media/img/shockwave.gif'),
+               array('../wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif'),
+               array('../wp-includes/js/tinymce/plugins/media/img/trans.gif'),
+               array('../wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/more.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/page.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/help.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/image.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/media.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/video.gif'),
+               array('../wp-includes/js/tinymce/plugins/wordpress/img/audio.gif'),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png'),
+               array('../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png'),
+               array('../wp-includes/js/tinymce/plugins/wpgallery/img/delete.png'),
+               array('../wp-includes/js/tinymce/plugins/wpgallery/img/edit.png'),
+               array('../wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png')
+       );
+       $files = array_merge($files, $mce);
+       endif;
+
+       return $files;
+}
index 57e032ea9c1555f5b7fb40d0089f96c3be1df82d..ab7cc58b143fbe88d9271718c0037482f3b6472f 100644 (file)
@@ -69,17 +69,16 @@ function the_media_upload_tabs() {
                        $current = $redir_tab;
                elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
                        $current = $_GET['tab'];
                        $current = $redir_tab;
                elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
                        $current = $_GET['tab'];
-               else {
-                       $keys = array_keys($tabs);
-                       $current = array_shift($keys);
-               }
+               else
+                       $current = apply_filters('media_upload_default_tab', 'type');
+
                foreach ( $tabs as $callback => $text ) {
                        $class = '';
                        if ( $current == $callback )
                                $class = " class='current'";
                        $href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
                foreach ( $tabs as $callback => $text ) {
                        $class = '';
                        if ( $current == $callback )
                                $class = " class='current'";
                        $href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
-                       $link = "<a href='" . clean_url($href) . "'$class>$text</a>";
-                       echo "\t<li id='" . attribute_escape("tab-$callback") . "'>$link</li>\n";
+                       $link = "<a href='" . esc_url($href) . "'$class>$text</a>";
+                       echo "\t<li id='" . esc_attr("tab-$callback") . "'>$link</li>\n";
                }
                echo "</ul>\n";
        }
                }
                echo "</ul>\n";
        }
@@ -105,10 +104,10 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
 
        $html = get_image_tag($id, $htmlalt, $title, $align, $size);
 
 
        $html = get_image_tag($id, $htmlalt, $title, $align, $size);
 
-       $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
+       $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : '';
 
        if ( $url )
 
        if ( $url )
-               $html = '<a href="' . clean_url($url) . "\"$rel>$html</a>";
+               $html = '<a href="' . esc_url($url) . "\"$rel>$html</a>";
 
        $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
 
 
        $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
 
@@ -131,15 +130,20 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
  */
 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
 
  */
 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
 
-       if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
+       if ( empty($alt) || apply_filters( 'disable_captions', '' ) )
+               return $html;
+
        $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
 
        preg_match( '/width="([0-9]+)/', $html, $matches );
        $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
 
        preg_match( '/width="([0-9]+)/', $html, $matches );
-       if ( ! isset($matches[1]) ) return $html;
+       if ( ! isset($matches[1]) )
+               return $html;
+
        $width = $matches[1];
 
        $width = $matches[1];
 
-       $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html );
-       if ( empty($align) ) $align = 'none';
+       $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
+       if ( empty($align) )
+               $align = 'none';
 
        $alt = ! empty($alt) ? addslashes($alt) : '';
 
 
        $alt = ! empty($alt) ? addslashes($alt) : '';
 
@@ -190,15 +194,19 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
                        $time = $post->post_date;
        }
 
                        $time = $post->post_date;
        }
 
+       $name = $_FILES[$file_id]['name'];
        $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
 
        if ( isset($file['error']) )
                return new WP_Error( 'upload_error', $file['error'] );
 
        $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
 
        if ( isset($file['error']) )
                return new WP_Error( 'upload_error', $file['error'] );
 
+       $name_parts = pathinfo($name);
+       $name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
+
        $url = $file['url'];
        $type = $file['type'];
        $file = $file['file'];
        $url = $file['url'];
        $type = $file['type'];
        $file = $file['file'];
-       $title = preg_replace('/\.[^.]+$/', '', basename($file));
+       $title = $name;
        $content = '';
 
        // use image exif/iptc data for title and caption defaults if possible
        $content = '';
 
        // use image exif/iptc data for title and caption defaults if possible
@@ -303,11 +311,12 @@ wp_enqueue_style( 'wp-admin' );
 wp_enqueue_style( 'colors' );
 if ( 0 === strpos( $content_func, 'media' ) )
        wp_enqueue_style( 'media' );
 wp_enqueue_style( 'colors' );
 if ( 0 === strpos( $content_func, 'media' ) )
        wp_enqueue_style( 'media' );
-
+wp_enqueue_style( 'ie' );
 ?>
 <script type="text/javascript">
 //<![CDATA[
 ?>
 <script type="text/javascript">
 //<![CDATA[
-function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
 //]]>
 </script>
 <?php
 //]]>
 </script>
 <?php
@@ -323,7 +332,10 @@ if ( is_string($content_func) )
        $args = func_get_args();
        $args = array_slice($args, 1);
        call_user_func_array($content_func, $args);
        $args = func_get_args();
        $args = array_slice($args, 1);
        call_user_func_array($content_func, $args);
+
+       do_action('admin_print_footer_scripts');
 ?>
 ?>
+<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
 </body>
 </html>
 <?php
 </body>
 </html>
 <?php
@@ -348,10 +360,10 @@ function media_buttons() {
        $audio_title = __('Add Audio');
        $out = <<<EOF
 
        $audio_title = __('Add Audio');
        $out = <<<EOF
 
-       <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
-       <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
-       <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
-       <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
+       <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title' onclick="return false;"><img src='images/media-button-image.gif' alt='$image_title' /></a>
+       <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title' onclick="return false;"><img src='images/media-button-video.gif' alt='$video_title' /></a>
+       <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title' onclick="return false;"><img src='images/media-button-music.gif' alt='$audio_title' /></a>
+       <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title' onclick="return false;"><img src='images/media-button-other.gif' alt='$media_title' /></a>
 
 EOF;
        printf($context, $out);
 
 EOF;
        printf($context, $out);
@@ -369,11 +381,13 @@ add_action('media_upload_media', 'media_upload_handler');
 function media_upload_form_handler() {
        check_admin_referer('media-form');
 
 function media_upload_form_handler() {
        check_admin_referer('media-form');
 
+       $errors = array();
+
        if ( isset($_POST['send']) ) {
                $keys = array_keys($_POST['send']);
                $send_id = (int) array_shift($keys);
        }
        if ( isset($_POST['send']) ) {
                $keys = array_keys($_POST['send']);
                $send_id = (int) array_shift($keys);
        }
-       
+
        if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
                $post = $_post = get_post($attachment_id, ARRAY_A);
                if ( isset($attachment['post_content']) )
        if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
                $post = $_post = get_post($attachment_id, ARRAY_A);
                if ( isset($attachment['post_content']) )
@@ -384,6 +398,7 @@ function media_upload_form_handler() {
                        $post['post_excerpt'] = $attachment['post_excerpt'];
                if ( isset($attachment['menu_order']) )
                        $post['menu_order'] = $attachment['menu_order'];
                        $post['post_excerpt'] = $attachment['post_excerpt'];
                if ( isset($attachment['menu_order']) )
                        $post['menu_order'] = $attachment['menu_order'];
+
                if ( isset($send_id) && $attachment_id == $send_id ) {
                        if ( isset($attachment['post_parent']) )
                                $post['post_parent'] = $attachment['post_parent'];
                if ( isset($send_id) && $attachment_id == $send_id ) {
                        if ( isset($attachment['post_parent']) )
                                $post['post_parent'] = $attachment['post_parent'];
@@ -417,12 +432,14 @@ function media_upload_form_handler() {
 
        if ( isset($send_id) ) {
                $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
 
        if ( isset($send_id) ) {
                $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
+
                $html = $attachment['post_title'];
                if ( !empty($attachment['url']) ) {
                        if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
                $html = $attachment['post_title'];
                if ( !empty($attachment['url']) ) {
                        if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
-                               $rel = " rel='attachment wp-att-".attribute_escape($send_id)."'";
+                               $rel = " rel='attachment wp-att-" . esc_attr($send_id)."'";
                        $html = "<a href='{$attachment['url']}'$rel>$html</a>";
                }
                        $html = "<a href='{$attachment['url']}'$rel>$html</a>";
                }
+
                $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
                return media_send_to_editor($html);
        }
                $html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
                return media_send_to_editor($html);
        }
@@ -455,13 +472,14 @@ function media_upload_image() {
                $src = $_POST['insertonly']['src'];
                if ( !empty($src) && !strpos($src, '://') )
                        $src = "http://$src";
                $src = $_POST['insertonly']['src'];
                if ( !empty($src) && !strpos($src, '://') )
                        $src = "http://$src";
-               $alt = attribute_escape($_POST['insertonly']['alt']);
+               $alt = esc_attr($_POST['insertonly']['alt']);
                if ( isset($_POST['insertonly']['align']) ) {
                if ( isset($_POST['insertonly']['align']) ) {
-                       $align = attribute_escape($_POST['insertonly']['align']);
+                       $align = esc_attr($_POST['insertonly']['align']);
                        $class = " class='align$align'";
                }
                if ( !empty($src) )
                        $html = "<img src='$src' alt='$alt'$class />";
                        $class = " class='align$align'";
                }
                if ( !empty($src) )
                        $html = "<img src='$src' alt='$alt'$class />";
+               $html = apply_filters('image_send_to_editor_url', $html, $src, $alt, $align);
                return media_send_to_editor($html);
        }
 
                return media_send_to_editor($html);
        }
 
@@ -548,11 +566,12 @@ function media_upload_audio() {
                $href = $_POST['insertonly']['href'];
                if ( !empty($href) && !strpos($href, '://') )
                        $href = "http://$href";
                $href = $_POST['insertonly']['href'];
                if ( !empty($href) && !strpos($href, '://') )
                        $href = "http://$href";
-               $title = attribute_escape($_POST['insertonly']['title']);
+               $title = esc_attr($_POST['insertonly']['title']);
                if ( empty($title) )
                        $title = basename($href);
                if ( !empty($title) && !empty($href) )
                        $html = "<a href='$href' >$title</a>";
                if ( empty($title) )
                        $title = basename($href);
                if ( !empty($title) && !empty($href) )
                        $html = "<a href='$href' >$title</a>";
+               $html = apply_filters('audio_send_to_editor_url', $html, $href, $title);
                return media_send_to_editor($html);
        }
 
                return media_send_to_editor($html);
        }
 
@@ -601,11 +620,12 @@ function media_upload_video() {
                $href = $_POST['insertonly']['href'];
                if ( !empty($href) && !strpos($href, '://') )
                        $href = "http://$href";
                $href = $_POST['insertonly']['href'];
                if ( !empty($href) && !strpos($href, '://') )
                        $href = "http://$href";
-               $title = attribute_escape($_POST['insertonly']['title']);
+               $title = esc_attr($_POST['insertonly']['title']);
                if ( empty($title) )
                        $title = basename($href);
                if ( !empty($title) && !empty($href) )
                        $html = "<a href='$href' >$title</a>";
                if ( empty($title) )
                        $title = basename($href);
                if ( !empty($title) && !empty($href) )
                        $html = "<a href='$href' >$title</a>";
+               $html = apply_filters('video_send_to_editor_url', $html, $href, $title);
                return media_send_to_editor($html);
        }
 
                return media_send_to_editor($html);
        }
 
@@ -654,11 +674,12 @@ function media_upload_file() {
                $href = $_POST['insertonly']['href'];
                if ( !empty($href) && !strpos($href, '://') )
                        $href = "http://$href";
                $href = $_POST['insertonly']['href'];
                if ( !empty($href) && !strpos($href, '://') )
                        $href = "http://$href";
-               $title = attribute_escape($_POST['insertonly']['title']);
+               $title = esc_attr($_POST['insertonly']['title']);
                if ( empty($title) )
                        $title = basename($href);
                if ( !empty($title) && !empty($href) )
                        $html = "<a href='$href' >$title</a>";
                if ( empty($title) )
                        $title = basename($href);
                if ( !empty($title) && !empty($href) )
                        $html = "<a href='$href' >$title</a>";
+               $html = apply_filters('file_send_to_editor_url', $html, $href, $title);
                return media_send_to_editor($html);
        }
 
                return media_send_to_editor($html);
        }
 
@@ -735,18 +756,18 @@ function media_upload_library() {
  * @param unknown_type $checked
  * @return unknown
  */
  * @param unknown_type $checked
  * @return unknown
  */
-function image_align_input_fields($post, $checked='') {
+function image_align_input_fields( $post, $checked = '' ) {
 
 
-       $alignments = array('none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right');
-       if ( !array_key_exists($checked, $alignments) )
+       $alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right'));
+       if ( !array_key_exists( (string) $checked, $alignments ) )
                $checked = 'none';
 
        $out = array();
        foreach ($alignments as $name => $label) {
                $checked = 'none';
 
        $out = array();
        foreach ($alignments as $name => $label) {
-
+               $name = esc_attr($name);
                $out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".
                        ( $checked == $name ? " checked='checked'" : "" ) .
                $out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".
                        ( $checked == $name ? " checked='checked'" : "" ) .
-                       " /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>" . __($label) . "</label>";
+                       " /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>" . $label . "</label>";
        }
        return join("\n", $out);
 }
        }
        return join("\n", $out);
 }
@@ -760,12 +781,12 @@ function image_align_input_fields($post, $checked='') {
  * @param unknown_type $checked
  * @return unknown
  */
  * @param unknown_type $checked
  * @return unknown
  */
-function image_size_input_fields($post, $checked='') {
+function image_size_input_fields( $post, $checked = '' ) {
 
                // get a list of the actual pixel dimensions of each possible intermediate version of this image
                $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size'));
 
 
                // get a list of the actual pixel dimensions of each possible intermediate version of this image
                $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size'));
 
-               foreach ( $size_names as $size => $name) {
+               foreach ( $size_names as $size => $name ) {
                        $downsize = image_downsize($post->ID, $size);
 
                        // is this size selectable?
                        $downsize = image_downsize($post->ID, $size);
 
                        // is this size selectable?
@@ -817,10 +838,10 @@ function image_link_input_fields($post, $url_type='') {
        elseif ( $url_type == 'post' )
                $url = $link;
 
        elseif ( $url_type == 'post' )
                $url = $link;
 
-       return "<input type='text' class='urlfield' name='attachments[$post->ID][url]' value='" . attribute_escape($url) . "' /><br />
+       return "<input type='text' class='urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />
                                <button type='button' class='button urlnone' title=''>" . __('None') . "</button>
                                <button type='button' class='button urlnone' title=''>" . __('None') . "</button>
-                               <button type='button' class='button urlfile' title='" . attribute_escape($file) . "'>" . __('File URL') . "</button>
-                               <button type='button' class='button urlpost' title='" . attribute_escape($link) . "'>" . __('Post URL') . "</button>
+                               <button type='button' class='button urlfile' title='" . esc_attr($file) . "'>" . __('File URL') . "</button>
+                               <button type='button' class='button urlpost' title='" . esc_attr($link) . "'>" . __('Post URL') . "</button>
 ";
 }
 
 ";
 }
 
@@ -836,6 +857,9 @@ function image_link_input_fields($post, $url_type='') {
 function image_attachment_fields_to_edit($form_fields, $post) {
        if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
                $form_fields['post_title']['required'] = true;
 function image_attachment_fields_to_edit($form_fields, $post) {
        if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
                $form_fields['post_title']['required'] = true;
+               $file = wp_get_attachment_url($post->ID);
+
+               $form_fields['image_url']['value'] = $file;
 
                $form_fields['post_excerpt']['label'] = __('Caption');
                $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
 
                $form_fields['post_excerpt']['label'] = __('Caption');
                $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
@@ -869,6 +893,11 @@ function media_single_attachment_fields_to_edit( $form_fields, $post ) {
        return $form_fields;
 }
 
        return $form_fields;
 }
 
+function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
+       unset($form_fields['image_url']);
+       return $form_fields;
+}
+
 /**
  * {@internal Missing Short Description}}
  *
 /**
  * {@internal Missing Short Description}}
  *
@@ -941,6 +970,8 @@ function get_attachment_fields_to_edit($post, $errors = null) {
        if ( is_array($post) )
                $post = (object) $post;
 
        if ( is_array($post) )
                $post = (object) $post;
 
+       $image_url = wp_get_attachment_url($post->ID);
+
        $edit_post = sanitize_post($post, 'edit');
 
        $form_fields = array(
        $edit_post = sanitize_post($post, 'edit');
 
        $form_fields = array(
@@ -967,6 +998,13 @@ function get_attachment_fields_to_edit($post, $errors = null) {
                        'label'      => __('Order'),
                        'value'      => $edit_post->menu_order
                ),
                        'label'      => __('Order'),
                        'value'      => $edit_post->menu_order
                ),
+               'image_url'     => array(
+                       'label'      => __('File URL'),
+                       'input'      => 'html',
+                       'html'       => "<input type='text' class='urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . esc_attr($image_url) . "' /><br />",
+                       'value'      => isset($edit_post->post_url) ? $edit_post->post_url : '',
+                       'helps'      => __('Location of the uploaded file.'),
+               )
        );
 
        foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
        );
 
        foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
@@ -1060,19 +1098,19 @@ function get_media_item( $attachment_id, $args = null ) {
        $post = get_post($attachment_id);
 
        $filename = basename($post->guid);
        $post = get_post($attachment_id);
 
        $filename = basename($post->guid);
-       $title = attribute_escape($post->post_title);
+       $title = esc_attr($post->post_title);
 
        if ( $_tags = get_the_tags($attachment_id) ) {
                foreach ( $_tags as $tag )
                        $tags[] = $tag->name;
 
        if ( $_tags = get_the_tags($attachment_id) ) {
                foreach ( $_tags as $tag )
                        $tags[] = $tag->name;
-               $tags = attribute_escape(join(', ', $tags));
+               $tags = esc_attr(join(', ', $tags));
        }
 
        $type = '';
        if ( isset($post_mime_types) ) {
                $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
                $type = array_shift($keys);
        }
 
        $type = '';
        if ( isset($post_mime_types) ) {
                $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
                $type = array_shift($keys);
-               $type = "<input type='hidden' id='type-of-$attachment_id' value='" . attribute_escape( $type ) . "' />";
+               $type = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
        }
 
        $form_fields = get_attachment_fields_to_edit($post, $errors);
        }
 
        $form_fields = get_attachment_fields_to_edit($post, $errors);
@@ -1131,7 +1169,7 @@ function get_media_item( $attachment_id, $args = null ) {
 
        $delete_href = wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id);
        if ( $send )
 
        $delete_href = wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id);
        if ( $send )
-               $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . attribute_escape( __( 'Insert into Post' ) ) . "' />";
+               $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";
        if ( $delete )
                $delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a>";
        if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
        if ( $delete )
                $delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a>";
        if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
@@ -1167,9 +1205,9 @@ function get_media_item( $attachment_id, $args = null ) {
                if ( !empty($field[$field['input']]) )
                        $item .= $field[$field['input']];
                elseif ( $field['input'] == 'textarea' ) {
                if ( !empty($field[$field['input']]) )
                        $item .= $field[$field['input']];
                elseif ( $field['input'] == 'textarea' ) {
-                       $item .= "<textarea type='text' id='$name' name='$name'" . $aria_required . ">" . htmlspecialchars( $field['value'] ) . "</textarea>";
+                       $item .= "<textarea type='text' id='$name' name='$name'" . $aria_required . ">" . esc_html( $field['value'] ) . "</textarea>";
                } else {
                } else {
-                       $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
+                       $item .= "<input type='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "'" . $aria_required . "/>";
                }
                if ( !empty($field['helps']) )
                        $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
                }
                if ( !empty($field['helps']) )
                        $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
@@ -1197,9 +1235,9 @@ function get_media_item( $attachment_id, $args = null ) {
        $item .= "\t</table>\n";
 
        foreach ( $hidden_fields as $name => $value )
        $item .= "\t</table>\n";
 
        foreach ( $hidden_fields as $name => $value )
-               $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n";
+               $item .= "\t<input type='hidden' name='$name' id='$name' value='" . esc_attr( $value ) . "' />\n";
 
 
-       if ( $post->post_parent < 1 && (int) $_REQUEST['post_id'] ) {
+       if ( $post->post_parent < 1 && isset($_REQUEST['post_id']) ) {
                $parent = (int) $_REQUEST['post_id'];
                $parent_name = "attachments[$attachment_id][post_parent]";
 
                $parent = (int) $_REQUEST['post_id'];
                $parent_name = "attachments[$attachment_id][post_parent]";
 
@@ -1244,6 +1282,16 @@ function media_upload_form( $errors = null ) {
        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
 
 ?>
        $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
 
 ?>
+<script type="text/javascript">
+//<![CDATA[
+var uploaderMode = 0;
+jQuery(document).ready(function($){
+       uploaderMode = getUserSetting('uploader');
+       $('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');uploaderMode=0;swfuploadPreLoad();return false;});
+       $('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');uploaderMode=1;swfuploadPreLoad();return false;});
+});
+//]]>
+</script>
 <div id="media-upload-notice">
 <?php if (isset($errors['upload_notice']) ) { ?>
        <?php echo $errors['upload_notice']; ?>
 <div id="media-upload-notice">
 <?php if (isset($errors['upload_notice']) ) { ?>
        <?php echo $errors['upload_notice']; ?>
@@ -1259,16 +1307,18 @@ function media_upload_form( $errors = null ) {
 
 <?php if ( $flash ) : ?>
 <script type="text/javascript">
 
 <?php if ( $flash ) : ?>
 <script type="text/javascript">
-<!--
+//<![CDATA[
+var swfu;
 SWFUpload.onload = function() {
 SWFUpload.onload = function() {
-       swfu = new SWFUpload({
+       var settings = {
                        button_text: '<span class="button"><?php _e('Select Files'); ?></span>',
                        button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
                        button_height: "24",
                        button_width: "132",
                        button_text: '<span class="button"><?php _e('Select Files'); ?></span>',
                        button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
                        button_height: "24",
                        button_width: "132",
+                       button_text_top_padding: 1,
                        button_image_url: '<?php echo includes_url('images/upload.png'); ?>',
                        button_placeholder_id: "flash-browse-button",
                        button_image_url: '<?php echo includes_url('images/upload.png'); ?>',
                        button_placeholder_id: "flash-browse-button",
-                       upload_url : "<?php echo attribute_escape( $flash_action_url ); ?>",
+                       upload_url : "<?php echo esc_attr( $flash_action_url ); ?>",
                        flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
                        file_post_name: "async-upload",
                        file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
                        flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
                        file_post_name: "async-upload",
                        file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
@@ -1297,32 +1347,36 @@ SWFUpload.onload = function() {
                                swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
                        },
                        debug: false
                                swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
                        },
                        debug: false
-               });
+               };
+               swfu = new SWFUpload(settings);
 };
 };
-//-->
+//]]>
 </script>
 
 <div id="flash-upload-ui">
 <?php do_action('pre-flash-upload-ui'); ?>
 
 </script>
 
 <div id="flash-upload-ui">
 <?php do_action('pre-flash-upload-ui'); ?>
 
-       <div><?php _e( 'Choose files to upload' ); ?> <div id="flash-browse-button"></div></div>
+       <div>
+       <?php _e( 'Choose files to upload' ); ?>
+       <div id="flash-browse-button"></div>
+       <span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php esc_attr_e('Cancel Upload'); ?>" class="button" /></span>
+       </div>
 <?php do_action('post-flash-upload-ui'); ?>
        <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
 </div>
 <?php do_action('post-flash-upload-ui'); ?>
        <p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
 </div>
-
 <?php endif; // $flash ?>
 
 <div id="html-upload-ui">
 <?php do_action('pre-html-upload-ui'); ?>
        <p id="async-upload-wrap">
 <?php endif; // $flash ?>
 
 <div id="html-upload-ui">
 <?php do_action('pre-html-upload-ui'); ?>
        <p id="async-upload-wrap">
-       <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onclick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
+       <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
+       <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php esc_attr_e('Upload'); ?>" /> <a href="#" onclick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
        </p>
        </p>
-
-       <br class="clear" />
+       <div class="clear"></div>
        <?php if ( is_lighttpd_before_150() ): ?>
        <p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
        <?php endif;?>
        <?php if ( is_lighttpd_before_150() ): ?>
        <p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
        <?php endif;?>
-<?php do_action('post-html-upload-ui'); ?>
+<?php do_action('post-html-upload-ui', $flash); ?>
 </div>
 <?php do_action('post-upload-ui'); ?>
 <?php
 </div>
 <?php do_action('post-upload-ui'); ?>
 <?php
@@ -1346,7 +1400,7 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
        $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
 ?>
 
        $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
 ?>
 
-<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <?php wp_nonce_field('media-form'); ?>
 
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <?php wp_nonce_field('media-form'); ?>
 
@@ -1355,7 +1409,7 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
 <?php media_upload_form( $errors ); ?>
 
 <script type="text/javascript">
 <?php media_upload_form( $errors ); ?>
 
 <script type="text/javascript">
-<!--
+//<![CDATA[
 jQuery(function($){
        var preloaded = $(".media-item.preloaded");
        if ( preloaded.length > 0 ) {
 jQuery(function($){
        var preloaded = $(".media-item.preloaded");
        if ( preloaded.length > 0 ) {
@@ -1363,21 +1417,24 @@ jQuery(function($){
        }
        updateMediaForm();
 });
        }
        updateMediaForm();
 });
--->
+//]]>
 </script>
 <div id="media-items">
 <?php
 if ( $id ) {
        if ( !is_wp_error($id) ) {
 </script>
 <div id="media-items">
 <?php
 if ( $id ) {
        if ( !is_wp_error($id) ) {
+               add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
                echo get_media_items( $id, $errors );
        } else {
                echo get_media_items( $id, $errors );
        } else {
-               echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
+               echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div>';
                exit;
        }
 }
 ?>
 </div>
                exit;
        }
 }
 ?>
 </div>
-<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
+<p class="savebutton ml-submit">
+<input type="submit" class="button" name="save" value="<?php esc_attr_e( 'Save all changes' ); ?>" />
+</p>
 <?php
 }
 
 <?php
 }
 
@@ -1401,7 +1458,7 @@ function media_upload_type_url_form($type = 'file', $errors = null, $id = null)
        $callback = "type_url_form_$type";
 ?>
 
        $callback = "type_url_form_$type";
 ?>
 
-<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <?php wp_nonce_field('media-form'); ?>
 
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <?php wp_nonce_field('media-form'); ?>
 
@@ -1474,7 +1531,7 @@ var addExtImage = {
                        t.resetImageData();
                        return false;
                }
                        t.resetImageData();
                        return false;
                }
-               document.getElementById('status_img').src = 'images/loading.gif';
+               document.getElementById('status_img').src = 'images/wpspin_light.gif';
                t.preloadImg = new Image();
                t.preloadImg.onload = t.updateImageData;
                t.preloadImg.onerror = t.resetImageData;
                t.preloadImg = new Image();
                t.preloadImg.onload = t.updateImageData;
                t.preloadImg.onerror = t.resetImageData;
@@ -1486,7 +1543,7 @@ var addExtImage = {
 
 <div id="media-items">
 <div class="media-item media-blank">
 
 <div id="media-items">
 <div class="media-item media-blank">
-<?php echo call_user_func($callback); ?>
+<?php echo apply_filters($callback, call_user_func($callback)); ?>
 </div>
 </div>
 </form>
 </div>
 </div>
 </form>
@@ -1524,8 +1581,18 @@ jQuery(function($){
 });
 -->
 </script>
 });
 -->
 </script>
-
-<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
+<div id="sort-buttons" class="hide-if-no-js">
+<span>
+<?php _e('All Tabs:'); ?>
+<a href="#" id="showall"><?php _e('Show'); ?></a>
+<a href="#" id="hideall" style="display:none;"><?php _e('Hide'); ?></a>
+</span>
+<?php _e('Sort Order:'); ?>
+<a href="#" id="asc"><?php _e('Ascending'); ?></a> |
+<a href="#" id="desc"><?php _e('Descending'); ?></a> |
+<a href="#" id="clear"><?php _e('Clear'); ?></a>
+</div>
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
 <?php wp_nonce_field('media-form'); ?>
 <?php //media_upload_form( $errors ); ?>
 <table class="widefat" cellspacing="0">
 <?php wp_nonce_field('media-form'); ?>
 <?php //media_upload_form( $errors ); ?>
 <table class="widefat" cellspacing="0">
@@ -1535,14 +1602,15 @@ jQuery(function($){
 </tr></thead>
 </table>
 <div id="media-items">
 </tr></thead>
 </table>
 <div id="media-items">
+<?php add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); ?>
 <?php echo get_media_items($post_id, $errors); ?>
 </div>
 
 <p class="ml-submit">
 <?php echo get_media_items($post_id, $errors); ?>
 </div>
 
 <p class="ml-submit">
-<input type="submit" class="button savebutton" style="display:none;" name="save" id="save-all" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
+<input type="submit" class="button savebutton" style="display:none;" name="save" id="save-all" value="<?php esc_attr_e( 'Save all changes' ); ?>" />
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
-<input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" />
-<input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" />
+<input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
+<input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
 </p>
 
 <div id="gallery-settings" style="display:none;">
 </p>
 
 <div id="gallery-settings" style="display:none;">
@@ -1572,8 +1640,9 @@ jQuery(function($){
        <td class="field">
                <select id="orderby" name="orderby">
                        <option value="menu_order" selected="selected"><?php _e('Menu order'); ?></option>
        <td class="field">
                <select id="orderby" name="orderby">
                        <option value="menu_order" selected="selected"><?php _e('Menu order'); ?></option>
-                       <option value="post_name"><?php _e('Name'); ?></option>
+                       <option value="title"><?php _e('Title'); ?></option>
                        <option value="ID"><?php _e('Date/Time'); ?></option>
                        <option value="ID"><?php _e('Date/Time'); ?></option>
+                       <option value="rand"><?php _e('Random'); ?></option>
                </select>
        </td>
        </tr>
                </select>
        </td>
        </tr>
@@ -1615,8 +1684,8 @@ jQuery(function($){
 </tbody></table>
 
 <p class="ml-submit">
 </tbody></table>
 
 <p class="ml-submit">
-<input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery' ) ); ?>" />
-<input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php echo attribute_escape( __( 'Update gallery settings' ) ); ?>" />
+<input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e( 'Insert gallery' ); ?>" />
+<input type="button" class="button" style="display:none;" onmousedown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" />
 </p>
 </div>
 </form>
 </p>
 </div>
 </form>
@@ -1652,15 +1721,15 @@ function media_upload_library_form($errors) {
 ?>
 
 <form id="filter" action="" method="get">
 ?>
 
 <form id="filter" action="" method="get">
-<input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" />
-<input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" />
+<input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" />
+<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
-<input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />
+<input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" />
 
 <p id="media-search" class="search-box">
 
 <p id="media-search" class="search-box">
-       <label class="hidden" for="media-search-input"><?php _e('Search Media');?>:</label>
-       <input type="text" id="media-search-input" class="search-input" name="s" value="<?php the_search_query(); ?>" />
-       <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
+       <label class="screen-reader-text" for="media-search-input"><?php _e('Search Media');?>:</label>
+       <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Media' ); ?>" class="button" />
 </p>
 
 <ul class="subsubsub">
 </p>
 
 <ul class="subsubsub">
@@ -1670,7 +1739,10 @@ $_num_posts = (array) wp_count_attachments();
 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
 foreach ( $matches as $_type => $reals )
        foreach ( $reals as $real )
 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
 foreach ( $matches as $_type => $reals )
        foreach ( $reals as $real )
-               $num_posts[$_type] += $_num_posts[$real];
+               if ( isset($num_posts[$_type]) )
+                       $num_posts[$_type] += $_num_posts[$real];
+               else
+                       $num_posts[$_type] = $_num_posts[$real];
 // If available type specified by media button clicked, filter by that type
 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
        $_GET['post_mime_type'] = $type;
 // If available type specified by media button clicked, filter by that type
 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
        $_GET['post_mime_type'] = $type;
@@ -1678,17 +1750,19 @@ if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
 }
 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
        $class = ' class="current"';
 }
 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
        $class = ' class="current"';
-$type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>";
+else
+       $class = '';
+$type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>";
 foreach ( $post_mime_types as $mime_type => $label ) {
        $class = '';
 
        if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
                continue;
 
 foreach ( $post_mime_types as $mime_type => $label ) {
        $class = '';
 
        if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
                continue;
 
-       if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
+       if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
                $class = ' class="current"';
 
                $class = ' class="current"';
 
-       $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
+       $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(_n($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
 }
 echo implode(' | </li>', $type_links) . '</li>';
 unset($type_links);
 }
 echo implode(' | </li>', $type_links) . '</li>';
 unset($type_links);
@@ -1734,15 +1808,15 @@ foreach ($arc_result as $arc_row) {
        else
                $default = '';
 
        else
                $default = '';
 
-       echo "<option$default value='" . attribute_escape( $arc_row->yyear . $arc_row->mmonth ) . "'>";
-       echo wp_specialchars( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
+       echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
+       echo esc_html( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
        echo "</option>\n";
 }
 ?>
 </select>
 <?php } ?>
 
        echo "</option>\n";
 }
 ?>
 </select>
 <?php } ?>
 
-<input type="submit" id="post-query-submit" value="<?php echo attribute_escape( __( 'Filter &#187;' ) ); ?>" class="button-secondary" />
+<input type="submit" id="post-query-submit" value="<?php echo esc_attr( __( 'Filter &#187;' ) ); ?>" class="button-secondary" />
 
 </div>
 
 
 </div>
 
@@ -1750,7 +1824,7 @@ foreach ($arc_result as $arc_row) {
 </div>
 </form>
 
 </div>
 </form>
 
-<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="library-form">
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="library-form">
 
 <?php wp_nonce_field('media-form'); ?>
 <?php //media_upload_form( $errors ); ?>
 
 <?php wp_nonce_field('media-form'); ?>
 <?php //media_upload_form( $errors ); ?>
@@ -1768,10 +1842,11 @@ jQuery(function($){
 </script>
 
 <div id="media-items">
 </script>
 
 <div id="media-items">
+<?php add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); ?>
 <?php echo get_media_items(null, $errors); ?>
 </div>
 <p class="ml-submit">
 <?php echo get_media_items(null, $errors); ?>
 </div>
 <p class="ml-submit">
-<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
+<input type="submit" class="button savebutton" name="save" value="<?php esc_attr_e( 'Save all changes' ); ?>" />
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 </p>
 </form>
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 </p>
 </form>
@@ -1789,7 +1864,7 @@ function type_url_form_image() {
 
        if ( apply_filters( 'disable_captions', '' ) ) {
                $alt = __('Alternate Text');
 
        if ( apply_filters( 'disable_captions', '' ) ) {
                $alt = __('Alternate Text');
-               $alt_help = __('Alt text for the image, e.g. "The Mona Lisa"');
+               $alt_help = __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;');
        } else {
                $alt = __('Image Caption');
                $alt_help = __('Also used as alternate text for the image');
        } else {
                $alt = __('Image Caption');
                $alt_help = __('Also used as alternate text for the image');
@@ -1853,7 +1928,7 @@ function type_url_form_image() {
                <tr>
                        <td></td>
                        <td>
                <tr>
                        <td></td>
                        <td>
-                               <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . attribute_escape(__('Insert into Post')) . '" />
+                               <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" />
                        </td>
                </tr>
        </tbody></table>
                        </td>
                </tr>
        </tbody></table>
@@ -1885,11 +1960,11 @@ function type_url_form_audio() {
                        </th>
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                        </th>
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
-               <tr><td></td><td class="help">' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '</td></tr>
+               <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Still Alive by Jonathan Coulton&#8221;') . '</td></tr>
                <tr>
                        <td></td>
                        <td>
                <tr>
                        <td></td>
                        <td>
-                               <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+                               <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Insert into Post') . '" />
                        </td>
                </tr>
        </tbody></table>
                        </td>
                </tr>
        </tbody></table>
@@ -1920,11 +1995,11 @@ function type_url_form_video() {
                        </th>
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                        </th>
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
-               <tr><td></td><td class="help">' . __('Link text, e.g. "Lucy on YouTube"') . '</td></tr>
+               <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Lucy on YouTube&#8220;') . '</td></tr>
                <tr>
                        <td></td>
                        <td>
                <tr>
                        <td></td>
                        <td>
-                               <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+                               <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Insert into Post') . '" />
                        </td>
                </tr>
        </tbody></table>
                        </td>
                </tr>
        </tbody></table>
@@ -1955,11 +2030,11 @@ function type_url_form_file() {
                        </th>
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                        </th>
                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
-               <tr><td></td><td class="help">' . __('Link text, e.g. "Ransom Demands (PDF)"') . '</td></tr>
+               <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;') . '</td></tr>
                <tr>
                        <td></td>
                        <td>
                <tr>
                        <td></td>
                        <td>
-                               <input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+                               <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Insert into Post') . '" />
                        </td>
                </tr>
        </tbody></table>
                        </td>
                </tr>
        </tbody></table>
@@ -1991,7 +2066,7 @@ add_filter('flash_uploader', 'media_upload_use_flash');
  */
 function media_upload_flash_bypass() {
        echo '<p class="upload-flash-bypass">';
  */
 function media_upload_flash_bypass() {
        echo '<p class="upload-flash-bypass">';
-       printf( __('You are using the Flash uploader.  Problems?  Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
+       printf( __('You are using the Flash uploader.  Problems?  Try the <a href="%s">Browser uploader</a> instead.'), esc_url(add_query_arg('flash', 0)) );
        echo '</p>';
 }
 
        echo '</p>';
 }
 
@@ -2000,16 +2075,15 @@ function media_upload_flash_bypass() {
  *
  * @since unknown
  */
  *
  * @since unknown
  */
-function media_upload_html_bypass() {
+function media_upload_html_bypass($flash = true) {
        echo '<p class="upload-html-bypass">';
        echo '<p class="upload-html-bypass">';
-       if ( array_key_exists('flash', $_REQUEST) )
+       _e('You are using the Browser uploader.');
+       if ( $flash ) {
                // the user manually selected the browser uploader, so let them switch back to Flash
                // the user manually selected the browser uploader, so let them switch back to Flash
-               printf( __('You are using the Browser uploader.  Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
-       else
-               // the user probably doesn't have Flash
-               printf( __('You are using the Browser uploader.') );
-
-       echo '</p>';
+               echo ' ';
+               printf( __('Try the <a href="%s">Flash uploader</a> instead.'), esc_url(add_query_arg('flash', 1)) );
+       }
+       echo "</p>\n";
 }
 
 add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
 }
 
 add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
@@ -2033,8 +2107,6 @@ function media_upload_bypass_url($url) {
 
 add_filter('media_upload_form_url', 'media_upload_bypass_url');
 
 
 add_filter('media_upload_form_url', 'media_upload_bypass_url');
 
-
-
 add_filter('async_upload_image', 'get_media_item', 10, 2);
 add_filter('async_upload_audio', 'get_media_item', 10, 2);
 add_filter('async_upload_video', 'get_media_item', 10, 2);
 add_filter('async_upload_image', 'get_media_item', 10, 2);
 add_filter('async_upload_audio', 'get_media_item', 10, 2);
 add_filter('async_upload_video', 'get_media_item', 10, 2);
index ffb849704d7bbeaa94e5bf88a8e0984f8f2ca6e0..d020e74add59a42f0c157bbfbdd702f7134ac942 100644 (file)
@@ -135,6 +135,34 @@ function save_mod_rewrite_rules() {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Updates the IIS web.config file with the current rules if it is writable.
+ * If the permalinks do not require rewrite rules then the rules are deleted from the web.config file.
+ *
+ * @since 2.8.0
+ *
+ * @return bool True if web.config was updated successfully
+ */
+function iis7_save_url_rewrite_rules(){
+       global $wp_rewrite;
+
+       $home_path = get_home_path();
+       $web_config_file = $home_path . 'web.config';
+
+       // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP
+       if ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) {
+               if ( iis7_supports_permalinks() ) {
+                       $rule = $wp_rewrite->iis7_url_rewrite_rules();
+                       if ( ! empty($rule) ) {
+                               return iis7_add_rewrite_rule($web_config_file, $rule);
+                       } else {
+                               return iis7_delete_rewrite_rule($web_config_file);
+                       }
+               }
+       }
+       return false;
+}
+
 /**
  * {@internal Missing Short Description}}
  *
 /**
  * {@internal Missing Short Description}}
  *
@@ -238,4 +266,371 @@ function show_message($message) {
        echo "<p>$message</p>\n";
 }
 
        echo "<p>$message</p>\n";
 }
 
+function wp_doc_link_parse( $content ) {
+       if ( !is_string( $content ) || empty( $content ) )
+               return array();
+
+       $tokens = token_get_all( $content );
+       $functions = array();
+       $ignore_functions = array();
+       for ( $t = 0, $count = count( $tokens ); $t < $count; $t++ ) {
+               if ( !is_array( $tokens[$t] ) ) continue;
+               if ( T_STRING == $tokens[$t][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) {
+                       // If it's a function or class defined locally, there's not going to be any docs available
+                       if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) {
+                               $ignore_functions[] = $tokens[$t][1];
+                       }
+                       // Add this to our stack of unique references
+                       $functions[] = $tokens[$t][1];
+               }
+       }
+
+       $functions = array_unique( $functions );
+       sort( $functions );
+       $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
+       $ignore_functions = array_unique( $ignore_functions );
+
+       $out = array();
+       foreach ( $functions as $function ) {
+               if ( in_array( $function, $ignore_functions ) )
+                       continue;
+               $out[] = $function;
+       }
+
+       return $out;
+}
+
+/**
+ * Determines the language to use for CodePress syntax highlighting,
+ * based only on a filename.
+ *
+ * @since 2.8
+ *
+ * @param string $filename The name of the file to be highlighting
+**/
+function codepress_get_lang( $filename ) {
+       $codepress_supported_langs = apply_filters( 'codepress_supported_langs',
+                                                                       array( '.css' => 'css',
+                                                                                       '.js' => 'javascript',
+                                                                                       '.php' => 'php',
+                                                                                       '.html' => 'html',
+                                                                                       '.htm' => 'html',
+                                                                                       '.txt' => 'text'
+                                                                                       ) );
+       $extension = substr( $filename, strrpos( $filename, '.' ) );
+       if ( $extension && array_key_exists( $extension, $codepress_supported_langs ) )
+               return $codepress_supported_langs[$extension];
+
+       return 'generic';
+}
+
+/**
+ * Adds Javascript required to make CodePress work on the theme/plugin editors.
+ *
+ * This code is attached to the action admin_print_footer_scripts.
+ *
+ * @since 2.8
+**/
+function codepress_footer_js() {
+       // Script-loader breaks CP's automatic path-detection, thus CodePress.path
+       // CP edits in an iframe, so we need to grab content back into normal form
+       ?><script type="text/javascript">
+/* <![CDATA[ */
+var codepress_path = '<?php echo includes_url('js/codepress/'); ?>';
+jQuery('#template').submit(function(){
+       if (jQuery('#newcontent_cp').length)
+               jQuery('#newcontent_cp').val(newcontent.getCode()).removeAttr('disabled');
+});
+jQuery('#codepress-on').hide();
+jQuery('#codepress-off').show();
+/* ]]> */
+</script>
+<?php
+}
+
+/**
+ * Determine whether to use CodePress or not.
+ *
+ * @since 2.8
+**/
+function use_codepress() {
+
+       if ( isset($_GET['codepress']) ) {
+               $on = 'on' == $_GET['codepress'] ? 'on' : 'off';
+               set_user_setting( 'codepress', $on );
+       } else {
+               $on = get_user_setting('codepress', 'on');
+       }
+
+       if ( 'on' == $on ) {
+               add_action( 'admin_print_footer_scripts', 'codepress_footer_js' );
+               return true;
+       }
+
+       return false;
+}
+
+/**
+ * Saves option for number of rows when listing posts, pages, comments, etc.
+ *
+ * @since 2.8
+**/
+function set_screen_options() {
+
+       if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
+               check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
+
+               if ( !$user = wp_get_current_user() )
+                       return;
+               $option = $_POST['wp_screen_options']['option'];
+               $value = $_POST['wp_screen_options']['value'];
+
+               if ( !preg_match( '/^[a-z_-]+$/', $option ) )
+                       return;
+
+               $option = str_replace('-', '_', $option);
+
+               switch ( $option ) {
+                       case 'edit_per_page':
+                       case 'edit_pages_per_page':
+                       case 'edit_comments_per_page':
+                       case 'upload_per_page':
+                       case 'categories_per_page':
+                       case 'edit_tags_per_page':
+                       case 'plugins_per_page':
+                               $value = (int) $value;
+                               if ( $value < 1 || $value > 999 )
+                                       return;
+                               break;
+                       default:
+                               $value = apply_filters('set-screen-option', false, $option, $value);
+                               if ( false === $value )
+                                       return;
+                               break;
+               }
+
+               update_usermeta($user->ID, $option, $value);
+               wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
+               exit;
+       }
+}
+
+function wp_menu_unfold() {
+       if ( isset($_GET['unfoldmenu']) ) {
+               delete_user_setting('mfold');
+               wp_redirect( remove_query_arg( 'unfoldmenu', stripslashes($_SERVER['REQUEST_URI']) ) );
+               exit;
+       }
+}
+
+/**
+ * Check if IIS 7 supports pretty permalinks
+ *
+ * @since 2.8.0
+ *
+ * @return bool
+ */
+function iis7_supports_permalinks() {
+       global $is_iis7;
+
+       $supports_permalinks = false;
+       if ( $is_iis7 ) {
+               /* First we check if the DOMDocument class exists. If it does not exist,
+                * which is the case for PHP 4.X, then we cannot easily update the xml configuration file,
+                * hence we just bail out and tell user that pretty permalinks cannot be used.
+                * This is not a big issue because PHP 4.X is going to be depricated and for IIS it
+                * is recommended to use PHP 5.X NTS.
+                * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
+                * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
+                * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
+                * via ISAPI then pretty permalinks will not work.
+                */
+               $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );
+       }
+
+       return apply_filters('iis7_supports_permalinks', $supports_permalinks);
+}
+
+/**
+ * Check if rewrite rule for WordPress already exists in the IIS 7 configuration file
+ *
+ * @since 2.8.0
+ *
+ * @return bool
+ * @param string $filename The file path to the configuration file
+ */
+function iis7_rewrite_rule_exists($filename) {
+       if ( ! file_exists($filename) )
+               return false;
+       if ( ! class_exists('DOMDocument') )
+               return false;
+
+       $doc = new DOMDocument();
+       if ( $doc->load($filename) === false )
+               return false;
+       $xpath = new DOMXPath($doc);
+       $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']');
+       if ( $rules->length == 0 )
+               return false;
+       else
+               return true;
+}
+
+/**
+ * Delete WordPress rewrite rule from web.config file if it exists there
+ *
+ * @since 2.8.0
+ *
+ * @param string $filename Name of the configuration file
+ * @return bool
+ */
+function iis7_delete_rewrite_rule($filename) {
+       // If configuration file does not exist then rules also do not exist so there is nothing to delete
+       if ( ! file_exists($filename) )
+               return true;
+
+       if ( ! class_exists('DOMDocument') )
+               return false;
+
+       $doc = new DOMDocument();
+       $doc->preserveWhiteSpace = false;
+
+       if ( $doc -> load($filename) === false )
+               return false;
+       $xpath = new DOMXPath($doc);
+       $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']');
+       if ( $rules->length > 0 ) {
+               $child = $rules->item(0);
+               $parent = $child->parentNode;
+               $parent->removeChild($child);
+               $doc->formatOutput = true;
+               saveDomDocument($doc, $filename);
+       }
+       return true;
+}
+
+/**
+ * Add WordPress rewrite rule to the IIS 7 configuration file.
+ *
+ * @since 2.8.0
+ *
+ * @param string $filename The file path to the configuration file
+ * @param string $rewrite_rule The XML fragment with URL Rewrite rule
+ * @return bool
+ */
+function iis7_add_rewrite_rule($filename, $rewrite_rule) {
+       if ( ! class_exists('DOMDocument') )
+               return false;
+
+       // If configuration file does not exist then we create one.
+       if ( ! file_exists($filename) ) {
+               $fp = fopen( $filename, 'w');
+               fwrite($fp, '<configuration/>');
+               fclose($fp);
+       }
+
+       $doc = new DOMDocument();
+       $doc->preserveWhiteSpace = false;
+
+       if ( $doc->load($filename) === false )
+               return false;
+
+       $xpath = new DOMXPath($doc);
+
+       // First check if the rule already exists as in that case there is no need to re-add it
+       $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[@name=\'wordpress\']');
+       if ( $wordpress_rules->length > 0 )
+               return true;
+
+       // Check the XPath to the rewrite rule and create XML nodes if they do not exist
+       $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite/rules');
+       if ( $xmlnodes->length > 0 ) {
+               $rules_node = $xmlnodes->item(0);
+       } else {
+               $rules_node = $doc->createElement('rules');
+
+               $xmlnodes = $xpath->query('/configuration/system.webServer/rewrite');
+               if ( $xmlnodes->length > 0 ) {
+                       $rewrite_node = $xmlnodes->item(0);
+                       $rewrite_node->appendChild($rules_node);
+               } else {
+                       $rewrite_node = $doc->createElement('rewrite');
+                       $rewrite_node->appendChild($rules_node);
+
+                       $xmlnodes = $xpath->query('/configuration/system.webServer');
+                       if ( $xmlnodes->length > 0 ) {
+                               $system_webServer_node = $xmlnodes->item(0);
+                               $system_webServer_node->appendChild($rewrite_node);
+                       } else {
+                               $system_webServer_node = $doc->createElement('system.webServer');
+                               $system_webServer_node->appendChild($rewrite_node);
+
+                               $xmlnodes = $xpath->query('/configuration');
+                               if ( $xmlnodes->length > 0 ) {
+                                       $config_node = $xmlnodes->item(0);
+                                       $config_node->appendChild($system_webServer_node);
+                               } else {
+                                       $config_node = $doc->createElement('configuration');
+                                       $doc->appendChild($config_node);
+                                       $config_node->appendChild($system_webServer_node);
+                               }
+                       }
+               }
+       }
+
+       $rule_fragment = $doc->createDocumentFragment();
+       $rule_fragment->appendXML($rewrite_rule);
+       $rules_node->appendChild($rule_fragment);
+
+       $doc->formatOutput = true;
+       saveDomDocument($doc, $filename);
+
+       return true;
+}
+
+/**
+ * Saves the XML document into a file
+ *
+ * @since 2.8.0
+ *
+ * @param DOMDocument $doc
+ * @param string $filename
+ */
+function saveDomDocument($doc, $filename) {
+       $config = $doc->saveXML();
+       $config = preg_replace("/([^\r])\n/", "$1\r\n", $config);
+       $fp = fopen($filename, 'w');
+       fwrite($fp, $config);
+       fclose($fp);
+}
+
+/**
+ * Workaround for Windows bug in is_writable() function
+ *
+ * @since 2.8.0
+ *
+ * @param object $path
+ * @return bool
+ */
+function win_is_writable($path) {
+       /* will work in despite of Windows ACLs bug
+        * NOTE: use a trailing slash for folders!!!
+        * see http://bugs.php.net/bug.php?id=27609
+        * see http://bugs.php.net/bug.php?id=30931
+        */
+
+    if ( $path{strlen($path)-1} == '/' ) // recursively return a temporary file path
+        return win_is_writable($path . uniqid(mt_rand()) . '.tmp');
+    else if ( is_dir($path) )
+        return win_is_writable($path . '/' . uniqid(mt_rand()) . '.tmp');
+    // check tmp file for read/write capabilities
+    $rm = file_exists($path);
+    $f = @fopen($path, 'a');
+    if ($f===false)
+        return false;
+    fclose($f);
+    if ( ! $rm )
+        unlink($path);
+    return true;
+}
 ?>
 ?>
index 57e24bd73753702f79d6352c1ea17e92547e4600..bcd9e1b2a20f0aec29d21a9bd91e13a3022439e3 100644 (file)
@@ -40,11 +40,11 @@ function plugins_api($action, $args = null) {
        if ( ! $res ) {
                $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
                if ( is_wp_error($request) ) {
        if ( ! $res ) {
                $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
                if ( is_wp_error($request) ) {
-                       $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occured during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
+                       $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
                } else {
                        $res = unserialize($request['body']);
                        if ( ! $res )
                } else {
                        $res = unserialize($request['body']);
                        if ( ! $res )
-                               $res = new WP_Error('plugins_api_failed', __('An unknown error occured'), $request['body']);
+                               $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']);
                }
        }
 
                }
        }
 
@@ -125,24 +125,11 @@ function install_dashboard() {
        <p><?php _e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via this page.') ?></p>
 
        <h4><?php _e('Search') ?></h4>
        <p><?php _e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via this page.') ?></p>
 
        <h4><?php _e('Search') ?></h4>
-       <?php install_search_form('<a href="' . add_query_arg('show-help', !isset($_REQUEST['show-help'])) .'" onclick="jQuery(\'#search-help\').toggle(); return false;">' . __('[need help?]') . '</a>') ?>
-       <div id="search-help" style="display: <?php echo isset($_REQUEST['show-help']) ? 'block' : 'none'; ?>;">
-       <p>     <?php _e('You may search based on 3 criteria:') ?><br />
-               <?php _e('<strong>Term:</strong> Searches plugins names and descriptions for the specified term') ?><br />
-               <?php _e('<strong>Tag:</strong> Searches for plugins tagged as such') ?><br />
-               <?php _e('<strong>Author:</strong> Searches for plugins created by the Author, or which the Author contributed to.') ?></p>
-       </div>
-
-       <h4><?php _e('Install a plugin in .zip format') ?></h4>
-       <p><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p>
-       <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('plugin-install.php?tab=upload') ?>">
-               <?php wp_nonce_field( 'plugin-upload') ?>
-               <input type="file" name="pluginzip" />
-               <input type="submit" class="button" value="<?php _e('Install Now') ?>" />
-       </form>
+       <p class="install-help"><?php _e('Search for plugins by keyword, author, or tag.') ?></p>
+       <?php install_search_form(); ?>
 
        <h4><?php _e('Popular tags') ?></h4>
 
        <h4><?php _e('Popular tags') ?></h4>
-       <p><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>
+       <p class="install-help"><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>
        <?php
 
        $api_tags = install_popular_tags();
        <?php
 
        $api_tags = install_popular_tags();
@@ -151,11 +138,13 @@ function install_dashboard() {
        $tags = array();
        foreach ( (array)$api_tags as $tag )
                $tags[ $tag['name'] ] = (object) array(
        $tags = array();
        foreach ( (array)$api_tags as $tag )
                $tags[ $tag['name'] ] = (object) array(
-                                                               'link' => clean_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
+                                                               'link' => esc_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ),
                                                                'name' => $tag['name'],
                                                                'id' => sanitize_title_with_dashes($tag['name']),
                                                                'count' => $tag['count'] );
                                                                'name' => $tag['name'],
                                                                'id' => sanitize_title_with_dashes($tag['name']),
                                                                'count' => $tag['count'] );
+       echo '<p class="popular-tags">';
        echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );
        echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );
+       echo '</p><br class="clear" />';
 }
 
 /**
 }
 
 /**
@@ -167,14 +156,15 @@ function install_search_form(){
        $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
        $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
 
        $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
        $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
 
-       ?><form id="search-plugins" method="post" action="<?php echo admin_url('plugin-install.php?tab=search') ?>">
+       ?><form id="search-plugins" method="post" action="<?php echo admin_url('plugin-install.php?tab=search'); ?>">
                <select name="type" id="typeselector">
                <select name="type" id="typeselector">
-                       <option value="term"<?php selected('term', $type) ?>><?php _e('Term') ?></option>
-                       <option value="author"<?php selected('author', $type) ?>><?php _e('Author') ?></option>
-                       <option value="tag"<?php selected('tag', $type) ?>><?php _e('Tag') ?></option>
+                       <option value="term"<?php selected('term', $type) ?>><?php _e('Term'); ?></option>
+                       <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>
+                       <option value="tag"<?php selected('tag', $type) ?>><?php echo _x('Tag', 'Plugin Installer'); ?></option>
                </select>
                </select>
-               <input type="text" name="s" id="search-field" value="<?php echo attribute_escape($term) ?>" />
-               <input type="submit" name="search" value="<?php echo attribute_escape(__('Search')) ?>" class="button" />
+               <input type="text" name="s" value="<?php echo esc_attr($term) ?>" />
+               <label class="screen-reader-text" for="plugin-search-input"><?php _e('Search Plugins'); ?></label>
+               <input type="submit" id="plugin-search-input" name="search" value="<?php esc_attr_e('Search Plugins'); ?>" class="button" />
        </form><?php
 }
 
        </form><?php
 }
 
@@ -208,6 +198,26 @@ function install_popular($page = 1) {
        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
 }
 
        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
 }
 
+add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
+/**
+ * Upload from zip
+ * @since 2.8.0
+ *
+ * @param string $page
+ */
+function install_plugins_upload( $page = 1 ) {
+?>
+       <h4><?php _e('Install a plugin in .zip format') ?></h4>
+       <p class="install-help"><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p>
+       <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('update.php?action=upload-plugin') ?>">
+               <?php wp_nonce_field( 'plugin-upload') ?>
+               <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
+               <input type="file" id="pluginzip" name="pluginzip" />
+               <input type="submit" class="button" value="<?php esc_attr_e('Install Now') ?>" />
+       </form>
+<?php
+}
+
 add_action('install_plugins_new', 'install_new', 10, 1);
 /**
  * Display new plugins.
 add_action('install_plugins_new', 'install_new', 10, 1);
 /**
  * Display new plugins.
@@ -254,7 +264,8 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
 
        $plugins_allowedtags = array('a' => array('href' => array(),'title' => array(), 'target' => array()),
                                                                'abbr' => array('title' => array()),'acronym' => array('title' => array()),
 
        $plugins_allowedtags = array('a' => array('href' => array(),'title' => array(), 'target' => array()),
                                                                'abbr' => array('title' => array()),'acronym' => array('title' => array()),
-                                                               'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array());
+                                                               'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(),
+                                                               'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array());
 
 ?>
        <div class="tablenav">
 
 ?>
        <div class="tablenav">
@@ -262,7 +273,7 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                <?php do_action('install_plugins_table_header'); ?>
                </div>
                <?php
                <?php do_action('install_plugins_table_header'); ?>
                </div>
                <?php
-                       $url = clean_url($_SERVER['REQUEST_URI']);
+                       $url = esc_url($_SERVER['REQUEST_URI']);
                        if ( ! empty($term) )
                                $url = add_query_arg('s', $term, $url);
                        if ( ! empty($type) )
                        if ( ! empty($term) )
                                $url = add_query_arg('s', $term, $url);
                        if ( ! empty($type) )
@@ -313,7 +324,17 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                        $plugin = (array) $plugin;
 
                                $title = wp_kses($plugin['name'], $plugins_allowedtags);
                                        $plugin = (array) $plugin;
 
                                $title = wp_kses($plugin['name'], $plugins_allowedtags);
-                               $description = wp_kses($plugin['description'], $plugins_allowedtags);
+                               //Limit description to 400char, and remove any HTML.
+                               $description = strip_tags($plugin['description']);
+                               if ( strlen($description) > 400 )
+                                       $description = mb_substr($description, 0, 400) . '&#8230;';
+                               //remove any trailing entities
+                               $description = preg_replace('/&[^;\s]{0,6}$/', '', $description);
+                               //strip leading/trailing & multiple consecutive lines
+                               $description = trim($description);
+                               $description = preg_replace("|(\r?\n)+|", "\n", $description);
+                               //\n => <br>
+                               $description = nl2br($description);
                                $version = wp_kses($plugin['version'], $plugins_allowedtags);
 
                                $name = strip_tags($title . ' ' . $version);
                                $version = wp_kses($plugin['version'], $plugins_allowedtags);
 
                                $name = strip_tags($title . ' ' . $version);
@@ -325,12 +346,12 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                $author = wp_kses($author, $plugins_allowedtags);
 
                                if( isset($plugin['homepage']) )
                                $author = wp_kses($author, $plugins_allowedtags);
 
                                if( isset($plugin['homepage']) )
-                                       $title = '<a target="_blank" href="' . attribute_escape($plugin['homepage']) . '">' . $title . '</a>';
+                                       $title = '<a target="_blank" href="' . esc_attr($plugin['homepage']) . '">' . $title . '</a>';
 
                                $action_links = array();
                                $action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
 
                                $action_links = array();
                                $action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
-                                                                       '&amp;TB_iframe=true&amp;width=600&amp;height=800') . '" class="thickbox onclick" title="' .
-                                                                       attribute_escape($name) . '">' . __('Install') . '</a>';
+                                                                       '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox onclick" title="' .
+                                                                       esc_attr($name) . '">' . __('Install') . '</a>';
 
                                $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
                        ?>
 
                                $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
                        ?>
@@ -338,8 +359,8 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                <td class="name"><?php echo $title; ?></td>
                                <td class="vers"><?php echo $version; ?></td>
                                <td class="vers">
                                <td class="name"><?php echo $title; ?></td>
                                <td class="vers"><?php echo $version; ?></td>
                                <td class="vers">
-                                       <div class="star-holder" title="<?php printf(__ngettext('(based on %s rating)', '(based on %s ratings)', $plugin['num_ratings']), number_format_i18n($plugin['num_ratings'])) ?>">
-                                               <div class="star star-rating" style="width: <?php echo attribute_escape($plugin['rating']) ?>px"></div>
+                                       <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $plugin['num_ratings']), number_format_i18n($plugin['num_ratings'])) ?>">
+                                               <div class="star star-rating" style="width: <?php echo esc_attr($plugin['rating']) ?>px"></div>
                                                <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
                                                <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
                                                <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
                                                <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
                                                <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
                                                <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
@@ -347,7 +368,7 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
                                                <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
                                        </div>
                                </td>
                                                <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
                                        </div>
                                </td>
-                               <td class="desc"><p><?php echo $description, $author; ?></p></td>
+                               <td class="desc"><?php echo $description, $author; ?></td>
                                <td class="action-links"><?php if ( !empty($action_links) )     echo implode(' | ', $action_links); ?></td>
                        </tr>
                        <?php
                                <td class="action-links"><?php if ( !empty($action_links) )     echo implode(' | ', $action_links); ?></td>
                        </tr>
                        <?php
@@ -406,8 +427,8 @@ function install_plugin_information() {
 
                $class = ( $section_name == $section ) ? ' class="current"' : '';
                $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
 
                $class = ( $section_name == $section ) ? ' class="current"' : '';
                $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
-               $href = clean_url($href);
-               $san_title = attribute_escape(sanitize_title_with_dashes($title));
+               $href = esc_url($href);
+               $san_title = esc_attr(sanitize_title_with_dashes($title));
                echo "\t<li><a name='$san_title' target='' href='$href'$class>$title</a></li>\n";
        }
        echo "</ul>\n";
                echo "\t<li><a name='$san_title' target='' href='$href'$class>$title</a></li>\n";
        }
        echo "</ul>\n";
@@ -421,18 +442,20 @@ function install_plugin_information() {
                        $type = 'install';
                        //Check to see if this plugin is known to be installed, and has an update awaiting it.
                        $update_plugins = get_option('update_plugins');
                        $type = 'install';
                        //Check to see if this plugin is known to be installed, and has an update awaiting it.
                        $update_plugins = get_option('update_plugins');
-                       foreach ( (array)$update_plugins->response as $file => $plugin ) {
-                               if ( $plugin->slug === $api->slug ) {
-                                       $type = 'update_available';
-                                       $update_file = $file;
-                                       break;
+                       if ( is_object( $update_plugins ) ) {
+                               foreach ( (array)$update_plugins->response as $file => $plugin ) {
+                                       if ( $plugin->slug === $api->slug ) {
+                                               $type = 'update_available';
+                                               $update_file = $file;
+                                               break;
+                                       }
                                }
                        }
                        if ( 'install' == $type && is_dir( WP_PLUGIN_DIR  . '/' . $api->slug ) ) {
                                $installed_plugin = get_plugins('/' . $api->slug);
                                if ( ! empty($installed_plugin) ) {
                                        $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
                                }
                        }
                        if ( 'install' == $type && is_dir( WP_PLUGIN_DIR  . '/' . $api->slug ) ) {
                                $installed_plugin = get_plugins('/' . $api->slug);
                                if ( ! empty($installed_plugin) ) {
                                        $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
-                                       if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '>') ){
+                                       if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
                                                $type = 'latest_installed';
                                        } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
                                                $type = 'newer_installed';
                                                $type = 'latest_installed';
                                        } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
                                                $type = 'newer_installed';
@@ -450,7 +473,7 @@ function install_plugin_information() {
                                default:
                                case 'install':
                                        if ( current_user_can('install_plugins') ) :
                                default:
                                case 'install':
                                        if ( current_user_can('install_plugins') ) :
-                               ?><a href="<?php echo wp_nonce_url(admin_url('plugin-install.php?tab=install&plugin=' . $api->slug), 'install-plugin_' . $api->slug) ?>" target="_parent"><?php _e('Install Now') ?></a><?php
+                               ?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug) ?>" target="_parent"><?php _e('Install Now') ?></a><?php
                                        endif;
                                break;
                                case 'update_available':
                                        endif;
                                break;
                                case 'update_available':
@@ -485,7 +508,7 @@ function install_plugin_information() {
 <?php endif; if ( ! empty($api->tested) ) : ?>
                        <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li>
 <?php endif; if ( ! empty($api->downloaded) ) : ?>
 <?php endif; if ( ! empty($api->tested) ) : ?>
                        <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li>
 <?php endif; if ( ! empty($api->downloaded) ) : ?>
-                       <li><strong><?php _e('Downloaded:') ?></strong> <?php printf(__ngettext('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>
+                       <li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>
 <?php endif; if ( ! empty($api->slug) ) : ?>
                        <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page &#187;') ?></a></li>
 <?php endif; if ( ! empty($api->homepage) ) : ?>
 <?php endif; if ( ! empty($api->slug) ) : ?>
                        <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page &#187;') ?></a></li>
 <?php endif; if ( ! empty($api->homepage) ) : ?>
@@ -493,22 +516,24 @@ function install_plugin_information() {
 <?php endif; ?>
                </ul>
                <h2><?php _e('Average Rating') ?></h2>
 <?php endif; ?>
                </ul>
                <h2><?php _e('Average Rating') ?></h2>
-               <div class="star-holder" title="<?php printf(__ngettext('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?>">
-                       <div class="star star-rating" style="width: <?php echo attribute_escape($api->rating) ?>px"></div>
+               <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?>">
+                       <div class="star star-rating" style="width: <?php echo esc_attr($api->rating) ?>px"></div>
                        <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
                        <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
                        <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
                        <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
                        <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
                </div>
                        <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
                        <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
                        <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
                        <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
                        <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
                </div>
-               <small><?php printf(__ngettext('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></small>
+               <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></small>
        </div>
        <div id="section-holder" class="wrap">
        <?php
        </div>
        <div id="section-holder" class="wrap">
        <?php
-               if ( version_compare($GLOBALS['wp_version'], $api->tested, '>') )
+               if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )
                        echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
                        echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
-               else if ( version_compare($GLOBALS['wp_version'], $api->requires, '<') )
-                       echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has not been marked as <strong>compatible</strong> with your version of WordPress.') . '</p></div>';
+
+               else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )
+                       echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
+
                foreach ( (array)$api->sections as $section_name => $content ) {
                        $title = $section_name;
                        $title[0] = strtoupper($title[0]);
                foreach ( (array)$api->sections as $section_name => $content ) {
                        $title = $section_name;
                        $title[0] = strtoupper($title[0]);
@@ -517,7 +542,7 @@ function install_plugin_information() {
                        $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/');
                        $content = links_add_target($content, '_blank');
 
                        $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/');
                        $content = links_add_target($content, '_blank');
 
-                       $san_title = attribute_escape(sanitize_title_with_dashes($title));
+                       $san_title = esc_attr(sanitize_title_with_dashes($title));
 
                        $display = ( $section_name == $section ) ? 'block' : 'none';
 
 
                        $display = ( $section_name == $section ) ? 'block' : 'none';
 
@@ -531,364 +556,3 @@ function install_plugin_information() {
        iframe_footer();
        exit;
 }
        iframe_footer();
        exit;
 }
-
-
-add_action('install_plugins_upload', 'upload_plugin');
-function upload_plugin() {
-
-       if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
-               wp_die($uploads['error']);
-
-       if ( !empty($_FILES) )
-               $filename = $_FILES['pluginzip']['name'];
-       else if ( isset($_GET['package']) )
-               $filename = $_GET['package'];
-
-       check_admin_referer('plugin-upload');
-
-       echo '<div class="wrap">';
-       echo '<h2>', sprintf( __('Installing Plugin from file: %s'), basename($filename) ), '</h2>';
-
-       //Handle a newly uploaded file, Else assume it was
-       if ( !empty($_FILES) ) {
-               $filename = wp_unique_filename( $uploads['basedir'], $filename );
-               $local_file = $uploads['basedir'] . '/' . $filename;
-
-               // Move the file to the uploads dir
-               if ( false === @ move_uploaded_file( $_FILES['pluginzip']['tmp_name'], $local_file) )
-                       wp_die( sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path']));
-       } else {
-               $local_file = $uploads['basedir'] . '/' . $filename;
-       }
-
-       do_plugin_install_local_package($local_file, $filename);
-       echo '</div>';
-}
-
-add_action('install_plugins_install', 'install_plugin');
-
-/**
- * Display plugin link and execute install.
- *
- * @since 2.7.0
- */
-function install_plugin() {
-
-       $plugin = isset($_REQUEST['plugin']) ? stripslashes( $_REQUEST['plugin'] ) : '';
-
-       check_admin_referer('install-plugin_' . $plugin);
-       $api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
-
-       if ( is_wp_error($api) )
-               wp_die($api);
-
-       echo '<div class="wrap">';
-       echo '<h2>', sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ), '</h2>';
-
-       do_plugin_install($api->download_link, $api);
-       echo '</div>';
-
-}
-
-/**
- * Retrieve plugin and install.
- *
- * @since 2.7.0
- *
- * @param string $download_url Download URL.
- * @param object $plugin_information Optional. Plugin information
- */
-function do_plugin_install($download_url, $plugin_information = null) {
-       global $wp_filesystem;
-
-       if ( empty($download_url) ) {
-               show_message( __('No plugin Specified') );
-               return;
-       }
-
-       $plugin = isset($_REQUEST['plugin']) ? stripslashes( $_REQUEST['plugin'] ) : '';
-
-       $url = 'plugin-install.php?tab=install';
-       $url = add_query_arg(array('plugin' => $plugin, 'plugin_name' => stripslashes( $_REQUEST['plugin_name'] ), 'download_url' => stripslashes( $_REQUEST['download_url'] ) ), $url);
-
-       $url = wp_nonce_url($url, 'install-plugin_' . $plugin);
-       if ( false === ($credentials = request_filesystem_credentials($url)) )
-               return;
-
-       if ( ! WP_Filesystem($credentials) ) {
-               request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
-               return;
-       }
-
-       if ( $wp_filesystem->errors->get_error_code() ) {
-               foreach ( $wp_filesystem->errors->get_error_messages() as $message )
-                       show_message($message);
-               return;
-       }
-
-       $result = wp_install_plugin( $download_url, 'show_message' );
-
-       if ( is_wp_error($result) ) {
-               show_message($result);
-               show_message( __('Installation Failed') );
-       } else {
-               show_message( sprintf(__('Successfully installed the plugin <strong>%s %s</strong>.'), $plugin_information->name, $plugin_information->version) );
-               $plugin_file = $result;
-
-               $install_actions = apply_filters('install_plugin_complete_actions', array(
-                       'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . attribute_escape(__('Activate this plugin')) . '" target="_parent">' . __('Activate Plugin') . '</a>',
-                       'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . attribute_escape(__('Goto plugins page')) . '" target="_parent">' . __('Return to Plugins page') . '</a>'
-                                                       ), $plugin_information, $plugin_file);
-               if ( ! empty($install_actions) )
-                       show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
-       }
-}
-
-/**
- * Install a plugin from a local file.
- *
- * @since 2.7.0
- *
- * @param string $package Local Plugin zip
- * @param string $filename Optional. Original filename
- * @param object $plugin_information Optional. Plugin information
- */
-function do_plugin_install_local_package($package, $filename = '') {
-       global $wp_filesystem;
-
-       if ( empty($package) ) {
-               show_message( __('No plugin Specified') );
-               return;
-       }
-
-       if ( empty($filename) )
-               $filename = basename($package);
-
-       $url = 'plugin-install.php?tab=upload';
-       $url = add_query_arg(array('package' => $filename), $url);
-
-       $url = wp_nonce_url($url, 'plugin-upload');
-       if ( false === ($credentials = request_filesystem_credentials($url)) )
-               return;
-
-       if ( ! WP_Filesystem($credentials) ) {
-               request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
-               return;
-       }
-
-       if ( $wp_filesystem->errors->get_error_code() ) {
-               foreach ( $wp_filesystem->errors->get_error_messages() as $message )
-                       show_message($message);
-               return;
-       }
-
-       $result = wp_install_plugin_local_package( $package, 'show_message' );
-
-       if ( is_wp_error($result) ) {
-               show_message($result);
-               show_message( __('Installation Failed') );
-       } else {
-               show_message( __('Successfully installed the plugin.') );
-               $plugin_file = $result;
-
-               $install_actions = apply_filters('install_plugin_complete_actions', array(
-                                                       'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
-                                                       'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . __('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
-                                                       ), array(), $plugin_file);
-               if ( ! empty($install_actions) )
-                       show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
-       }
-}
-
-/**
- * Install plugin.
- *
- * @since 2.7.0
- *
- * @param string $package
- * @param string $feedback Optional.
- * @return mixed.
- */
-function wp_install_plugin($package, $feedback = '') {
-       global $wp_filesystem;
-
-       if ( !empty($feedback) )
-               add_filter('install_feedback', $feedback);
-
-       // Is a filesystem accessor setup?
-       if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
-               WP_Filesystem();
-
-       if ( ! is_object($wp_filesystem) )
-               return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
-
-       if ( $wp_filesystem->errors->get_error_code() )
-               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
-
-       //Get the base plugin folder
-       $plugins_dir = $wp_filesystem->wp_plugins_dir();
-       if ( empty($plugins_dir) )
-               return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
-
-       //And the same for the Content directory.
-       $content_dir = $wp_filesystem->wp_content_dir();
-       if( empty($content_dir) )
-               return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
-
-       $plugins_dir = trailingslashit( $plugins_dir );
-       $content_dir = trailingslashit( $content_dir );
-
-       if ( empty($package) )
-               return new WP_Error('no_package', __('Install package not available.'));
-
-       // Download the package
-       apply_filters('install_feedback', sprintf(__('Downloading plugin package from %s'), $package));
-       $download_file = download_url($package);
-
-       if ( is_wp_error($download_file) )
-               return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());
-
-       $working_dir = $content_dir . 'upgrade/' . basename($package, '.zip');
-
-       // Clean up working directory
-       if ( $wp_filesystem->is_dir($working_dir) )
-               $wp_filesystem->delete($working_dir, true);
-
-       apply_filters('install_feedback', __('Unpacking the plugin package'));
-       // Unzip package to working directory
-       $result = unzip_file($download_file, $working_dir);
-
-       // Once extracted, delete the package
-       @unlink($download_file);
-
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
-       $filelist = array_keys( $wp_filesystem->dirlist($working_dir) );
-
-       if( $wp_filesystem->exists( $plugins_dir . $filelist[0] ) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] );
-       }
-
-       apply_filters('install_feedback', __('Installing the plugin'));
-       // Copy new version of plugin into place.
-       $result = copy_dir($working_dir, $plugins_dir);
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
-       $filelist = array_keys( $wp_filesystem->dirlist($working_dir) );
-
-       // Remove working directory
-       $wp_filesystem->delete($working_dir, true);
-
-       if( empty($filelist) )
-               return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
-
-       $folder = $filelist[0];
-       $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
-       $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
-
-       //Return the plugin files name.
-       return  $folder . '/' . $pluginfiles[0];
-}
-
-/**
- * Install plugin from local package
- *
- * @since 2.7.0
- *
- * @param string $package
- * @param string $feedback Optional.
- * @return mixed.
- */
-function wp_install_plugin_local_package($package, $feedback = '') {
-       global $wp_filesystem;
-
-       if ( !empty($feedback) )
-               add_filter('install_feedback', $feedback);
-
-       // Is a filesystem accessor setup?
-       if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
-               WP_Filesystem();
-
-       if ( ! is_object($wp_filesystem) )
-               return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
-
-       if ( $wp_filesystem->errors->get_error_code() )
-               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
-
-       //Get the base plugin folder
-       $plugins_dir = $wp_filesystem->wp_plugins_dir();
-       if ( empty($plugins_dir) )
-               return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
-
-       //And the same for the Content directory.
-       $content_dir = $wp_filesystem->wp_content_dir();
-       if( empty($content_dir) )
-               return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
-
-       $plugins_dir = trailingslashit( $plugins_dir );
-       $content_dir = trailingslashit( $content_dir );
-
-       if ( empty($package) )
-               return new WP_Error('no_package', __('Install package not available.'));
-
-       $working_dir = $content_dir . 'upgrade/' . basename($package, '.zip');
-
-       // Clean up working directory
-       if ( $wp_filesystem->is_dir($working_dir) )
-               $wp_filesystem->delete($working_dir, true);
-
-       apply_filters('install_feedback', __('Unpacking the plugin package'));
-       // Unzip package to working directory
-       $result = unzip_file($package, $working_dir);
-
-       // Once extracted, delete the package
-       unlink($package);
-
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
-       $filelist = array_keys( $wp_filesystem->dirlist($working_dir) );
-
-       if( $wp_filesystem->exists( $plugins_dir . $filelist[0] ) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] );
-       }
-
-       apply_filters('install_feedback', __('Installing the plugin'));
-       // Copy new version of plugin into place.
-       $result = copy_dir($working_dir, $plugins_dir);
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
-       $filelist = array_keys( $wp_filesystem->dirlist($working_dir) );
-
-       // Remove working directory
-       $wp_filesystem->delete($working_dir, true);
-
-       if( empty($filelist) )
-               return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
-
-       $folder = $filelist[0];
-       $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
-       $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
-
-       //Return the plugin files name.
-       return  $folder . '/' . $pluginfiles[0];
-}
-
-?>
index 0210c5efea1a39722407927f5d6f7166bac705ac..4f469c9611806ea720da43e73c0f334a68267d20 100644 (file)
@@ -86,7 +86,7 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
 
        foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) {
                if ( !empty( ${$field} ) )
 
        foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) {
                if ( !empty( ${$field} ) )
-                       ${$field} = trim(${$field}[1]);
+                       ${$field} = _cleanup_header_comment(${$field}[1]);
                else
                        ${$field} = '';
        }
                else
                        ${$field} = '';
        }
@@ -97,11 +97,12 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
                                'TextDomain' => $text_domain, 'DomainPath' => $domain_path
                                );
        if ( $markup || $translate )
                                'TextDomain' => $text_domain, 'DomainPath' => $domain_path
                                );
        if ( $markup || $translate )
-               $plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate);
+               $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate);
+
        return $plugin_data;
 }
 
        return $plugin_data;
 }
 
-function _get_plugin_data_markup_translate($plugin_data, $markup = true, $translate = true) {
+function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) {
 
        //Translate fields
        if( $translate && ! empty($plugin_data['TextDomain']) ) {
 
        //Translate fields
        if( $translate && ! empty($plugin_data['TextDomain']) ) {
@@ -140,6 +141,46 @@ function _get_plugin_data_markup_translate($plugin_data, $markup = true, $transl
        return $plugin_data;
 }
 
        return $plugin_data;
 }
 
+/**
+ * Get a list of a plugin's files.
+ *
+ * @since 2.8.0
+ *
+ * @param string $plugin Plugin ID
+ * @return array List of files relative to the plugin root.
+ */
+function get_plugin_files($plugin) {
+       $plugin_file = WP_PLUGIN_DIR . '/' . $plugin;
+       $dir = dirname($plugin_file);
+       $plugin_files = array($plugin);
+       if ( is_dir($dir) && $dir != WP_PLUGIN_DIR ) {
+               $plugins_dir = @ opendir( $dir );
+               if ( $plugins_dir ) {
+                       while (($file = readdir( $plugins_dir ) ) !== false ) {
+                               if ( substr($file, 0, 1) == '.' )
+                                       continue;
+                               if ( is_dir( $dir . '/' . $file ) ) {
+                                       $plugins_subdir = @ opendir( $dir . '/' . $file );
+                                       if ( $plugins_subdir ) {
+                                               while (($subfile = readdir( $plugins_subdir ) ) !== false ) {
+                                                       if ( substr($subfile, 0, 1) == '.' )
+                                                               continue;
+                                                       $plugin_files[] = plugin_basename("$dir/$file/$subfile");
+                                               }
+                                               @closedir( $plugins_subdir );
+                                       }
+                               } else {
+                                       if ( plugin_basename("$dir/$file") != $plugin )
+                                               $plugin_files[] = plugin_basename("$dir/$file");
+                               }
+                       }
+                       @closedir( $plugins_dir );
+               }
+       }
+
+       return $plugin_files;
+}
+
 /**
  * Check the plugins directory and retrieve all plugin files with plugin data.
  *
 /**
  * Check the plugins directory and retrieve all plugin files with plugin data.
  *
@@ -175,6 +216,7 @@ function get_plugins($plugin_folder = '') {
 
        // Files in wp-content/plugins directory
        $plugins_dir = @ opendir( $plugin_root);
 
        // Files in wp-content/plugins directory
        $plugins_dir = @ opendir( $plugin_root);
+       $plugin_files = array();
        if ( $plugins_dir ) {
                while (($file = readdir( $plugins_dir ) ) !== false ) {
                        if ( substr($file, 0, 1) == '.' )
        if ( $plugins_dir ) {
                while (($file = readdir( $plugins_dir ) ) !== false ) {
                        if ( substr($file, 0, 1) == '.' )
@@ -198,7 +240,7 @@ function get_plugins($plugin_folder = '') {
        @closedir( $plugins_dir );
        @closedir( $plugins_subdir );
 
        @closedir( $plugins_dir );
        @closedir( $plugins_subdir );
 
-       if ( !$plugins_dir || !$plugin_files )
+       if ( !$plugins_dir || empty($plugin_files) )
                return $wp_plugins;
 
        foreach ( $plugin_files as $plugin_file ) {
                return $wp_plugins;
 
        foreach ( $plugin_files as $plugin_file ) {
@@ -391,14 +433,10 @@ function delete_plugins($plugins, $redirect = '' ) {
                return;
        }
 
                return;
        }
 
-       if ( $wp_filesystem->errors->get_error_code() ) {
-               return $wp_filesystem->errors;
-       }
-
        if ( ! is_object($wp_filesystem) )
                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
        if ( ! is_object($wp_filesystem) )
                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
-       if ( $wp_filesystem->errors->get_error_code() )
+       if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
                return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
 
        //Get the base plugin folder
                return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
 
        //Get the base plugin folder
@@ -430,7 +468,10 @@ function delete_plugins($plugins, $redirect = '' ) {
                return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
 
        // Force refresh of plugin update information
                return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
 
        // Force refresh of plugin update information
-       delete_option('update_plugins');
+       if ( $current = get_transient('update_plugins') ) {
+               unset( $current->response[ $plugin_file ] );
+               set_transient('update_plugins', $current);
+       }
 
        return true;
 }
 
        return true;
 }
@@ -476,6 +517,9 @@ function validate_plugin($plugin) {
        if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
                return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
 
        if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
                return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
 
+       $installed_plugins = get_plugins();
+       if ( ! isset($installed_plugins[$plugin]) )
+               return new WP_Error('no_plugin_header', __('The plugin does not have a valid header.'));
        return 0;
 }
 
        return 0;
 }
 
@@ -553,6 +597,8 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
 
        if ( empty($icon_url) )
                $icon_url = 'images/generic.png';
 
        if ( empty($icon_url) )
                $icon_url = 'images/generic.png';
+       elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') )
+               $icon_url = 'https://' . substr($icon_url, 7);
 
        $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
 
 
        $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
 
@@ -593,6 +639,8 @@ function add_utility_page( $page_title, $menu_title, $access_level, $file, $func
 
        if ( empty($icon_url) )
                $icon_url = 'images/generic.png';
 
        if ( empty($icon_url) )
                $icon_url = 'images/generic.png';
+       elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') )
+               $icon_url = 'https://' . substr($icon_url, 7);
 
        $_wp_last_utility_menu++;
 
 
        $_wp_last_utility_menu++;
 
@@ -623,7 +671,7 @@ function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $fi
        // parent file someone is trying to link back to the parent manually.  In
        // this case, don't automatically add a link back to avoid duplication.
        if (!isset( $submenu[$parent] ) && $file != $parent  ) {
        // parent file someone is trying to link back to the parent manually.  In
        // this case, don't automatically add a link back to avoid duplication.
        if (!isset( $submenu[$parent] ) && $file != $parent  ) {
-               foreach ( $menu as $parent_menu ) {
+               foreach ( (array)$menu as $parent_menu ) {
                        if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
                                $submenu[$parent][] = $parent_menu;
                }
                        if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
                                $submenu[$parent][] = $parent_menu;
                }
@@ -721,7 +769,7 @@ function get_admin_page_parent( $parent = '' ) {
 */
 
        if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
 */
 
        if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
-               foreach ( $menu as $parent_menu ) {
+               foreach ( (array)$menu as $parent_menu ) {
                        if ( $parent_menu[2] == $plugin_page ) {
                                $parent_file = $plugin_page;
                                if ( isset( $_wp_real_parent_file[$parent_file] ) )
                        if ( $parent_menu[2] == $plugin_page ) {
                                $parent_file = $plugin_page;
                                if ( isset( $_wp_real_parent_file[$parent_file] ) )
@@ -744,7 +792,7 @@ function get_admin_page_parent( $parent = '' ) {
                return $parent_file;
        }
 
                return $parent_file;
        }
 
-       foreach (array_keys( $submenu ) as $parent) {
+       foreach (array_keys( (array)$submenu ) as $parent) {
                foreach ( $submenu[$parent] as $submenu_array ) {
                        if ( isset( $_wp_real_parent_file[$parent] ) )
                                $parent = $_wp_real_parent_file[$parent];
                foreach ( $submenu[$parent] as $submenu_array ) {
                        if ( isset( $_wp_real_parent_file[$parent] ) )
                                $parent = $_wp_real_parent_file[$parent];
@@ -780,7 +828,7 @@ function get_admin_page_title() {
        $parent = $parent1 = get_admin_page_parent();
 
        if ( empty ( $parent) ) {
        $parent = $parent1 = get_admin_page_parent();
 
        if ( empty ( $parent) ) {
-               foreach ( $menu as $menu_array ) {
+               foreach ( (array)$menu as $menu_array ) {
                        if ( isset( $menu_array[3] ) ) {
                                if ( $menu_array[2] == $pagenow ) {
                                        $title = $menu_array[3];
                        if ( isset( $menu_array[3] ) ) {
                                if ( $menu_array[2] == $pagenow ) {
                                        $title = $menu_array[3];
@@ -818,6 +866,18 @@ function get_admin_page_title() {
                                }
                        }
                }
                                }
                        }
                }
+               if ( !isset($title) || empty ( $title ) ) {
+                       foreach ( $menu as $menu_array ) {
+                               if ( isset( $plugin_page ) &&
+                                       ($plugin_page == $menu_array[2] ) &&
+                                       ($pagenow == 'admin.php' ) &&
+                                       ($parent1 == $menu_array[2] ) )
+                                       {
+                                               $title = $menu_array[3];
+                                               return $menu_array[3];
+                                       }
+                       }
+               }
        }
 
        return $title;
        }
 
        return $title;
@@ -969,7 +1029,7 @@ function add_option_update_handler($option_group, $option_name, $sanitize_callba
  */
 function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
        global $new_whitelist_options;
  */
 function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
        global $new_whitelist_options;
-       $pos = array_search( $option_name, $new_whitelist_options );
+       $pos = array_search( $option_name, (array) $new_whitelist_options );
        if ( $pos !== false )
                unset( $new_whitelist_options[ $option_group ][ $pos ] );
        if ( $sanitize_callback != '' )
        if ( $pos !== false )
                unset( $new_whitelist_options[ $option_group ][ $pos ] );
        if ( $sanitize_callback != '' )
@@ -1041,9 +1101,11 @@ function remove_option_whitelist( $del_options, $options = '' ) {
        }
        foreach( $del_options as $page => $keys ) {
                foreach( $keys as $key ) {
        }
        foreach( $del_options as $page => $keys ) {
                foreach( $keys as $key ) {
-                       $pos = array_search( $key, $whitelist_options[ $page ] );
-                       if( $pos !== false )
-                               unset( $whitelist_options[ $page ][ $pos ] );
+                       if ( isset($whitelist_options[ $page ]) && is_array($whitelist_options[ $page ]) ) {
+                               $pos = array_search( $key, $whitelist_options[ $page ] );
+                               if( $pos !== false )
+                                       unset( $whitelist_options[ $page ][ $pos ] );
+                       }
                }
        }
        return $whitelist_options;
                }
        }
        return $whitelist_options;
@@ -1057,7 +1119,7 @@ function remove_option_whitelist( $del_options, $options = '' ) {
  * @param string $option_group A settings group name.  This should match the group name used in register_setting().
  */
 function settings_fields($option_group) {
  * @param string $option_group A settings group name.  This should match the group name used in register_setting().
  */
 function settings_fields($option_group) {
-       echo "<input type='hidden' name='option_page' value='$option_group' />";
+       echo "<input type='hidden' name='option_page' value='" . esc_attr($option_group) . "' />";
        echo '<input type="hidden" name="action" value="update" />';
        wp_nonce_field("$option_group-options");
 }
        echo '<input type="hidden" name="action" value="update" />';
        wp_nonce_field("$option_group-options");
 }
index 178162165a019b036ae1209e2722d0d8ed75997e..c7acf91563f9eec5b57c62aa1a54054e84d6c5fc 100644 (file)
@@ -319,9 +319,9 @@ function bulk_edit_posts( $post_data = null ) {
  */
 function get_default_post_to_edit() {
        if ( !empty( $_REQUEST['post_title'] ) )
  */
 function get_default_post_to_edit() {
        if ( !empty( $_REQUEST['post_title'] ) )
-               $post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
+               $post_title = esc_html( stripslashes( $_REQUEST['post_title'] ));
        else if ( !empty( $_REQUEST['popuptitle'] ) ) {
        else if ( !empty( $_REQUEST['popuptitle'] ) ) {
-               $post_title = wp_specialchars( stripslashes( $_REQUEST['popuptitle'] ));
+               $post_title = esc_html( stripslashes( $_REQUEST['popuptitle'] ));
                $post_title = funky_javascript_fix( $post_title );
        } else {
                $post_title = '';
                $post_title = funky_javascript_fix( $post_title );
        } else {
                $post_title = '';
@@ -329,16 +329,16 @@ function get_default_post_to_edit() {
 
        $post_content = '';
        if ( !empty( $_REQUEST['content'] ) )
 
        $post_content = '';
        if ( !empty( $_REQUEST['content'] ) )
-               $post_content = wp_specialchars( stripslashes( $_REQUEST['content'] ));
+               $post_content = esc_html( stripslashes( $_REQUEST['content'] ));
        else if ( !empty( $post_title ) ) {
        else if ( !empty( $post_title ) ) {
-               $text       = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
+               $text       = esc_html( stripslashes( urldecode( $_REQUEST['text'] ) ) );
                $text       = funky_javascript_fix( $text);
                $text       = funky_javascript_fix( $text);
-               $popupurl   = clean_url($_REQUEST['popupurl']);
+               $popupurl   = esc_url($_REQUEST['popupurl']);
                $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
        }
 
        if ( !empty( $_REQUEST['excerpt'] ) )
                $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
        }
 
        if ( !empty( $_REQUEST['excerpt'] ) )
-               $post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
+               $post_excerpt = esc_html( stripslashes( $_REQUEST['excerpt'] ));
        else
                $post_excerpt = '';
 
        else
                $post_excerpt = '';
 
@@ -346,6 +346,7 @@ function get_default_post_to_edit() {
        $post->post_name = '';
        $post->post_author = '';
        $post->post_date = '';
        $post->post_name = '';
        $post->post_author = '';
        $post->post_date = '';
+       $post->post_date_gmt = '';
        $post->post_password = '';
        $post->post_status = 'draft';
        $post->post_type = 'post';
        $post->post_password = '';
        $post->post_status = 'draft';
        $post->post_type = 'post';
@@ -397,30 +398,42 @@ function get_post_to_edit( $id ) {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Determine if a post exists based on title, content, and date
  *
  * @since unknown
  *
  *
  * @since unknown
  *
- * @param unknown_type $title
- * @param unknown_type $content
- * @param unknown_type $post_date
- * @return unknown
+ * @param string $title Post title
+ * @param string $content Optional post content
+ * @param string $date Optional post date
+ * @return int Post ID if post exists, 0 otherwise.
  */
  */
-function post_exists($title, $content = '', $post_date = '') {
+function post_exists($title, $content = '', $date = '') {
        global $wpdb;
 
        global $wpdb;
 
-       $title = stripslashes($title);
-       $content = stripslashes($content);
-       $post_date = stripslashes($post_date);
+       $post_title = stripslashes( sanitize_post_field( 'post_title', $title, 0, 'db' ) );
+       $post_content = stripslashes( sanitize_post_field( 'post_content', $content, 0, 'db' ) );
+       $post_date = stripslashes( sanitize_post_field( 'post_date', $date, 0, 'db' ) );
 
 
-       if (!empty ($post_date))
-               $post_date = $wpdb->prepare("AND post_date = %s", $post_date);
+       $query = "SELECT ID FROM $wpdb->posts WHERE 1=1";
+       $args = array();
 
 
-       if (!empty ($title))
-               return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s $post_date", $title) );
-       else
-               if (!empty ($content))
-                       return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_content = %s $post_date", $content) );
+       if ( !empty ( $date ) ) {
+               $query .= ' AND post_date = %s';
+               $args[] = $post_date;
+       }
+
+       if ( !empty ( $title ) ) {
+               $query .= ' AND post_title = %s';
+               $args[] = $post_title;
+       }
+
+       if ( !empty ( $content ) ) {
+               $query .= 'AND post_content = %s';
+               $args[] = $post_content;
+       }
+
+       if ( !empty ( $args ) )
+               return $wpdb->get_var( $wpdb->prepare($query, $args) );
 
        return 0;
 }
 
        return 0;
 }
@@ -664,10 +677,13 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
        if ( in_array($meta_key, $protected) )
                return false;
 
        if ( in_array($meta_key, $protected) )
                return false;
 
+       if ( '' === trim( $meta_value ) )
+               return false;
+
        $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
        wp_cache_delete($post_id, 'post_meta');
 
        $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
        wp_cache_delete($post_id, 'post_meta');
 
-       $meta_value = maybe_serialize( stripslashes( $meta_value ));
+       $meta_value = maybe_serialize( stripslashes( $meta_value ) );
        $meta_id = (int) $meta_id;
 
        $data  = compact( 'meta_key', 'meta_value' );
        $meta_id = (int) $meta_id;
 
        $data  = compact( 'meta_key', 'meta_value' );
@@ -743,7 +759,7 @@ function _relocate_children( $old_ID, $new_ID ) {
        global $wpdb;
        $old_ID = (int) $old_ID;
        $new_ID = (int) $new_ID;
        global $wpdb;
        $old_ID = (int) $old_ID;
        $new_ID = (int) $new_ID;
-       return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
+       return $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('post_parent' => $old_ID) );
 }
 
 /**
 }
 
 /**
@@ -774,11 +790,11 @@ function wp_edit_posts_query( $q = false ) {
        $q['m']   = isset($q['m']) ? (int) $q['m'] : 0;
        $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
        $post_stati  = array(   //      array( adj, noun )
        $q['m']   = isset($q['m']) ? (int) $q['m'] : 0;
        $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
        $post_stati  = array(   //      array( adj, noun )
-                               'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')),
-                               'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')),
-                               'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
-                               'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
-                               'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
+                               'publish' => array(_x('Published', 'post'), __('Published posts'), _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')),
+                               'future' => array(_x('Scheduled', 'post'), __('Scheduled posts'), _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')),
+                               'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
+                               'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
+                               'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
                        );
 
        $post_stati = apply_filters('post_stati', $post_stati);
                        );
 
        $post_stati = apply_filters('post_stati', $post_stati);
@@ -802,7 +818,12 @@ function wp_edit_posts_query( $q = false ) {
                $orderby = 'date';
        }
 
                $orderby = 'date';
        }
 
-       wp("post_type=post&what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");
+       $posts_per_page = get_user_option('edit_per_page');
+       if ( empty($posts_per_page) )
+               $posts_per_page = 15;
+       $posts_per_page = apply_filters('edit_posts_per_page', $posts_per_page);
+
+       wp("post_type=post&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby");
 
        return array($post_stati, $avail_post_stati);
 }
 
        return array($post_stati, $avail_post_stati);
 }
@@ -838,11 +859,14 @@ function wp_edit_attachments_query( $q = false ) {
        $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
        $q['post_type'] = 'attachment';
        $q['post_status'] = 'any';
        $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
        $q['post_type'] = 'attachment';
        $q['post_status'] = 'any';
-       $q['posts_per_page'] = 15;
+       $media_per_page = get_user_option('upload_per_page');
+       if ( empty($media_per_page) )
+               $media_per_page = 20;
+       $q['posts_per_page'] = $media_per_page;
        $post_mime_types = array(       //      array( adj, noun )
        $post_mime_types = array(       //      array( adj, noun )
-                               'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),
-                               'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),
-                               'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
+                               'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),
+                               'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),
+                               'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
                        );
        $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
                        );
        $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
@@ -871,7 +895,7 @@ function postbox_classes( $id, $page ) {
        $current_user = wp_get_current_user();
        if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) {
                if ( !is_array( $closed ) ) return '';
        $current_user = wp_get_current_user();
        if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) {
                if ( !is_array( $closed ) ) return '';
-               return in_array( $id, $closed )? 'if-js-closed' : '';
+               return in_array( $id, $closed )? 'closed' : '';
        } else {
                return '';
        }
        } else {
                return '';
        }
@@ -903,13 +927,15 @@ function get_sample_permalink($id, $title=null, $name = null) {
                $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
        }
 
                $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
        }
 
+       $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
+
        // If the user wants to set a new name -- override the current one
        // Note: if empty name is supplied -- use the title instead, see #6072
        if (!is_null($name)) {
                $post->post_name = sanitize_title($name? $name : $title, $post->ID);
        }
 
        // If the user wants to set a new name -- override the current one
        // Note: if empty name is supplied -- use the title instead, see #6072
        if (!is_null($name)) {
                $post->post_name = sanitize_title($name? $name : $title, $post->ID);
        }
 
-       $post->filter = 'sample'; 
+       $post->filter = 'sample';
 
        $permalink = get_permalink($post, true);
 
 
        $permalink = get_permalink($post, true);
 
@@ -943,12 +969,22 @@ function get_sample_permalink($id, $title=null, $name = null) {
  * @param unknown_type $new_slug
  * @return unknown
  */
  * @param unknown_type $new_slug
  * @return unknown
  */
-function get_sample_permalink_html($id, $new_title=null, $new_slug=null) {
+function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
        $post = &get_post($id);
        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
        $post = &get_post($id);
        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
-       if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) {
-               return '';
+       if ( 'publish' == $post->post_status )
+               $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page');
+
+       if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
+               $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n";
+               if ( current_user_can( 'manage_options' ) )
+                       $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
+               if ( isset($view_post) )
+                       $return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n";
+
+               return $return;
        }
        }
+
        $title = __('Click to edit this part of the permalink');
        if (function_exists('mb_strlen')) {
                if (mb_strlen($post_name) > 30) {
        $title = __('Click to edit this part of the permalink');
        if (function_exists('mb_strlen')) {
                if (mb_strlen($post_name) > 30) {
@@ -963,10 +999,16 @@ function get_sample_permalink_html($id, $new_title=null, $new_slug=null) {
                        $post_name_abridged = $post_name;
                }
        }
                        $post_name_abridged = $post_name;
                }
        }
-       $post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name_abridged.'</span><span id="editable-post-name-full">'.$post_name.'</span>';
+
+       $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
+       $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
-       $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
+       $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";
+       $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
+       if ( isset($view_post) )
+               $return .= "<span id='view-post-btn'><a href='$view_link' class='button' target='_blank'>$view_post</a></span>\n";
+
        return $return;
 }
 
        return $return;
 }
 
@@ -1039,6 +1081,9 @@ function wp_create_post_autosave( $post_id ) {
                return wp_update_post( $new_autosave );
        }
 
                return wp_update_post( $new_autosave );
        }
 
+       // _wp_put_post_revision() expects unescaped.
+       $_POST = stripslashes_deep($_POST);
+
        // Otherwise create the new autosave as a special post revision
        return _wp_put_post_revision( $_POST, true );
 }
        // Otherwise create the new autosave as a special post revision
        return _wp_put_post_revision( $_POST, true );
 }
@@ -1107,20 +1152,24 @@ function post_preview() {
 /**
  * Adds the TinyMCE editor used on the Write and Edit screens.
  *
 /**
  * Adds the TinyMCE editor used on the Write and Edit screens.
  *
- * Has option to output a trimmed down version used in Press This.
- *
  * @package WordPress
  * @since 2.7
  * @package WordPress
  * @since 2.7
+ *
+ * TinyMCE is loaded separately from other Javascript by using wp-tinymce.php. It outputs concatenated
+ * and optionaly pre-compressed version of the core and all default plugins. Additional plugins are loaded
+ * directly by TinyMCE using non-blocking method. Custom plugins can be refreshed by adding a query string
+ * to the URL when queueing them with the mce_external_plugins filter.
+ *
+ * @param bool $teeny optional Output a trimmed down version used in Press This.
  */
 function wp_tiny_mce( $teeny = false ) {
  */
 function wp_tiny_mce( $teeny = false ) {
+       global $concatenate_scripts, $compress_scripts, $tinymce_version;
+
        if ( ! user_can_richedit() )
                return;
 
        $baseurl = includes_url('js/tinymce');
 
        if ( ! user_can_richedit() )
                return;
 
        $baseurl = includes_url('js/tinymce');
 
-       $mce_css = $baseurl . '/wordpress.css';
-       $mce_css = apply_filters('mce_css', $mce_css);
-
        $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
 
        /*
        $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
 
        /*
@@ -1135,7 +1184,7 @@ function wp_tiny_mce( $teeny = false ) {
                $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'autosave', 'fullscreen') );
                $ext_plugins = '';
        } else {
                $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'autosave', 'fullscreen') );
                $ext_plugins = '';
        } else {
-               $plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery' );
+               $plugins = array( 'safari', 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus' );
 
                /*
                The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
 
                /*
                The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
@@ -1146,7 +1195,7 @@ function wp_tiny_mce( $teeny = false ) {
                */
                $mce_external_plugins = apply_filters('mce_external_plugins', array());
 
                */
                $mce_external_plugins = apply_filters('mce_external_plugins', array());
 
-               $ext_plugins = "\n";
+               $ext_plugins = '';
                if ( ! empty($mce_external_plugins) ) {
 
                        /*
                if ( ! empty($mce_external_plugins) ) {
 
                        /*
@@ -1239,8 +1288,8 @@ function wp_tiny_mce( $teeny = false ) {
 
        // TinyMCE init settings
        $initArray = array (
 
        // TinyMCE init settings
        $initArray = array (
-               'mode' => 'none',
-               'onpageload' => 'switchEditors.edInit',
+               'mode' => 'specific_textareas',
+               'editor_selector' => 'theEditor',
                'width' => '100%',
                'theme' => 'advanced',
                'skin' => 'wp_theme',
                'width' => '100%',
                'theme' => 'advanced',
                'skin' => 'wp_theme',
@@ -1261,19 +1310,21 @@ function wp_tiny_mce( $teeny = false ) {
                'convert_urls' => false,
                'apply_source_formatting' => false,
                'remove_linebreaks' => true,
                'convert_urls' => false,
                'apply_source_formatting' => false,
                'remove_linebreaks' => true,
-               'paste_convert_middot_lists' => true,
-               'paste_remove_spans' => true,
-               'paste_remove_styles' => true,
                'gecko_spellcheck' => true,
                'entities' => '38,amp,60,lt,62,gt',
                'accessibility_focus' => true,
                'gecko_spellcheck' => true,
                'entities' => '38,amp,60,lt,62,gt',
                'accessibility_focus' => true,
-               'tab_focus' => ':prev,:next',
-               'content_css' => "$mce_css",
+               'tabfocus_elements' => 'major-publishing-actions',
+               'media_strict' => false,
                'save_callback' => 'switchEditors.saveCallback',
                'wpeditimage_disable_captions' => $no_captions,
                'plugins' => "$plugins"
        );
 
                'save_callback' => 'switchEditors.saveCallback',
                'wpeditimage_disable_captions' => $no_captions,
                'plugins' => "$plugins"
        );
 
+       $mce_css = trim(apply_filters('mce_css', ''), ' ,');
+
+       if ( ! empty($mce_css) )
+               $initArray['content_css'] = "$mce_css";
+
        // For people who really REALLY know what they're doing with TinyMCE
        // You can modify initArray to add, remove, change elements of the config before tinyMCE.init
        // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
        // For people who really REALLY know what they're doing with TinyMCE
        // You can modify initArray to add, remove, change elements of the config before tinyMCE.init
        // Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
@@ -1284,9 +1335,26 @@ function wp_tiny_mce( $teeny = false ) {
                $initArray = apply_filters('tiny_mce_before_init', $initArray);
        }
 
                $initArray = apply_filters('tiny_mce_before_init', $initArray);
        }
 
-       $language = $initArray['language'];
+       if ( empty($initArray['theme_advanced_buttons3']) && !empty($initArray['theme_advanced_buttons4']) ) {
+               $initArray['theme_advanced_buttons3'] = $initArray['theme_advanced_buttons4'];
+               $initArray['theme_advanced_buttons4'] = '';
+       }
 
 
-       $ver = apply_filters('tiny_mce_version', '3101');
+       if ( ! isset($concatenate_scripts) )
+               script_concat_settings();
+
+       $language = $initArray['language'];
+       $zip = $compress_scripts ? 1 : 0;
+
+       /**
+        * Deprecated
+        *
+        * The tiny_mce_version filter is not needed since external plugins are loaded directly by TinyMCE.
+        * These plugins can be refreshed by appending query string to the URL passed to mce_external_plugins filter.
+        * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code).
+        */
+       $version = apply_filters('tiny_mce_version', '');
+       $version = 'ver=' . $tinymce_version . $version;
 
        if ( 'en' != $language )
                include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
 
        if ( 'en' != $language )
                include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
@@ -1302,52 +1370,35 @@ function wp_tiny_mce( $teeny = false ) {
 tinyMCEPreInit = {
        base : "<?php echo $baseurl; ?>",
        suffix : "",
 tinyMCEPreInit = {
        base : "<?php echo $baseurl; ?>",
        suffix : "",
-       query : "ver=<?php echo $ver; ?>",
+       query : "<?php echo $version; ?>",
        mceInit : {<?php echo $mce_options; ?>},
        mceInit : {<?php echo $mce_options; ?>},
-
-       go : function() {
-               var t = this, sl = tinymce.ScriptLoader, ln = t.mceInit.language, th = t.mceInit.theme, pl = t.mceInit.plugins;
-
-               sl.markDone(t.base + '/langs/' + ln + '.js');
-
-               sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '.js');
-               sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '_dlg.js');
-
-               tinymce.each(pl.split(','), function(n) {
-                       if (n && n.charAt(0) != '-') {
-                               sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '.js');
-                               sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '_dlg.js');
-                       }
-               });
-       },
-
-       load_ext : function(url,lang) {
-               var sl = tinymce.ScriptLoader;
-
-               sl.markDone(url + '/langs/' + lang + '.js');
-               sl.markDone(url + '/langs/' + lang + '_dlg.js');
-       }
+       load_ext : function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
 };
 /* ]]> */
 </script>
 };
 /* ]]> */
 </script>
-<script type="text/javascript" src="<?php echo $baseurl; ?>/tiny_mce.js?ver=<?php echo $ver; ?>"></script>
-<?php if ( 'en' != $language && isset($lang) ) { ?>
+
+<?php
+       if ( $concatenate_scripts )
+               echo "<script type='text/javascript' src='$baseurl/wp-tinymce.php?c=$zip&amp;$version'></script>\n";
+       else
+               echo "<script type='text/javascript' src='$baseurl/tiny_mce.js?$version'></script>\n";
+
+       if ( 'en' != $language && isset($lang) )
+               echo "<script type='text/javascript'>\n$lang\n</script>\n";
+       else
+               echo "<script type='text/javascript' src='$baseurl/langs/wp-langs-en.js?$version'></script>\n";
+?>
+
 <script type="text/javascript">
 <script type="text/javascript">
-<?php echo $lang; ?>
-</script>
+/* <![CDATA[ */
+<?php if ( $ext_plugins ) echo "$ext_plugins\n"; ?>
+<?php if ( $concatenate_scripts ) { ?>
+tinyMCEPreInit.go();
 <?php } else { ?>
 <?php } else { ?>
-<script type="text/javascript" src="<?php echo $baseurl; ?>/langs/wp-langs-en.js?ver=<?php echo $ver; ?>"></script>
+(function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.mceInit.language,th=t.mceInit.theme,pl=t.mceInit.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();
 <?php } ?>
 <?php } ?>
-<script type="text/javascript">
-<?php if ( $ext_plugins ) echo $ext_plugins; ?>
-
-// Mark translations as done
-tinyMCEPreInit.go();
-
-// Init
 tinyMCE.init(tinyMCEPreInit.mceInit);
 tinyMCE.init(tinyMCEPreInit.mceInit);
+/* ]]> */
 </script>
 </script>
-
 <?php
 }
 <?php
 }
-?>
index 1f9c5be59c60e452a807ad5781bd280ab282d52d..53ec246d72312e09f6ffea5c59ef60d13804fd3f 100644 (file)
@@ -28,7 +28,7 @@ if ( $wpdb->has_cap( 'collation' ) ) {
 
 /** Create WordPress database tables SQL */
 $wp_queries = "CREATE TABLE $wpdb->terms (
 
 /** Create WordPress database tables SQL */
 $wp_queries = "CREATE TABLE $wpdb->terms (
- term_id bigint(20) NOT NULL auto_increment,
+ term_id bigint(20) unsigned NOT NULL auto_increment,
  name varchar(200) NOT NULL default '',
  slug varchar(200) NOT NULL default '',
  term_group bigint(10) NOT NULL default 0,
  name varchar(200) NOT NULL default '',
  slug varchar(200) NOT NULL default '',
  term_group bigint(10) NOT NULL default 0,
@@ -37,25 +37,26 @@ $wp_queries = "CREATE TABLE $wpdb->terms (
  KEY name (name)
 ) $charset_collate;
 CREATE TABLE $wpdb->term_taxonomy (
  KEY name (name)
 ) $charset_collate;
 CREATE TABLE $wpdb->term_taxonomy (
- term_taxonomy_id bigint(20) NOT NULL auto_increment,
- term_id bigint(20) NOT NULL default 0,
+ term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment,
+ term_id bigint(20) unsigned NOT NULL default 0,
  taxonomy varchar(32) NOT NULL default '',
  description longtext NOT NULL,
  taxonomy varchar(32) NOT NULL default '',
  description longtext NOT NULL,
- parent bigint(20) NOT NULL default 0,
+ parent bigint(20) unsigned NOT NULL default 0,
  count bigint(20) NOT NULL default 0,
  PRIMARY KEY  (term_taxonomy_id),
  count bigint(20) NOT NULL default 0,
  PRIMARY KEY  (term_taxonomy_id),
- UNIQUE KEY term_id_taxonomy (term_id,taxonomy)
+ UNIQUE KEY term_id_taxonomy (term_id,taxonomy),
+ KEY taxonomy (taxonomy)
 ) $charset_collate;
 CREATE TABLE $wpdb->term_relationships (
 ) $charset_collate;
 CREATE TABLE $wpdb->term_relationships (
- object_id bigint(20) NOT NULL default 0,
- term_taxonomy_id bigint(20) NOT NULL default 0,
+ object_id bigint(20) unsigned NOT NULL default 0,
+ term_taxonomy_id bigint(20) unsigned NOT NULL default 0,
  term_order int(11) NOT NULL default 0,
  PRIMARY KEY  (object_id,term_taxonomy_id),
  KEY term_taxonomy_id (term_taxonomy_id)
 ) $charset_collate;
 CREATE TABLE $wpdb->comments (
   comment_ID bigint(20) unsigned NOT NULL auto_increment,
  term_order int(11) NOT NULL default 0,
  PRIMARY KEY  (object_id,term_taxonomy_id),
  KEY term_taxonomy_id (term_taxonomy_id)
 ) $charset_collate;
 CREATE TABLE $wpdb->comments (
   comment_ID bigint(20) unsigned NOT NULL auto_increment,
-  comment_post_ID int(11) NOT NULL default '0',
+  comment_post_ID bigint(20) unsigned NOT NULL default '0',
   comment_author tinytext NOT NULL,
   comment_author_email varchar(100) NOT NULL default '',
   comment_author_url varchar(200) NOT NULL default '',
   comment_author tinytext NOT NULL,
   comment_author_email varchar(100) NOT NULL default '',
   comment_author_url varchar(200) NOT NULL default '',
@@ -67,8 +68,8 @@ CREATE TABLE $wpdb->comments (
   comment_approved varchar(20) NOT NULL default '1',
   comment_agent varchar(255) NOT NULL default '',
   comment_type varchar(20) NOT NULL default '',
   comment_approved varchar(20) NOT NULL default '1',
   comment_agent varchar(255) NOT NULL default '',
   comment_type varchar(20) NOT NULL default '',
-  comment_parent bigint(20) NOT NULL default '0',
-  user_id bigint(20) NOT NULL default '0',
+  comment_parent bigint(20) unsigned NOT NULL default '0',
+  user_id bigint(20) unsigned NOT NULL default '0',
   PRIMARY KEY  (comment_ID),
   KEY comment_approved (comment_approved),
   KEY comment_post_ID (comment_post_ID),
   PRIMARY KEY  (comment_ID),
   KEY comment_approved (comment_approved),
   KEY comment_post_ID (comment_post_ID),
@@ -76,26 +77,24 @@ CREATE TABLE $wpdb->comments (
   KEY comment_date_gmt (comment_date_gmt)
 ) $charset_collate;
 CREATE TABLE $wpdb->links (
   KEY comment_date_gmt (comment_date_gmt)
 ) $charset_collate;
 CREATE TABLE $wpdb->links (
-  link_id bigint(20) NOT NULL auto_increment,
+  link_id bigint(20) unsigned NOT NULL auto_increment,
   link_url varchar(255) NOT NULL default '',
   link_name varchar(255) NOT NULL default '',
   link_image varchar(255) NOT NULL default '',
   link_target varchar(25) NOT NULL default '',
   link_url varchar(255) NOT NULL default '',
   link_name varchar(255) NOT NULL default '',
   link_image varchar(255) NOT NULL default '',
   link_target varchar(25) NOT NULL default '',
-  link_category bigint(20) NOT NULL default '0',
   link_description varchar(255) NOT NULL default '',
   link_visible varchar(20) NOT NULL default 'Y',
   link_description varchar(255) NOT NULL default '',
   link_visible varchar(20) NOT NULL default 'Y',
-  link_owner int(11) NOT NULL default '1',
+  link_owner bigint(20) unsigned NOT NULL default '1',
   link_rating int(11) NOT NULL default '0',
   link_updated datetime NOT NULL default '0000-00-00 00:00:00',
   link_rel varchar(255) NOT NULL default '',
   link_notes mediumtext NOT NULL,
   link_rss varchar(255) NOT NULL default '',
   PRIMARY KEY  (link_id),
   link_rating int(11) NOT NULL default '0',
   link_updated datetime NOT NULL default '0000-00-00 00:00:00',
   link_rel varchar(255) NOT NULL default '',
   link_notes mediumtext NOT NULL,
   link_rss varchar(255) NOT NULL default '',
   PRIMARY KEY  (link_id),
-  KEY link_category (link_category),
   KEY link_visible (link_visible)
 ) $charset_collate;
 CREATE TABLE $wpdb->options (
   KEY link_visible (link_visible)
 ) $charset_collate;
 CREATE TABLE $wpdb->options (
-  option_id bigint(20) NOT NULL auto_increment,
+  option_id bigint(20) unsigned NOT NULL auto_increment,
   blog_id int(11) NOT NULL default '0',
   option_name varchar(64) NOT NULL default '',
   option_value longtext NOT NULL,
   blog_id int(11) NOT NULL default '0',
   option_name varchar(64) NOT NULL default '',
   option_value longtext NOT NULL,
@@ -104,8 +103,8 @@ CREATE TABLE $wpdb->options (
   KEY option_name (option_name)
 ) $charset_collate;
 CREATE TABLE $wpdb->postmeta (
   KEY option_name (option_name)
 ) $charset_collate;
 CREATE TABLE $wpdb->postmeta (
-  meta_id bigint(20) NOT NULL auto_increment,
-  post_id bigint(20) NOT NULL default '0',
+  meta_id bigint(20) unsigned NOT NULL auto_increment,
+  post_id bigint(20) unsigned NOT NULL default '0',
   meta_key varchar(255) default NULL,
   meta_value longtext,
   PRIMARY KEY  (meta_id),
   meta_key varchar(255) default NULL,
   meta_value longtext,
   PRIMARY KEY  (meta_id),
@@ -114,12 +113,11 @@ CREATE TABLE $wpdb->postmeta (
 ) $charset_collate;
 CREATE TABLE $wpdb->posts (
   ID bigint(20) unsigned NOT NULL auto_increment,
 ) $charset_collate;
 CREATE TABLE $wpdb->posts (
   ID bigint(20) unsigned NOT NULL auto_increment,
-  post_author bigint(20) NOT NULL default '0',
+  post_author bigint(20) unsigned NOT NULL default '0',
   post_date datetime NOT NULL default '0000-00-00 00:00:00',
   post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
   post_content longtext NOT NULL,
   post_title text NOT NULL,
   post_date datetime NOT NULL default '0000-00-00 00:00:00',
   post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
   post_content longtext NOT NULL,
   post_title text NOT NULL,
-  post_category int(4) NOT NULL default '0',
   post_excerpt text NOT NULL,
   post_status varchar(20) NOT NULL default 'publish',
   comment_status varchar(20) NOT NULL default 'open',
   post_excerpt text NOT NULL,
   post_status varchar(20) NOT NULL default 'publish',
   comment_status varchar(20) NOT NULL default 'open',
@@ -131,7 +129,7 @@ CREATE TABLE $wpdb->posts (
   post_modified datetime NOT NULL default '0000-00-00 00:00:00',
   post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
   post_content_filtered text NOT NULL,
   post_modified datetime NOT NULL default '0000-00-00 00:00:00',
   post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
   post_content_filtered text NOT NULL,
-  post_parent bigint(20) NOT NULL default '0',
+  post_parent bigint(20) unsigned NOT NULL default '0',
   guid varchar(255) NOT NULL default '',
   menu_order int(11) NOT NULL default '0',
   post_type varchar(20) NOT NULL default 'post',
   guid varchar(255) NOT NULL default '',
   menu_order int(11) NOT NULL default '0',
   post_type varchar(20) NOT NULL default 'post',
@@ -158,8 +156,8 @@ CREATE TABLE $wpdb->users (
   KEY user_nicename (user_nicename)
 ) $charset_collate;
 CREATE TABLE $wpdb->usermeta (
   KEY user_nicename (user_nicename)
 ) $charset_collate;
 CREATE TABLE $wpdb->usermeta (
-  umeta_id bigint(20) NOT NULL auto_increment,
-  user_id bigint(20) NOT NULL default '0',
+  umeta_id bigint(20) unsigned NOT NULL auto_increment,
+  user_id bigint(20) unsigned NOT NULL default '0',
   meta_key varchar(255) default NULL,
   meta_value longtext,
   PRIMARY KEY  (umeta_id),
   meta_key varchar(255) default NULL,
   meta_value longtext,
   PRIMARY KEY  (umeta_id),
@@ -181,138 +179,169 @@ function populate_options() {
 
        do_action('populate_options');
 
 
        do_action('populate_options');
 
-       add_option('siteurl', $guessurl);
-       add_option('blogname', __('My Blog'));
-       add_option('blogdescription', __('Just another WordPress weblog'));
-       add_option('users_can_register', 0);
-       add_option('admin_email', 'you@example.com');
-       add_option('start_of_week', 1);
-       add_option('use_balanceTags', 0);
-       add_option('use_smilies', 1);
-       add_option('require_name_email', 1);
-       add_option('comments_notify', 1);
-       add_option('posts_per_rss', 10);
-       add_option('rss_excerpt_length', 50);
-       add_option('rss_use_excerpt', 0);
-       add_option('mailserver_url', 'mail.example.com');
-       add_option('mailserver_login', 'login@example.com');
-       add_option('mailserver_pass', 'password');
-       add_option('mailserver_port', 110);
-       add_option('default_category', 1);
-       add_option('default_comment_status', 'open');
-       add_option('default_ping_status', 'open');
-       add_option('default_pingback_flag', 1);
-       add_option('default_post_edit_rows', 10);
-       add_option('posts_per_page', 10);
-       add_option('what_to_show', 'posts');
-       add_option('date_format', __('F j, Y'));
-       add_option('time_format', __('g:i a'));
-       add_option('links_updated_date_format', __('F j, Y g:i a'));
-       add_option('links_recently_updated_prepend', '<em>');
-       add_option('links_recently_updated_append', '</em>');
-       add_option('links_recently_updated_time', 120);
-       add_option('comment_moderation', 0);
-       add_option('moderation_notify', 1);
-       add_option('permalink_structure');
-       add_option('gzipcompression', 0);
-       add_option('hack_file', 0);
-       add_option('blog_charset', 'UTF-8');
-       add_option('moderation_keys');
-       add_option('active_plugins');
-       add_option('home', $guessurl);
-       // in case it is set, but blank, update "home"
-       if ( !__get_option('home') ) update_option('home', $guessurl);
-       add_option('category_base');
-       add_option('ping_sites', 'http://rpc.pingomatic.com/');
-       add_option('advanced_edit', 0);
-       add_option('comment_max_links', 2);
-       add_option('gmt_offset', date('Z') / 3600);
-       // 1.5
-       add_option('default_email_category', 1);
-       add_option('recently_edited');
-       add_option('use_linksupdate', 0);
-       add_option('template', 'default');
-       add_option('stylesheet', 'default');
-       add_option('comment_whitelist', 1);
-       add_option('page_uris');
-       add_option('blacklist_keys');
-       add_option('comment_registration', 0);
-       add_option('rss_language', 'en');
-       add_option('html_type', 'text/html');
-       // 1.5.1
-       add_option('use_trackback', 0);
-       // 2.0
-       add_option('default_role', 'subscriber');
-       add_option('db_version', $wp_db_version);
-       // 2.0.1
        if ( ini_get('safe_mode') ) {
                // Safe mode screws up mkdir(), so we must use a flat structure.
        if ( ini_get('safe_mode') ) {
                // Safe mode screws up mkdir(), so we must use a flat structure.
-               add_option('uploads_use_yearmonth_folders', 0);
-               add_option('upload_path', WP_CONTENT_DIR);
+               $uploads_use_yearmonth_folders = 0;
+               $upload_path = WP_CONTENT_DIR;
        } else {
        } else {
-               add_option('uploads_use_yearmonth_folders', 1);
-               add_option('upload_path', WP_CONTENT_DIR . '/uploads');
+               $uploads_use_yearmonth_folders = 1;
+               $upload_path = WP_CONTENT_DIR . '/uploads';
        }
 
        }
 
+       $options = array(
+       'siteurl' => $guessurl,
+       'blogname' => __('My Blog'),
+       'blogdescription' => __('Just another WordPress weblog'),
+       'users_can_register' => 0,
+       'admin_email' => 'you@example.com',
+       'start_of_week' => 1,
+       'use_balanceTags' => 0,
+       'use_smilies' => 1,
+       'require_name_email' => 1,
+       'comments_notify' => 1,
+       'posts_per_rss' => 10,
+       'rss_excerpt_length' => 50,
+       'rss_use_excerpt' => 0,
+       'mailserver_url' => 'mail.example.com',
+       'mailserver_login' => 'login@example.com',
+       'mailserver_pass' => 'password',
+       'mailserver_port' => 110,
+       'default_category' => 1,
+       'default_comment_status' => 'open',
+       'default_ping_status' => 'open',
+       'default_pingback_flag' => 1,
+       'default_post_edit_rows' => 10,
+       'posts_per_page' => 10,
+       /* translators: default date format, see http://php.net/date */
+       'date_format' => __('F j, Y'),
+       /* translators: default time format, see http://php.net/date */
+       'time_format' => __('g:i a'),
+       /* translators: links last updated date format, see http://php.net/date */
+       'links_updated_date_format' => __('F j, Y g:i a'),
+       'links_recently_updated_prepend' => '<em>',
+       'links_recently_updated_append' => '</em>',
+       'links_recently_updated_time' => 120,
+       'comment_moderation' => 0,
+       'moderation_notify' => 1,
+       'permalink_structure' => '',
+       'gzipcompression' => 0,
+       'hack_file' => 0,
+       'blog_charset' => 'UTF-8',
+       'moderation_keys' => '',
+       'active_plugins' => array(),
+       'home' => $guessurl,
+       'category_base' => '',
+       'ping_sites' => 'http://rpc.pingomatic.com/',
+       'advanced_edit' => 0,
+       'comment_max_links' => 2,
+       'gmt_offset' => date('Z') / 3600,
+
+       // 1.5
+       'default_email_category' => 1,
+       'recently_edited' => '',
+       'use_linksupdate' => 0,
+       'template' => 'default',
+       'stylesheet' => 'default',
+       'comment_whitelist' => 1,
+       'blacklist_keys' => '',
+       'comment_registration' => 0,
+       'rss_language' => 'en',
+       'html_type' => 'text/html',
+
+       // 1.5.1
+       'use_trackback' => 0,
+
+       // 2.0
+       'default_role' => 'subscriber',
+       'db_version' => $wp_db_version,
+
+       // 2.0.1
+       'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders,
+       'upload_path' => $upload_path,
+
        // 2.0.3
        // 2.0.3
-       add_option('secret', wp_generate_password(64));
+       'secret' => wp_generate_password(64),
 
        // 2.1
 
        // 2.1
-       add_option('blog_public', '1');
-       add_option('default_link_category', 2);
-       add_option('show_on_front', 'posts');
+       'blog_public' => '1',
+       'default_link_category' => 2,
+       'show_on_front' => 'posts',
 
        // 2.2
 
        // 2.2
-       add_option('tag_base');
+       'tag_base' => '',
 
        // 2.5
 
        // 2.5
-       add_option('show_avatars', '1');
-       add_option('avatar_rating', 'G');
-       add_option('upload_url_path', '');
-       add_option('thumbnail_size_w', 150);
-       add_option('thumbnail_size_h', 150);
-       add_option('thumbnail_crop', 1);
-       add_option('medium_size_w', 300);
-       add_option('medium_size_h', 300);
+       'show_avatars' => '1',
+       'avatar_rating' => 'G',
+       'upload_url_path' => '',
+       'thumbnail_size_w' => 150,
+       'thumbnail_size_h' => 150,
+       'thumbnail_crop' => 1,
+       'medium_size_w' => 300,
+       'medium_size_h' => 300,
 
        // 2.6
 
        // 2.6
-       add_option('avatar_default', 'mystery');
-       add_option('enable_app', 0);
-       add_option('enable_xmlrpc', 0);
+       'avatar_default' => 'mystery',
+       'enable_app' => 0,
+       'enable_xmlrpc' => 0,
 
        // 2.7
 
        // 2.7
-       add_option('large_size_w', 1024);
-       add_option('large_size_h', 1024);
-       add_option('image_default_link_type', 'file');
-       add_option('image_default_size', '');
-       add_option('image_default_align', '');
-       add_option('close_comments_for_old_posts', 0);
-       add_option('close_comments_days_old', 14);
-       add_option('thread_comments', 0);
-       add_option('thread_comments_depth', 5);
-       add_option('page_comments', 1);
-       add_option('comments_per_page', 50);
-       add_option('default_comments_page', 'newest');
-       add_option('comment_order', 'asc');
-       add_option('use_ssl', 0);
-       add_option('sticky_posts', array());
-       add_option('widget_categories', array());
-       add_option('widget_text', array());
-       add_option('widget_rss', array());
-       add_option('update_core', array());
-       add_option('dismissed_update_core', array());
+       'large_size_w' => 1024,
+       'large_size_h' => 1024,
+       'image_default_link_type' => 'file',
+       'image_default_size' => '',
+       'image_default_align' => '',
+       'close_comments_for_old_posts' => 0,
+       'close_comments_days_old' => 14,
+       'thread_comments' => 0,
+       'thread_comments_depth' => 5,
+       'page_comments' => 1,
+       'comments_per_page' => 50,
+       'default_comments_page' => 'newest',
+       'comment_order' => 'asc',
+       'sticky_posts' => array(),
+       'widget_categories' => array(),
+       'widget_text' => array(),
+       'widget_rss' => array(),
+
+       // 2.8
+       'timezone_string' => ''
+       );
+
+       // Set autoload to no for these options
+       $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
+
+       $existing_options = $wpdb->get_col("SELECT option_name FROM $wpdb->options");
+
+       $insert = '';
+       foreach ( $options as $option => $value ) {
+               if ( in_array($option, $existing_options) )
+                       continue;
+               if ( in_array($option, $fat_options) )
+                       $autoload = 'no';
+               else
+                       $autoload = 'yes';
+
+               $option = $wpdb->escape($option);
+               if ( is_array($value) )
+                       $value = serialize($value);
+               $value = $wpdb->escape($value);
+               if ( !empty($insert) )
+                       $insert .= ', ';
+               $insert .= "('$option', '$value', '$autoload')";
+       }
+
+       if ( !empty($insert) )
+               $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert);
+
+       // in case it is set, but blank, update "home"
+       if ( !__get_option('home') ) update_option('home', $guessurl);
 
        // Delete unused options
 
        // Delete unused options
-       $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
-       foreach ($unusedoptions as $option) :
+       $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts',
+               'page_uris', 'rewrite_rules', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed');
+       foreach ($unusedoptions as $option)
                delete_option($option);
                delete_option($option);
-       endforeach;
-
-       // Set up a few options not to load by default
-       $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
-       foreach ($fatoptions as $fatoption) :
-               $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'");
-       endforeach;
 }
 
 /**
 }
 
 /**
@@ -327,6 +356,7 @@ function populate_roles() {
        populate_roles_250();
        populate_roles_260();
        populate_roles_270();
        populate_roles_250();
        populate_roles_260();
        populate_roles_270();
+       populate_roles_280();
 }
 
 /**
 }
 
 /**
@@ -338,17 +368,22 @@ function populate_roles_160() {
        // Add roles
 
        // Dummy gettext calls to get strings in the catalog.
        // Add roles
 
        // Dummy gettext calls to get strings in the catalog.
-       _c('Administrator|User role');
-       _c('Editor|User role');
-       _c('Author|User role');
-       _c('Contributor|User role');
-       _c('Subscriber|User role');
-
-       add_role('administrator', 'Administrator|User role');
-       add_role('editor', 'Editor|User role');
-       add_role('author', 'Author|User role');
-       add_role('contributor', 'Contributor|User role');
-       add_role('subscriber', 'Subscriber|User role');
+       /* translators: user role */
+       _x('Administrator', 'User role');
+       /* translators: user role */
+       _x('Editor', 'User role');
+       /* translators: user role */
+       _x('Author', 'User role');
+       /* translators: user role */
+       _x('Contributor', 'User role');
+       /* translators: user role */
+       _x('Subscriber', 'User role');
+
+       add_role('administrator', 'Administrator');
+       add_role('editor', 'Editor');
+       add_role('author', 'Author');
+       add_role('contributor', 'Contributor');
+       add_role('subscriber', 'Subscriber');
 
        // Add caps for Administrator role
        $role =& get_role('administrator');
 
        // Add caps for Administrator role
        $role =& get_role('administrator');
@@ -530,4 +565,17 @@ function populate_roles_270() {
        }
 }
 
        }
 }
 
+/**
+ * Create and modify WordPress roles for WordPress 2.8.
+ *
+ * @since 2.8.0
+ */
+function populate_roles_280() {
+       $role =& get_role( 'administrator' );
+
+       if ( !empty( $role ) ) {
+               $role->add_cap( 'install_themes' );
+       }
+}
+
 ?>
 ?>
index a6c753d48b47e294b80e07f4a3b59311252e1b98..5f104d630feef124323f517289c14141d15753e8 100644 (file)
@@ -18,8 +18,8 @@
  * @param unknown_type $cat_name
  * @return unknown
  */
  * @param unknown_type $cat_name
  * @return unknown
  */
-function category_exists($cat_name) {
-       $id = is_term($cat_name, 'category');
+function category_exists($cat_name, $parent = 0) {
+       $id = is_term($cat_name, 'category', $parent);
        if ( is_array($id) )
                $id = $id['term_id'];
        return $id;
        if ( is_array($id) )
                $id = $id['term_id'];
        return $id;
@@ -194,21 +194,37 @@ function wp_update_category($catarr) {
  * @param unknown_type $post_id
  * @return unknown
  */
  * @param unknown_type $post_id
  * @return unknown
  */
-function get_tags_to_edit( $post_id ) {
+function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
+       return get_terms_to_edit( $post_id, $taxonomy);
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post_id
+ * @return unknown
+ */
+function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
        $post_id = (int) $post_id;
        if ( !$post_id )
                return false;
 
        $post_id = (int) $post_id;
        if ( !$post_id )
                return false;
 
-       $tags = wp_get_post_tags($post_id);
+       $tags = wp_get_post_terms($post_id, $taxonomy, array());
 
        if ( !$tags )
                return false;
 
 
        if ( !$tags )
                return false;
 
+       if ( is_wp_error($tags) )
+               return $tags;
+
        foreach ( $tags as $tag )
                $tag_names[] = $tag->name;
        $tags_to_edit = join( ',', $tag_names );
        foreach ( $tags as $tag )
                $tag_names[] = $tag->name;
        $tags_to_edit = join( ',', $tag_names );
-       $tags_to_edit = attribute_escape( $tags_to_edit );
-       $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
+       $tags_to_edit = esc_attr( $tags_to_edit );
+       $tags_to_edit = apply_filters( 'terms_to_edit', $tags_to_edit, $taxonomy );
+
        return $tags_to_edit;
 }
 
        return $tags_to_edit;
 }
 
@@ -233,10 +249,20 @@ function tag_exists($tag_name) {
  * @return unknown
  */
 function wp_create_tag($tag_name) {
  * @return unknown
  */
 function wp_create_tag($tag_name) {
-       if ( $id = tag_exists($tag_name) )
+       return wp_create_term( $tag_name, 'post_tag');
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $tag_name
+ * @return unknown
+ */
+function wp_create_term($tag_name, $taxonomy = 'post_tag') {
+       if ( $id = is_term($tag_name, $taxonomy) )
                return $id;
 
                return $id;
 
-       return wp_insert_term($tag_name, 'post_tag');
+       return wp_insert_term($tag_name, $taxonomy);
 }
 }
-
-?>
index 2566a61684332021e0803acc10891877a1b1eeb3..13faf1063b9bfffb2c393c998d2c6d7fa01225d0 100644 (file)
  * @param unknown_type $per_page
  */
 function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
  * @param unknown_type $per_page
  */
 function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
+
        $count = 0;
        $count = 0;
-       _cat_rows($categories, $count, $parent, $level, $page, $per_page);
+
+       if ( empty($categories) ) {
+
+               $args = array('hide_empty' => 0);
+               if ( !empty($_GET['s']) )
+                       $args['search'] = $_GET['s'];
+
+               $categories = get_categories( $args );
+
+               if ( empty($categories) )
+                       return false;
+       }
+
+       $children = _get_term_hierarchy('category');
+
+       _cat_rows( $parent, $level, $categories, $children, $page, $per_page, $count );
+
 }
 
 /**
 }
 
 /**
@@ -38,42 +55,32 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_pag
  * @param unknown_type $per_page
  * @return unknown
  */
  * @param unknown_type $per_page
  * @return unknown
  */
-function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
-       if ( empty($categories) ) {
-               $args = array('hide_empty' => 0);
-               if ( !empty($_GET['s']) )
-                       $args['search'] = $_GET['s'];
-               $categories = get_categories( $args );
-       }
-
-       if ( !$categories )
-               return false;
-
-       $children = _get_term_hierarchy('category');
+function _cat_rows( $parent = 0, $level = 0, $categories, &$children, $page = 1, $per_page = 20, &$count ) {
 
        $start = ($page - 1) * $per_page;
        $end = $start + $per_page;
 
        $start = ($page - 1) * $per_page;
        $end = $start + $per_page;
-       $i = -1;
        ob_start();
        ob_start();
-       foreach ( $categories as $category ) {
+
+       foreach ( $categories as $key => $category ) {
                if ( $count >= $end )
                        break;
 
                if ( $count >= $end )
                        break;
 
-               $i++;
-
-               if ( $category->parent != $parent )
+               if ( $category->parent != $parent && empty($_GET['s']) )
                        continue;
 
                // If the page starts in a subtree, print the parents.
                if ( $count == $start && $category->parent > 0 ) {
                        continue;
 
                // If the page starts in a subtree, print the parents.
                if ( $count == $start && $category->parent > 0 ) {
+
                        $my_parents = array();
                        $my_parents = array();
-                       while ( $my_parent) {
-                               $my_parent = get_category($my_parent);
+                       $p = $category->parent;
+                       while ( $p ) {
+                               $my_parent = get_category( $p );
                                $my_parents[] = $my_parent;
                                $my_parents[] = $my_parent;
-                               if ( !$my_parent->parent )
+                               if ( $my_parent->parent == 0 )
                                        break;
                                        break;
-                               $my_parent = $my_parent->parent;
+                               $p = $my_parent->parent;
                        }
                        }
+
                        $num_parents = count($my_parents);
                        while( $my_parent = array_pop($my_parents) ) {
                                echo "\t" . _cat_row( $my_parent, $level - $num_parents );
                        $num_parents = count($my_parents);
                        while( $my_parent = array_pop($my_parents) ) {
                                echo "\t" . _cat_row( $my_parent, $level - $num_parents );
@@ -84,12 +91,12 @@ function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $p
                if ( $count >= $start )
                        echo "\t" . _cat_row( $category, $level );
 
                if ( $count >= $start )
                        echo "\t" . _cat_row( $category, $level );
 
-               unset($categories[$i]); // Prune the working set
+               unset( $categories[ $key ] );
+
                $count++;
 
                if ( isset($children[$category->term_id]) )
                $count++;
 
                if ( isset($children[$category->term_id]) )
-                       _cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
-
+                       _cat_rows( $category->term_id, $level + 1, $categories, $children, $page, $per_page, $count );
        }
 
        $output = ob_get_contents();
        }
 
        $output = ob_get_contents();
@@ -114,16 +121,17 @@ function _cat_row( $category, $level, $name_override = false ) {
        $category = get_category( $category, OBJECT, 'display' );
 
        $default_cat_id = (int) get_option( 'default_category' );
        $category = get_category( $category, OBJECT, 'display' );
 
        $default_cat_id = (int) get_option( 'default_category' );
-       $pad = str_repeat( '&#8212; ', $level );
+       $pad = str_repeat( '&#8212; ', max(0, $level) );
        $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
        $edit_link = "categories.php?action=edit&amp;cat_ID=$category->term_id";
        if ( current_user_can( 'manage_categories' ) ) {
        $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
        $edit_link = "categories.php?action=edit&amp;cat_ID=$category->term_id";
        if ( current_user_can( 'manage_categories' ) ) {
-               $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $name ) . '</a><br />';
+               $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $category->name)) . "'>" . esc_attr( $name ) . '</a><br />';
                $actions = array();
                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
                if ( $default_cat_id != $category->term_id )
                $actions = array();
                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
                if ( $default_cat_id != $category->term_id )
-                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+                       $actions['delete'] = "<a class='delete:the-list:cat-$category->term_id submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "'>" . __('Delete') . "</a>";
+               $actions = apply_filters('cat_row_actions', $actions, $category);
                $action_count = count($actions);
                $i = 0;
                $edit .= '<div class="row-actions">';
                $action_count = count($actions);
                $i = 0;
                $edit .= '<div class="row-actions">';
@@ -181,6 +189,11 @@ function _cat_row( $category, $level, $name_override = false ) {
                        case 'posts':
                                $attributes = 'class="posts column-posts num"' . $style;
                                $output .= "<td $attributes>$posts_count</td>\n";
                        case 'posts':
                                $attributes = 'class="posts column-posts num"' . $style;
                                $output .= "<td $attributes>$posts_count</td>\n";
+                               break;
+                       default:
+                               $output .= "<td $attributes>";
+                               $output .= apply_filters('manage_categories_custom_column', '', $column_name, $category->term_id);
+                               $output .= "</td>";
                }
        }
        $output .= '</tr>';
                }
        }
        $output .= '</tr>';
@@ -251,8 +264,8 @@ function inline_edit_term_row($type) {
        <p class="inline-edit-save submit">
                <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
                <?php $update_text = ( $is_tag ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?>
        <p class="inline-edit-save submit">
                <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
                <?php $update_text = ( $is_tag ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?>
-               <a accesskey="s" href="#inline-edit" title="<?php echo attribute_escape( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
-               <img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
+               <a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>
+               <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
                <span class="error" style="display:none;"></span>
                <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
                <br class="clear" />
                <span class="error" style="display:none;"></span>
                <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
                <br class="clear" />
@@ -283,12 +296,13 @@ function link_cat_row( $category, $name_override = false ) {
        $name = ( $name_override ? $name_override : $category->name );
        $edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id";
        if ( current_user_can( 'manage_categories' ) ) {
        $name = ( $name_override ? $name_override : $category->name );
        $edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id";
        if ( current_user_can( 'manage_categories' ) ) {
-               $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
+               $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $category->name)) . "'>$name</a><br />";
                $actions = array();
                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
                if ( $default_cat_id != $category->term_id )
                $actions = array();
                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
                if ( $default_cat_id != $category->term_id )
-                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+                       $actions['delete'] = "<a class='delete:the-list:link-cat-$category->term_id submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "'>" . __('Delete') . "</a>";
+               $actions = apply_filters('link_cat_row_actions', $actions, $category);
                $action_count = count($actions);
                $i = 0;
                $edit .= '<div class="row-actions">';
                $action_count = count($actions);
                $i = 0;
                $edit .= '<div class="row-actions">';
@@ -345,6 +359,11 @@ function link_cat_row( $category, $name_override = false ) {
                        case 'links':
                                $attributes = 'class="links column-links num"' . $style;
                                $output .= "<td $attributes>$count</td>";
                        case 'links':
                                $attributes = 'class="links column-links num"' . $style;
                                $output .= "<td $attributes>$count</td>";
+                               break;
+                       default:
+                               $output .= "<td $attributes>";
+                               $output .= apply_filters('manage_link_categories_custom_column', '', $column_name, $category->term_id);
+                               $output .= "</td>";
                }
        }
        $output .= '</tr>';
                }
        }
        $output .= '</tr>';
@@ -353,29 +372,58 @@ function link_cat_row( $category, $name_override = false ) {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Outputs the html checked attribute.
  *
  *
- * @since unknown
+ * Compares the first two arguments and if identical marks as checked
+ *
+ * @since 2.8
  *
  *
- * @param unknown_type $checked
- * @param unknown_type $current
+ * @param any $checked One of the values to compare
+ * @param any $current (true) The other value to compare if not just true
+ * @param bool $echo Whether or not to echo or just return the string
  */
  */
-function checked( $checked, $current) {
-       if ( $checked == $current)
-               echo ' checked="checked"';
+function checked( $checked, $current = true, $echo = true) {
+       return __checked_selected_helper( $checked, $current, $echo, 'checked' );
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Outputs the html selected attribute.
  *
  *
- * @since unknown
+ * Compares the first two arguments and if identical marks as selected
  *
  *
- * @param unknown_type $selected
- * @param unknown_type $current
+ * @since 2.8
+ *
+ * @param any selected One of the values to compare
+ * @param any $current (true) The other value to compare if not just true
+ * @param bool $echo Whether or not to echo or just return the string
  */
  */
-function selected( $selected, $current) {
-       if ( $selected == $current)
-               echo ' selected="selected"';
+function selected( $selected, $current = true, $echo = true) {
+       return __checked_selected_helper( $selected, $current, $echo, 'selected' );
+}
+
+/**
+ * Private helper function for checked and selected.
+ *
+ * Compares the first two arguments and if identical marks as $type
+ *
+ * @since 2.8
+ * @access private
+ *
+ * @param any $helper One of the values to compare
+ * @param any $current (true) The other value to compare if not just true
+ * @param bool $echo Whether or not to echo or just return the string
+ * @param string $type The type of checked|selected we are doing.
+ */
+function __checked_selected_helper( $helper, $current, $echo, $type) {
+       if ( $helper == $current)
+               $result = " $type='$type'";
+       else
+               $result = '';
+
+       if ($echo)
+               echo $result;
+
+       return $result;
 }
 
 //
 }
 
 //
@@ -421,7 +469,7 @@ class Walker_Category_Checklist extends Walker {
                extract($args);
 
                $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
                extract($args);
 
                $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
-               $output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . wp_specialchars( apply_filters('the_category', $category->name )) . '</label>';
+               $output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
        }
 
        function end_el(&$output, $category, $depth, $args) {
        }
 
        function end_el(&$output, $category, $depth, $args) {
@@ -469,10 +517,12 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
 
        // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
        $checked_categories = array();
 
        // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
        $checked_categories = array();
-       for ( $i = 0; isset($categories[$i]); $i++ ) {
-               if ( in_array($categories[$i]->term_id, $args['selected_cats']) ) {
-                       $checked_categories[] = $categories[$i];
-                       unset($categories[$i]);
+       $keys = array_keys( $categories );
+
+       foreach( $keys as $k ) {
+               if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
+                       $checked_categories[] = $categories[$k];
+                       unset( $categories[$k] );
                }
        }
 
                }
        }
 
@@ -512,7 +562,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
                <li id="<?php echo $id; ?>" class="popular-category">
                        <label class="selectit">
                        <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" />
                <li id="<?php echo $id; ?>" class="popular-category">
                        <label class="selectit">
                        <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" />
-                               <?php echo wp_specialchars( apply_filters( 'the_category', $category->name ) ); ?>
+                               <?php echo esc_html( apply_filters( 'the_category', $category->name ) ); ?>
                        </label>
                </li>
 
                        </label>
                </li>
 
@@ -564,7 +614,7 @@ function wp_link_category_checklist( $link_id = 0 ) {
 
        foreach ( $categories as $category ) {
                $cat_id = $category->term_id;
 
        foreach ( $categories as $category ) {
                $cat_id = $category->term_id;
-               $name = wp_specialchars( apply_filters('the_category', $category->name));
+               $name = esc_html( apply_filters('the_category', $category->name));
                $checked = in_array( $cat_id, $checked_categories );
                echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
        }
                $checked = in_array( $cat_id, $checked_categories );
                echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>";
        }
@@ -583,13 +633,14 @@ function wp_link_category_checklist( $link_id = 0 ) {
  * @param unknown_type $class
  * @return unknown
  */
  * @param unknown_type $class
  * @return unknown
  */
-function _tag_row( $tag, $class = '' ) {
+function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
                $count = number_format_i18n( $tag->count );
                $count = number_format_i18n( $tag->count );
-               $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
+               $tagsel = ($taxonomy == 'post_tag' ? 'tag' : $taxonomy);
+               $count = ( $count > 0 ) ? "<a href='edit.php?$tagsel=$tag->slug'>$count</a>" : $count;
 
                $name = apply_filters( 'term_name', $tag->name );
 
                $name = apply_filters( 'term_name', $tag->name );
-               $qe_data = get_term($tag->term_id, 'post_tag', object, 'edit');
-               $edit_link = "edit-tags.php?action=edit&amp;tag_ID=$tag->term_id";
+               $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
+               $edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id";
                $out = '';
                $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
                $columns = get_column_headers('edit-tags');
                $out = '';
                $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
                $columns = get_column_headers('edit-tags');
@@ -608,11 +659,12 @@ function _tag_row( $tag, $class = '' ) {
                                        $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
                                        break;
                                case 'name':
                                        $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
                                        break;
                                case 'name':
-                                       $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
+                                       $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $name)) . '">' . $name . '</a></strong><br />';
                                        $actions = array();
                                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
                                        $actions = array();
                                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
-                                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+                                       $actions['delete'] = "<a class='delete:the-list:tag-$tag->term_id submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
+                                       $actions = apply_filters('tag_row_actions', $actions, $tag);
                                        $action_count = count($actions);
                                        $i = 0;
                                        $out .= '<div class="row-actions">';
                                        $action_count = count($actions);
                                        $i = 0;
                                        $out .= '<div class="row-actions">';
@@ -626,6 +678,9 @@ function _tag_row( $tag, $class = '' ) {
                                        $out .= '<div class="name">' . $qe_data->name . '</div>';
                                        $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
                                        break;
                                        $out .= '<div class="name">' . $qe_data->name . '</div>';
                                        $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
                                        break;
+                               case 'description':
+                                       $out .= "<td $attributes>$tag->description</td>";
+                                       break;
                                case 'slug':
                                        $out .= "<td $attributes>$tag->slug</td>";
                                        break;
                                case 'slug':
                                        $out .= "<td $attributes>$tag->slug</td>";
                                        break;
@@ -633,6 +688,10 @@ function _tag_row( $tag, $class = '' ) {
                                        $attributes = 'class="posts column-posts num"' . $style;
                                        $out .= "<td $attributes>$count</td>";
                                        break;
                                        $attributes = 'class="posts column-posts num"' . $style;
                                        $out .= "<td $attributes>$count</td>";
                                        break;
+                               default:
+                                       $out .= "<td $attributes>";
+                                       $out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id);
+                                       $out .= "</td>";
                        }
                }
 
                        }
                }
 
@@ -654,7 +713,7 @@ function _tag_row( $tag, $class = '' ) {
  * @param unknown_type $searchterms
  * @return unknown
  */
  * @param unknown_type $searchterms
  * @return unknown
  */
-function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
+function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) {
 
        // Get a page worth of tags
        $start = ($page - 1) * $pagesize;
 
        // Get a page worth of tags
        $start = ($page - 1) * $pagesize;
@@ -665,13 +724,13 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
                $args['search'] = $searchterms;
        }
 
                $args['search'] = $searchterms;
        }
 
-       $tags = get_terms( 'post_tag', $args );
+       $tags = get_terms( $taxonomy, $args );
 
        // convert it to table rows
        $out = '';
        $count = 0;
        foreach( $tags as $tag )
 
        // convert it to table rows
        $out = '';
        $count = 0;
        foreach( $tags as $tag )
-               $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );
+               $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"', $taxonomy );
 
        // filter and send to screen
        echo $out;
 
        // filter and send to screen
        echo $out;
@@ -689,7 +748,8 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
 function wp_manage_posts_columns() {
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
 function wp_manage_posts_columns() {
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
-       $posts_columns['title'] = _c('Post|noun');
+       /* translators: manage posts column name */
+       $posts_columns['title'] = _x('Post', 'column name');
        $posts_columns['author'] = __('Author');
        $posts_columns['categories'] = __('Categories');
        $posts_columns['tags'] = __('Tags');
        $posts_columns['author'] = __('Author');
        $posts_columns['categories'] = __('Categories');
        $posts_columns['tags'] = __('Tags');
@@ -713,13 +773,16 @@ function wp_manage_media_columns() {
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
        $posts_columns['icon'] = '';
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
        $posts_columns['icon'] = '';
-       $posts_columns['media'] = _c('File|media column header');
+       /* translators: column name */
+       $posts_columns['media'] = _x('File', 'column name');
        $posts_columns['author'] = __('Author');
        $posts_columns['author'] = __('Author');
-       //$posts_columns['tags'] = _c('Tags|media column header');
-       $posts_columns['parent'] = _c('Attached to|media column header');
+       //$posts_columns['tags'] = _x('Tags', 'column name');
+       /* translators: column name */
+       $posts_columns['parent'] = _x('Attached to', 'column name');
        $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
        //$posts_columns['comments'] = __('Comments');
        $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
        //$posts_columns['comments'] = __('Comments');
-       $posts_columns['date'] = _c('Date|media column header');
+       /* translators: column name */
+       $posts_columns['date'] = _x('Date', 'column name');
        $posts_columns = apply_filters('manage_media_columns', $posts_columns);
 
        return $posts_columns;
        $posts_columns = apply_filters('manage_media_columns', $posts_columns);
 
        return $posts_columns;
@@ -777,7 +840,8 @@ function get_column_headers($page) {
                        $_wp_column_headers[$page] = array(
                                'cb' => '<input type="checkbox" />',
                                'author' => __('Author'),
                        $_wp_column_headers[$page] = array(
                                'cb' => '<input type="checkbox" />',
                                'author' => __('Author'),
-                               'comment' => _c('Comment|noun'),
+                               /* translators: column name */
+                               'comment' => _x('Comment', 'column name'),
                                //'date' => __('Submitted'),
                                'response' => __('In Response To')
                        );
                                //'date' => __('Submitted'),
                                'response' => __('In Response To')
                        );
@@ -789,8 +853,9 @@ function get_column_headers($page) {
                                'name' => __('Name'),
                                'url' => __('URL'),
                                'categories' => __('Categories'),
                                'name' => __('Name'),
                                'url' => __('URL'),
                                'categories' => __('Categories'),
-                               'rel' => __('rel'),
-                               'visible' => __('Visible')
+                               'rel' => __('Relationship'),
+                               'visible' => __('Visible'),
+                               'rating' => __('Rating')
                        );
 
                        break;
                        );
 
                        break;
@@ -821,6 +886,7 @@ function get_column_headers($page) {
                        $_wp_column_headers[$page] = array(
                                'cb' => '<input type="checkbox" />',
                                'name' => __('Name'),
                        $_wp_column_headers[$page] = array(
                                'cb' => '<input type="checkbox" />',
                                'name' => __('Name'),
+                               'description' => __('Description'),
                                'slug' => __('Slug'),
                                'posts' => __('Posts')
                        );
                                'slug' => __('Slug'),
                                'posts' => __('Posts')
                        );
@@ -1014,8 +1080,12 @@ function inline_edit_row( $type ) {
                                <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
                        </label>
 
                                <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
                        </label>
 
-                       <em style="margin:5px 10px 0 0" class="alignleft"><?php echo _c( '&ndash;OR&ndash;|Between password field and private checkbox on post quick edit interface' ); ?></em>
-
+                       <em style="margin:5px 10px 0 0" class="alignleft">
+                               <?php
+                               /* translators: Between password field and private checkbox on post quick edit interface */
+                               echo __( '&ndash;OR&ndash;' );
+                               ?>
+                       </em>
                        <label class="alignleft inline-edit-private">
                                <input type="checkbox" name="keep_private" value="private" />
                                <span class="checkbox-title"><?php echo $is_page ? __('Private page') : __('Private post'); ?></span>
                        <label class="alignleft inline-edit-private">
                                <input type="checkbox" name="keep_private" value="private" />
                                <span class="checkbox-title"><?php echo $is_page ? __('Private page') : __('Private post'); ?></span>
@@ -1143,7 +1213,7 @@ function inline_edit_row( $type ) {
 <?php endif; // $bulk ?>
                                <?php endif; ?>
                                        <option value="pending"><?php _e( 'Pending Review' ); ?></option>
 <?php endif; // $bulk ?>
                                <?php endif; ?>
                                        <option value="pending"><?php _e( 'Pending Review' ); ?></option>
-                                       <option value="draft"><?php _e( 'Unpublished' ); ?></option>
+                                       <option value="draft"><?php _e( 'Draft' ); ?></option>
                                </select>
                        </label>
 
                                </select>
                        </label>
 
@@ -1188,12 +1258,12 @@ function inline_edit_row( $type ) {
                        wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
                        $update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' );
                        ?>
                        wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
                        $update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' );
                        ?>
-                       <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo attribute_escape( $update_text ); ?></a>
-                       <img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
+                       <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
+                       <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
                <?php } else {
                        $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );
                ?>
                <?php } else {
                        $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' );
                ?>
-                       <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo attribute_escape( $update_text ); ?>" />
+                       <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" />
                <?php } ?>
                <input type="hidden" name="post_view" value="<?php echo $m; ?>" />
                <br class="clear" />
                <?php } ?>
                <input type="hidden" name="post_view" value="<?php echo $m; ?>" />
                <br class="clear" />
@@ -1219,7 +1289,7 @@ function get_inline_data($post) {
        if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
                return;
 
        if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
                return;
 
-       $title = attribute_escape($post->post_title);
+       $title = esc_attr($post->post_title);
 
        echo '
 <div class="hidden" id="inline_' . $post->ID . '">
 
        echo '
 <div class="hidden" id="inline_' . $post->ID . '">
@@ -1229,23 +1299,23 @@ function get_inline_data($post) {
        <div class="comment_status">' . $post->comment_status . '</div>
        <div class="ping_status">' . $post->ping_status . '</div>
        <div class="_status">' . $post->post_status . '</div>
        <div class="comment_status">' . $post->comment_status . '</div>
        <div class="ping_status">' . $post->ping_status . '</div>
        <div class="_status">' . $post->post_status . '</div>
-       <div class="jj">' . mysql2date( 'd', $post->post_date ) . '</div>
-       <div class="mm">' . mysql2date( 'm', $post->post_date ) . '</div>
-       <div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div>
-       <div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div>
-       <div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div>
-       <div class="ss">' . mysql2date( 's', $post->post_date ) . '</div>
-       <div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>';
+       <div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div>
+       <div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div>
+       <div class="aa">' . mysql2date( 'Y', $post->post_date, false ) . '</div>
+       <div class="hh">' . mysql2date( 'H', $post->post_date, false ) . '</div>
+       <div class="mn">' . mysql2date( 'i', $post->post_date, false ) . '</div>
+       <div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
+       <div class="post_password">' . esc_html( $post->post_password ) . '</div>';
 
        if( $post->post_type == 'page' )
                echo '
        <div class="post_parent">' . $post->post_parent . '</div>
 
        if( $post->post_type == 'page' )
                echo '
        <div class="post_parent">' . $post->post_parent . '</div>
-       <div class="page_template">' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . '</div>
+       <div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>
        <div class="menu_order">' . $post->menu_order . '</div>';
 
        if( $post->post_type == 'post' )
                echo '
        <div class="menu_order">' . $post->menu_order . '</div>';
 
        if( $post->post_type == 'post' )
                echo '
-       <div class="tags_input">' . wp_specialchars( str_replace( ',', ', ', get_tags_to_edit($post->ID) ), 1) . '</div>
+       <div class="tags_input">' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '</div>
        <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
        <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
 
        <div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
        <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
 
@@ -1262,7 +1332,7 @@ function get_inline_data($post) {
 function post_rows( $posts = array() ) {
        global $wp_query, $post, $mode;
 
 function post_rows( $posts = array() ) {
        global $wp_query, $post, $mode;
 
-       add_filter('the_title','wp_specialchars');
+       add_filter('the_title','esc_html');
 
        // Create array of post IDs.
        $post_ids = array();
 
        // Create array of post IDs.
        $post_ids = array();
@@ -1332,6 +1402,7 @@ function _post_row($a_post, $pending_comments, $mode) {
                case 'date':
                        if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
                                $t_time = $h_time = __('Unpublished');
                case 'date':
                        if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
                                $t_time = $h_time = __('Unpublished');
+                               $time_diff = 0;
                        } else {
                                $t_time = get_the_time(__('Y/m/d g:i:s A'));
                                $m_time = $post->post_date;
                        } else {
                                $t_time = get_the_time(__('Y/m/d g:i:s A'));
                                $m_time = $post->post_date;
@@ -1339,20 +1410,10 @@ function _post_row($a_post, $pending_comments, $mode) {
 
                                $time_diff = time() - $time;
 
 
                                $time_diff = time() - $time;
 
-                               if ( ( 'future' == $post->post_status) ) {
-                                       if ( $time_diff <= 0 ) {
-                                               $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
-                                       } else {
-                                               $h_time = $t_time;
-                                               $missed = true;
-                                       }
-                               } else {
-
-                                       if ( $time_diff > 0 && $time_diff < 24*60*60 )
-                                               $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
-                                       else
-                                               $h_time = mysql2date(__('Y/m/d'), $m_time);
-                               }
+                               if ( $time_diff > 0 && $time_diff < 24*60*60 )
+                                       $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
+                               else
+                                       $h_time = mysql2date(__('Y/m/d'), $m_time);
                        }
 
                        echo '<td ' . $attributes . '>';
                        }
 
                        echo '<td ' . $attributes . '>';
@@ -1364,7 +1425,7 @@ function _post_row($a_post, $pending_comments, $mode) {
                        if ( 'publish' == $post->post_status ) {
                                _e('Published');
                        } elseif ( 'future' == $post->post_status ) {
                        if ( 'publish' == $post->post_status ) {
                                _e('Published');
                        } elseif ( 'future' == $post->post_status ) {
-                               if ( isset($missed) )
+                               if ( $time_diff > 0 )
                                        echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
                                else
                                        _e('Scheduled');
                                        echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
                                else
                                        _e('Scheduled');
@@ -1377,23 +1438,24 @@ function _post_row($a_post, $pending_comments, $mode) {
                case 'title':
                        $attributes = 'class="post-title column-title"' . $style;
                ?>
                case 'title':
                        $attributes = 'class="post-title column-title"' . $style;
                ?>
-               <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
+               <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
                <?php
                        if ( 'excerpt' == $mode )
                                the_excerpt();
 
                        $actions = array();
                        if ( current_user_can('edit_post', $post->ID) ) {
                <?php
                        if ( 'excerpt' == $mode )
                                the_excerpt();
 
                        $actions = array();
                        if ( current_user_can('edit_post', $post->ID) ) {
-                               $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . attribute_escape(__('Edit this post')) . '">' . __('Edit') . '</a>';
-                               $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . attribute_escape(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
-                               $actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+                               $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
+                               $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
+                               $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
                        }
                        if ( in_array($post->post_status, array('pending', 'draft')) ) {
                                if ( current_user_can('edit_post', $post->ID) )
                        }
                        if ( in_array($post->post_status, array('pending', 'draft')) ) {
                                if ( current_user_can('edit_post', $post->ID) )
-                                       $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+                                       $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
                        } else {
                        } else {
-                               $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                               $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                        }
                        }
+                       $actions = apply_filters('post_row_actions', $actions, $post);
                        $action_count = count($actions);
                        $i = 0;
                        echo '<div class="row-actions">';
                        $action_count = count($actions);
                        $i = 0;
                        echo '<div class="row-actions">';
@@ -1417,7 +1479,7 @@ function _post_row($a_post, $pending_comments, $mode) {
                        if ( !empty( $categories ) ) {
                                $out = array();
                                foreach ( $categories as $c )
                        if ( !empty( $categories ) ) {
                                $out = array();
                                foreach ( $categories as $c )
-                                       $out[] = "<a href='edit.php?category_name=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
+                                       $out[] = "<a href='edit.php?category_name=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
                                        echo join( ', ', $out );
                        } else {
                                _e('Uncategorized');
                                        echo join( ', ', $out );
                        } else {
                                _e('Uncategorized');
@@ -1433,7 +1495,7 @@ function _post_row($a_post, $pending_comments, $mode) {
                        if ( !empty( $tags ) ) {
                                $out = array();
                                foreach ( $tags as $c )
                        if ( !empty( $tags ) ) {
                                $out = array();
                                foreach ( $tags as $c )
-                                       $out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
+                                       $out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
                                echo join( ', ', $out );
                        } else {
                                _e('No Tags');
                                echo join( ', ', $out );
                        } else {
                                _e('No Tags');
@@ -1449,7 +1511,7 @@ function _post_row($a_post, $pending_comments, $mode) {
                        $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
                        if ( $pending_comments )
                                echo '<strong>';
                        $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
                        if ( $pending_comments )
                                echo '<strong>';
-                               comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
+                               comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
                                if ( $pending_comments )
                                echo '</strong>';
                ?>
                                if ( $pending_comments )
                                echo '</strong>';
                ?>
@@ -1459,7 +1521,7 @@ function _post_row($a_post, $pending_comments, $mode) {
 
                case 'author':
                ?>
 
                case 'author':
                ?>
-               <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
+               <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
                <?php
                break;
 
                <?php
                break;
 
@@ -1513,7 +1575,24 @@ function display_page_row( $page, $level = 0 ) {
        $post = $page;
        setup_postdata($page);
 
        $post = $page;
        setup_postdata($page);
 
-       $page->post_title = wp_specialchars( $page->post_title );
+       if ( 0 == $level && (int)$page->post_parent > 0 ) {
+               //sent level 0 by accident, by default, or because we don't know the actual level
+               $find_main_page = (int)$page->post_parent;
+               while ( $find_main_page > 0 ) {
+                       $parent = get_page($find_main_page);
+
+                       if ( is_null($parent) )
+                               break;
+
+                       $level++;
+                       $find_main_page = (int)$parent->post_parent;
+
+                       if ( !isset($parent_name) )
+                               $parent_name = $parent->post_title;
+               }
+       }
+
+       $page->post_title = esc_html( $page->post_title );
        $pad = str_repeat( '&#8212; ', $level );
        $id = (int) $page->ID;
        $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
        $pad = str_repeat( '&#8212; ', $level );
        $id = (int) $page->ID;
        $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
@@ -1543,47 +1622,53 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
        case 'date':
                if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
                        $t_time = $h_time = __('Unpublished');
        case 'date':
                if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
                        $t_time = $h_time = __('Unpublished');
+                       $time_diff = 0;
                } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A'));
                        $m_time = $page->post_date;
                        $time = get_post_time('G', true);
 
                } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A'));
                        $m_time = $page->post_date;
                        $time = get_post_time('G', true);
 
-                       if ( ( abs(time() - $time) ) < 86400 ) {
-                               if ( ( 'future' == $page->post_status) )
-                                       $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
-                               else
-                                       $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
-                       } else {
+                       $time_diff = time() - $time;
+
+                       if ( $time_diff > 0 && $time_diff < 24*60*60 )
+                               $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
+                       else
                                $h_time = mysql2date(__('Y/m/d'), $m_time);
                                $h_time = mysql2date(__('Y/m/d'), $m_time);
-                       }
                }
                echo '<td ' . $attributes . '>';
                echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>';
                echo '<br />';
                }
                echo '<td ' . $attributes . '>';
                echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . '</abbr>';
                echo '<br />';
-               if ( 'publish' == $page->post_status || 'future' == $page->post_status )
+               if ( 'publish' == $page->post_status ) {
                        _e('Published');
                        _e('Published');
-               else
+               } elseif ( 'future' == $page->post_status ) {
+                       if ( $time_diff > 0 )
+                               echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
+                       else
+                               _e('Scheduled');
+               } else {
                        _e('Last Modified');
                        _e('Last Modified');
+               }
                echo '</td>';
                break;
        case 'title':
                $attributes = 'class="post-title page-title column-title"' . $style;
                $edit_link = get_edit_post_link( $page->ID );
                ?>
                echo '</td>';
                break;
        case 'title':
                $attributes = 'class="post-title page-title column-title"' . $style;
                $edit_link = get_edit_post_link( $page->ID );
                ?>
-               <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); ?></strong>
+               <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_page', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>
                <?php
                $actions = array();
                if ( current_user_can('edit_page', $page->ID) ) {
                <?php
                $actions = array();
                if ( current_user_can('edit_page', $page->ID) ) {
-                       $actions['edit'] = '<a href="' . $edit_link . '" title="' . attribute_escape(__('Edit this page')) . '">' . __('Edit') . '</a>';
+                       $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
                        $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
                        $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
-                       $actions['delete'] = "<a class='submitdelete' title='" . attribute_escape(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+                       $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
                }
                if ( in_array($post->post_status, array('pending', 'draft')) ) {
                        if ( current_user_can('edit_page', $page->ID) )
                }
                if ( in_array($post->post_status, array('pending', 'draft')) ) {
                        if ( current_user_can('edit_page', $page->ID) )
-                               $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('Preview "%s"'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+                               $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
                } else {
                } else {
-                       $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                       $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                }
                }
+               $actions = apply_filters('page_row_actions', $actions, $page);
                $action_count = count($actions);
 
                $i = 0;
                $action_count = count($actions);
 
                $i = 0;
@@ -1607,7 +1692,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
                if ( $left )
                        echo '<strong>';
                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
                if ( $left )
                        echo '<strong>';
-               comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
+               comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
                if ( $left )
                        echo '</strong>';
                ?>
                if ( $left )
                        echo '</strong>';
                ?>
@@ -1617,7 +1702,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
 
        case 'author':
                ?>
 
        case 'author':
                ?>
-               <td <?php echo $attributes ?>><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
+               <td <?php echo $attributes ?>><a href="edit-pages.php?author=<?php the_author_meta('ID'); ?>"><?php the_author() ?></a></td>
                <?php
                break;
 
                <?php
                break;
 
@@ -1805,17 +1890,24 @@ function user_row( $user_object, $style = '', $role = '' ) {
        if ( strlen( $short_url ) > 35 )
                $short_url = substr( $short_url, 0, 32 ).'...';
        $numposts = get_usernumposts( $user_object->ID );
        if ( strlen( $short_url ) > 35 )
                $short_url = substr( $short_url, 0, 32 ).'...';
        $numposts = get_usernumposts( $user_object->ID );
+       $checkbox = '';
+       // Check if the user for this row is editable
        if ( current_user_can( 'edit_user', $user_object->ID ) ) {
        if ( current_user_can( 'edit_user', $user_object->ID ) ) {
+               // Set up the user editing link
+               // TODO: make profile/user-edit determination a seperate function
                if ($current_user->ID == $user_object->ID) {
                        $edit_link = 'profile.php';
                } else {
                if ($current_user->ID == $user_object->ID) {
                        $edit_link = 'profile.php';
                } else {
-                       $edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
+                       $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
                }
                $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
                }
                $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
+
+               // Set up the hover actions for this user
                $actions = array();
                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                if ( $current_user->ID != $user_object->ID )
                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
                $actions = array();
                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                if ( $current_user->ID != $user_object->ID )
                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "'>" . __('Delete') . "</a>";
+               $actions = apply_filters('user_row_actions', $actions, $user_object);
                $action_count = count($actions);
                $i = 0;
                $edit .= '<div class="row-actions">';
                $action_count = count($actions);
                $i = 0;
                $edit .= '<div class="row-actions">';
@@ -1825,14 +1917,18 @@ function user_row( $user_object, $style = '', $role = '' ) {
                        $edit .= "<span class='$action'>$link$sep</span>";
                }
                $edit .= '</div>';
                        $edit .= "<span class='$action'>$link$sep</span>";
                }
                $edit .= '</div>';
+
+               // Set up the checkbox (because the user is editable, otherwise its empty)
+               $checkbox = "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
+
        } else {
                $edit = '<strong>' . $user_object->user_login . '</strong>';
        }
        } else {
                $edit = '<strong>' . $user_object->user_login . '</strong>';
        }
-       $role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None');
+       $role_name = isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : __('None');
        $r = "<tr id='user-$user_object->ID'$style>";
        $columns = get_column_headers('users');
        $hidden = get_hidden_columns('users');
        $r = "<tr id='user-$user_object->ID'$style>";
        $columns = get_column_headers('users');
        $hidden = get_hidden_columns('users');
-       $avatar = get_avatar( $user_object->user_email, 32 );
+       $avatar = get_avatar( $user_object->ID, 32 );
        foreach ( $columns as $column_name => $column_display_name ) {
                $class = "class=\"$column_name column-$column_name\"";
 
        foreach ( $columns as $column_name => $column_display_name ) {
                $class = "class=\"$column_name column-$column_name\"";
 
@@ -1844,7 +1940,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
 
                switch ($column_name) {
                        case 'cb':
 
                switch ($column_name) {
                        case 'cb':
-                               $r .= "<th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th>";
+                               $r .= "<th scope='row' class='check-column'>$checkbox</th>";
                                break;
                        case 'username':
                                $r .= "<td $attributes>$avatar $edit</td>";
                                break;
                        case 'username':
                                $r .= "<td $attributes>$avatar $edit</td>";
@@ -1869,6 +1965,11 @@ function user_row( $user_object, $style = '', $role = '' ) {
                                        $r .= 0;
                                }
                                $r .= "</td>";
                                        $r .= 0;
                                }
                                $r .= "</td>";
+                               break;
+                       default:
+                               $r .= "<td $attributes>";
+                               $r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID);
+                               $r .= "</td>";
                }
        }
        $r .= '</tr>';
                }
        }
        $r .= '</tr>';
@@ -1895,17 +1996,26 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
        $start = abs( (int) $start );
        $num = (int) $num;
        $post = (int) $post;
        $start = abs( (int) $start );
        $num = (int) $num;
        $post = (int) $post;
+       $count = wp_count_comments();
+       $index = '';
 
 
-       if ( 'moderated' == $status )
+       if ( 'moderated' == $status ) {
                $approved = "comment_approved = '0'";
                $approved = "comment_approved = '0'";
-       elseif ( 'approved' == $status )
+               $total = $count->moderated;
+       } elseif ( 'approved' == $status ) {
                $approved = "comment_approved = '1'";
                $approved = "comment_approved = '1'";
-       elseif ( 'spam' == $status )
+               $total = $count->approved;
+       } elseif ( 'spam' == $status ) {
                $approved = "comment_approved = 'spam'";
                $approved = "comment_approved = 'spam'";
-       else
+               $total = $count->spam;
+       } else {
                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
+               $total = $count->moderated + $count->approved;
+               $index = 'USE INDEX (comment_date_gmt)';
+       }
 
        if ( $post ) {
 
        if ( $post ) {
+               $total = '';
                $post = " AND comment_post_ID = '$post'";
                $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num";
        } else {
                $post = " AND comment_post_ID = '$post'";
                $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num";
        } else {
@@ -1924,24 +2034,29 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
        else
                $typesql = '';
 
        else
                $typesql = '';
 
+       if ( !empty($type) )
+               $total = '';
+
        if ( $s ) {
        if ( $s ) {
+               $total = '';
                $s = $wpdb->escape($s);
                $s = $wpdb->escape($s);
-               $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
+               $query = "FROM $wpdb->comments WHERE
                        (comment_author LIKE '%$s%' OR
                        comment_author_email LIKE '%$s%' OR
                        comment_author_url LIKE ('%$s%') OR
                        comment_author_IP LIKE ('%$s%') OR
                        comment_content LIKE ('%$s%') ) AND
                        $approved
                        (comment_author LIKE '%$s%' OR
                        comment_author_email LIKE '%$s%' OR
                        comment_author_url LIKE ('%$s%') OR
                        comment_author_IP LIKE ('%$s%') OR
                        comment_content LIKE ('%$s%') ) AND
                        $approved
-                       $typesql
-                       $orderby");
+                       $typesql";
        } else {
        } else {
-               $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post $typesql $orderby" );
+               $query = "FROM $wpdb->comments $index WHERE $approved $post $typesql";
        }
 
        }
 
-       update_comment_cache($comments);
+       $comments = $wpdb->get_results("SELECT * $query $orderby");
+       if ( '' === $total )
+               $total = $wpdb->get_var("SELECT COUNT(comment_ID) $query");
 
 
-       $total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
+       update_comment_cache($comments);
 
        return array($comments, $total);
 }
 
        return array($comments, $total);
 }
@@ -1961,6 +2076,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
        $comment = get_comment( $comment_id );
        $post = get_post($comment->comment_post_ID);
        $the_comment_status = wp_get_comment_status($comment->comment_ID);
        $comment = get_comment( $comment_id );
        $post = get_post($comment->comment_post_ID);
        $the_comment_status = wp_get_comment_status($comment->comment_ID);
+       $user_can = current_user_can('edit_post', $post->ID);
 
        $author_url = get_comment_author_url();
        if ( 'http://' == $author_url )
 
        $author_url = get_comment_author_url();
        if ( 'http://' == $author_url )
@@ -1977,10 +2093,10 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
        else
                $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
 
        else
                $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
 
-       $delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
-       $approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
-       $unapprove_url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
-       $spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
+       $delete_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
+       $approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
+       $unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
+       $spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
 
        echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
        $columns = get_column_headers('edit-comments');
 
        echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
        $columns = get_column_headers('edit-comments');
@@ -1998,7 +2114,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                        case 'cb':
                                if ( !$checkbox ) break;
                                echo '<th scope="row" class="check-column">';
                        case 'cb':
                                if ( !$checkbox ) break;
                                echo '<th scope="row" class="check-column">';
-                               if ( current_user_can('edit_post', $post->ID) ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
+                               if ( $user_can ) echo "<input type='checkbox' name='delete_comments[]' value='$comment->comment_ID' />";
                                echo '</th>';
                                break;
                        case 'comment':
                                echo '</th>';
                                break;
                        case 'comment':
@@ -2009,18 +2125,18 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                                comment_text(); ?>
                                <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
                                <textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
                                comment_text(); ?>
                                <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
                                <textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea>
-                               <div class="author-email"><?php echo attribute_escape( $comment->comment_author_email ); ?></div>
-                               <div class="author"><?php echo attribute_escape( $comment->comment_author ); ?></div>
-                               <div class="author-url"><?php echo attribute_escape( $comment->comment_author_url ); ?></div>
+                               <div class="author-email"><?php if ( $user_can ) echo esc_attr( $comment->comment_author_email ); ?></div>
+                               <div class="author"><?php if ( $user_can ) echo esc_attr( $comment->comment_author ); ?></div>
+                               <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
                                <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
                                </div>
                                <?php
                                $actions = array();
 
                                <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
                                </div>
                                <?php
                                $actions = array();
 
-                               if ( current_user_can('edit_post', $post->ID) ) {
+                               if ( $user_can ) {
                                        $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
                                        $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
                                        $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
                                        $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
-                                       if ( $comment_status ) { // not looking at all comments
+                                       if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
                                                if ( 'approved' == $the_comment_status ) {
                                                        $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
                                                        unset($actions['approve']);
                                                if ( 'approved' == $the_comment_status ) {
                                                        $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
                                                        unset($actions['approve']);
@@ -2030,7 +2146,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                                                }
                                        }
                                        if ( 'spam' != $the_comment_status )
                                                }
                                        }
                                        if ( 'spam' != $the_comment_status )
-                                               $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . _c( 'Spam|verb' ) . '</a>';
+                                               $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
                                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
                                        $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
                                        $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
                                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete') . '</a>';
                                        $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
                                        $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick&nbsp;Edit') . '</a>';
@@ -2060,7 +2176,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                                echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
                                if ( !empty($author_url) )
                                        echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
                                echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
                                if ( !empty($author_url) )
                                        echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
-                               if ( current_user_can( 'edit_post', $post->ID ) ) {
+                               if ( $user_can ) {
                                        if ( !empty($comment->comment_author_email) ) {
                                                comment_author_email_link();
                                                echo '<br />';
                                        if ( !empty($comment->comment_author_email) ) {
                                                comment_author_email_link();
                                                echo '<br />';
@@ -2087,26 +2203,34 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
                                                $_comment_pending_count_temp = (array) get_pending_comments_num( array( $post->ID ) );
                                                $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
                                        }
                                                $_comment_pending_count_temp = (array) get_pending_comments_num( array( $post->ID ) );
                                                $pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
                                        }
-                                       if ( current_user_can( 'edit_post', $post->ID ) ) {
+                                       if ( $user_can ) {
                                                $post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
                                                $post_link .= get_the_title($post->ID) . '</a>';
                                        } else {
                                                $post_link = get_the_title($post->ID);
                                        }
                                        echo "<td $attributes>\n";
                                                $post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
                                                $post_link .= get_the_title($post->ID) . '</a>';
                                        } else {
                                                $post_link = get_the_title($post->ID);
                                        }
                                        echo "<td $attributes>\n";
-                                       echo $post_link;
-
                                        echo '<div class="response-links"><span class="post-com-count-wrapper">';
                                        echo '<div class="response-links"><span class="post-com-count-wrapper">';
+                                       echo $post_link . '<br />';
                                        $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
                                        if ( $pending_comments )
                                                echo '<strong>';
                                        $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) );
                                        if ( $pending_comments )
                                                echo '<strong>';
-                                       comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
+                                       comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
                                        if ( $pending_comments )
                                                echo '</strong>';
                                        echo '</span> ';
                                        echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
                                        if ( $pending_comments )
                                                echo '</strong>';
                                        echo '</span> ';
                                        echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
-                                       echo '</div></td>';
+                                       echo '</div>';
+                                       if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) )
+                                               echo $thumb;
+                                       echo '</td>';
                                }
                                }
+                               break;
+                       default:
+                               echo "<td $attributes>\n";
+                               do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
+                               echo "</td>\n";
+                               break;
                }
        }
        echo "</tr>\n";
                }
        }
        echo "</tr>\n";
@@ -2170,7 +2294,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
        <a href="#comments-form" class="save button-primary alignright" tabindex="104">
        <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
        <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
        <a href="#comments-form" class="save button-primary alignright" tabindex="104">
        <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
        <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
-       <img class="waiting" style="display:none;" src="images/loading.gif" alt="" />
+       <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" />
        <span class="error" style="display:none;"></span>
        <br class="clear" />
        </p>
        <span class="error" style="display:none;"></span>
        <br class="clear" />
        </p>
@@ -2182,7 +2306,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
        <input type="hidden" name="status" id="status" value="" />
        <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
        <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
        <input type="hidden" name="status" id="status" value="" />
        <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
        <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
-       <input type="hidden" name="mode" id="mode" value="<?php echo $mode; ?>" />
+       <input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" />
        <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
        <?php wp_comment_form_unfiltered_html_nonce(); ?>
 <?php if ( $table_row ) : ?>
        <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
        <?php wp_comment_form_unfiltered_html_nonce(); ?>
 <?php if ( $table_row ) : ?>
@@ -2214,7 +2338,7 @@ function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $le
                foreach ( $categories as $category ) {
                        if ( $currentcat != $category->term_id && $parent == $category->parent) {
                                $pad = str_repeat( '&#8211; ', $level );
                foreach ( $categories as $category ) {
                        if ( $currentcat != $category->term_id && $parent == $category->parent) {
                                $pad = str_repeat( '&#8211; ', $level );
-                               $category->name = wp_specialchars( $category->name );
+                               $category->name = esc_html( $category->name );
                                echo "\n\t<option value='$category->term_id'";
                                if ( $currentparent == $category->term_id )
                                        echo " selected='selected'";
                                echo "\n\t<option value='$category->term_id'";
                                if ( $currentparent == $category->term_id )
                                        echo " selected='selected'";
@@ -2304,22 +2428,22 @@ function _list_meta_row( $entry, &$count ) {
                }
        }
 
                }
        }
 
-       $entry['meta_key'] = attribute_escape($entry['meta_key']);
+       $entry['meta_key'] = esc_attr($entry['meta_key']);
        $entry['meta_value'] = htmlspecialchars($entry['meta_value']); // using a <textarea />
        $entry['meta_id'] = (int) $entry['meta_id'];
 
        $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
 
        $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
        $entry['meta_value'] = htmlspecialchars($entry['meta_value']); // using a <textarea />
        $entry['meta_id'] = (int) $entry['meta_id'];
 
        $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
 
        $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
-       $r .= "\n\t\t<td class='left'><label class='hidden' for='meta[{$entry['meta_id']}][key]'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' />";
+       $r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta[{$entry['meta_id']}][key]'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' />";
 
        $r .= "\n\t\t<div class='submit'><input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
 
        $r .= "\n\t\t<div class='submit'><input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
-       $r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />";
-       $r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /></div>";
+       $r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='". esc_attr__( 'Delete' ) ."' />";
+       $r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='". esc_attr__( 'Update' ) ."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /></div>";
        $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
        $r .= "</td>";
 
        $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
        $r .= "</td>";
 
-       $r .= "\n\t\t<td><label class='hidden' for='meta[{$entry['meta_id']}][value]'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
+       $r .= "\n\t\t<td><label class='screen-reader-text' for='meta[{$entry['meta_id']}][value]'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
        return $r;
 }
 
        return $r;
 }
 
@@ -2334,9 +2458,9 @@ function meta_form() {
        $keys = $wpdb->get_col( "
                SELECT meta_key
                FROM $wpdb->postmeta
        $keys = $wpdb->get_col( "
                SELECT meta_key
                FROM $wpdb->postmeta
-               WHERE meta_key NOT LIKE '\_%'
                GROUP BY meta_key
                GROUP BY meta_key
-               ORDER BY meta_id DESC
+               HAVING meta_key NOT LIKE '\_%'
+               ORDER BY LOWER(meta_key)
                LIMIT $limit" );
        if ( $keys )
                natcasesort($keys);
                LIMIT $limit" );
        if ( $keys )
                natcasesort($keys);
@@ -2359,8 +2483,8 @@ function meta_form() {
 <?php
 
        foreach ( $keys as $key ) {
 <?php
 
        foreach ( $keys as $key ) {
-               $key = attribute_escape( $key );
-               echo "\n<option value='$key'>$key</option>";
+               $key = esc_attr( $key );
+               echo "\n<option value='" . esc_attr($key) . "'>$key</option>";
        }
 ?>
 </select>
        }
 ?>
 </select>
@@ -2376,7 +2500,7 @@ function meta_form() {
 </tr>
 
 <tr><td colspan="2" class="submit">
 </tr>
 
 <tr><td colspan="2" class="submit">
-<input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
+<input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php esc_attr_e( 'Add Custom Field' ) ?>" />
 <?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
 </td></tr>
 </tbody>
 <?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
 </td></tr>
 </tbody>
@@ -2409,12 +2533,12 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
 
        $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
        $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
 
        $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
        $post_date = ($for_post) ? $post->post_date : $comment->comment_date;
-       $jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj );
-       $mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj );
-       $aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj );
-       $hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj );
-       $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
-       $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
+       $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
+       $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
+       $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );
+       $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );
+       $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );
+       $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );
 
        $cur_jj = gmdate( 'd', $time_adj );
        $cur_mm = gmdate( 'm', $time_adj );
 
        $cur_jj = gmdate( 'd', $time_adj );
        $cur_mm = gmdate( 'm', $time_adj );
@@ -2432,10 +2556,11 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
        $month .= '</select>';
 
        $day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
        $month .= '</select>';
 
        $day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
-       $year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />';
+       $year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';
        $hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
        $minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
        $hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
        $minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
-       printf(_c('%1$s%2$s, %3$s @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
+       /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */
+       printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute);
 
        echo '<input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
 
 
        echo '<input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
 
@@ -2449,8 +2574,6 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
        }
 ?>
 
        }
 ?>
 
-<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
-
 <p>
 <a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
 <a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
 <p>
 <a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
 <a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
@@ -2505,7 +2628,7 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
                        else
                                $current = '';
 
                        else
                                $current = '';
 
-                       echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";
+                       echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
                        parent_dropdown( $default, $item->ID, $level +1 );
                }
        } else {
                        parent_dropdown( $default, $item->ID, $level +1 );
                }
        } else {
@@ -2576,23 +2699,30 @@ function the_attachment_links( $id = false ) {
 <?php
 }
 
 <?php
 }
 
+
 /**
 /**
- * {@internal Missing Short Description}}
+ * Print out <option> html elements for role selectors based on $wp_roles
  *
  *
- * @since unknown
+ * @package WordPress
+ * @subpackage Administration
+ * @since 2.1
  *
  *
- * @param unknown_type $default
+ * @uses $wp_roles
+ * @param string $default slug for the role that should be already selected
  */
  */
-function wp_dropdown_roles( $default = false ) {
+function wp_dropdown_roles( $selected = false ) {
        global $wp_roles;
        $p = '';
        $r = '';
        global $wp_roles;
        $p = '';
        $r = '';
-       foreach( $wp_roles->role_names as $role => $name ) {
-               $name = translate_with_context($name);
-               if ( $default == $role ) // Make default first in list
-                       $p = "\n\t<option selected='selected' value='$role'>$name</option>";
+
+       $editable_roles = get_editable_roles();
+
+       foreach( $editable_roles as $role => $details ) {
+               $name = translate_user_role($details['name'] );
+               if ( $selected == $role ) // Make default first in list
+                       $p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
                else
                else
-                       $r .= "\n\t<option value='$role'>$name</option>";
+                       $r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
        }
        echo $p . $r;
 }
        }
        echo $p . $r;
 }
@@ -2657,8 +2787,13 @@ function wp_max_upload_size() {
 function wp_import_upload_form( $action ) {
        $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
        $size = wp_convert_bytes_to_hr( $bytes );
 function wp_import_upload_form( $action ) {
        $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
        $size = wp_convert_bytes_to_hr( $bytes );
+       $upload_dir = wp_upload_dir();
+       if ( ! empty( $upload_dir['error'] ) ) :
+               ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
+               <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
+       else :
 ?>
 ?>
-<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>">
+<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr($action) ?>">
 <p>
 <?php wp_nonce_field('import-upload'); ?>
 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
 <p>
 <?php wp_nonce_field('import-upload'); ?>
 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
@@ -2667,10 +2802,11 @@ function wp_import_upload_form( $action ) {
 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
 </p>
 <p class="submit">
 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
 </p>
 <p class="submit">
-<input type="submit" class="button" value="<?php _e( 'Upload file and import' ); ?>" />
+<input type="submit" class="button" value="<?php esc_attr_e( 'Upload file and import' ); ?>" />
 </p>
 </form>
 <?php
 </p>
 </form>
 <?php
+       endif;
 }
 
 /**
 }
 
 /**
@@ -2680,7 +2816,7 @@ function wp_import_upload_form( $action ) {
  */
 function wp_remember_old_slug() {
        global $post;
  */
 function wp_remember_old_slug() {
        global $post;
-       $name = attribute_escape($post->post_name); // just in case
+       $name = esc_attr($post->post_name); // just in case
        if ( strlen($name) )
                echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />';
 }
        if ( strlen($name) )
                echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />';
 }
@@ -2697,7 +2833,7 @@ function wp_remember_old_slug() {
  * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
  * @param string $priority The priority within the context where the boxes should show ('high', 'low').
  */
  * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
  * @param string $priority The priority within the context where the boxes should show ('high', 'low').
  */
-function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
+function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args=null) {
        global $wp_meta_boxes;
 
        if ( !isset($wp_meta_boxes) )
        global $wp_meta_boxes;
 
        if ( !isset($wp_meta_boxes) )
@@ -2731,6 +2867,7 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
                } elseif ( 'sorted' == $priority ) {
                        $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
                        $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
                } elseif ( 'sorted' == $priority ) {
                        $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
                        $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
+                       $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
                }
                // An id can be in only one priority and one context
                if ( $priority != $a_priority || $context != $a_context )
                }
                // An id can be in only one priority and one context
                if ( $priority != $a_priority || $context != $a_context )
@@ -2744,7 +2881,7 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
        if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
                $wp_meta_boxes[$page][$context][$priority] = array();
 
        if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
                $wp_meta_boxes[$page][$context][$priority] = array();
 
-       $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
+       $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
 }
 
 /**
 }
 
 /**
@@ -3018,14 +3155,14 @@ function find_posts_div($found_action = '') {
                <div class="find-box-inside">
                        <div class="find-box-search">
                                <?php if ( $found_action ) { ?>
                <div class="find-box-inside">
                        <div class="find-box-search">
                                <?php if ( $found_action ) { ?>
-                                       <input type="hidden" name="found_action" value="<?php echo $found_action; ?>" />
+                                       <input type="hidden" name="found_action" value="<?php echo esc_attr($found_action); ?>" />
                                <?php } ?>
 
                                <input type="hidden" name="affected" id="affected" value="" />
                                <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
                                <?php } ?>
 
                                <input type="hidden" name="affected" id="affected" value="" />
                                <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
-                               <label class="hidden" for="find-posts-input"><?php _e( 'Search' ); ?></label>
-                               <input type="text" id="find-posts-input" class="search-input" name="ps" value="" />
-                               <input type="button" onclick="findPosts.send();" value="<?php _e( 'Search' ); ?>" class="button" /><br />
+                               <label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
+                               <input type="text" id="find-posts-input" name="ps" value="" />
+                               <input type="button" onclick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br />
 
                                <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
                                <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label>
 
                                <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" />
                                <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label>
@@ -3035,123 +3172,25 @@ function find_posts_div($found_action = '') {
                        <div id="find-posts-response"></div>
                </div>
                <div class="find-box-buttons">
                        <div id="find-posts-response"></div>
                </div>
                <div class="find-box-buttons">
-                       <input type="button" class="button" onclick="findPosts.close();" value="<?php _e('Close'); ?>" />
-                       <input id="find-posts-submit" type="submit" class="button" value="<?php _e('Select'); ?>" />
+                       <input type="button" class="button alignleft" onclick="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" />
+                       <input id="find-posts-submit" type="submit" class="button-primary alignright" value="<?php esc_attr_e('Select'); ?>" />
                </div>
        </div>
                </div>
        </div>
-       <script type="text/javascript">
-       /* <![CDATA[ */
-       (function($){
-               findPosts = {
-                       open : function(af_name, af_val) {
-                               var st = document.documentElement.scrollTop || $(document).scrollTop();
-
-                               if ( af_name && af_val )
-                                       $('#affected').attr('name', af_name).val(af_val);
-
-                               $('#find-posts').show().draggable({
-                                       handle: '#find-posts-head'
-                               }).resizable({
-                                       handles: 'all',
-                                       minHeight: 150,
-                                       minWidth: 280
-                               }).css({'top':st+'px','left':'50%','marginLeft':'-200px'});
-
-                               $('.ui-resizable-handle').css({
-                                       'backgroundColor': '#e5e5e5'
-                               });
-
-                               $('.ui-resizable-se').css({
-                                       'border': '0 none',
-                                       'width': '15px',
-                                       'height': '16px',
-                                       'background': 'transparent url(images/se.png) no-repeat scroll 0 0'
-                               });
-
-                               $('#find-posts-input').focus().keyup(function(e){
-                                       if (e.which == 27) findPosts.close(); // close on Escape
-                               });
-
-                               return false;
-                       },
-
-                       close : function() {
-                               $('#find-posts-response').html('');
-                               $('#find-posts').draggable('destroy').resizable('destroy').hide();
-                       },
-
-                       send : function() {
-                               var post = {};
-
-                               post['ps'] = $('#find-posts-input').val();
-                               post['action'] = 'find_posts';
-                               post['_ajax_nonce'] = $('#_ajax_nonce').val();
-
-                               if ( $('#find-posts-pages:checked').val() )
-                                       post['pages'] = 1;
-                               else
-                                       post['posts'] = 1;
-
-                               $.ajax({
-                                       type : 'POST',
-                                       url : '<?php echo admin_url('admin-ajax.php'); ?>',
-                                       data : post,
-                                       success : function(x) { findPosts.show(x); },
-                                       error : function(r) { findPosts.error(r); }
-                               });
-                       },
-
-                       show : function(x) {
-
-                               if ( typeof(x) == 'string' ) {
-                                       this.error({'responseText': x});
-                                       return;
-                               }
-
-                               var r = wpAjax.parseAjaxResponse(x);
-
-                               if ( r.errors )
-                                       this.error({'responseText': wpAjax.broken});
-
-                               r = r.responses[0];
-                               $('#find-posts-response').html(r.data);
-                       },
-
-                       error : function(r) {
-                               var er = r.statusText;
-
-                               if ( r.responseText )
-                                       er = r.responseText.replace( /<.[^<>]*?>/g, '' );
-
-                               if ( er )
-                                       $('#find-posts-response').html(er);
-                       }
-               };
-
-               $(document).ready(function(){
-                       $('#find-posts-submit').click(function(e) {
-                               if ( '' == $('#find-posts-response').html() )
-                                       e.preventDefault();
-                       });
-               });
-       })(jQuery);
-       /* ]]> */
-       </script>
 <?php
 }
 
 /**
  * Display the post password.
  *
 <?php
 }
 
 /**
  * Display the post password.
  *
- * The password is passed through {@link attribute_escape()} to ensure that it
+ * The password is passed through {@link esc_attr()} to ensure that it
  * is safe for placing in an html attribute.
  *
  * is safe for placing in an html attribute.
  *
- * @uses attribute_escape
+ * @uses attr
  * @since 2.7.0
  */
 function the_post_password() {
        global $post;
  * @since 2.7.0
  */
 function the_post_password() {
        global $post;
-       if ( isset( $post->post_password ) ) echo attribute_escape( $post->post_password );
+       if ( isset( $post->post_password ) ) echo esc_attr( $post->post_password );
 }
 
 /**
 }
 
 /**
@@ -3159,7 +3198,52 @@ function the_post_password() {
  *
  * @since unknown
  */
  *
  * @since unknown
  */
-function favorite_actions() {
+function favorite_actions( $screen = null ) {
+       switch ( $screen ) {
+               case 'post-new.php':
+                       $default_action = array('edit.php' => array(__('Edit Posts'), 'edit_posts'));
+                       break;
+               case 'edit-pages.php':
+                       $default_action = array('page-new.php' => array(__('New Page'), 'edit_pages'));
+                       break;
+               case 'page-new.php':
+                       $default_action = array('edit-pages.php' => array(__('Edit Pages'), 'edit_pages'));
+                       break;
+               case 'upload.php':
+                       $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
+                       break;
+               case 'media-new.php':
+                       $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
+                       break;
+               case 'link-manager.php':
+                       $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
+                       break;
+               case 'link-add.php':
+                       $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
+                       break;
+               case 'users.php':
+                       $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
+                       break;
+               case 'user-new.php':
+                       $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
+                       break;
+               case 'plugins.php':
+                       $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
+                       break;
+               case 'plugin-install.php':
+                       $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
+                       break;
+               case 'themes.php':
+                       $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
+                       break;
+               case 'theme-install.php':
+                       $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
+                       break;
+               default:
+                       $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
+                       break;
+       }
+
        $actions = array(
                'post-new.php' => array(__('New Post'), 'edit_posts'),
                'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
        $actions = array(
                'post-new.php' => array(__('New Post'), 'edit_posts'),
                'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
@@ -3168,6 +3252,11 @@ function favorite_actions() {
                'edit-comments.php' => array(__('Comments'), 'moderate_comments')
                );
 
                'edit-comments.php' => array(__('Comments'), 'moderate_comments')
                );
 
+       $default_key = array_keys($default_action);
+       $default_key = $default_key[0];
+       if ( isset($actions[$default_key]) )
+               unset($actions[$default_key]);
+       $actions = array_merge($default_action, $actions);
        $actions = apply_filters('favorite_actions', $actions);
 
        $allowed_actions = array();
        $actions = apply_filters('favorite_actions', $actions);
 
        $allowed_actions = array();
@@ -3219,12 +3308,12 @@ function _draft_or_post_title($post_id = 0)
  * A simple wrapper to display the "s" parameter in a GET URI. This function
  * should only be used when {@link the_search_query()} cannot.
  *
  * A simple wrapper to display the "s" parameter in a GET URI. This function
  * should only be used when {@link the_search_query()} cannot.
  *
- * @uses attribute_escape
+ * @uses attr
  * @since 2.7.0
  *
  */
 function _admin_search_query() {
  * @since 2.7.0
  *
  */
 function _admin_search_query() {
-       echo isset($_GET['s']) ? attribute_escape( stripslashes( $_GET['s'] ) ) : '';
+       echo isset($_GET['s']) ? esc_attr( stripslashes( $_GET['s'] ) ) : '';
 }
 
 /**
 }
 
 /**
@@ -3235,7 +3324,7 @@ function _admin_search_query() {
  * @param bool $limit_styles Limit styles to colour-related styles only (unless others are enqueued).
  *
  */
  * @param bool $limit_styles Limit styles to colour-related styles only (unless others are enqueued).
  *
  */
-function iframe_header( $title = '', $limit_styles = false) {
+function iframe_header( $title = '', $limit_styles = false ) {
 ?><!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
 <head>
 ?><!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
 <head>
@@ -3243,13 +3332,14 @@ function iframe_header( $title = '', $limit_styles = false) {
 <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
 <?php
 wp_enqueue_style( 'global' );
 <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
 <?php
 wp_enqueue_style( 'global' );
-wp_enqueue_style( 'colors' );
 if ( ! $limit_styles )
        wp_enqueue_style( 'wp-admin' );
 if ( ! $limit_styles )
        wp_enqueue_style( 'wp-admin' );
+wp_enqueue_style( 'colors' );
 ?>
 <script type="text/javascript">
 //<![CDATA[
 ?>
 <script type="text/javascript">
 //<![CDATA[
-function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
 //]]>
 </script>
 <?php
 //]]>
 </script>
 <?php
@@ -3269,9 +3359,16 @@ do_action('admin_head');
  *
  */
 function iframe_footer() {
  *
  */
 function iframe_footer() {
-       echo '
-       </body>
-</html>';
+       //We're going to hide any footer output on iframe pages, but run the hooks anyway since they output Javascript or other needed content. ?>
+       <div class="hidden">
+<?php
+       do_action('admin_footer', '');
+       do_action('admin_print_footer_scripts'); ?>
+       </div>
+<script type="text/javascript">if(typeof wpOnload=="function")wpOnload();</script>
+</body>
+</html>
+<?php
 }
 
 function _post_states($post) {
 }
 
 function _post_states($post) {
@@ -3288,7 +3385,12 @@ function _post_states($post) {
        if ( 'draft' == $post->post_status && 'draft' != $post_status )
                $post_states[] = __('Draft');
        if ( 'pending' == $post->post_status && 'pending' != $post_status )
        if ( 'draft' == $post->post_status && 'draft' != $post_status )
                $post_states[] = __('Draft');
        if ( 'pending' == $post->post_status && 'pending' != $post_status )
-               $post_states[] = __('Pending');
+               /* translators: post state */
+               $post_states[] = _x('Pending', 'post state');
+       if ( is_sticky($post->ID) )
+               $post_states[] = __('Sticky');
+
+       $post_states = apply_filters( 'display_post_states', $post_states );
 
        if ( ! empty($post_states) ) {
                $state_count = count($post_states);
 
        if ( ! empty($post_states) ) {
                $state_count = count($post_states);
@@ -3316,25 +3418,96 @@ function screen_meta($screen) {
        if ( isset($meta_screens[$screen]) )
                $screen = $meta_screens[$screen];
        $show_screen = false;
        if ( isset($meta_screens[$screen]) )
                $screen = $meta_screens[$screen];
        $show_screen = false;
-       if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) )
+       $show_on_screen = false;
+       if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) ) {
                $show_screen = true;
                $show_screen = true;
+               $show_on_screen = true;
+       }
+
+       $screen_options = screen_options($screen);
+       if ( $screen_options )
+               $show_screen = true;
+
+       if ( !isset($_wp_contextual_help) )
+               $_wp_contextual_help = array();
+
+       $settings = '';
+
+       switch ( $screen ) {
+               case 'post':
+                       if ( !isset($_wp_contextual_help['post']) ) {
+                               $help = drag_drop_help();
+                               $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
+                               $_wp_contextual_help['post'] = $help;
+                       }
+                       break;
+               case 'page':
+                       if ( !isset($_wp_contextual_help['page']) ) {
+                               $help = drag_drop_help();
+                               $_wp_contextual_help['page'] = $help;
+                       }
+                       break;
+               case 'dashboard':
+                       if ( !isset($_wp_contextual_help['dashboard']) ) {
+                               $help = '<p>' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "</p>\n";
+                               $help .= drag_drop_help();
+                               $_wp_contextual_help['dashboard'] = $help;
+                       }
+                       break;
+               case 'link':
+                       if ( !isset($_wp_contextual_help['link']) ) {
+                               $help = drag_drop_help();
+                               $_wp_contextual_help['link'] = $help;
+                       }
+                       break;
+               case 'options-general':
+                       if ( !isset($_wp_contextual_help['options-general']) )
+                               $_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
+                       break;
+               case 'theme-install':
+               case 'plugin-install':
+                       if ( ( !isset($_GET['tab']) || 'dashboard' == $_GET['tab'] ) && !isset($_wp_contextual_help[$screen]) ) {
+                               $help = plugins_search_help();
+                               $_wp_contextual_help[$screen] = $help;
+                       }
+                       break;
+               case 'theme-editor':
+               case 'plugin-editor':
+                       $settings = '<p><a id="codepress-on" href="' . $screen . '.php?codepress=on">' . __('Enable syntax highlighting') . '</a><a id="codepress-off" href="' . $screen . '.php?codepress=off">' . __('Disable syntax highlighting') . "</a></p>\n";
+                       $show_screen = true;
+                       break;
+               case 'widgets':
+                       if ( !isset($_wp_contextual_help['widgets']) ) {
+                               $help = widgets_help();
+                               $_wp_contextual_help['widgets'] = $help;
+                       }
+                       $settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
+                       $show_screen = true;
+                       break;
+       }
 ?>
 <div id="screen-meta">
 <?php
        if ( $show_screen ) :
 ?>
 <div id="screen-options-wrap" class="hidden">
 ?>
 <div id="screen-meta">
 <?php
        if ( $show_screen ) :
 ?>
 <div id="screen-options-wrap" class="hidden">
+       <form id="adv-settings" action="" method="post">
+<?php if ( $show_on_screen ) : ?>
        <h5><?php _e('Show on screen') ?></h5>
        <h5><?php _e('Show on screen') ?></h5>
-       <form id="adv-settings" action="" method="get">
        <div class="metabox-prefs">
 <?php
        if ( !meta_box_prefs($screen) && isset($column_screens) ) {
                manage_columns_prefs($screen);
        <div class="metabox-prefs">
 <?php
        if ( !meta_box_prefs($screen) && isset($column_screens) ) {
                manage_columns_prefs($screen);
-               wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
        }
 ?>
        <br class="clear" />
        }
 ?>
        <br class="clear" />
-       </div></form>
+       </div>
+<?php endif; ?>
+<?php echo screen_layout($screen); ?>
+<?php echo $screen_options; ?>
+<?php echo $settings; ?>
+<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
+</form>
 </div>
 
 <?php
 </div>
 
 <?php
@@ -3342,33 +3515,6 @@ function screen_meta($screen) {
 
        global $title;
 
 
        global $title;
 
-       if ( !isset($_wp_contextual_help) )
-               $_wp_contextual_help = array();
-
-       if ( !isset($_wp_contextual_help['post']) ) {
-               $help = drag_drop_help();
-               $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
-               $_wp_contextual_help['post'] = $help;
-       }
-
-       if ( !isset($_wp_contextual_help['page']) ) {
-               $help = drag_drop_help();
-               $_wp_contextual_help['page'] = $help;
-       }
-
-       if ( !isset($_wp_contextual_help['dashboard']) ) {
-               $help = drag_drop_help();
-               $_wp_contextual_help['dashboard'] = $help;
-       }
-
-       if ( !isset($_wp_contextual_help['link']) ) {
-               $help = drag_drop_help();
-               $_wp_contextual_help['link'] = $help;
-       }
-
-       if ( !isset($_wp_contextual_help['options-general']) )
-               $_wp_contextual_help['options-general'] =  __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
-
        $_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
        ?>
        <div id="contextual-help-wrap" class="hidden">
        $_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
        ?>
        <div id="contextual-help-wrap" class="hidden">
@@ -3376,7 +3522,7 @@ function screen_meta($screen) {
        $contextual_help = '';
        if ( isset($_wp_contextual_help[$screen]) ) {
                if ( !empty($title) )
        $contextual_help = '';
        if ( isset($_wp_contextual_help[$screen]) ) {
                if ( !empty($title) )
-                       $contextual_help .= '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
+                       $contextual_help .= '<h5>' . sprintf(__('Get help with &#8220;%s&#8221;'), $title) . '</h5>';
                else
                        $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
                $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n";
                else
                        $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
                $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n";
@@ -3387,9 +3533,10 @@ function screen_meta($screen) {
        }
 
        $contextual_help .= '<div class="metabox-prefs">';
        }
 
        $contextual_help .= '<div class="metabox-prefs">';
-       $contextual_help .= __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
-       $contextual_help .= '<br />';
-       $contextual_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
+       $default_help = __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
+       $default_help .= '<br />';
+       $default_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
+       $contextual_help .= apply_filters('default_contextual_help', $default_help);
        $contextual_help .= "</div>\n";
        echo apply_filters('contextual_help', $contextual_help, $screen);
        ?>
        $contextual_help .= "</div>\n";
        echo apply_filters('contextual_help', $contextual_help, $screen);
        ?>
@@ -3428,11 +3575,103 @@ function add_contextual_help($screen, $help) {
 
 function drag_drop_help() {
        return '
 
 function drag_drop_help() {
        return '
-       <p>' .  __('Most of the modules on this screen can be moved. If you hover your mouse over the title bar of a module youll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the module to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the module will be placed when you release the mouse button.') . '</p>
+       <p>' .  __('Most of the modules on this screen can be moved. If you hover your mouse over the title bar of a module you&rsquo;ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the module to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the module will be placed when you release the mouse button.') . '</p>
        <p>' . __('The same modules can be expanded and collapsed by clicking once on their title bar and also completely hidden from the Screen Options tab.') . '</p>
 ';
 }
 
        <p>' . __('The same modules can be expanded and collapsed by clicking once on their title bar and also completely hidden from the Screen Options tab.') . '</p>
 ';
 }
 
+function plugins_search_help() {
+       return '
+       <p><strong>' . __('Search help') . '</strong></p>' .
+       '<p>' . __('You may search based on 3 criteria:') . '<br />' .
+       __('<strong>Term:</strong> Searches theme names and descriptions for the specified term.') . '<br />' .
+       __('<strong>Tag:</strong> Searches for themes tagged as such.') . '<br />' .
+       __('<strong>Author:</strong> Searches for themes created by the Author, or which the Author contributed to.') . '</p>
+';
+}
+
+function widgets_help() {
+       return '
+       <p>' . __('Widgets are added and arranged by simple drag &#8217;n&#8217; drop. If you hover your mouse over the titlebar of a widget, you&#8217;ll see a 4-arrow cursor which indicates that the widget is movable.  Click on the titlebar, hold down the mouse button and drag the widget to a sidebar. As you drag, you&#8217;ll see a dotted box that also moves. This box shows where the widget will go once you drop it.') . '</p>
+       <p>' . __('To remove a widget from a sidebar, drag it back to Available Widgets or click on the arrow on its titlebar to reveal its settings, and then click Remove.') . '</p>
+       <p>' . __('To remove a widget from a sidebar <em>and keep its configuration</em>, drag it to Inactive Widgets.') . '</p>
+       <p>' . __('The Inactive Widgets area stores widgets that are configured but not curently used. If you change themes and the new theme has fewer sidebars than the old, all extra widgets will be stored to Inactive Widgets automatically.') . '</p>
+';
+}
+
+function screen_layout($screen) {
+       global $screen_layout_columns;
+
+       $columns = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2);
+       $columns = apply_filters('screen_layout_columns', $columns, $screen);
+
+       if ( !isset($columns[$screen]) ) {
+               $screen_layout_columns = 0;
+               return '';
+       }
+
+       $screen_layout_columns = get_user_option("screen_layout_$screen");
+       $num = $columns[$screen];
+
+       if ( ! $screen_layout_columns )
+                       $screen_layout_columns = 2;
+
+       $i = 1;
+       $return = '<h5>' . __('Screen Layout') . "</h5>\n<div class='columns-prefs'>" . __('Number of Columns:') . "\n";
+       while ( $i <= $num ) {
+               $return .= "<label><input type='radio' name='screen_columns' value='$i'" . ( ($screen_layout_columns == $i) ? " checked='checked'" : "" ) . " /> $i</label>\n";
+               ++$i;
+       }
+       $return .= "</div>\n";
+       return $return;
+}
+
+function screen_options($screen) {
+       switch ( $screen ) {
+               case 'edit':
+                       $per_page_label = __('Posts per page:');
+                       break;
+               case 'edit-pages':
+                       $per_page_label = __('Pages per page:');
+                       break;
+               case 'edit-comments':
+                       $per_page_label = __('Comments per page:');
+                       break;
+               case 'upload':
+                       $per_page_label = __('Media items per page:');
+                       break;
+               case 'categories':
+                       $per_page_label = __('Categories per page:');
+                       break;
+               case 'edit-tags':
+                       $per_page_label = __('Tags per page:');
+                       break;
+               case 'plugins':
+                       $per_page_label = __('Plugins per page:');
+                       break;
+               default:
+                       return '';
+       }
+
+       $option = str_replace('-', '_', "${screen}_per_page");
+       $per_page = get_user_option($option);
+       if ( empty($per_page) ) {
+               if ( 'plugins' == $screen )
+                       $per_page = 999;
+               else
+                       $per_page = 20;
+       }
+
+       $return = '<h5>' . __('Options') . "</h5>\n";
+       $return .= "<div class='screen-options'>\n";
+       if ( !empty($per_page_label) )
+               $return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' />\n";
+       $return .= "<input type='submit' class='button' value='" . esc_attr__('Apply') . "' />";
+       $return .= "<input type='hidden' name='wp_screen_options[option]' value='" . esc_attr($option) . "' />";
+       $return .= "</div>\n";
+       return $return;
+}
+
 function screen_icon($name = '') {
        global $parent_file, $hook_suffix;
 
 function screen_icon($name = '') {
        global $parent_file, $hook_suffix;
 
@@ -3442,10 +3681,74 @@ function screen_icon($name = '') {
                else
                        $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
        }
                else
                        $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
        }
-       unset($hook_suffix);
 ?>
        <div id="icon-<?php echo $name; ?>" class="icon32"><br /></div>
 <?php
 }
 
 ?>
        <div id="icon-<?php echo $name; ?>" class="icon32"><br /></div>
 <?php
 }
 
+/**
+ * Test support for compressing JavaScript from PHP
+ *
+ * Outputs JavaScript that tests if compression from PHP works as expected
+ * and sets an option with the result. Has no effect when the current user
+ * is not an administrator. To run the test again the option 'can_compress_scripts'
+ * has to be deleted.
+ *
+ * @since 2.8.0
+ */
+function compression_test() {
+?>
+       <script type="text/javascript">
+       /* <![CDATA[ */
+       var testCompression = {
+               get : function(test) {
+                       var x;
+                       if ( window.XMLHttpRequest ) {
+                               x = new XMLHttpRequest();
+                       } else {
+                               try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};}
+                       }
+
+                       if (x) {
+                               x.onreadystatechange = function() {
+                                       var r, h;
+                                       if ( x.readyState == 4 ) {
+                                               r = x.responseText.substr(0, 18);
+                                               h = x.getResponseHeader('Content-Encoding');
+                                               testCompression.check(r, h, test);
+                                       }
+                               }
+
+                               x.open('GET', 'admin-ajax.php?action=wp-compression-test&test='+test+'&'+(new Date()).getTime(), true);
+                               x.send('');
+                       }
+               },
+
+               check : function(r, h, test) {
+                       if ( ! r && ! test )
+                               this.get(1);
+
+                       if ( 1 == test ) {
+                               if ( h && ( h.match(/deflate/i) || h.match(/gzip/i) ) )
+                                       this.get('no');
+                               else
+                                       this.get(2);
+
+                               return;
+                       }
+
+                       if ( 2 == test ) {
+                               if ( '"wpCompressionTest' == r )
+                                       this.get('yes');
+                               else
+                                       this.get('no');
+                       }
+               }
+       };
+       testCompression.check();
+       /* ]]> */
+       </script>
+<?php
+}
+
 ?>
 ?>
diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php
new file mode 100644 (file)
index 0000000..d704d67
--- /dev/null
@@ -0,0 +1,547 @@
+<?php
+/**
+ * WordPress Theme Install Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+$themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),
+       'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
+       'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
+       'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
+       'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
+       'img' => array('src' => array(), 'class' => array(), 'alt' => array())
+);
+
+$theme_field_defaults = array( 'description' => true, 'sections' => false, 'tested' => true, 'requires' => true,
+       'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true,
+       'tags' => true, 'num_ratings' => true
+);
+
+
+/**
+ * Retrieve theme installer pages from WordPress Themes API.
+ *
+ * It is possible for a theme to override the Themes API result with three
+ * filters. Assume this is for themes, which can extend on the Theme Info to
+ * offer more choices. This is very powerful and must be used with care, when
+ * overridding the filters.
+ *
+ * The first filter, 'themes_api_args', is for the args and gives the action as
+ * the second parameter. The hook for 'themes_api_args' must ensure that an
+ * object is returned.
+ *
+ * The second filter, 'themes_api', is the result that would be returned.
+ *
+ * @since 2.8.0
+ *
+ * @param string $action
+ * @param array|object $args Optional. Arguments to serialize for the Theme Info API.
+ * @return mixed
+ */
+function themes_api($action, $args = null) {
+
+       if ( is_array($args) )
+               $args = (object)$args;
+
+       if ( !isset($args->per_page) )
+               $args->per_page = 24;
+
+       $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
+       $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API.
+
+       if ( ! $res ) {
+               $request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
+               if ( is_wp_error($request) ) {
+                       $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occured during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() );
+               } else {
+                       $res = unserialize($request['body']);
+                       if ( ! $res )
+                       $res = new WP_Error('themes_api_failed', __('An unknown error occured'), $request['body']);
+               }
+       }
+       //var_dump(array($args, $res));
+       return apply_filters('themes_api_result', $res, $action, $args);
+}
+
+/**
+ * Retrieve list of WordPress theme features (aka theme tags)
+ *
+ * @since 2.8.0
+ *
+ * @return array
+ */
+function install_themes_feature_list( ) {
+       if ( !$cache = get_transient( 'wporg_theme_feature_list' ) )
+               set_transient( 'wporg_theme_feature_list', array( ),  10800);
+
+       if ( $cache  )
+               return $cache;
+
+       $feature_list = themes_api( 'feature_list', array( ) );
+       if ( is_wp_error( $feature_list ) )
+               return $features;
+
+       set_transient( 'wporg_theme_feature_list', $feature_list, 10800 );
+
+       return $feature_list;
+}
+
+add_action('install_themes_search', 'install_theme_search', 10, 1);
+/**
+ * Display theme search results
+ *
+ * @since 2.8.0
+ *
+ * @param string $page
+ */
+function install_theme_search($page) {
+       global $theme_field_defaults;
+
+       $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
+       $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
+
+       $args = array();
+
+       switch( $type ){
+               case 'tag':
+                       $terms = explode(',', $term);
+                       $terms = array_map('trim', $terms);
+                       $terms = array_map('sanitize_title_with_dashes', $terms);
+                       $args['tag'] = $terms;
+                       break;
+               case 'term':
+                       $args['search'] = $term;
+                       break;
+               case 'author':
+                       $args['author'] = $term;
+                       break;
+       }
+
+       $args['page'] = $page;
+       $args['fields'] = $theme_field_defaults;
+
+       if ( !empty( $_POST['features'] ) ) {
+               $terms = $_POST['features'];
+               $terms = array_map( 'trim', $terms );
+               $terms = array_map( 'sanitize_title_with_dashes', $terms );
+               $args['tag'] = $terms;
+               $_REQUEST['s'] = implode( ',', $terms );
+               $_REQUEST['type'] = 'tag';
+       }
+
+       $api = themes_api('query_themes', $args);
+
+       if ( is_wp_error($api) )
+               wp_die($api);
+
+       add_action('install_themes_table_header', 'install_theme_search_form');
+
+       display_themes($api->themes, $api->info['page'], $api->info['pages']);
+}
+
+/**
+ * Display search form for searching themes.
+ *
+ * @since 2.8.0
+ */
+function install_theme_search_form() {
+       $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
+       $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
+       ?>
+<p class="install-help"><?php _e('Search for themes by keyword, author, or tag.') ?></p>
+
+<form id="search-themes" method="post" action="<?php echo admin_url( 'theme-install.php?tab=search' ); ?>">
+       <select name="type" id="typeselector">
+       <option value="term" <?php selected('term', $type) ?>><?php _e('Term'); ?></option>
+       <option value="author" <?php selected('author', $type) ?>><?php _e('Author'); ?></option>
+       <option value="tag" <?php selected('tag', $type) ?>><?php echo _x('Tag', 'Theme Installer'); ?></option>
+       </select>
+       <input type="text" name="s" size="30" value="<?php echo esc_attr($term) ?>" />
+       <input type="submit" name="search" value="<?php esc_attr_e('Search'); ?>" class="button" />
+</form>
+<?php
+}
+
+add_action('install_themes_dashboard', 'install_themes_dashboard');
+/**
+ * Display tags filter for themes.
+ *
+ * @since 2.8.0
+ */
+function install_themes_dashboard() {
+       install_theme_search_form();
+?>
+<h4><?php _e('Feature Filter') ?></h4>
+<form method="post" action="<?php echo admin_url( 'theme-install.php?tab=search' ); ?>">
+<p class="install-help"><?php _e('Find a theme based on specific features') ?></p>
+       <?php
+       $feature_list = install_themes_feature_list( );
+       echo '<div class="feature-filter">';
+       $trans = array ('Colors' => __('Colors'), 'black' => __('Black'), 'blue' => __('Blue'), 'brown' => __('Brown'),
+               'green' => __('Green'), 'orange' => __('Orange'), 'pink' => __('Pink'), 'purple' => __('Purple'), 'red' => __('Red'),
+               'silver' => __('Silver'), 'tan' => __('Tan'), 'white' => __('White'), 'yellow' => __('Yellow'), 'dark' => __('Dark'),
+               'light' => __('Light'), 'Columns' => __('Columns'), 'one-column' => __('One Column'), 'two-columns' => __('Two Columns'),
+               'three-columns' => __('Three Columns'), 'four-columns' => __('Four Columns'), 'left-sidebar' => __('Left Sidebar'),
+               'right-sidebar' => __('Right Sidebar'), 'Width' => __('Width'), 'fixed-width' => __('Fixed Width'), 'flexible-width' => __('Flexible Width'),
+               'Features' => __('Features'), 'custom-colors' => __('Custom Colors'), 'custom-header' => __('Custom Header'), 'theme-options' => __('Theme Options'),
+               'threaded-comments' => __('Threaded Comments'), 'sticky-post' => __('Sticky Post'), 'microformats' => __('Microformats'),
+               'Subject' => __('Subject'), 'holiday' => __('Holiday'), 'photoblogging' => __('Photoblogging'), 'seasonal' => __('Seasonal'),
+       );
+
+       foreach ( (array) $feature_list as $feature_name => $features ) {
+               if ( isset($trans[$feature_name]) )
+                        $feature_name = $trans[$feature_name];
+               $feature_name = esc_html( $feature_name );
+               echo '<div class="feature-name">' . $feature_name . '</div>';
+
+               echo '<ol style="float: left; width: 725px;" class="feature-group">';
+               foreach ( $features as $feature ) {
+                       $feature_name = $feature;
+                       if ( isset($trans[$feature]) )
+                               $feature_name = $trans[$feature];
+                       $feature_name = esc_html( $feature_name );
+                       $feature = esc_attr($feature);
+?>
+
+<li>
+       <input type="checkbox" name="features[<?php echo $feature; ?>]" id="feature-id-<?php echo $feature; ?>" value="<?php echo $feature; ?>" />
+       <label for="feature-id-<?php echo $feature; ?>"><?php echo $feature_name; ?></label>
+</li>
+
+<?php  } ?>
+</ol>
+<br class="clear" />
+<?php
+       } ?>
+
+</div>
+<br class="clear" />
+<p><input type="submit" name="search" value="<?php esc_attr_e('Find Themes'); ?>" class="button" /></p>
+</form>
+<?php
+}
+
+add_action('install_themes_featured', 'install_themes_featured', 10, 1);
+/**
+ * Display featured themes.
+ *
+ * @since 2.8.0
+ *
+ * @param string $page
+ */
+function install_themes_featured($page = 1) {
+       global $theme_field_defaults;
+       $args = array('browse' => 'featured', 'page' => $page, 'fields' => $theme_field_defaults);
+       $api = themes_api('query_themes', $args);
+       if ( is_wp_error($api) )
+               wp_die($api);
+       display_themes($api->themes, $api->info['page'], $api->info['pages']);
+}
+
+add_action('install_themes_new', 'install_themes_new', 10, 1);
+/**
+ * Display new themes/
+ *
+ * @since 2.8.0
+ *
+ * @param string $page
+ */
+function install_themes_new($page = 1) {
+       global $theme_field_defaults;
+       $args = array('browse' => 'new', 'page' => $page, 'fields' => $theme_field_defaults);
+       $api = themes_api('query_themes', $args);
+       if ( is_wp_error($api) )
+               wp_die($api);
+       display_themes($api->themes, $api->info['page'], $api->info['pages']);
+}
+
+add_action('install_themes_updated', 'install_themes_updated', 10, 1);
+/**
+ * Display recently updated themes.
+ *
+ * @since 2.8.0
+ *
+ * @param string $page
+ */
+function install_themes_updated($page = 1) {
+       global $theme_field_defaults;
+       $args = array('browse' => 'updated', 'page' => $page, 'fields' => $theme_field_defaults);
+       $api = themes_api('query_themes', $args);
+       display_themes($api->themes, $api->info['page'], $api->info['pages']);
+}
+
+add_action('install_themes_upload', 'install_themes_upload', 10, 1);
+function install_themes_upload($page = 1) {
+?>
+<h4><?php _e('Install a theme in .zip format') ?></h4>
+<p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.') ?></p>
+<form method="post" enctype="multipart/form-data" action="<?php echo admin_url('update.php?action=upload-theme') ?>">
+       <?php wp_nonce_field( 'theme-upload') ?>
+       <input type="file" name="themezip" />
+       <input type="submit"
+       class="button" value="<?php esc_attr_e('Install Now') ?>" />
+</form>
+       <?php
+}
+
+function display_theme($theme, $actions = null, $show_details = true) {
+       global $themes_allowedtags;
+
+       if ( empty($theme) )
+               return;
+
+       $name = wp_kses($theme->name, $themes_allowedtags);
+       $desc = wp_kses($theme->description, $themes_allowedtags);
+       //if ( strlen($desc) > 30 )
+       //      $desc =  substr($desc, 0, 15) . '<span class="dots">...</span><span>' . substr($desc, -15) . '</span>';
+
+       $preview_link = $theme->preview_url . '?TB_iframe=true&amp;width=600&amp;height=400';
+       if ( !is_array($actions) ) {
+               $actions = array();
+               $actions[] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
+                                                                               '&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=350') . '" class="thickbox thickbox-preview onclick" title="' . esc_attr(sprintf(__('Install &#8220;%s&#8221;'), $name)) . '">' . __('Install') . '</a>';
+               $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview onclick previewlink" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
+               $actions = apply_filters('theme_install_action_links', $actions, $theme);
+       }
+
+       $actions = implode ( ' | ', $actions );
+       ?>
+<a class='thickbox thickbox-preview screenshot'
+       href='<?php echo esc_url($preview_link); ?>'
+       title='<?php echo esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)); ?>'>
+<img src='<?php echo esc_url($theme->screenshot_url); ?>' width='150' />
+</a>
+<h3><?php echo $name ?></h3>
+<span class='action-links'><?php echo $actions ?></span>
+<p><?php echo $desc ?></p>
+<?php if ( $show_details ) { ?>
+<a href="#theme_detail" class="theme-detail hide-if-no-js" tabindex='4'><?php _e('Details') ?></a>
+<div class="themedetaildiv hide-if-js">
+<p><strong><?php _e('Version:') ?></strong> <?php echo wp_kses($theme->version, $themes_allowedtags) ?></p>
+<p><strong><?php _e('Author:') ?></strong> <?php echo wp_kses($theme->author, $themes_allowedtags) ?></p>
+<?php if ( ! empty($theme->last_updated) ) : ?>
+<p><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $theme->last_updated ?>"><?php printf( __('%s ago'), human_time_diff(strtotime($theme->last_updated)) ) ?></span></p>
+<?php endif; if ( ! empty($theme->requires) ) : ?>
+<p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p>
+<?php endif; if ( ! empty($theme->tested) ) : ?>
+<p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p>
+<?php endif; if ( !empty($theme->downloaded) ) : ?>
+<p><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $theme->downloaded), number_format_i18n($theme->downloaded)) ?></p>
+<?php endif; ?>
+<div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $theme->num_ratings), number_format_i18n($theme->num_ratings)) ?>">
+       <div class="star star-rating" style="width: <?php echo esc_attr($theme->rating) ?>px"></div>
+       <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div>
+       <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div>
+       <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div>
+       <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div>
+       <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
+</div>
+</div>
+<?php }
+       /*
+        object(stdClass)[59]
+        public 'name' => string 'Magazine Basic' (length=14)
+        public 'slug' => string 'magazine-basic' (length=14)
+        public 'version' => string '1.1' (length=3)
+        public 'author' => string 'tinkerpriest' (length=12)
+        public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36)
+        public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)
+        public 'rating' => float 80
+        public 'num_ratings' => int 1
+        public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)
+        public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214)
+        public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)
+        */
+}
+
+/**
+ * Display theme content based on theme list.
+ *
+ * @since 2.8.0
+ *
+ * @param array $themes List of themes.
+ * @param string $page
+ * @param int $totalpages Number of pages.
+ */
+function display_themes($themes, $page = 1, $totalpages = 1) {
+       global $themes_allowedtags;
+
+       $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
+       $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
+       ?>
+<div class="tablenav">
+<div class="alignleft actions"><?php do_action('install_themes_table_header'); ?></div>
+       <?php
+       $url = esc_url($_SERVER['REQUEST_URI']);
+       if ( ! empty($term) )
+               $url = add_query_arg('s', $term, $url);
+       if ( ! empty($type) )
+               $url = add_query_arg('type', $type, $url);
+
+       $page_links = paginate_links( array(
+                       'base' => add_query_arg('paged', '%#%', $url),
+                       'format' => '',
+                       'prev_text' => __('&laquo;'),
+                       'next_text' => __('&raquo;'),
+                       'total' => $totalpages,
+                       'current' => $page
+       ));
+
+       if ( $page_links )
+               echo "\t\t<div class='tablenav-pages'>$page_links</div>";
+       ?>
+</div>
+<br class="clear" />
+<?php
+       if ( empty($themes) ) {
+               _e('No themes found');
+               return;
+       }
+?>
+<table id="availablethemes" cellspacing="0" cellpadding="0">
+<?php
+       $rows = ceil(count($themes) / 3);
+       $table = array();
+       $theme_keys = array_keys($themes);
+       for ( $row = 1; $row <= $rows; $row++ )
+               for ( $col = 1; $col <= 3; $col++ )
+                       $table[$row][$col] = array_shift($theme_keys);
+
+       foreach ( $table as $row => $cols ) {
+       ?>
+       <tr>
+       <?php
+
+       foreach ( $cols as $col => $theme_index ) {
+               $class = array('available-theme');
+               if ( $row == 1 ) $class[] = 'top';
+               if ( $col == 1 ) $class[] = 'left';
+               if ( $row == $rows ) $class[] = 'bottom';
+               if ( $col == 3 ) $class[] = 'right';
+               ?>
+               <td class="<?php echo join(' ', $class); ?>"><?php
+                       if ( isset($themes[$theme_index]) )
+                               display_theme($themes[$theme_index]);
+               ?></td>
+               <?php } // end foreach $cols ?>
+       </tr>
+       <?php } // end foreach $table ?>
+</table>
+
+<div class="tablenav"><?php if ( $page_links )
+echo "\t\t<div class='tablenav-pages'>$page_links</div>"; ?> <br
+       class="clear" />
+</div>
+
+<?php
+}
+
+add_action('install_themes_pre_theme-information', 'install_theme_information');
+
+/**
+ * Display theme information in dialog box form.
+ *
+ * @since 2.8.0
+ */
+function install_theme_information() {
+       //TODO: This function needs a LOT of UI work :)
+       global $tab, $themes_allowedtags;
+
+       $api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) ));
+
+       if ( is_wp_error($api) )
+               wp_die($api);
+
+       // Sanitize HTML
+       foreach ( (array)$api->sections as $section_name => $content )
+               $api->sections[$section_name] = wp_kses($content, $themes_allowedtags);
+       foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )
+               $api->$key = wp_kses($api->$key, $themes_allowedtags);
+
+       iframe_header( __('Theme Install') );
+
+       if ( empty($api->download_link) ) {
+               echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> This theme is currently not available. Please try again later.') . '</p></div>';
+               iframe_footer();
+               exit;
+       }
+
+       if ( !empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>') )
+               echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
+       else if ( !empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<') )
+               echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has not been marked as <strong>compatible</strong> with your version of WordPress.') . '</p></div>';
+
+       // Default to a "new" theme
+       $type = 'install';
+       // Check to see if this theme is known to be installed, and has an update awaiting it.
+       $update_themes = get_transient('update_themes');
+       if ( is_object($update_themes) && isset($update_themes->response) ) {
+               foreach ( (array)$update_themes->response as $theme_slug => $theme_info ) {
+                       if ( $theme_slug === $api->slug ) {
+                               $type = 'update_available';
+                               $update_file = $theme_slug;
+                               break;
+                       }
+               }
+       }
+
+       $themes = get_themes();
+       foreach ( $themes as $this_theme ) {
+               if ( is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug ) {
+                       if ( $this_theme['Version'] == $api->version ) {
+                               $type = 'latest_installed';
+                       } elseif ( $this_theme['Version'] > $api->version ) {
+                               $type = 'newer_installed';
+                               $newer_version = $this_theme['Version'];
+                       }
+                       break;
+               }
+       }
+?>
+
+<div class='available-theme'>
+<img src='<?php echo esc_url($api->screenshot_url) ?>' width='300' class="theme-preview-img" />
+<h3><?php echo $api->name; ?></h3>
+<p><?php printf(__('by %s'), $api->author); ?></p>
+<p><?php printf(__('Version: %s'), $api->version); ?></p>
+
+<?php
+$buttons = '<a class="button" id="cancel" href="#" onclick="tb_close();return false;">' . __('Cancel') . '</a> ';
+
+switch ( $type ) {
+default:
+case 'install':
+       if ( current_user_can('install_themes') ) :
+       $buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>';
+       endif;
+       break;
+case 'update_available':
+       if ( current_user_can('update_themes') ) :
+       $buttons .= '<a class="button-primary" id="install"     href="' . wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '" target="_parent">' . __('Install Update Now') . '</a>';
+       endif;
+       break;
+case 'newer_installed':
+       if ( current_user_can('install_themes') || current_user_can('update_themes') ) :
+       ?><p><?php printf(__('Newer version (%s) is installed.'), $newer_version); ?></p><?php
+       endif;
+       break;
+case 'latest_installed':
+       if ( current_user_can('install_themes') || current_user_can('update_themes') ) :
+       ?><p><?php _e('This version is already installed.'); ?></p><?php
+       endif;
+       break;
+} ?>
+<br class="clear" />
+</div>
+
+<p class="action-button">
+<?php echo $buttons; ?>
+<br class="clear" />
+</p>
+
+<?php
+       iframe_footer();
+       exit;
+}
index 8b883e23ab1fa2345e3e0f7f82769866ab2b51df..f6eb03df30fd0d998ee4fd31fb02d9b3dd1aac92 100644 (file)
@@ -31,6 +31,75 @@ function current_theme_info() {
        return $ct;
 }
 
        return $ct;
 }
 
+/**
+ * Remove a theme
+ *
+ * @since 2.8.0
+ *
+ * @param string $template Template directory of the theme to delete
+ * @return mixed
+ */
+function delete_theme($template) {
+       global $wp_filesystem;
+
+       if ( empty($template) )
+               return false;
+
+       ob_start();
+       $url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
+       if ( false === ($credentials = request_filesystem_credentials($url)) ) {
+               $data = ob_get_contents();
+               ob_end_clean();
+               if ( ! empty($data) ){
+                       include_once( ABSPATH . 'wp-admin/admin-header.php');
+                       echo $data;
+                       include( ABSPATH . 'wp-admin/admin-footer.php');
+                       exit;
+               }
+               return;
+       }
+
+       if ( ! WP_Filesystem($credentials) ) {
+               request_filesystem_credentials($url, '', true); // Failed to connect, Error and request again
+               $data = ob_get_contents();
+               ob_end_clean();
+               if( ! empty($data) ){
+                       include_once( ABSPATH . 'wp-admin/admin-header.php');
+                       echo $data;
+                       include( ABSPATH . 'wp-admin/admin-footer.php');
+                       exit;
+               }
+               return;
+       }
+
+
+       if ( ! is_object($wp_filesystem) )
+               return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
+
+       if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
+               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
+
+       //Get the base plugin folder
+       $themes_dir = $wp_filesystem->wp_themes_dir();
+       if ( empty($themes_dir) )
+               return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.'));
+
+       $themes_dir = trailingslashit( $themes_dir );
+
+       $errors = array();
+
+       $theme_dir = trailingslashit($themes_dir . $template);
+       $deleted = $wp_filesystem->delete($theme_dir, true);
+
+       if ( ! $deleted )
+               return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s'), $template) );
+
+       // Force refresh of theme update information
+       delete_transient('update_themes');
+
+       return true;
+}
+
 /**
  * {@internal Missing Short Description}}
  *
 /**
  * {@internal Missing Short Description}}
  *
@@ -64,11 +133,7 @@ function get_page_templates() {
 
                        $name = '';
                        if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) )
 
                        $name = '';
                        if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) )
-                               $name = $name[1];
-
-                       $description = '';
-                       if( preg_match( '|Description:(.*)$|mi', $template_data, $description ) )
-                               $description = $description[1];
+                               $name = _cleanup_header_comment($name[1]);
 
                        if ( !empty( $name ) ) {
                                $page_templates[trim( $name )] = basename( $template );
 
                        if ( !empty( $name ) ) {
                                $page_templates[trim( $name )] = basename( $template );
index 2e4781b2fe9a0efdbdd49685ed8bbdb374089083..9aac1e77b7ff2078ea1cc80389bc703f7aa50364 100644 (file)
@@ -161,11 +161,7 @@ $_old_files = array(
 'wp-images/smilies',
 'wp-images/wp-small.png',
 'wp-images/wpminilogo.png',
 'wp-images/smilies',
 'wp-images/wp-small.png',
 'wp-images/wpminilogo.png',
-'wp.php',
-'wp-content/themes/default/attachment.php',
-'wp-content/themes/default/images/kubrickbg.jpg',
-'wp-content/plugins/markdown.php',
-'wp-content/plugins/textile1.php',
+'wp.php'
 );
 
 /**
 );
 
 /**
@@ -233,7 +229,7 @@ function update_core($from, $to) {
        $result = copy_dir($from . '/wordpress', $to);
        if ( is_wp_error($result) ) {
                $wp_filesystem->delete($maintenance_file);
        $result = copy_dir($from . '/wordpress', $to);
        if ( is_wp_error($result) ) {
                $wp_filesystem->delete($maintenance_file);
-               //$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
+               $wp_filesystem->delete($working_dir, true);
                return $result;
        }
 
                return $result;
        }
 
@@ -254,7 +250,10 @@ function update_core($from, $to) {
        $wp_filesystem->delete($from, true);
 
        // Force refresh of update information
        $wp_filesystem->delete($from, true);
 
        // Force refresh of update information
-       delete_option('update_core');
+       if ( function_exists('delete_transient') )
+               delete_transient('update_core');
+       else
+               delete_option('update_core');
 
        // Remove maintenance file, we're done.
        $wp_filesystem->delete($maintenance_file);
 
        // Remove maintenance file, we're done.
        $wp_filesystem->delete($maintenance_file);
index c90bd7aae615fd35038d6fa24be9d03ad477a568..0db0882c6a4e358f325b5ac798b7e05be644d483 100644 (file)
@@ -33,10 +33,10 @@ function get_core_updates( $options = array() ) {
        $options = array_merge( array('available' => true, 'dismissed' => false ), $options );
        $dismissed = get_option( 'dismissed_update_core' );
        if ( !is_array( $dismissed ) ) $dismissed = array();
        $options = array_merge( array('available' => true, 'dismissed' => false ), $options );
        $dismissed = get_option( 'dismissed_update_core' );
        if ( !is_array( $dismissed ) ) $dismissed = array();
-       $from_api = get_option( 'update_core' );
+       $from_api = get_transient( 'update_core' );
        if ( empty($from_api) )
                return false;
        if ( empty($from_api) )
                return false;
-       if ( !is_array( $from_api->updates ) ) return false;
+       if ( !isset( $from_api->updates ) || !is_array( $from_api->updates ) ) return false;
        $updates = $from_api->updates;
        if ( !is_array( $updates ) ) return false;
        $result = array();
        $updates = $from_api->updates;
        if ( !is_array( $updates ) ) return false;
        $result = array();
@@ -71,7 +71,7 @@ function undismiss_core_update( $version, $locale ) {
 }
 
 function find_core_update( $version, $locale ) {
 }
 
 function find_core_update( $version, $locale ) {
-       $from_api = get_option( 'update_core' );
+       $from_api = get_transient( 'update_core' );
        if ( !is_array( $from_api->updates ) ) return false;
        $updates = $from_api->updates;
        foreach($updates as $update) {
        if ( !is_array( $from_api->updates ) ) return false;
        $updates = $from_api->updates;
        foreach($updates as $update) {
@@ -83,7 +83,7 @@ function find_core_update( $version, $locale ) {
 
 function core_update_footer( $msg = '' ) {
        if ( !current_user_can('manage_options') )
 
 function core_update_footer( $msg = '' ) {
        if ( !current_user_can('manage_options') )
-               return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );
+               return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
 
        $cur = get_preferred_from_update_core();
        if ( ! isset( $cur->current ) )
 
        $cur = get_preferred_from_update_core();
        if ( ! isset( $cur->current ) )
@@ -146,333 +146,61 @@ function update_right_now_message() {
 }
 
 function wp_plugin_update_row( $file, $plugin_data ) {
 }
 
 function wp_plugin_update_row( $file, $plugin_data ) {
-       $current = get_option( 'update_plugins' );
+       $current = get_transient( 'update_plugins' );
        if ( !isset( $current->response[ $file ] ) )
                return false;
 
        $r = $current->response[ $file ];
 
        if ( !isset( $current->response[ $file ] ) )
                return false;
 
        $r = $current->response[ $file ];
 
+       $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+       $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
+
        $details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
 
        $details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
 
-       echo '<tr><td colspan="5" class="plugin-update">';
+       echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
        if ( ! current_user_can('update_plugins') )
        if ( ! current_user_can('update_plugins') )
-               printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.'), $plugin_data['Name'], $details_url, $r->new_version);
+               printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
        else if ( empty($r->package) )
        else if ( empty($r->package) )
-               printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $details_url, $r->new_version);
+               printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
        else
        else
-               printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $details_url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;plugin=' . $file, 'upgrade-plugin_' . $file) );
+               printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a> or <a href="%5$s">upgrade automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $file, 'upgrade-plugin_' . $file) );
 
 
-       echo '</td></tr>';
+       do_action( "in_plugin_update_message-$file", $plugin_data, $r );
+
+       echo '</div></td></tr>';
 }
 add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
 
 function wp_update_plugin($plugin, $feedback = '') {
 }
 add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
 
 function wp_update_plugin($plugin, $feedback = '') {
-       global $wp_filesystem;
 
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
 
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
-       // Is an update available?
-       $current = get_option( 'update_plugins' );
-       if ( !isset( $current->response[ $plugin ] ) )
-               return new WP_Error('up_to_date', __('The plugin is at the latest version.'));
-
-       // Is a filesystem accessor setup?
-       if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
-               WP_Filesystem();
-
-       if ( ! is_object($wp_filesystem) )
-               return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
-
-       if ( $wp_filesystem->errors->get_error_code() )
-               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
-
-       //Get the base plugin folder
-       $plugins_dir = $wp_filesystem->wp_plugins_dir();
-       if ( empty($plugins_dir) )
-               return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
-
-       //And the same for the Content directory.
-       $content_dir = $wp_filesystem->wp_content_dir();
-       if( empty($content_dir) )
-               return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
-
-       $plugins_dir = trailingslashit( $plugins_dir );
-       $content_dir = trailingslashit( $content_dir );
-
-       // Get the URL to the zip file
-       $r = $current->response[ $plugin ];
-
-       if ( empty($r->package) )
-               return new WP_Error('no_package', __('Upgrade package not available.'));
-
-       // Download the package
-       $package = $r->package;
-       apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
-       $download_file = download_url($package);
-
-       if ( is_wp_error($download_file) )
-               return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());
-
-       $working_dir = $content_dir . 'upgrade/' . basename($plugin, '.php');
-
-       // Clean up working directory
-       if ( $wp_filesystem->is_dir($working_dir) )
-               $wp_filesystem->delete($working_dir, true);
-
-       apply_filters('update_feedback', __('Unpacking the update'));
-       // Unzip package to working directory
-       $result = unzip_file($download_file, $working_dir);
-
-       // Once extracted, delete the package
-       unlink($download_file);
-
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       if ( is_plugin_active($plugin) ) {
-               //Deactivate the plugin silently, Prevent deactivation hooks from running.
-               apply_filters('update_feedback', __('Deactivating the plugin'));
-               deactivate_plugins($plugin, true);
-       }
-
-       // Remove the existing plugin.
-       apply_filters('update_feedback', __('Removing the old version of the plugin'));
-       $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
-
-       // If plugin is in its own directory, recursively delete the directory.
-       if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
-               $deleted = $wp_filesystem->delete($this_plugin_dir, true);
-       else
-               $deleted = $wp_filesystem->delete($plugins_dir . $plugin);
-
-       if ( ! $deleted ) {
-               $wp_filesystem->delete($working_dir, true);
-               return new WP_Error('delete_failed', __('Could not remove the old plugin'));
-       }
-
-       apply_filters('update_feedback', __('Installing the latest version'));
-       // Copy new version of plugin into place.
-       $result = copy_dir($working_dir, $plugins_dir);
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
-       $filelist = array_keys( $wp_filesystem->dirlist($working_dir) );
-
-       // Remove working directory
-       $wp_filesystem->delete($working_dir, true);
-
-       // Force refresh of plugin update information
-       delete_option('update_plugins');
-
-       if( empty($filelist) )
-               return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
-
-       $folder = $filelist[0];
-       $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
-       $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
-
-       return  $folder . '/' . $pluginfiles[0];
+       include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+       $upgrader = new Plugin_Upgrader();
+       return $upgrader->upgrade($plugin);
 }
 
 function wp_update_theme($theme, $feedback = '') {
 }
 
 function wp_update_theme($theme, $feedback = '') {
-       global $wp_filesystem;
 
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
 
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
-       // Is an update available?
-       $current = get_option( 'update_themes' );
-       if ( !isset( $current->response[ $theme ] ) )
-               return new WP_Error('up_to_date', __('The theme is at the latest version.'));
-
-       $r = $current->response[ $theme ];
-
-       $themes = get_themes();
-       foreach ( (array) $themes as $this_theme ) {
-               if ( $this_theme['Stylesheet'] == $theme ) {
-                       $theme_directory = preg_replace('!^/themes/!i', '', $this_theme['Stylesheet Dir']);
-                       break;
-               }
-       }
-       unset($themes);
-
-       if ( empty($theme_directory) )
-               return new WP_Error('theme_non_existant', __('Theme does not exist.'));
-
-       // Is a filesystem accessor setup?
-       if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
-               WP_Filesystem();
-
-       if ( ! is_object($wp_filesystem) )
-               return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
-
-       if ( $wp_filesystem->errors->get_error_code() )
-               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
-
-       //Get the base plugin folder
-       $themes_dir = $wp_filesystem->wp_themes_dir();
-       if ( empty($themes_dir) )
-               return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress Theme directory.'));
-
-       //And the same for the Content directory.
-       $content_dir = $wp_filesystem->wp_content_dir();
-       if( empty($content_dir) )
-               return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
-
-       $themes_dir = trailingslashit( $themes_dir );
-       $content_dir = trailingslashit( $content_dir );
-
-       if ( empty($r->package) )
-               return new WP_Error('no_package', __('Upgrade package not available.'));
-
-       // Download the package
-       apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $r['package']));
-       $download_file = download_url($r['package']);
-
-       if ( is_wp_error($download_file) )
-               return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());
-
-       $working_dir = $content_dir . 'upgrade/' . basename($theme_directory);
-
-       // Clean up working directory
-       if ( $wp_filesystem->is_dir($working_dir) )
-               $wp_filesystem->delete($working_dir, true);
-
-       apply_filters('update_feedback', __('Unpacking the update'));
-       // Unzip package to working directory
-       $result = unzip_file($download_file, $working_dir);
-
-       // Once extracted, delete the package
-       unlink($download_file);
-
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       //TODO: Is theme currently active? If so, set default theme
-       /*
-       if ( is_plugin_active($plugin) ) {
-               //Deactivate the plugin silently, Prevent deactivation hooks from running.
-               apply_filters('update_feedback', __('Deactivating the plugin'));
-               deactivate_plugins($plugin, true);
-       }*/
-
-       // Remove the existing plugin.
-       apply_filters('update_feedback', __('Removing the old version of the theme'));
-       $deleted = $wp_filesystem->delete($themes_dir . $theme_directory, true);
-
-       if ( ! $deleted ) {
-               $wp_filesystem->delete($working_dir, true);
-               return new WP_Error('delete_failed', __('Could not remove the old plugin'));
-       }
-
-       apply_filters('update_feedback', __('Installing the latest version'));
-       // Copy new version of plugin into place.
-       $result = copy_dir($working_dir, $themes_dir);
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
-       //$filelist = array_keys( $wp_filesystem->dirlist($working_dir) );
-
-       // Remove working directory
-       $wp_filesystem->delete($working_dir, true);
-
-       // Force refresh of plugin update information
-       delete_option('update_themes');
-
-       /*if( empty($filelist) )
-               return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
-
-       $folder = $filelist[0];
-       $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
-       $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
-
-       return  $folder . '/' . $pluginfiles[0];*/
+       include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+       $upgrader = new Theme_Upgrader();
+       return $upgrader->upgrade($theme);
 }
 
 
 function wp_update_core($current, $feedback = '') {
 }
 
 
 function wp_update_core($current, $feedback = '') {
-       global $wp_filesystem;
-
-       @set_time_limit( 300 );
 
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
 
        if ( !empty($feedback) )
                add_filter('update_feedback', $feedback);
 
-       // Is an update available?
-       if ( !isset( $current->response ) || $current->response == 'latest' )
-               return new WP_Error('up_to_date', __('WordPress is at the latest version.'));
-
-       // Is a filesystem accessor setup?
-       if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
-               WP_Filesystem();
-
-       if ( ! is_object($wp_filesystem) )
-               return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
-
-       if ( $wp_filesystem->errors->get_error_code() )
-               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
-
-       // Get the base WP folder
-       $wp_dir = $wp_filesystem->abspath();
-       if ( empty($wp_dir) )
-               return new WP_Error('fs_no_wp_dir', __('Unable to locate WordPress directory.'));
-
-       // And the same for the Content directory.
-       $content_dir = $wp_filesystem->wp_content_dir();
-       if( empty($content_dir) )
-               return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
-
-       $wp_dir = trailingslashit( $wp_dir );
-       $content_dir = trailingslashit( $content_dir );
-
-       // Get the URL to the zip file
-       $package = $current->package;
-
-       // Download the package
-       apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
-       $download_file = download_url($package);
-
-       if ( is_wp_error($download_file) )
-               return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());
-
-       $working_dir = $content_dir . 'upgrade/core';
-       // Clean up working directory
-       if ( $wp_filesystem->is_dir($working_dir) ) {
-               $wp_filesystem->delete($working_dir, true);
-       }
-
-       apply_filters('update_feedback', __('Unpacking the core update'));
-       // Unzip package to working directory
-       $result = unzip_file($download_file, $working_dir);
-       // Once extracted, delete the package
-       unlink($download_file);
-
-       if ( is_wp_error($result) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return $result;
-       }
-
-       // Copy update-core.php from the new version into place.
-       if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) {
-               $wp_filesystem->delete($working_dir, true);
-               return new WP_Error('copy_failed', __('Could not copy files'));
-       }
-       $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
-
-       require(ABSPATH . 'wp-admin/includes/update-core.php');
+       include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+       $upgrader = new Core_Upgrader();
+       return $upgrader->upgrade($current);
 
 
-       return update_core($working_dir, $wp_dir);
 }
 
 function maintenance_nag() {
 }
 
 function maintenance_nag() {
index 4919fd4317c65e992c487466f80eedb1f4d43103..a4d5abaece20082e0dde9bd17ac46b6b7c8e8da1 100644 (file)
@@ -20,7 +20,7 @@ require_once(ABSPATH . 'wp-admin/includes/schema.php');
 
 if ( !function_exists('wp_install') ) :
 /**
 
 if ( !function_exists('wp_install') ) :
 /**
- * {@internal Missing Short Description}}
+ * Installs the blog
  *
  * {@internal Missing Long Description}}
  *
  *
  * {@internal Missing Long Description}}
  *
@@ -31,7 +31,7 @@ if ( !function_exists('wp_install') ) :
  * @param string $user_email User's email.
  * @param bool $public Whether blog is public.
  * @param null $deprecated Optional. Not used.
  * @param string $user_email User's email.
  * @param bool $public Whether blog is public.
  * @param null $deprecated Optional. Not used.
- * @return array Array keys 'url', 'user_id', 'password'.
+ * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
  */
 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
        global $wp_rewrite;
  */
 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
        global $wp_rewrite;
@@ -59,9 +59,12 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
        $user_id = username_exists($user_name);
        if ( !$user_id ) {
                $random_password = wp_generate_password();
        $user_id = username_exists($user_name);
        if ( !$user_id ) {
                $random_password = wp_generate_password();
+               $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
                $user_id = wp_create_user($user_name, $random_password, $user_email);
                $user_id = wp_create_user($user_name, $random_password, $user_email);
+               update_usermeta($user_id, 'default_password_nag', true);
        } else {
        } else {
-               $random_password = __('User already exists.  Password inherited.');
+               $random_password = '';
+               $message =  __('User already exists.  Password inherited.');
        }
 
        $user = new WP_User($user_id);
        }
 
        $user = new WP_User($user_id);
@@ -75,7 +78,7 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
 
        wp_cache_flush();
 
 
        wp_cache_flush();
 
-       return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password);
+       return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password, 'password_message' => $message);
 }
 endif;
 
 }
 endif;
 
@@ -93,52 +96,116 @@ function wp_install_defaults($user_id) {
        global $wpdb;
 
        // Default category
        global $wpdb;
 
        // Default category
-       $cat_name = $wpdb->escape(__('Uncategorized'));
-       $cat_slug = sanitize_title(_c('Uncategorized|Default category slug'));
-       $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
-       $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('1', 'category', '', '0', '1')");
-
-       // Default link category
-       $cat_name = $wpdb->escape(__('Blogroll'));
-       $cat_slug = sanitize_title(_c('Blogroll|Default link category slug'));
-       $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
-       $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('2', 'link_category', '', '0', '7')");
-
-       // Now drop in some default links
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://codex.wordpress.org/', 'Documentation', 0, '', '');");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 2)" );
+       $cat_name = __('Uncategorized');
+       /* translators: Default category slug */
+       $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
 
 
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/development/', 'Development Blog', 0, 'http://wordpress.org/development/feed/', '');");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (2, 2)" );
+       $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
+       $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '1', 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
 
 
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/extend/ideas/', 'Suggest Ideas', 0, '', '');");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (3, 2)" );
-
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/support/', 'Support Forum', 0, '', '');");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (4, 2)" );
-
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/extend/plugins/', 'Plugins', 0, '', '');");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (5, 2)" );
+       // Default link category
+       $cat_name = __('Blogroll');
+       /* translators: Default link category slug */
+       $cat_slug = sanitize_title(_x('Blogroll', 'Default link category slug'));
 
 
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/extend/themes/', 'Themes', 0, '', '');");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (6, 2)" );
+       $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
+       $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '2', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7));
 
 
-       $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://planet.wordpress.org/', 'WordPress Planet', 0, '', '');");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (7, 2)" );
+       // Now drop in some default links
+       $default_links = array();
+       $default_links[] = array(       'link_url' => 'http://codex.wordpress.org/',
+                                                               'link_name' => 'Documentation',
+                                                               'link_rss' => '',
+                                                               'link_notes' => '');
+
+       $default_links[] = array(       'link_url' => 'http://wordpress.org/development/',
+                                                               'link_name' => 'Development Blog',
+                                                               'link_rss' => 'http://wordpress.org/development/feed/',
+                                                               'link_notes' => '');
+
+       $default_links[] = array(       'link_url' => 'http://wordpress.org/extend/ideas/',
+                                                               'link_name' => 'Suggest Ideas',
+                                                               'link_rss' => '',
+                                                               'link_notes' =>'');
+
+       $default_links[] = array(       'link_url' => 'http://wordpress.org/support/',
+                                                               'link_name' => 'Support Forum',
+                                                               'link_rss' => '',
+                                                               'link_notes' =>'');
+
+       $default_links[] = array(       'link_url' => 'http://wordpress.org/extend/plugins/',
+                                                               'link_name' => 'Plugins',
+                                                               'link_rss' => '',
+                                                               'link_notes' =>'');
+
+       $default_links[] = array(       'link_url' => 'http://wordpress.org/extend/themes/',
+                                                               'link_name' => 'Themes',
+                                                               'link_rss' => '',
+                                                               'link_notes' =>'');
+
+       $default_links[] = array(       'link_url' => 'http://planet.wordpress.org/',
+                                                               'link_name' => 'WordPress Planet',
+                                                               'link_rss' => '',
+                                                               'link_notes' =>'');
+
+       foreach ( $default_links as $link ) {
+               $wpdb->insert( $wpdb->links, $link);
+               $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 2, 'object_id' => $wpdb->insert_id) );
+       }
 
        // First post
        $now = date('Y-m-d H:i:s');
        $now_gmt = gmdate('Y-m-d H:i:s');
        $first_post_guid = get_option('home') . '/?p=1';
 
        // First post
        $now = date('Y-m-d H:i:s');
        $now_gmt = gmdate('Y-m-d H:i:s');
        $first_post_guid = get_option('home') . '/?p=1';
-       $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(_c('hello-world|Default post slug'))."', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')");
-       $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 1)" );
 
 
-       // Default comment
-       $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.'))."')");
+       $wpdb->insert( $wpdb->posts, array(
+                                                               'post_author' => $user_id,
+                                                               'post_date' => $now,
+                                                               'post_date_gmt' => $now_gmt,
+                                                               'post_content' => __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'),
+                                                               'post_excerpt' => '',
+                                                               'post_title' => __('Hello world!'),
+                                                               /* translators: Default post slug */
+                                                               'post_name' => _x('hello-world', 'Default post slug'),
+                                                               'post_modified' => $now,
+                                                               'post_modified_gmt' => $now_gmt,
+                                                               'guid' => $first_post_guid,
+                                                               'comment_count' => 1,
+                                                               'to_ping' => '',
+                                                               'pinged' => '',
+                                                               'post_content_filtered' => ''
+                                                               ));
+       $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 1, 'object_id' => 1) );
 
 
+       // Default comment
+       $wpdb->insert( $wpdb->comments, array(
+                                                               'comment_post_ID' => 1,
+                                                               'comment_author' => __('Mr WordPress'),
+                                                               'comment_author_email' => '',
+                                                               'comment_author_url' => 'http://wordpress.org/',
+                                                               'comment_date' => $now,
+                                                               'comment_date_gmt' => $now_gmt,
+                                                               'comment_content' => __('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.')
+                                                               ));
        // First Page
        $first_post_guid = get_option('home') . '/?page_id=2';
        // First Page
        $first_post_guid = get_option('home') . '/?page_id=2';
-       $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(_c('about|Default page slug'))."', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')");
+       $wpdb->insert( $wpdb->posts, array(
+                                                               'post_author' => $user_id,
+                                                               'post_date' => $now,
+                                                               'post_date_gmt' => $now_gmt,
+                                                               'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'),
+                                                               'post_excerpt' => '',
+                                                               'post_title' => __('About'),
+                                                               /* translators: Default page slug */
+                                                               'post_name' => _x('about', 'Default page slug'),
+                                                               'post_modified' => $now,
+                                                               'post_modified_gmt' => $now_gmt,
+                                                               'guid' => $first_post_guid,
+                                                               'post_type' => 'page',
+                                                               'to_ping' => '',
+                                                               'pinged' => '',
+                                                               'post_content_filtered' => ''
+                                                               ));
 }
 endif;
 
 }
 endif;
 
@@ -159,7 +226,6 @@ function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
        $user = new WP_User($user_id);
        $email = $user->user_email;
        $name = $user->user_login;
        $user = new WP_User($user_id);
        $email = $user->user_email;
        $name = $user->user_login;
-       $message_headers = 'From: "' . $blog_title . '" <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
        $message = sprintf(__("Your new WordPress blog has been successfully set up at:
 
 %1\$s
        $message = sprintf(__("Your new WordPress blog has been successfully set up at:
 
 %1\$s
@@ -175,7 +241,7 @@ We hope you enjoy your new blog. Thanks!
 http://wordpress.org/
 "), $blog_url, $name, $password);
 
 http://wordpress.org/
 "), $blog_url, $name, $password);
 
-       @wp_mail($email, __('New WordPress Blog'), $message, $message_headers);
+       @wp_mail($email, __('New WordPress Blog'), $message);
 }
 endif;
 
 }
 endif;
 
@@ -276,11 +342,13 @@ function upgrade_all() {
        if ( $wp_current_db_version < 8989 )
                upgrade_270();
 
        if ( $wp_current_db_version < 8989 )
                upgrade_270();
 
-       maybe_disable_automattic_widgets();
+       if ( $wp_current_db_version < 10360 )
+               upgrade_280();
 
 
-       $wp_rewrite->flush_rules();
+       maybe_disable_automattic_widgets();
 
 
-       update_option('db_version', $wp_db_version);
+       update_option( 'db_version', $wp_db_version );
+       update_option( 'db_upgraded', true );
 }
 
 /**
 }
 
 /**
@@ -306,7 +374,7 @@ function upgrade_100() {
        foreach ($categories as $category) {
                if ('' == $category->category_nicename) {
                        $newtitle = sanitize_title($category->cat_name);
        foreach ($categories as $category) {
                if ('' == $category->category_nicename) {
                        $newtitle = sanitize_title($category->cat_name);
-                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->categories SET category_nicename = %s WHERE cat_ID = %d", $newtitle, $category->cat_ID) );
+                       $wpdb>update( $wpdb->categories, array('category_nicename' => $newtitle), array('cat_ID' => $category->cat_ID) );
                }
        }
 
                }
        }
 
@@ -330,10 +398,7 @@ function upgrade_100() {
                        // Check to see if it's already been imported
                        $cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) );
                        if (!$cat && 0 != $post->post_category) { // If there's no result
                        // Check to see if it's already been imported
                        $cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) );
                        if (!$cat && 0 != $post->post_category) { // If there's no result
-                               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->post2cat
-                                       (post_id, category_id)
-                                       VALUES (%s, %s)
-                                       ", $post->ID, $post->post_category) );
+                               $wpdb->insert( $wpdb->post2cat, array('post_id' => $post->ID, 'category_id' => $post->post_category) );
                        }
                }
        endif;
                        }
                }
        endif;
@@ -370,14 +435,14 @@ function upgrade_110() {
        foreach ($users as $user) {
                if ('' == $user->user_nicename) {
                        $newname = sanitize_title($user->user_nickname);
        foreach ($users as $user) {
                if ('' == $user->user_nicename) {
                        $newname = sanitize_title($user->user_nickname);
-                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET user_nicename = %s WHERE ID = %d", $newname, $user->ID) );
+                       $wpdb->update( $wpdb->users, array('user_nicename' => $newname), array('ID' => $user->ID) );
                }
        }
 
        $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
        foreach ($users as $row) {
                if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
                }
        }
 
        $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
        foreach ($users as $row) {
                if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
-                       $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
+                       $wpdb->update( $wpdb->users, array('user_pass' => md5($row->user_pass)), array('ID' => $row->ID) );
                }
        }
 
                }
        }
 
@@ -437,7 +502,8 @@ function upgrade_130() {
                        else
                                $guid = $post->guid;
 
                        else
                                $guid = $post->guid;
 
-                       $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
+                       $wpdb->update( $wpdb->posts, compact('post_title', 'post_content', 'post_excerpt', 'guid'), array('ID' => $post->ID) );
+
                }
        }
 
                }
        }
 
@@ -445,9 +511,10 @@ function upgrade_130() {
        $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
        if ($comments) {
                foreach($comments as $comment) {
        $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
        if ($comments) {
                foreach($comments as $comment) {
-                       $comment_content = addslashes(deslash($comment->comment_content));
-                       $comment_author = addslashes(deslash($comment->comment_author));
-                       $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
+                       $comment_content = deslash($comment->comment_content);
+                       $comment_author = deslash($comment->comment_author);
+
+                       $wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID) );
                }
        }
 
                }
        }
 
@@ -455,15 +522,11 @@ function upgrade_130() {
        $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
        if ($links) {
                foreach($links as $link) {
        $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
        if ($links) {
                foreach($links as $link) {
-                       $link_name = addslashes(deslash($link->link_name));
-                       $link_description = addslashes(deslash($link->link_description));
-                       $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
-               }
-       }
+                       $link_name = deslash($link->link_name);
+                       $link_description = deslash($link->link_description);
 
 
-       // The "paged" option for what_to_show is no more.
-       if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
-               $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
+                       $wpdb->update( $wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id) );
+               }
        }
 
        $active_plugins = __get_option('active_plugins');
        }
 
        $active_plugins = __get_option('active_plugins');
@@ -539,7 +602,7 @@ function upgrade_160() {
                        if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
                        if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
                        if (!$idmode) $id = $user->user_nickname;
                        if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
                        if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
                        if (!$idmode) $id = $user->user_nickname;
-                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET display_name = %s WHERE ID = %d", $id, $user->ID) );
+                       $wpdb->update( $wpdb->users, array('display_name' => $id), array('ID' => $user->ID) );
                endif;
 
                // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
                endif;
 
                // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
@@ -559,21 +622,19 @@ function upgrade_160() {
 
        // populate comment_count field of posts table
        $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
 
        // populate comment_count field of posts table
        $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
-       if( is_array( $comments ) ) {
-               foreach ($comments as $comment) {
-                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $comment->c, $comment->comment_post_ID) );
-               }
-       }
+       if( is_array( $comments ) )
+               foreach ($comments as $comment)
+                       $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) );
 
        // Some alpha versions used a post status of object instead of attachment and put
        // the mime type in post_type instead of post_mime_type.
        if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
                $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
                foreach ($objects as $object) {
 
        // Some alpha versions used a post status of object instead of attachment and put
        // the mime type in post_type instead of post_mime_type.
        if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
                $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
                foreach ($objects as $object) {
-                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = 'attachment',
-                       post_mime_type = %s,
-                       post_type = ''
-                       WHERE ID = %d", $object->post_type, $object->ID) );
+                       $wpdb->update( $wpdb->posts, array(     'post_status' => 'attachment',
+                                                                                               'post_mime_type' => $object->post_type,
+                                                                                               'post_type' => ''),
+                                                                                array( 'ID' => $object->ID ) );
 
                        $meta = get_post_meta($object->ID, 'imagedata', true);
                        if ( ! empty($meta['file']) )
 
                        $meta = get_post_meta($object->ID, 'imagedata', true);
                        if ( ! empty($meta['file']) )
@@ -622,7 +683,7 @@ function upgrade_210() {
                $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
                if ( !empty($posts) )
                        foreach ( $posts as $post )
                $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
                if ( !empty($posts) )
                        foreach ( $posts as $post )
-                               wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID));
+                               wp_schedule_single_event(mysql2date('U', $post->post_date, false), 'publish_future_post', array($post->ID));
        }
 }
 
        }
 }
 
@@ -691,14 +752,14 @@ function upgrade_230() {
                        $have_tags = true;
                        $count = (int) $category->tag_count;
                        $taxonomy = 'post_tag';
                        $have_tags = true;
                        $count = (int) $category->tag_count;
                        $taxonomy = 'post_tag';
-                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
+                       $wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') );
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
 
                if ( empty($count) ) {
                        $count = 0;
                        $taxonomy = 'category';
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
 
                if ( empty($count) ) {
                        $count = 0;
                        $taxonomy = 'category';
-                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
+                       $wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') );
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
        }
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
        }
@@ -718,7 +779,7 @@ function upgrade_230() {
                if ( empty($tt_id) )
                        continue;
 
                if ( empty($tt_id) )
                        continue;
 
-               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $post_id, $tt_id) );
+               $wpdb->insert( $wpdb->term_relationships, array('object_id' => $post_id, 'term_taxonomy_id' => $tt_id) );
        }
 
        // < 3570 we used linkcategories.  >= 3570 we used categories and link2cat.
        }
 
        // < 3570 we used linkcategories.  >= 3570 we used categories and link2cat.
@@ -743,14 +804,14 @@ function upgrade_230() {
                        }
 
                        if ( empty($term_id) ) {
                        }
 
                        if ( empty($term_id) ) {
-                               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES (%s, %s, %d)", $name, $slug, $term_group) );
+                               $wpdb->insert( $wpdb->terms, compact('name', 'slug', 'term_group') );
                                $term_id = (int) $wpdb->insert_id;
                        }
 
                        $link_cat_id_map[$cat_id] = $term_id;
                        $default_link_cat = $term_id;
 
                                $term_id = (int) $wpdb->insert_id;
                        }
 
                        $link_cat_id_map[$cat_id] = $term_id;
                        $default_link_cat = $term_id;
 
-                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (%d, 'link_category', '', '0', '0')", $term_id) );
+                       $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $term_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 0) );
                        $tt_ids[$term_id] = (int) $wpdb->insert_id;
                }
 
                        $tt_ids[$term_id] = (int) $wpdb->insert_id;
                }
 
@@ -766,7 +827,7 @@ function upgrade_230() {
                        if ( empty($tt_id) )
                                continue;
 
                        if ( empty($tt_id) )
                                continue;
 
-                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link->link_id, $tt_id) );
+                       $wpdb->insert( $wpdb->term_relationships, array('object_id' => $link->link_id, 'term_taxonomy_id' => $tt_id) );
                }
 
                // Set default to the last category we grabbed during the upgrade loop.
                }
 
                // Set default to the last category we grabbed during the upgrade loop.
@@ -780,8 +841,7 @@ function upgrade_230() {
                        $tt_id = $tt_ids[$term_id][$taxonomy];
                        if ( empty($tt_id) )
                                continue;
                        $tt_id = $tt_ids[$term_id][$taxonomy];
                        if ( empty($tt_id) )
                                continue;
-
-                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link_id, $tt_id) );
+                       $wpdb->insert( $wpdb->term_relationships, array('object_id' => $link_id, 'term_taxonomy_id' => $tt_id) );
                }
        }
 
                }
        }
 
@@ -797,7 +857,7 @@ function upgrade_230() {
                        $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id) );
                else
                        $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) );
                        $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id) );
                else
                        $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) );
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_taxonomy_id = %d", $count, $term->term_taxonomy_id) );
+               $wpdb->update( $wpdb->term_taxonomy, array('count' => $count), array('term_taxonomy_id' => $term->term_taxonomy_id) );
        }
 }
 
        }
 }
 
@@ -908,6 +968,18 @@ function upgrade_270() {
                $wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" );
 }
 
                $wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" );
 }
 
+/**
+ * Execute changes made in WordPress 2.8.
+ *
+ * @since 2.8.0
+ */
+function upgrade_280() {
+       global $wp_current_db_version;
+
+       if ( $wp_current_db_version < 10360 )
+               populate_roles_280();
+}
+
 
 // The functions we use to actually do stuff
 
 
 // The functions we use to actually do stuff
 
@@ -926,19 +998,13 @@ function upgrade_270() {
  */
 function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
  */
 function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
-       foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
-               if ($table == $table_name) {
-                       return true;
-               }
-       }
+       if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name )
+               return true;
        //didn't find it try to create it.
        $q = $wpdb->query($create_ddl);
        // we cannot directly tell that whether this succeeded!
        //didn't find it try to create it.
        $q = $wpdb->query($create_ddl);
        // we cannot directly tell that whether this succeeded!
-       foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
-               if ($table == $table_name) {
-                       return true;
-               }
-       }
+       if ( $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name )
+               return true;
        return false;
 }
 
        return false;
 }
 
@@ -1119,7 +1185,7 @@ function dbDelta($queries, $execute = true) {
        // Create a tablename index for an array ($cqueries) of queries
        foreach($queries as $qry) {
                if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
        // Create a tablename index for an array ($cqueries) of queries
        foreach($queries as $qry) {
                if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
-                       $cqueries[strtolower($matches[1])] = $qry;
+                       $cqueries[trim( strtolower($matches[1]), '`' )] = $qry;
                        $for_update[$matches[1]] = 'Created table '.$matches[1];
                }
                else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
                        $for_update[$matches[1]] = 'Created table '.$matches[1];
                }
                else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
@@ -1158,7 +1224,7 @@ function dbDelta($queries, $execute = true) {
                                foreach($flds as $fld) {
                                        // Extract the field name
                                        preg_match("|^([^ ]*)|", trim($fld), $fvals);
                                foreach($flds as $fld) {
                                        // Extract the field name
                                        preg_match("|^([^ ]*)|", trim($fld), $fvals);
-                                       $fieldname = $fvals[1];
+                                       $fieldname = trim( $fvals[1], '`' );
 
                                        // Verify the found field name
                                        $validfield = true;
 
                                        // Verify the found field name
                                        $validfield = true;
index 5709cc18432a3b82f62778daa5e28b77dc87e50a..33e751f53c6a0c1e85636fa64ae2889425750533 100644 (file)
@@ -9,9 +9,12 @@
 /**
  * Creates a new user from the "Users" form using $_POST information.
  *
 /**
  * Creates a new user from the "Users" form using $_POST information.
  *
- * {@internal Missing Long Description}}
+ * It seems that the first half is for backwards compatibility, but only
+ * has the ability to alter the user's role. Wordpress core seems to
+ * use this function only in the second way, running edit_user() with
+ * no id so as to create a new user.
  *
  *
- * @since unknown
+ * @since 2.0
  *
  * @param int $user_id Optional. User ID.
  * @return null|WP_Error|int Null when adding user, WP_Error or User ID integer when no parameters.
  *
  * @param int $user_id Optional. User ID.
  * @return null|WP_Error|int Null when adding user, WP_Error or User ID integer when no parameters.
@@ -22,7 +25,13 @@ function add_user() {
                $user_id = (int) func_get_arg( 0 );
 
                if ( isset( $_POST['role'] ) ) {
                $user_id = (int) func_get_arg( 0 );
 
                if ( isset( $_POST['role'] ) ) {
+                       // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
                        if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
                        if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) {
+                               // If the new role isn't editable by the logged-in user die with error
+                               $editable_roles = get_editable_roles();
+                               if (!$editable_roles[$_POST['role']])
+                                       wp_die(__('You can&#8217;t give users that role.'));
+
                                $user = new WP_User( $user_id );
                                $user->set_role( $_POST['role'] );
                        }
                                $user = new WP_User( $user_id );
                                $user->set_role( $_POST['role'] );
                        }
@@ -34,14 +43,14 @@ function add_user() {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Edit user settings based on contents of $_POST
  *
  *
- * {@internal Missing Long Description}}
+ * Used on user-edit.php and profile.php to manage and process user options, passwords etc.
  *
  *
- * @since unknown
+ * @since 2.0
  *
  * @param int $user_id Optional. User ID.
  *
  * @param int $user_id Optional. User ID.
- * @return unknown
+ * @return int user id of the updated user
  */
 function edit_user( $user_id = 0 ) {
        global $current_user, $wp_roles, $wpdb;
  */
 function edit_user( $user_id = 0 ) {
        global $current_user, $wp_roles, $wpdb;
@@ -56,7 +65,7 @@ function edit_user( $user_id = 0 ) {
        }
 
        if ( isset( $_POST['user_login'] ))
        }
 
        if ( isset( $_POST['user_login'] ))
-               $user->user_login = wp_specialchars( trim( $_POST['user_login'] ));
+               $user->user_login = esc_html( trim( $_POST['user_login'] ));
 
        $pass1 = $pass2 = '';
        if ( isset( $_POST['pass1'] ))
 
        $pass1 = $pass2 = '';
        if ( isset( $_POST['pass1'] ))
@@ -65,32 +74,43 @@ function edit_user( $user_id = 0 ) {
                $pass2 = $_POST['pass2'];
 
        if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
                $pass2 = $_POST['pass2'];
 
        if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
+
+               // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
                if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ))
                        $user->role = $_POST['role'];
                if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ))
                        $user->role = $_POST['role'];
+
+               // If the new role isn't editable by the logged-in user die with error
+               $editable_roles = get_editable_roles();
+               if (!$editable_roles[$_POST['role']])
+                       wp_die(__('You can&#8217;t give users that role.'));
        }
 
        if ( isset( $_POST['email'] ))
        }
 
        if ( isset( $_POST['email'] ))
-               $user->user_email = wp_specialchars( trim( $_POST['email'] ));
+               $user->user_email = esc_html( trim( $_POST['email'] ));
        if ( isset( $_POST['url'] ) ) {
        if ( isset( $_POST['url'] ) ) {
-               $user->user_url = clean_url( trim( $_POST['url'] ));
-               $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
+               if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) {
+                       $user->user_url = '';
+               } else {
+                       $user->user_url = esc_url( trim( $_POST['url'] ));
+                       $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
+               }
        }
        if ( isset( $_POST['first_name'] ))
        }
        if ( isset( $_POST['first_name'] ))
-               $user->first_name = wp_specialchars( trim( $_POST['first_name'] ));
+               $user->first_name = esc_html( trim( $_POST['first_name'] ));
        if ( isset( $_POST['last_name'] ))
        if ( isset( $_POST['last_name'] ))
-               $user->last_name = wp_specialchars( trim( $_POST['last_name'] ));
+               $user->last_name = esc_html( trim( $_POST['last_name'] ));
        if ( isset( $_POST['nickname'] ))
        if ( isset( $_POST['nickname'] ))
-               $user->nickname = wp_specialchars( trim( $_POST['nickname'] ));
+               $user->nickname = esc_html( trim( $_POST['nickname'] ));
        if ( isset( $_POST['display_name'] ))
        if ( isset( $_POST['display_name'] ))
-               $user->display_name = wp_specialchars( trim( $_POST['display_name'] ));
+               $user->display_name = esc_html( trim( $_POST['display_name'] ));
        if ( isset( $_POST['description'] ))
                $user->description = trim( $_POST['description'] );
        if ( isset( $_POST['jabber'] ))
        if ( isset( $_POST['description'] ))
                $user->description = trim( $_POST['description'] );
        if ( isset( $_POST['jabber'] ))
-               $user->jabber = wp_specialchars( trim( $_POST['jabber'] ));
+               $user->jabber = esc_html( trim( $_POST['jabber'] ));
        if ( isset( $_POST['aim'] ))
        if ( isset( $_POST['aim'] ))
-               $user->aim = wp_specialchars( trim( $_POST['aim'] ));
+               $user->aim = esc_html( trim( $_POST['aim'] ));
        if ( isset( $_POST['yim'] ))
        if ( isset( $_POST['yim'] ))
-               $user->yim = wp_specialchars( trim( $_POST['yim'] ));
+               $user->yim = esc_html( trim( $_POST['yim'] ));
        if ( !$update )
                $user->rich_editing = 'true';  // Default to true for new users.
        else if ( isset( $_POST['rich_editing'] ) )
        if ( !$update )
                $user->rich_editing = 'true';  // Default to true for new users.
        else if ( isset( $_POST['rich_editing'] ) )
@@ -133,7 +153,7 @@ function edit_user( $user_id = 0 ) {
        }
 
        /* Check for "\" in password */
        }
 
        /* Check for "\" in password */
-       if( strpos( " ".$pass1, "\\" ) )
+       if ( false !== strpos( stripslashes($pass1), "\\" ) )
                $errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
 
        /* checking the password has been typed twice the same */
                $errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
 
        /* checking the password has been typed twice the same */
@@ -151,11 +171,15 @@ function edit_user( $user_id = 0 ) {
 
        /* checking e-mail address */
        if ( empty ( $user->user_email ) ) {
 
        /* checking e-mail address */
        if ( empty ( $user->user_email ) ) {
-               $errors->add( 'user_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
-       } else
-               if (!is_email( $user->user_email ) ) {
-                       $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
-               }
+               $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
+       } elseif (!is_email( $user->user_email ) ) {
+               $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The e-mail address isn&#8217;t correct.' ), array( 'form-field' => 'email' ) );
+       } elseif ( ( $owner_id = email_exists($user->user_email) ) && $owner_id != $user->ID ) {
+               $errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
+       }
+
+       // Allow plugins to return there own errors.
+       do_action_ref_array('user_profile_update_errors', array ( &$errors, $update, &$user ) );
 
        if ( $errors->get_error_codes() )
                return $errors;
 
        if ( $errors->get_error_codes() )
                return $errors;
@@ -164,7 +188,7 @@ function edit_user( $user_id = 0 ) {
                $user_id = wp_update_user( get_object_vars( $user ));
        } else {
                $user_id = wp_insert_user( get_object_vars( $user ));
                $user_id = wp_update_user( get_object_vars( $user ));
        } else {
                $user_id = wp_insert_user( get_object_vars( $user ));
-               wp_new_user_notification( $user_id );
+               wp_new_user_notification( $user_id, isset($_POST['send_password']) ? $pass1 : '' );
        }
        return $user_id;
 }
        }
        return $user_id;
 }
@@ -241,6 +265,31 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'p
        return $wpdb->get_col( $query );
 }
 
        return $wpdb->get_col( $query );
 }
 
+/**
+ * Fetch a filtered list of user roles that the current user is
+ * allowed to edit.
+ *
+ * Simple function who's main purpose is to allow filtering of the
+ * list of roles in the $wp_roles object so that plugins can remove
+ * innappropriate ones depending on the situation or user making edits.
+ * Specifically because without filtering anyone with the edit_users
+ * capability can edit others to be administrators, even if they are
+ * only editors or authors. This filter allows admins to delegate
+ * user management.
+ *
+ * @since 2.8
+ *
+ * @return unknown
+ */
+function get_editable_roles() {
+       global $wp_roles;
+
+       $all_roles = $wp_roles->roles;
+       $editable_roles = apply_filters('editable_roles', $all_roles);
+
+       return $editable_roles;
+}
+
 /**
  * {@internal Missing Short Description}}
  *
 /**
  * {@internal Missing Short Description}}
  *
@@ -322,17 +371,17 @@ function get_others_pending($user_id) {
  */
 function get_user_to_edit( $user_id ) {
        $user = new WP_User( $user_id );
  */
 function get_user_to_edit( $user_id ) {
        $user = new WP_User( $user_id );
-       $user->user_login   = attribute_escape($user->user_login);
-       $user->user_email   = attribute_escape($user->user_email);
-       $user->user_url     = clean_url($user->user_url);
-       $user->first_name   = attribute_escape($user->first_name);
-       $user->last_name    = attribute_escape($user->last_name);
-       $user->display_name = attribute_escape($user->display_name);
-       $user->nickname     = attribute_escape($user->nickname);
-       $user->aim          = isset( $user->aim ) && !empty( $user->aim ) ? attribute_escape($user->aim) : '';
-       $user->yim          = isset( $user->yim ) && !empty( $user->yim ) ? attribute_escape($user->yim) : '';
-       $user->jabber       = isset( $user->jabber ) && !empty( $user->jabber ) ? attribute_escape($user->jabber) : '';
-       $user->description  = isset( $user->description ) && !empty( $user->description ) ? wp_specialchars($user->description) : '';
+       $user->user_login   = esc_attr($user->user_login);
+       $user->user_email   = esc_attr($user->user_email);
+       $user->user_url     = esc_url($user->user_url);
+       $user->first_name   = esc_attr($user->first_name);
+       $user->last_name    = esc_attr($user->last_name);
+       $user->display_name = esc_attr($user->display_name);
+       $user->nickname     = esc_attr($user->nickname);
+       $user->aim          = isset( $user->aim ) && !empty( $user->aim ) ? esc_attr($user->aim) : '';
+       $user->yim          = isset( $user->yim ) && !empty( $user->yim ) ? esc_attr($user->yim) : '';
+       $user->jabber       = isset( $user->jabber ) && !empty( $user->jabber ) ? esc_attr($user->jabber) : '';
+       $user->description  = isset( $user->description ) && !empty( $user->description ) ? esc_html($user->description) : '';
 
        return $user;
 }
 
        return $user;
 }
@@ -370,6 +419,10 @@ function wp_delete_user($id, $reassign = 'novalue') {
        global $wpdb;
 
        $id = (int) $id;
        global $wpdb;
 
        $id = (int) $id;
+       $user = new WP_User($id);
+
+       // allow for transaction statement
+       do_action('delete_user', $id);
 
        if ($reassign == 'novalue') {
                $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
 
        if ($reassign == 'novalue') {
                $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
@@ -380,7 +433,13 @@ function wp_delete_user($id, $reassign = 'novalue') {
                }
 
                // Clean links
                }
 
                // Clean links
-               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_owner = %d", $id) );
+               $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) );
+
+               if ( $link_ids ) {
+                       foreach ( $link_ids as $link_id )
+                               wp_delete_link($link_id);
+               }
+
        } else {
                $reassign = (int) $reassign;
                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
        } else {
                $reassign = (int) $reassign;
                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
@@ -388,14 +447,17 @@ function wp_delete_user($id, $reassign = 'novalue') {
        }
 
        // FINALLY, delete user
        }
 
        // FINALLY, delete user
-       do_action('delete_user', $id);
 
 
-       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
+       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
 
        wp_cache_delete($id, 'users');
        wp_cache_delete($user->user_login, 'userlogins');
        wp_cache_delete($user->user_email, 'useremail');
 
        wp_cache_delete($id, 'users');
        wp_cache_delete($user->user_login, 'userlogins');
        wp_cache_delete($user->user_email, 'useremail');
+       wp_cache_delete($user->user_nicename, 'userslugs');
+
+       // allow for commit transaction
+       do_action('deleted_user', $id);
 
        return true;
 }
 
        return true;
 }
@@ -734,4 +796,43 @@ class WP_User_Search {
 }
 endif;
 
 }
 endif;
 
+add_action('admin_init', 'default_password_nag_handler');
+function default_password_nag_handler($errors = false) {
+       global $user_ID;
+       if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
+               return;
+
+       //get_user_setting = JS saved UI setting. else no-js-falback code.
+       if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) {
+               delete_user_setting('default_password_nag');
+               update_usermeta($user_ID, 'default_password_nag', false);
+       }
+}
+
+add_action('profile_update', 'default_password_nag_edit_user', 10, 2);
+function default_password_nag_edit_user($user_ID, $old_data) {
+       global $user_ID;
+       if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
+               return;
+
+       $new_data = get_userdata($user_ID);
+
+       if ( $new_data->user_pass != $old_data->user_pass ) { //Remove the nag if the password has been changed.
+               delete_user_setting('default_password_nag');
+               update_usermeta($user_ID, 'default_password_nag', false);
+       }
+}
+
+add_action('admin_notices', 'default_password_nag');
+function default_password_nag() {
+       global $user_ID;
+       if ( ! get_usermeta($user_ID, 'default_password_nag') )
+               return;
+
+       echo '<div class="error default-password-nag"><p>';
+       printf(__("Notice: you're using the auto-generated password for your account. Would you like to change it to something you'll remember easier?<br />
+                         <a href='%s'>Yes, Take me to my profile page</a> | <a href='%s' id='default-password-nag-no'>No Thanks, Do not remind me again.</a>"), admin_url('profile.php') . '#password', '?default_password_nag=0');
+       echo '</p></div>';
+}
+
 ?>
 ?>
index 9e15d54855db2a22b3c1ec311cf9e0f030d93c40..2be814534500c5f5ba5fe3c25455b808c87bdd7d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /**
  */
 
 /**
- * Display list of widgets, either all or matching search.
+ * Display list of the available widgets, either all or matching search.
  *
  * The search parameter are search terms separated by spaces.
  *
  *
  * The search parameter are search terms separated by spaces.
  *
  * @param string $show Optional, default is all. What to display, can be 'all', 'unused', or 'used'.
  * @param string $_search Optional. Search for widgets. Should be unsanitized.
  */
  * @param string $show Optional, default is all. What to display, can be 'all', 'unused', or 'used'.
  * @param string $_search Optional. Search for widgets. Should be unsanitized.
  */
-function wp_list_widgets( $show = 'all', $_search = false ) {
+function wp_list_widgets() {
        global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
        global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
-       if ( $_search ) {
-               // sanitize
-               $search = preg_replace( '/[^\w\s]/', '', $_search );
-               // array of terms
-               $search_terms = preg_split( '/[\s]/', $search, -1, PREG_SPLIT_NO_EMPTY );
-       } else {
-               $search_terms = array();
-       }
-
-       if ( !in_array( $show, array( 'all', 'unused', 'used' ) ) )
-               $show = 'all';
-?>
-
-       <ul id='widget-list'>
-               <?php
-               $no_widgets_shown = true;
-               $already_shown = array();
-               foreach ( $wp_registered_widgets as $name => $widget ) :
-                       if ( 'all' == $show && in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
-                               continue;
-
-                       if ( $search_terms ) {
-                               $hit = false;
-                               // Simple case-insensitive search.  Boolean OR.
-                               $search_text = preg_replace( '/[^\w]/', '', $widget['name'] );
-                               if ( isset($widget['description']) )
-                                       $search_text .= preg_replace( '/[^\w]/', '', $widget['description'] );
-
-                               foreach ( $search_terms as $search_term ) {
-                                       if ( stristr( $search_text, $search_term ) ) {
-                                               $hit = true;
-                                               break;
-                                       }
-                               }
-                               if ( !$hit )
-                                       continue;
-                       }
-
-                       $sidebar = is_active_widget( $widget['callback'], $widget['id'] );
-
-                       if ( ( 'unused' == $show && $sidebar ) || ( 'used' == $show && !$sidebar ) )
-                               continue;
-
-                       if ( ! isset( $widget['params'][0] ) )
-                               $widget['params'][0] = array();
-                       ob_start();
-                       $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template', '_show' => $show ), 1 => $widget['params'][0] ) );
-                       $sidebar_args = call_user_func_array( 'wp_widget_control', $args );
-                       $widget_control_template = ob_get_contents();
-                       ob_end_clean();
-
-                       $widget_id = $widget['id']; // save this for later in case we mess with $widget['id']
-
-                       $is_multi = false !== strpos( $widget_control_template, '%i%' );
-                       if ( !$sidebar || $is_multi ) {
-                               $add_query = array(
-                                       'sidebar' => $sidebar,
-                                       'key' => false,
-                                       'edit' => false
-                               );
-                               if ( 'all' == $show && $is_multi ) {
-                                       // it's a multi-widget.  We only need to show it in the list once.
-                                       $already_shown[] = $widget['callback'];
-                                       $num = (int) array_pop( $ids = explode( '-', $widget['id'] ) );
-                                       $id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
-                                       // so that we always add a new one when clicking "add"
-                                       while ( isset($wp_registered_widgets["$id_base-$num"]) )
-                                               $num++;
-                                       $widget['id'] = "$id_base-$num";
-                                       $add_query['base'] = $id_base;
-                                       $add_query['key'] = $num;
-                                       $add_query['sidebar'] = $GLOBALS['sidebar'];
-                               }
-                               $add_query['add'] = $widget['id'];
-                               $action = 'add';
-                               $add_url = clean_url( wp_nonce_url( add_query_arg( $add_query ), "add-widget_$widget[id]" ) );
-                       } else {
-                               $action = 'edit';
-                               $edit_url = clean_url( add_query_arg( array(
-                                       'sidebar' => $sidebar,
-                                       'edit' => $widget['id'],
-                                       'key' => array_search( $widget['id'], $sidebars_widgets[$sidebar] ),
-                               ) ) );
-
-                               $widget_control_template = '<textarea rows="1" cols="1">' . htmlspecialchars( $widget_control_template ) . '</textarea>';
-                       }
-
-                       $widget_control_template = $sidebar_args['before_widget'] . $widget_control_template . $sidebar_args['after_widget'];
-
-                       $no_widgets_shown = false;
-
-
-                       if ( 'all' != $show && $sidebar_args['_widget_title'] )
-                               $widget_title = $sidebar_args['_widget_title'];
-                       else
-                               $widget_title = $widget['name'];
-               ?>
-
-               <li id="widget-list-item-<?php echo attribute_escape( $widget['id'] ); ?>" class="widget-list-item">
-                       <h4 class="widget-title widget-draggable">
-
-                               <span><?php echo $widget_title; ?></span>
-
-                               <?php if ( 'add' == $action ) : ?>
-
-                               <a class="widget-action widget-control-add" href="<?php echo $add_url; ?>"><?php _e( 'Add' ); ?></a>
 
 
-                               <?php elseif ( 'edit' == $action ) :
-                                       // We echo a hidden edit link for the sake of the JS.  Edit links are shown (needlessly?) after a widget is added.
-                               ?>
+       $sort = $wp_registered_widgets;
+       usort( $sort, create_function( '$a, $b', 'return strnatcasecmp( $a["name"], $b["name"] );' ) );
+       $done = array();
 
 
-                               <a class="widget-action widget-control-edit" href="<?php echo $edit_url; ?>" style="display: none;"><?php _e( 'Edit' ); ?></a>
+       foreach ( $sort as $widget ) {
+               if ( in_array( $widget['callback'], $done, true ) ) // We already showed this multi-widget
+                       continue;
 
 
-                               <?php endif; ?>
+               $sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
+               $done[] = $widget['callback'];
 
 
-                               <br class="clear" />
+               if ( ! isset( $widget['params'][0] ) )
+                       $widget['params'][0] = array();
 
 
-                       </h4>
+               $args = array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' );
 
 
+               if ( isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number']) ) {
+                       $id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
+                       $args['_temp_id'] = "$id_base-__i__";
+                       $args['_multi_num'] = next_widget_id_number($id_base);
+                       $args['_add'] = 'multi';
+               } else {
+                       $args['_add'] = 'single';
+                       if ( $sidebar )
+                               $args['_hide'] = '1';
+               }
 
 
-                       <ul id="widget-control-info-<?php echo $widget['id']; ?>" class="widget-control-info">
-
-                               <?php echo $widget_control_template; ?>
-
-                       </ul>
-
-                       <?php if ( 'add' == $action ) : ?>
-                       <?php endif; ?>
-
-                       <div class="widget-description">
-                               <?php echo ( $widget_description = wp_widget_description( $widget_id ) ) ? $widget_description : '&nbsp;'; ?>
-                       </div>
-
-                       <br class="clear" />
-
-               </li>
-
-               <?php endforeach; if ( $no_widgets_shown ) : ?>
-
-               <li><?php _e( 'No matching widgets' ); ?></li>
-
-               <?php endif; ?>
-
-       </ul>
-<?php
+               $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
+               call_user_func_array( 'wp_widget_control', $args );
+       }
 }
 
 /**
 }
 
 /**
@@ -174,15 +60,10 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
  */
 function wp_list_widget_controls( $sidebar ) {
        add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
  */
 function wp_list_widget_controls( $sidebar ) {
        add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
-?>
-
-       <ul class="widget-control-list">
-
-               <?php if ( !dynamic_sidebar( $sidebar ) ) echo "<li />"; ?>
-
-       </ul>
 
 
-<?php
+       echo "\t<div id='$sidebar' class='widgets-sortables'>\n";
+       dynamic_sidebar( $sidebar );
+       echo "\t</div>\n";
 }
 
 /**
 }
 
 /**
@@ -199,18 +80,31 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
        $i++;
 
        $widget_id = $params[0]['widget_id'];
        $i++;
 
        $widget_id = $params[0]['widget_id'];
+       $id = isset($params[0]['_temp_id']) ? $params[0]['_temp_id'] : $widget_id;
+       $hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : '';
 
 
-       $params[0]['before_widget'] = "<li id='widget-list-control-item-$i-$widget_id' class='widget-list-control-item widget-sortable'>\n";
-       $params[0]['after_widget'] = "</li>";
-       $params[0]['before_title'] = "%BEG_OF_TITLE%";
-       $params[0]['after_title'] = "%END_OF_TITLE%";
+       $params[0]['before_widget'] = "<div id='widget-${i}_$id' class='widget'$hidden>";
+       $params[0]['after_widget'] = "</div>";
+       $params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated
+       $params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated
        if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) {
                $wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback'];
                $wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control';
        }
        if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) {
                $wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback'];
                $wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control';
        }
+
        return $params;
 }
 
        return $params;
 }
 
+function next_widget_id_number($id_base) {
+       global $wp_registered_widgets;
+       $number = 2;
+
+       while ( isset($wp_registered_widgets["$id_base-$number"]) )
+               $number++;
+
+       return $number;
+}
+
 /**
  * Meta widget used to display the control form for a widget.
  *
 /**
  * Meta widget used to display the control form for a widget.
  *
@@ -222,119 +116,92 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
  * @return array
  */
 function wp_widget_control( $sidebar_args ) {
  * @return array
  */
 function wp_widget_control( $sidebar_args ) {
-       global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
+       global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets;
+
        $widget_id = $sidebar_args['widget_id'];
        $sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
        $widget_id = $sidebar_args['widget_id'];
        $sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
-
-       $control = isset($wp_registered_widget_controls[$widget_id]) ? $wp_registered_widget_controls[$widget_id] : 0;
-       $widget  = $wp_registered_widgets[$widget_id];
-
-       $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : 'no-key'; // position of widget in sidebar
-
-       $edit = -1 <  $edit_widget && is_numeric($key) && $edit_widget === $key; // (bool) are we currently editing this widget
+       $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : '-1'; // position of widget in sidebar
+       $control = isset($wp_registered_widget_controls[$widget_id]) ? $wp_registered_widget_controls[$widget_id] : array();
+       $widget = $wp_registered_widgets[$widget_id];
 
        $id_format = $widget['id'];
 
        $id_format = $widget['id'];
-
-       if ( ! isset( $sidebar_args['_show'] ) )
-               $sidebar_args['_show'] = '';
-
-       if ( ! isset( $sidebar_args['_display'] ) )
-               $sidebar_args['_display'] = '';
+       $widget_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : '';
+       $id_base = isset($control['id_base']) ? $control['id_base'] : $widget_id;
+       $multi_number = isset($sidebar_args['_multi_num']) ? $sidebar_args['_multi_num'] : '';
+       $add_new = isset($sidebar_args['_add']) ? $sidebar_args['_add'] : '';
+
+       $query_arg = array( 'editwidget' => $widget['id'] );
+       if ( $add_new ) {
+               $query_arg['addnew'] = 1;
+               if ( $multi_number ) {
+                       $query_arg['num'] = $multi_number;
+                       $query_arg['base'] = $id_base;
+               }
+       } else {
+               $query_arg['sidebar'] = $sidebar_id;
+               $query_arg['key'] = $key;
+       }
 
        // We aren't showing a widget control, we're outputing a template for a mult-widget control
 
        // We aren't showing a widget control, we're outputing a template for a mult-widget control
-       if ( 'all' == $sidebar_args['_show'] && 'template' == $sidebar_args['_display'] && isset($control['params'][0]['number']) ) {
-               // number == -1 implies a template where id numbers are replaced by a generic '%i%'
+       if ( isset($sidebar_args['_display']) && 'template' == $sidebar_args['_display'] && $widget_number ) {
+               // number == -1 implies a template where id numbers are replaced by a generic '__i__'
                $control['params'][0]['number'] = -1;
                $control['params'][0]['number'] = -1;
-               // if given, id_base means widget id's should be constructed like {$id_base}-{$id_number}
+               // with id_base widget id's are constructed like {$id_base}-{$id_number}
                if ( isset($control['id_base']) )
                if ( isset($control['id_base']) )
-                       $id_format = $control['id_base'] . '-%i%';
+                       $id_format = $control['id_base'] . '-__i__';
        }
 
        }
 
-       $widget_title = '';
-       // We grab the normal widget output to find the widget's title
-       if ( ( 'all' != $sidebar_args['_show'] || 'template' != $sidebar_args['_display'] ) && is_callable( $widget['_callback'] ) ) {
-               ob_start();
-               $args = func_get_args();
-               call_user_func_array( $widget['_callback'], $args );
-               $widget_title = ob_get_clean();
-               $widget_title = wp_widget_control_ob_filter( $widget_title );
-       }
        $wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
        unset($wp_registered_widgets[$widget_id]['_callback']);
 
        $wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
        unset($wp_registered_widgets[$widget_id]['_callback']);
 
-       if ( $widget_title && $widget_title != $sidebar_args['widget_name'] )
-               $widget_title = sprintf( _c('%1$s: %2$s|1: widget name, 2: widget title' ), $sidebar_args['widget_name'], $widget_title );
+       $widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) );
+       $has_form = 'noform';
+
+       echo $sidebar_args['before_widget']; ?>
+       <div class="widget-top">
+       <div class="widget-title-action">
+               <a class="widget-action hide-if-no-js" href="#available-widgets"></a>
+               <a class="widget-control-edit hide-if-js" href="<?php echo esc_url( add_query_arg( $query_arg ) ); ?>"><span class="edit"><?php _e('Edit'); ?></span><span class="add"><?php _e('Add'); ?></span></a>
+       </div>
+       <div class="widget-title"><h4><?php echo $widget_title ?><span class="in-widget-title"></span></h4></div>
+       </div>
+
+       <div class="widget-inside">
+       <form action="" method="post">
+       <div class="widget-content">
+<?php
+       if ( isset($control['callback']) )
+               $has_form = call_user_func_array( $control['callback'], $control['params'] );
        else
        else
-               $widget_title = wp_specialchars( strip_tags( $sidebar_args['widget_name'] ) );
-
-       $sidebar_args['_widget_title'] = $widget_title;
-
-       if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
-               echo $sidebar_args['before_widget'];
-?>
-               <div class="widget-top">
-               <h4 class="widget-title"><span><?php echo $widget_title ?></span>
-
-                       <?php if ( $edit ) : ?>
-
-                       <a class="widget-action widget-control-edit" href="<?php echo clean_url( remove_query_arg( array( 'edit', 'key' ) ) ); ?>"><?php _e('Cancel'); ?></a>
-
-                       <?php else : ?>
-
-                       <a class="widget-action widget-control-edit" href="<?php echo clean_url( add_query_arg( array( 'edit' => $id_format, 'key' => $key ) ) ); ?>"><?php _e('Edit'); ?></a>
-
-                       <?php endif; ?>
-
-                       <br class="clear" />
-
-               </h4></div>
-
-               <div class="widget-control"<?php if ( $edit ) echo ' style="display: block;"'; ?>>
-
-                       <?php
-                       if ( $control )
-                               call_user_func_array( $control['callback'], $control['params'] );
-                       else
-                               echo '<p>' . __('There are no options for this widget.') . '</p>';
-                       ?>
-
-                       <input type="hidden" name="widget-id[]" value="<?php echo $id_format; ?>" />
-                       <input type="hidden" class="widget-width" value="<?php echo $control['width']; ?>" />
-
-                       <div class="widget-control-actions">
-
-                               <?php if ( $control ) : ?>
-
-                               <a class="button widget-action widget-control-save hide-if-no-js edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Done'); ?></a>
-
-                               <?php endif; ?>
-
-                               <a class="button widget-action widget-control-remove alignright" href="<?php echo clean_url( wp_nonce_url( add_query_arg( array( 'remove' => $id_format, 'key' => $key ) ), "remove-widget_$widget[id]" ) ); ?>"><?php _e('Remove'); ?></a>
-                               <br class="clear" />
-                       </div>
+               echo "\t\t<p>" . __('There are no options for this widget.') . "</p>\n"; ?>
+       </div>
+       <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($id_format); ?>" />
+       <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
+       <input type="hidden" name="widget-width" class="widget-width" value="<?php echo esc_attr($control['width']); ?>" />
+       <input type="hidden" name="widget-height" class="widget-height" value="<?php echo esc_attr($control['height']); ?>" />
+       <input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr($widget_number); ?>" />
+       <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
+       <input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr($add_new); ?>" />
+
+       <div class="widget-control-actions">
+               <div class="alignleft">
+               <a class="widget-control-remove" href="#remove"><?php _e('Remove'); ?></a> |
+               <a class="widget-control-close" href="#close"><?php _e('Close'); ?></a>
                </div>
                </div>
+               <div class="alignright<?php if ( 'noform' === $has_form ) echo ' widget-control-noform'; ?>">
+               <img src="images/wpspin_light.gif" class="ajax-feedback " title="" alt="" />
+               <input type="submit" name="savewidget" class="button-primary widget-control-save" value="<?php esc_attr_e('Save'); ?>" />
+               </div>
+               <br class="clear" />
+       </div>
+       </form>
+       </div>
+
+       <div class="widget-description">
+<?php echo ( $widget_description = wp_widget_description($widget_id) ) ? "$widget_description\n" : "$widget_title\n"; ?>
+       </div>
 <?php
 <?php
-       if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
-               echo $sidebar_args['after_widget'];
+       echo $sidebar_args['after_widget'];
        return $sidebar_args;
 }
 
        return $sidebar_args;
 }
 
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param string $string
- * @return string
- */
-function wp_widget_control_ob_filter( $string ) {
-       if ( false === $beg = strpos( $string, '%BEG_OF_TITLE%' ) )
-               return '';
-       if ( false === $end = strpos( $string, '%END_OF_TITLE%' ) )
-               return '';
-       $string = substr( $string, $beg + 14 , $end - $beg - 14);
-       $string = str_replace( '&nbsp;', ' ', $string );
-       return trim( wp_specialchars( strip_tags( $string ) ) );
-}
-
-?>
\ No newline at end of file
index 59fd228c59cdb4e5b4b01326fe96f91470d01932..a88b1bc3685ceff3f1794599e14994511fe4be3d 100644 (file)
@@ -30,7 +30,7 @@ $today = current_time('mysql', 1);
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <div id="dashboard-widgets-wrap">
 
 
 <div id="dashboard-widgets-wrap">
 
index de5b970d6db1c0bca454116245986b3f178bf222..a9579ff4dec8eaf5420c501fe585bb1ece0ec11c 100644 (file)
 define('WP_INSTALLING', true);
 
 /** Load WordPress Bootstrap */
 define('WP_INSTALLING', true);
 
 /** Load WordPress Bootstrap */
-require_once('../wp-load.php');
+require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
 
 /** Load WordPress Administration Upgrade API */
 
 /** Load WordPress Administration Upgrade API */
-require_once('./includes/upgrade.php');
+require_once(dirname(__FILE__) . '/includes/upgrade.php');
 
 if (isset($_GET['step']))
        $step = $_GET['step'];
 
 if (isset($_GET['step']))
        $step = $_GET['step'];
@@ -48,40 +48,50 @@ header( 'Content-Type: text/html; charset=utf-8' );
 <?php
 }//end function display_header();
 
 <?php
 }//end function display_header();
 
-// Let's check to make sure WP isn't already installed.
-if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
-
-switch($step) {
-       case 0:
-       case 1: // in case people are directly linking to this
-         display_header();
+function display_setup_form( $error = null ) {
+       if ( ! is_null( $error ) ) {
 ?>
 ?>
-<h1><?php _e('Welcome'); ?></h1>
-<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure.  Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
-<!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->
-
-<h1><?php _e('Information needed'); ?></h1>
-<p><?php _e("Please provide the following information.  Don't worry, you can always change these settings later."); ?></p>
-
+<p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>
+<?php } ?>
 <form id="setup" method="post" action="install.php?step=2">
        <table class="form-table">
                <tr>
                        <th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
 <form id="setup" method="post" action="install.php?step=2">
        <table class="form-table">
                <tr>
                        <th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
-                       <td><input name="weblog_title" type="text" id="weblog_title" size="25" /></td>
+                       <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset($_POST['weblog_title']) ? esc_attr($_POST['weblog_title']) : '' ); ?>" /></td>
                </tr>
                <tr>
                        <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
                </tr>
                <tr>
                        <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
-                       <td><input name="admin_email" type="text" id="admin_email" size="25" /><br />
+                       <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset($_POST['admin_email']) ? esc_attr($_POST['admin_email']) : '' ); ?>" /><br />
                        <?php _e('Double-check your email address before continuing.'); ?>
                </tr>
                <tr>
                        <?php _e('Double-check your email address before continuing.'); ?>
                </tr>
                <tr>
-                       <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
+                       <td colspan="2"><label><input type="checkbox" name="blog_public" value="1"<?php if( isset($_POST) && ! empty($_POST) && isset( $_POST['blog_public'] ) ) : ?> checked="checked"<?php endif; ?> /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
                </tr>
        </table>
                </tr>
        </table>
-       <p class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /></p>
+       <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e('Install WordPress'); ?>" class="button" /></p>
 </form>
 </form>
+<?php
+}
+
+// Let's check to make sure WP isn't already installed.
+if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
+
+switch($step) {
+       case 0:
+       case 1: // in case people are directly linking to this
+         display_header();
+?>
+<h1><?php _e('Welcome'); ?></h1>
+<p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure.  Otherwise, just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
+<!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->
+
+<h1><?php _e('Information needed'); ?></h1>
+<p><?php _e('Please provide the following information.  Don&#8217;t worry, you can always change these settings later.'); ?></p>
+
+
 
 <?php
 
 <?php
+               display_setup_form();
                break;
        case 2:
                if ( !empty($wpdb->error) )
                break;
        case 2:
                if ( !empty($wpdb->error) )
@@ -93,17 +103,21 @@ switch($step) {
                $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
                $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
                // check e-mail address
                $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
                $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
                // check e-mail address
+               $error = false;
                if (empty($admin_email)) {
                        // TODO: poka-yoke
                if (empty($admin_email)) {
                        // TODO: poka-yoke
-                       die('<p>'.__("<strong>ERROR</strong>: you must provide an e-mail address.").'</p>');
+                       display_setup_form( __('you must provide an e-mail address.') );
+                       $error = true;
                } else if (!is_email($admin_email)) {
                        // TODO: poka-yoke
                } else if (!is_email($admin_email)) {
                        // TODO: poka-yoke
-                       die('<p>'.__('<strong>ERROR</strong>: that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>').'</p>');
+                       display_setup_form( __('that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>') );
+                       $error = true;
                }
 
                }
 
-               $wpdb->show_errors();
-               $result = wp_install($weblog_title, 'admin', $admin_email, $public);
-               extract($result, EXTR_SKIP);
+               if ( $error === false ) {
+                       $wpdb->show_errors();
+                       $result = wp_install($weblog_title, 'admin', $admin_email, $public);
+                       extract($result, EXTR_SKIP);
 ?>
 
 <h1><?php _e('Success!'); ?></h1>
 ?>
 
 <h1><?php _e('Success!'); ?></h1>
@@ -117,14 +131,17 @@ switch($step) {
        </tr>
        <tr>
                <th><?php _e('Password'); ?></th>
        </tr>
        <tr>
                <th><?php _e('Password'); ?></th>
-               <td><code><?php echo $password; ?></code><br />
-                       <?php echo '<p>'.__('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.').'</p>'; ?></td>
+               <td><?php if ( !empty( $password ) ) {
+                                               echo '<code>'. $password .'</code><br />';
+                                       }
+                                       echo '<p>'. $password_message .'</p>'; ?></td>
        </tr>
 </table>
 
 <p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
 
 <?php
        </tr>
 </table>
 
 <p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
 
 <?php
+               }
                break;
 }
 ?>
                break;
 }
 ?>
diff --git a/wp-admin/js/cat.dev.js b/wp-admin/js/cat.dev.js
new file mode 100644 (file)
index 0000000..cbc2900
--- /dev/null
@@ -0,0 +1,5 @@
+jQuery(document).ready( function($) {
+       var myConfirm = function() { return '' !== $('#newcat').val(); };
+       $('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>');
+       $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } );
+} );
index 4a64994adf8e5774af748f51f407321ea1458f5c..deee8c47e36f0758b6bbb784b489bd65702f33e9 100644 (file)
@@ -1,5 +1 @@
-jQuery( function($) {
-       var myConfirm = function() { return '' !== $('#newcat').val(); };
-       $('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>')
-       $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } );
-} );
+jQuery(document).ready(function(b){var a=function(){return""!==b("#newcat").val()};b("#jaxcat").prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="'+catL10n.add+'"/><input type="hidden"/><input type="hidden"/><span id="howto">'+catL10n.how+'</span></span><span id="cat-ajax-response"></span>');b("#categorychecklist").wpList({alt:"",response:"cat-ajax-response",confirm:a})});
\ No newline at end of file
diff --git a/wp-admin/js/categories.dev.js b/wp-admin/js/categories.dev.js
new file mode 100644 (file)
index 0000000..dd96954
--- /dev/null
@@ -0,0 +1,42 @@
+jQuery(document).ready(function($) {
+       var options = false, addAfter, addAfter2, delBefore, delAfter;
+       if ( document.forms['addcat'].category_parent )
+               options = document.forms['addcat'].category_parent.options;
+
+       addAfter = function( r, settings ) {
+               var name, id;
+
+               name = $("<span>" + $('name', r).text() + "</span>").html();
+               id = $('cat', r).attr('id');
+               options[options.length] = new Option(name, id);
+
+               addAfter2( r, settings );
+       }
+
+       addAfter2 = function( x, r ) {
+               var t = $(r.parsed.responses[0].data);
+               if ( t.length == 1 )
+                       inlineEditTax.addEvents($(t.id));
+       }
+
+       delAfter = function( r, settings ) {
+               var id = $('cat', r).attr('id'), o;
+               for ( o = 0; o < options.length; o++ )
+                       if ( id == options[o].value )
+                               options[o] = null;
+       }
+
+       delBefore = function(s) {
+               if ( 'undefined' != showNotice )
+                       return showNotice.warn() ? s : false;
+
+               return s;
+       }
+
+       if ( options )
+               $('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
+       else
+               $('#the-list').wpList({ addAfter: addAfter2, delBefore: delBefore });
+
+       $('.delete a[class^="delete"]').click(function(){return false;});
+});
index fa23b226ae0f8392157a469c13c6d901f3e39bf6..43f60ca1dcf419591d40434c822ed7aaab8455eb 100644 (file)
@@ -1,37 +1 @@
-jQuery(function($) {
-       var options = false
-       if ( document.forms['addcat'].category_parent )
-               options = document.forms['addcat'].category_parent.options;
-
-       var addAfter = function( r, settings ) {
-               var name = $("<span>" + $('name', r).text() + "</span>").html();
-               var id = $('cat', r).attr('id');
-               options[options.length] = new Option(name, id);
-
-               addAfter2( r, settings );
-       }
-
-       var addAfter2 = function( x, r ) {
-               var t = $(r.parsed.responses[0].data);
-               if ( t.length == 1 )
-                       inlineEditTax.addEvents($(t.id));
-       }
-
-       var delAfter = function( r, settings ) {
-               var id = $('cat', r).attr('id');
-               for ( var o = 0; o < options.length; o++ )
-                       if ( id == options[o].value )
-                               options[o] = null;
-       }
-
-       if ( options )
-               $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
-       else
-               $('#the-list').wpList({ addAfter: addAfter2 });
-
-       if ( jQuery('#link-category-search-input').size() ) {
-               columns.init('edit-link-categories');
-       } else {
-               columns.init('categories');
-       }
-});
+jQuery(document).ready(function(d){var b=false,f,e,c,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}f=function(i,h){var g,j;g=d("<span>"+d("name",i).text()+"</span>").html();j=d("cat",i).attr("id");b[b.length]=new Option(g,j);e(i,h)};e=function(g,i){var h=d(i.parsed.responses[0].data);if(h.length==1){inlineEditTax.addEvents(d(h.id))}};a=function(h,g){var j=d("cat",h).attr("id"),i;for(i=0;i<b.length;i++){if(j==b[i].value){b[i]=null}}};c=function(g){if("undefined"!=showNotice){return showNotice.warn()?g:false}return g};if(b){d("#the-list").wpList({addAfter:f,delBefore:c,delAfter:a})}else{d("#the-list").wpList({addAfter:e,delBefore:c})}d('.delete a[class^="delete"]').click(function(){return false})});
\ No newline at end of file
diff --git a/wp-admin/js/comment.dev.js b/wp-admin/js/comment.dev.js
new file mode 100644 (file)
index 0000000..1f15b5b
--- /dev/null
@@ -0,0 +1,37 @@
+jQuery(document).ready( function($) {
+
+       var stamp = $('#timestamp').html();
+       $('.edit-timestamp').click(function () {
+               if ($('#timestampdiv').is(":hidden")) {
+                       $('#timestampdiv').slideDown("normal");
+                       $('.edit-timestamp').hide();
+               }
+               return false;
+       });
+
+       $('.cancel-timestamp').click(function() {
+               $('#timestampdiv').slideUp("normal");
+               $('#mm').val($('#hidden_mm').val());
+               $('#jj').val($('#hidden_jj').val());
+               $('#aa').val($('#hidden_aa').val());
+               $('#hh').val($('#hidden_hh').val());
+               $('#mn').val($('#hidden_mn').val());
+               $('#timestamp').html(stamp);
+               $('.edit-timestamp').show();
+               return false;
+       });
+
+       $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
+               $('#timestampdiv').slideUp("normal");
+               $('.edit-timestamp').show();
+               $('#timestamp').html(
+                       commentL10n.submittedOn + ' <b>' +
+                       $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
+                       $('#jj').val() + ', ' +
+                       $('#aa').val() + ' @ ' +
+                       $('#hh').val() + ':' +
+                       $('#mn').val() + '</b> '
+               );
+               return false;
+       });
+});
\ No newline at end of file
index 7d5055255b2fdcbc38b15e832b12c1b27ec24408..ac65c92fa7880c9366d5baee2fb179d0b1433c57 100644 (file)
@@ -1,39 +1 @@
-jQuery(document).ready( function($) {
-       jQuery('.hide-if-no-js').show();
-       jQuery('.hide-if-js').hide();
-
-       var stamp = $('#timestamp').html();
-       $('.edit-timestamp').click(function () {
-               if ($('#timestampdiv').is(":hidden")) {
-                       $('#timestampdiv').slideDown("normal");
-                       $('.edit-timestamp').hide();
-               }
-               return false;
-       });
-
-       $('.cancel-timestamp').click(function() {
-               $('#timestampdiv').slideUp("normal");
-               $('#mm').val($('#hidden_mm').val());
-               $('#jj').val($('#hidden_jj').val());
-               $('#aa').val($('#hidden_aa').val());
-               $('#hh').val($('#hidden_hh').val());
-               $('#mn').val($('#hidden_mn').val());
-               $('#timestamp').html(stamp);
-               $('.edit-timestamp').show();
-               return false;
-       });
-
-       $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
-               $('#timestampdiv').slideUp("normal");
-               $('.edit-timestamp').show();
-               $('#timestamp').html(
-                       commentL10n.submittedOn + ' <b>' +
-                       $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
-                       $('#jj').val() + ', ' +
-                       $('#aa').val() + ' @ ' +
-                       $('#hh').val() + ':' +
-                       $('#mn').val() + '</b> '
-               );
-               return false;
-       });
-});
\ No newline at end of file
+jQuery(document).ready(function(b){var a=b("#timestamp").html();b(".edit-timestamp").click(function(){if(b("#timestampdiv").is(":hidden")){b("#timestampdiv").slideDown("normal");b(".edit-timestamp").hide()}return false});b(".cancel-timestamp").click(function(){b("#timestampdiv").slideUp("normal");b("#mm").val(b("#hidden_mm").val());b("#jj").val(b("#hidden_jj").val());b("#aa").val(b("#hidden_aa").val());b("#hh").val(b("#hidden_hh").val());b("#mn").val(b("#hidden_mn").val());b("#timestamp").html(a);b(".edit-timestamp").show();return false});b(".save-timestamp").click(function(){b("#timestampdiv").slideUp("normal");b(".edit-timestamp").show();b("#timestamp").html(commentL10n.submittedOn+" <b>"+b("#mm option[value="+b("#mm").val()+"]").text()+" "+b("#jj").val()+", "+b("#aa").val()+" @ "+b("#hh").val()+":"+b("#mn").val()+"</b> ");return false})});
\ No newline at end of file
diff --git a/wp-admin/js/common.dev.js b/wp-admin/js/common.dev.js
new file mode 100644 (file)
index 0000000..4a54c59
--- /dev/null
@@ -0,0 +1,267 @@
+var showNotice, adminMenu, columns;
+(function($){
+// sidebar admin menu
+adminMenu = {
+
+       init : function() {
+               $('#adminmenu div.wp-menu-toggle').each( function() {
+                       if ( $(this).siblings('.wp-submenu').length )
+                               $(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });
+                       else
+                               $(this).hide();
+               });
+
+               this.favorites();
+
+               $('a.separator').click(function(){
+                       if ( $('body').hasClass('folded') ) {
+                               adminMenu.fold(1);
+                               deleteUserSetting( 'mfold' );
+                       } else {
+                               adminMenu.fold();
+                               setUserSetting( 'mfold', 'f' );
+                       }
+                       return false;
+               });
+
+               if ( $('body').hasClass('folded') ) {
+                       this.fold();
+               }
+               this.restoreMenuState();
+       },
+
+       restoreMenuState : function() {
+               $('#adminmenu li.wp-has-submenu').each(function(i, e) {
+                       var v = getUserSetting( 'm'+i );
+                       if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
+
+                       if ( 'o' == v ) $(e).addClass('wp-menu-open');
+                       else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
+               });
+       },
+
+       toggle : function(el) {
+
+               el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' );
+
+               $('#adminmenu li.wp-has-submenu').each(function(i, e) {
+                       var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
+                       setUserSetting( 'm'+i, v );
+               });
+
+               return false;
+       },
+
+       fold : function(off) {
+               if (off) {
+                       $('body').removeClass('folded');
+                       $('#adminmenu li.wp-has-submenu').unbind();
+               } else {
+                       $('body').addClass('folded');
+                       $('#adminmenu li.wp-has-submenu').hoverIntent({
+                               over: function(e){
+                                       var m, b, h, o, f;
+                                       m = $(this).find('.wp-submenu');
+                                       b = m.parent().offset().top + m.height() + 1; // Bottom offset of the menu
+                                       h = $('#wpwrap').height(); // Height of the entire page
+                                       o = 60 + b - h;
+                                       f = $(window).height() + $('body').scrollTop() - 15; // The fold
+                                       if (f < (b - o)) {
+                                               o = b - f;
+                                       }
+                                       if (o > 1) {
+                                               m.css({'marginTop':'-'+o+'px'});
+                                       } else if ( m.css('marginTop') ) {
+                                               m.css({'marginTop':''});
+                                       }
+                                       m.addClass('sub-open');
+                               },
+                               out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); },
+                               timeout: 220,
+                               sensitivity: 8,
+                               interval: 100
+                       });
+
+               }
+       },
+
+       favorites : function() {
+               $('#favorite-inside').width($('#favorite-actions').width()-4);
+               $('#favorite-toggle, #favorite-inside').bind( 'mouseenter', function(){$('#favorite-inside').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideDown') ) { $('#favorite-inside').slideDown(100); $('#favorite-first').addClass('slide-down'); }}, 200) } );
+
+               $('#favorite-toggle, #favorite-inside').bind( 'mouseleave', function(){$('#favorite-inside').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideUp') ) { $('#favorite-inside').slideUp(100, function(){ $('#favorite-first').removeClass('slide-down'); } ); }}, 300) } );
+       }
+};
+
+$(document).ready(function(){adminMenu.init();});
+
+// show/hide/save table columns
+columns = {
+       init : function() {
+               $('.hide-column-tog').click( function() {
+                       var column = $(this).val(), show = $(this).attr('checked');
+                       if ( show ) {
+                               $('.column-' + column).show();
+                       } else {
+                               $('.column-' + column).hide();
+                       }
+                       columns.save_manage_columns_state();
+               } );
+       },
+
+       save_manage_columns_state : function() {
+               var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
+               $.post(ajaxurl, {
+                       action: 'hidden-columns',
+                       hidden: hidden,
+                       screenoptionnonce: $('#screenoptionnonce').val(),
+                       page: pagenow
+               });
+       }
+}
+
+$(document).ready(function(){columns.init();});
+
+})(jQuery);
+
+// stub for doing better warnings
+showNotice = {
+       warn : function() {
+               var msg = commonL10n.warnDelete || '';
+               if ( confirm(msg) ) {
+                       return true;
+               }
+
+               return false;
+       },
+
+       note : function(text) {
+               alert(text);
+       }
+};
+
+jQuery(document).ready( function($) {
+       var lastClicked = false, checks, first, last, checked;
+
+       // pulse
+       $('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
+
+       // Move .updated and .error alert boxes
+       $('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
+       $('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
+
+       // show warnings
+       $('#doaction, #doaction2').click(function(){
+               if ( $('select[name="action"]').val() == 'delete' || $('select[name="action2"]').val() == 'delete' ) {
+                       return showNotice.warn();
+               }
+       });
+
+       // screen settings tab
+       $('#show-settings-link').click(function () {
+               if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
+                       $('#contextual-help-link-wrap').css('visibility', 'hidden');
+               }
+               $('#screen-options-wrap').slideToggle('fast', function(){
+                       if ( $(this).hasClass('screen-options-open') ) {
+                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
+                               $('#contextual-help-link-wrap').css('visibility', '');
+                               $(this).removeClass('screen-options-open');
+                       } else {
+                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
+                               $(this).addClass('screen-options-open');
+                       }
+               });
+               return false;
+       });
+
+       // help tab
+       $('#contextual-help-link').click(function () {
+               if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
+                       $('#screen-options-link-wrap').css('visibility', 'hidden');
+               }
+               $('#contextual-help-wrap').slideToggle('fast', function(){
+                       if ( $(this).hasClass('contextual-help-open') ) {
+                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
+                               $('#screen-options-link-wrap').css('visibility', '');
+                               $(this).removeClass('contextual-help-open');
+                       } else {
+                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
+                               $(this).addClass('contextual-help-open');
+                       }
+               });
+               return false;
+       });
+       $('#contextual-help-link-wrap, #screen-options-link-wrap').show();
+
+       // check all checkboxes
+       $( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
+               if ( 'undefined' == e.shiftKey ) { return true; }
+               if ( e.shiftKey ) {
+                       if ( !lastClicked ) { return true; }
+                       checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
+                       first = checks.index( lastClicked );
+                       last = checks.index( this );
+                       checked = $(this).attr('checked');
+                       if ( 0 < first && 0 < last && first != last ) {
+                               checks.slice( first, last ).attr( 'checked', function(){
+                                       if ( $(this).parents('tr').is(':visible') )
+                                               return checked ? 'checked' : '';
+
+                                       return '';
+                               });
+                       }
+               }
+               lastClicked = this;
+               return true;
+       } );
+       $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
+               var c = $(this).attr('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle;
+
+
+               $(this).parents( 'form:first' ).find( 'table tbody:visible' ).find( '.check-column :checkbox' ).attr( 'checked', function() {
+                       if ( $(this).parents('tr').is(':hidden') )
+                               return '';
+                       if ( toggle )
+                               return $(this).attr( 'checked' ) ? '' : 'checked';
+                       else if (c)
+                               return 'checked';
+                       return '';
+               });
+               $(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
+                       if ( toggle )
+                               return '';
+                       else if (c)
+                               return 'checked';
+                       return '';
+               });
+       });
+       $('#default-password-nag-no').click( function() {
+               setUserSetting('default_password_nag', 'hide');
+               $('div.default-password-nag').hide();
+               return false;
+       });
+       
+       
+});
+
+jQuery(document).ready( function($){
+       var turboNag = $('.turbo-nag');
+
+       if ( !turboNag.length || ('undefined' != typeof(google) && google.gears) )
+               return;
+
+       if ( 'undefined' != typeof GearsFactory ) {
+               return;
+       } else {
+               try {
+                       if ( ( 'undefined' != typeof window.ActiveXObject && ActiveXObject('Gears.Factory') ) ||
+                               ( 'undefined' != typeof navigator.mimeTypes && navigator.mimeTypes['application/x-googlegears'] ) ) {
+                                       return;
+                       }
+               } catch(e){}
+       }
+
+       turboNag.show();
+
+});
index 67e38d81acc58c29cf03cfb2fe5aea50589f471b..299b57618b583212d575ca009bf9d761cf78b2d2 100644 (file)
@@ -1,395 +1 @@
-
-var wpCookies = {
-// The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.
-
-       each : function(o, cb, s) {
-               var n, l;
-
-               if (!o)
-                       return 0;
-
-               s = s || o;
-
-               if (typeof(o.length) != 'undefined') {
-                       for (n=0, l = o.length; n<l; n++) {
-                               if (cb.call(s, o[n], n, o) === false)
-                                       return 0;
-                       }
-               } else {
-                       for (n in o) {
-                               if (o.hasOwnProperty(n)) {
-                                       if (cb.call(s, o[n], n, o) === false)
-                                               return 0;
-                               }
-                       }
-               }
-               return 1;
-       },
-
-       getHash : function(n) {
-               var v = this.get(n), h;
-
-               if (v) {
-                       this.each(v.split('&'), function(v) {
-                               v = v.split('=');
-                               h = h || {};
-                               h[v[0]] = v[1];
-                       });
-               }
-               return h;
-       },
-
-       setHash : function(n, v, e, p, d, s) {
-               var o = '';
-
-               this.each(v, function(v, k) {
-                       o += (!o ? '' : '&') + k + '=' + v;
-               });
-
-               this.set(n, o, e, p, d, s);
-       },
-
-       get : function(n) {
-               var c = document.cookie, e, p = n + "=", b;
-
-               if (!c)
-                       return;
-
-               b = c.indexOf("; " + p);
-
-               if (b == -1) {
-                       b = c.indexOf(p);
-
-                       if (b != 0)
-                               return null;
-               } else
-                       b += 2;
-
-               e = c.indexOf(";", b);
-
-               if (e == -1)
-                       e = c.length;
-
-               return decodeURIComponent(c.substring(b + p.length, e));
-       },
-
-       set : function(n, v, e, p, d, s) {
-               document.cookie = n + "=" + encodeURIComponent(v) +
-                       ((e) ? "; expires=" + e.toGMTString() : "") +
-                       ((p) ? "; path=" + p : "") +
-                       ((d) ? "; domain=" + d : "") +
-                       ((s) ? "; secure" : "");
-       },
-
-       remove : function(n, p) {
-               var d = new Date();
-
-               d.setTime(d.getTime() - 1000);
-
-               this.set(n, '', d, p, d);
-       }
-};
-
-// Returns the value as string. Second arg or empty string is returned when value is not set.
-function getUserSetting( name, def ) {
-       var o = getAllUserSettings();
-
-       if ( o.hasOwnProperty(name) )
-               return o[name];
-
-       if ( typeof def != 'undefined' )
-               return def;
-
-       return '';
-}
-
-// Both name and value must be only ASCII letters, numbers or underscore
-// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
-function setUserSetting( name, value, del ) {
-       var c = 'wp-settings-'+userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date();
-       var n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, '');
-
-       if ( del ) delete o[n];
-       else o[n] = v;
-
-       d.setTime( d.getTime() + 31536000000 );
-       p = userSettings.url;
-
-       wpCookies.setHash(c, o, d, p );
-       wpCookies.set('wp-settings-time-'+userSettings.uid, userSettings.time, d, p );
-}
-
-function deleteUserSetting( name ) {
-       setUserSetting( name, '', 1 );
-}
-
-// Returns all settings as js object.
-function getAllUserSettings() {
-       return wpCookies.getHash('wp-settings-'+userSettings.uid) || {};
-}
-
-
-jQuery(document).ready( function($) {
-       // pulse
-       $('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
-
-       // show things that should be visible, hide what should be hidden
-       $('.hide-if-no-js').removeClass('hide-if-no-js');
-       $('.hide-if-js').hide();
-
-       // Basic form validation
-       if ( ( 'undefined' != typeof wpAjax ) && $.isFunction( wpAjax.validateForm ) ) {
-               $('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
-       }
-
-       // Move .updated and .error alert boxes
-       $('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
-       $('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
-
-       // screen settings tab
-       $('#show-settings-link').click(function () {
-               if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
-                       $('#contextual-help-link-wrap').addClass('invisible');
-               }
-               $('#screen-options-wrap').slideToggle('fast', function(){
-                       if ( $(this).hasClass('screen-options-open') ) {
-                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
-                               $('#contextual-help-link-wrap').removeClass('invisible');
-                               $(this).removeClass('screen-options-open');
-
-                       } else {
-                               $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
-                               $(this).addClass('screen-options-open');
-                       }
-               });
-               return false;
-       });
-
-       // help tab
-       $('#contextual-help-link').click(function () {
-               if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
-                       $('#screen-options-link-wrap').addClass('invisible');
-               }
-               $('#contextual-help-wrap').slideToggle('fast', function(){
-                       if ( $(this).hasClass('contextual-help-open') ) {
-                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
-                               $('#screen-options-link-wrap').removeClass('invisible');
-                               $(this).removeClass('contextual-help-open');
-                       } else {
-                               $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
-                               $(this).addClass('contextual-help-open');
-                       }
-               });
-               return false;
-       });
-
-       // check all checkboxes
-       var lastClicked = false;
-       $( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
-               if ( 'undefined' == e.shiftKey ) { return true; }
-               if ( e.shiftKey ) {
-                       if ( !lastClicked ) { return true; }
-                       var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
-                       var first = checks.index( lastClicked );
-                       var last = checks.index( this );
-                       var checked = $(this).attr('checked');
-                       if ( 0 < first && 0 < last && first != last ) {
-                               checks.slice( first, last ).attr( 'checked', function(){
-                                       if ( $(this).parents('tr').is(':visible') )
-                                               return checked ? 'checked' : '';
-
-                                       return '';
-                               });
-                       }
-               }
-               lastClicked = this;
-               return true;
-       } );
-       $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
-               var c = $(this).attr('checked');
-               if ( 'undefined' == typeof  toggleWithKeyboard)
-                       toggleWithKeyboard = false;
-               var toggle = e.shiftKey || toggleWithKeyboard;
-               $(this).parents( 'form:first' ).find( 'table tbody:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
-                       if ( $(this).parents('tr').is(':hidden') )
-                               return '';
-                       if ( toggle )
-                               return $(this).attr( 'checked' ) ? '' : 'checked';
-                       else if (c)
-                               return 'checked';
-                       return '';
-               });
-               $(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
-                       if ( toggle )
-                               return '';
-                       else if (c)
-                               return 'checked';
-                       return '';
-               });
-       });
-});
-
-var showNotice, adminMenu, columns;
-
-// stub for doing better warnings
-showNotice = {
-       warn : function(text) {
-               if ( confirm(text) )
-                       return true;
-
-               return false;
-       },
-
-       note : function(text) {
-               alert(text);
-       }
-};
-
-(function($){
-// sidebar admin menu
-adminMenu = {
-
-       init : function() {
-               $('#adminmenu div.wp-menu-toggle').each( function() {
-                       if ( $(this).siblings('.wp-submenu').length )
-                               $(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });
-                       else
-                               $(this).hide();
-               });
-               $('#adminmenu li.menu-top .wp-menu-image').click( function() { window.location = $(this).siblings('a.menu-top')[0].href; } );
-               this.favorites();
-
-               $('.wp-menu-separator').click(function(){
-                       if ( $('#wpcontent').hasClass('folded') ) {
-                               adminMenu.fold(1);
-                               setUserSetting( 'mfold', 'o' );
-                       } else {
-                               adminMenu.fold();
-                               setUserSetting( 'mfold', 'f' );
-                       }
-               });
-
-               if ( 'f' != getUserSetting( 'mfold' ) ) {
-                       this.restoreMenuState();
-               } else {
-                       this.fold();
-               }
-       },
-
-       restoreMenuState : function() {
-               $('#adminmenu li.wp-has-submenu').each(function(i, e) {
-                       var v = getUserSetting( 'm'+i );
-                       if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
-
-                       if ( 'o' == v ) $(e).addClass('wp-menu-open');
-                       else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
-               });
-       },
-
-       toggle : function(el) {
-
-               el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' );
-
-               $('#adminmenu li.wp-has-submenu').each(function(i, e) {
-                       var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
-                       setUserSetting( 'm'+i, v );
-               });
-
-               return false;
-       },
-
-       fold : function(off) {
-               if (off) {
-                       $('#wpcontent').removeClass('folded');
-                       $('#adminmenu li.wp-has-submenu').unbind();
-               } else {
-                       $('#wpcontent').addClass('folded');
-                       $('#adminmenu li.wp-has-submenu').hoverIntent({
-                               over: function(e){
-                                       var m = $(this).find('.wp-submenu'), t = e.clientY, H = $(window).height(), h = m.height(), o;
-
-                                       if ( (t+h+10) > H ) {
-                                               o = (t+h+10) - H;
-                                               m.css({'marginTop':'-'+o+'px'});
-                                       } else if ( m.css('marginTop') ) {
-                                               m.css({'marginTop':''})
-                                       }
-                                       m.addClass('sub-open');
-                               },
-                               out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); },
-                               timeout: 220,
-                               sensitivity: 8,
-                               interval: 100
-                       });
-
-               }
-       },
-
-       favorites : function() {
-               $('#favorite-inside').width($('#favorite-actions').width()-4);
-               $('#favorite-toggle, #favorite-inside').bind( 'mouseenter', function(){$('#favorite-inside').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideDown') ) { $('#favorite-inside').slideDown(100); $('#favorite-first').addClass('slide-down'); }}, 200) } );
-
-               $('#favorite-toggle, #favorite-inside').bind( 'mouseleave', function(){$('#favorite-inside').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideUp') ) { $('#favorite-inside').slideUp(100, function(){ $('#favorite-first').removeClass('slide-down'); } ); }}, 300) } );
-       }
-};
-
-$(document).ready(function(){adminMenu.init();});
-})(jQuery);
-
-(function($){
-// show/hide/save table columns
-columns = {
-       init : function(page) {
-               $('.hide-column-tog').click( function() {
-                       var column = $(this).val();
-                       var show = $(this).attr('checked');
-                       if ( show ) {
-                               $('.column-' + column).show();
-                       } else {
-                               $('.column-' + column).hide();
-                       }
-                       columns.save_manage_columns_state(page);
-               } );
-       },
-
-       save_manage_columns_state : function(page) {
-               var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
-               $.post('admin-ajax.php', {
-                       action: 'hidden-columns',
-                       hidden: hidden,
-                       hiddencolumnsnonce: $('#hiddencolumnsnonce').val(),
-                       page: page
-               });
-       }
-}
-
-})(jQuery);
-
-
-jQuery(document).ready(function($){
-       if ( 'undefined' != typeof google && google.gears ) return;
-
-       var gf = false;
-       if ( 'undefined' != typeof GearsFactory ) {
-               gf = new GearsFactory();
-       } else {
-               try {
-                       gf = new ActiveXObject('Gears.Factory');
-                       if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
-                               gf.privateSetGlobalObject(this);
-               } catch (e) {
-                       if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
-                               gf = document.createElement("object");
-                               gf.style.display = "none";
-                               gf.width = 0;
-                               gf.height = 0;
-                               gf.type = "application/x-googlegears";
-                               document.documentElement.appendChild(gf);
-                       }
-               }
-       }
-       if ( gf && gf.hasPermission )
-               return;
-
-       $('.turbo-nag').show();
-});
+var showNotice,adminMenu,columns;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});this.favorites();a("a.separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=d.parent().offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a("body").scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()})})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name="action"]').val()=="delete"||d('select[name="action2"]').val()=="delete"){return showNotice.warn()}});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b(".turbo-nag");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
\ No newline at end of file
diff --git a/wp-admin/js/custom-fields.dev.js b/wp-admin/js/custom-fields.dev.js
new file mode 100644 (file)
index 0000000..70be83a
--- /dev/null
@@ -0,0 +1,34 @@
+jQuery(document).ready( function($) {
+       var before, addBefore, addAfter, delBefore;
+
+       before = function() {
+               var nonce = $('#newmeta [name=_ajax_nonce]').val(), postId = $('#post_ID').val();
+               if ( !nonce || !postId ) { return false; }
+               return [nonce,postId];
+       }
+
+       addBefore = function( s ) {
+               var b = before();
+               if ( !b ) { return false; }
+               s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1];
+               return s;
+       };
+
+       addAfter = function( r, s ) {
+               var postId = $('postid', r).text(), h;
+               if ( !postId ) { return; }
+               $('#post_ID').attr( 'name', 'post_ID' ).val( postId );
+               h = $('#hiddenaction');
+               if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); }
+       };
+
+       delBefore = function( s ) {
+               var b = before(); if ( !b ) return false;
+               s.data._ajax_nonce = b[0]; s.data.post_id = b[1];
+               return s;
+       }
+
+       $('#the-list')
+               .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } )
+               .find('.updatemeta, .deletemeta').attr( 'type', 'button' );
+} );
index 8f2b1a59cf81d3df6376b7dc47800b433dccb38a..48dad1e3aa8f3154d57c53f00ee8ce3b6d547ae9 100644 (file)
@@ -1,33 +1 @@
-jQuery( function($) {
-       var before = function() {
-               var nonce = $('#newmeta [@name=_ajax_nonce]').val();
-               var postId = $('#post_ID').val();
-               if ( !nonce || !postId ) { return false; }
-               return [nonce,postId];
-       }
-
-       var addBefore = function( s ) {
-               var b = before();
-               if ( !b ) { return false; }
-               s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1];
-               return s;
-       };
-
-       var addAfter = function( r, s ) {
-               var postId = $('postid', r).text();
-               if ( !postId ) { return; }
-               $('#post_ID').attr( 'name', 'post_ID' ).val( postId );
-               var h = $('#hiddenaction');
-               if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); }
-       };
-
-       var delBefore = function( s ) {
-               var b = before(); if ( !b ) return false;
-               s.data._ajax_nonce = b[0]; s.data.post_id = b[1];
-               return s;
-       }
-
-       $('#the-list')
-               .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } )
-               .find('.updatemeta, .deletemeta').attr( 'type', 'button' );
-} );
+jQuery(document).ready(function(d){var c,b,e,a;c=function(){var g=d("#newmeta [name=_ajax_nonce]").val(),f=d("#post_ID").val();if(!g||!f){return false}return[g,f]};b=function(g){var f=c();if(!f){return false}g.data=g.data.replace(/_ajax_nonce=[a-f0-9]+/,"_ajax_nonce="+f[0])+"&post_id="+f[1];return g};e=function(j,i){var f=d("postid",j).text(),g;if(!f){return}d("#post_ID").attr("name","post_ID").val(f);g=d("#hiddenaction");if("post"==g.val()){g.val("postajaxpost")}};a=function(g){var f=c();if(!f){return false}g.data._ajax_nonce=f[0];g.data.post_id=f[1];return g};d("#the-list").wpList({addBefore:b,addAfter:e,delBefore:a}).find(".updatemeta, .deletemeta").attr("type","button")});
\ No newline at end of file
diff --git a/wp-admin/js/dashboard.dev.js b/wp-admin/js/dashboard.dev.js
new file mode 100644 (file)
index 0000000..75d4521
--- /dev/null
@@ -0,0 +1,50 @@
+
+jQuery(document).ready( function($) {
+       var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
+       // These widgets are sometimes populated via ajax
+       ajaxWidgets = [
+               'dashboard_incoming_links',
+               'dashboard_primary',
+               'dashboard_secondary',
+               'dashboard_plugins'
+       ];
+
+       ajaxPopulateWidgets = function() {
+               $.each( ajaxWidgets, function() {
+                       var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading');
+                       if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); }
+               } );
+       };
+       ajaxPopulateWidgets();
+
+       postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } );
+
+       /* QuickPress */
+       quickPressLoad = function() {
+               var act = $('#quickpost-action'), t;
+               t = $('#quick-press').submit( function() {
+                       $('#dashboard_quick_press h3').append( '<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />' );
+                       $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled','disabled');
+
+                       if ( 'post' == act.val() ) {
+                               act.val( 'post-quickpress-publish' );
+                       }
+
+                       $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() {
+                               $('#dashboard_quick_press h3 img').remove();
+                               $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled','');
+                               $('#dashboard_quick_press ul').find('li').each( function() {
+                                       $('#dashboard_recent_drafts ul').prepend( this );
+                               } ).end().remove();
+                               tb_init('a.thickbox');
+                               quickPressLoad();
+                       } );
+                       return false;
+               } );
+
+               $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );
+
+       };
+       quickPressLoad();
+
+} );
index c99163a64918d796b8ecd72cce1b6b4eb29c79e4..8c20f1ecf211d3972039bd55306785cb1fe26b77 100644 (file)
@@ -1,52 +1 @@
-
-jQuery( function($) {
-
-// close postboxes that should be closed
-jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
-
-// These widgets are sometimes populated via ajax
-var ajaxWidgets = [
-       'dashboard_incoming_links',
-       'dashboard_primary',
-       'dashboard_secondary',
-       'dashboard_plugins'
-];
-
-var ajaxPopulateWidgets = function() {
-       $.each( ajaxWidgets, function() {
-               var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading');
-               if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); }
-       } );
-};
-ajaxPopulateWidgets();
-
-postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } );
-
-/* QuickPress */
-var quickPressLoad = function() {
-       var act = $('#quickpost-action');
-       var t = $('#quick-press').submit( function() {
-               $('#dashboard_quick_press h3').append( '<img src="images/loading.gif" style="margin: 0 6px 0 0; vertical-align: middle" />' );
-
-               if ( 'post' == act.val() ) {
-                       act.val( 'post-quickpress-publish' );
-               }
-
-               $('#dashboard_quick_press div.inside').load( t.attr( 'action' ), t.serializeArray(), function() {
-                       $('#dashboard_quick_press h3 img').remove();
-                       $('#dashboard_quick_press ul').find('li').each( function() {
-                               $('#dashboard_recent_drafts ul').prepend( this );
-                       } ).end().remove();
-                       $(this).find('.hide-if-no-js').removeClass('hide-if-no-js');
-                       tb_init('a.thickbox');
-                       quickPressLoad();
-               } );
-               return false;
-       } );
-
-       $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );
-
-};
-quickPressLoad();
-
-} );
+jQuery(document).ready(function(c){var a,b,d;a=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];b=function(){c.each(a,function(){var f=jQuery("#"+this+":visible div.inside").find(".widget-loading");if(f.size()){f.parent().load("index-extra.php?jax="+this)}})};b();postboxes.add_postbox_toggles("dashboard",{onShow:b});d=function(){var e=c("#quickpost-action"),f;f=c("#quick-press").submit(function(){c("#dashboard_quick_press h3").append('<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==e.val()){e.val("post-quickpress-publish")}c("#dashboard_quick_press div.inside").load(f.attr("action"),f.serializeArray(),function(){c("#dashboard_quick_press h3 img").remove();c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");c("#dashboard_quick_press ul").find("li").each(function(){c("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");d()});return false});c("#publish").click(function(){e.val("post-quickpress-publish")})};d()});
\ No newline at end of file
diff --git a/wp-admin/js/edit-comments.dev.js b/wp-admin/js/edit-comments.dev.js
new file mode 100644 (file)
index 0000000..2d7ddbe
--- /dev/null
@@ -0,0 +1,391 @@
+var theList, theExtraList, toggleWithKeyboard = false;
+(function($) {
+
+setCommentsList = function() {
+       var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter;
+
+       totalInput = $('#comments-form .tablenav :input[name="_total"]');
+       perPageInput = $('#comments-form .tablenav :input[name="_per_page"]');
+       pageInput = $('#comments-form .tablenav :input[name="_page"]');
+
+       dimAfter = function( r, settings ) {
+               var c = $('#' + settings.element);
+
+               if ( c.is('.unapproved') )
+                       c.find('div.comment_status').html('0')
+               else
+                       c.find('div.comment_status').html('1')
+
+               $('span.pending-count').each( function() {
+                       var a = $(this), n;
+                       n = a.html().replace(/[ ,.]+/g, '');
+                       n = parseInt(n,10);
+                       if ( isNaN(n) ) return;
+                       n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
+                       if ( n < 0 ) { n = 0; }
+                       $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
+                       n = n.toString();
+                       if ( n.length > 3 )
+                               n = n.substr(0, n.length-3)+' '+n.substr(-3);
+                       a.html(n);
+               });
+       };
+
+       // Send current total, page, per_page and url
+       delBefore = function( settings ) {
+               settings.data._total = totalInput.val();
+               settings.data._per_page = perPageInput.val();
+               settings.data._page = pageInput.val();
+               settings.data._url = document.location.href;
+
+               if ( 'undefined' != showNotice && settings.data.action && settings.data.action == 'delete-comment' && !settings.data.spam )
+                       return showNotice.warn() ? settings : false;
+
+               return settings;
+       };
+
+       /* Updates the current total (as displayed visibly)
+       */
+       updateTotalCount = function( total, time, setConfidentTime ) {
+               if ( time < lastConfidentTime ) {
+                       return;
+               }
+               totalInput.val( total.toString() );
+               if ( setConfidentTime ) {
+                       lastConfidentTime = time;
+               }
+               $('span.total-type-count').each( function() {
+                       var a = $(this), n;
+                       n = totalInput.val().toString();
+                       if ( n.length > 3 )
+                               n = n.substr(0, n.length-3)+' '+n.substr(-3);
+                       a.html(n);
+               });
+
+       };
+
+       // In admin-ajax.php, we send back the unix time stamp instead of 1 on success
+       delAfter = function( r, settings ) {
+               $('span.pending-count').each( function() {
+                       var a = $(this), n;
+                       n = a.html().replace(/[ ,.]+/g, '');
+                       n = parseInt(n,10);
+                       if ( isNaN(n) ) return;
+                       if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
+                               n = n - 1;
+                       } else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
+                               n = n + 1;
+                       }
+                       if ( n < 0 ) { n = 0; }
+                       $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
+                       n = n.toString();
+                       if ( n.length > 3 )
+                               n = n.substr(0, n.length-3)+' '+n.substr(-3);
+                       a.html(n);
+               });
+
+               $('span.spam-count').each( function() {
+                       var a = $(this), n;
+                       n = a.html().replace(/[ ,.]+/g, '');
+                       n = parseInt(n,10);
+                       if ( isNaN(n) ) return;
+                       if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
+                               n = n + 1;
+                       } else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam
+                               n = n - 1;
+                       }
+                       if ( n < 0 ) { n = 0; }
+                       n = n.toString();
+                       if ( n.length > 3 )
+                               n = n.substr(0, n.length-3)+' '+n.substr(-3);
+                       a.html(n);
+               });
+
+
+               // XML response
+               if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) {
+                       // Set the total to the known good value (even if this value is a little old, newer values should only be a few less, and so shouldn't mess up the page links)
+                       updateTotalCount( settings.parsed.responses[0].supplemental.total, settings.parsed.responses[0].supplemental.time, true );
+                       if ( $.trim( settings.parsed.responses[0].supplemental.pageLinks ) ) {
+                               $('.tablenav-pages').find( '.page-numbers' ).remove().end().append( $( settings.parsed.responses[0].supplemental.pageLinks ) );
+                       } else if ( 'undefined' != typeof settings.parsed.responses[0].supplemental.pageLinks ) {
+                               $('.tablenav-pages').find( '.page-numbers' ).remove();
+                       }
+               } else {
+                       // Decrement the total
+                       var total = parseInt( totalInput.val(), 10 );
+                       if ( total-- < 0 )
+                               total = 0;
+                       updateTotalCount( total, r, false );
+               }
+
+               if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
+                       return;
+               }
+
+               theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
+               $('#get-extra-comments').submit();
+       };
+
+       theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
+       theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
+
+};
+
+commentReply = {
+
+       init : function() {
+               var row = $('#replyrow');
+
+               $('a.cancel', row).click(function() { return commentReply.revert(); });
+               $('a.save', row).click(function() { return commentReply.send(); });
+               $('input#author, input#author-email, input#author-url', row).keypress(function(e){
+                       if ( e.which == 13 ) {
+                               commentReply.send();
+                               e.preventDefault();
+                               return false;
+                       }
+               });
+
+               // add events
+               $('#the-comment-list .column-comment > p').dblclick(function(){
+                       commentReply.toggle($(this).parent());
+               });
+
+               $('#doaction, #doaction2, #post-query-submit').click(function(e){
+                       if ( $('#the-comment-list #replyrow').length > 0 )
+                               commentReply.close();
+               });
+
+               this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || '';
+
+       },
+
+       addEvents : function(r) {
+               r.each(function() {
+                       $(this).find('.column-comment > p').dblclick(function(){
+                               commentReply.toggle($(this).parent());
+                       });
+               });
+       },
+
+       toggle : function(el) {
+               if ( $(el).css('display') != 'none' )
+                       $(el).find('a.vim-q').click();
+       },
+
+       revert : function() {
+
+               if ( $('#the-comment-list #replyrow').length < 1 )
+                       return false;
+
+               $('#replyrow').fadeOut('fast', function(){
+                       commentReply.close();
+               });
+
+               return false;
+       },
+
+       close : function() {
+               $(this.o).fadeIn('fast').css('backgroundColor', '');
+               $('#com-reply').append( $('#replyrow') );
+               $('#replycontent').val('');
+               $('#edithead input').val('');
+               $('#replysubmit .error').html('').hide();
+               $('#replysubmit .waiting').hide();
+               if ( $.browser.msie )
+                       $('#replycontainer, #replycontent').css('height', '120px');
+               else
+                       $('#replycontainer').resizable('destroy').css('height', '120px');
+       },
+
+       open : function(id, p, a) {
+               var t = this, editRow, act, h;
+               t.close();
+               t.o = '#comment-'+id;
+
+               $('#replyrow td').attr('colspan', $('.widefat thead th:visible').length);
+               editRow = $('#replyrow'), rowData = $('#inline-'+id);
+               act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment';
+
+               $('#action', editRow).val(act);
+               $('#comment_post_ID', editRow).val(p);
+               $('#comment_ID', editRow).val(id);
+
+               if ( a == 'edit' ) {
+                       $('#author', editRow).val( $('div.author', rowData).text() );
+                       $('#author-email', editRow).val( $('div.author-email', rowData).text() );
+                       $('#author-url', editRow).val( $('div.author-url', rowData).text() );
+                       $('#status', editRow).val( $('div.comment_status', rowData).text() );
+                       $('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
+                       $('#edithead, #savebtn', editRow).show();
+                       $('#replyhead, #replybtn', editRow).hide();
+
+                       h = $(t.o).height();
+                       if ( h > 220 )
+                               if ( $.browser.msie )
+                                       $('#replycontainer, #replycontent', editRow).height(h-105);
+                               else
+                                       $('#replycontainer', editRow).height(h-105);
+
+                       $(t.o).after(editRow.hide()).fadeOut('fast', function(){
+                               $('#replyrow').fadeIn('fast');
+                       });
+               } else {
+                       $('#edithead, #savebtn', editRow).hide();
+                       $('#replyhead, #replybtn', editRow).show();
+                       $(t.o).after(editRow);
+                       $('#replyrow').hide().fadeIn('fast');
+               }
+
+               if ( ! $.browser.msie )
+                       $('#replycontainer').resizable({
+                               handles : 's',
+                               axis : 'y',
+                               minHeight : 80,
+                               stop : function() {
+                                       $('#replycontainer').width('auto');
+                               }
+                       });
+
+               setTimeout(function() {
+                       var rtop, rbottom, scrollTop, vp, scrollBottom;
+
+                       rtop = $('#replyrow').offset().top;
+                       rbottom = rtop + $('#replyrow').height();
+                       scrollTop = window.pageYOffset || document.documentElement.scrollTop;
+                       vp = document.documentElement.clientHeight || self.innerHeight || 0;
+                       scrollBottom = scrollTop + vp;
+
+                       if ( scrollBottom - 20 < rbottom )
+                               window.scroll(0, rbottom - vp + 35);
+                       else if ( rtop - 20 < scrollTop )
+                               window.scroll(0, rtop - 35);
+
+                       $('#replycontent').focus().keyup(function(e){
+                               if (e.which == 27) commentReply.revert(); // close on Escape
+                       });
+               }, 600);
+
+               return false;
+       },
+
+       send : function() {
+               var post = {};
+
+               $('#replysubmit .waiting').show();
+
+               $('#replyrow input').each(function() {
+                       post[ $(this).attr('name') ] = $(this).val();
+               });
+
+               post.content = $('#replycontent').val();
+               post.id = post.comment_post_ID;
+               post.comments_listing = this.comments_listing;
+
+               $.ajax({
+                       type : 'POST',
+                       url : wpListL10n.url,
+                       data : post,
+                       success : function(x) { commentReply.show(x); },
+                       error : function(r) { commentReply.error(r); }
+               });
+
+               return false;
+       },
+
+       show : function(xml) {
+               var r, c, id, bg;
+
+               if ( typeof(xml) == 'string' ) {
+                       this.error({'responseText': xml});
+                       return false;
+               }
+
+               r = wpAjax.parseAjaxResponse(xml);
+               if ( r.errors ) {
+                       this.error({'responseText': wpAjax.broken});
+                       return false;
+               }
+
+               if ( 'edit-comment' == this.act )
+                       $(this.o).remove();
+
+               r = r.responses[0];
+               c = r.data;
+
+               $(c).hide()
+               $('#replyrow').after(c);
+
+               this.o = id = '#comment-'+r.id;
+               this.revert();
+               this.addEvents($(id));
+               bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff';
+
+               $(id)
+                       .animate( { 'backgroundColor':'#CCEEBB' }, 600 )
+                       .animate( { 'backgroundColor': bg }, 600 );
+
+               $.fn.wpList.process($(id))
+       },
+
+       error : function(r) {
+               var er = r.statusText;
+
+               $('#replysubmit .waiting').hide();
+
+               if ( r.responseText )
+                       er = r.responseText.replace( /<.[^<>]*?>/g, '' );
+
+               if ( er )
+                       $('#replysubmit .error').html(er).show();
+
+       }
+};
+
+$(document).ready(function(){
+       var make_hotkeys_redirect, edit_comment, toggle_all, make_bulk;
+
+       setCommentsList();
+       commentReply.init();
+       $('span.delete a.delete').click(function(){return false;});
+
+       if ( typeof QTags != 'undefined' )
+               ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');
+
+       if ( typeof $.table_hotkeys != 'undefined' ) {
+               make_hotkeys_redirect = function(which) {
+                       return function() {
+                               var first_last, l;
+
+                               first_last = 'next' == which? 'first' : 'last';
+                               l = $('.'+which+'.page-numbers');
+                               if (l.length)
+                                       window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
+                       }
+               };
+               edit_comment = function(event, current_row) {
+                       window.location = $('span.edit a', current_row).attr('href');
+               };
+               toggle_all = function() {
+                       toggleWithKeyboard = true;
+                       $('#comments-form thead #cb input:checkbox').click().attr('checked', '');
+                       toggleWithKeyboard = false;
+               }
+               make_bulk = function(value) {
+                       return function(event, _) {
+                               $('option[value='+value+']').attr('selected', 'selected');
+                               $('form#comments-form')[0].submit();
+                       }
+               };
+               $.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment],
+                               ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
+                               ['shift+d', make_bulk('delete')], ['shift+x', toggle_all],
+                               ['shift+u', make_bulk('unapprove')]],
+                               {highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
+                               prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')}
+               );
+       }
+});
+
+})(jQuery);
index 349a57d73dfdecceab0e7203e279a7a243bb4b87..91288b9466fda2cf1ceab02acb6feedf1429205e 100644 (file)
@@ -1,320 +1 @@
-var theList; var theExtraList;
-(function($) {
-
-setCommentsList = function() {
-       var dimAfter = function( r, settings ) {
-               var c = $('#' + settings.element);
-
-               if ( c.is('.unapproved') )
-                       c.find('div.comment_status').html('0')
-               else
-                       c.find('div.comment_status').html('1')
-
-               $('span.pending-count').each( function() {
-                       var a = $(this);
-                       var n = a.html().replace(/[ ,.]+/g, '');
-                       n = parseInt(n,10);
-                       if ( isNaN(n) ) return;
-                       n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
-                       if ( n < 0 ) { n = 0; }
-                       $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
-                       n = n.toString();
-                       if ( n.length > 3 )
-                               n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                       a.html(n);
-               });
-       };
-
-       var delAfter = function( r, settings ) {
-               $('span.pending-count').each( function() {
-                       var a = $(this);
-                       var n = a.html().replace(/[ ,.]+/g, '');
-                       n = parseInt(n,10);
-                       if ( isNaN(n) ) return;
-                       if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
-                               n = n - 1;
-                       } else if ( $(settings.target).parents( 'span.unapprove' ).size() ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"
-                               n = n + 1;
-                       }
-                       if ( n < 0 ) { n = 0; }
-                       $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
-                       n = n.toString();
-                       if ( n.length > 3 )
-                               n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                       a.html(n);
-               });
-
-               $('span.spam-count' ).each( function() {
-                       var a = $(this);
-                       var n = a.html().replace(/[ ,.]+/g, '');
-                       n = parseInt(n,10);
-                       if ( isNaN(n) ) return;
-                       if ( $(settings.target).parents( 'span.spam' ).size() ) { // we marked a comment as spam
-                               n = n + 1;
-                       } else if ( $('#' + settings.element).is('.spam') ) { // we approved or deleted a comment marked as spam
-                               n = n - 1;
-                       }
-                       if ( n < 0 ) { n = 0; }
-                       n = n.toString();
-                       if ( n.length > 3 )
-                               n = n.substr(0, n.length-3)+' '+n.substr(-3);
-                       a.html(n);
-               });
-
-               if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
-                       return;
-               }
-
-               theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
-               $('#get-extra-comments').submit();
-       };
-
-       theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
-       theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
-
-};
-
-$(document).ready(function(){
-       setCommentsList();
-});
-
-commentReply = {
-
-       init : function() {
-               var row = $('#replyrow');
-
-               $('a.cancel', row).click(function() { return commentReply.revert(); });
-               $('a.save', row).click(function() { return commentReply.send(this); });
-
-               // add events
-               $('#the-comment-list .column-comment > p').dblclick(function(){
-                               commentReply.toggle($(this).parent());
-                       });
-
-               $('#doaction, #doaction2, #post-query-submit').click(function(e){
-                       if ( $('#the-comment-list #replyrow').length > 0 )
-                               t.close();
-               });
-
-       },
-
-       addEvents : function(r) {
-               r.each(function() {
-                       $(this).find('.column-comment > p').dblclick(function(){
-                               commentReply.toggle($(this).parent());
-                       });
-               });
-       },
-
-       toggle : function(el) {
-               if ( $(el).css('display') != 'none' )
-                       $(el).find('a.vim-q').click();
-       },
-
-       revert : function() {
-
-               if ( $('#the-comment-list #replyrow').length < 1 )
-                       return false;
-
-               $('#replyrow').fadeOut('fast', function(){
-                       commentReply.close();
-               });
-
-               return false;
-       },
-
-       close : function() {
-               $(this.o).fadeIn('fast').css('backgroundColor', '');
-               $('#com-reply').append( $('#replyrow') );
-               $('#replycontent').val('');
-               $('#edithead input').val('');
-               $('#replysubmit .error').html('').hide();
-               $('#replysubmit .waiting').hide();
-               if ( $.browser.msie )
-                       $('#replycontainer, #replycontent').css('height', '120px');
-               else
-                       $('#replycontainer').resizable('destroy').css('height', '120px');
-       },
-
-       open : function(id, p, a) {
-               var t = this;
-               t.close();
-               t.o = '#comment-'+id;
-
-               $('#replyrow td').attr('colspan', $('.widefat thead th:visible').length);
-               var editRow = $('#replyrow'), rowData = $('#inline-'+id);
-               var act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment';
-
-               $('#action', editRow).val(act);
-               $('#comment_post_ID', editRow).val(p);
-               $('#comment_ID', editRow).val(id);
-
-               if ( a == 'edit' ) {
-                       $('#author', editRow).val( $('div.author', rowData).text() );
-                       $('#author-email', editRow).val( $('div.author-email', rowData).text() );
-                       $('#author-url', editRow).val( $('div.author-url', rowData).text() );
-                       $('#status', editRow).val( $('div.comment_status', rowData).text() );
-                       $('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
-                       $('#edithead, #savebtn', editRow).show();
-                       $('#replyhead, #replybtn', editRow).hide();
-
-                       var h = $(t.o).height();
-                       if ( h > 220 )
-                               if ( $.browser.msie )
-                                       $('#replycontainer, #replycontent', editRow).height(h-105);
-                               else
-                                       $('#replycontainer', editRow).height(h-105);
-
-                       $(t.o).after(editRow.hide()).fadeOut('fast', function(){
-                               $('#replyrow').fadeIn('fast');
-                       });
-               } else {
-                       $('#edithead, #savebtn', editRow).hide();
-                       $('#replyhead, #replybtn', editRow).show();
-                       $(t.o).after(editRow);
-                       $('#replyrow').hide().fadeIn('fast');
-               }
-
-               if ( ! $.browser.msie )
-                       $('#replycontainer').resizable({
-                               handles : 's',
-                               axis : 'y',
-                               minHeight : 80,
-                               stop : function() {
-                                       $('#replycontainer').width('auto');
-                               }
-                       });
-
-               setTimeout(function() {
-                       var rtop = $('#replyrow').offset().top;
-                       var rbottom = rtop + $('#replyrow').height();
-                       var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
-                       var vp = document.documentElement.clientHeight || self.innerHeight || 0;
-                       var scrollBottom = scrollTop + vp;
-
-                       if ( scrollBottom - 20 < rbottom )
-                               window.scroll(0, rbottom - vp + 35);
-                       else if ( rtop - 20 < scrollTop )
-                               window.scroll(0, rtop - 35);
-
-                       $('#replycontent').focus().keyup(function(e){
-                               if (e.which == 27) commentReply.revert(); // close on Escape
-                       });
-               }, 600);
-
-               return false;
-       },
-
-       send : function() {
-               var post = {};
-
-               $('#replysubmit .waiting').show();
-
-               $('#replyrow input').each(function() {
-                       post[ $(this).attr('name') ] = $(this).val();
-               });
-
-               post.content = $('#replycontent').val();
-               post.id = post.comment_post_ID;
-
-               $.ajax({
-                       type : 'POST',
-                       url : wpListL10n.url,
-                       data : post,
-                       success : function(x) { commentReply.show(x); },
-                       error : function(r) { commentReply.error(r); }
-               });
-
-               return false;
-       },
-
-       show : function(xml) {
-
-               if ( typeof(xml) == 'string' ) {
-                       this.error({'responseText': xml});
-                       return false;
-               }
-
-               var r = wpAjax.parseAjaxResponse(xml);
-               if ( r.errors ) {
-                       this.error({'responseText': wpAjax.broken});
-                       return false;
-               }
-
-               if ( 'edit-comment' == this.act )
-                       $(this.o).remove();
-
-               r = r.responses[0];
-               var c = r.data;
-
-               $(c).hide()
-               $('#replyrow').after(c);
-               this.o = id = '#comment-'+r.id;
-               $(id+' .hide-if-no-js').removeClass('hide-if-no-js');
-               this.revert();
-               this.addEvents($(id));
-               var bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff';
-
-               $(id)
-                       .animate( { 'backgroundColor':'#CCEEBB' }, 600 )
-                       .animate( { 'backgroundColor': bg }, 600 );
-
-               $.fn.wpList.process($(id))
-       },
-
-       error : function(r) {
-               var er = r.statusText;
-
-               $('#replysubmit .waiting').hide();
-
-               if ( r.responseText )
-                       er = r.responseText.replace( /<.[^<>]*?>/g, '' );
-
-               if ( er )
-                       $('#replysubmit .error').html(er).show();
-
-       }
-};
-toggleWithKeyboard = false;
-$(document).ready(function(){
-       columns.init('edit-comments');
-       commentReply.init();
-
-       if ( typeof QTags != 'undefined' )
-               ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');
-
-       if ( typeof $.table_hotkeys != 'undefined' ) {
-               var make_hotkeys_redirect = function(which) {
-                       return function() {
-                               var first_last = 'next' == which? 'first' : 'last';
-                               var l=$('.'+which+'.page-numbers');
-                               if (l.length)
-                                       window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
-                       }
-               };
-               var edit_comment = function(event, current_row) {
-                       window.location = $('span.edit a', current_row).attr('href');
-               };
-               var toggle_all = function() {
-                       toggleWithKeyboard = true;
-                       var master_checkbox = $('form#comments-form .check-column :checkbox:first');
-                       master_checkbox.click().attr('checked', '');
-                       toggleWithKeyboard = false;
-               }
-               var make_bulk = function(value) {
-                       return function(event, _) {
-                               $('option[value='+value+']').attr('selected', 'selected');
-                               $('form#comments-form')[0].submit();
-                       }
-               };
-               $.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', 'q', ['e', edit_comment],
-                               ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
-                               ['shift+d', make_bulk('delete')], ['shift+x', toggle_all],
-                               ['shift+u', make_bulk('unapprove')]],
-                               {highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
-                               prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')}
-               );
-       }
-});
-
-})(jQuery);
+var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;if("undefined"!=showNotice&&j.data.action&&j.data.action=="delete-comment"&&!j.data.spam){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/js/editor.dev.js b/wp-admin/js/editor.dev.js
new file mode 100644 (file)
index 0000000..17c0192
--- /dev/null
@@ -0,0 +1,179 @@
+
+jQuery(document).ready(function($){
+       var h = wpCookies.getHash('TinyMCE_content_size');
+
+       if ( getUserSetting( 'editor' ) == 'html' ) {
+               if ( h )
+                       $('#content').css('height', h.ch - 15 + 'px');
+       } else {
+               $('#content').css('color', 'white');
+               $('#quicktags').hide();
+       }
+});
+
+var switchEditors = {
+
+       mode : '',
+
+       I : function(e) {
+               return document.getElementById(e);
+       },
+
+       edInit : function() {
+       },
+
+       saveCallback : function(el, content, body) {
+
+               if ( tinyMCE.activeEditor.isHidden() )
+                       content = this.I(el).value;
+               else
+                       content = this.pre_wpautop(content);
+
+               return content;
+       },
+
+       pre_wpautop : function(content) {
+               var blocklist1, blocklist2;
+
+               // Protect pre|script tags
+               content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
+                       a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
+                       return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
+               });
+
+               // Pretty it up for the source editor
+               blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
+               content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
+               content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
+
+               // Mark </p> if it has any attributes.
+               content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
+
+               // Sepatate <div> containing <p>
+               content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
+
+               // Remove <p> and <br />
+               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
+               content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
+               content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
+               content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
+               content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
+
+               blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
+               content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
+               content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
+               content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
+
+               if ( content.indexOf('<object') != -1 ) {
+                       content = content.replace(/<object[\s\S]+?<\/object>/g, function(a){
+                               return a.replace(/[\r\n]+/g, '');
+                       });
+               }
+
+               // Unmark special paragraph closing tags
+               content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
+               content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
+
+               // Trim whitespace
+               content = content.replace(new RegExp('^\\s*', ''), '');
+               content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
+
+               // put back the line breaks in pre|script
+               content = content.replace(/<wp_temp>/g, '\n');
+
+               // Hope.
+               return content;
+       },
+
+       go : function(id, mode) {
+               id = id || 'content';
+               mode = mode || this.mode || '';
+
+               var ed, qt = this.I('quicktags'), H = this.I('edButtonHTML'), P = this.I('edButtonPreview'), ta = this.I(id);
+
+               try { ed = tinyMCE.get(id); }
+               catch(e) { ed = false; }
+
+               if ( 'tinymce' == mode ) {
+                       if ( ed && ! ed.isHidden() )
+                               return false;
+
+                       setUserSetting( 'editor', 'tinymce' );
+                       this.mode = 'html';
+
+                       P.className = 'active';
+                       H.className = '';
+                       edCloseAllTags(); // :-(
+                       qt.style.display = 'none';
+
+                       ta.value = this.wpautop(ta.value);
+
+                       if ( ed ) {
+                               ed.show();
+                       } else {
+                               try{tinyMCE.execCommand("mceAddControl", false, id);}
+                               catch(e){}
+                       }
+               } else {
+                       setUserSetting( 'editor', 'html' );
+                       ta.style.color = '#000';
+                       this.mode = 'tinymce';
+                       H.className = 'active';
+                       P.className = '';
+
+                       if ( ed && !ed.isHidden() ) {
+                               ta.style.height = ed.getContentAreaContainer().offsetHeight + 24 + 'px';
+                               ed.hide();
+                       }
+
+                       qt.style.display = 'block';
+               }
+               return false;
+       },
+
+       wpautop : function(pee) {
+               var blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]';
+
+               if ( pee.indexOf('<object') != -1 ) {
+                       pee = pee.replace(/<object[\s\S]+?<\/object>/g, function(a){
+                               return a.replace(/[\r\n]+/g, '');
+                       });
+               }
+
+               pee = pee.replace(/<[^<>]+>/g, function(a){
+                       return a.replace(/[\r\n]+/g, ' ');
+               });
+
+               pee = pee + "\n\n";
+               pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
+               pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
+               pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', '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('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
+               pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
+               pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
+               pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
+               pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
+               pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
+               pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
+               pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
+               pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
+               pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\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('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
+
+               // Fix the pre|script tags
+               pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
+                       a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
+                       return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
+               });
+
+               return pee;
+       }
+};
index 935267a28666b95564483a905dbeb4b1c79697f3..f3e54154509d8b032f302c82451bb5c587ed6491 100644 (file)
@@ -1,172 +1 @@
-
-var switchEditors = {
-
-       mode : '',
-
-       I : function(e) {
-               return document.getElementById(e);
-       },
-
-       edInit : function() {
-               var h = tinymce.util.Cookie.getHash("TinyMCE_content_size"), H = this.I('edButtonHTML'), P = this.I('edButtonPreview');
-
-               // Activate TinyMCE if it's the user's default editor
-               if ( getUserSetting( 'editor' ) == 'html' ) {
-                       if ( h )
-                               try { this.I('content').style.height = h.ch - 30 + 'px'; } catch(e){};
-               } else {
-                       try {
-                               this.I("quicktags").style.display = "none";
-                       } catch(e){};
-                       tinyMCE.execCommand("mceAddControl", false, "content");
-               }
-       },
-
-       saveCallback : function(el, content, body) {
-
-               if ( tinyMCE.activeEditor.isHidden() )
-                       content = this.I(el).value;
-               else
-                       content = this.pre_wpautop(content);
-
-               return content;
-       },
-
-       pre_wpautop : function(content) {
-               // We have a TON of cleanup to do. Line breaks are already stripped.
-
-               // Protect pre|script tags
-               content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
-                       a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
-                       return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
-               });
-
-               // Pretty it up for the source editor
-               var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
-               content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
-               content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
-
-               // Mark </p> if it has any attributes.
-               content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
-
-               // Sepatate <div> containing <p>
-               content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
-
-               // Remove <p> and <br />
-               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
-               content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
-               content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
-               content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
-               content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
-
-               var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
-               content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
-               content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
-               content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
-
-               if ( content.indexOf('<object') != -1 ) {
-                       content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
-                       content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
-               }
-
-               // Unmark special paragraph closing tags
-               content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
-               content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
-
-               // Trim whitespace
-               content = content.replace(new RegExp('^\\s*', ''), '');
-               content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
-
-               // put back the line breaks in pre|script
-               content = content.replace(/<wp_temp>/g, '\n');
-
-               // Hope.
-               return content;
-       },
-
-       go : function(id, mode) {
-               id = id || 'content';
-               mode = mode || this.mode || '';
-
-               var ed = tinyMCE.get(id) || false;
-               var qt = this.I('quicktags');
-               var H = this.I('edButtonHTML');
-               var P = this.I('edButtonPreview');
-               var ta = this.I(id);
-
-               if ( 'tinymce' == mode ) {
-
-                       if ( ed && ! ed.isHidden() )
-                               return false;
-
-                       this.mode = 'html';
-                       ta.style.color = '#fff';
-
-                       P.className = 'active';
-                       H.className = '';
-                       edCloseAllTags(); // :-(
-
-                       qt.style.display = 'none';
-
-                       ta.value = this.wpautop(ta.value);
-
-                       if ( ed ) ed.show();
-                       else tinyMCE.execCommand("mceAddControl", false, id);
-
-                       setUserSetting( 'editor', 'tinymce' );
-               } else {
-                       if ( ! ed || ed.isHidden() )
-                               return false;
-
-                       this.mode = 'tinymce';
-                       H.className = 'active';
-                       P.className = '';
-
-                       ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
-
-                       ed.hide();
-                       qt.style.display = 'block';
-
-                       ta.style.color = '';
-                       setUserSetting( 'editor', 'html' );
-               }
-               return false;
-       },
-
-       wpautop : function(pee) {
-               var blocklist = '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]';
-
-               pee = pee + "\n\n";
-               pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
-               pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
-               pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', '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('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
-               pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
-               pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
-               pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
-               pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
-               pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
-               pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
-               pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
-               pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
-               pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\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('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
-               // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
-
-               // Fix the pre|script tags
-               pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
-                       a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
-                       return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
-               });
-
-               return pee;
-       }
-};
+jQuery(document).ready(function(b){var a=wpCookies.getHash("TinyMCE_content_size");if(getUserSetting("editor")=="html"){if(a){b("#content").css("height",a.ch-15+"px")}}else{b("#content").css("color","white");b("#quicktags").hide()}});var switchEditors={mode:"",I:function(a){return document.getElementById(a)},edInit:function(){},saveCallback:function(b,c,a){if(tinyMCE.activeEditor.isHidden()){c=this.I(b).value}else{c=this.pre_wpautop(c)}return c},pre_wpautop:function(b){var c,a;b=b.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(d){d=d.replace(/<br ?\/?>[\r\n]*/g,"<wp_temp>");return d.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"<wp_temp>")});c="blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p";b=b.replace(new RegExp("\\s*</("+c+")>\\s*","mg"),"</$1>\n");b=b.replace(new RegExp("\\s*<(("+c+")[^>]*)>","mg"),"\n<$1>");b=b.replace(new RegExp("(<p [^>]+>.*?)</p>","mg"),"$1</p#>");b=b.replace(new RegExp("<div([^>]*)>\\s*<p>","mgi"),"<div$1>\n\n");b=b.replace(new RegExp("\\s*<p>","mgi"),"");b=b.replace(new RegExp("\\s*</p>\\s*","mgi"),"\n\n");b=b.replace(new RegExp("\\n\\s*\\n","mgi"),"\n\n");b=b.replace(new RegExp("\\s*<br ?/?>\\s*","gi"),"\n");b=b.replace(new RegExp("\\s*<div","mg"),"\n<div");b=b.replace(new RegExp("</div>\\s*","mg"),"</div>\n");b=b.replace(new RegExp("\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*","gi"),"\n\n[caption$1[/caption]\n\n");b=b.replace(new RegExp("caption\\]\\n\\n+\\[caption","g"),"caption]\n\n[caption");a="blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre";b=b.replace(new RegExp("\\s*<(("+a+") ?[^>]*)\\s*>","mg"),"\n<$1>");b=b.replace(new RegExp("\\s*</("+a+")>\\s*","mg"),"</$1>\n");b=b.replace(new RegExp("<li([^>]*)>","g"),"\t<li$1>");if(b.indexOf("<object")!=-1){b=b.replace(/<object[\s\S]+?<\/object>/g,function(d){return d.replace(/[\r\n]+/g,"")})}b=b.replace(new RegExp("</p#>","g"),"</p>\n");b=b.replace(new RegExp("\\s*(<p [^>]+>.*</p>)","mg"),"\n$1");b=b.replace(new RegExp("^\\s*",""),"");b=b.replace(new RegExp("[\\s\\u00a0]*$",""),"");b=b.replace(/<wp_temp>/g,"\n");return b},go:function(i,g){i=i||"content";g=g||this.mode||"";var b,h=this.I("quicktags"),c=this.I("edButtonHTML"),d=this.I("edButtonPreview"),a=this.I(i);try{b=tinyMCE.get(i)}catch(f){b=false}if("tinymce"==g){if(b&&!b.isHidden()){return false}setUserSetting("editor","tinymce");this.mode="html";d.className="active";c.className="";edCloseAllTags();h.style.display="none";a.value=this.wpautop(a.value);if(b){b.show()}else{try{tinyMCE.execCommand("mceAddControl",false,i)}catch(f){}}}else{setUserSetting("editor","html");a.style.color="#000";this.mode="tinymce";c.className="active";d.className="";if(b&&!b.isHidden()){a.style.height=b.getContentAreaContainer().offsetHeight+24+"px";b.hide()}h.style.display="block"}return false},wpautop:function(a){var b="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]";if(a.indexOf("<object")!=-1){a=a.replace(/<object[\s\S]+?<\/object>/g,function(c){return c.replace(/[\r\n]+/g,"")})}a=a.replace(/<[^<>]+>/g,function(c){return c.replace(/[\r\n]+/g," ")});a=a+"\n\n";a=a.replace(new RegExp("<br />\\s*<br />","gi"),"\n\n");a=a.replace(new RegExp("(<(?:"+b+")[^>]*>)","gi"),"\n$1");a=a.replace(new RegExp("(</(?:"+b+")>)","gi"),"$1\n\n");a=a.replace(new RegExp("\\r\\n|\\r","g"),"\n");a=a.replace(new RegExp("\\n\\s*\\n+","g"),"\n\n");a=a.replace(new RegExp("([\\s\\S]+?)\\n\\n","mg"),"<p>$1</p>\n");a=a.replace(new RegExp("<p>\\s*?</p>","gi"),"");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(new RegExp("<p>(<li.+?)</p>","gi"),"$1");a=a.replace(new RegExp("<p>\\s*<blockquote([^>]*)>","gi"),"<blockquote$1><p>");a=a.replace(new RegExp("</blockquote>\\s*</p>","gi"),"</p></blockquote>");a=a.replace(new RegExp("<p>\\s*(</?(?:"+b+")[^>]*>)","gi"),"$1");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*</p>","gi"),"$1");a=a.replace(new RegExp("\\s*\\n","gi"),"<br />\n");a=a.replace(new RegExp("(</?(?:"+b+")[^>]*>)\\s*<br />","gi"),"$1");a=a.replace(new RegExp("<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)","gi"),"$1");a=a.replace(new RegExp("(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*","gi"),"[caption$1[/caption]");a=a.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g,function(c){c=c.replace(/<br ?\/?>[\r\n]*/g,"\n");return c.replace(/<\/?p( [^>]*)?>[\r\n]*/g,"\n")});return a}};
\ No newline at end of file
diff --git a/wp-admin/js/gallery.dev.js b/wp-admin/js/gallery.dev.js
new file mode 100644 (file)
index 0000000..a7f1661
--- /dev/null
@@ -0,0 +1,204 @@
+jQuery(document).ready(function($) {
+       var gallerySortable, gallerySortableInit, w, desc = false;
+
+       gallerySortableInit = function() {
+               gallerySortable = $('#media-items').sortable( {
+                       items: '.media-item',
+                       placeholder: 'sorthelper',
+                       axis: 'y',
+                       distance: 2,
+                       stop: function(e, ui) {
+                               // When an update has occurred, adjust the order for each item
+                               var all = $('#media-items').sortable('toArray'), len = all.length;
+                               $.each(all, function(i, id) {
+                                       var order = desc ? (len - i) : (1 + i);
+                                       $('#' + id + ' .menu_order input').val(order);
+                               });
+                       }
+               } );
+       }
+
+       sortIt = function() {
+               var all = $('.menu_order_input'), len = all.length;
+               all.each(function(i){
+                       var order = desc ? (len - i) : (1 + i);
+                       $(this).val(order);
+               });
+       }
+
+       clearAll = function(c) {
+               c = c || 0;
+               $('.menu_order_input').each(function(){
+                       if ( this.value == '0' || c ) this.value = '';
+               });
+       }
+
+       $('#asc').click(function(){desc = false; sortIt(); return false;});
+       $('#desc').click(function(){desc = true; sortIt(); return false;});
+       $('#clear').click(function(){clearAll(1); return false;});
+       $('#showall').click(function(){
+               $('#sort-buttons span a').toggle();
+               $('a.describe-toggle-on').hide();
+               $('a.describe-toggle-off, table.slidetoggle').show();
+               return false;
+       });
+       $('#hideall').click(function(){
+               $('#sort-buttons span a').toggle();
+               $('a.describe-toggle-on').show();
+               $('a.describe-toggle-off, table.slidetoggle').hide();
+               return false;
+       });
+
+       // initialize sortable
+       gallerySortableInit();
+       clearAll();
+
+       if ( $('#media-items>*').length > 1 ) {
+               w = wpgallery.getWin();
+
+               $('#save-all, #gallery-settings').show();
+               if ( typeof w.tinyMCE != 'undefined' && w.tinyMCE.activeEditor && ! w.tinyMCE.activeEditor.isHidden() ) {
+                       wpgallery.mcemode = true;
+                       wpgallery.init();
+               } else {
+                       $('#insert-gallery').show();
+               }
+       }
+});
+
+jQuery(window).unload( function () { tinymce = tinyMCE = wpgallery = null; } ); // Cleanup
+
+/* gallery settings */
+var tinymce = null, tinyMCE, wpgallery;
+
+wpgallery = {
+       mcemode : false,
+       editor : {},
+       dom : {},
+       is_update : false,
+       el : {},
+
+       I : function(e) {
+               return document.getElementById(e);
+       },
+
+       init: function() {
+               var t = this, li, q, i, it, w = t.getWin();
+
+               if ( ! t.mcemode ) return;
+
+               li = ('' + document.location.search).replace(/^\?/, '').split('&');
+               q = {};
+               for (i=0; i<li.length; i++) {
+                       it = li[i].split('=');
+                       q[unescape(it[0])] = unescape(it[1]);
+               }
+
+               if (q.mce_rdomain)
+                       document.domain = q.mce_rdomain;
+
+               // Find window & API
+               tinymce = w.tinymce;
+               tinyMCE = w.tinyMCE;
+               t.editor = tinymce.EditorManager.activeEditor;
+
+               t.setup();
+       },
+
+       getWin : function() {
+               return window.dialogArguments || opener || parent || top;
+       },
+
+       restoreSelection : function() {
+               var t = this;
+
+               if (tinymce.isIE)
+                       t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
+       },
+
+       setup : function() {
+               var t = this, a, ed = t.editor, g, columns, link, order, orderby;
+               if ( ! t.mcemode ) return;
+
+               t.restoreSelection();
+               t.el = ed.selection.getNode();
+
+               if ( t.el.nodeName != 'IMG' || ! ed.dom.hasClass(t.el, 'wpGallery') ) {
+                       if ( (g = ed.dom.select('img.wpGallery')) && g[0] ) {
+                               t.el = g[0];
+                       } else {
+                               if ( getUserSetting('galfile') == '1' ) t.I('linkto-file').checked = "checked";
+                               if ( getUserSetting('galdesc') == '1' ) t.I('order-desc').checked = "checked";
+                               if ( getUserSetting('galcols') ) t.I('columns').value = getUserSetting('galcols');
+                               if ( getUserSetting('galord') ) t.I('orderby').value = getUserSetting('galord');
+                               jQuery('#insert-gallery').show();
+                               return;
+                       }
+               }
+
+               a = ed.dom.getAttrib(t.el, 'title');
+               a = ed.dom.decode(a);
+
+               if ( a ) {
+                       jQuery('#update-gallery').show();
+                       t.is_update = true;
+
+                       columns = a.match(/columns=['"]([0-9]+)['"]/);
+                       link = a.match(/link=['"]([^'"]+)['"]/i);
+                       order = a.match(/order=['"]([^'"]+)['"]/i);
+                       orderby = a.match(/orderby=['"]([^'"]+)['"]/i);
+
+                       if ( link && link[1] ) t.I('linkto-file').checked = "checked";
+                       if ( order && order[1] ) t.I('order-desc').checked = "checked";
+                       if ( columns && columns[1] ) t.I('columns').value = ''+columns[1];
+                       if ( orderby && orderby[1] ) t.I('orderby').value = orderby[1];
+               } else {
+                       jQuery('#insert-gallery').show();
+               }
+       },
+
+       update : function() {
+               var t = this, ed = t.editor, all = '', s;
+
+               if ( ! t.mcemode || ! t.is_update ) {
+                       s = '[gallery'+t.getSettings()+']';
+                       t.getWin().send_to_editor(s);
+                       return;
+               }
+
+               if (t.el.nodeName != 'IMG') return;
+
+               all = ed.dom.decode(ed.dom.getAttrib(t.el, 'title'));
+               all = all.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, '');
+               all += t.getSettings();
+
+               ed.dom.setAttrib(t.el, 'title', all);
+               t.getWin().tb_remove();
+       },
+
+       getSettings : function() {
+               var I = this.I, s = '';
+
+               if ( I('linkto-file').checked ) {
+                       s += ' link="file"';
+                       setUserSetting('galfile', '1');
+               }
+
+               if ( I('order-desc').checked ) {
+                       s += ' order="DESC"';
+                       setUserSetting('galdesc', '1');
+               }
+
+               if ( I('columns').value != 3 ) {
+                       s += ' columns="'+I('columns').value+'"';
+                       setUserSetting('galcols', I('columns').value);
+               }
+
+               if ( I('orderby').value != 'menu_order' ) {
+                       s += ' orderby="'+I('orderby').value+'"';
+                       setUserSetting('galord', I('orderby').value);
+               }
+
+               return s;
+       }
+};
index c0be92f8e55bb28ae43d04f20ed48899b00c8ed1..17fa43860c9c4010553f3d298d5d695e614c22b1 100644 (file)
@@ -1,175 +1 @@
-jQuery(function($) {
-       var gallerySortable;
-       var gallerySortableInit = function() {
-               gallerySortable = $('#media-items').sortable( {
-                       items: '.media-item',
-                       placeholder: 'sorthelper',
-                       axis: 'y',
-                       distance: 2,
-                       update: galleryReorder
-               } );
-       }
-
-       // When an update has occurred, adjust the order for each item
-       var galleryReorder = function(e, sort) {
-               jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
-                       jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
-               });
-       }
-
-       // initialize sortable
-       gallerySortableInit();
-});
-
-jQuery(document).ready(function($){
-       $('.menu_order_input').each(function(){
-               if ( this.value == '0' ) this.value = '';
-       });
-
-       if ( $('#media-items>*').length > 1 ) {
-               var w = wpgallery.getWin();
-
-               $('#save-all, #gallery-settings').show();
-               if ( typeof w.tinyMCE != 'undefined' && w.tinyMCE.activeEditor && ! w.tinyMCE.activeEditor.isHidden() ) {
-                       wpgallery.mcemode = true;
-                       wpgallery.init();
-               } else {
-                       $('#insert-gallery').show();
-               }
-       }
-});
-
-jQuery(window).unload( function () { tinymce = tinyMCE = wpgallery = null; } ); // Cleanup
-
-/* gallery settings */
-var tinymce = null, tinyMCE;
-
-var wpgallery = {
-       mcemode : false,
-       editor : {},
-       dom : {},
-       is_update : false,
-       el : {},
-
-       I : function(e) {
-               return document.getElementById(e);
-       },
-
-       init: function() {
-               var t = this, li, q, i, it, w = t.getWin();
-
-               if ( ! t.mcemode ) return;
-
-               li = ('' + document.location.search).replace(/^\?/, '').split('&');
-               q = {};
-               for (i=0; i<li.length; i++) {
-                       it = li[i].split('=');
-                       q[unescape(it[0])] = unescape(it[1]);
-               }
-
-               if (q.mce_rdomain)
-                       document.domain = q.mce_rdomain;
-
-               // Find window & API
-               tinymce = w.tinymce;
-               tinyMCE = w.tinyMCE;
-               t.editor = tinymce.EditorManager.activeEditor;
-
-               t.setup();
-       },
-
-       getWin : function() {
-               return window.dialogArguments || opener || parent || top;
-       },
-
-       restoreSelection : function() {
-               var t = this;
-
-               if (tinymce.isIE)
-                       t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
-       },
-
-       setup : function() {
-               var t = this, a, f = document.forms[0], ed = t.editor, el, g;
-               if ( ! t.mcemode ) return;
-
-               t.restoreSelection();
-               t.el = ed.selection.getNode();
-
-               if ( t.el.nodeName != 'IMG' || ! ed.dom.hasClass(t.el, 'wpGallery') ) {
-                       if ( (g = ed.dom.select('img.wpGallery')) && g[0] ) {
-                               t.el = g[0];
-                       } else {
-                               if ( getUserSetting('galfile') == '1' ) t.I('linkto-file').checked = "checked";
-                               if ( getUserSetting('galdesc') == '1' ) t.I('order-desc').checked = "checked";
-                               if ( getUserSetting('galcols') ) t.I('columns').value = getUserSetting('galcols');
-                               if ( getUserSetting('galord') ) t.I('orderby').value = getUserSetting('galord');
-                               jQuery('#insert-gallery').show();
-                               return;
-                       }
-               }
-
-               a = ed.dom.getAttrib(t.el, 'title');
-               a = ed.dom.decode(a);
-
-               if ( a ) {
-                       jQuery('#update-gallery').show();
-                       t.is_update = true;
-
-                       var columns = a.match(/columns=['"]([0-9]+)['"]/), link = a.match(/link=['"]([^'"]+)['"]/i);
-                       var order = a.match(/order=['"]([^'"]+)['"]/i), orderby = a.match(/orderby=['"]([^'"]+)['"]/i), all = '';
-
-                       if ( link && link[1] ) t.I('linkto-file').checked = "checked";
-                       if ( order && order[1] ) t.I('order-desc').checked = "checked";
-                       if ( columns && columns[1] ) t.I('columns').value = ''+columns[1];
-                       if ( orderby && orderby[1] ) t.I('orderby').value = orderby[1];
-               } else {
-                       jQuery('#insert-gallery').show();
-               }
-       },
-
-       update : function() {
-               var t = this, ed = t.editor, el, all = '';
-
-               if ( ! t.mcemode || ! t.is_update ) {
-                       var s = '[gallery'+t.getSettings()+']';
-                       t.getWin().send_to_editor(s);
-                       return;
-               }
-
-               if (t.el.nodeName != 'IMG') return;
-
-               all = ed.dom.decode(ed.dom.getAttrib(t.el, 'title'));
-               all = all.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, '');
-               all += t.getSettings();
-
-               ed.dom.setAttrib(t.el, 'title', all);
-               t.getWin().tb_remove();
-       },
-
-       getSettings : function() {
-               var I = this.I, s = '';
-
-               if ( I('linkto-file').checked ) {
-                       s += ' link="file"';
-                       setUserSetting('galfile', '1');
-               }
-
-               if ( I('order-desc').checked ) {
-                       s += ' order="DESC"';
-                       setUserSetting('galdesc', '1');
-               }
-
-               if ( I('columns').value != 3 ) {
-                       s += ' columns="'+I('columns').value+'"';
-                       setUserSetting('galcols', I('columns').value);
-               }
-
-               if ( I('orderby').value != 'menu_order' ) {
-                       s += ' orderby="'+I('orderby').value+'"';
-                       setUserSetting('galord', I('orderby').value);
-               }
-
-               return s;
-       }
-};
+jQuery(document).ready(function(c){var b,e,a,d=false;e=function(){b=c("#media-items").sortable({items:".media-item",placeholder:"sorthelper",axis:"y",distance:2,stop:function(i,h){var g=c("#media-items").sortable("toArray"),f=g.length;c.each(g,function(k,l){var j=d?(f-k):(1+k);c("#"+l+" .menu_order input").val(j)})}})};sortIt=function(){var g=c(".menu_order_input"),f=g.length;g.each(function(j){var h=d?(f-j):(1+j);c(this).val(h)})};clearAll=function(f){f=f||0;c(".menu_order_input").each(function(){if(this.value=="0"||f){this.value=""}})};c("#asc").click(function(){d=false;sortIt();return false});c("#desc").click(function(){d=true;sortIt();return false});c("#clear").click(function(){clearAll(1);return false});c("#showall").click(function(){c("#sort-buttons span a").toggle();c("a.describe-toggle-on").hide();c("a.describe-toggle-off, table.slidetoggle").show();return false});c("#hideall").click(function(){c("#sort-buttons span a").toggle();c("a.describe-toggle-on").show();c("a.describe-toggle-off, table.slidetoggle").hide();return false});e();clearAll();if(c("#media-items>*").length>1){a=wpgallery.getWin();c("#save-all, #gallery-settings").show();if(typeof a.tinyMCE!="undefined"&&a.tinyMCE.activeEditor&&!a.tinyMCE.activeEditor.isHidden()){wpgallery.mcemode=true;wpgallery.init()}else{c("#insert-gallery").show()}}});jQuery(window).unload(function(){tinymce=tinyMCE=wpgallery=null});var tinymce=null,tinyMCE,wpgallery;wpgallery={mcemode:false,editor:{},dom:{},is_update:false,el:{},I:function(a){return document.getElementById(a)},init:function(){var d=this,a,f,c,e,b=d.getWin();if(!d.mcemode){return}a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.setup()},getWin:function(){return window.dialogArguments||opener||parent||top},restoreSelection:function(){var a=this;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},setup:function(){var f=this,c,d=f.editor,i,e,h,b,j;if(!f.mcemode){return}f.restoreSelection();f.el=d.selection.getNode();if(f.el.nodeName!="IMG"||!d.dom.hasClass(f.el,"wpGallery")){if((i=d.dom.select("img.wpGallery"))&&i[0]){f.el=i[0]}else{if(getUserSetting("galfile")=="1"){f.I("linkto-file").checked="checked"}if(getUserSetting("galdesc")=="1"){f.I("order-desc").checked="checked"}if(getUserSetting("galcols")){f.I("columns").value=getUserSetting("galcols")}if(getUserSetting("galord")){f.I("orderby").value=getUserSetting("galord")}jQuery("#insert-gallery").show();return}}c=d.dom.getAttrib(f.el,"title");c=d.dom.decode(c);if(c){jQuery("#update-gallery").show();f.is_update=true;e=c.match(/columns=['"]([0-9]+)['"]/);h=c.match(/link=['"]([^'"]+)['"]/i);b=c.match(/order=['"]([^'"]+)['"]/i);j=c.match(/orderby=['"]([^'"]+)['"]/i);if(h&&h[1]){f.I("linkto-file").checked="checked"}if(b&&b[1]){f.I("order-desc").checked="checked"}if(e&&e[1]){f.I("columns").value=""+e[1]}if(j&&j[1]){f.I("orderby").value=j[1]}}else{jQuery("#insert-gallery").show()}},update:function(){var b=this,a=b.editor,d="",c;if(!b.mcemode||!b.is_update){c="[gallery"+b.getSettings()+"]";b.getWin().send_to_editor(c);return}if(b.el.nodeName!="IMG"){return}d=a.dom.decode(a.dom.getAttrib(b.el,"title"));d=d.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi,"");d+=b.getSettings();a.dom.setAttrib(b.el,"title",d);b.getWin().tb_remove()},getSettings:function(){var a=this.I,b="";if(a("linkto-file").checked){b+=' link="file"';setUserSetting("galfile","1")}if(a("order-desc").checked){b+=' order="DESC"';setUserSetting("galdesc","1")}if(a("columns").value!=3){b+=' columns="'+a("columns").value+'"';setUserSetting("galcols",a("columns").value)}if(a("orderby").value!="menu_order"){b+=' orderby="'+a("orderby").value+'"';setUserSetting("galord",a("orderby").value)}return b}};
\ No newline at end of file
diff --git a/wp-admin/js/inline-edit-post.dev.js b/wp-admin/js/inline-edit-post.dev.js
new file mode 100644 (file)
index 0000000..ecc93b6
--- /dev/null
@@ -0,0 +1,268 @@
+
+(function($) {
+inlineEditPost = {
+
+       init : function() {
+               var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
+
+               t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
+               t.what = '#'+t.type+'-';
+
+               // get all editable rows
+               t.rows = $('tr.iedit');
+
+               // prepare the edit rows
+               qeRow.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); });
+               bulkRow.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); });
+
+               $('a.cancel', qeRow).click(function() { return inlineEditPost.revert(); });
+               $('a.save', qeRow).click(function() { return inlineEditPost.save(this); });
+               $('td', qeRow).keydown(function(e) { if ( e.which == 13 ) return inlineEditPost.save(this); });
+
+               $('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); });
+
+               $('#inline-edit .inline-edit-private input[value=private]').click( function(){
+                       var pw = $('input.inline-edit-password-input');
+                       if ( $(this).attr('checked') ) {
+                               pw.val('').attr('disabled', 'disabled');
+                       } else {
+                               pw.attr('disabled', '');
+                       }
+               });
+
+               // add events
+               t.addEvents(t.rows);
+
+               $('#bulk-title-div').parents('fieldset').after(
+                       $('#inline-edit fieldset.inline-edit-categories').clone()
+               ).siblings( 'fieldset:last' ).prepend(
+                       $('#inline-edit label.inline-edit-tags').clone()
+               );
+
+               // categories expandable?
+               $('span.catshow').click(function() {
+                       $('.inline-editor ul.cat-checklist').addClass("cat-hover");
+                       $('.inline-editor span.cathide').show();
+                       $(this).hide();
+               });
+
+               $('span.cathide').click(function() {
+                       $('.inline-editor ul.cat-checklist').removeClass("cat-hover");
+                       $('.inline-editor span.catshow').show();
+                       $(this).hide();
+               });
+
+               $('select[name="_status"] option[value="future"]', bulkRow).remove();
+
+               $('#doaction, #doaction2').click(function(e){
+                       var n = $(this).attr('id').substr(2);
+                       if ( $('select[name="'+n+'"]').val() == 'edit' ) {
+                               e.preventDefault();
+                               t.setBulk();
+                       } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
+                               t.revert();
+                       }
+               });
+
+               $('#post-query-submit').click(function(e){
+                       if ( $('form#posts-filter tr.inline-editor').length > 0 )
+                               t.revert();
+               });
+
+       },
+
+       toggle : function(el) {
+               var t = this;
+               $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
+       },
+
+       addEvents : function(r) {
+               r.each(function() {
+                       var row = $(this);
+                       $('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; });
+               });
+       },
+
+       setBulk : function() {
+               var te = '', type = this.type, tax;
+               this.revert();
+
+               $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length);
+               $('table.widefat tbody').prepend( $('#bulk-edit') );
+               $('#bulk-edit').addClass('inline-editor').show();
+
+               $('tbody th.check-column input[type="checkbox"]').each(function(i){
+                       if ( $(this).attr('checked') ) {
+                               var id = $(this).val(), theTitle;
+                               theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle;
+                               te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>';
+                       }
+               });
+
+               $('#bulk-titles').html(te);
+               $('#bulk-titles a').click(function() {
+                       var id = $(this).attr('id').substr(1);
+
+                       $('table.widefat input[value="'+id+'"]').attr('checked', '');
+                       $('#ttle'+id).remove();
+               });
+
+               // enable autocomplete for tags
+               if ( type == 'post' ) {
+                       // support multi taxonomies?
+                       tax = 'post_tag';
+                       $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
+               }
+       },
+
+       edit : function(id) {
+               var t = this, fields, editRow, rowData, cats, status, pageOpt, f, pageLevel, nextPage, pageLoop = true, nextLevel, tax;
+               t.revert();
+
+               if ( typeof(id) == 'object' )
+                       id = t.getId(id);
+
+               fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password'];
+               if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
+               if ( t.type == 'post' ) fields.push('tags_input');
+
+               // add the new blank row
+               editRow = $('#inline-edit').clone(true);
+               $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
+
+               if ( $(t.what+id).hasClass('alternate') )
+                       $(editRow).addClass('alternate');
+               $(t.what+id).hide().after(editRow);
+
+               // populate the data
+               rowData = $('#inline_'+id);
+               for ( f = 0; f < fields.length; f++ ) {
+                       $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() );
+               }
+
+               if ( $('.comment_status', rowData).text() == 'open' )
+                       $('input[name="comment_status"]', editRow).attr("checked", "checked");
+               if ( $('.ping_status', rowData).text() == 'open' )
+                       $('input[name="ping_status"]', editRow).attr("checked", "checked");
+               if ( $('.sticky', rowData).text() == 'sticky' )
+                       $('input[name="sticky"]', editRow).attr("checked", "checked");
+
+               // categories
+               if ( cats = $('.post_category', rowData).text() )
+                       $('ul.cat-checklist :checkbox', editRow).val(cats.split(','));
+
+               // handle the post status
+               status = $('._status', rowData).text();
+               if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove();
+               if ( status == 'private' ) {
+                       $('input[name="keep_private"]', editRow).attr("checked", "checked");
+                       $('input.inline-edit-password-input').val('').attr('disabled', 'disabled');
+               }
+
+               // remove the current page and children from the parent dropdown
+               pageOpt = $('select[name="post_parent"] option[value="'+id+'"]', editRow);
+               if ( pageOpt.length > 0 ) {
+                       pageLevel = pageOpt[0].className.split('-')[1];
+                       nextPage = pageOpt;
+                       while ( pageLoop ) {
+                               nextPage = nextPage.next('option');
+                               if (nextPage.length == 0) break;
+                               nextLevel = nextPage[0].className.split('-')[1];
+                               if ( nextLevel <= pageLevel ) {
+                                       pageLoop = false;
+                               } else {
+                                       nextPage.remove();
+                                       nextPage = pageOpt;
+                               }
+                       }
+                       pageOpt.remove();
+               }
+
+               $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
+               $('.ptitle', editRow).focus();
+
+               // enable autocomplete for tags
+               if ( t.type == 'post' ) {
+                       tax = 'post_tag';
+                       $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
+               }
+
+               return false;
+       },
+
+       save : function(id) {
+               var params, fields;
+
+               if( typeof(id) == 'object' )
+                       id = this.getId(id);
+
+               $('table.widefat .inline-edit-save .waiting').show();
+
+               params = {
+                       action: 'inline-save',
+                       post_type: this.type,
+                       post_ID: id,
+                       edit_date: 'true'
+               };
+
+               fields = $('#edit-'+id+' :input').fieldSerialize();
+               params = fields + '&' + $.param(params);
+
+               // make ajax request
+               $.post('admin-ajax.php', params,
+                       function(r) {
+                               $('table.widefat .inline-edit-save .waiting').hide();
+
+                               if (r) {
+                                       if ( -1 != r.indexOf('<tr') ) {
+                                               $(inlineEditPost.what+id).remove();
+                                               $('#edit-'+id).before(r).remove();
+
+                                               var row = $(inlineEditPost.what+id);
+                                               row.hide();
+
+                                               if ( 'draft' == $('input[name="post_status"]').val() )
+                                                       row.find('td.column-comments').hide();
+
+                                               inlineEditPost.addEvents(row);
+                                               row.fadeIn();
+                                       } else {
+                                               r = r.replace( /<.[^<>]*?>/g, '' );
+                                               $('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>');
+                                       }
+                               } else {
+                                       $('#edit-'+id+' .inline-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>');
+                               }
+                       }
+               , 'html');
+               return false;
+       },
+
+       revert : function() {
+               var id;
+
+               if ( id = $('table.widefat tr.inline-editor').attr('id') ) {
+                       $('table.widefat .inline-edit-save .waiting').hide();
+
+                       if ( 'bulk-edit' == id ) {
+                               $('table.widefat #bulk-edit').removeClass('inline-editor').hide();
+                               $('#bulk-titles').html('');
+                               $('#inlineedit').append( $('#bulk-edit') );
+                       } else  {
+                               $('#'+id).remove();
+                               id = id.substr( id.lastIndexOf('-') + 1 );
+                               $(this.what+id).show();
+                       }
+               }
+
+               return false;
+       },
+
+       getId : function(o) {
+               var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');
+               return parts[parts.length - 1];
+       }
+};
+
+$(document).ready(function(){inlineEditPost.init();});
+})(jQuery);
index bda63eb26550dae70995ef5b99b6e02e424e7c0d..f8c9bb3c58b9ef15c610c3b22bb0be89304a294f 100644 (file)
@@ -1,266 +1 @@
-
-(function($) {
-inlineEditPost = {
-
-       init : function() {
-               var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
-
-               t.type = $('table.widefat').hasClass('page') ? 'page' : 'post';
-               t.what = '#'+t.type+'-';
-
-               // get all editable rows
-               t.rows = $('tr.iedit');
-
-               // prepare the edit rows
-               qeRow.keyup(function(e) { if(e.which == 27) return inlineEditPost.revert(); });
-               bulkRow.keyup(function(e) { if (e.which == 27) return inlineEditPost.revert(); });
-
-               $('a.cancel', qeRow).click(function() { return inlineEditPost.revert(); });
-               $('a.save', qeRow).click(function() { return inlineEditPost.save(this); });
-               $('input, select', qeRow).keydown(function(e) { if(e.which == 13) return inlineEditPost.save(this); });
-
-               $('a.cancel', bulkRow).click(function() { return inlineEditPost.revert(); });
-
-               $('#inline-edit .inline-edit-private input[value=private]').click( function(){
-                       var pw = $('input.inline-edit-password-input');
-                       if ( $(this).attr('checked') ) {
-                               pw.val('').attr('disabled', 'disabled');
-                       } else {
-                               pw.attr('disabled', '');
-                       }
-               });
-
-               // add events
-               t.addEvents(t.rows);
-
-               $('#bulk-title-div').parents('fieldset').after(
-                       $('#inline-edit fieldset.inline-edit-categories').clone()
-               ).siblings( 'fieldset:last' ).prepend(
-//             ).siblings( 'fieldset:last' ).after( '<fieldset class="inline-edit-col-bottom"><div class="inline-edit-col"></div></fieldset>' );
-//             $('fieldset.inline-edit-col-bottom').prepend(
-                       $('#inline-edit label.inline-edit-tags').clone()
-               );
-
-               // categories expandable?
-               $('span.catshow').click(function() {
-                       $('.inline-editor ul.cat-checklist').addClass("cat-hover");
-                       $('.inline-editor span.cathide').show();
-                       $(this).hide();
-               });
-
-               $('span.cathide').click(function() {
-                       $('.inline-editor ul.cat-checklist').removeClass("cat-hover");
-                       $('.inline-editor span.catshow').show();
-                       $(this).hide();
-               });
-
-               $('select[name="_status"] option[value="future"]', bulkRow).remove();
-
-               $('#doaction, #doaction2').click(function(e){
-                       var n = $(this).attr('id').substr(2);
-                       if ( $('select[name="'+n+'"]').val() == 'edit' ) {
-                               e.preventDefault();
-                               t.setBulk();
-                       } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
-                               t.revert();
-                       }
-               });
-
-               $('#post-query-submit').click(function(e){
-                       if ( $('form#posts-filter tr.inline-editor').length > 0 )
-                               t.revert();
-               });
-
-       },
-
-       toggle : function(el) {
-               var t = this;
-
-               $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
-       },
-
-       addEvents : function(r) {
-               r.each(function() {
-                       var row = $(this);
-                       $('a.editinline', row).click(function() { inlineEditPost.edit(this); return false; });
-               });
-       },
-
-       setBulk : function() {
-               var te = '', c = '', type = this.type;
-               this.revert();
-
-               $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length);
-               $('table.widefat tbody').prepend( $('#bulk-edit') );
-               $('#bulk-edit').addClass('inline-editor').show();
-
-               $('tbody th.check-column input[type="checkbox"]').each(function(i){
-                       if ( $(this).attr('checked') ) {
-                               var id = $(this).val();
-                               var theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle;
-                               te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>';
-                       }
-               });
-
-               $('#bulk-titles').html(te);
-               $('#bulk-titles a').click(function() {
-                       var id = $(this).attr('id').substr(1), r = inlineEditPost.type+'-'+id;
-
-                       $('table.widefat input[value="'+id+'"]').attr('checked', '');
-                       $('#ttle'+id).remove();
-               });
-
-               // enable autocomplete for tags
-               if ( type == 'post' )
-                       $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
-       },
-
-       edit : function(id) {
-               var t = this;
-               t.revert();
-
-               if ( typeof(id) == 'object' )
-                       id = t.getId(id);
-
-               var fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password'];
-               if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
-               if ( t.type == 'post' ) fields.push('tags_input');
-
-               // add the new blank row
-               var editRow = $('#inline-edit').clone(true);
-               $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
-
-               if ( $(t.what+id).hasClass('alternate') )
-                       $(editRow).addClass('alternate');
-               $(t.what+id).hide().after(editRow);
-
-               // populate the data
-               var rowData = $('#inline_'+id);
-               for ( var f = 0; f < fields.length; f++ ) {
-                       $(':input[name="'+fields[f]+'"]', editRow).val( $('.'+fields[f], rowData).text() );
-               }
-
-               if ( $('.comment_status', rowData).text() == 'open' )
-                       $('input[name="comment_status"]', editRow).attr("checked", "checked");
-               if ( $('.ping_status', rowData).text() == 'open' )
-                       $('input[name="ping_status"]', editRow).attr("checked", "checked");
-               if ( $('.sticky', rowData).text() == 'sticky' )
-                       $('input[name="sticky"]', editRow).attr("checked", "checked");
-
-               // categories
-               var cats;
-               if ( cats = $('.post_category', rowData).text() )
-                       $('ul.cat-checklist :checkbox', editRow).val(cats.split(','));
-
-               // handle the post status
-               var status = $('._status', rowData).text();
-               if ( status != 'future' ) $('select[name="_status"] option[value="future"]', editRow).remove();
-               if ( status == 'private' ) {
-                       $('input[name="keep_private"]', editRow).attr("checked", "checked");
-                       $('input.inline-edit-password-input').val('').attr('disabled', 'disabled');
-               }
-
-               // remove the current page and children from the parent dropdown
-               var pageOpt = $('select[name="post_parent"] option[value="'+id+'"]', editRow);
-               if ( pageOpt.length > 0 ) {
-                       var pageLevel = pageOpt[0].className.split('-')[1], nextPage = pageOpt, pageLoop = true;
-                       while ( pageLoop ) {
-                               var nextPage = nextPage.next('option');
-                               if (nextPage.length == 0) break;
-                               var nextLevel = nextPage[0].className.split('-')[1];
-                               if ( nextLevel <= pageLevel ) {
-                                       pageLoop = false;
-                               } else {
-                                       nextPage.remove();
-                                       nextPage = pageOpt;
-                               }
-                       }
-                       pageOpt.remove();
-               }
-
-               $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
-               $('.ptitle', editRow).focus();
-
-               // enable autocomplete for tags
-               if ( t.type == 'post' )
-                       $('tr.inline-editor textarea[name="tags_input"]').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
-
-               return false;
-       },
-
-       save : function(id) {
-               if( typeof(id) == 'object' )
-                       id = this.getId(id);
-
-               $('table.widefat .inline-edit-save .waiting').show();
-
-               var params = {
-                       action: 'inline-save',
-                       post_type: this.type,
-                       post_ID: id,
-                       edit_date: 'true'
-               };
-
-               var fields = $('#edit-'+id+' :input').fieldSerialize();
-               params = fields + '&' + $.param(params);
-
-               // make ajax request
-               $.post('admin-ajax.php', params,
-                       function(r) {
-                               $('table.widefat .inline-edit-save .waiting').hide();
-
-                               if (r) {
-                                       if ( -1 != r.indexOf('<tr') ) {
-                                               $(inlineEditPost.what+id).remove();
-                                               $('#edit-'+id).before(r).remove();
-
-                                               var row = $(inlineEditPost.what+id);
-                                               row.hide();
-
-                                               if ( 'draft' == $('input[name="post_status"]').val() )
-                                                       row.find('td.column-comments').hide();
-
-                                               row.find('.hide-if-no-js').removeClass('hide-if-no-js');
-                                               inlineEditPost.addEvents(row);
-                                               row.fadeIn();
-                                       } else {
-                                               r = r.replace( /<.[^<>]*?>/g, '' );
-                                               $('#edit-'+id+' .inline-edit-save').append('<span class="error">'+r+'</span>');
-                                       }
-                               } else {
-                                       $('#edit-'+id+' .inline-edit-save').append('<span class="error">'+inlineEditL10n.error+'</span>');
-                               }
-                       }
-               , 'html');
-               return false;
-       },
-
-       revert : function() {
-               var id;
-
-               if ( id = $('table.widefat tr.inline-editor').attr('id') ) {
-                       $('table.widefat .inline-edit-save .waiting').hide();
-
-                       if ( 'bulk-edit' == id ) {
-                               $('table.widefat #bulk-edit').removeClass('inline-editor').hide();
-                               $('#bulk-titles').html('');
-                               $('#inlineedit').append( $('#bulk-edit') );
-                       } else  {
-                               $('#'+id).remove();
-                               id = id.substr( id.lastIndexOf('-') + 1 );
-                               $(this.what+id).show();
-                       }
-               }
-
-               return false;
-       },
-
-       getId : function(o) {
-               var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id');
-               var parts = id.split('-');
-               return parts[parts.length - 1];
-       }
-};
-
-$(document).ready(function(){inlineEditPost.init();});
-})(jQuery);
+(function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("page")?"page":"post";c.what="#"+c.type+"-";c.rows=a("tr.iedit");d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("td",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a("#inline-edit .inline-edit-private input[value=private]").click(function(){var e=a("input.inline-edit-password-input");if(a(this).attr("checked")){e.val("").attr("disabled","disabled")}else{e.attr("disabled","")}});c.addEvents(c.rows);a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(".inline-editor ul.cat-checklist").addClass("cat-hover");a(".inline-editor span.cathide").show();a(this).hide()});a("span.cathide").click(function(){a(".inline-editor ul.cat-checklist").removeClass("cat-hover");a(".inline-editor span.catshow").show();a(this).hide()});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").click(function(f){if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){var c=a(this);a("a.editinline",c).click(function(){inlineEditPost.edit(this);return false})})},setBulk:function(){var d="",c=this.type,b;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(f){if(a(this).attr("checked")){var g=a(this).val(),e;e=a("#inline_"+g+" .post_title").text()||inlineEditL10n.notitle;d+='<div id="ttle'+g+'"><a id="_'+g+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+e+"</div>"}});a("#bulk-titles").html(d);a("#bulk-titles a").click(function(){var e=a(this).attr("id").substr(1);a('table.widefat input[value="'+e+'"]').attr("checked","");a("#ttle"+e).remove()});if(c=="post"){b="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:", "})}},edit:function(b){var o=this,j,d,g,n,i,h,k,m,l,c=true,p,e;o.revert();if(typeof(b)=="object"){b=o.getId(b)}j=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(o.type=="page"){j.push("post_parent","menu_order","page_template")}if(o.type=="post"){j.push("tags_input")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(o.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(o.what+b).hide().after(d);g=a("#inline_"+b);for(k=0;k<j.length;k++){a(':input[name="'+j[k]+'"]',d).val(a("."+j[k],g).text())}if(a(".comment_status",g).text()=="open"){a('input[name="comment_status"]',d).attr("checked","checked")}if(a(".ping_status",g).text()=="open"){a('input[name="ping_status"]',d).attr("checked","checked")}if(a(".sticky",g).text()=="sticky"){a('input[name="sticky"]',d).attr("checked","checked")}if(n=a(".post_category",g).text()){a("ul.cat-checklist :checkbox",d).val(n.split(","))}i=a("._status",g).text();if(i!="future"){a('select[name="_status"] option[value="future"]',d).remove()}if(i=="private"){a('input[name="keep_private"]',d).attr("checked","checked");a("input.inline-edit-password-input").val("").attr("disabled","disabled")}h=a('select[name="post_parent"] option[value="'+b+'"]',d);if(h.length>0){m=h[0].className.split("-")[1];l=h;while(c){l=l.next("option");if(l.length==0){break}p=l[0].className.split("-")[1];if(p<=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr("id","edit-"+b).addClass("inline-editor").show();a(".ptitle",d).focus();if(o.type=="post"){e="post_tag";a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search&tax="+e,{delay:500,minchars:2,multiple:true,multipleSep:", "})}return false},save:function(d){var c,b;if(typeof(d)=="object"){d=this.getId(d)}a("table.widefat .inline-edit-save .waiting").show();c={action:"inline-save",post_type:this.type,post_ID:d,edit_date:"true"};b=a("#edit-"+d+" :input").fieldSerialize();c=b+"&"+a.param(c);a.post("admin-ajax.php",c,function(e){a("table.widefat .inline-edit-save .waiting").hide();if(e){if(-1!=e.indexOf("<tr")){a(inlineEditPost.what+d).remove();a("#edit-"+d).before(e).remove();var f=a(inlineEditPost.what+d);f.hide();if("draft"==a('input[name="post_status"]').val()){f.find("td.column-comments").hide()}inlineEditPost.addEvents(f);f.fadeIn()}else{e=e.replace(/<.[^<>]*?>/g,"");a("#edit-"+d+" .inline-edit-save").append('<span class="error">'+e+"</span>")}}else{a("#edit-"+d+" .inline-edit-save").append('<span class="error">'+inlineEditL10n.error+"</span>")}},"html");return false},revert:function(){var b;if(b=a("table.widefat tr.inline-editor").attr("id")){a("table.widefat .inline-edit-save .waiting").hide();if("bulk-edit"==b){a("table.widefat #bulk-edit").removeClass("inline-editor").hide();a("#bulk-titles").html("");a("#inlineedit").append(a("#bulk-edit"))}else{a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/js/inline-edit-tax.dev.js b/wp-admin/js/inline-edit-tax.dev.js
new file mode 100644 (file)
index 0000000..91c85ff
--- /dev/null
@@ -0,0 +1,129 @@
+
+(function($) {
+inlineEditTax = {
+
+       init : function() {
+               var t = this, row = $('#inline-edit');
+
+               t.type = $('#the-list').attr('className').substr(5);
+               t.what = '#'+t.type+'-';
+
+               // get all editable rows
+               t.rows = $('tr.iedit');
+
+               // prepare the edit row
+               row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });
+
+               $('a.cancel', row).click(function() { return inlineEditTax.revert(); });
+               $('a.save', row).click(function() { return inlineEditTax.save(this); });
+               $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });
+
+               // add events
+               t.addEvents(t.rows);
+
+               $('#posts-filter input[type="submit"]').click(function(e){
+                       if ( $('form#posts-filter tr.inline-editor').length > 0 )
+                               t.revert();
+               });
+       },
+
+       toggle : function(el) {
+               var t = this;
+               $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
+       },
+
+       addEvents : function(r) {
+               r.each(function() {
+                       $(this).find('a.editinline').click(function() { inlineEditTax.edit(this); return false; });
+               });
+       },
+
+       edit : function(id) {
+               var t = this, editRow;
+               t.revert();
+
+               if ( typeof(id) == 'object' )
+                       id = t.getId(id);
+
+               editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
+               $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
+
+               if ( $(t.what+id).hasClass('alternate') )
+                       $(editRow).addClass('alternate');
+
+               $(t.what+id).hide().after(editRow);
+
+               $(':input[name="name"]', editRow).val( $('.name', rowData).text() );
+               $(':input[name="slug"]', editRow).val( $('.slug', rowData).text() );
+
+               $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
+               $('.ptitle', editRow).eq(0).focus();
+
+               return false;
+       },
+
+       save : function(id) {
+               var params, fields, tax = $('input[name="taxonomy"]').val() || '';
+
+               if( typeof(id) == 'object' )
+                       id = this.getId(id);
+
+               $('table.widefat .inline-edit-save .waiting').show();
+
+               params = {
+                       action: 'inline-save-tax',
+                       tax_type: this.type,
+                       tax_ID: id,
+                       taxonomy: tax
+               };
+
+               fields = $('#edit-'+id+' :input').fieldSerialize();
+               params = fields + '&' + $.param(params);
+
+               // make ajax request
+               $.post('admin-ajax.php', params,
+                       function(r) {
+                               var row, new_id;
+                               $('table.widefat .inline-edit-save .waiting').hide();
+
+                               if (r) {
+                                       if ( -1 != r.indexOf('<tr') ) {
+                                               $(inlineEditTax.what+id).remove();
+                                               new_id = $(r).attr('id');
+
+                                               $('#edit-'+id).before(r).remove();
+                                               row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id);
+                                               row.hide();
+
+                                               inlineEditTax.addEvents(row);
+                                               row.fadeIn();
+                                       } else
+                                               $('#edit-'+id+' .inline-edit-save .error').html(r).show();
+                               } else
+                                       $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
+                       }
+               );
+               return false;
+       },
+
+       revert : function() {
+               var id = $('table.widefat tr.inline-editor').attr('id');
+
+               if ( id ) {
+                       $('table.widefat .inline-edit-save .waiting').hide();
+                       $('#'+id).remove();
+                       id = id.substr( id.lastIndexOf('-') + 1 );
+                       $(this.what+id).show();
+               }
+
+               return false;
+       },
+
+       getId : function(o) {
+               var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');
+               return parts[parts.length - 1];
+       }
+};
+
+$(document).ready(function(){inlineEditTax.init();});
+})(jQuery);
index d5539cc2b2184e98814a678bd685d29c45700d79..9953442c1af31c854b0cb46c1068c00ff1bdf242 100644 (file)
@@ -1,152 +1 @@
-
-(function($) {
-inlineEditTax = {
-
-       init : function() {
-               var t = this, row = $('#inline-edit');
-
-               t.type = $('#the-list').attr('className').substr(5);
-               t.what = '#'+t.type+'-';
-
-               // get all editable rows
-               t.rows = $('tr.iedit');
-
-               // prepare the edit row
-               row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); });
-
-               $('a.cancel', row).click(function() { return inlineEditTax.revert(); });
-               $('a.save', row).click(function() { return inlineEditTax.save(this); });
-               $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });
-
-               // add events
-               t.addEvents(t.rows);
-
-               $('#posts-filter input[type="submit"]').click(function(e){
-                       if ( $('form#posts-filter tr.inline-editor').length > 0 )
-                               t.revert();
-               });
-       },
-
-       toggle : function(el) {
-               var t = this;
-
-               $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
-       },
-
-       addEvents : function(r) {
-               r.each(function() {
-                       $(this).find('a.editinline').click(function() { inlineEditTax.edit(this); return false; });
-                       $(this).find('.hide-if-no-js').removeClass('hide-if-no-js');
-               });
-       },
-
-       edit : function(id) {
-               var t = this;
-               t.revert();
-
-               if ( typeof(id) == 'object' )
-                       id = t.getId(id);
-
-               var editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
-               $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
-
-               if ( $(t.what+id).hasClass('alternate') )
-                       $(editRow).addClass('alternate');
-
-               $(t.what+id).hide().after(editRow);
-
-               $(':input[name="name"]', editRow).val( $('.name', rowData).text() );
-               $(':input[name="slug"]', editRow).val( $('.slug', rowData).text() );
-
-               // cat parents
-               var cat_parent = $('.cat_parent', rowData).text();
-               if ( cat_parent != '0' )
-                       $('select[name="parent"]', editRow).val(cat_parent);
-
-               // remove the current parent and children from the parent dropdown
-               var pageOpt = $('select[name="parent"] option[value="'+id+'"]', editRow);
-               if ( pageOpt.length > 0 ) {
-                       var pageLevel = pageOpt[0].className.split('-')[1], nextPage = pageOpt, pageLoop = true;
-                       while ( pageLoop ) {
-                               var nextPage = nextPage.next('option');
-                               if (nextPage.length == 0) break;
-                               var nextLevel = nextPage[0].className.split('-')[1];
-                               if ( nextLevel <= pageLevel ) {
-                                       pageLoop = false;
-                               } else {
-                                       nextPage.remove();
-                                       nextPage = pageOpt;
-                               }
-                       }
-                       pageOpt.remove();
-               }
-
-               $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
-               $('.ptitle', editRow).eq(0).focus();
-
-               return false;
-       },
-
-       save : function(id) {
-               if( typeof(id) == 'object' )
-                       id = this.getId(id);
-
-               $('table.widefat .inline-edit-save .waiting').show();
-
-               var params = {
-                       action: 'inline-save-tax',
-                       tax_type: this.type,
-                       tax_ID: id
-               };
-
-               var fields = $('#edit-'+id+' :input').fieldSerialize();
-               params = fields + '&' + $.param(params);
-
-               // make ajax request
-               $.post('admin-ajax.php', params,
-                       function(r) {
-
-                               $('table.widefat .inline-edit-save .waiting').hide();
-
-                               if (r) {
-                                       if ( -1 != r.indexOf('<tr') ) {
-                                               $(inlineEditTax.what+id).remove();
-                                               $('#edit-'+id).before(r).remove();
-
-                                               var row = $(inlineEditTax.what+id);
-                                               row.hide();
-
-                                               row.find('.hide-if-no-js').removeClass('hide-if-no-js');
-                                               inlineEditTax.addEvents(row);
-                                               row.fadeIn();
-                                       } else
-                                               $('#edit-'+id+' .inline-edit-save .error').html(r).show();
-                               } else
-                                       $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
-                       }
-               );
-               return false;
-       },
-
-       revert : function() {
-               var id = $('table.widefat tr.inline-editor').attr('id');
-
-               if ( id ) {
-                       $('table.widefat .inline-edit-save .waiting').hide();
-                       $('#'+id).remove();
-                       id = id.substr( id.lastIndexOf('-') + 1 );
-                       $(this.what+id).show();
-               }
-
-               return false;
-       },
-
-       getId : function(o) {
-               var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id');
-               var parts = id.split('-');
-               return parts[parts.length - 1];
-       }
-};
-
-$(document).ready(function(){inlineEditTax.init();});
-})(jQuery);
+(function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("className").substr(5);b.what="#"+b.type+"-";b.rows=a("tr.iedit");c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});b.addEvents(b.rows);a('#posts-filter input[type="submit"]').click(function(d){if(a("form#posts-filter tr.inline-editor").length>0){b.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){a(this).find("a.editinline").click(function(){inlineEditTax.edit(this);return false})})},edit:function(d){var c=this,b;c.revert();if(typeof(d)=="object"){d=c.getId(d)}b=a("#inline-edit").clone(true),rowData=a("#inline_"+d);a("td",b).attr("colspan",a(".widefat:first thead th:visible").length);if(a(c.what+d).hasClass("alternate")){a(b).addClass("alternate")}a(c.what+d).hide().after(b);a(':input[name="name"]',b).val(a(".name",rowData).text());a(':input[name="slug"]',b).val(a(".slug",rowData).text());a(b).attr("id","edit-"+d).addClass("inline-editor").show();a(".ptitle",b).eq(0).focus();return false},save:function(e){var d,b,c=a('input[name="taxonomy"]').val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save-tax",tax_type:this.type,tax_ID:e,taxonomy:c};b=a("#edit-"+e+" :input").fieldSerialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(g){var h,f;a("table.widefat .inline-edit-save .waiting").hide();if(g){if(-1!=g.indexOf("<tr")){a(inlineEditTax.what+e).remove();f=a(g).attr("id");a("#edit-"+e).before(g).remove();h=f?a("#"+f):a(inlineEditTax.what+e);h.hide();inlineEditTax.addEvents(h);h.fadeIn()}else{a("#edit-"+e+" .inline-edit-save .error").html(g).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditTax.init()})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/js/link.dev.js b/wp-admin/js/link.dev.js
new file mode 100644 (file)
index 0000000..e963db9
--- /dev/null
@@ -0,0 +1,66 @@
+jQuery(document).ready( function($) {
+
+       var newCat, noSyncChecks = false, syncChecks, catAddAfter;
+
+       $('#link_name').focus();
+       // postboxes
+       postboxes.add_postbox_toggles('link');
+
+       // category tabs
+       $('#category-tabs a').click(function(){
+               var t = $(this).attr('href');
+               $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
+               $('.tabs-panel').hide();
+               $(t).show();
+               if ( '#categories-all' == t )
+                       deleteUserSetting('cats');
+               else
+                       setUserSetting('cats','pop');
+               return false;
+       });
+       if ( getUserSetting('cats') )
+               $('#category-tabs a[href="#categories-pop"]').click();
+
+       // Ajax Cat
+       newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
+       $('#category-add-submit').click( function() { newCat.focus(); } );
+       syncChecks = function() {
+               if ( noSyncChecks )
+                       return;
+               noSyncChecks = true;
+               var th = $(this), c = th.is(':checked'), id = th.val().toString();
+               $('#in-link-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
+               noSyncChecks = false;
+       };
+
+       catAddAfter = function( r, s ) {
+               $(s.what + ' response_data', r).each( function() {
+                       var t = $($(this).text());
+                       t.find( 'label' ).each( function() {
+                               var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o;
+                               $('#' + id).change( syncChecks );
+                               o = $( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
+                       } );
+               } );
+       };
+
+       $('#categorychecklist').wpList( {
+               alt: '',
+               what: 'link-category',
+               response: 'category-ajax-response',
+               addAfter: catAddAfter
+       } );
+
+       $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');});
+       $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');});
+       if ( 'pop' == getUserSetting('cats') )
+               $('a[href="#categories-pop"]').click();
+
+       $('#category-add-toggle').click( function() {
+               $(this).parents('div:first').toggleClass( 'wp-hidden-children' );
+               $('#category-tabs a[href="#categories-all"]').click();
+               return false;
+       } );
+
+       $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
+});
index 716b34452ad192598b47a86edd142a0613c82e52..db140c6b7835067c937194b839fb92e6ce5b7f0b 100644 (file)
@@ -1,57 +1 @@
-jQuery(document).ready( function($) {
-       // close postboxes that should be closed
-       jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
-
-       jQuery('#link_name').focus();
-       // postboxes
-       postboxes.add_postbox_toggles('link');
-
-       // category tabs
-       var categoryTabs = jQuery('#category-tabs').tabs();
-
-       // Ajax Cat
-       var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
-       jQuery('#category-add-submit').click( function() { newCat.focus(); } );
-       var noSyncChecks = false; // prophylactic. necessary?
-       var syncChecks = function() {
-               if ( noSyncChecks )
-                       return;
-               noSyncChecks = true;
-               var th = jQuery(this);
-               var c = th.is(':checked');
-               var id = th.val().toString();
-               jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
-               noSyncChecks = false;
-       };
-       var catAddAfter = function( r, s ) {
-               jQuery(s.what + ' response_data', r).each( function() {
-                       var t = jQuery(jQuery(this).text());
-                       t.find( 'label' ).each( function() {
-                               var th = jQuery(this);
-                               var val = th.find('input').val();
-                               var id = th.find('input')[0].id
-                               jQuery('#' + id).change( syncChecks );
-                               var name = jQuery.trim( th.text() );
-                               var o = jQuery( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
-                       } );
-               } );
-       };
-       jQuery('#categorychecklist').wpList( {
-               alt: '',
-               what: 'link-category',
-               response: 'category-ajax-response',
-               addAfter: catAddAfter
-       } );
-
-       $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');});
-       $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');});
-       if ( 'pop' == getUserSetting('cats') )
-               $('a[href="#categories-pop"]').click();
-
-       jQuery('#category-add-toggle').click( function() {
-               jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
-               categoryTabs.tabsClick( 1 );
-               return false;
-       } );
-       jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
-});
+jQuery(document).ready(function(c){var b,a=false,d,e;c("#link_name").focus();postboxes.add_postbox_toggles("link");c("#category-tabs a").click(function(){var f=c(this).attr("href");c(this).parent().addClass("tabs").siblings("li").removeClass("tabs");c(".tabs-panel").hide();c(f).show();if("#categories-all"==f){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){c('#category-tabs a[href="#categories-pop"]').click()}b=c("#newcat").one("focus",function(){c(this).val("").removeClass("form-input-tip")});c("#category-add-submit").click(function(){b.focus()});d=function(){if(a){return}a=true;var f=c(this),h=f.is(":checked"),g=f.val().toString();c("#in-link-category-"+g+", #in-popular-category-"+g).attr("checked",h);a=false};e=function(g,f){c(f.what+" response_data",g).each(function(){var h=c(c(this).text());h.find("label").each(function(){var j=c(this),l=j.find("input").val(),m=j.find("input")[0].id,i=c.trim(j.text()),k;c("#"+m).change(d);k=c('<option value="'+parseInt(l,10)+'"></option>').text(i)})})};c("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e});c('a[href="#categories-all"]').click(function(){deleteUserSetting("cats")});c('a[href="#categories-pop"]').click(function(){setUserSetting("cats","pop")});if("pop"==getUserSetting("cats")){c('a[href="#categories-pop"]').click()}c("#category-add-toggle").click(function(){c(this).parents("div:first").toggleClass("wp-hidden-children");c('#category-tabs a[href="#categories-all"]').click();return false});c(".categorychecklist :checkbox").change(d).filter(":checked").change()});
\ No newline at end of file
diff --git a/wp-admin/js/media-upload.dev.js b/wp-admin/js/media-upload.dev.js
new file mode 100644 (file)
index 0000000..e2c00ae
--- /dev/null
@@ -0,0 +1,63 @@
+// send html to the post editor
+function send_to_editor(h) {
+       var ed;
+
+       if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
+               ed.focus();
+               if (tinymce.isIE)
+                       ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
+
+               if ( h.indexOf('[caption') === 0 ) {
+                       if ( ed.plugins.wpeditimage )
+                               h = ed.plugins.wpeditimage._do_shcode(h);
+               } else if ( h.indexOf('[gallery') === 0 ) {
+                       if ( ed.plugins.wpgallery )
+                               h = ed.plugins.wpgallery._do_gallery(h);
+               }
+
+               ed.execCommand('mceInsertContent', false, h);
+
+       } else if ( typeof edInsertContent == 'function' ) {
+               edInsertContent(edCanvas, h);
+       } else {
+               jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
+       }
+
+       tb_remove();
+}
+
+// thickbox settings
+var tb_position;
+(function($) {
+       tb_position = function() {
+               var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width;
+
+               if ( tbWindow.size() ) {
+                       tbWindow.width( W - 50 ).height( H - 45 );
+                       $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
+                       tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
+                       if ( typeof document.body.style.maxWidth != 'undefined' )
+                               tbWindow.css({'top':'20px','margin-top':'0'});
+               };
+
+               return $('a.thickbox').each( function() {
+                       var href = $(this).attr('href');
+                       if ( ! href ) return;
+                       href = href.replace(/&width=[0-9]+/g, '');
+                       href = href.replace(/&height=[0-9]+/g, '');
+                       $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
+               });
+       };
+
+       $(window).resize(function(){ tb_position(); });
+
+})(jQuery);
+
+jQuery(document).ready(function($){
+       $('a.thickbox').click(function(){
+               if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) {
+                       tinyMCE.get('content').focus();
+                       tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
+               }
+       });
+});
index beb8c96b7de223f626ba5c8a62ae34845a3fa43e..741220312a78f3b790cbc8b0bfd740e3c451eb0e 100644 (file)
@@ -1,62 +1 @@
-// send html to the post editor
-function send_to_editor(h) {
-       if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
-               ed.focus();
-               if (tinymce.isIE)
-                       ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
-
-               if ( h.indexOf('[caption') === 0 ) {
-                       if ( ed.plugins.wpeditimage )
-                               h = ed.plugins.wpeditimage._do_shcode(h);
-               } else if ( h.indexOf('[gallery') === 0 ) {
-                       if ( ed.plugins.wpgallery )
-                               h = ed.plugins.wpgallery._do_gallery(h);
-               }
-
-               ed.execCommand('mceInsertContent', false, h);
-
-       } else if ( typeof edInsertContent == 'function' ) {
-               edInsertContent(edCanvas, h);
-       } else {
-               jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
-       }
-
-       tb_remove();
-}
-
-// thickbox settings
-jQuery(function($) {
-       tb_position = function() {
-               var tbWindow = $('#TB_window');
-               var width = $(window).width();
-               var H = $(window).height();
-               var W = ( 720 < width ) ? 720 : width;
-
-               if ( tbWindow.size() ) {
-                       tbWindow.width( W - 50 ).height( H - 45 );
-                       $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
-                       tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
-                       if ( typeof document.body.style.maxWidth != 'undefined' )
-                               tbWindow.css({'top':'20px','margin-top':'0'});
-                       $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
-               };
-
-               return $('a.thickbox').each( function() {
-                       var href = $(this).attr('href');
-                       if ( ! href ) return;
-                       href = href.replace(/&width=[0-9]+/g, '');
-                       href = href.replace(/&height=[0-9]+/g, '');
-                       $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
-               });
-       };
-
-       jQuery('a.thickbox').click(function(){
-               if ( typeof tinyMCE != 'undefined' &&  tinyMCE.activeEditor ) {
-                       tinyMCE.get('content').focus();
-                       tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
-               }
-       });
-
-       $(window).resize( function() { tb_position() } );
-});
-
+function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){a.focus();if(tinymce.isIE){a.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}var tb_position;(function(a){tb_position=function(){var e=a("#TB_window"),d=a(window).width(),c=a(window).height(),b=(720<d)?720:d;if(e.size()){e.width(b-50).height(c-45);a("#TB_iframeContent").width(b-50).height(c-75);e.css({"margin-left":"-"+parseInt(((b-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){e.css({top:"20px","margin-top":"0"})}}return a("a.thickbox").each(function(){var f=a(this).attr("href");if(!f){return}f=f.replace(/&width=[0-9]+/g,"");f=f.replace(/&height=[0-9]+/g,"");a(this).attr("href",f+"&width="+(b-80)+"&height="+(c-85))})};a(window).resize(function(){tb_position()})})(jQuery);jQuery(document).ready(function(a){a("a.thickbox").click(function(){if(typeof tinyMCE!="undefined"&&tinyMCE.activeEditor){tinyMCE.get("content").focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark("simple")}})});
\ No newline at end of file
diff --git a/wp-admin/js/media.dev.js b/wp-admin/js/media.dev.js
new file mode 100644 (file)
index 0000000..2d6553f
--- /dev/null
@@ -0,0 +1,90 @@
+
+var findPosts;
+(function($){
+       findPosts = {
+               open : function(af_name, af_val) {
+                       var st = document.documentElement.scrollTop || $(document).scrollTop();
+
+                       if ( af_name && af_val ) {
+                               $('#affected').attr('name', af_name).val(af_val);
+                       }
+                       $('#find-posts').show().draggable({
+                               handle: '#find-posts-head'
+                       }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-250px'});
+
+                       $('#find-posts-input').focus().keyup(function(e){
+                               if (e.which == 27) { findPosts.close(); } // close on Escape
+                       });
+
+                       return false;
+               },
+
+               close : function() {
+                       $('#find-posts-response').html('');
+                       $('#find-posts').draggable('destroy').hide();
+               },
+
+               send : function() {
+                       var post = {
+                               ps: $('#find-posts-input').val(),
+                               action: 'find_posts',
+                               _ajax_nonce: $('#_ajax_nonce').val()
+                       };
+
+                       if ( $('#find-posts-pages:checked').val() ) {
+                               post['pages'] = 1;
+                       } else {
+                               post['posts'] = 1;
+                       }
+                       $.ajax({
+                               type : 'POST',
+                               url : ajaxurl,
+                               data : post,
+                               success : function(x) { findPosts.show(x); },
+                               error : function(r) { findPosts.error(r); }
+                       });
+               },
+
+               show : function(x) {
+
+                       if ( typeof(x) == 'string' ) {
+                               this.error({'responseText': x});
+                               return;
+                       }
+
+                       var r = wpAjax.parseAjaxResponse(x);
+
+                       if ( r.errors ) {
+                               this.error({'responseText': wpAjax.broken});
+                       }
+                       r = r.responses[0];
+                       $('#find-posts-response').html(r.data);
+               },
+
+               error : function(r) {
+                       var er = r.statusText;
+
+                       if ( r.responseText ) {
+                               er = r.responseText.replace( /<.[^<>]*?>/g, '' );
+                       }
+                       if ( er ) {
+                               $('#find-posts-response').html(er);
+                       }
+               }
+       };
+
+       $(document).ready(function() {
+               $('#find-posts-submit').click(function(e) {
+                       if ( '' == $('#find-posts-response').html() )
+                               e.preventDefault();
+               });
+               $('#doaction, #doaction2').click(function(e){
+                       $('select[name^="action"]').each(function(){
+                               if ( $(this).val() == 'attach' ) {
+                                       e.preventDefault();
+                                       findPosts.open();
+                               }
+                       });
+               });
+       });
+})(jQuery);
diff --git a/wp-admin/js/media.js b/wp-admin/js/media.js
new file mode 100644 (file)
index 0000000..3f0962d
--- /dev/null
@@ -0,0 +1 @@
+var findPosts;(function(a){findPosts={open:function(d,c){var b=document.documentElement.scrollTop||a(document).scrollTop();if(d&&c){a("#affected").attr("name",d).val(c)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).css({top:b+50+"px",left:"50%",marginLeft:"-250px"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").hide()},send:function(){var b={ps:a("#find-posts-input").val(),action:"find_posts",_ajax_nonce:a("#_ajax_nonce").val()};if(a("#find-posts-pages:checked").val()){b.pages=1}else{b.posts=1}a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){findPosts.show(c)},error:function(c){findPosts.error(c)}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data)},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/js/page.dev.js b/wp-admin/js/page.dev.js
new file mode 100644 (file)
index 0000000..b28785a
--- /dev/null
@@ -0,0 +1,185 @@
+jQuery(document).ready( function($) {
+       postboxes.add_postbox_toggles('page');
+       make_slugedit_clickable();
+
+       $('#title').blur( function() { if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) ) return; autosave(); } );
+
+       var stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html();
+
+       function updateVisibility() {
+               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
+                       $('#sticky').attr('checked', false);
+                       $('#sticky-span').hide();
+               } else {
+                       $('#sticky-span').show();
+               }
+               if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
+                       $('#password-span').hide();
+               } else {
+                       $('#password-span').show();
+               }
+       }
+
+       function updateText() {
+               var attemptedDate, originalDate, currentDate, publishOn;
+
+               attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
+               originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
+               currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
+               if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
+                       publishOn = postL10n.publishOnFuture;
+                       $('#publish').val( postL10n.schedule );
+               } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
+                       publishOn = postL10n.publishOn;
+                       $('#publish').val( postL10n.publish );
+               } else {
+                       publishOn = postL10n.publishOnPast;
+                       $('#publish').val( postL10n.update );
+               }
+               if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
+                       $('#timestamp').html(stamp);
+               } else {
+                       $('#timestamp').html(
+                               publishOn + ' <b>' +
+                               $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
+                               $('#jj').val() + ', ' +
+                               $('#aa').val() + ' @ ' +
+                               $('#hh').val() + ':' +
+                               $('#mn').val() + '</b> '
+                       );
+               }
+
+               if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
+                       $('#publish').val( postL10n.update );
+                       if ( $('#post_status option[value=publish]').length == 0 ) {
+                               $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
+                       }
+                       $('#post_status option[value=publish]').html( postL10n.privatelyPublished );
+                       $('#post_status option[value=publish]').attr('selected', true);
+                       $('.edit-post-status').hide();
+               } else {
+                       if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
+                               if ( $('#post_status option[value=publish]').length != 0 ) {
+                                       $('#post_status option[value=publish]').remove();
+                                       $('#post_status').val($('#hidden_post_status').val());
+                               }
+                       } else {
+                               $('#post_status option[value=publish]').html( postL10n.published );
+                       }
+                       $('.edit-post-status').show();
+               }
+               $('#post-status-display').html($('#post_status :selected').text());
+               if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
+                       $('#save-post').hide();
+               } else {
+                       $('#save-post').show();
+                       if ( $('#post_status :selected').val() == 'pending' ) {
+                               $('#save-post').show().val( postL10n.savePending );
+                       } else {
+                               $('#save-post').show().val( postL10n.saveDraft );
+                       }
+               }
+       }
+
+       $('.edit-visibility').click(function () {
+               if ($('#post-visibility-select').is(":hidden")) {
+                       updateVisibility();
+                       $('#post-visibility-select').slideDown("normal");
+                       $('.edit-visibility').hide();
+               }
+               return false;
+       });
+
+       $('.cancel-post-visibility').click(function () {
+               $('#post-visibility-select').slideUp("normal");
+               $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
+               $('#post_password').val($('#hidden_post_password').val());
+               $('#post-visibility-display').html(visibility);
+               $('.edit-visibility').show();
+               updateText();
+               return false;
+       });
+
+       $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
+               $('#post-visibility-select').slideUp("normal");
+               $('.edit-visibility').show();
+               updateText();
+
+               $('#post-visibility-display').html(
+                       postL10n[$('#post-visibility-select input:radio:checked').val()]
+               );
+
+               return false;
+       });
+
+       $('#post-visibility-select input:radio').change(function() {
+               updateVisibility();
+       });
+
+       $('.edit-timestamp').click(function () {
+               if ($('#timestampdiv').is(":hidden")) {
+                       $('#timestampdiv').slideDown("normal");
+                       $('.edit-timestamp').hide();
+               }
+
+               return false;
+       });
+
+       $('.cancel-timestamp').click(function() {
+               $('#timestampdiv').slideUp("normal");
+               $('#mm').val($('#hidden_mm').val());
+               $('#jj').val($('#hidden_jj').val());
+               $('#aa').val($('#hidden_aa').val());
+               $('#hh').val($('#hidden_hh').val());
+               $('#mn').val($('#hidden_mn').val());
+               $('.edit-timestamp').show();
+
+               updateText();
+               return false;
+       });
+
+       $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
+               $('#timestampdiv').slideUp("normal");
+               $('.edit-timestamp').show();
+               updateText();
+
+               return false;
+       });
+
+       $('.edit-post-status').click(function() {
+               if ($('#post-status-select').is(":hidden")) {
+                       $('#post-status-select').slideDown("normal");
+                       $(this).hide();
+               }
+
+               return false;
+       });
+
+       $('.save-post-status').click(function() {
+               $('#post-status-select').slideUp("normal");
+               $('.edit-post-status').show();
+               updateText();
+               return false;
+       });
+
+       $('.cancel-post-status').click(function() {
+               $('#post-status-select').slideUp("normal");
+               $('#post_status').val($('#hidden_post_status').val());
+               $('.edit-post-status').show();
+
+               updateText();
+               return false;
+       });
+
+       // Custom Fields
+       $('#the-list').wpList( { addAfter: function( xml, s ) {
+               $('table#list-table').show();
+               if ( $.isFunction( autosave_update_post_ID ) ) {
+                       autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
+               }
+       }, addBefore: function( s ) {
+               s.data += '&post_id=' + $('#post_ID').val();
+               return s;
+       }
+       });
+});
index 943c1de96b44ed0c8d1ecef9889861b313abf09a..7d7dd9bfa29319acdf2b69de967a757f87df06b6 100644 (file)
@@ -1,202 +1 @@
-jQuery(document).ready( function($) {
-       postboxes.add_postbox_toggles('page');
-       make_slugedit_clickable();
-
-       // close postboxes that should be closed
-       jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
-
-       jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
-
-       var stamp = $('#timestamp').html();
-
-       var visibility = $('#post-visibility-display').html();
-
-       function updateVisibility() {
-               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
-                       $('#sticky').attr('checked', false);
-                       $('#sticky-span').hide();
-               } else {
-                       $('#sticky-span').show();
-               }
-               if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
-                       $('#password-span').hide();
-               } else {
-                       $('#password-span').show();
-               }
-       }
-
-       function updateText() {
-               var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
-               var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
-               var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
-               if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
-                       var publishOn = postL10n.publishOnFuture;
-                       $('#publish').val( postL10n.schedule );
-               } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
-                       var publishOn = postL10n.publishOn;
-                       $('#publish').val( postL10n.publish );
-               } else {
-                       var publishOn = postL10n.publishOnPast;
-                       $('#publish').val( postL10n.update );
-               }
-               if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
-                       $('#timestamp').html(stamp);
-               } else {
-                       $('#timestamp').html(
-                               publishOn + ' <b>' +
-                               $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
-                               $('#jj').val() + ', ' +
-                               $('#aa').val() + ' @ ' +
-                               $('#hh').val() + ':' +
-                               $('#mn').val() + '</b> '
-                       );
-               }
-
-               if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
-                       $('#publish').val( postL10n.update );
-                       if ( $('#post_status option[value=publish]').length == 0 ) {
-                               $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
-                       }
-                       $('#post_status option[value=publish]').html( postL10n.privatelyPublished );
-                       $('#post_status option[value=publish]').attr('selected', true);
-                       $('.edit-post-status').hide();
-               } else {
-                       if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
-                               if ( $('#post_status option[value=publish]').length != 0 ) {
-                                       $('#post_status option[value=publish]').remove();
-                                       $('#post_status').val($('#hidden_post_status').val());
-                               }
-                       } else {
-                               $('#post_status option[value=publish]').html( postL10n.published );
-                       }
-                       $('.edit-post-status').show();
-               }
-               $('#post-status-display').html($('#post_status :selected').text());
-               if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
-                       $('#save-post').hide();
-               } else {
-                       $('#save-post').show();
-                       if ( $('#post_status :selected').val() == 'pending' ) {
-                               $('#save-post').show().val( postL10n.savePending );
-                       } else {
-                               $('#save-post').show().val( postL10n.saveDraft );
-                       }
-               }
-       }
-
-       $('.edit-visibility').click(function () {
-               if ($('#post-visibility-select').is(":hidden")) {
-                       updateVisibility();
-                       $('#post-visibility-select').slideDown("normal");
-                       $('.edit-visibility').hide();
-               }
-               return false;
-       });
-
-       $('.cancel-post-visibility').click(function () {
-               $('#post-visibility-select').slideUp("normal");
-               $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
-               $('#post_password').val($('#hidden_post_password').val());
-               $('#post-visibility-display').html(visibility);
-               $('.edit-visibility').show();
-               updateText();
-               return false;
-       });
-
-       $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
-               $('#post-visibility-select').slideUp("normal");
-               $('.edit-visibility').show();
-               updateText();
-
-               $('#post-visibility-display').html(
-                       postL10n[$('#post-visibility-select input:radio:checked').val()]
-               );
-
-               return false;
-       });
-
-       $('#post-visibility-select input:radio').change(function() {
-               updateVisibility();
-       });
-
-       $('.edit-timestamp').click(function () {
-               if ($('#timestampdiv').is(":hidden")) {
-                       $('#timestampdiv').slideDown("normal");
-                       $('.edit-timestamp').hide();
-               }
-
-               return false;
-       });
-
-       $('.cancel-timestamp').click(function() {
-               $('#timestampdiv').slideUp("normal");
-               $('#mm').val($('#hidden_mm').val());
-               $('#jj').val($('#hidden_jj').val());
-               $('#aa').val($('#hidden_aa').val());
-               $('#hh').val($('#hidden_hh').val());
-               $('#mn').val($('#hidden_mn').val());
-               $('.edit-timestamp').show();
-
-               updateText();
-               return false;
-       });
-
-       $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
-               $('#timestampdiv').slideUp("normal");
-               $('.edit-timestamp').show();
-               updateText();
-
-               return false;
-       });
-
-       $('.edit-post-status').click(function() {
-               if ($('#post-status-select').is(":hidden")) {
-                       $('#post-status-select').slideDown("normal");
-                       $(this).hide();
-               }
-
-               return false;
-       });
-
-       $('.save-post-status').click(function() {
-               $('#post-status-select').slideUp("normal");
-               $('.edit-post-status').show();
-               updateText();
-               return false;
-       });
-
-       $('.cancel-post-status').click(function() {
-               $('#post-status-select').slideUp("normal");
-               $('#post_status').val($('#hidden_post_status').val());
-               $('.edit-post-status').show();
-
-               updateText();
-               return false;
-       });
-
-       // Custom Fields
-       jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
-               $('table#list-table').show();
-               if ( jQuery.isFunction( autosave_update_post_ID ) ) {
-                       autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
-               }
-       }, addBefore: function( s ) {
-               s.data += '&post_id=' + jQuery('#post_ID').val();
-               return s;
-       }
-       });
-
-       // preview
-       $('#post-preview').click(function(e){
-               if ( 1 > $('#post_ID').val() && autosaveFirst ) {
-                       autosaveDelayPreview = true;
-                       autosave();
-                       return false;
-               }
-
-               $('input#wp-preview').val('dopreview');
-               $('form#post').attr('target', 'wp-preview').submit().attr('target', '');
-               $('input#wp-preview').val('');
-               return false;
-       });
-});
+jQuery(document).ready(function(e){postboxes.add_postbox_toggles("page");make_slugedit_clickable();e("#title").blur(function(){if((e("#post_ID").val()>0)||(e("#title").val().length==0)){return}autosave()});var b=e("#timestamp").html(),a=e("#post-visibility-display").html();function d(){if(e("#post-visibility-select input:radio:checked").val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("#post-visibility-select input:radio:checked").val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var f,h,g,i;f=new Date(e("#aa").val(),e("#mm").val()-1,e("#jj").val(),e("#hh").val(),e("#mn").val());h=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());g=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(f>g&&e("#original_post_status").val()!="future"){i=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(f<=g&&e("#original_post_status").val()!="publish"){i=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{i=postL10n.publishOnPast;e("#publish").val(postL10n.update)}}if(h.toUTCString()==f.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(i+" <b>"+e("#mm option[value="+e("#mm").val()+"]").text()+" "+e("#jj").val()+", "+e("#aa").val()+" @ "+e("#hh").val()+":"+e("#mn").val()+"</b> ")}if(e("#post-visibility-select input:radio:checked").val()=="private"){e("#publish").val(postL10n.update);if(e("#post_status option[value=publish]").length==0){e("#post_status").append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}e("#post_status option[value=publish]").html(postL10n.privatelyPublished);e("#post_status option[value=publish]").attr("selected",true);e(".edit-post-status").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(e("#post_status option[value=publish]").length!=0){e("#post_status option[value=publish]").remove();e("#post_status").val(e("#hidden_post_status").val())}}else{e("#post_status option[value=publish]").html(postL10n.published)}e(".edit-post-status").show()}e("#post-status-display").html(e("#post_status :selected").text());if(e("#post_status :selected").val()=="private"||e("#post_status :selected").val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("#post_status :selected").val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}}e(".edit-visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(".edit-visibility").hide()}return false});e(".cancel-post-visibility").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#post-visibility-display").html(a);e(".edit-visibility").show();c();return false});e(".save-post-visibility").click(function(){e("#post-visibility-select").slideUp("normal");e(".edit-visibility").show();c();e("#post-visibility-display").html(postL10n[e("#post-visibility-select input:radio:checked").val()]);return false});e("#post-visibility-select input:radio").change(function(){d()});e(".edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(".edit-timestamp").hide()}return false});e(".cancel-timestamp").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e(".edit-timestamp").show();c();return false});e(".save-timestamp").click(function(){e("#timestampdiv").slideUp("normal");e(".edit-timestamp").show();c();return false});e(".edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status").click(function(){e("#post-status-select").slideUp("normal");e(".edit-post-status").show();c();return false});e(".cancel-post-status").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e(".edit-post-status").show();c();return false});e("#the-list").wpList({addAfter:function(f,g){e("table#list-table").show();if(e.isFunction(autosave_update_post_ID)){autosave_update_post_ID(g.parsed.responses[0].supplemental.postid)}},addBefore:function(f){f.data+="&post_id="+e("#post_ID").val();return f}})});
\ No newline at end of file
diff --git a/wp-admin/js/password-strength-meter.dev.js b/wp-admin/js/password-strength-meter.dev.js
new file mode 100644 (file)
index 0000000..0adb4ec
--- /dev/null
@@ -0,0 +1,21 @@
+// Password strength meter
+function passwordStrength(password,username) {
+    var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, symbolSize = 0, natLog, score;
+
+       //password < 4
+    if (password.length < 4 ) { return shortPass };
+
+    //password == username
+    if (password.toLowerCase()==username.toLowerCase()) return badPass;
+
+       if (password.match(/[0-9]/)) symbolSize +=10;
+       if (password.match(/[a-z]/)) symbolSize +=26;
+       if (password.match(/[A-Z]/)) symbolSize +=26;
+       if (password.match(/[^a-zA-Z0-9]/)) symbolSize +=31;
+
+       natLog = Math.log( Math.pow(symbolSize,password.length) );
+       score = natLog / Math.LN2;
+       if (score < 40 )  return badPass
+       if (score < 56 )  return goodPass
+    return strongPass;
+}
index 516a3e25110f269add2cca32fd907756eba1a023..f79937ec9b09111a0ab987ea876b76b002c1ce37 100644 (file)
@@ -1,23 +1 @@
-// Password strength meter
-
-function passwordStrength(password,username) {
-    var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4;
-
-       //password < 4
-    if (password.length < 4 ) { return shortPass };
-
-    //password == username
-    if (password.toLowerCase()==username.toLowerCase()) return badPass;
-
-       var symbolSize = 0;
-       if (password.match(/[0-9]/)) symbolSize +=10;
-       if (password.match(/[a-z]/)) symbolSize +=26;
-       if (password.match(/[A-Z]/)) symbolSize +=26;
-       if (password.match(/[^a-zA-Z0-9]/)) symbolSize +=31;
-
-       var natLog = Math.log( Math.pow(symbolSize,password.length) );
-       var score = natLog / Math.LN2;
-       if (score < 40 )  return badPass
-       if (score < 56 )  return goodPass
-    return strongPass;
-}
\ No newline at end of file
+function passwordStrength(i,f){var h=1,e=2,b=3,a=4,d=0,g,c;if(i.length<4){return h}if(i.toLowerCase()==f.toLowerCase()){return e}if(i.match(/[0-9]/)){d+=10}if(i.match(/[a-z]/)){d+=26}if(i.match(/[A-Z]/)){d+=26}if(i.match(/[^a-zA-Z0-9]/)){d+=31}g=Math.log(Math.pow(d,i.length));c=g/Math.LN2;if(c<40){return e}if(c<56){return b}return a};
\ No newline at end of file
diff --git a/wp-admin/js/plugin-install.dev.js b/wp-admin/js/plugin-install.dev.js
new file mode 100644 (file)
index 0000000..fabb1aa
--- /dev/null
@@ -0,0 +1,41 @@
+/* Plugin Browser Thickbox related JS*/
+jQuery(document).ready(function($) {
+       var thickDims = function() {
+               var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width;
+
+               if ( tbWindow.size() ) {
+                       tbWindow.width( W - 50 ).height( H - 45 );
+                       $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
+                       tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
+                       if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) )
+                               tbWindow.css({'top':'20px','margin-top':'0'});
+               };
+
+               return $('#dashboard_plugins a.thickbox, .plugins a.thickbox').each( function() {
+                       var href = $(this).attr('href');
+                       if ( ! href )
+                               return;
+                       href = href.replace(/&width=[0-9]+/g, '');
+                       href = href.replace(/&height=[0-9]+/g, '');
+                       $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
+               });
+       };
+
+       thickDims().click( function() {
+               $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
+               $('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).attr('title') );
+               return false;
+       });
+
+       /* Plugin install related JS*/
+       $('#plugin-information #sidemenu a').click( function() {
+               var tab = $(this).attr('name');
+               //Flip the tab
+               $('#plugin-information-header a.current').removeClass('current');
+               $(this).addClass('current');
+               //Flip the content.
+               $('#section-holder div.section').hide(); //Hide 'em all
+               $('#section-' + tab).show();
+               return false;
+       });
+});
index fb6be93200bf9fae74d262742418bfab0ff50caf..cbe0c5e26b596a40ed21cd7e8f8ae42757ec7c6a 100644 (file)
@@ -1,51 +1 @@
-/* Plugin Browser Thickbox related JS*/
-jQuery(function($) {
-       var thickDims = function() {
-               var tbWindow = $('#TB_window');
-               var width = $(window).width();
-               var H = $(window).height();
-               var W = ( 720 < width ) ? 720 : width;
-
-               if ( tbWindow.size() ) {
-                       tbWindow.width( W - 50 ).height( H - 45 );
-                       $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
-                       tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
-                       if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) )
-                               tbWindow.css({'top':'20px','margin-top':'0'});
-               };
-
-               return $('a.thickbox').each( function() {
-                       var href = $(this).attr('href');
-                       if ( ! href )
-                               return;
-                       href = href.replace(/&width=[0-9]+/g, '');
-                       href = href.replace(/&height=[0-9]+/g, '');
-                       $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
-               });
-       };
-
-       thickDims().click( function() {
-               $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
-               $('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).attr('title') );
-               return false;
-       });
-});
-
-/* Plugin install related JS*/
-jQuery(function($) {
-       $('#install-plugins tbody.plugins tr').click( function() {
-               $(this).find('.action-links a.onclick').click();
-               return false;
-       });
-
-       $('#plugin-information #sidemenu a').click( function() {
-               var tab = $(this).attr('name');
-               //Flip the tab
-               $('#plugin-information-header a.current').removeClass('current');
-               $(this).addClass('current');
-               //Flip the content.
-               $('#section-holder div.section').hide(); //Hide 'em all
-               $('#section-' + tab).show();
-               return false;
-       });
-});
\ No newline at end of file
+jQuery(document).ready(function(b){var a=function(){var f=b("#TB_window"),e=b(window).width(),d=b(window).height(),c=(720<e)?720:e;if(f.size()){f.width(c-50).height(d-45);b("#TB_iframeContent").width(c-50).height(d-75);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(!(b.browser.msie&&b.browser.version.substr(0,1)<7)){f.css({top:"20px","margin-top":"0"})}}return b("#dashboard_plugins a.thickbox, .plugins a.thickbox").each(function(){var g=b(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");b(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85))})};a().click(function(){b("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});b("#TB_ajaxWindowTitle").html("<strong>"+plugininstallL10n.plugin_information+"</strong>&nbsp;"+b(this).attr("title"));return false});b("#plugin-information #sidemenu a").click(function(){var c=b(this).attr("name");b("#plugin-information-header a.current").removeClass("current");b(this).addClass("current");b("#section-holder div.section").hide();b("#section-"+c).show();return false})});
\ No newline at end of file
diff --git a/wp-admin/js/post.dev.js b/wp-admin/js/post.dev.js
new file mode 100644 (file)
index 0000000..dcb12a4
--- /dev/null
@@ -0,0 +1,488 @@
+// return an array with any duplicate, whitespace or values removed
+function array_unique_noempty(a) {
+       var out = [];
+       jQuery.each( a, function(key, val) {
+               val = jQuery.trim(val);
+               if ( val && jQuery.inArray(val, out) == -1 )
+                       out.push(val);
+               } );
+       return out;
+}
+
+function new_tag_remove_tag() {
+       var id = jQuery( this ).attr( 'id' ), num = id.split('-check-num-')[1], taxbox = jQuery(this).parents('.tagsdiv'), current_tags = taxbox.find( '.the-tags' ).val().split(','), new_tags = [];
+       delete current_tags[num];
+
+       jQuery.each( current_tags, function(key, val) {
+               val = jQuery.trim(val);
+               if ( val ) {
+                       new_tags.push(val);
+               }
+       });
+
+       taxbox.find('.the-tags').val( new_tags.join(',').replace(/\s*,+\s*/, ',').replace(/,+/, ',').replace(/,+\s+,+/, ',').replace(/,+\s*$/, '').replace(/^\s*,+/, '') );
+
+       tag_update_quickclicks(taxbox);
+       return false;
+}
+
+function tag_update_quickclicks(taxbox) {
+       if ( jQuery(taxbox).find('.the-tags').length == 0 )
+               return;
+
+       var current_tags = jQuery(taxbox).find('.the-tags').val().split(',');
+       jQuery(taxbox).find('.tagchecklist').empty();
+       shown = false;
+
+       jQuery.each( current_tags, function( key, val ) {
+               var txt, button_id;
+
+               val = jQuery.trim(val);
+               if ( !val.match(/^\s+$/) && '' != val ) {
+                       button_id = jQuery(taxbox).attr('id') + '-check-num-' + key;
+                       txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
+                       jQuery(taxbox).find('.tagchecklist').append(txt);
+                       jQuery( '#' + button_id ).click( new_tag_remove_tag );
+               }
+       });
+       if ( shown )
+               jQuery(taxbox).find('.tagchecklist').prepend('<strong>'+postL10n.tagsUsed+'</strong><br />');
+}
+
+function tag_flush_to_text(id, a) {
+       a = a || false;
+       var taxbox, text, tags, newtags;
+
+       taxbox = jQuery('#'+id);
+       text = a ? jQuery(a).text() : taxbox.find('input.newtag').val();
+
+       // is the input box empty (i.e. showing the 'Add new tag' tip)?
+       if ( taxbox.find('input.newtag').hasClass('form-input-tip') && ! a )
+               return false;
+
+       tags = taxbox.find('.the-tags').val();
+       newtags = tags ? tags + ',' + text : text;
+
+       // massage
+       newtags = newtags.replace(/\s+,+\s*/g, ',').replace(/,+/g, ',').replace(/,+\s+,+/g, ',').replace(/,+\s*$/g, '').replace(/^\s*,+/g, '');
+       newtags = array_unique_noempty(newtags.split(',')).join(',');
+       taxbox.find('.the-tags').val(newtags);
+       tag_update_quickclicks(taxbox);
+
+       if ( ! a )
+               taxbox.find('input.newtag').val('').focus();
+
+       return false;
+}
+
+function tag_save_on_publish() {
+       jQuery('.tagsdiv').each( function(i) {
+               if ( !jQuery(this).find('input.newtag').hasClass('form-input-tip') )
+               tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id'));
+               } );
+}
+
+function tag_press_key( e ) {
+       if ( 13 == e.which ) {
+               tag_flush_to_text(jQuery(e.target).parents('.tagsdiv').attr('id'));
+               return false;
+       }
+};
+
+function tag_init() {
+
+       jQuery('.ajaxtag').show();
+    jQuery('.tagsdiv').each( function(i) {
+        tag_update_quickclicks(this);
+    } );
+
+    // add the quickadd form
+    jQuery('.ajaxtag input.tagadd').click(function(){tag_flush_to_text(jQuery(this).parents('.tagsdiv').attr('id'));});
+    jQuery('.ajaxtag input.newtag').focus(function() {
+        if ( !this.cleared ) {
+            this.cleared = true;
+            jQuery(this).val( '' ).removeClass( 'form-input-tip' );
+        }
+    });
+
+    jQuery('.ajaxtag input.newtag').blur(function() {
+        if ( this.value == '' ) {
+            this.cleared = false;
+            jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
+        }
+    });
+
+    // auto-save tags on post save/publish
+    jQuery('#publish').click( tag_save_on_publish );
+    jQuery('#save-post').click( tag_save_on_publish );
+
+    // catch the enter key
+    jQuery('.ajaxtag input.newtag').keypress( tag_press_key );
+}
+
+var commentsBox, tagCloud;
+(function($){
+
+       commentsBox = {
+               st : 0,
+
+               get : function(total, num) {
+                       var st = this.st, data;
+                       if ( ! num )
+                               num = 20;
+
+                       this.st += num;
+                       this.total = total;
+                       $('#commentsdiv img.waiting').show();
+
+                       data = {
+                               'action' : 'get-comments',
+                               'mode' : 'single',
+                               '_ajax_nonce' : $('#add_comment_nonce').val(),
+                               'post_ID' : $('#post_ID').val(),
+                               'start' : st,
+                               'num' : num
+                       };
+
+                       $.post(ajaxurl, data,
+                               function(r) {
+                                       r = wpAjax.parseAjaxResponse(r);
+                                       $('#commentsdiv .widefat').show();
+                                       $('#commentsdiv img.waiting').hide();
+
+                                       if ( 'object' == typeof r && r.responses[0] ) {
+                                               $('#the-comment-list').append( r.responses[0].data );
+
+                                               theList = theExtraList = null;
+                                               $("a[className*=':']").unbind();
+                                               setCommentsList();
+
+                                               if ( commentsBox.st > commentsBox.total )
+                                                       $('#show-comments').hide();
+                                               else
+                                                       $('#show-comments').html(postL10n.showcomm);
+                                               return;
+                                       } else if ( 1 == r ) {
+                                               $('#show-comments').parent().html(postL10n.endcomm);
+                                               return;
+                                       }
+
+                                       $('#the-comment-list').append('<tr><td colspan="5">'+wpAjax.broken+'</td></tr>');
+                               }
+                       );
+
+                       return false;
+               }
+       };
+
+       tagCloud = {
+               init : function() {
+                       $('.tagcloud-link').click(function(){
+                               tagCloud.get($(this).attr('id'));
+                               $(this).unbind().click(function(){
+                                       $(this).siblings('.the-tagcloud').toggle();
+                                       return false;
+                               });
+                               return false;
+                       });
+               },
+
+               get : function(id) {
+                       var tax = id.substr(id.indexOf('-')+1);
+
+                       $.post(ajaxurl, {'action':'get-tagcloud','tax':tax}, function(r, stat) {
+                               if ( 0 == r || 'success' != stat )
+                                       r = wpAjax.broken;
+
+                               r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>');
+                               $('a', r).click(function(){
+                                       var id = $(this).parents('p').attr('id');
+                                       tag_flush_to_text(id.substr(id.indexOf('-')+1), this);
+                                       return false;
+                               });
+
+                               $('#'+id).after(r);
+                       });
+               }
+       };
+
+       $(document).ready(function(){tagCloud.init();});
+})(jQuery);
+
+jQuery(document).ready( function($) {
+       var noSyncChecks = false, syncChecks, catAddAfter, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
+
+       // for Press This
+       if ( typeof autosave != 'function' )
+               autosave = function(){};
+
+       // postboxes
+       postboxes.add_postbox_toggles('post');
+
+       // Editable slugs
+       make_slugedit_clickable();
+
+       // prepare the tag UI
+       tag_init();
+
+       $('#title').blur( function() { if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) ) return; autosave(); } );
+
+       // auto-suggest stuff
+       $('.newtag').each(function(){
+               var tax = $(this).parents('div.tagsdiv').attr('id');
+               $(this).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
+       });
+
+       // category tabs
+       $('#category-tabs a').click(function(){
+               var t = $(this).attr('href');
+               $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
+               $('.tabs-panel').hide();
+               $(t).show();
+               if ( '#categories-all' == t )
+                       deleteUserSetting('cats');
+               else
+                       setUserSetting('cats','pop');
+               return false;
+       });
+       if ( getUserSetting('cats') )
+               $('#category-tabs a[href="#categories-pop"]').click();
+
+       // Ajax Cat
+       $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
+       $('#category-add-sumbit').click(function(){$('#newcat').focus();});
+
+       syncChecks = function() {
+               if ( noSyncChecks )
+                       return;
+               noSyncChecks = true;
+               var th = jQuery(this), c = th.is(':checked'), id = th.val().toString();
+               $('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
+               noSyncChecks = false;
+       };
+
+       popularCats = $('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
+       catAddBefore = function( s ) {
+               if ( !$('#newcat').val() )
+                       return false;
+               s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize();
+               return s;
+       };
+
+       catAddAfter = function( r, s ) {
+               var newCatParent = jQuery('#newcat_parent'), newCatParentOption = newCatParent.find( 'option[value="-1"]' );
+               $(s.what + ' response_data', r).each( function() {
+                       var t = $($(this).text());
+                       t.find( 'label' ).each( function() {
+                               var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name, o;
+                               $('#' + id).change( syncChecks ).change();
+                               if ( newCatParent.find( 'option[value="' + val + '"]' ).size() )
+                                       return;
+                               name = $.trim( th.text() );
+                               o = $( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
+                               newCatParent.prepend( o );
+                       } );
+                       newCatParentOption.attr( 'selected', 'selected' );
+               } );
+       };
+
+       $('#categorychecklist').wpList( {
+               alt: '',
+               response: 'category-ajax-response',
+               addBefore: catAddBefore,
+               addAfter: catAddAfter
+       } );
+
+       $('#category-add-toggle').click( function() {
+               $('#category-adder').toggleClass( 'wp-hidden-children' );
+               $('#category-tabs a[href="#categories-all"]').click();
+               return false;
+       } );
+
+       $('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(), sticky = '';
+
+       function updateVisibility() {
+               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
+                       $('#sticky').attr('checked', false);
+                       $('#sticky-span').hide();
+               } else {
+                       $('#sticky-span').show();
+               }
+               if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
+                       $('#password-span').hide();
+               } else {
+                       $('#password-span').show();
+               }
+       }
+
+       function updateText() {
+               var attemptedDate, originalDate, currentDate, publishOn;
+
+               attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
+               originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
+               currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
+               if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
+                       publishOn = postL10n.publishOnFuture;
+                       $('#publish').val( postL10n.schedule );
+               } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
+                       publishOn = postL10n.publishOn;
+                       $('#publish').val( postL10n.publish );
+               } else {
+                       publishOn = postL10n.publishOnPast;
+                       $('#publish').val( postL10n.update );
+               }
+               if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
+                       $('#timestamp').html(stamp);
+               } else {
+                       $('#timestamp').html(
+                               publishOn + ' <b>' +
+                               $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
+                               $('#jj').val() + ', ' +
+                               $('#aa').val() + ' @ ' +
+                               $('#hh').val() + ':' +
+                               $('#mn').val() + '</b> '
+                       );
+               }
+
+               if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
+                       $('#publish').val( postL10n.update );
+                       if ( $('#post_status option[value=publish]').length == 0 ) {
+                               $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
+                       }
+                       $('#post_status option[value=publish]').html( postL10n.privatelyPublished );
+                       $('#post_status option[value=publish]').attr('selected', true);
+                       $('.edit-post-status').hide();
+               } else {
+                       if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
+                               if ( $('#post_status option[value=publish]').length != 0 ) {
+                                       $('#post_status option[value=publish]').remove();
+                                       $('#post_status').val($('#hidden_post_status').val());
+                               }
+                       } else {
+                               $('#post_status option[value=publish]').html( postL10n.published );
+                       }
+                       $('.edit-post-status').show();
+               }
+               $('#post-status-display').html($('#post_status :selected').text());
+               if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
+                       $('#save-post').hide();
+               } else {
+                       $('#save-post').show();
+                       if ( $('#post_status :selected').val() == 'pending' ) {
+                               $('#save-post').show().val( postL10n.savePending );
+                       } else {
+                               $('#save-post').show().val( postL10n.saveDraft );
+                       }
+               }
+       }
+
+       $('.edit-visibility').click(function () {
+               if ($('#post-visibility-select').is(":hidden")) {
+                       updateVisibility();
+                       $('#post-visibility-select').slideDown("normal");
+                       $('.edit-visibility').hide();
+               }
+               return false;
+       });
+
+       $('.cancel-post-visibility').click(function () {
+               $('#post-visibility-select').slideUp("normal");
+               $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
+               $('#post_password').val($('#hidden_post_password').val());
+               $('#sticky').attr('checked', $('#hidden-post-sticky').attr('checked'));
+               $('#post-visibility-display').html(visibility);
+               $('.edit-visibility').show();
+               updateText();
+               return false;
+       });
+
+       $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
+               $('#post-visibility-select').slideUp("normal");
+               $('.edit-visibility').show();
+               updateText();
+               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
+                       $('#sticky').attr('checked', false);
+               }
+
+               if ( true == $('#sticky').attr('checked') ) {
+                       sticky = 'Sticky';
+               } else {
+                       sticky = '';
+               }
+
+               $('#post-visibility-display').html(
+                       postL10n[$('#post-visibility-select input:radio:checked').val() + sticky]
+               );
+
+               return false;
+       });
+
+       $('#post-visibility-select input:radio').change(function() {
+               updateVisibility();
+       });
+
+       $('.edit-timestamp').click(function () {
+               if ($('#timestampdiv').is(":hidden")) {
+                       $('#timestampdiv').slideDown("normal");
+                       $('.edit-timestamp').hide();
+               }
+
+               return false;
+       });
+
+       $('.cancel-timestamp').click(function() {
+               $('#timestampdiv').slideUp("normal");
+               $('#mm').val($('#hidden_mm').val());
+               $('#jj').val($('#hidden_jj').val());
+               $('#aa').val($('#hidden_aa').val());
+               $('#hh').val($('#hidden_hh').val());
+               $('#mn').val($('#hidden_mn').val());
+               $('.edit-timestamp').show();
+               updateText();
+               return false;
+       });
+
+       $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
+               $('#timestampdiv').slideUp("normal");
+               $('.edit-timestamp').show();
+               updateText();
+
+               return false;
+       });
+
+       $('.edit-post-status').click(function() {
+               if ($('#post-status-select').is(":hidden")) {
+                       $('#post-status-select').slideDown("normal");
+                       $(this).hide();
+               }
+
+               return false;
+       });
+
+       $('.save-post-status').click(function() {
+               $('#post-status-select').slideUp("normal");
+               $('.edit-post-status').show();
+               updateText();
+               return false;
+       });
+
+       $('.cancel-post-status').click(function() {
+               $('#post-status-select').slideUp("normal");
+               $('#post_status').val($('#hidden_post_status').val());
+               $('.edit-post-status').show();
+               updateText();
+               return false;
+       });
+
+       // Custom Fields
+       $('#the-list').wpList( { addAfter: function( xml, s ) {
+               $('table#list-table').show();
+               if ( $.isFunction( autosave_update_post_ID ) ) {
+                       autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
+               }
+       }, addBefore: function( s ) {
+               s.data += '&post_id=' + $('#post_ID').val();
+               return s;
+       }
+       });
+});
index eb9ae4372b25d882f6b28e0dfd717e0e57094a96..1d0f21e4f34266f7624762c1dacd26f651b0a224 100644 (file)
@@ -1,455 +1 @@
-// this file contains all the scripts used in the post/edit page
-
-function new_tag_remove_tag() {
-       var id = jQuery( this ).attr( 'id' );
-       var num = id.substr( 10 );
-       var current_tags = jQuery( '#tags-input' ).val().split(',');
-       delete current_tags[num];
-       var new_tags = [];
-       jQuery.each( current_tags, function( key, val ) {
-               if ( val && !val.match(/^\s+$/) && '' != val ) {
-                       new_tags = new_tags.concat( val );
-               }
-       });
-       jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
-       tag_update_quickclicks();
-       jQuery('#newtag').focus();
-       return false;
-}
-
-function tag_update_quickclicks() {
-       if ( jQuery( '#tags-input' ).length == 0 )
-               return;
-       var current_tags = jQuery( '#tags-input' ).val().split(',');
-       jQuery( '#tagchecklist' ).empty();
-       shown = false;
-//     jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique
-       jQuery.each( current_tags, function( key, val ) {
-               val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
-               if ( !val.match(/^\s+$/) && '' != val ) {
-                       txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
-                       jQuery( '#tagchecklist' ).append( txt );
-                       jQuery( '#tag-check-' + key ).click( new_tag_remove_tag );
-                       shown = true;
-               }
-       });
-       if ( shown )
-               jQuery( '#tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />' );
-}
-
-function tag_flush_to_text(e,a) {
-       a = a || false;
-       var text = a ? jQuery(a).text() : jQuery('#newtag').val();
-       var newtags = jQuery('#tags-input').val();
-
-       var t = text.replace( /\s*([^,]+).*/, '$1,' );
-       newtags += ','
-
-       if ( newtags.indexOf(t) != -1 )
-               return false;
-
-       newtags += text;
-
-       // massage
-       newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' );
-       jQuery('#tags-input').val( newtags );
-       tag_update_quickclicks();
-       if ( ! a ) {
-               jQuery('#newtag').val('');
-               jQuery('#newtag').focus();
-       }
-       return false;
-}
-
-function tag_save_on_publish() {
-       if ( jQuery('#newtag').val() != postL10n.addTag )
-               tag_flush_to_text();
-}
-
-function tag_press_key( e ) {
-       if ( 13 == e.keyCode ) {
-               tag_flush_to_text();
-               return false;
-       }
-};
-
-(function($){
-       tagCloud = {
-               init : function() {
-                       $('#tagcloud-link').click(function(){tagCloud.get(); $(this).unbind().click(function(){return false;}); return false;});
-               },
-
-               get : function() {
-                       $.post('admin-ajax.php', {'action':'get-tagcloud'}, function(r, stat) {
-                               if ( 0 == r || 'success' != stat )
-                                       r = wpAjax.broken;
-
-                               r = '<p id="the-tagcloud">'+r+'</p>';
-                               $('#tagcloud-link').after($(r));
-                               $('#the-tagcloud a').click(function(){
-                                       tag_flush_to_text(0,this);
-                                       return false;
-                               });
-                       });
-               }
-       }
-})(jQuery);
-
-jQuery(document).ready( function($) {
-       tagCloud.init();
-
-       // close postboxes that should be closed
-       jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
-
-       // postboxes
-       postboxes.add_postbox_toggles('post');
-
-       // Editable slugs
-       make_slugedit_clickable();
-
-       jQuery('#tags-input').hide();
-       tag_update_quickclicks();
-       // add the quickadd form
-       jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
-       jQuery('#tagadd').click( tag_flush_to_text );
-       jQuery('#newtag').focus(function() {
-               if ( this.value == postL10n.addTag )
-                       jQuery(this).val( '' ).removeClass( 'form-input-tip' );
-       });
-       jQuery('#newtag').blur(function() {
-               if ( this.value == '' )
-                       jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
-       });
-
-       // auto-save tags on post save/publish
-       jQuery('#publish').click( tag_save_on_publish );
-       jQuery('#save-post').click( tag_save_on_publish );
-
-       jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
-
-       // auto-suggest stuff
-       jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
-       jQuery('#newtag').keypress( tag_press_key );
-
-       // category tabs
-       var categoryTabs =jQuery('#category-tabs').tabs();
-
-       // Ajax Cat
-       var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
-       jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
-       var newCatParent = false;
-       var newCatParentOption = false;
-       var noSyncChecks = false; // prophylactic. necessary?
-       var syncChecks = function() {
-               if ( noSyncChecks )
-                       return;
-               noSyncChecks = true;
-               var th = jQuery(this);
-               var c = th.is(':checked');
-               var id = th.val().toString();
-               jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
-               noSyncChecks = false;
-       };
-       var popularCats = jQuery('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
-       var catAddBefore = function( s ) {
-               s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize();
-               return s;
-       };
-       var catAddAfter = function( r, s ) {
-               if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
-               if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
-               jQuery(s.what + ' response_data', r).each( function() {
-                       var t = jQuery(jQuery(this).text());
-                       t.find( 'label' ).each( function() {
-                               var th = jQuery(this);
-                               var val = th.find('input').val();
-                               var id = th.find('input')[0].id
-                               jQuery('#' + id).change( syncChecks ).change();
-                               if ( newCatParent.find( 'option[value=' + val + ']' ).size() )
-                                       return;
-                               var name = jQuery.trim( th.text() );
-                               var o = jQuery( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
-                               newCatParent.prepend( o );
-                       } );
-                       newCatParentOption.attr( 'selected', true );
-               } );
-       };
-       jQuery('#categorychecklist').wpList( {
-               alt: '',
-               response: 'category-ajax-response',
-               addBefore: catAddBefore,
-               addAfter: catAddAfter
-       } );
-       jQuery('#category-add-toggle').click( function() {
-               jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
-               // categoryTabs.tabs( 'select', '#categories-all' ); // this is broken (in the UI beta?)
-               categoryTabs.find( 'a[href="#categories-all"]' ).click();
-               jQuery('#newcat').focus();
-               return false;
-       } );
-
-       $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');});
-       $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');});
-       if ( 'pop' == getUserSetting('cats') )
-               $('a[href="#categories-pop"]').click();
-
-       jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
-       var stamp = $('#timestamp').html();
-       var visibility = $('#post-visibility-display').html();
-       var sticky = '';
-
-       function updateVisibility() {
-               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
-                       $('#sticky').attr('checked', false);
-                       $('#sticky-span').hide();
-               } else {
-                       $('#sticky-span').show();
-               }
-               if ( $('#post-visibility-select input:radio:checked').val() != 'password' ) {
-                       $('#password-span').hide();
-               } else {
-                       $('#password-span').show();
-               }
-       }
-
-       function updateText() {
-               var attemptedDate = new Date( $('#aa').val(), $('#mm').val() -1, $('#jj').val(), $('#hh').val(), $('#mn').val());
-               var originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val());
-               var currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val());
-               if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
-                       var publishOn = postL10n.publishOnFuture;
-                       $('#publish').val( postL10n.schedule );
-               } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
-                       var publishOn = postL10n.publishOn;
-                       $('#publish').val( postL10n.publish );
-               } else {
-                       var publishOn = postL10n.publishOnPast;
-                       $('#publish').val( postL10n.update );
-               }
-               if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
-                       $('#timestamp').html(stamp);
-               } else {
-                       $('#timestamp').html(
-                               publishOn + ' <b>' +
-                               $( '#mm option[value=' + $('#mm').val() + ']' ).text() + ' ' +
-                               $('#jj').val() + ', ' +
-                               $('#aa').val() + ' @ ' +
-                               $('#hh').val() + ':' +
-                               $('#mn').val() + '</b> '
-                       );
-               }
-
-               if ( $('#post-visibility-select input:radio:checked').val() == 'private' ) {
-                       $('#publish').val( postL10n.update );
-                       if ( $('#post_status option[value=publish]').length == 0 ) {
-                               $('#post_status').append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
-                       }
-                       $('#post_status option[value=publish]').html( postL10n.privatelyPublished );
-                       $('#post_status option[value=publish]').attr('selected', true);
-                       $('.edit-post-status').hide();
-               } else {
-                       if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
-                               if ( $('#post_status option[value=publish]').length != 0 ) {
-                                       $('#post_status option[value=publish]').remove();
-                                       $('#post_status').val($('#hidden_post_status').val());
-                               }
-                       } else {
-                               $('#post_status option[value=publish]').html( postL10n.published );
-                       }
-                       $('.edit-post-status').show();
-               }
-               $('#post-status-display').html($('#post_status :selected').text());
-               if ( $('#post_status :selected').val() == 'private' || $('#post_status :selected').val() == 'publish' ) {
-                       $('#save-post').hide();
-               } else {
-                       $('#save-post').show();
-                       if ( $('#post_status :selected').val() == 'pending' ) {
-                               $('#save-post').show().val( postL10n.savePending );
-                       } else {
-                               $('#save-post').show().val( postL10n.saveDraft );
-                       }
-               }
-       }
-
-       $('.edit-visibility').click(function () {
-               if ($('#post-visibility-select').is(":hidden")) {
-                       updateVisibility();
-                       $('#post-visibility-select').slideDown("normal");
-                       $('.edit-visibility').hide();
-               }
-               return false;
-       });
-
-       $('.cancel-post-visibility').click(function () {
-               $('#post-visibility-select').slideUp("normal");
-               $('#visibility-radio-' + $('#hidden-post-visibility').val()).attr('checked', true);
-               $('#post_password').val($('#hidden_post_password').val());
-               $('#sticky').attr('checked', $('#hidden-post-sticky').attr('checked'));
-               $('#post-visibility-display').html(visibility);
-               $('.edit-visibility').show();
-               updateText();
-               return false;
-       });
-
-       $('.save-post-visibility').click(function () { // crazyhorse - multiple ok cancels
-               $('#post-visibility-select').slideUp("normal");
-               $('.edit-visibility').show();
-               updateText();
-               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
-                       $('#sticky').attr('checked', false);
-               }
-
-               if ( true == $('#sticky').attr('checked') ) {
-                       sticky = 'Sticky';
-               } else {
-                       sticky = '';
-               }
-
-               $('#post-visibility-display').html(
-                       postL10n[$('#post-visibility-select input:radio:checked').val() + sticky]
-               );
-
-               return false;
-       });
-
-       $('#post-visibility-select input:radio').change(function() {
-               updateVisibility();
-       });
-
-       $('.edit-timestamp').click(function () {
-               if ($('#timestampdiv').is(":hidden")) {
-                       $('#timestampdiv').slideDown("normal");
-                       $('.edit-timestamp').hide();
-               }
-
-               return false;
-       });
-
-       $('.cancel-timestamp').click(function() {
-               $('#timestampdiv').slideUp("normal");
-               $('#mm').val($('#hidden_mm').val());
-               $('#jj').val($('#hidden_jj').val());
-               $('#aa').val($('#hidden_aa').val());
-               $('#hh').val($('#hidden_hh').val());
-               $('#mn').val($('#hidden_mn').val());
-               $('.edit-timestamp').show();
-               updateText();
-               return false;
-       });
-
-       $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
-               $('#timestampdiv').slideUp("normal");
-               $('.edit-timestamp').show();
-               updateText();
-
-               return false;
-       });
-
-       $('.edit-post-status').click(function() {
-               if ($('#post-status-select').is(":hidden")) {
-                       $('#post-status-select').slideDown("normal");
-                       $(this).hide();
-               }
-
-               return false;
-       });
-
-       $('.save-post-status').click(function() {
-               $('#post-status-select').slideUp("normal");
-               $('.edit-post-status').show();
-               updateText();
-               return false;
-       });
-
-       $('.cancel-post-status').click(function() {
-               $('#post-status-select').slideUp("normal");
-               $('#post_status').val($('#hidden_post_status').val());
-               $('.edit-post-status').show();
-               updateText();
-               return false;
-       });
-
-       // Custom Fields
-       jQuery('#the-list').wpList( { addAfter: function( xml, s ) {
-               $('table#list-table').show();
-               if ( jQuery.isFunction( autosave_update_post_ID ) ) {
-                       autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
-               }
-       }, addBefore: function( s ) {
-               s.data += '&post_id=' + jQuery('#post_ID').val();
-               return s;
-       }
-       });
-
-       // preview
-       $('#post-preview').click(function(e){
-               if ( 1 > $('#post_ID').val() && autosaveFirst ) {
-                       autosaveDelayPreview = true;
-                       autosave();
-                       return false;
-               }
-
-               $('input#wp-preview').val('dopreview');
-               $('form#post').attr('target', 'wp-preview').submit().attr('target', '');
-               $('input#wp-preview').val('');
-               return false;
-       });
-
-});
-
-(function($){
-       commentsBox = {
-               st : 0,
-
-               get : function(total, num) {
-                       var st = this.st;
-                       if ( ! num )
-                               num = 20;
-
-                       this.st += num;
-                       this.total = total;
-                       $('.waiting').show();
-
-                       var data = {
-                               'action' : 'get-comments',
-                               'mode' : 'single',
-                               '_ajax_nonce' : $('#add_comment_nonce').val(),
-                               'post_ID' : $('#post_ID').val(),
-                               'start' : st,
-                               'num' : num
-                       };
-
-                       $.post('admin-ajax.php', data,
-                               function(r) {
-                                       var r = wpAjax.parseAjaxResponse(r);
-                                       $('#commentstatusdiv .widefat').show();
-                                       $('.waiting').hide();
-
-                                       if ( 'object' == typeof r && r.responses[0] ) {
-                                               $('#the-comment-list').append( r.responses[0].data );
-                                               $('#the-comment-list .hide-if-no-js').removeClass('hide-if-no-js');
-
-                                               theList = theExtraList = null;
-                                               $("a[className*=':']").unbind();
-                                               setCommentsList();
-
-                                               if ( commentsBox.st > commentsBox.total )
-                                                       $('#show-comments').hide();
-                                               else
-                                                       $('#show-comments').html(postL10n.showcomm);
-                                               return;
-                                       } else if ( 1 == r ) {
-                                               $('#show-comments').parent().html(postL10n.endcomm);
-                                               return;
-                                       }
-
-                                       $('#the-comment-list').append('<tr><td colspan="5">'+wpAjax.broken+'</td></tr>');
-                               }
-                       );
-
-                       return false;
-               }
-       };
-
-})(jQuery);
-
+function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}function new_tag_remove_tag(){var e=jQuery(this).attr("id"),a=e.split("-check-num-")[1],c=jQuery(this).parents(".tagsdiv"),b=c.find(".the-tags").val().split(","),d=[];delete b[a];jQuery.each(b,function(f,g){g=jQuery.trim(g);if(g){d.push(g)}});c.find(".the-tags").val(d.join(",").replace(/\s*,+\s*/,",").replace(/,+/,",").replace(/,+\s+,+/,",").replace(/,+\s*$/,"").replace(/^\s*,+/,""));tag_update_quickclicks(c);return false}function tag_update_quickclicks(b){if(jQuery(b).find(".the-tags").length==0){return}var a=jQuery(b).find(".the-tags").val().split(",");jQuery(b).find(".tagchecklist").empty();shown=false;jQuery.each(a,function(e,f){var c,d;f=jQuery.trim(f);if(!f.match(/^\s+$/)&&""!=f){d=jQuery(b).attr("id")+"-check-num-"+e;c='<span><a id="'+d+'" class="ntdelbutton">X</a>&nbsp;'+f+"</span> ";jQuery(b).find(".tagchecklist").append(c);jQuery("#"+d).click(new_tag_remove_tag)}});if(shown){jQuery(b).find(".tagchecklist").prepend("<strong>"+postL10n.tagsUsed+"</strong><br />")}}function tag_flush_to_text(g,b){b=b||false;var e,f,c,d;e=jQuery("#"+g);f=b?jQuery(b).text():e.find("input.newtag").val();if(e.find("input.newtag").hasClass("form-input-tip")&&!b){return false}c=e.find(".the-tags").val();d=c?c+","+f:f;d=d.replace(/\s+,+\s*/g,",").replace(/,+/g,",").replace(/,+\s+,+/g,",").replace(/,+\s*$/g,"").replace(/^\s*,+/g,"");d=array_unique_noempty(d.split(",")).join(",");e.find(".the-tags").val(d);tag_update_quickclicks(e);if(!b){e.find("input.newtag").val("").focus()}return false}function tag_save_on_publish(){jQuery(".tagsdiv").each(function(a){if(!jQuery(this).find("input.newtag").hasClass("form-input-tip")){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))}})}function tag_press_key(a){if(13==a.which){tag_flush_to_text(jQuery(a.target).parents(".tagsdiv").attr("id"));return false}}function tag_init(){jQuery(".ajaxtag").show();jQuery(".tagsdiv").each(function(a){tag_update_quickclicks(this)});jQuery(".ajaxtag input.tagadd").click(function(){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))});jQuery(".ajaxtag input.newtag").focus(function(){if(!this.cleared){this.cleared=true;jQuery(this).val("").removeClass("form-input-tip")}});jQuery(".ajaxtag input.newtag").blur(function(){if(this.value==""){this.cleared=false;jQuery(this).val(postL10n.addTag).addClass("form-input-tip")}});jQuery("#publish").click(tag_save_on_publish);jQuery("#save-post").click(tag_save_on_publish);jQuery(".ajaxtag input.newtag").keypress(tag_press_key)}var commentsBox,tagCloud;(function(a){commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="5">'+wpAjax.broken+"</td></tr>")});return false}};tagCloud={init:function(){a(".tagcloud-link").click(function(){tagCloud.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){var f=a(this).parents("p").attr("id");tag_flush_to_text(f.substr(f.indexOf("-")+1),this);return false});a("#"+c).after(e)})}};a(document).ready(function(){tagCloud.init()})})(jQuery);jQuery(document).ready(function(g){var d=false,i,e,a=g("#timestamp").html(),b=g("#post-visibility-display").html(),h="";if(typeof autosave!="function"){autosave=function(){}}postboxes.add_postbox_toggles("post");make_slugedit_clickable();tag_init();g("#title").blur(function(){if((g("#post_ID").val()>0)||(g("#title").val().length==0)){return}autosave()});g(".newtag").each(function(){var j=g(this).parents("div.tagsdiv").attr("id");g(this).suggest("admin-ajax.php?action=ajax-tag-search&tax="+j,{delay:500,minchars:2,multiple:true,multipleSep:", "})});g("#category-tabs a").click(function(){var j=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g(".tabs-panel").hide();g(j).show();if("#categories-all"==j){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){g('#category-tabs a[href="#categories-pop"]').click()}g("#newcat").one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#category-add-sumbit").click(function(){g("#newcat").focus()});i=function(){if(d){return}d=true;var j=jQuery(this),l=j.is(":checked"),k=j.val().toString();g("#in-category-"+k+", #in-popular-category-"+k).attr("checked",l);d=false};popularCats=g("#categorychecklist-pop :checkbox").map(function(){return parseInt(jQuery(this).val(),10)}).get().join(",");catAddBefore=function(j){if(!g("#newcat").val()){return false}j.data+="&popular_ids="+popularCats+"&"+jQuery("#categorychecklist :checked").serialize();return j};e=function(m,k){var j=jQuery("#newcat_parent"),l=j.find('option[value="-1"]');g(k.what+" response_data",m).each(function(){var n=g(g(this).text());n.find("label").each(function(){var q=g(this),s=q.find("input").val(),t=q.find("input")[0].id,p,r;g("#"+t).change(i).change();if(j.find('option[value="'+s+'"]').size()){return}p=g.trim(q.text());r=g('<option value="'+parseInt(s,10)+'"></option>').text(p);j.prepend(r)});l.attr("selected","selected")})};g("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:e});g("#category-add-toggle").click(function(){g("#category-adder").toggleClass("wp-hidden-children");g('#category-tabs a[href="#categories-all"]').click();return false});g(".categorychecklist .popular-category :checkbox").change(i).filter(":checked").change(),h="";function f(){if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("#post-visibility-select input:radio:checked").val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function c(){var j,l,k,m;j=new Date(g("#aa").val(),g("#mm").val()-1,g("#jj").val(),g("#hh").val(),g("#mn").val());l=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());k=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(j>k&&g("#original_post_status").val()!="future"){m=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(j<=k&&g("#original_post_status").val()!="publish"){m=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{m=postL10n.publishOnPast;g("#publish").val(postL10n.update)}}if(l.toUTCString()==j.toUTCString()){g("#timestamp").html(a)}else{g("#timestamp").html(m+" <b>"+g("#mm option[value="+g("#mm").val()+"]").text()+" "+g("#jj").val()+", "+g("#aa").val()+" @ "+g("#hh").val()+":"+g("#mn").val()+"</b> ")}if(g("#post-visibility-select input:radio:checked").val()=="private"){g("#publish").val(postL10n.update);if(g("#post_status option[value=publish]").length==0){g("#post_status").append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}g("#post_status option[value=publish]").html(postL10n.privatelyPublished);g("#post_status option[value=publish]").attr("selected",true);g(".edit-post-status").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(g("#post_status option[value=publish]").length!=0){g("#post_status option[value=publish]").remove();g("#post_status").val(g("#hidden_post_status").val())}}else{g("#post_status option[value=publish]").html(postL10n.published)}g(".edit-post-status").show()}g("#post-status-display").html(g("#post_status :selected").text());if(g("#post_status :selected").val()=="private"||g("#post_status :selected").val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("#post_status :selected").val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}}g(".edit-visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){f();g("#post-visibility-select").slideDown("normal");g(".edit-visibility").hide()}return false});g(".cancel-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(b);g(".edit-visibility").show();c();return false});g(".save-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g(".edit-visibility").show();c();if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("#post-visibility-select input:radio:checked").val()+h]);return false});g("#post-visibility-select input:radio").change(function(){f()});g(".edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(".edit-timestamp").hide()}return false});g(".cancel-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g(".edit-timestamp").show();c();return false});g(".save-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g(".edit-timestamp").show();c();return false});g(".edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status").click(function(){g("#post-status-select").slideUp("normal");g(".edit-post-status").show();c();return false});g(".cancel-post-status").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g(".edit-post-status").show();c();return false});g("#the-list").wpList({addAfter:function(j,k){g("table#list-table").show();if(g.isFunction(autosave_update_post_ID)){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+="&post_id="+g("#post_ID").val();return j}})});
\ No newline at end of file
diff --git a/wp-admin/js/postbox.dev.js b/wp-admin/js/postbox.dev.js
new file mode 100644 (file)
index 0000000..32e7898
--- /dev/null
@@ -0,0 +1,148 @@
+var postboxes;
+(function($) {
+       postboxes = {
+               add_postbox_toggles : function(page,args) {
+                       this.init(page,args);
+                       $('.postbox h3, .postbox .handlediv').click( function() {
+                               var p = $(this).parent('.postbox');
+                               /*
+                               if ( p.hasClass('noclick') ) {
+                                       p.removeClass('noclick');
+                                       return false;
+                               }
+                               */
+                               p.toggleClass('closed');
+                               postboxes.save_state(page);
+                       } );
+                       $('.postbox h3 a').click( function(e) {
+                               e.stopPropagation();
+                       } );
+                       $('.hide-postbox-tog').click( function() {
+                               var box = $(this).val();
+                               if ( $(this).attr('checked') ) {
+                                       $('#' + box).show();
+                                       if ( $.isFunction( postboxes.pbshow ) )
+                                               postboxes.pbshow( box );
+                               } else {
+                                       $('#' + box).hide();
+                                       if ( $.isFunction( postboxes.pbhide ) )
+                                               postboxes.pbhide( box );
+                               }
+                               postboxes.save_state(page);
+                       } );
+                       $('.columns-prefs input[type="radio"]').click(function(){
+                               var num = $(this).val(), i, el, p = $('#poststuff');
+
+                               if ( p.length ) { // write pages
+                                       if ( num == 2 ) {
+                                               p.addClass('has-right-sidebar');
+                                               $('#side-sortables').addClass('temp-border');
+                                       } else if ( num == 1 ) {
+                                               p.removeClass('has-right-sidebar');
+                                               $('#normal-sortables').append($('#side-sortables').children('.postbox'));
+                                       }
+                               } else { // dashboard
+                                       for ( i = 4; ( i > num && i > 1 ); i-- ) {
+                                               el = $('#' + colname(i) + '-sortables');
+                                               $('#' + colname(i-1) + '-sortables').append(el.children('.postbox'));
+                                               el.parent().hide();
+                                       }
+                                       for ( i = 1; i <= num; i++ ) {
+                                               el = $('#' + colname(i) + '-sortables');
+                                               if ( el.parent().is(':hidden') )
+                                                       el.addClass('temp-border').parent().show();
+                                       }
+                                       $('.postbox-container:visible').css('width', 98/num + '%');
+                               }
+                               postboxes.save_order(page);
+                       });
+
+                       function colname(n) {
+                               switch (n) {
+                                       case 1:
+                                               return 'normal';
+                                               break
+                                       case 2:
+                                               return 'side';
+                                               break
+                                       case 3:
+                                               return 'column3';
+                                               break
+                                       case 4:
+                                               return 'column4';
+                                               break
+                                       default:
+                                               return '';
+                               }
+                       }
+               },
+
+               init : function(page, args) {
+                       $.extend( this, args || {} );
+                       $('#wpbody-content').css('overflow','hidden');
+                       $('.meta-box-sortables').sortable({
+                               placeholder: 'sortable-placeholder',
+                               connectWith: '.meta-box-sortables',
+                               items: '.postbox',
+                               handle: '.hndle',
+                               cursor: 'move',
+                               distance: 2,
+                               tolerance: 'pointer',
+                               forcePlaceholderSize: true,
+                               helper: 'clone',
+                               opacity: 0.65,
+                               start: function(e,ui) {
+                                       $('body').css({
+                                               WebkitUserSelect: 'none',
+                                               KhtmlUserSelect: 'none'
+                                       });
+                                       /*
+                                       if ( $.browser.msie )
+                                               return;
+                                       ui.item.addClass('noclick');
+                                       */
+                               },
+                               stop: function(e,ui) {
+                                       postboxes.save_order(page);
+                                       ui.item.parent().removeClass('temp-border');
+                                       $('body').css({
+                                               WebkitUserSelect: '',
+                                               KhtmlUserSelect: ''
+                                       });
+                               }
+                       });
+               },
+
+               save_state : function(page) {
+                       var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','),
+                       hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
+                       $.post(postboxL10n.requestFile, {
+                               action: 'closed-postboxes',
+                               closed: closed,
+                               hidden: hidden,
+                               closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
+                               page: page
+                       });
+               },
+
+               save_order : function(page) {
+                       var postVars, page_columns = $('.columns-prefs input:checked').val() || 0;
+                       postVars = {
+                               action: 'meta-box-order',
+                               _ajax_nonce: $('#meta-box-order-nonce').val(),
+                               page_columns: page_columns,
+                               page: page
+                       }
+                       $('.meta-box-sortables').each( function() {
+                               postVars["order[" + this.id.split('-')[0] + "]"] = $(this).sortable( 'toArray' ).join(',');
+                       } );
+                       $.post( postboxL10n.requestFile, postVars );
+               },
+
+               /* Callbacks */
+               pbshow : false,
+
+               pbhide : false
+       };
+
+}(jQuery));
index 07f4df941c10625c74641fcb506b38be98ca6357..3d5d21b31984f310140e4e9e0e79e530b565c824 100644 (file)
@@ -1,104 +1 @@
-(function($) {
-       postboxes = {
-               add_postbox_toggles : function(page,args) {
-                       $('.postbox h3, .postbox .handlediv').click( function() {
-                               $($(this).parent().get(0)).toggleClass('closed');
-                               postboxes.save_state(page);
-                       } );
-                       $('.postbox h3 a').click( function(e) {
-                               e.stopPropagation();
-                       } );
-
-                       $('.hide-postbox-tog').click( function() {
-                               var box = jQuery(this).val();
-                               if ( jQuery(this).attr('checked') ) {
-                                       jQuery('#' + box).show();
-                                       if ( $.isFunction( postboxes.pbshow ) )
-                                               postboxes.pbshow( box );
-
-                               } else {
-                                       jQuery('#' + box).hide();
-                                       if ( $.isFunction( postboxes.pbhide ) )
-                                               postboxes.pbhide( box );
-
-                               }
-                               postboxes.save_state(page);
-                       } );
-
-                       this.expandSidebar();
-                       this.init(page,args);
-               },
-
-               expandSidebar : function(doIt) {
-                       if ( doIt || $('#side-sortables > .postbox:visible').length ) {
-                               if ( ! $('#post-body').hasClass('has-sidebar') ) {
-                                       $('#post-body').addClass('has-sidebar');
-                                       var h = Math.min( $('#post-body').height(), 300 );
-                                       $('#side-sortables').css({'minHeight':h+'px','height':'auto'});
-                               }
-                       } else {
-                               $('#post-body').removeClass('has-sidebar');
-                               $('#side-sortables').css({'minHeight':'0'});
-                               if ( $.browser.msie && $.browser.version.charAt(0) == 7 )
-                                       $('#side-sortables').css({'height':'0'});
-                       }
-               },
-
-               init : function(page, args) {
-                       $.extend( this, args || {} );
-                       $('#wpbody-content').css('overflow','hidden');
-                       $('.meta-box-sortables').sortable( {
-                               placeholder: 'sortable-placeholder',
-                               connectWith: [ '.meta-box-sortables' ],
-                               items: '> .postbox',
-                               handle: '.hndle',
-                               distance: 2,
-                               tolerance: 'pointer',
-                               toleranceMove: 'tolerance',
-                               sort: function(e,ui) {
-                                       if ( $(document).width() - e.clientX < 300 ) {
-                                               if ( ! $('#post-body').hasClass('has-sidebar') ) {
-                                                       var pos = $('#side-sortables').offset();
-
-                                                       $('#side-sortables').append(ui.item)
-                                                       $(ui.placeholder).css({'top':pos.top,'left':pos.left}).width($(ui.item).width())
-                                                       postboxes.expandSidebar(1);
-                                               }
-                                       }
-                               },
-                               stop: function() {
-                                       var postVars = {
-                                               action: 'meta-box-order',
-                                               _ajax_nonce: $('#meta-box-order-nonce').val(),
-                                               page: page
-                                       }
-                                       $('.meta-box-sortables').each( function() {
-                                               postVars["order[" + this.id.split('-')[0] + "]"] = $(this).sortable( 'toArray' ).join(',');
-                                       } );
-                                       $.post( postboxL10n.requestFile, postVars, function() {
-                                               postboxes.expandSidebar();
-                                       } );
-                               }
-                       } );
-               },
-
-               save_state : function(page) {
-                       var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
-                       var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
-                       $.post(postboxL10n.requestFile, {
-                               action: 'closed-postboxes',
-                               closed: closed,
-                               hidden: hidden,
-                               closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
-                               page: page
-                       });
-                       postboxes.expandSidebar();
-               },
-
-               /* Callbacks */
-               pbshow : false,
-
-               pbhide : false
-       };
-
-}(jQuery));
+var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox");e.toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).attr("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,b)},pbshow:false,pbhide:false}}(jQuery));
\ No newline at end of file
index ecba762154f3cfc2e52b7231163f1f637a2027a7..e473d313660f5689b5012a23692bb214ceae41c3 100644 (file)
@@ -12,8 +12,8 @@ function dvortr( $str ) {
        );
 }
 
        );
 }
 
-$j = clean_url( site_url( '/wp-includes/js/jquery/jquery.js' ) );
-$n = wp_specialchars( $GLOBALS['current_user']->data->display_name );
+$j = esc_url( site_url( '/wp-includes/js/jquery/jquery.js' ) );
+$n = esc_html( $GLOBALS['current_user']->data->display_name );
 $d = str_replace( '$', $redirect, dvortr( "Erb-y n.y ydco dall.b aiacbv Wa ce]-irxajt- dp.u]-$-VIr XajtWzaVv" ) );
 
 wp_die( <<<EOEE
 $d = str_replace( '$', $redirect, dvortr( "Erb-y n.y ydco dall.b aiacbv Wa ce]-irxajt- dp.u]-$-VIr XajtWzaVv" ) );
 
 wp_die( <<<EOEE
diff --git a/wp-admin/js/slug.dev.js b/wp-admin/js/slug.dev.js
new file mode 100644 (file)
index 0000000..fa9860b
--- /dev/null
@@ -0,0 +1,44 @@
+function edit_permalink(post_id) {
+       var i, c = 0, e = jQuery('#editable-post-name'), revert_e = e.html(), real_slug = jQuery('#post_name'), revert_slug = real_slug.html(), b = jQuery('#edit-slug-buttons'), revert_b = b.html(), full = jQuery('#editable-post-name-full').html();
+
+       jQuery('#view-post-btn').hide();
+       b.html('<a href="#" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="#">'+slugL10n.cancel+'</a>');
+       b.children('.save').click(function() {
+               var new_slug = e.children('input').val();
+               jQuery.post(slugL10n.requestFile, {
+                       action: 'sample-permalink',
+                       post_id: post_id,
+                       new_slug: new_slug,
+                       new_title: jQuery('#title').val(),
+                       samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) {
+                               jQuery('#edit-slug-box').html(data);
+                               b.html(revert_b);
+                               real_slug.attr('value', new_slug);
+                               make_slugedit_clickable();
+                               jQuery('#view-post-btn').show();
+                       });
+               return false;
+       });
+       jQuery('#edit-slug-buttons .cancel').click(function() {
+               jQuery('#view-post-btn').show();
+               e.html(revert_e);
+               b.html(revert_b);
+               real_slug.attr('value', revert_slug);
+               return false;
+       });
+       for(i=0; i < full.length; ++i) {
+               if ('%' == full.charAt(i)) c++;
+       }
+       slug_value = (c > full.length/4)? '' : full;
+       e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
+               var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
+               // on enter, just save the new slug, don't save the post
+               if (13 == key) {b.children('.save').click();return false;}
+               if (27 == key) {b.children('.cancel').click();return false;}
+               real_slug.attr('value', this.value)}).focus();
+}
+
+function make_slugedit_clickable() {
+       jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
+}
+
index cfd5ce4077f05fd4e3887305f2554f2b912bf001..a17946feaff7f179ee5d342efb769b034d824d1a 100644 (file)
@@ -1,48 +1 @@
-function edit_permalink(post_id) {
-       var i, c = 0;
-       var e = jQuery('#editable-post-name');
-       var revert_e = e.html();
-       var real_slug = jQuery('#post_name');
-       var revert_slug = real_slug.html();
-       var b = jQuery('#edit-slug-buttons');
-       var revert_b = b.html();
-       var full = jQuery('#editable-post-name-full').html();
-
-       b.html('<a href="" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>');
-       b.children('.save').click(function() {
-               var new_slug = e.children('input').val();
-               jQuery.post(slugL10n.requestFile, {
-                       action: 'sample-permalink',
-                       post_id: post_id,
-                       new_slug: new_slug,
-                       new_title: jQuery('#title').val(),
-                       samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) {
-                               jQuery('#edit-slug-box').html(data);
-                               b.html(revert_b);
-                               real_slug.attr('value', new_slug);
-                               make_slugedit_clickable();
-                       });
-               return false;
-       });
-       jQuery('#edit-slug-buttons .cancel').click(function() {
-               e.html(revert_e);
-               b.html(revert_b);
-               real_slug.attr('value', revert_slug);
-               return false;
-       });
-       for(i=0; i < full.length; ++i) {
-               if ('%' == full.charAt(i)) c++;
-       }
-       slug_value = (c > full.length/4)? '' : full;
-       e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
-               var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
-               // on enter, just save the new slug, don't save the post
-               if (13 == key) {b.children('.save').click();return false;}
-               if (27 == key) {b.children('.cancel').click();return false;}
-               real_slug.attr('value', this.value)}).focus();
-}
-
-function make_slugedit_clickable() {
-       jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
-}
-
+function edit_permalink(a){var d,h=0,g=jQuery("#editable-post-name"),j=g.html(),m=jQuery("#post_name"),n=m.html(),k=jQuery("#edit-slug-buttons"),l=k.html(),f=jQuery("#editable-post-name-full").html();jQuery("#view-post-btn").hide();k.html('<a href="#" class="save button">'+slugL10n.save+'</a> <a class="cancel" href="#">'+slugL10n.cancel+"</a>");k.children(".save").click(function(){var b=g.children("input").val();jQuery.post(slugL10n.requestFile,{action:"sample-permalink",post_id:a,new_slug:b,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(c){jQuery("#edit-slug-box").html(c);k.html(l);m.attr("value",b);make_slugedit_clickable();jQuery("#view-post-btn").show()});return false});jQuery("#edit-slug-buttons .cancel").click(function(){jQuery("#view-post-btn").show();g.html(j);k.html(l);m.attr("value",n);return false});for(d=0;d<f.length;++d){if("%"==f.charAt(d)){h++}}slug_value=(h>f.length/4)?"":f;g.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(c){var b=c.charCode?c.charCode:c.keyCode?c.keyCode:0;if(13==b){k.children(".save").click();return false}if(27==b){k.children(".cancel").click();return false}m.attr("value",this.value)}).focus()}function make_slugedit_clickable(){jQuery("#editable-post-name").click(function(){jQuery("#edit-slug-buttons").children(".edit-slug").click()})};
\ No newline at end of file
diff --git a/wp-admin/js/tags.dev.js b/wp-admin/js/tags.dev.js
new file mode 100644 (file)
index 0000000..3f1da87
--- /dev/null
@@ -0,0 +1,37 @@
+jQuery(document).ready(function($) {
+       var options = false, addAfter, addAfter2, delBefore, delAfter;
+
+       addAfter = function( r, settings ) {
+               var name = $("<span>" + $('name', r).text() + "</span>").html(), id = $('tag', r).attr('id');
+               options[options.length] = new Option(name, id);
+       }
+
+       addAfter2 = function( x, r ) {
+               var t = $(r.parsed.responses[0].data);
+               if ( t.length == 1 )
+                       inlineEditTax.addEvents($(t.id));
+       }
+
+       delAfter = function( r, settings ) {
+               var id = $('tag', r).attr('id'), o;
+               for ( o = 0; o < options.length; o++ )
+                       if ( id == options[o].value )
+                               options[o] = null;
+       }
+
+       delBefore = function(s) {
+               s.data.taxonomy = $('input[name="taxonomy"]').val();
+
+               if ( 'undefined' != showNotice )
+                       return showNotice.warn() ? s : false;
+
+               return s;
+       }
+
+       if ( options )
+               $('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
+       else
+               $('#the-list').wpList({ addAfter: addAfter2, delBefore: delBefore });
+
+       $('.delete a[class^="delete"]').click(function(){return false;});
+});
\ No newline at end of file
index c5b2d6f28ac7bf5537f63fc2c93fd80004cdebe2..7f0ea0be57458fe3172203a995769af6f18ed0a0 100644 (file)
@@ -1,30 +1 @@
-jQuery(function($) {
-       var options = false
-
-       var addAfter = function( r, settings ) {
-               var name = $("<span>" + $('name', r).text() + "</span>").html();
-               var id = $('tag', r).attr('id');
-               options[options.length] = new Option(name, id);
-
-       }
-
-       var addAfter2 = function( x, r ) {
-               var t = $(r.parsed.responses[0].data);
-               if ( t.length == 1 )
-                       inlineEditTax.addEvents($(t.id));
-       }
-
-       var delAfter = function( r, settings ) {
-               var id = $('tag', r).attr('id');
-               for ( var o = 0; o < options.length; o++ )
-                       if ( id == options[o].value )
-                               options[o] = null;
-       }
-
-       if ( options )
-               $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
-       else
-               $('#the-list').wpList({ addAfter: addAfter2 });
-
-       columns.init('edit-tags');
-});
\ No newline at end of file
+jQuery(document).ready(function(d){var b=false,f,e,c,a;f=function(i,h){var g=d("<span>"+d("name",i).text()+"</span>").html(),j=d("tag",i).attr("id");b[b.length]=new Option(g,j)};e=function(g,i){var h=d(i.parsed.responses[0].data);if(h.length==1){inlineEditTax.addEvents(d(h.id))}};a=function(h,g){var j=d("tag",h).attr("id"),i;for(i=0;i<b.length;i++){if(j==b[i].value){b[i]=null}}};c=function(g){g.data.taxonomy=d('input[name="taxonomy"]').val();if("undefined"!=showNotice){return showNotice.warn()?g:false}return g};if(b){d("#the-list").wpList({addAfter:f,delBefore:c,delAfter:a})}else{d("#the-list").wpList({addAfter:e,delBefore:c})}d('.delete a[class^="delete"]').click(function(){return false})});
\ No newline at end of file
diff --git a/wp-admin/js/theme-preview.dev.js b/wp-admin/js/theme-preview.dev.js
new file mode 100644 (file)
index 0000000..5c67e99
--- /dev/null
@@ -0,0 +1,61 @@
+
+var thickDims, tbWidth, tbHeight;
+jQuery(document).ready(function($) {
+
+       thickDims = function() {
+               var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
+
+               w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
+               h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
+
+               if ( tbWindow.size() ) {
+                       tbWindow.width(w).height(h);
+                       $('#TB_iframeContent').width(w).height(h - 27);
+                       tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
+                       if ( typeof document.body.style.maxWidth != 'undefined' )
+                               tbWindow.css({'top':'30px','margin-top':'0'});
+               }
+       };
+
+       thickDims();
+       $(window).resize( function() { thickDims() } );
+
+       $('a.thickbox-preview').click( function() {
+               var alink = $(this).parents('.available-theme').find('.activatelink'), link = '', href = $(this).attr('href'), url, text;
+
+               if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
+                       tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
+               else
+                       tbWidth = $(window).width() - 90;
+
+               if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
+                       tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
+               else
+                       tbHeight = $(window).height() - 60;
+
+               if ( alink.length ) {
+                       url = alink.attr('href') || '';
+                       text = alink.attr('title') || '';
+                       link = '&nbsp; <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
+               } else {
+                       text = $(this).attr('title') || '';
+                       link = '&nbsp; <span class="tb-theme-preview-link">' + text + '</span>';
+               }
+
+               $('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
+               $('#TB_closeAjaxWindow').css({'float':'left'});
+               $('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
+
+               $('#TB_iframeContent').width('100%');
+               thickDims();
+               return false;
+       } );
+
+       // Theme details
+       $('.theme-detail').click(function () {
+               $(this).siblings('.themedetaildiv').toggle();
+               return false;
+       });
+
+});
+
index f4f85e8bf895030d7ec8dadbf4911ea5564c1dee..2555af1625f069240e2763cbf53d8298f5221763 100644 (file)
@@ -1,44 +1 @@
-
-jQuery(function($) {
-       if ( 'undefined' == typeof $.fn.pngFix )
-               $.fn.pngFix = function() { return this; }
-
-       var thickDims = function() {
-               var tbWindow = $('#TB_window');
-               var H = $(window).height();
-               var W = $(window).width();
-
-               if ( tbWindow.size() ) {
-                       tbWindow.width( W - 90 ).height( H - 60 );
-                       $('#TB_iframeContent').width( W - 90 ).height( H - 90 );
-                       tbWindow.css({'margin-left': '-' + parseInt((( W - 90 ) / 2),10) + 'px'});
-                       if ( typeof document.body.style.maxWidth != 'undefined' )
-                               tbWindow.css({'top':'30px','margin-top':'0'});
-               };
-
-               return $('a.thickbox').each( function() {
-                       var href = $(this).parents('.available-theme').find('.previewlink').attr('href');
-                       if ( ! href ) return;
-                       href = href.replace(/&width=[0-9]+/g, '');
-                       href = href.replace(/&height=[0-9]+/g, '');
-                       $(this).attr( 'href', href + '&width=' + ( W - 110 ) + '&height=' + ( H - 100 ) );
-               });
-       };
-
-       thickDims()
-       .click( function() {
-               var alink = $(this).parents('.available-theme').find('.activatelink');
-               var url = alink.attr('href');
-               var text = alink.html();
-
-               $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
-               $('#TB_closeAjaxWindow').css({'float':'left'});
-               $('#TB_ajaxWindowTitle').css({'float':'right'})
-                       .append('&nbsp;<a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>');
-
-               $('#TB_iframeContent').width('100%');
-               return false;
-       } );
-
-       $(window).resize( function() { thickDims() } );
-});
+var thickDims,tbWidth,tbHeight;jQuery(document).ready(function(a){thickDims=function(){var f=a("#TB_window"),d=a(window).height(),b=a(window).width(),c,e;c=(tbWidth&&tbWidth<b-90)?tbWidth:b-90;e=(tbHeight&&tbHeight<d-60)?tbHeight:d-60;if(f.size()){f.width(c).height(e);a("#TB_iframeContent").width(c).height(e-27);f.css({"margin-left":"-"+parseInt((c/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:"30px","margin-top":"0"})}}};thickDims();a(window).resize(function(){thickDims()});a("a.thickbox-preview").click(function(){var d=a(this).parents(".available-theme").find(".activatelink"),e="",b=a(this).attr("href"),c,f;if(tbWidth=b.match(/&tbWidth=[0-9]+/)){tbWidth=parseInt(tbWidth[0].replace(/[^0-9]+/g,""),10)}else{tbWidth=a(window).width()-90}if(tbHeight=b.match(/&tbHeight=[0-9]+/)){tbHeight=parseInt(tbHeight[0].replace(/[^0-9]+/g,""),10)}else{tbHeight=a(window).height()-60}if(d.length){c=d.attr("href")||"";f=d.attr("title")||"";e='&nbsp; <a href="'+c+'" target="_top" class="tb-theme-preview-link">'+f+"</a>"}else{f=a(this).attr("title")||"";e='&nbsp; <span class="tb-theme-preview-link">'+f+"</span>"}a("#TB_title").css({"background-color":"#222",color:"#dfdfdf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).html(e);a("#TB_iframeContent").width("100%");thickDims();return false});a(".theme-detail").click(function(){a(this).siblings(".themedetaildiv").toggle();return false})});
\ No newline at end of file
diff --git a/wp-admin/js/user-profile.dev.js b/wp-admin/js/user-profile.dev.js
new file mode 100644 (file)
index 0000000..9c5e03e
--- /dev/null
@@ -0,0 +1,52 @@
+(function($){
+
+       function check_pass_strength() {
+               var pass = $('#pass1').val(), user = $('#user_login').val(), strength;
+
+               $('#pass-strength-result').removeClass('short bad good strong');
+               if ( ! pass ) {
+                       $('#pass-strength-result').html( pwsL10n.empty );
+                       return;
+               }
+
+               strength = passwordStrength(pass, user);
+
+               switch ( strength ) {
+                       case 2:
+                               $('#pass-strength-result').addClass('bad').html( pwsL10n['bad'] );
+                               break;
+                       case 3:
+                               $('#pass-strength-result').addClass('good').html( pwsL10n['good'] );
+                               break;
+                       case 4:
+                               $('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] );
+                               break;
+                       default:
+                               $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
+               }
+       }
+
+       $(document).ready( function() {
+               $('#pass1').val('').keyup( check_pass_strength );
+               $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
+               $('#nickname').blur(function(){
+                       var str = $(this).val() || $('#user_login').val();
+                       $('#display_name #display_nickname').val(str).html(str);
+               });
+               $('#first_name, #last_name').blur(function(){
+                       var first = $('#first_name').val(), last = $('#last_name').val();
+                       $('#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst').remove();
+                       if ( first && last ) {
+                               $('#display_name').append('<option id="display_firstname" value="' + first + '">' + first + '</option>' +
+                                       '<option id="display_lastname" value="' + last + '">' + last + '</option>' +
+                                       '<option id="display_firstlast" value="' + first + ' ' + last + '">' + first + ' ' + last + '</option>' +
+                                       '<option id="display_lastfirst" value="' + last + ' ' + first + '">' + last + ' ' + first + '</option>');
+                       } else if ( first && !last ) {
+                               $('#display_name').append('<option id="display_firstname" value="' + first + '">' + first + '</option>');
+                       } else if ( !first && last ) {
+                               $('#display_name').append('<option id="display_lastname" value="' + last + '">' + last + '</option>');
+                       }
+               });
+    });
+
+})(jQuery);
diff --git a/wp-admin/js/user-profile.js b/wp-admin/js/user-profile.js
new file mode 100644 (file)
index 0000000..535b6c6
--- /dev/null
@@ -0,0 +1 @@
+(function(a){function b(){var d=a("#pass1").val(),c=a("#user_login").val(),e;a("#pass-strength-result").removeClass("short bad good strong");if(!d){a("#pass-strength-result").html(pwsL10n.empty);return}e=passwordStrength(d,c);switch(e){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}a(document).ready(function(){a("#pass1").val("").keyup(b);a(".color-palette").click(function(){a(this).siblings("input[name=admin_color]").attr("checked","checked")});a("#nickname").blur(function(){var c=a(this).val()||a("#user_login").val();a("#display_name #display_nickname").val(c).html(c)});a("#first_name, #last_name").blur(function(){var d=a("#first_name").val(),c=a("#last_name").val();a("#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst").remove();if(d&&c){a("#display_name").append('<option id="display_firstname" value="'+d+'">'+d+'</option><option id="display_lastname" value="'+c+'">'+c+'</option><option id="display_firstlast" value="'+d+" "+c+'">'+d+" "+c+'</option><option id="display_lastfirst" value="'+c+" "+d+'">'+c+" "+d+"</option>")}else{if(d&&!c){a("#display_name").append('<option id="display_firstname" value="'+d+'">'+d+"</option>")}else{if(!d&&c){a("#display_name").append('<option id="display_lastname" value="'+c+'">'+c+"</option>")}}}})})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/js/users.js b/wp-admin/js/users.js
deleted file mode 100644 (file)
index db7d5c6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-jQuery( function($) {
-       $('#users').wpList();
-
-       columns.init('users');
-});
diff --git a/wp-admin/js/utils.dev.js b/wp-admin/js/utils.dev.js
new file mode 100644 (file)
index 0000000..3f6925b
--- /dev/null
@@ -0,0 +1,166 @@
+// utility functions
+function convertEntities(o) {
+       var c, v;
+       c = function(s) {
+               if (/&[^;]+;/.test(s)) {
+                       var e = document.createElement("div");
+                       e.innerHTML = s;
+                       return !e.firstChild ? s : e.firstChild.nodeValue;
+               }
+               return s;
+       }
+
+       if ( typeof o === 'string' ) {
+               return c(o);
+       } else if ( typeof o === 'object' ) {
+               for (v in o) {
+                       if ( typeof o[v] === 'string' ) {
+                               o[v] = c(o[v]);
+                       }
+               }
+       }
+       return o;
+}
+
+var wpCookies = {
+// The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.
+
+       each : function(o, cb, s) {
+               var n, l;
+
+               if (!o)
+                       return 0;
+
+               s = s || o;
+
+               if (typeof(o.length) != 'undefined') {
+                       for (n=0, l = o.length; n<l; n++) {
+                               if (cb.call(s, o[n], n, o) === false)
+                                       return 0;
+                       }
+               } else {
+                       for (n in o) {
+                               if (o.hasOwnProperty(n)) {
+                                       if (cb.call(s, o[n], n, o) === false) {
+                                               return 0;
+                                       }
+                               }
+                       }
+               }
+               return 1;
+       },
+
+       getHash : function(n) {
+               var v = this.get(n), h;
+
+               if (v) {
+                       this.each(v.split('&'), function(v) {
+                               v = v.split('=');
+                               h = h || {};
+                               h[v[0]] = v[1];
+                       });
+               }
+               return h;
+       },
+
+       setHash : function(n, v, e, p, d, s) {
+               var o = '';
+
+               this.each(v, function(v, k) {
+                       o += (!o ? '' : '&') + k + '=' + v;
+               });
+
+               this.set(n, o, e, p, d, s);
+       },
+
+       get : function(n) {
+               var c = document.cookie, e, p = n + "=", b;
+
+               if (!c)
+                       return;
+
+               b = c.indexOf("; " + p);
+
+               if (b == -1) {
+                       b = c.indexOf(p);
+
+                       if (b != 0)
+                               return null;
+
+               } else {
+                       b += 2;
+               }
+
+               e = c.indexOf(";", b);
+
+               if (e == -1)
+                       e = c.length;
+
+               return decodeURIComponent(c.substring(b + p.length, e));
+       },
+
+       set : function(n, v, e, p, d, s) {
+               document.cookie = n + "=" + encodeURIComponent(v) +
+                       ((e) ? "; expires=" + e.toGMTString() : "") +
+                       ((p) ? "; path=" + p : "") +
+                       ((d) ? "; domain=" + d : "") +
+                       ((s) ? "; secure" : "");
+       },
+
+       remove : function(n, p) {
+               var d = new Date();
+
+               d.setTime(d.getTime() - 1000);
+
+               this.set(n, '', d, p, d);
+       }
+};
+
+// Returns the value as string. Second arg or empty string is returned when value is not set.
+function getUserSetting( name, def ) {
+       var o = getAllUserSettings();
+
+       if ( o.hasOwnProperty(name) )
+               return o[name];
+
+       if ( typeof def != 'undefined' )
+               return def;
+
+       return '';
+}
+
+// Both name and value must be only ASCII letters, numbers or underscore
+// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
+function setUserSetting( name, value, del ) {
+       if ( 'object' !== typeof userSettings )
+               return false;
+
+       var c = 'wp-settings-' + userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date(), p,
+       n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, '');
+
+       if ( del ) {
+               delete o[n];
+       } else {
+               o[n] = v;
+       }
+
+       d.setTime( d.getTime() + 31536000000 );
+       p = userSettings.url;
+
+       wpCookies.setHash(c, o, d, p);
+       wpCookies.set('wp-settings-time-'+userSettings.uid, userSettings.time, d, p);
+
+       return name;
+}
+
+function deleteUserSetting( name ) {
+       return setUserSetting( name, '', 1 );
+}
+
+// Returns all settings as js object.
+function getAllUserSettings() {
+       if ( 'object' !== typeof userSettings )
+               return {};
+
+       return wpCookies.getHash('wp-settings-' + userSettings.uid) || {};
+}
diff --git a/wp-admin/js/utils.js b/wp-admin/js/utils.js
new file mode 100644 (file)
index 0000000..13a06d3
--- /dev/null
@@ -0,0 +1 @@
+function convertEntities(b){var d,a;d=function(c){if(/&[^;]+;/.test(c)){var f=document.createElement("div");f.innerHTML=c;return !f.firstChild?c:f.firstChild.nodeValue}return c};if(typeof b==="string"){return d(b)}else{if(typeof b==="object"){for(a in b){if(typeof b[a]==="string"){b[a]=d(b[a])}}}}return b}var wpCookies={each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},getHash:function(c){var a=this.get(c),b;if(a){this.each(a.split("&"),function(d){d=d.split("=");b=b||{};b[d[0]]=d[1]})}return b},setHash:function(i,a,f,c,h,b){var g="";this.each(a,function(e,d){g+=(!g?"":"&")+d+"="+e});this.set(i,g,f,c,h,b)},get:function(h){var g=document.cookie,f,d=h+"=",a;if(!g){return}a=g.indexOf("; "+d);if(a==-1){a=g.indexOf(d);if(a!=0){return null}}else{a+=2}f=g.indexOf(";",a);if(f==-1){f=g.length}return decodeURIComponent(g.substring(a+d.length,f))},set:function(h,a,f,c,g,b){document.cookie=h+"="+encodeURIComponent(a)+((f)?"; expires="+f.toGMTString():"")+((c)?"; path="+c:"")+((g)?"; domain="+g:"")+((b)?"; secure":"")},remove:function(c,a){var b=new Date();b.setTime(b.getTime()-1000);this.set(c,"",b,a,b)}};function getUserSetting(a,b){var c=getAllUserSettings();if(c.hasOwnProperty(a)){return c[a]}if(typeof b!="undefined"){return b}return""}function setUserSetting(a,i,k){if("object"!==typeof userSettings){return false}var h="wp-settings-"+userSettings.uid,e=wpCookies.getHash(h)||{},g=new Date(),b,f=a.toString().replace(/[^A-Za-z0-9_]/,""),j=i.toString().replace(/[^A-Za-z0-9_]/,"");if(k){delete e[f]}else{e[f]=j}g.setTime(g.getTime()+31536000000);b=userSettings.url;wpCookies.setHash(h,e,g,b);wpCookies.set("wp-settings-time-"+userSettings.uid,userSettings.time,g,b);return a}function deleteUserSetting(a){return setUserSetting(a,"",1)}function getAllUserSettings(){if("object"!==typeof userSettings){return{}}return wpCookies.getHash("wp-settings-"+userSettings.uid)||{}};
\ No newline at end of file
diff --git a/wp-admin/js/widgets.dev.js b/wp-admin/js/widgets.dev.js
new file mode 100644 (file)
index 0000000..0fd0f97
--- /dev/null
@@ -0,0 +1,284 @@
+
+var wpWidgets;
+(function($) {
+
+wpWidgets = {
+       init : function() {
+        var rem;
+
+               if ( $('body').hasClass('widgets_access') ) {
+                       return;
+               }
+
+               $('#widgets-right div.sidebar-name').click(function(){
+            var c = $(this).siblings('.widgets-sortables');
+                       if ( c.is(':visible') ) {
+                               c.sortable('disable');
+                               $(this).parent().addClass('closed');
+                       } else {
+                               $(this).parent().removeClass('closed');
+                               c.sortable('enable').sortable('refresh');
+                       }
+        });
+
+        $('#widgets-left div.sidebar-name').click(function(){
+                       if ( $(this).siblings('.widget-holder').is(':visible') ) {
+                               $(this).parent().addClass('closed');
+                       } else {
+                               $(this).parent().removeClass('closed');
+                       }
+        });
+
+               $('#widgets-right .widget, #wp_inactive_widgets .widget').each(function(){
+                       wpWidgets.appendTitle(this);
+               });
+
+               this.addEvents();
+        $('.widget-error').parents('.widget').find('a.widget-action').click();
+
+               $('#available-widgets').droppable({
+                       tolerance: 'pointer',
+                       accept: function(o){
+                               return $(o).parent().attr('id') != 'widget-list';
+                       },
+                       drop: function(e,ui) {
+                               ui.draggable.addClass('deleting');
+                               $('#removing-widget').hide().children('span').html('');
+                       },
+                       over: function(e,ui) {
+                               ui.draggable.addClass('deleting');
+                               $('.widget-placeholder').hide();
+
+                               if ( ui.draggable.hasClass('ui-sortable-helper') )
+                                       $('#removing-widget').show().children('span').html( ui.draggable.find('.widget-title h4').html() );
+                       },
+                       out: function(e,ui) {
+                               ui.draggable.removeClass('deleting');
+                               $('.widget-placeholder').show();
+                               $('#removing-widget').hide().children('span').html('');
+                       }
+               });
+
+               $('#widget-list .widget').draggable({
+                       connectToSortable: '.widgets-sortables',
+                       handle: '.widget-title',
+                       distance: 2,
+                       helper: 'clone',
+                       zIndex: 5,
+                       containment: 'document',
+                       start: function(e,ui) {
+                               wpWidgets.fixWebkit(1);
+                               ui.helper.find('.widget-description').hide();
+                       },
+                       stop: function(e,ui) {
+                               if ( rem )
+                                       $(rem).hide();
+                               rem = '';
+                               wpWidgets.fixWebkit();
+                       }
+               });
+
+        $('.widgets-sortables').sortable({
+                       placeholder: 'widget-placeholder',
+                       connectWith: '.widgets-sortables',
+                       items: '.widget',
+                       handle: '.widget-title',
+                       cursor: 'move',
+                       distance: 2,
+                       containment: 'document',
+                       start: function(e,ui) {
+                               wpWidgets.fixWebkit(1);
+                               ui.item.find('.widget-inside').hide();
+                               ui.item.css({'marginLeft':'','width':''});
+                       },
+                       stop: function(e,ui) {
+                               if ( ui.item.hasClass('ui-draggable') )
+                                       ui.item.draggable('destroy');
+
+                               if ( ui.item.hasClass('deleting') ) {
+                                       wpWidgets.save( ui.item, 1, 0, 1 ); // delete widget
+                                       ui.item.remove();
+                                       return;
+                               }
+
+                               var add = ui.item.find('input.add_new').val(), n = ui.item.find('input.multi_number').val(), id = ui.item.attr('id'), sb = $(this).attr('id');
+
+                               ui.item.css({'marginLeft':'','width':''});
+                               wpWidgets.fixWebkit();
+                               if ( add ) {
+                                       if ( 'multi' == add ) {
+                                               ui.item.html( ui.item.html().replace(/<[^<>]+>/g, function(m){ return m.replace(/__i__|%i%/g, n); }) );
+                                               ui.item.attr( 'id', id.replace(/__i__|%i%/g, n) );
+                                               n++;
+                                               $('div#' + id).find('input.multi_number').val(n);
+                                       } else if ( 'single' == add ) {
+                                               ui.item.attr( 'id', 'new-' + id );
+                                               rem = 'div#' + id;
+                                       }
+                                       wpWidgets.addEvents(ui.item);
+                                       wpWidgets.save( ui.item, 0, 0, 1 );
+                                       ui.item.find('input.add_new').val('');
+                                       ui.item.find('a.widget-action').click();
+                                       return;
+                               }
+                               wpWidgets.saveOrder(sb);
+                       },
+                       receive: function(e,ui) {
+                               if ( !$(this).is(':visible') )
+                                       $(this).sortable('cancel');
+                       }
+               }).not(':visible').sortable('disable');
+               wpWidgets.resize();
+               wpWidgets.fixLabels();
+       },
+
+       saveOrder : function(sb) {
+               if ( sb )
+                       $('#' + sb).parents('.widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible');
+
+               var a = {
+                       action: 'widgets-order',
+                       savewidgets: $('#_wpnonce_widgets').val(),
+                       sidebars: []
+               };
+
+               $('.widgets-sortables').each( function() {
+                       a['sidebars[' + $(this).attr('id') + ']'] = $(this).sortable('toArray').join(',');
+               });
+
+               $.post( ajaxurl, a, function() {
+                       $('.ajax-feedback').css('visibility', 'hidden');
+               });
+               this.resize();
+       },
+
+       save : function(widget, del, animate, order) {
+               var sb = widget.parents('.widgets-sortables').attr('id'), data = widget.find('form').serialize(), a;
+               widget = $(widget);
+               widget.find('.ajax-feedback').css('visibility', 'visible');
+
+               a = {
+                       action: 'save-widget',
+                       savewidgets: $('#_wpnonce_widgets').val(),
+                       sidebar: sb
+               };
+
+               if ( del )
+                       a['delete_widget'] = 1;
+
+               data += '&' + $.param(a);
+
+               $.post( ajaxurl, data, function(r){
+                       var id;
+
+                       if ( del ) {
+                               if ( !$('.widget_number', widget).val() ) {
+                                       id = $('.widget-id', widget).val();
+                                       $('#available-widgets .widget-id').each(function(){
+                                               if ( $(this).val() == id )
+                                                       $(this).parents('.widget').show();
+                                       });
+                               }
+
+                               if ( animate ) {
+                                       order = 0;
+                                       widget.slideUp('fast', function(){
+                                               $(this).remove();
+                                               wpWidgets.saveOrder();
+                                       });
+                               } else {
+                                       widget.remove();
+                                       wpWidgets.resize();
+                               }
+                       } else {
+                               $('.ajax-feedback').css('visibility', 'hidden');
+                               if ( r && r.length > 2 ) {
+                                       $('.widget-content', widget).html(r);
+                                       wpWidgets.appendTitle(widget);
+                                       wpWidgets.fixLabels(widget);
+                               }
+                       }
+                       if ( order )
+                               wpWidgets.saveOrder();
+               });
+       },
+
+       appendTitle : function(widget) {
+               $('input[type="text"]', widget).each(function(){
+                       var title;
+                       if ( this.id.indexOf('title') != -1 ) {
+                               title = $(this).val().replace(/<[^<>]+>/g, '').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+                               if ( title )
+                                       $('.widget-title .in-widget-title', widget).html(': ' + title);
+                               return false;
+                       }
+               });
+       },
+
+       resize : function() {
+               $('.widgets-sortables').not('#wp_inactive_widgets').each(function(){
+                       var h = 50, H = $('.widget', this).length;
+                       h = h + parseInt(H * 48, 10);
+                       $(this).css( 'minHeight', h + 'px' );
+               });
+       },
+
+    fixWebkit : function(n) {
+        n = n ? 'none' : '';
+        $('body').css({
+                       WebkitUserSelect: n,
+                       KhtmlUserSelect: n
+               });
+    },
+    
+    fixLabels : function(sc) {
+               sc = sc || document;
+
+               $('.widget-inside label', sc).each(function(){
+                       var f = $(this).attr('for');
+
+                       if ( f && f == $('input', this).attr('id') )
+                               $(this).removeAttr('for');
+               });
+       },
+    
+    close : function(widget) {
+               widget.find('.widget-inside').slideUp('fast', function(){
+                       widget.css({'width':'','marginLeft':''});
+               });
+       },
+
+    addEvents : function(sc) {
+               sc = sc || document;
+               $('a.widget-action', sc).click(function(){
+            var w = parseInt( $(this).parents('.widget').find('.widget-width').val(), 10 ), css = {}, inside = $(this).parents('.widget-top').siblings('.widget-inside');
+                       if ( inside.is(':hidden') ) {
+                               if ( w > 250 && inside.parents('.widgets-sortables').length ) {
+                                       css['width'] = w + 30 + 'px';
+                                       if ( inside.parents('.widget-liquid-right').length )
+                                               css['marginLeft'] = 235 - w + 'px';
+                                       inside.parents('.widget').css(css);
+                               }
+                               inside.slideDown('fast');
+                       } else {
+                               inside.slideUp('fast', function(){ inside.parents('.widget').css({'width':'','marginLeft':''}); });
+                       }
+            return false;
+        });
+        $('.widget-control-save', sc).click(function(){
+                       wpWidgets.save( $(this).parents('.widget'), 0, 1, 0 );
+                       return false;
+               });
+               $('.widget-control-remove', sc).click(function(){
+                       wpWidgets.save( $(this).parents('.widget'), 1, 1, 0 );
+                       return false;
+               });
+               $('.widget-control-close', sc).click(function(){
+                       wpWidgets.close( $(this).parents('.widget') );
+                       return false;
+               });
+       }
+};
+$(document).ready(function(){wpWidgets.init();});
+
+})(jQuery);
index 1d2cca32ef007274aad2c0957f1b08cff844f2a6..60389f8992ca7e44ade7b182c9871335f6844b45 100644 (file)
@@ -1,150 +1 @@
-jQuery(function($) {
-       $('.noscript-action').remove();
-
-       var reminded = false;
-       var lameWidgetReminder = function() {
-               if ( reminded )
-                       return;
-               window.onbeforeunload = function () { return widgetsL10n.lamerReminder };
-               $('h2:first').after( '<div class="updated"><p>' + widgetsL10n.lameReminder + '</p></div>' );
-               $('#current-widgets .submit input[name=save-widgets]').css( 'background-color', '#ffffe0' ).click( function() {
-                       window.onbeforeunload = null;
-               } );
-               reminded = true;
-       };
-
-       var increment = 1;
-
-       // Open or close widget control form
-       var toggleWidget = function( li, disableFields ) {
-               var width = li.find('input.widget-width').val();
-
-               // it seems IE chokes on these animations because of the positioning/floating
-               var widgetAnim = $.browser.msie ? function() {
-                       var t = $(this);
-                       if ( t.is(':visible') ) {
-                               if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
-                               li.css( 'marginLeft', 0 );
-                               t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
-                       } else {
-                               t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
-                               if ( width > 250 )
-                                       li.css( 'marginLeft', ( width - 250 ) * -1 );
-                               t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
-                       }
-                       t.toggle();
-               } : function() {
-                       var t = $(this);
-
-                       if ( t.is(':visible') ) {
-                               if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
-                               if ( width > 250 )
-                                       li.animate( { marginLeft: 0 } );
-                               t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
-                       } else {
-                               t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
-                               if ( width > 250 )
-                                       li.animate( { marginLeft: ( width - 250 ) * -1 } );
-                               t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
-                       }
-                       t.animate( { height: 'toggle' } );
-               };
-
-               return li.children('div.widget-control').each( widgetAnim ).end();
-       };
-
-       // onclick for edit/cancel links
-       var editClick = function() {
-               var q = wpAjax.unserialize( this.href );
-               // if link is in available widgets list, make sure it points to the current sidebar
-               if ( ( q.sidebar && q.sidebar == $('#sidebar').val() ) || q.add ) {
-                       var w = q.edit || q.add;
-                       toggleWidget( $('#current-sidebar .widget-control-list input[@name^="widget-id"][@value=' + w + ']').parents('li:first'), false ).blur();
-                       return false;
-               } else if ( q.sidebar ) { // otherwise, redirect to correct page
-                       return true;
-               }
-
-               // If link is in current widgets list, just open the form
-               toggleWidget( $(this).parents('li:first'), true ).blur();
-               return false;
-       };
-
-       // onclick for add links
-       var addClick = function() {
-               var oldLi = $(this).parents('li:first').find('ul.widget-control-info li');
-               var newLi = oldLi.clone();
-
-               if ( newLi.html().match( /%i%/ ) ) {
-                       // supplid form is a template, replace %i% by unique id
-                       var i = $('#generated-time').val() + increment.toString();
-                       increment++;
-                       newLi.html( newLi.html().replace( /%i%/g, i ) );
-               } else {
-                       $(this).text( widgetsL10n.edit ).unbind().click( editClick );
-                       // save form content in textarea so we don't have any conflicting HTML ids
-                       oldLi.html( '<textarea>' + oldLi.html() + '</textarea>' );
-               }
-
-               // add event handlers
-               addWidgetControls( newLi );
-
-               // add widget to sidebar sortable
-               widgetSortable.append( newLi ).SortableAddItem( newLi[0] );
-
-               // increment widget counter
-               var n = parseInt( $('#widget-count').text(), 10 ) + 1;
-               $('#widget-count').text( n.toString() )
-
-               lameWidgetReminder();
-               return false;
-       };
-
-       // add event handlers to all links found in context
-       var addWidgetControls = function( context ) {
-               if ( !context )
-                       context = document;
-
-               $('a.widget-control-edit', context).click( editClick );
-
-               // onclick for save links
-               $('a.widget-control-save', context).click( function() {
-                       lameWidgetReminder();
-                       toggleWidget( $(this).parents('li:first'), false ).blur()
-                       return false;
-               } );
-
-               // onclick for remove links
-               $('a.widget-control-remove', context).click( function() {
-                       var w = $(this).parents('li:first').find('input[@name^="widget-id"]').val();
-                       $(this).parents('li:first').remove();
-                       var t = $('#widget-list ul#widget-control-info-' + w + ' textarea');
-                       t.parent().html( t.text() ).parents('li.widget-list-item:first').children( 'h4' ).children('a.widget-action')
-                               .show().text( widgetsL10n.add ).unbind().click( addClick );
-                       var n = parseInt( $('#widget-count').text(), 10 ) - 1;
-                       $('#widget-count').text( n.toString() )
-                       return false;
-               } );
-       }
-
-       addWidgetControls();
-
-       $('a.widget-control-add').click( addClick );
-
-       var widgetSortable;
-       var widgetSortableInit = function() {
-               try { // a hack to make sortables work in jQuery 1.2+ and IE7
-                       $('#current-sidebar .widget-control-list').SortableDestroy();
-               } catch(e) {}
-               widgetSortable = $('#current-sidebar .widget-control-list').Sortable( {
-                       accept: 'widget-sortable',
-                       helperclass: 'sorthelper',
-                       handle: 'h4.widget-title',
-                       onStop: widgetSortableInit
-               } );
-       }
-
-       // initialize sortable
-       widgetSortableInit();
-
-});
+var wpWidgets;(function(a){wpWidgets={init:function(){var b;if(a("body").hasClass("widgets_access")){return}a("#widgets-right div.sidebar-name").click(function(){var d=a(this).siblings(".widgets-sortables");if(d.is(":visible")){d.sortable("disable");a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed");d.sortable("enable").sortable("refresh")}});a("#widgets-left div.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});a("#widgets-right .widget, #wp_inactive_widgets .widget").each(function(){wpWidgets.appendTitle(this)});this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#available-widgets").droppable({tolerance:"pointer",accept:function(c){return a(c).parent().attr("id")!="widget-list"},drop:function(d,c){c.draggable.addClass("deleting");a("#removing-widget").hide().children("span").html("")},over:function(d,c){c.draggable.addClass("deleting");a(".widget-placeholder").hide();if(c.draggable.hasClass("ui-sortable-helper")){a("#removing-widget").show().children("span").html(c.draggable.find(".widget-title h4").html())}},out:function(d,c){c.draggable.removeClass("deleting");a(".widget-placeholder").show();a("#removing-widget").hide().children("span").html("")}});a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.helper.find(".widget-description").hide()},stop:function(d,c){if(b){a(b).hide()}b="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(".widget-inside").hide();c.item.css({marginLeft:"",width:""})},stop:function(f,c){if(c.item.hasClass("ui-draggable")){c.item.draggable("destroy")}if(c.item.hasClass("deleting")){wpWidgets.save(c.item,1,0,1);c.item.remove();return}var d=c.item.find("input.add_new").val(),i=c.item.find("input.multi_number").val(),h=c.item.attr("id"),g=a(this).attr("id");c.item.css({marginLeft:"",width:""});wpWidgets.fixWebkit();if(d){if("multi"==d){c.item.html(c.item.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,i)}));c.item.attr("id",h.replace(/__i__|%i%/g,i));i++;a("div#"+h).find("input.multi_number").val(i)}else{if("single"==d){c.item.attr("id","new-"+h);b="div#"+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item,0,0,1);c.item.find("input.add_new").val("");c.item.find("a.widget-action").click();return}wpWidgets.saveOrder(g)},receive:function(d,c){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable");wpWidgets.resize();wpWidgets.fixLabels()},saveOrder:function(c){if(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible")}var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")});this.resize()},save:function(g,d,e,b){var h=g.parents(".widgets-sortables").attr("id"),f=g.find("form").serialize(),c;g=a(g);g.find(".ajax-feedback").css("visibility","visible");c={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:h};if(d){c.delete_widget=1}f+="&"+a.param(c);a.post(ajaxurl,f,function(i){var j;if(d){if(!a(".widget_number",g).val()){j=a(".widget-id",g).val();a("#available-widgets .widget-id").each(function(){if(a(this).val()==j){a(this).parents(".widget").show()}})}if(e){b=0;g.slideUp("fast",function(){a(this).remove();wpWidgets.saveOrder()})}else{g.remove();wpWidgets.resize()}}else{a(".ajax-feedback").css("visibility","hidden");if(i&&i.length>2){a(".widget-content",g).html(i);wpWidgets.appendTitle(g);wpWidgets.fixLabels(g)}}if(b){wpWidgets.saveOrder()}})},appendTitle:function(b){a('input[type="text"]',b).each(function(){var c;if(this.id.indexOf("title")!=-1){c=a(this).val().replace(/<[^<>]+>/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;");if(c){a(".widget-title .in-widget-title",b).html(": "+c)}return false}})},resize:function(){a(".widgets-sortables").not("#wp_inactive_widgets").each(function(){var c=50,b=a(".widget",this).length;c=c+parseInt(b*48,10);a(this).css("minHeight",c+"px")})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},fixLabels:function(b){b=b||document;a(".widget-inside label",b).each(function(){var c=a(this).attr("for");if(c&&c==a("input",this).attr("id")){a(this).removeAttr("for")}})},close:function(b){b.find(".widget-inside").slideUp("fast",function(){b.css({width:"",marginLeft:""})})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=235-d+"px"}c.parents(".widget").css(e)}c.slideDown("fast")}else{c.slideUp("fast",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents(".widget"),0,1,0);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents(".widget"),1,1,0);return false});a(".widget-control-close",b).click(function(){wpWidgets.close(a(this).parents(".widget"));return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/js/word-count.dev.js b/wp-admin/js/word-count.dev.js
new file mode 100644 (file)
index 0000000..27aae3c
--- /dev/null
@@ -0,0 +1,39 @@
+// Word count
+(function($) {
+       wpWordCount = {
+
+               init : function() {
+                       var t = this, last = 0, co = $('#content');
+
+                       $('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
+                       t.block = 0;
+                       t.wc(co.val());
+                       co.keyup( function(e) {
+                               if ( e.keyCode == last ) return true;
+                               if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
+                               last = e.keyCode;
+                               return true;
+                       });
+               },
+
+               wc : function(tx) {
+                       var t = this, w = $('#word-count'), tc = 0;
+
+                       if ( t.block ) return;
+                       t.block = 1;
+
+                       setTimeout( function() {
+                               if ( tx ) {
+                                       tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( /&nbsp;|&#160;/gi, ' ' );
+                                       tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' );
+                                       tx.replace( /\S\s+/g, function(){tc++;} );
+                               }
+                               w.html(tc.toString());
+
+                               setTimeout( function() { t.block = 0; }, 2000 );
+                       }, 1 );
+               }
+       }
+
+       $(document).ready( function(){ wpWordCount.init(); } );
+}(jQuery));
index 474056e990ae4d90e71f3e21b661f70ea2ef6326..8c935d4175d6acb9d1129ce9203ced52130e1c68 100644 (file)
@@ -1,39 +1 @@
-// Word count
-(function(JQ) {
-       wpWordCount = {
-
-               init : function() {
-                       var t = this, last = 0, co = JQ('#content');
-
-                       JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
-                       t.block = 0;
-                       t.wc(co.val());
-                       co.keyup( function(e) {
-                               if ( e.keyCode == last ) return true;
-                               if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
-                               last = e.keyCode;
-                               return true;
-                       });
-               },
-
-               wc : function(tx) {
-                       var t = this, w = JQ('#word-count'), tc = 0;
-
-                       if ( t.block ) return;
-                       t.block = 1;
-
-                       setTimeout( function() {
-                               if ( tx ) {
-                                       tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( /&nbsp;/gi, ' ' );
-                                       tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' );
-                                       tx.replace( /\S\s+/g, function(){tc++;} );
-                               }
-                               w.html(tc.toString());
-
-                               setTimeout( function() { t.block = 0; }, 2000 );
-                       }, 1 );
-               }
-       }
-}(jQuery));
-
-jQuery(document).ready( function(){ wpWordCount.init(); } );
+(function(a){wpWordCount={init:function(){var b=this,c=0,d=a("#content");a("#wp-word-count").html(wordCountL10n.count.replace(/%d/,'<span id="word-count">0</span>'));b.block=0;b.wc(d.val());d.keyup(function(f){if(f.keyCode==c){return true}if(13==f.keyCode||8==c||46==c){b.wc(d.val())}c=f.keyCode;return true})},wc:function(d){var e=this,c=a("#word-count"),b=0;if(e.block){return}e.block=1;setTimeout(function(){if(d){d=d.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ");d=d.replace(/[0-9.(),;:!?%#$¿'"_+=\\/-]*/g,"");d.replace(/\S\s+/g,function(){b++})}c.html(b.toString());setTimeout(function(){e.block=0},2000)},1)}};a(document).ready(function(){wpWordCount.init()})}(jQuery));
\ No newline at end of file
diff --git a/wp-admin/js/wp-gears.dev.js b/wp-admin/js/wp-gears.dev.js
new file mode 100644 (file)
index 0000000..3e9519c
--- /dev/null
@@ -0,0 +1,96 @@
+
+var wpGears = {
+
+       createStore : function() {
+               if ( 'undefined' == typeof google || ! google.gears ) return;
+
+               if ( 'undefined' == typeof localServer )
+                       localServer = google.gears.factory.create("beta.localserver");
+
+               store = localServer.createManagedStore(this.storeName());
+               store.manifestUrl = "gears-manifest.php";
+               store.checkForUpdate();
+               this.message(3);
+       },
+
+       getPermission : function() {
+               var perm = true;
+
+               if ( 'undefined' != typeof google && google.gears ) {
+                       if ( ! google.gears.factory.hasPermission )
+                               perm = google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
+
+                       if ( perm )
+                               try { this.createStore(); } catch(e) { this.message(); } // silence if canceled
+                       else
+                               this.message(4);
+               }
+       },
+
+       storeName : function() {
+               var name = window.location.protocol + window.location.host;
+
+               name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
+               name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
+
+               return name;
+       },
+
+       message : function(show) {
+               var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), msg4 = t.I('gears-msg4'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
+
+               if ( ! msg1 ) return;
+
+               if ( 'undefined' != typeof google && google.gears ) {
+                       if ( show && show == 4 ) {
+                               msg1.style.display = msg2.style.display = msg3.style.display = 'none';
+                               msg4.style.display = 'block';
+                       } else if ( google.gears.factory.hasPermission ) {
+                               msg1.style.display = msg2.style.display = msg4.style.display = 'none';
+                               msg3.style.display = 'block';
+
+                               if ( 'undefined' == typeof store )
+                                       t.createStore();
+
+                               store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);};
+                               store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
+                               store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
+                       } else {
+                               msg1.style.display = msg3.style.display = msg4.style.display = 'none';
+                               msg2.style.display = 'block';
+                       }
+               }
+       },
+
+       I : function(id) {
+               return document.getElementById(id);
+       }
+};
+
+(function() {
+       if ( 'undefined' != typeof google && google.gears ) return;
+
+       var gf = false;
+       if ( 'undefined' != typeof GearsFactory ) {
+               gf = new GearsFactory();
+       } else {
+               try {
+                       gf = new ActiveXObject('Gears.Factory');
+                       if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
+                               gf.privateSetGlobalObject(this);
+               } catch (e) {
+                       if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
+                               gf = document.createElement("object");
+                               gf.style.display = "none";
+                               gf.width = 0;
+                               gf.height = 0;
+                               gf.type = "application/x-googlegears";
+                               document.documentElement.appendChild(gf);
+                       }
+               }
+       }
+
+       if ( ! gf ) return;
+       if ( 'undefined' == typeof google ) google = {};
+       if ( ! google.gears ) google.gears = { factory : gf };
+})();
index 0509373ef12b2abe269c14a9a64b5ce4ebf4bca2..375234c44d76778ddf61eca9138f109ef0296bcb 100644 (file)
@@ -1,96 +1 @@
-
-wpGears = {
-
-       createStore : function() {
-               if ( 'undefined' == typeof google || ! google.gears ) return;
-
-               if ( 'undefined' == typeof localServer )
-                       localServer = google.gears.factory.create("beta.localserver");
-
-               store = localServer.createManagedStore(this.storeName());
-               store.manifestUrl = "gears-manifest.php";
-               store.checkForUpdate();
-               this.message(3);
-       },
-
-       getPermission : function() {
-               var perm = true;
-
-               if ( 'undefined' != typeof google && google.gears ) {
-                       if ( ! google.gears.factory.hasPermission )
-                               perm = google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
-
-                       if ( perm )
-                               try { this.createStore(); } catch(e) { this.message(); } // silence if canceled
-                       else
-                               this.message(4);
-               }
-       },
-
-       storeName : function() {
-               var name = window.location.protocol + window.location.host;
-
-               name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
-               name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
-
-               return name;
-       },
-
-       message : function(show) {
-               var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), msg4 = t.I('gears-msg4'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
-
-               if ( ! msg1 ) return;
-
-               if ( 'undefined' != typeof google && google.gears ) {
-                       if ( show && show == 4 ) {
-                               msg1.style.display = msg2.style.display = msg3.style.display = 'none';
-                               msg4.style.display = 'block';
-                       } else if ( google.gears.factory.hasPermission ) {
-                               msg1.style.display = msg2.style.display = msg4.style.display = 'none';
-                               msg3.style.display = 'block';
-
-                               if ( 'undefined' == typeof store )
-                                       t.createStore();
-
-                               store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);};
-                               store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
-                               store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
-                       } else {
-                               msg1.style.display = msg3.style.display = msg4.style.display = 'none';
-                               msg2.style.display = 'block';
-                       }
-               }
-       },
-
-       I : function(id) {
-               return document.getElementById(id);
-       }
-};
-
-(function() {
-       if ( 'undefined' != typeof google && google.gears ) return;
-
-       var gf = false;
-       if ( 'undefined' != typeof GearsFactory ) {
-               gf = new GearsFactory();
-       } else {
-               try {
-                       gf = new ActiveXObject('Gears.Factory');
-                       if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
-                               gf.privateSetGlobalObject(this);
-               } catch (e) {
-                       if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
-                               gf = document.createElement("object");
-                               gf.style.display = "none";
-                               gf.width = 0;
-                               gf.height = 0;
-                               gf.type = "application/x-googlegears";
-                               document.documentElement.appendChild(gf);
-                       }
-               }
-       }
-
-       if ( ! gf ) return;
-       if ( 'undefined' == typeof google ) google = {};
-       if ( ! google.gears ) google.gears = { factory : gf };
-})();
+var wpGears={createStore:function(){if("undefined"==typeof google||!google.gears){return}if("undefined"==typeof localServer){localServer=google.gears.factory.create("beta.localserver")}store=localServer.createManagedStore(this.storeName());store.manifestUrl="gears-manifest.php";store.checkForUpdate();this.message(3)},getPermission:function(){var a=true;if("undefined"!=typeof google&&google.gears){if(!google.gears.factory.hasPermission){a=google.gears.factory.getPermission("WordPress","images/logo.gif")}if(a){try{this.createStore()}catch(b){this.message()}}else{this.message(4)}}},storeName:function(){var a=window.location.protocol+window.location.host;a=a.replace(/[\/\\:*"?<>|;,]+/g,"_");a="wp_"+a.substring(0,60);return a},message:function(a){var d=this,g=d.I("gears-msg1"),f=d.I("gears-msg2"),e=d.I("gears-msg3"),c=d.I("gears-msg4"),b=d.I("gears-upd-number"),h=d.I("gears-wait");if(!g){return}if("undefined"!=typeof google&&google.gears){if(a&&a==4){g.style.display=f.style.display=e.style.display="none";c.style.display="block"}else{if(google.gears.factory.hasPermission){g.style.display=f.style.display=c.style.display="none";e.style.display="block";if("undefined"==typeof store){d.createStore()}store.oncomplete=function(){h.innerHTML=(" "+wpGearsL10n.updateCompleted)};store.onerror=function(){h.innerHTML=(" "+wpGearsL10n.error+" "+store.lastErrorMessage)};store.onprogress=function(i){if(b){b.innerHTML=(" "+i.filesComplete+" / "+i.filesTotal)}}}else{g.style.display=e.style.display=c.style.display="none";f.style.display="block"}}}},I:function(a){return document.getElementById(a)}};(function(){if("undefined"!=typeof google&&google.gears){return}var a=false;if("undefined"!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(factory.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if(("undefined"!=typeof navigator.mimeTypes)&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(!a){return}if("undefined"==typeof google){google={}}if(!google.gears){google.gears={factory:a}}})();
\ No newline at end of file
diff --git a/wp-admin/js/xfn.dev.js b/wp-admin/js/xfn.dev.js
new file mode 100644 (file)
index 0000000..fdb5969
--- /dev/null
@@ -0,0 +1,41 @@
+function GetElementsWithClassName(elementName, className) {
+       var allElements = document.getElementsByTagName(elementName), elemColl = new Array(), i;
+       for (i = 0; i < allElements.length; i++) {
+               if (allElements[i].className == className) {
+                       elemColl[elemColl.length] = allElements[i];
+               }
+       }
+       return elemColl;
+}
+
+function meChecked() {
+       var undefined, eMe = document.getElementById('me');
+       if (eMe == undefined) return false;
+       else return eMe.checked;
+}
+
+function upit() {
+       var isMe = meChecked(), inputColl = GetElementsWithClassName('input', 'valinp'), results = document.getElementById('link_rel'), inputs = '', i;
+       for (i = 0; i < inputColl.length; i++) {
+                inputColl[i].disabled = isMe;
+                inputColl[i].parentNode.className = isMe ? 'disabled' : '';
+                if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
+                       inputs += inputColl[i].value + ' ';
+                               }
+                }
+       inputs = inputs.substr(0,inputs.length - 1);
+       if (isMe) inputs='me';
+       results.value = inputs;
+       }
+
+function blurry() {
+       if (!document.getElementById) return;
+
+       var aInputs = document.getElementsByTagName('input'), i;
+
+       for ( i = 0; i < aInputs.length; i++) {
+                aInputs[i].onclick = aInputs[i].onkeyup = upit;
+       }
+}
+
+addLoadEvent(blurry);
\ No newline at end of file
index 2fe41eb14f82e9537c26f91f905e167782ab6653..d37a80af91b5d7e2e0405fa6e36f8b84b775a80c 100644 (file)
@@ -1,46 +1 @@
-function GetElementsWithClassName(elementName, className) {
-       var allElements = document.getElementsByTagName(elementName);
-       var elemColl = new Array();
-       for (i = 0; i < allElements.length; i++) {
-               if (allElements[i].className == className) {
-                       elemColl[elemColl.length] = allElements[i];
-               }
-       }
-       return elemColl;
-}
-
-function meChecked() {
-       var undefined;
-       var eMe = document.getElementById('me');
-       if (eMe == undefined) return false;
-       else return eMe.checked;
-}
-
-function upit() {
-       var isMe = meChecked(); //document.getElementById('me').checked;
-       var inputColl = GetElementsWithClassName('input', 'valinp');
-       var results = document.getElementById('link_rel');
-       var linkText, linkUrl, inputs = '';
-       for (i = 0; i < inputColl.length; i++) {
-                inputColl[i].disabled = isMe;
-                inputColl[i].parentNode.className = isMe ? 'disabled' : '';
-                if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
-                       inputs += inputColl[i].value + ' ';
-                               }
-                }
-       inputs = inputs.substr(0,inputs.length - 1);
-       if (isMe) inputs='me';
-       results.value = inputs;
-       }
-
-function blurry() {
-       if (!document.getElementById) return;
-
-       var aInputs = document.getElementsByTagName('input');
-
-       for (var i = 0; i < aInputs.length; i++) {
-                aInputs[i].onclick = aInputs[i].onkeyup = upit;
-       }
-}
-
-addLoadEvent(blurry);
\ No newline at end of file
+function GetElementsWithClassName(a,c){var d=document.getElementsByTagName(a),e=new Array(),b;for(b=0;b<d.length;b++){if(d[b].className==c){e[e.length]=d[b]}}return e}function meChecked(){var b,a=document.getElementById("me");if(a==b){return false}else{return a.checked}}function upit(){var b=meChecked(),e=GetElementsWithClassName("input","valinp"),d=document.getElementById("link_rel"),a="",c;for(c=0;c<e.length;c++){e[c].disabled=b;e[c].parentNode.className=b?"disabled":"";if(!b&&e[c].checked&&e[c].value!=""){a+=e[c].value+" "}}a=a.substr(0,a.length-1);if(b){a="me"}d.value=a}function blurry(){if(!document.getElementById){return}var b=document.getElementsByTagName("input"),a;for(a=0;a<b.length;a++){b[a].onclick=b[a].onkeyup=upit}}addLoadEvent(blurry);
\ No newline at end of file
index 7638ece93bdb41ba82901a08fdca670e188b924d..b28109e6cc90d84a92c64e0faccac0d5bb93b2d3 100644 (file)
@@ -71,16 +71,16 @@ switch ($order_by) {
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
 
 <div class="wrap nosubsub">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( stripslashes($_GET['s']) ) ); ?>
 </h2>
 
 <?php
 if ( isset($_GET['deleted']) ) {
        echo '<div id="message" class="updated fade"><p>';
        $deleted = (int) $_GET['deleted'];
 </h2>
 
 <?php
 if ( isset($_GET['deleted']) ) {
        echo '<div id="message" class="updated fade"><p>';
        $deleted = (int) $_GET['deleted'];
-       printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
+       printf(_n('%s link deleted.', '%s links deleted', $deleted), $deleted);
        echo '</p></div>';
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
 }
        echo '</p></div>';
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
 }
@@ -88,9 +88,9 @@ if ( isset($_GET['deleted']) ) {
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
-       <label class="hidden" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label>
-       <input type="text" class="search-input" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
+       <label class="screen-reader-text" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label>
+       <input type="text" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Links' ); ?>" class="button" />
 </p>
 </form>
 <br class="clear" />
 </p>
 </form>
 <br class="clear" />
@@ -103,14 +103,14 @@ if ( isset($_GET['deleted']) ) {
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 
 <?php
 $categories = get_terms('link_category', "hide_empty=1");
 $select_cat = "<select name=\"cat_id\">\n";
 $select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
 foreach ((array) $categories as $cat)
 
 <?php
 $categories = get_terms('link_category', "hide_empty=1");
 $select_cat = "<select name=\"cat_id\">\n";
 $select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
 foreach ((array) $categories as $cat)
-       $select_cat .= '<option value="' . $cat->term_id . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . sanitize_term_field('name', $cat->name, $cat->term_id, 'link_category', 'display') . "</option>\n";
+       $select_cat .= '<option value="' . esc_attr($cat->term_id) . '"' . (($cat->term_id == $cat_id) ? " selected='selected'" : '') . '>' . sanitize_term_field('name', $cat->name, $cat->term_id, 'link_category', 'display') . "</option>\n";
 $select_cat .= "</select>\n";
 
 $select_order = "<select name=\"order_by\">\n";
 $select_cat .= "</select>\n";
 
 $select_order = "<select name=\"order_by\">\n";
@@ -124,7 +124,7 @@ echo $select_cat;
 echo $select_order;
 
 ?>
 echo $select_order;
 
 ?>
-<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
+<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
 
 </div>
 
 
 </div>
 
@@ -165,15 +165,16 @@ if ( $links ) {
 
        foreach ($links as $link) {
                $link = sanitize_bookmark($link);
 
        foreach ($links as $link) {
                $link = sanitize_bookmark($link);
-               $link->link_name = attribute_escape($link->link_name);
+               $link->link_name = esc_attr($link->link_name);
                $link->link_category = wp_get_link_cats($link->link_id);
                $short_url = str_replace('http://', '', $link->link_url);
                $link->link_category = wp_get_link_cats($link->link_id);
                $short_url = str_replace('http://', '', $link->link_url);
-               $short_url = preg_replace('/^www./i', '', $short_url);
+               $short_url = preg_replace('/^www\./i', '', $short_url);
                if ('/' == substr($short_url, -1))
                        $short_url = substr($short_url, 0, -1);
                if (strlen($short_url) > 35)
                        $short_url = substr($short_url, 0, 32).'...';
                $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
                if ('/' == substr($short_url, -1))
                        $short_url = substr($short_url, 0, -1);
                if (strlen($short_url) > 35)
                        $short_url = substr($short_url, 0, 32).'...';
                $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
+               $rating  = $link->link_rating;
                $style = ($alt % 2) ? '' : ' class="alternate"';
                ++ $alt;
                $edit_link = get_edit_bookmark_link();
                $style = ($alt % 2) ? '' : ' class="alternate"';
                ++ $alt;
                $edit_link = get_edit_bookmark_link();
@@ -184,20 +185,19 @@ if ( $links ) {
                        $style = '';
                        if ( in_array($column_name, $hidden) )
                                $style = ' style="display:none;"';
                        $style = '';
                        if ( in_array($column_name, $hidden) )
                                $style = ' style="display:none;"';
-                       if ( 'visible' == $column_name )
-                               $style = empty($style) ? ' style="text-align: center;"' : ' style="text-align: center; display: none;"';
+
                        $attributes = "$class$style";
 
                        switch($column_name) {
                                case 'cb':
                        $attributes = "$class$style";
 
                        switch($column_name) {
                                case 'cb':
-                                       echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></th>';
+                                       echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'. esc_attr($link->link_id) .'" /></th>';
                                        break;
                                case 'name':
 
                                        break;
                                case 'name':
 
-                                       echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $link->link_name)) . "'>$link->link_name</a></strong><br />";
+                                       echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $link->link_name)) . "'>$link->link_name</a></strong><br />";
                                        $actions = array();
                                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
                                        $actions = array();
                                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
-                                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+                                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . esc_js(sprintf( __("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
                                        $action_count = count($actions);
                                        $i = 0;
                                        echo '<div class="row-actions">';
                                        $action_count = count($actions);
                                        $i = 0;
                                        echo '<div class="row-actions">';
@@ -228,11 +228,14 @@ if ( $links ) {
                                        ?></td><?php
                                        break;
                                case 'rel':
                                        ?></td><?php
                                        break;
                                case 'rel':
-                                       ?><td <?php echo $attributes ?>><?php echo $link->link_rel; ?></td><?php
+                                       ?><td <?php echo $attributes ?>><?php echo empty($link->link_rel) ? '<br />' : $link->link_rel; ?></td><?php
                                        break;
                                case 'visible':
                                        ?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
                                        break;
                                        break;
                                case 'visible':
                                        ?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
                                        break;
+                               case 'rating':
+                                       ?><td <?php echo $attributes ?>><?php echo $rating; ?></td><?php
+                                       break;
                                default:
                                        ?>
                                        <td><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
                                default:
                                        ?>
                                        <td><?php do_action('manage_link_custom_column', $column_name, $link->link_id); ?></td>
@@ -258,7 +261,7 @@ if ( $links ) {
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
 <br class="clear" />
 </div>
 
 <br class="clear" />
@@ -270,20 +273,5 @@ if ( $links ) {
 
 </div>
 
 
 </div>
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected links.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       }
-               });
-       });
-})(jQuery);
-columns.init('link-manager');
-/* ]]> */
-</script>
-
-<?php include('admin-footer.php'); ?>
+<?php
+include('admin-footer.php');
diff --git a/wp-admin/load-scripts.php b/wp-admin/load-scripts.php
new file mode 100644 (file)
index 0000000..957a8cb
--- /dev/null
@@ -0,0 +1,142 @@
+<?php
+
+/**
+ * Disable error reporting
+ *
+ * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
+ */
+error_reporting(0);
+
+/** Set ABSPATH for execution */
+define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
+define( 'WPINC', 'wp-includes' );
+
+/**
+ * @ignore
+ */
+function __() {}
+
+/**
+ * @ignore
+ */
+function _c() {}
+
+/**
+ * @ignore
+ */
+function _x() {}
+
+
+/**
+ * @ignore
+ */
+function add_filter() {}
+
+/**
+ * @ignore
+ */
+function esc_attr() {}
+
+/**
+ * @ignore
+ */
+function apply_filters() {}
+
+/**
+ * @ignore
+ */
+function get_option() {}
+
+/**
+ * @ignore
+ */
+function is_lighttpd_before_150() {}
+
+/**
+ * @ignore
+ */
+function add_action() {}
+
+/**
+ * @ignore
+ */
+function do_action_ref_array() {}
+
+/**
+ * @ignore
+ */
+function get_bloginfo() {}
+
+/**
+ * @ignore
+ */
+function is_admin() {return true;}
+
+/**
+ * @ignore
+ */
+function site_url() {}
+
+/**
+ * @ignore
+ */
+function admin_url() {}
+
+/**
+ * @ignore
+ */
+function wp_guess_url() {}
+
+function get_file($path) {
+
+       if ( function_exists('realpath') )
+               $path = realpath($path);
+
+       if ( ! $path || ! @is_file($path) )
+               return '';
+
+       return @file_get_contents($path);
+}
+
+$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
+$load = explode(',', $load);
+
+if ( empty($load) )
+       exit;
+
+require(ABSPATH . WPINC . '/script-loader.php');
+require(ABSPATH . WPINC . '/version.php');
+
+$compress = ( isset($_GET['c']) && $_GET['c'] );
+$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
+$expires_offset = 31536000;
+$out = '';
+
+$wp_scripts = new WP_Scripts();
+wp_default_scripts($wp_scripts);
+
+foreach( $load as $handle ) {
+       if ( !array_key_exists($handle, $wp_scripts->registered) )
+               continue;
+
+       $path = ABSPATH . $wp_scripts->registered[$handle]->src;
+       $out .= get_file($path) . "\n";
+}
+
+header('Content-Type: application/x-javascript; charset=UTF-8');
+header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
+header("Cache-Control: public, max-age=$expires_offset");
+
+if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
+       header('Vary: Accept-Encoding'); // Handle proxies
+       if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
+               header('Content-Encoding: deflate');
+               $out = gzdeflate( $out, 3 );
+       } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
+               header('Content-Encoding: gzip');
+               $out = gzencode( $out, 3 );
+       }
+}
+
+echo $out;
+exit;
diff --git a/wp-admin/load-styles.php b/wp-admin/load-styles.php
new file mode 100644 (file)
index 0000000..9358427
--- /dev/null
@@ -0,0 +1,152 @@
+<?php
+
+/**
+ * Disable error reporting
+ *
+ * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
+ */
+error_reporting(0);
+
+/** Set ABSPATH for execution */
+define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
+define( 'WPINC', 'wp-includes' );
+
+/**
+ * @ignore
+ */
+function __() {}
+
+/**
+ * @ignore
+ */
+function _c() {}
+
+/**
+ * @ignore
+ */
+function _x() {}
+
+
+/**
+ * @ignore
+ */
+function add_filter() {}
+
+/**
+ * @ignore
+ */
+function esc_attr() {}
+
+/**
+ * @ignore
+ */
+function apply_filters() {}
+
+/**
+ * @ignore
+ */
+function get_option() {}
+
+/**
+ * @ignore
+ */
+function is_lighttpd_before_150() {}
+
+/**
+ * @ignore
+ */
+function add_action() {}
+
+/**
+ * @ignore
+ */
+function do_action_ref_array() {}
+
+/**
+ * @ignore
+ */
+function get_bloginfo() {}
+
+/**
+ * @ignore
+ */
+function is_admin() {return true;}
+
+/**
+ * @ignore
+ */
+function site_url() {}
+
+/**
+ * @ignore
+ */
+function admin_url() {}
+
+/**
+ * @ignore
+ */
+function wp_guess_url() {}
+
+function get_file($path) {
+
+       if ( function_exists('realpath') )
+               $path = realpath($path);
+
+       if ( ! $path || ! @is_file($path) )
+               return '';
+
+       return @file_get_contents($path);
+}
+
+require(ABSPATH . '/wp-includes/script-loader.php');
+require(ABSPATH . '/wp-includes/version.php');
+
+$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
+$load = explode(',', $load);
+
+if ( empty($load) )
+       exit;
+
+$compress = ( isset($_GET['c']) && $_GET['c'] );
+$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
+$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
+$expires_offset = 31536000;
+$out = '';
+
+$wp_styles = new WP_Styles();
+wp_default_styles($wp_styles);
+
+foreach( $load as $handle ) {
+       if ( !array_key_exists($handle, $wp_styles->registered) )
+               continue;
+
+       $style = $wp_styles->registered[$handle];
+       $path = ABSPATH . $style->src;
+
+       $content = get_file($path) . "\n";
+
+       if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) {
+               $rtl_path = is_bool($style->extra['rtl']) ? str_replace( '.css', '-rtl.css', $path ) : ABSPATH . $style->extra['rtl'];
+               $content .= get_file($rtl_path) . "\n";
+       }
+
+       $out .= str_replace( '../images/', 'images/', $content );
+}
+
+header('Content-Type: text/css');
+header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
+header("Cache-Control: public, max-age=$expires_offset");
+
+if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
+       header('Vary: Accept-Encoding'); // Handle proxies
+       if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
+               header('Content-Encoding: deflate');
+               $out = gzdeflate( $out, 3 );
+       } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
+               header('Content-Encoding: gzip');
+               $out = gzencode( $out, 3 );
+       }
+}
+
+echo $out;
+exit;
index 9ba2268f7055a0da18afbf8b1cd93ffe71b7cdc8..ccb364e00f0d6745044c4da30f3f313cfb2541ff 100644 (file)
@@ -15,9 +15,7 @@ require_once('admin.php');
 if (!current_user_can('upload_files'))
        wp_die(__('You do not have permission to upload files.'));
 
 if (!current_user_can('upload_files'))
        wp_die(__('You do not have permission to upload files.'));
 
-wp_enqueue_script('swfupload');
-wp_enqueue_script('swfupload-swfobject');
-wp_enqueue_script('swfupload-queue');
+wp_enqueue_script('swfupload-all');
 wp_enqueue_script('swfupload-handlers');
 
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 wp_enqueue_script('swfupload-handlers');
 
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
@@ -57,7 +55,7 @@ if ( isset($_GET['inline']) ) {
        require_once('admin-header.php'); ?>
        <div class="wrap">
        <?php screen_icon(); ?>
        require_once('admin-header.php'); ?>
        <div class="wrap">
        <?php screen_icon(); ?>
-       <h2><?php echo wp_specialchars( $title ); ?></h2>
+       <h2><?php echo esc_html( $title ); ?></h2>
 
        <form enctype="multipart/form-data" method="post" action="media-upload.php?inline=&amp;upload-page-form=" class="media-upload-form type-form validate" id="file-form">
 
 
        <form enctype="multipart/form-data" method="post" action="media-upload.php?inline=&amp;upload-page-form=" class="media-upload-form type-form validate" id="file-form">
 
@@ -78,7 +76,7 @@ if ( isset($_GET['inline']) ) {
        <?php wp_nonce_field('media-form'); ?>
        <div id="media-items"> </div>
        <p>
        <?php wp_nonce_field('media-form'); ?>
        <div id="media-items"> </div>
        <p>
-       <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
+       <input type="submit" class="button savebutton" name="save" value="<?php esc_attr_e( 'Save all changes' ); ?>" />
        </p>
        </form>
        </div>
        </p>
        </form>
        </div>
index 906238f7d0bcc8694900685f2df79fe25ab78a2c..e31baf2d5e5bed5df3b0418efb665ba36c4010a8 100644 (file)
@@ -61,7 +61,6 @@ case 'edit' :
        add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
 
        wp_enqueue_script( 'wp-ajax-response' );
        add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
 
        wp_enqueue_script( 'wp-ajax-response' );
-//     wp_admin_css( 'media' );
 
        require( 'admin-header.php' );
 
 
        require( 'admin-header.php' );
 
@@ -85,7 +84,7 @@ case 'edit' :
 <?php screen_icon(); ?>
 <h2><?php _e( 'Edit Media' ); ?></h2>
 
 <?php screen_icon(); ?>
 <h2><?php _e( 'Edit Media' ); ?></h2>
 
-<form method="post" action="<?php echo clean_url( remove_query_arg( 'message' ) ); ?>" class="media-upload-form" id="media-single-form">
+<form method="post" action="<?php echo esc_url( remove_query_arg( 'message' ) ); ?>" class="media-upload-form" id="media-single-form">
 <div class="media-single">
 <div id='media-item-<?php echo $att_id; ?>' class='media-item'>
 <?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => $errors ) ); ?>
 <div class="media-single">
 <div id='media-item-<?php echo $att_id; ?>' class='media-item'>
 <?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => $errors ) ); ?>
@@ -93,9 +92,9 @@ case 'edit' :
 </div>
 
 <p class="submit">
 </div>
 
 <p class="submit">
-<input type="submit" class="button-primary" name="save" value="<?php _e('Update Media'); ?>" />
-<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
-<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $att_id; ?>" />
+<input type="submit" class="button-primary" name="save" value="<?php esc_attr_e('Update Media'); ?>" />
+<input type="hidden" name="post_id" id="post_id" value="<?php echo isset($post_id) ? esc_attr($post_id) : ''; ?>" />
+<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($att_id); ?>" />
 <input type="hidden" name="action" value="editattachment" />
 <?php wp_original_referer_field(true, 'previous'); ?>
 <?php wp_nonce_field('media-form'); ?>
 <input type="hidden" name="action" value="editattachment" />
 <?php wp_original_referer_field(true, 'previous'); ?>
 <?php wp_nonce_field('media-form'); ?>
index c6482ce152c459373e3d2b7bd0d7627597210c78..1f652455e8bed19d2ff7484beec92b7e5ff0cd60 100644 (file)
@@ -61,32 +61,32 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                $img = '';
                if ( isset($item[6]) && ! empty($item[6]) ) {
                        if ( 'div' === $item[6] )
                $img = '';
                if ( isset($item[6]) && ! empty($item[6]) ) {
                        if ( 'div' === $item[6] )
-                               $img = '<div class="wp-menu-image"><br /></div>';
+                               $img = '<br />';
                        else
                        else
-                               $img = '<img class="wp-menu-image" src="' . $item[6] . '" alt="" />';
+                               $img = '<img src="' . $item[6] . '" alt="" />';
                }
                $toggle = '<div class="wp-menu-toggle"><br /></div>';
 
                echo "\n\t<li$class$id>";
 
                if ( false !== strpos($class, 'wp-menu-separator') ) {
                }
                $toggle = '<div class="wp-menu-toggle"><br /></div>';
 
                echo "\n\t<li$class$id>";
 
                if ( false !== strpos($class, 'wp-menu-separator') ) {
-                       echo '<br />';
+                       echo '<a class="separator" href="?unfoldmenu=1"><br /></a>';
                } elseif ( $submenu_as_parent && !empty($submenu[$item[2]]) ) {
                        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
                        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
                } elseif ( $submenu_as_parent && !empty($submenu[$item[2]]) ) {
                        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
                        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-                       if ( ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") && ('index.php' != $submenu[$item[2]][0][2]) ) || !empty($menu_hook)) {
+                       if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") ) || !empty($menu_hook)) {
                                $admin_is_parent = true;
                                $admin_is_parent = true;
-                               echo "$img$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
+                               echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
                        } else {
                        } else {
-                               echo "\n\t$img$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
+                               echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
                        }
                } else if ( current_user_can($item[1]) ) {
                        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
                        }
                } else if ( current_user_can($item[1]) ) {
                        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-                       if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
+                       if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
                                $admin_is_parent = true;
                                $admin_is_parent = true;
-                               echo "\n\t$img$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
+                               echo "\n\t<div class='wp-menu-image'><a href='admin.php?page={$item[2]}'>$img</a></div>$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
                        } else {
                        } else {
-                               echo "\n\t$img$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";
+                               echo "\n\t<div class='wp-menu-image'><a href='{$item[2]}'>$img</a></div>$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";
                        }
                }
 
                        }
                }
 
@@ -115,7 +115,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
 
                                $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
 
 
                                $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
 
-                               if ( ( file_exists(WP_PLUGIN_DIR . "/{$sub_item[2]}") && ('index.php' != $sub_item[2]) ) || ! empty($menu_hook) ) {
+                               if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/{$sub_item[2]}") ) || ! empty($menu_hook) ) {
                                        // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
                                        $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]);
                                        if ( $parent_exists )
                                        // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
                                        $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]);
                                        if ( $parent_exists )
@@ -144,4 +144,4 @@ _wp_menu_output( $menu, $submenu );
 do_action( 'adminmenu' );
 
 ?>
 do_action( 'adminmenu' );
 
 ?>
-</ul>
\ No newline at end of file
+</ul>
index 209eb5870f98dcf211d22a4abda65c5a8f3ab8be..6116f5aa81a3155fbd78ec47f8843bfb1ce60540 100644 (file)
@@ -27,51 +27,66 @@ $awaiting_mod = $awaiting_mod->moderated;
 
 $menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' );
 
 
 $menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' );
 
-$menu[4] = array( '', 'read', '', '', 'wp-menu-separator' );
+$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
 
 
-$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'wp-menu-open menu-top', 'menu-posts', 'div' );
+$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top', 'menu-posts', 'div' );
        $submenu['edit.php'][5]  = array( __('Edit'), 'edit_posts', 'edit.php' );
        $submenu['edit.php'][5]  = array( __('Edit'), 'edit_posts', 'edit.php' );
-       $submenu['edit.php'][10]  = array( _c('Add New|post'), 'edit_posts', 'post-new.php' );
-       $submenu['edit.php'][15] = array( __('Tags'), 'manage_categories', 'edit-tags.php' );
-       $submenu['edit.php'][20] = array( __('Categories'), 'manage_categories', 'categories.php' );
+       /* translators: add new post */
+       $submenu['edit.php'][10]  = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );
+
+       $i = 15;
+       foreach ( $wp_taxonomies as $tax ) {
+               if ( $tax->hierarchical || ! in_array('post', (array) $tax->object_type, true) )
+                       continue;
+
+               $submenu['edit.php'][$i] = array( esc_attr($tax->label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax->name );
+               ++$i;
+       }
+
+       $submenu['edit.php'][50] = array( __('Categories'), 'manage_categories', 'categories.php' );
 
 $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
        $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
 
 $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
        $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
-       $submenu['upload.php'][10] = array( _c('Add New|file'), 'upload_files', 'media-new.php');
+       /* translators: add new file */
+       $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
 
 $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top', 'menu-links', 'div' );
        $submenu['link-manager.php'][5] = array( __('Edit'), 'manage_links', 'link-manager.php' );
 
 $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top', 'menu-links', 'div' );
        $submenu['link-manager.php'][5] = array( __('Edit'), 'manage_links', 'link-manager.php' );
-       $submenu['link-manager.php'][10] = array( _c('Add New|links'), 'manage_links', 'link-add.php' );
+       /* translators: add new links */
+       $submenu['link-manager.php'][10] = array( _x('Add New', 'links'), 'manage_links', 'link-add.php' );
        $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-link-categories.php' );
 
 $menu[20] = array( __('Pages'), 'edit_pages', 'edit-pages.php', '', 'menu-top', 'menu-pages', 'div' );
        $submenu['edit-pages.php'][5] = array( __('Edit'), 'edit_pages', 'edit-pages.php' );
        $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-link-categories.php' );
 
 $menu[20] = array( __('Pages'), 'edit_pages', 'edit-pages.php', '', 'menu-top', 'menu-pages', 'div' );
        $submenu['edit-pages.php'][5] = array( __('Edit'), 'edit_pages', 'edit-pages.php' );
-       $submenu['edit-pages.php'][10] = array( _c('Add New|page'), 'edit_pages', 'page-new.php' );
+       /* translators: add new page */
+       $submenu['edit-pages.php'][10] = array( _x('Add New', 'page'), 'edit_pages', 'page-new.php' );
 
 $menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top', 'menu-comments', 'div' );
 
 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
 
 
 $menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top', 'menu-comments', 'div' );
 
 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
 
-$menu[39] = array( '', 'read', '', '', 'wp-menu-separator' );
+$menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
 
 
-$menu[40] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
+$menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' );
        $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
        $submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
        $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
        $submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
+       $submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php');
 
 
-$update_plugins = get_option( 'update_plugins' );
+$update_plugins = get_transient( 'update_plugins' );
 $update_count = 0;
 if ( !empty($update_plugins->response) )
        $update_count = count( $update_plugins->response );
 
 $update_count = 0;
 if ( !empty($update_plugins->response) )
        $update_count = count( $update_plugins->response );
 
-$menu[45] = array( sprintf( __('Plugins %s'), "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php', '', 'menu-top', 'menu-plugins', 'div' );
+$menu[65] = array( sprintf( __('Plugins %s'), "<span class='update-plugins count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php', '', 'menu-top', 'menu-plugins', 'div' );
        $submenu['plugins.php'][5]  = array( __('Installed'), 'activate_plugins', 'plugins.php' );
        $submenu['plugins.php'][5]  = array( __('Installed'), 'activate_plugins', 'plugins.php' );
-       $submenu['plugins.php'][10] = array(_c('Add New|plugin'), 'install_plugins', 'plugin-install.php');
+       /* translators: add new plugin */
+       $submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
        $submenu['plugins.php'][15] = array( __('Editor'), 'edit_plugins', 'plugin-editor.php' );
 
 if ( current_user_can('edit_users') )
        $submenu['plugins.php'][15] = array( __('Editor'), 'edit_plugins', 'plugin-editor.php' );
 
 if ( current_user_can('edit_users') )
-       $menu[50] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-top', 'menu-users', 'div' );
+       $menu[70] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-top', 'menu-users', 'div' );
 else
 else
-       $menu[50] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top', 'menu-users', 'div' );
+       $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top', 'menu-users', 'div' );
 
 if ( current_user_can('edit_users') ) {
        $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
 
 if ( current_user_can('edit_users') ) {
        $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
@@ -83,13 +98,13 @@ if ( current_user_can('edit_users') ) {
        $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
 }
 
        $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
 }
 
-$menu[55] = array( __('Tools'), 'read', 'tools.php', '', 'menu-top', 'menu-tools', 'div' );
+$menu[75] = array( __('Tools'), 'read', 'tools.php', '', 'menu-top', 'menu-tools', 'div' );
        $submenu['tools.php'][5] = array( __('Tools'), 'read', 'tools.php' );
        $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
        $submenu['tools.php'][15] = array( __('Export'), 'import', 'export.php' );
        $submenu['tools.php'][20] = array( __('Upgrade'), 'install_plugins',  'update-core.php');
 
        $submenu['tools.php'][5] = array( __('Tools'), 'read', 'tools.php' );
        $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
        $submenu['tools.php'][15] = array( __('Export'), 'import', 'export.php' );
        $submenu['tools.php'][20] = array( __('Upgrade'), 'install_plugins',  'update-core.php');
 
-$menu[60] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' );
+$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' );
        $submenu['options-general.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
        $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
        $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
        $submenu['options-general.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
        $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
        $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
@@ -99,9 +114,9 @@ $menu[60] = array( __('Settings'), 'manage_options', 'options-general.php', '',
        $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
        $submenu['options-general.php'][45] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
 
        $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
        $submenu['options-general.php'][45] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
 
-$_wp_last_utility_menu = 60; // The index of the last top-level menu in the utility menu group
+$_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
 
 
-$menu[79] = array( '', 'read', '', '', 'wp-menu-separator-last' );
+$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' );
 
 // Back-compat for old top-levels
 $_wp_real_parent_file['post.php'] = 'edit.php';
 
 // Back-compat for old top-levels
 $_wp_real_parent_file['post.php'] = 'edit.php';
@@ -112,7 +127,26 @@ do_action('_admin_menu');
 
 // Create list of page plugin hook names.
 foreach ($menu as $menu_page) {
 
 // Create list of page plugin hook names.
 foreach ($menu as $menu_page) {
-       $admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]);
+       $hook_name = sanitize_title(basename($menu_page[2], '.php'));
+
+       // ensure we're backwards compatible
+       $compat = array(
+               'index' => 'dashboard',
+               'edit' => 'posts',
+               'upload' => 'media',
+               'link-manager' => 'links',
+               'edit-pages' => 'pages',
+               'edit-comments' => 'comments',
+               'options-general' => 'settings',
+               'themes' => 'appearance',
+               );
+
+       if ( isset($compat[$hook_name]) )
+               $hook_name = $compat[$hook_name];
+       elseif ( !$hook_name )
+               continue;
+
+       $admin_page_hooks[$menu_page[2]] = $hook_name;
 }
 
 $_wp_submenu_nopriv = array();
 }
 
 $_wp_submenu_nopriv = array();
@@ -205,16 +239,15 @@ function add_menu_classes($menu) {
                $i++;
 
                if ( 0 == $order ) { // dashboard is always shown/single
                $i++;
 
                if ( 0 == $order ) { // dashboard is always shown/single
-                       $menu[0][4] = add_cssclass('menu-top-first menu-top-last', $top[4]);
+                       $menu[0][4] = add_cssclass('menu-top-first', $top[4]);
+                       $lastorder = 0;
                        continue;
                }
 
                        continue;
                }
 
-               if ( empty($top[2]) ) { // if separator
+               if ( 0 === strpos($top[2], 'separator') ) { // if separator
                        $first = true;
                        $first = true;
-                       if ( $lastorder ) {
-                               $c = $menu[$lastorder][4];
-                               $menu[$lastorder][4] = add_cssclass('menu-top-last', $c);
-                       }
+                       $c = $menu[$lastorder][4];
+                       $menu[$lastorder][4] = add_cssclass('menu-top-last', $c);
                        continue;
                }
 
                        continue;
                }
 
@@ -237,6 +270,38 @@ function add_menu_classes($menu) {
 
 uksort($menu, "strnatcasecmp"); // make it all pretty
 
 
 uksort($menu, "strnatcasecmp"); // make it all pretty
 
+if ( apply_filters('custom_menu_order', false) ) {
+       $menu_order = array();
+       foreach ( $menu as $menu_item ) {
+               $menu_order[] = $menu_item[2];
+       }
+       unset($menu_item);
+       $default_menu_order = $menu_order;
+       $menu_order = apply_filters('menu_order', $menu_order);
+       $menu_order = array_flip($menu_order);
+       $default_menu_order = array_flip($default_menu_order);
+
+       function sort_menu($a, $b) {
+               global $menu_order, $default_menu_order;
+               $a = $a[2];
+               $b = $b[2];
+               if ( isset($menu_order[$a]) && !isset($menu_order[$b]) ) {
+                       return -1;
+               } elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) {
+                       return 1;
+               } elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) {
+                       if ( $menu_order[$a] == $menu_order[$b] )
+                               return 0;
+                       return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1;
+               } else {
+                       return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1;
+               }
+       }
+
+       usort($menu, 'sort_menu');
+       unset($menu_order, $default_menu_order);
+}
+
 $menu = add_menu_classes($menu);
 
 if (! user_can_access_admin_page()) {
 $menu = add_menu_classes($menu);
 
 if (! user_can_access_admin_page()) {
index f267db22512eccb4ae6ef1fcc1dacc6c1e011641..5013ebca9499cb4288e8d7923a300fb1abf1bc2a 100644 (file)
@@ -17,7 +17,7 @@ include('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form method="post" action="options.php">
 <?php settings_fields('discussion'); ?>
 
 <form method="post" action="options.php">
 <?php settings_fields('discussion'); ?>
@@ -25,7 +25,7 @@ include('admin-header.php');
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Default article settings') ?></th>
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Default article settings') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Default article settings') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Default article settings') ?></span></legend>
 <label for="default_pingback_flag">
 <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
 <?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?></label>
 <label for="default_pingback_flag">
 <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
 <?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?></label>
@@ -36,14 +36,14 @@ include('admin-header.php');
 <br />
 <label for="default_comment_status">
 <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
 <br />
 <label for="default_comment_status">
 <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
-<?php _e('Allow people to post comments on the article') ?></label>
+<?php _e('Allow people to post comments on new articles') ?></label>
 <br />
 <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
 </fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Other comment settings') ?></th>
 <br />
 <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
 </fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Other comment settings') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Other comment settings') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Other comment settings') ?></span></legend>
 <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
 <br />
 <label for="comment_registration">
 <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
 <br />
 <label for="comment_registration">
@@ -54,7 +54,7 @@ include('admin-header.php');
 
 <label for="close_comments_for_old_posts">
 <input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> />
 
 <label for="close_comments_for_old_posts">
 <input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> />
-<?php printf( __('Automatically close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . attribute_escape(get_option('close_comments_days_old')) . '" class="small-text" />') ?>
+<?php printf( __('Automatically close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . esc_attr(get_option('close_comments_days_old')) . '" class="small-text" />') ?>
 <br />
 <label for="thread_comments">
 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> />
 <br />
 <label for="thread_comments">
 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> />
@@ -64,7 +64,7 @@ $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
 
 $thread_comments_depth = '</label><select name="thread_comments_depth" id="thread_comments_depth">';
 for ( $i = 1; $i <= $maxdeep; $i++ ) {
 
 $thread_comments_depth = '</label><select name="thread_comments_depth" id="thread_comments_depth">';
 for ( $i = 1; $i <= $maxdeep; $i++ ) {
-       $thread_comments_depth .= "<option value='$i'";
+       $thread_comments_depth .= "<option value='" . esc_attr($i) . "'";
        if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
        $thread_comments_depth .= ">$i</option>";
 }
        if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
        $thread_comments_depth .= ">$i</option>";
 }
@@ -83,7 +83,7 @@ $default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
 if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
 $default_comments_page .= '>' . __('first') . '</option></select>';
 
 if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
 $default_comments_page .= '>' . __('first') . '</option></select>';
 
-printf( __('Break comments into pages with %1$s comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="text" id="comments_per_page" value="' . attribute_escape(get_option('comments_per_page')) . '" class="small-text" />', $default_comments_page );
+printf( __('Break comments into pages with %1$s comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="text" id="comments_per_page" value="' . esc_attr(get_option('comments_per_page')) . '" class="small-text" />', $default_comments_page );
 
 ?></label>
 <br />
 
 ?></label>
 <br />
@@ -102,7 +102,7 @@ printf( __('Comments should be displayed with the %s comments at the top of each
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('E-mail me whenever') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('E-mail me whenever') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('E-mail me whenever') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('E-mail me whenever') ?></span></legend>
 <label for="comments_notify">
 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
 <?php _e('Anyone posts a comment') ?> </label>
 <label for="comments_notify">
 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
 <?php _e('Anyone posts a comment') ?> </label>
@@ -114,7 +114,7 @@ printf( __('Comments should be displayed with the %s comments at the top of each
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Before a comment appears') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Before a comment appears') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Before a comment appears') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears') ?></span></legend>
 <label for="comment_moderation">
 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
 <?php _e('An administrator must always approve the comment') ?> </label>
 <label for="comment_moderation">
 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
 <?php _e('An administrator must always approve the comment') ?> </label>
@@ -124,10 +124,10 @@ printf( __('Comments should be displayed with the %s comments at the top of each
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Comment Moderation') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Comment Moderation') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Comment Moderation') ?></legend>
-<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" value="' . get_option('comment_max_links'). '" class="small-text" />' ) ?></label></p>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation') ?></span></legend>
+<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" value="' . esc_attr(get_option('comment_max_links')) . '" class="small-text" />' ) ?></label></p>
 
 
-<p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
+<p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.') ?></label></p>
 <p>
 <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php form_option('moderation_keys'); ?></textarea>
 </p>
 <p>
 <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php form_option('moderation_keys'); ?></textarea>
 </p>
@@ -135,8 +135,8 @@ printf( __('Comments should be displayed with the %s comments at the top of each
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Comment Blacklist') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Comment Blacklist') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Comment Blacklist') ?></legend>
-<p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Blacklist') ?></span></legend>
+<p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.') ?></label></p>
 <p>
 <textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php form_option('blacklist_keys'); ?></textarea>
 </p>
 <p>
 <textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php form_option('blacklist_keys'); ?></textarea>
 </p>
@@ -154,25 +154,25 @@ printf( __('Comments should be displayed with the %s comments at the top of each
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Avatar Display') ?></th>
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Avatar Display') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Avatar display') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar display') ?></span></legend>
 <?php
        $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
        foreach ( $yesorno as $key => $value) {
                $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
 <?php
        $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
        foreach ( $yesorno as $key => $value) {
                $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
-               echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected/> $value</label><br />";
+               echo "\n\t<label><input type='radio' name='show_avatars' value='" . esc_attr($key) . "' $selected/> $value</label><br />";
        }
 ?>
 </fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Maximum Rating') ?></th>
        }
 ?>
 </fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Maximum Rating') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Maximum Rating') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating') ?></span></legend>
 
 <?php
 $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
 foreach ($ratings as $key => $rating) :
        $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
 
 <?php
 $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
 foreach ($ratings as $key => $rating) :
        $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
-       echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected/> $rating</label><br />";
+       echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr($key) . "' $selected/> $rating</label><br />";
 endforeach;
 ?>
 
 endforeach;
 ?>
 
@@ -180,7 +180,7 @@ endforeach;
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Default Avatar') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Default Avatar') ?></th>
-<td class="defaultavatarpicker"><fieldset><legend class="hidden"><?php _e('Default Avatar') ?></legend>
+<td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar') ?></span></legend>
 
 <?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
 
 
 <?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
 
@@ -201,7 +201,7 @@ $size = 32;
 $avatar_list = '';
 foreach ( $avatar_defaults as $default_key => $default_name ) {
        $selected = ($default == $default_key) ? 'checked="checked" ' : '';
 $avatar_list = '';
 foreach ( $avatar_defaults as $default_key => $default_name ) {
        $selected = ($default == $default_key) ? 'checked="checked" ' : '';
-       $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";
+       $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key)  . "' {$selected}/> ";
 
        $avatar = get_avatar( $user_email, $size, $default_key );
        $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
 
        $avatar = get_avatar( $user_email, $size, $default_key );
        $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
@@ -220,7 +220,7 @@ echo apply_filters('default_avatar_select', $avatar_list);
 <?php do_settings_sections('discussion'); ?>
 
 <p class="submit">
 <?php do_settings_sections('discussion'); ?>
 
 <p class="submit">
-<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
 </form>
 </div>
 </p>
 </form>
 </div>
index f302e5fbefa21fec63956f502a28b75257448e31..cd4b8cdb3ad5731fb0900a0124f9d4f5804b3ee5 100644 (file)
@@ -11,6 +11,8 @@ require_once('./admin.php');
 
 $title = __('General Settings');
 $parent_file = 'options-general.php';
 
 $title = __('General Settings');
 $parent_file = 'options-general.php';
+/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
+$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
 
 /**
  * Display JavaScript on the page.
 
 /**
  * Display JavaScript on the page.
@@ -50,7 +52,7 @@ include('./admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form method="post" action="options.php">
 <?php settings_fields('general'); ?>
 
 <form method="post" action="options.php">
 <?php settings_fields('general'); ?>
@@ -63,7 +65,7 @@ include('./admin-header.php');
 <tr valign="top">
 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
 <td><input name="blogdescription" type="text" id="blogdescription"  value="<?php form_option('blogdescription'); ?>" class="regular-text" />
 <tr valign="top">
 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
 <td><input name="blogdescription" type="text" id="blogdescription"  value="<?php form_option('blogdescription'); ?>" class="regular-text" />
-<span class="setting-description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
+<span class="description"><?php _e('In a few words, explain what this blog is about.') ?></span></td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
@@ -72,16 +74,16 @@ include('./admin-header.php');
 <tr valign="top">
 <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
 <td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" class="regular-text code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> />
 <tr valign="top">
 <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
 <td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" class="regular-text code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> />
-<span class="setting-description"><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></span></td>
+<span class="description"><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></span></td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
-<td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text code" />
-<span class="setting-description"><?php _e('This address is used for admin purposes, like new user notification.') ?></span></td>
+<td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text" />
+<span class="description"><?php _e('This address is used for admin purposes, like new user notification.') ?></span></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Membership') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Membership') ?></th>
-<td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="users_can_register">
+<td> <fieldset><legend class="screen-reader-text"><span><?php _e('Membership') ?></span></legend><label for="users_can_register">
 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
 <?php _e('Anyone can register') ?></label>
 </fieldset></td>
 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
 <?php _e('Anyone can register') ?></label>
 </fieldset></td>
@@ -93,6 +95,9 @@ include('./admin-header.php');
 </td>
 </tr>
 <tr>
 </td>
 </tr>
 <tr>
+<?php
+if ( !wp_timezone_supported() ) : // no magic timezone support here
+?>
 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
 <td>
 <select name="gmt_offset" id="gmt_offset">
 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
 <td>
 <select name="gmt_offset" id="gmt_offset">
@@ -115,23 +120,84 @@ foreach ( $offset_range as $offset ) {
                $selected = " selected='selected'";
                $current_offset_name = $offset_name;
        }
                $selected = " selected='selected'";
                $current_offset_name = $offset_name;
        }
-       echo "<option value=\"$offset\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
+       echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
 }
 ?>
 </select>
 }
 ?>
 </select>
-<?php _e('hours') ?>
-<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n(__('Y-m-d G:i:s'), false, 'gmt')); ?></span>
+<?php _e('hours'); ?>
+<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n( $time_format, false, 'gmt')); ?></span>
 <?php if ($current_offset) : ?>
 <?php if ($current_offset) : ?>
-       <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n(__('Y-m-d G:i:s'))); ?></span>
+       <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span>
 <?php endif; ?>
 <?php endif; ?>
-<br/>
-<span class="setting-description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span>
+<br />
+<span class="description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span>
 </td>
 </td>
+<?php
+else: // looks like we can do nice timezone selection!
+$current_offset = get_option('gmt_offset');
+$tzstring = get_option('timezone_string');
+if (empty($tzstring)) { // set the Etc zone if no timezone string exists
+       if ($current_offset < 0) $offnum = - ceil($current_offset);
+       else $offnum = - floor($current_offset);
+       $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum;
+}
+?>
+<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
+<td>
+
+<select id="timezone_string" name="timezone_string">
+<?php echo wp_timezone_choice($tzstring); ?>
+</select>
+
+    <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
+<?php if (get_option('timezone_string')) : ?>
+       <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
+<?php endif; ?>
+<br />
+<span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
+<br />
+<span>
+<?php if (get_option('timezone_string')) : ?>
+       <?php
+       $now = localtime(time(),true);
+       if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
+       else _e('This timezone is currently in standard time.');
+       ?>
+       <br />
+       <?php
+       if (function_exists('timezone_transitions_get') && $tzstring) {
+               $dateTimeZoneSelected = new DateTimeZone($tzstring);
+               foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
+                       if ($tr['ts'] > time()) {
+                               $found = true;
+                               break;
+                       }
+               }
+
+               if ( isset($found) && $found === true ) {
+                       echo ' ';
+                       $message = $tr['isdst'] ?
+                               __('Daylight savings time begins on: <code>%s</code>.') :
+                               __('Standard time begins  on: <code>%s</code>.');
+                       $tz = new DateTimeZone($tzstring);
+                       $d = new DateTime( "@{$tr['ts']}" );
+                       $d->setTimezone($tz);
+                       printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $d->format('U') ) );
+               } else {
+                       _e('This timezone does not observe daylight savings time.');
+               }
+       }
+       ?>
+       </span>
+<?php endif; ?>
+</td>
+
+<?php endif; ?>
 </tr>
 <tr>
 <th scope="row"><?php _e('Date Format') ?></th>
 <td>
 </tr>
 <tr>
 <th scope="row"><?php _e('Date Format') ?></th>
 <td>
-       <fieldset><legend class="hidden"><?php _e('Date Format') ?></legend>
+       <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
 <?php
 
        $date_formats = apply_filters( 'date_formats', array(
 <?php
 
        $date_formats = apply_filters( 'date_formats', array(
@@ -144,7 +210,7 @@ foreach ( $offset_range as $offset ) {
        $custom = TRUE;
 
        foreach ( $date_formats as $format ) {
        $custom = TRUE;
 
        foreach ( $date_formats as $format ) {
-               echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='date_format' value='" . attribute_escape($format) . "'";
+               echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
                if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
                        echo " checked='checked'";
                        $custom = FALSE;
                if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
                        echo " checked='checked'";
                        $custom = FALSE;
@@ -153,10 +219,10 @@ foreach ( $offset_range as $offset ) {
        }
 
        echo '  <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
        }
 
        echo '  <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
-       checked( $custom, TRUE );
-       echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . attribute_escape( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n";
+       checked( $custom );
+       echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n";
 
 
-       echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') . "</p>\n";
+       echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click &#8220;Save Changes&#8221; to update sample output.') . "</p>\n";
 ?>
        </fieldset>
 </td>
 ?>
        </fieldset>
 </td>
@@ -164,7 +230,7 @@ foreach ( $offset_range as $offset ) {
 <tr>
 <th scope="row"><?php _e('Time Format') ?></th>
 <td>
 <tr>
 <th scope="row"><?php _e('Time Format') ?></th>
 <td>
-       <fieldset><legend class="hidden"><?php _e('Time Format') ?></legend>
+       <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
 <?php
 
        $time_formats = apply_filters( 'time_formats', array(
 <?php
 
        $time_formats = apply_filters( 'time_formats', array(
@@ -176,7 +242,7 @@ foreach ( $offset_range as $offset ) {
        $custom = TRUE;
 
        foreach ( $time_formats as $format ) {
        $custom = TRUE;
 
        foreach ( $time_formats as $format ) {
-               echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='time_format' value='" . attribute_escape($format) . "'";
+               echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
                if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
                        echo " checked='checked'";
                        $custom = FALSE;
                if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
                        echo " checked='checked'";
                        $custom = FALSE;
@@ -185,8 +251,8 @@ foreach ( $offset_range as $offset ) {
        }
 
        echo '  <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
        }
 
        echo '  <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
-       checked( $custom, TRUE );
-       echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . attribute_escape( get_option('time_format') ) . '" class="small-text" /> ' . date_i18n( get_option('time_format') ) . "\n";
+       checked( $custom );
+       echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> ' . date_i18n( get_option('time_format') ) . "\n";
 ?>
        </fieldset>
 </td>
 ?>
        </fieldset>
 </td>
@@ -197,7 +263,7 @@ foreach ( $offset_range as $offset ) {
 <?php
 for ($day_index = 0; $day_index <= 6; $day_index++) :
        $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
 <?php
 for ($day_index = 0; $day_index <= 6; $day_index++) :
        $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
-       echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
+       echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
 endfor;
 ?>
 </select></td>
 endfor;
 ?>
 </select></td>
@@ -208,7 +274,7 @@ endfor;
 <?php do_settings_sections('general'); ?>
 
 <p class="submit">
 <?php do_settings_sections('general'); ?>
 
 <p class="submit">
-<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
 </form>
 
 </p>
 </form>
 
index 87a6d0cef414f585a8ddc4d2f6d00c2f939e4803..6c97c0323cb8edb06ebcc5ad3a7552edbcac1b18 100644 (file)
@@ -18,7 +18,7 @@ include('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form action="options.php" method="post">
 <?php settings_fields('media'); ?>
 
 <form action="options.php" method="post">
 <?php settings_fields('media'); ?>
@@ -41,7 +41,7 @@ include('admin-header.php');
 
 <tr valign="top">
 <th scope="row"><?php _e('Medium size') ?></th>
 
 <tr valign="top">
 <th scope="row"><?php _e('Medium size') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Medium size') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size') ?></span></legend>
 <label for="medium_size_w"><?php _e('Max Width'); ?></label>
 <input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" />
 <label for="medium_size_h"><?php _e('Max Height'); ?></label>
 <label for="medium_size_w"><?php _e('Max Width'); ?></label>
 <input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" />
 <label for="medium_size_h"><?php _e('Max Height'); ?></label>
@@ -51,7 +51,7 @@ include('admin-header.php');
 
 <tr valign="top">
 <th scope="row"><?php _e('Large size') ?></th>
 
 <tr valign="top">
 <th scope="row"><?php _e('Large size') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Large size') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size') ?></span></legend>
 <label for="large_size_w"><?php _e('Max Width'); ?></label>
 <input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" />
 <label for="large_size_h"><?php _e('Max Height'); ?></label>
 <label for="large_size_w"><?php _e('Max Width'); ?></label>
 <input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" />
 <label for="large_size_h"><?php _e('Max Height'); ?></label>
@@ -65,7 +65,7 @@ include('admin-header.php');
 <?php do_settings_sections('media'); ?>
 
 <p class="submit">
 <?php do_settings_sections('media'); ?>
 
 <p class="submit">
-       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
 
 </form>
 </p>
 
 </form>
index 8109c2f8d8f1547bcd7492bcd791c2ee5dc795b5..e63528103c4ef9369e9bb37f8c0b67b567d2c8c8 100644 (file)
@@ -18,7 +18,7 @@ include('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form method="post" action="options.php">
 <?php settings_fields('misc'); ?>
 
 <form method="post" action="options.php">
 <?php settings_fields('misc'); ?>
@@ -27,15 +27,15 @@ include('admin-header.php');
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
-<td><input name="upload_path" type="text" id="upload_path" value="<?php echo attribute_escape(str_replace(ABSPATH, '', get_option('upload_path'))); ?>" class="regular-text code" />
-<span class="setting-description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></span>
+<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(str_replace(ABSPATH, '', get_option('upload_path'))); ?>" class="regular-text code" />
+<span class="description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></span>
 </td>
 </tr>
 
 <tr valign="top">
 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
 </td>
 </tr>
 
 <tr valign="top">
 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
-<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo attribute_escape( get_option('upload_url_path')); ?>" class="regular-text code" />
-<span class="setting-description"><?php _e('Configuring this is optional by default it should be blank'); ?></span>
+<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" />
+<span class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></span>
 </td>
 </tr>
 
 </td>
 </tr>
 
@@ -62,20 +62,12 @@ include('admin-header.php');
 </tr>
 <tr>
 
 </tr>
 <tr>
 
-<th scope="row" class="th-full">
-<label for="hack_file">
-<input type="checkbox" id="hack_file" name="hack_file" value="1"<?php checked('1', get_option('hack_file')); ?> />
-<?php _e('Use legacy <code>my-hacks.php</code> file support') ?>
-</label>
-</th>
-</tr>
-
 </table>
 
 <?php do_settings_sections('misc'); ?>
 
 <p class="submit">
 </table>
 
 <?php do_settings_sections('misc'); ?>
 
 <p class="submit">
-       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
 
 </form>
 </p>
 
 </form>
index 93f1619f839f59997253c3b259fa9d457b38fff0..4bff30a4cb3100b06c937d643476d0ad7e58580c 100644 (file)
@@ -70,6 +70,7 @@ add_filter('admin_head', 'add_js');
 include('admin-header.php');
 
 $home_path = get_home_path();
 include('admin-header.php');
 
 $home_path = get_home_path();
+$iis7_permalinks = iis7_supports_permalinks();
 
 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
        check_admin_referer('update-permalink');
 
 if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
        check_admin_referer('update-permalink');
@@ -100,12 +101,19 @@ $permalink_structure = get_option('permalink_structure');
 $category_base = get_option('category_base');
 $tag_base = get_option( 'tag_base' );
 
 $category_base = get_option('category_base');
 $tag_base = get_option( 'tag_base' );
 
-if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
-       $writable = true;
-else
-       $writable = false;
+if ( $iis7_permalinks ) {
+       if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
+               $writable = true;
+       else
+               $writable = false;
+} else {
+       if ( ( ! file_exists($home_path . '.htaccess') && is_writable($home_path) ) || is_writable($home_path . '.htaccess') )
+               $writable = true;
+       else
+               $writable = false;
+}
 
 
-if ($wp_rewrite->using_index_permalinks())
+if ( $wp_rewrite->using_index_permalinks() )
        $usingpi = true;
 else
        $usingpi = false;
        $usingpi = true;
 else
        $usingpi = false;
@@ -115,16 +123,26 @@ $wp_rewrite->flush_rules();
 
 <?php if (isset($_POST['submit'])) : ?>
 <div id="message" class="updated fade"><p><?php
 
 <?php if (isset($_POST['submit'])) : ?>
 <div id="message" class="updated fade"><p><?php
-if ( $permalink_structure && !$usingpi && !$writable )
-       _e('You should update your .htaccess now.');
-else
-       _e('Permalink structure updated.');
-?></p></div>
+if ( $iis7_permalinks ) {
+       if ( $permalink_structure && ! $usingpi && ! $writable )
+               _e('You should update your web.config now');
+       else if ( $permalink_structure && ! $usingpi && $writable)
+               _e('Permalink structure updated. Remove write access on web.config file now!');
+       else
+               _e('Permalink structure updated');
+} else {
+       if ( $permalink_structure && ! $usingpi && ! $writable )
+               _e('You should update your .htaccess now.');
+       else
+               _e('Permalink structure updated.');
+}
+?>
+</p></div>
 <?php endif; ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
 <?php endif; ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form name="form" action="options-permalink.php" method="post">
 <?php wp_nonce_field('update-permalink') ?>
 
 <form name="form" action="options-permalink.php" method="post">
 <?php wp_nonce_field('update-permalink') ?>
@@ -134,7 +152,7 @@ else
 <?php
 $prefix = '';
 
 <?php
 $prefix = '';
 
-if ( ! got_mod_rewrite() )
+if ( ! got_mod_rewrite() && ! $iis7_permalinks )
        $prefix = '/index.php';
 
 $structures = array(
        $prefix = '/index.php';
 
 $structures = array(
@@ -151,15 +169,15 @@ $structures = array(
                <td><code><?php echo get_option('home'); ?>/?p=123</code></td>
        </tr>
        <tr>
                <td><code><?php echo get_option('home'); ?>/?p=123</code></td>
        </tr>
        <tr>
-               <th><label><input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
+               <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
                <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td>
        </tr>
        <tr>
                <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></td>
        </tr>
        <tr>
-               <th><label><input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
+               <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
                <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td>
        </tr>
        <tr>
                <td><code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/sample-post/'; ?></code></td>
        </tr>
        <tr>
-               <th><label><input name="selection" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
+               <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" class="tog" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
                <td><code><?php echo get_option('home') . $prefix  ; ?>/archives/123</code></td>
        </tr>
        <tr>
                <td><code><?php echo get_option('home') . $prefix  ; ?>/archives/123</code></td>
        </tr>
        <tr>
@@ -173,13 +191,13 @@ $structures = array(
                        </label>
                </th>
                <td>
                        </label>
                </th>
                <td>
-                       <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo attribute_escape($permalink_structure); ?>" class="regular-text code" />
+                       <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
                </td>
        </tr>
 </table>
 
 <h3><?php _e('Optional'); ?></h3>
                </td>
        </tr>
 </table>
 
 <h3><?php _e('Optional'); ?></h3>
-<?php if ($is_apache) : ?>
+<?php if ( $is_apache || $iis7_permalinks ) : ?>
        <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <kbd>topics</kbd> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
 <?php else : ?>
        <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
        <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <kbd>topics</kbd> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
 <?php else : ?>
        <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
@@ -188,11 +206,11 @@ $structures = array(
 <table class="form-table">
        <tr>
                <th><label for="category_base"><?php _e('Category base'); ?></label></th>
 <table class="form-table">
        <tr>
                <th><label for="category_base"><?php _e('Category base'); ?></label></th>
-               <td><input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape($category_base); ?>" class="regular-text code" /></td>
+               <td><input name="category_base" id="category_base" type="text" value="<?php echo esc_attr($category_base); ?>" class="regular-text code" /></td>
        </tr>
        <tr>
                <th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
        </tr>
        <tr>
                <th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
-               <td><input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td>
+               <td><input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
        </tr>
        <?php do_settings_fields('permalink', 'optional'); ?>
 </table>
        </tr>
        <?php do_settings_fields('permalink', 'optional'); ?>
 </table>
@@ -200,15 +218,26 @@ $structures = array(
 <?php do_settings_sections('permalink'); ?>
 
 <p class="submit">
 <?php do_settings_sections('permalink'); ?>
 
 <p class="submit">
-       <input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
   </form>
 </p>
   </form>
-<?php if ( $permalink_structure && !$usingpi && !$writable ) : ?>
-  <p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
+<?php if ($iis7_permalinks) :
+       if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) : ?>
+<p><?php _e('If your <code>web.config</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code> element in <code>web.config</code> file.') ?></p>
+<form action="options-permalink.php" method="post">
+<?php wp_nonce_field('update-permalink') ?>
+       <p><textarea rows="10" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_html($wp_rewrite->iis7_url_rewrite_rules()); ?></textarea></p>
+</form>
+<p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.')  ?></p>
+       <?php endif; ?>
+<?php else :
+       if ( $permalink_structure && ! $usingpi && ! $writable ) : ?>
+<p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
 <form action="options-permalink.php" method="post">
 <?php wp_nonce_field('update-permalink') ?>
 <form action="options-permalink.php" method="post">
 <?php wp_nonce_field('update-permalink') ?>
-       <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
+       <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_html($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
 </form>
 </form>
+       <?php endif; ?>
 <?php endif; ?>
 
 </div>
 <?php endif; ?>
 
 </div>
index c46b72083105e12cd3114f6407bafbc47424b4db..b501a27cb2754ec44a5fda153d38d4f6c741c97c 100644 (file)
@@ -17,7 +17,7 @@ include('./admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form method="post" action="options.php">
 <?php settings_fields('privacy'); ?>
 
 <form method="post" action="options.php">
 <?php settings_fields('privacy'); ?>
@@ -25,7 +25,7 @@ include('./admin-header.php');
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Blog Visibility') ?> </th>
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Blog Visibility') ?> </th>
-<td><fieldset><legend class="hidden"><?php _e('Blog Visibility') ?> </legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Blog Visibility') ?> </span></legend>
 <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
 <label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p>
 <p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
 <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
 <label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p>
 <p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
@@ -39,7 +39,7 @@ include('./admin-header.php');
 <?php do_settings_sections('privacy'); ?>
 
 <p class="submit">
 <?php do_settings_sections('privacy'); ?>
 
 <p class="submit">
-       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
 </form>
 
 </p>
 </form>
 
index ff0fa4b6026e0a2d586c6e35497b663c7eec184c..64410c380d31494563576974dc2e6dc9f90d6104 100644 (file)
@@ -17,7 +17,7 @@ include('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form name="form1" method="post" action="options.php">
 <?php settings_fields('reading'); ?>
 
 <form name="form1" method="post" action="options.php">
 <?php settings_fields('reading'); ?>
@@ -26,7 +26,7 @@ include('admin-header.php');
 <?php if ( get_pages() ): ?>
 <tr valign="top">
 <th scope="row"><?php _e('Front page displays')?></th>
 <?php if ( get_pages() ): ?>
 <tr valign="top">
 <th scope="row"><?php _e('Front page displays')?></th>
-<td><fieldset><legend class="hidden"><?php _e('Front page displays')?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Front page displays')?></span></legend>
        <p><label>
                <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
                <?php _e('Your latest posts'); ?>
        <p><label>
                <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
                <?php _e('Your latest posts'); ?>
@@ -63,7 +63,7 @@ include('admin-header.php');
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('For each article in a feed, show') ?> </th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('For each article in a feed, show') ?> </th>
-<td><fieldset><legend class="hidden"><?php _e('For each article in a feed, show') ?> </legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('For each article in a feed, show') ?> </span></legend>
 <p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?>    /> <?php _e('Full text') ?></label><br />
 <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
 </fieldset></td>
 <p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?>    /> <?php _e('Full text') ?></label><br />
 <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p>
 </fieldset></td>
@@ -71,8 +71,8 @@ include('admin-header.php');
 
 <tr valign="top">
 <th scope="row"><label for="blog_charset"><?php _e('Encoding for pages and feeds') ?></label></th>
 
 <tr valign="top">
 <th scope="row"><label for="blog_charset"><?php _e('Encoding for pages and feeds') ?></label></th>
-<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" class="regular-text code" />
-<span class="setting-description"><?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></span></td>
+<td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" class="regular-text" />
+<span class="description"><?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></span></td>
 </tr>
 <?php do_settings_fields('reading', 'default'); ?>
 </table>
 </tr>
 <?php do_settings_fields('reading', 'default'); ?>
 </table>
@@ -80,7 +80,7 @@ include('admin-header.php');
 <?php do_settings_sections('reading'); ?>
 
 <p class="submit">
 <?php do_settings_sections('reading'); ?>
 
 <p class="submit">
-       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
 </form>
 </div>
 </p>
 </form>
 </div>
index 7220a45e4e61f7ef50a6be9ea3991971fd6638d0..208aab4b93da6cb1538c06308989fa8059da80a9 100644 (file)
@@ -17,7 +17,7 @@ include('admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form method="post" action="options.php">
 <?php settings_fields('writing'); ?>
 
 <form method="post" action="options.php">
 <?php settings_fields('writing'); ?>
@@ -30,7 +30,7 @@ include('admin-header.php');
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Formatting') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Formatting') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Formatting') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Formatting') ?></span></legend>
 <label for="use_smilies">
 <input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
 <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
 <label for="use_smilies">
 <input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
 <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
@@ -61,7 +61,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Atom Publishing Protocol') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Atom Publishing Protocol') ?></span></legend>
 <label for="enable_app">
 <input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', get_option('enable_app')); ?> />
 <?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
 <label for="enable_app">
 <input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', get_option('enable_app')); ?> />
 <?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
@@ -69,7 +69,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('XML-RPC') ?></th>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('XML-RPC') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('XML-RPC') ?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('XML-RPC') ?></span></legend>
 <label for="enable_xmlrpc">
 <input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', get_option('enable_xmlrpc')); ?> />
 <?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
 <label for="enable_xmlrpc">
 <input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', get_option('enable_xmlrpc')); ?> />
 <?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
@@ -84,7 +84,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="mailserver_url"><?php _e('Mail Server') ?></label></th>
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="mailserver_url"><?php _e('Mail Server') ?></label></th>
-<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" class="regular-text" />
+<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" class="regular-text code" />
 <label for="mailserver_port"><?php _e('Port') ?></label>
 <input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" class="small-text" />
 </td>
 <label for="mailserver_port"><?php _e('Port') ?></label>
 <input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" class="small-text" />
 </td>
@@ -116,18 +116,18 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor
 
 <p><label for="ping_sites"><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></label></p>
 
 
 <p><label for="ping_sites"><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></label></p>
 
-<textarea name="ping_sites" id="ping_sites" class="large-text" rows="3"><?php form_option('ping_sites'); ?></textarea>
+<textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3"><?php form_option('ping_sites'); ?></textarea>
 
 <?php else : ?>
 
 
 <?php else : ?>
 
-       <p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your blog\'s <a href="%s">privacy settings</a>.'), 'options-privacy.php'); ?></p>
+       <p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your blog&#8217;s <a href="%s">privacy settings</a>.'), 'options-privacy.php'); ?></p>
 
 <?php endif; ?>
 
 <?php do_settings_sections('writing'); ?>
 
 <p class="submit">
 
 <?php endif; ?>
 
 <?php do_settings_sections('writing'); ?>
 
 <p class="submit">
-       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
 </p>
 </form>
 </div>
 </p>
 </form>
 </div>
index ad048ca889a4f847b69704efa48422ed15499f1c..6bc05615533b5c37d49fc862774a4cf66d3fa8b9 100644 (file)
@@ -22,9 +22,9 @@ $parent_file = 'options-general.php';
 wp_reset_vars(array('action'));
 
 $whitelist_options = array(
 wp_reset_vars(array('action'));
 
 $whitelist_options = array(
-       'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role' ),
+       'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role', 'timezone_string' ),
        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
-       'misc' => array( 'hack_file', 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ),
+       'misc' => array( 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ),
        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
        'privacy' => array( 'blog_public' ),
        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
        'privacy' => array( 'blog_public' ),
        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
@@ -99,7 +99,7 @@ $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name
 
 foreach ( (array) $options as $option) :
        $disabled = '';
 
 foreach ( (array) $options as $option) :
        $disabled = '';
-       $option->option_name = attribute_escape($option->option_name);
+       $option->option_name = esc_attr($option->option_name);
        if ( is_serialized($option->option_value) ) {
                if ( is_serialized_string($option->option_value) ) {
                        // this is a serialized string, so we should display it
        if ( is_serialized($option->option_value) ) {
                if ( is_serialized_string($option->option_value) ) {
                        // this is a serialized string, so we should display it
@@ -121,8 +121,8 @@ foreach ( (array) $options as $option) :
        <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
 <td>";
 
        <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
 <td>";
 
-       if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>";
-       else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . attribute_escape($value) . "'$disabled />";
+       if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . esc_html($value) . "</textarea>";
+       else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . esc_attr($value) . "'$disabled />";
 
        echo "</td>
 </tr>";
 
        echo "</td>
 </tr>";
@@ -130,7 +130,7 @@ endforeach;
 ?>
   </table>
 <?php $options_to_update = implode(',', $options_to_update); ?>
 ?>
   </table>
 <?php $options_to_update = implode(',', $options_to_update); ?>
-<p class="submit"><input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" /><input type="submit" name="Update" value="<?php _e('Save Changes') ?>" class="button-primary" /></p>
+<p class="submit"><input type="hidden" name="page_options" value="<?php echo esc_attr($options_to_update); ?>" /><input type="submit" name="Update" value="<?php _e('Save Changes') ?>" class="button-primary" /></p>
   </form>
 </div>
 
   </form>
 </div>
 
index 91918b55969dba2e94a419d10558cbc7811db633..68a669020135b4591b2302393a2f4212f2f256eb 100644 (file)
@@ -35,21 +35,14 @@ function redirect_page($page_ID) {
                $location = $_POST['referredby'];
        } elseif ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
                $location = 'sidebar.php?a=b';
                $location = $_POST['referredby'];
        } elseif ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
                $location = 'sidebar.php?a=b';
-       } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
-               if ( isset($_POST['_wp_original_http_referer']) && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page-new.php') === false )
-                       $location = add_query_arg( array(
-                               '_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ),
-                               'message' => 1
-                       ), get_edit_post_link( $page_ID, 'url' ) );
-               else {
-                       if ( isset( $_POST['publish'] ) ) {
-                               if ( 'pending' == get_post_status( $page_ID ) )
-                                       $location = add_query_arg( 'message', 6, get_edit_post_link( $page_ID, 'url' ) );
-                               else
-                                       $location = add_query_arg( 'message', 5, get_edit_post_link( $page_ID, 'url' ) );
-                       } else {
-                               $location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
-                       }
+       } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) ) {
+               if ( isset( $_POST['publish'] ) ) {
+                       if ( 'pending' == get_post_status( $page_ID ) )
+                               $location = add_query_arg( 'message', 6, get_edit_post_link( $page_ID, 'url' ) );
+                       else
+                               $location = add_query_arg( 'message', 5, get_edit_post_link( $page_ID, 'url' ) );
+               } else {
+                       $location = add_query_arg( 'message', 1, get_edit_post_link( $page_ID, 'url' ) );
                }
        } elseif ( isset($_POST['addmeta']) ) {
                $location = add_query_arg( 'message', 2, wp_get_referer() );
                }
        } elseif ( isset($_POST['addmeta']) ) {
                $location = add_query_arg( 'message', 2, wp_get_referer() );
@@ -59,19 +52,10 @@ function redirect_page($page_ID) {
                $location = add_query_arg( 'message', 3, wp_get_referer() );
                $location = explode('#', $location);
                $location = $location[0] . '#postcustom';
                $location = add_query_arg( 'message', 3, wp_get_referer() );
                $location = explode('#', $location);
                $location = $location[0] . '#postcustom';
-       } elseif (!empty($referredby) && $referredby != $referer) {
-               $location = $_POST['referredby'];
-               $location = remove_query_arg('_wp_original_http_referer', $location);
-               if ( false !== strpos($location, 'edit-pages.php') )
-                       $location = add_query_arg('posted', $page_ID, $location);
-               elseif ( false !== strpos($location, 'wp-admin') )
-                       $location = "page-new.php?posted=$page_ID";
-       } elseif ( isset($_POST['publish']) ) {
-               $location = "page-new.php?posted=$page_ID";
        } elseif ($action == 'editattachment') {
                $location = 'attachments.php';
        } else {
        } elseif ($action == 'editattachment') {
                $location = 'attachments.php';
        } else {
-               $location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
+               $location = add_query_arg( 'message', 1, get_edit_post_link( $page_ID, 'url' ) );
        }
 
        wp_redirect($location);
        }
 
        wp_redirect($location);
@@ -98,7 +82,7 @@ case 'edit':
        $page_ID = $post_ID = $p = (int) $_GET['post'];
        $post = get_post_to_edit($page_ID);
 
        $page_ID = $post_ID = $p = (int) $_GET['post'];
        $post = get_post_to_edit($page_ID);
 
-       if ( empty($post->ID) ) wp_die( __("You attempted to edit a page that doesn't exist. Perhaps it was deleted?") );
+       if ( empty($post->ID) ) wp_die( __('You attempted to edit a page that doesn&#8217;t exist. Perhaps it was deleted?') );
 
        if ( 'page' != $post->post_type ) {
                wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
 
        if ( 'page' != $post->post_type ) {
                wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
@@ -116,7 +100,7 @@ case 'edit':
                if ( $last = wp_check_post_lock( $post->ID ) ) {
                        $last_user = get_userdata( $last );
                        $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
                if ( $last = wp_check_post_lock( $post->ID ) ) {
                        $last_user = get_userdata( $last );
                        $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
-                       $message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
+                       $message = sprintf( __( 'Warning: %s is currently editing this page' ), esc_html( $last_user_name ) );
                        $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
                        add_action('admin_notices', create_function( '', "echo '$message';" ) );
                } else {
                        $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
                        add_action('admin_notices', create_function( '', "echo '$message';" ) );
                } else {
index b807de895b7b777363de6cf4a0d1ae74a907fda2..e297ef4ce62bbf558f1b4ccaef0461e757225033 100644 (file)
@@ -12,20 +12,29 @@ require_once('admin.php');
 $title = __("Edit Plugins");
 $parent_file = 'plugins.php';
 
 $title = __("Edit Plugins");
 $parent_file = 'plugins.php';
 
-wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
+wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'plugin'));
 
 wp_admin_css( 'theme-editor' );
 
 $plugins = get_plugins();
 
 wp_admin_css( 'theme-editor' );
 
 $plugins = get_plugins();
-$plugin_files = array_keys($plugins);
 
 
-if (empty($file))
+if ( isset($_REQUEST['file']) )
+       $plugin = $_REQUEST['file'];
+
+if ( empty($plugin) ) {
+       $plugin = array_keys($plugins);
+       $plugin = $plugin[0];
+}
+
+$plugin_files = get_plugin_files($plugin);
+
+if ( empty($file) )
        $file = $plugin_files[0];
 
 $file = validate_file_to_edit($file, $plugin_files);
 $real_file = WP_PLUGIN_DIR . '/' . $file;
 
        $file = $plugin_files[0];
 
 $file = validate_file_to_edit($file, $plugin_files);
 $real_file = WP_PLUGIN_DIR . '/' . $file;
 
-switch($action) {
+switch ( $action ) {
 
 case 'update':
 
 
 case 'update':
 
@@ -64,25 +73,54 @@ default:
                check_admin_referer('edit-plugin-test_' . $file);
 
                $error = validate_plugin($file);
                check_admin_referer('edit-plugin-test_' . $file);
 
                $error = validate_plugin($file);
-               if( is_wp_error($error) )
+               if ( is_wp_error($error) )
                        wp_die( $error );
 
                if ( ! is_plugin_active($file) )
                        wp_die( $error );
 
                if ( ! is_plugin_active($file) )
-                       activate_plugin($file, "plugin-editor.php?file=$file&phperror=1");// we'll override this later if the plugin can be included without fatal error
+                       activate_plugin($file, "plugin-editor.php?file=$file&phperror=1"); // we'll override this later if the plugin can be included without fatal error
 
                wp_redirect("plugin-editor.php?file=$file&a=te");
                exit;
        }
 
 
                wp_redirect("plugin-editor.php?file=$file&a=te");
                exit;
        }
 
+       if ( use_codepress() )
+               wp_enqueue_script( 'codepress' );
+
+       // List of allowable extensions
+       $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
+       $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions);
+
+       if ( ! is_file($real_file) ) {
+               wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.')));
+       } else {
+               // Get the extension of the file
+               if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) {
+                       $ext = strtolower($matches[1]);
+                       // If extension is not in the acceptable list, skip it
+                       if ( !in_array( $ext, $editable_extensions) )
+                               wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.')));
+               }
+       }
+
        require_once('admin-header.php');
 
        update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
 
        require_once('admin-header.php');
 
        update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
 
-       if ( ! is_file($real_file) )
-               $error = 1;
+       $content = file_get_contents( $real_file );
+
+       if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) {
+               $functions = wp_doc_link_parse( $content );
+
+               $docs_select = '<select name="docs-list" id="docs-list">';
+               $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>';
+               foreach ( $functions as $function) {
+                       $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>';
+               }
+               $docs_select .= '</select>';
+       }
 
 
-       if ( ! $error )
-               $content = htmlspecialchars(file_get_contents($real_file));
+       $content = htmlspecialchars( $content );
+       $codepress_lang = codepress_get_lang($real_file);
 
        ?>
 <?php if (isset($_GET['a'])) : ?>
 
        ?>
 <?php if (isset($_GET['a'])) : ?>
@@ -91,18 +129,37 @@ default:
  <div id="message" class="updated fade"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
        <?php
                if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?>
  <div id="message" class="updated fade"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
        <?php
                if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?>
-       <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo attribute_escape($file); ?>&amp;_wpnonce=<?php echo attribute_escape($_GET['_error_nonce']); ?>"></iframe>
+       <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo esc_attr($file); ?>&amp;_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe>
        <?php } ?>
 </div>
 <?php endif; ?>
 <div class="wrap">
 <?php screen_icon(); ?>
        <?php } ?>
 </div>
 <?php endif; ?>
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
-
+<h2><?php echo esc_html( $title ); ?></h2>
+<div class="bordertitle">
+       <form id="themeselector" action="plugin-editor.php" method="post">
+               <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong>
+               <select name="plugin" id="plugin">
+<?php
+       foreach ( $plugins as $plugin_key => $a_plugin ) {
+               $plugin_name = $a_plugin['Name'];
+               if ( $plugin_key == $plugin )
+                       $selected = " selected='selected'";
+               else
+                       $selected = '';
+               $plugin_name = esc_attr($plugin_name);
+               $plugin_key = esc_attr($plugin_key);
+               echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
+       }
+?>
+               </select>
+               <input type="submit" name="Submit" value="<?php esc_attr_e('Select') ?>" class="button" />
+       </form>
+</div>
 <div class="tablenav">
 <div class="alignleft">
 <big><?php
 <div class="tablenav">
 <div class="alignleft">
 <big><?php
-       if ( is_plugin_active($file) ) {
+       if ( is_plugin_active($plugin) ) {
                if ( is_writeable($real_file) )
                        echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
                else
                if ( is_writeable($real_file) )
                        echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
                else
@@ -121,20 +178,34 @@ default:
        <div id="templateside">
        <h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3>
 
        <div id="templateside">
        <h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3>
 
-       <h4><?php _e('Plugins'); ?></h4>
        <ul>
        <ul>
-<?php foreach($plugin_files as $plugin_file) : ?>
-               <li><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
+<?php
+foreach ( $plugin_files as $plugin_file ) :
+       // Get the extension of the file
+       if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) {
+               $ext = strtolower($matches[1]);
+               // If extension is not in the acceptable list, skip it
+               if ( !in_array( $ext, $editable_extensions ) )
+                       continue;
+       } else {
+               // No extension found
+               continue;
+       }
+?>
+               <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>&amp;plugin=<?php echo $plugin; ?>"><?php echo $plugin_file ?></a></li>
 <?php endforeach; ?>
        </ul>
        </div>
 <?php endforeach; ?>
        </ul>
        </div>
-<?php  if ( ! $error ) { ?>
        <form name="template" id="template" action="plugin-editor.php" method="post">
        <?php wp_nonce_field('edit-plugin_' . $file) ?>
        <form name="template" id="template" action="plugin-editor.php" method="post">
        <?php wp_nonce_field('edit-plugin_' . $file) ?>
-               <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
+               <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
                <input type="hidden" name="action" value="update" />
                <input type="hidden" name="action" value="update" />
-               <input type="hidden" name="file" value="<?php echo $file ?>" />
+               <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
+               <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
                </div>
                </div>
+               <?php if ( isset( $functions ) ) : ?>
+               <div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
+               <?php endif; ?>
 <?php if ( is_writeable($real_file) ) : ?>
        <?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
                <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
 <?php if ( is_writeable($real_file) ) : ?>
        <?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?>
                <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
@@ -142,23 +213,18 @@ default:
        <p class="submit">
        <?php
                if ( isset($_GET['phperror']) )
        <p class="submit">
        <?php
                if ( isset($_GET['phperror']) )
-                       echo "<input type='hidden' name='phperror' value='1' /><input type='submit' name='submit' class='button-primary' value='" . __('Update File and Attempt to Reactivate') . "' tabindex='2' />";
+                       echo "<input type='hidden' name='phperror' value='1' /><input type='submit' name='submit' class='button-primary' value='" . esc_attr__('Update File and Attempt to Reactivate') . "' tabindex='2' />";
                else
                else
-                       echo "<input type='submit' name='submit' class='button-primary' value='" . __('Update File') . "' tabindex='2' />";
+                       echo "<input type='submit' name='submit' class='button-primary' value='" . esc_attr__('Update File') . "' tabindex='2' />";
        ?>
        </p>
 <?php else : ?>
        <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
 <?php endif; ?>
  </form>
        ?>
        </p>
 <?php else : ?>
        <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
 <?php endif; ?>
  </form>
-<?php
-       } else {
-               echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
-       }
-?>
 <div class="clear"> &nbsp; </div>
 </div>
 <?php
        break;
 }
 <div class="clear"> &nbsp; </div>
 </div>
 <?php
        break;
 }
-include("admin-footer.php") ?>
\ No newline at end of file
+include("admin-footer.php") ?>
index dde4a3059f77973b49ce5344e4dac36fa6caa6d7..452aee1e6df3113a895bb74b881cece1c9252f7a 100644 (file)
@@ -18,21 +18,19 @@ $title = __('Install Plugins');
 $parent_file = 'plugins.php';
 
 wp_reset_vars( array('tab', 'paged') );
 $parent_file = 'plugins.php';
 
 wp_reset_vars( array('tab', 'paged') );
-wp_enqueue_style( 'plugin-install' );
-wp_enqueue_script( 'plugin-install' );
-add_thickbox();
 
 //These are the tabs which are shown on the page,
 $tabs = array();
 
 //These are the tabs which are shown on the page,
 $tabs = array();
-$tabs['dashboard'] = __('Start Page'); //TODO: Better name?
+$tabs['dashboard'] = __('Search');
 if ( 'search' == $tab )
        $tabs['search'] = __('Search Results');
 if ( 'search' == $tab )
        $tabs['search'] = __('Search Results');
+$tabs['upload'] = __('Upload');
 $tabs['featured'] = __('Featured');
 $tabs['popular']  = __('Popular');
 $tabs['new']      = __('Newest');
 $tabs['updated']  = __('Recently Updated');
 
 $tabs['featured'] = __('Featured');
 $tabs['popular']  = __('Popular');
 $tabs['new']      = __('Newest');
 $tabs['updated']  = __('Recently Updated');
 
-$nonmenu_tabs = array('install', 'plugin-information', 'upload'); //Valid actions to perform which do not have a Menu item.
+$nonmenu_tabs = array('plugin-information'); //Valid actions to perform which do not have a Menu item.
 
 $tabs = apply_filters('install_plugins_tabs', $tabs );
 $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
 
 $tabs = apply_filters('install_plugins_tabs', $tabs );
 $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
@@ -45,6 +43,11 @@ if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_
 if( empty($paged) )
        $paged = 1;
 
 if( empty($paged) )
        $paged = 1;
 
+wp_enqueue_style( 'plugin-install' );
+wp_enqueue_script( 'plugin-install' );
+if ( 'plugin-information' != $tab )
+       add_thickbox();
+
 $body_id = $tab;
 
 do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information.
 $body_id = $tab;
 
 do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information.
@@ -53,7 +56,7 @@ include('admin-header.php');
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
        <ul class="subsubsub">
 <?php
 
        <ul class="subsubsub">
 <?php
@@ -61,7 +64,7 @@ $display_tabs = array();
 foreach ( (array)$tabs as $action => $text ) {
        $sep = ( end($tabs) != $text ) ? ' | ' : '';
        $class = ( $action == $tab ) ? ' class="current"' : '';
 foreach ( (array)$tabs as $action => $text ) {
        $sep = ( end($tabs) != $text ) ? ' | ' : '';
        $class = ( $action == $tab ) ? ' class="current"' : '';
-       $href = admin_url('plugin-install.php?tab='. $action);
+       $href = admin_url('plugin-install.php?tab=' . $action);
        echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
 }
 ?>
        echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
 }
 ?>
@@ -71,4 +74,3 @@ foreach ( (array)$tabs as $action => $text ) {
 </div>
 <?php
 include('admin-footer.php');
 </div>
 <?php
 include('admin-footer.php');
-?>
index ab7049198ec58fb1e607f6765477b7a18afcbe75..5a22807e8f829c9cda2336170d827dc26cc16393 100644 (file)
@@ -9,54 +9,78 @@
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
 
-$action = '';
-foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) {
-       if( isset($_POST[$action_key]) ) {
-               $action = $action_key;
-               break;
-       }
-}
-
-if( isset($_REQUEST['action']) && !empty($_REQUEST['action']) )
+if ( isset($_POST['clear-recent-list']) )
+       $action = 'clear-recent-list';
+elseif ( !empty($_REQUEST['action']) )
        $action = $_REQUEST['action'];
        $action = $_REQUEST['action'];
+elseif ( !empty($_REQUEST['action2']) )
+       $action = $_REQUEST['action2'];
+else
+       $action = false;
 
 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
 
 
 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
 
-if( !empty($action) ) {
-       switch( $action ) {
+$default_status = get_user_option('plugins_last_view');
+if ( empty($default_status) )
+       $default_status = 'all';
+$status = isset($_REQUEST['plugin_status']) ? $_REQUEST['plugin_status'] : $default_status;
+if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'search')) )
+       $status = 'all';
+if ( $status != $default_status && 'search' != $status )
+       update_usermeta($current_user->ID, 'plugins_last_view', $status);
+
+$page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1;
+
+//Clean up request URI from temporary args for screen options/paging uri's to work as expected.
+$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
+
+if ( !empty($action) ) {
+       switch ( $action ) {
                case 'activate':
                        check_admin_referer('activate-plugin_' . $plugin);
                case 'activate':
                        check_admin_referer('activate-plugin_' . $plugin);
+
                        $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
                        if ( is_wp_error( $result ) )
                                wp_die($result);
                        $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
                        if ( is_wp_error( $result ) )
                                wp_die($result);
+
                        $recent = (array)get_option('recently_activated');
                        if ( isset($recent[ $plugin ]) ) {
                                unset($recent[ $plugin ]);
                                update_option('recently_activated', $recent);
                        }
                        $recent = (array)get_option('recently_activated');
                        if ( isset($recent[ $plugin ]) ) {
                                unset($recent[ $plugin ]);
                                update_option('recently_activated', $recent);
                        }
-                       wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
+
+                       wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above
                        exit;
                        break;
                case 'activate-selected':
                        check_admin_referer('bulk-manage-plugins');
                        exit;
                        break;
                case 'activate-selected':
                        check_admin_referer('bulk-manage-plugins');
-                       activate_plugins($_POST['checked'], 'plugins.php?error=true');
+
+                       $plugins = (array) $_POST['checked'];
+                       $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Only activate plugins which are not already active.
+                       if ( empty($plugins) ) {
+                               wp_redirect("plugins.php?plugin_status=$status&paged=$page");
+                               exit;
+                       }
+
+                       activate_plugins($plugins, 'plugins.php?error=true');
 
                        $recent = (array)get_option('recently_activated');
 
                        $recent = (array)get_option('recently_activated');
-                       foreach( (array)$_POST['checked'] as $plugin => $time) {
+                       foreach ( $plugins as $plugin => $time)
                                if ( isset($recent[ $plugin ]) )
                                        unset($recent[ $plugin ]);
                                if ( isset($recent[ $plugin ]) )
                                        unset($recent[ $plugin ]);
-                       }
-                       if( $recent != get_option('recently_activated') ) //If array changed, update it.
-                               update_option('recently_activated', $recent);
 
 
-                       wp_redirect('plugins.php?activate-multi=true');
+                       update_option('recently_activated', $recent);
+
+                       wp_redirect("plugins.php?activate-multi=true&plugin_status=$status&paged=$page");
                        exit;
                        break;
                case 'error_scrape':
                        check_admin_referer('plugin-activation-error_' . $plugin);
                        exit;
                        break;
                case 'error_scrape':
                        check_admin_referer('plugin-activation-error_' . $plugin);
+
                        $valid = validate_plugin($plugin);
                        if ( is_wp_error($valid) )
                                wp_die($valid);
                        $valid = validate_plugin($plugin);
                        if ( is_wp_error($valid) )
                                wp_die($valid);
+
                        error_reporting( E_ALL ^ E_NOTICE );
                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
                        include(WP_PLUGIN_DIR . '/' . $plugin);
                        error_reporting( E_ALL ^ E_NOTICE );
                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
                        include(WP_PLUGIN_DIR . '/' . $plugin);
@@ -67,17 +91,27 @@ if( !empty($action) ) {
                        check_admin_referer('deactivate-plugin_' . $plugin);
                        deactivate_plugins($plugin);
                        update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
                        check_admin_referer('deactivate-plugin_' . $plugin);
                        deactivate_plugins($plugin);
                        update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
-                       wp_redirect('plugins.php?deactivate=true');
+                       wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page");
                        exit;
                        break;
                case 'deactivate-selected':
                        check_admin_referer('bulk-manage-plugins');
                        exit;
                        break;
                case 'deactivate-selected':
                        check_admin_referer('bulk-manage-plugins');
-                       deactivate_plugins($_POST['checked']);
+
+                       $plugins = (array) $_POST['checked'];
+                       $plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated.
+                       if ( empty($plugins) ) {
+                               wp_redirect("plugins.php?plugin_status=$status&paged=$page");
+                               exit;
+                       }
+
+                       deactivate_plugins($plugins);
+
                        $deactivated = array();
                        $deactivated = array();
-                       foreach ( (array)$_POST['checked'] as $plugin )
+                       foreach ( $plugins as $plugin )
                                $deactivated[ $plugin ] = time();
                                $deactivated[ $plugin ] = time();
+
                        update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
                        update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
-                       wp_redirect('plugins.php?deactivate-multi=true');
+                       wp_redirect("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page");
                        exit;
                        break;
                case 'delete-selected':
                        exit;
                        break;
                case 'delete-selected':
@@ -86,10 +120,15 @@ if( !empty($action) ) {
 
                        check_admin_referer('bulk-manage-plugins');
 
 
                        check_admin_referer('bulk-manage-plugins');
 
-                       $plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
+                       $plugins = (array) $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
+                       $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Do not allow to delete Activated plugins.
+                       if ( empty($plugins) ) {
+                               wp_redirect("plugins.php?plugin_status=$status&paged=$page");
+                               exit;
+                       }
+
                        include(ABSPATH . 'wp-admin/update.php');
 
                        include(ABSPATH . 'wp-admin/update.php');
 
-                       $title = __('Delete Plugin');
                        $parent_file = 'plugins.php';
 
                        if ( ! isset($_REQUEST['verify-delete']) ) {
                        $parent_file = 'plugins.php';
 
                        if ( ! isset($_REQUEST['verify-delete']) ) {
@@ -118,30 +157,30 @@ if( !empty($action) ) {
                                        }
                                ?>
                                <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
                                        }
                                ?>
                                <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
-                                       <ul>
+                                       <ul class="ul-disc">
                                                <?php
                                                foreach ( $plugin_info as $plugin )
                                                <?php
                                                foreach ( $plugin_info as $plugin )
-                                                       echo '<li>', sprintf(__('%s by %s'), $plugin['Name'], $plugin['Author']), '</li>';
+                                                       echo '<li>', sprintf(__('<strong>%s</strong> by <em>%s</em>'), $plugin['Name'], $plugin['Author']), '</li>';
                                                ?>
                                        </ul>
                                <p><?php _e('Are you sure you wish to delete these files?') ?></p>
                                                ?>
                                        </ul>
                                <p><?php _e('Are you sure you wish to delete these files?') ?></p>
-                               <form method="post" action="<?php echo clean_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
+                               <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
                                        <input type="hidden" name="verify-delete" value="1" />
                                        <input type="hidden" name="verify-delete" value="1" />
-                                       <input type="hidden" name="delete-selected" value="1" />
+                                       <input type="hidden" name="action" value="delete-selected" />
                                        <?php
                                                foreach ( (array)$plugins as $plugin )
                                        <?php
                                                foreach ( (array)$plugins as $plugin )
-                                                       echo '<input type="hidden" name="checked[]" value="' . attribute_escape($plugin) . '" />';
+                                                       echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />';
                                        ?>
                                        <?php wp_nonce_field('bulk-manage-plugins') ?>
                                        ?>
                                        <?php wp_nonce_field('bulk-manage-plugins') ?>
-                                       <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
+                                       <input type="submit" name="submit" value="<?php esc_attr_e('Yes, Delete these files') ?>" class="button" />
                                </form>
                                </form>
-                               <form method="post" action="<?php echo clean_url(wp_get_referer()); ?>" style="display:inline;">
-                                       <input type="submit" name="submit" value="<?php _e('No, Return me to the plugin list') ?>" class="button" />
+                               <form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;">
+                                       <input type="submit" name="submit" value="<?php esc_attr_e('No, Return me to the plugin list') ?>" class="button" />
                                </form>
 
                                <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
                                <div id="files-list" style="display:none;">
                                </form>
 
                                <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
                                <div id="files-list" style="display:none;">
-                                       <ul>
+                                       <ul class="code">
                                        <?php
                                                foreach ( (array)$files_to_delete as $file )
                                                        echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>';
                                        <?php
                                                foreach ( (array)$files_to_delete as $file )
                                                        echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>';
@@ -155,7 +194,9 @@ if( !empty($action) ) {
                        } //Endif verify-delete
                        $delete_result = delete_plugins($plugins);
 
                        } //Endif verify-delete
                        $delete_result = delete_plugins($plugins);
 
-                       wp_cache_delete('plugins', 'plugins');
+                       set_transient('plugins_delete_result_'.$user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
+                       wp_redirect("plugins.php?deleted=true&plugin_status=$status&paged=$page");
+                       exit;
                        break;
                case 'clear-recent-list':
                        update_option('recently_activated', array());
                        break;
                case 'clear-recent-list':
                        update_option('recently_activated', array());
@@ -166,25 +207,34 @@ if( !empty($action) ) {
 wp_enqueue_script('plugin-install');
 add_thickbox();
 
 wp_enqueue_script('plugin-install');
 add_thickbox();
 
+$help = '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>';
+$help .= '<p>' . sprintf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>';
+$help .= '<p>' . sprintf(__('You can find additional plugins for your site by using the new <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually.  To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%2$s</code> directory.  Once a plugin has been installed, you may activate it here.'), 'plugin-install.php', WP_PLUGIN_DIR) . '</p>';
+
+add_contextual_help('plugins', $help);
+
 $title = __('Manage Plugins');
 require_once('admin-header.php');
 
 $invalid = validate_active_plugins();
 if ( !empty($invalid) )
        foreach ( $invalid as $plugin_file => $error )
 $title = __('Manage Plugins');
 require_once('admin-header.php');
 
 $invalid = validate_active_plugins();
 if ( !empty($invalid) )
        foreach ( $invalid as $plugin_file => $error )
-               echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), wp_specialchars($plugin_file), $error->get_error_message()) . '</p></div>';
+               echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>';
 ?>
 
 <?php if ( isset($_GET['error']) ) : ?>
        <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
        <?php
                if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
 ?>
 
 <?php if ( isset($_GET['error']) ) : ?>
        <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
        <?php
                if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
-       <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&amp;plugin=' . attribute_escape($plugin) . '&amp;_wpnonce=' . attribute_escape($_GET['_error_nonce'])); ?>"></iframe>
+       <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&amp;plugin=' . esc_attr($plugin) . '&amp;_wpnonce=' . esc_attr($_GET['_error_nonce'])); ?>"></iframe>
        <?php
                }
        ?>
        </div>
        <?php
                }
        ?>
        </div>
-<?php elseif ( 'delete-selected' == $action ) :
+<?php elseif ( isset($_GET['deleted']) ) :
+               $delete_result = get_transient('plugins_delete_result_'.$user_ID);
+               delete_transient('plugins_delete_result'); //Delete it once we're done.
+
                if ( is_wp_error($delete_result) ) : ?>
                <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
                <?php else : ?>
                if ( is_wp_error($delete_result) ) : ?>
                <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
                <?php else : ?>
@@ -202,43 +252,107 @@ if ( !empty($invalid) )
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-       <h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 
-<p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
 <?php
 
 $all_plugins = get_plugins();
 <?php
 
 $all_plugins = get_plugins();
+$search_plugins = array();
 $active_plugins = array();
 $inactive_plugins = array();
 $recent_plugins = array();
 $active_plugins = array();
 $inactive_plugins = array();
 $recent_plugins = array();
-$recently_activated = (array) get_option('recently_activated');
+$recently_activated = get_option('recently_activated', array());
+$upgrade_plugins = array();
+
+set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 );
 
 
-//Clean out any plugins which were deactivated over a week ago.
+// Clean out any plugins which were deactivated over a week ago.
 foreach ( $recently_activated as $key => $time )
        if ( $time + (7*24*60*60) < time() ) //1 week
                unset($recently_activated[ $key ]);
 if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
        update_option('recently_activated', $recently_activated);
 foreach ( $recently_activated as $key => $time )
        if ( $time + (7*24*60*60) < time() ) //1 week
                unset($recently_activated[ $key ]);
 if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
        update_option('recently_activated', $recently_activated);
+$current = get_transient( 'update_plugins' );
 
 foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
 
        //Translate, Apply Markup, Sanitize HTML
 
 foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
 
        //Translate, Apply Markup, Sanitize HTML
-       $plugin_data = _get_plugin_data_markup_translate($plugin_data, true, true);
+       $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
+       $all_plugins[ $plugin_file ] = $plugin_data;
 
        //Filter into individual sections
        if ( is_plugin_active($plugin_file) ) {
                $active_plugins[ $plugin_file ] = $plugin_data;
        } else {
 
        //Filter into individual sections
        if ( is_plugin_active($plugin_file) ) {
                $active_plugins[ $plugin_file ] = $plugin_data;
        } else {
-               if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
+               if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
                        $recent_plugins[ $plugin_file ] = $plugin_data;
                        $recent_plugins[ $plugin_file ] = $plugin_data;
+               $inactive_plugins[ $plugin_file ] = $plugin_data;
+       }
+
+    if ( isset( $current->response[ $plugin_file ] ) )
+        $upgrade_plugins[ $plugin_file ] = $plugin_data;
+}
+
+$total_all_plugins = count($all_plugins);
+$total_inactive_plugins = count($inactive_plugins);
+$total_active_plugins = count($active_plugins);
+$total_recent_plugins = count($recent_plugins);
+$total_upgrade_plugins = count($upgrade_plugins);
+
+//Searching.
+if ( isset($_GET['s']) ) {
+       function _search_plugins_filter_callback($plugin) {
+               static $term;
+               if ( is_null($term) )
+                       $term = stripslashes($_GET['s']);
+               if (    stripos($plugin['Name'], $term) !== false ||
+                               stripos($plugin['Description'], $term) !== false ||
+                               stripos($plugin['Author'], $term) !== false ||
+                               stripos($plugin['PluginURI'], $term) !== false ||
+                               stripos($plugin['AuthorURI'], $term) !== false ||
+                               stripos($plugin['Version'], $term) !== false )
+                       return true;
                else
                else
-                       $inactive_plugins[ $plugin_file ] = $plugin_data;
+                       return false;
        }
        }
+       $status = 'search';
+       $search_plugins = array_filter($all_plugins, '_search_plugins_filter_callback');
+       $total_search_plugins = count($search_plugins);
 }
 
 }
 
-?>
+$plugin_array_name = "${status}_plugins";
+if ( empty($$plugin_array_name) && $status != 'all' ) {
+       $status = 'all';
+       $plugin_array_name = "${status}_plugins";
+}
+
+$plugins = &$$plugin_array_name;
+
+//Paging.
+$total_this_page = "total_{$status}_plugins";
+$total_this_page = $$total_this_page;
+$plugins_per_page = get_user_option('plugins_per_page');
+if ( empty($plugins_per_page) )
+       $plugins_per_page = 999;
+$plugins_per_page = apply_filters('plugins_per_page', $plugins_per_page);
+
+$start = ($page - 1) * $plugins_per_page;
+
+$page_links = paginate_links( array(
+       'base' => add_query_arg( 'paged', '%#%' ),
+       'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
+       'total' => ceil($total_this_page / $plugins_per_page),
+       'current' => $page
+));
+$page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
+       number_format_i18n( $start + 1 ),
+       number_format_i18n( min( $page * $plugins_per_page, $total_this_page ) ),
+       '<span class="total-type-count">' . number_format_i18n( $total_this_page ) . '</span>',
+       $page_links
+);
 
 
-<?php
 /**
  * @ignore
  *
 /**
  * @ignore
  *
@@ -246,25 +360,22 @@ foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
  * @param string $context
  */
 function print_plugins_table($plugins, $context = '') {
  * @param string $context
  */
 function print_plugins_table($plugins, $context = '') {
+       global $page;
 ?>
 <table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
        <thead>
        <tr>
 ?>
 <table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
        <thead>
        <tr>
-               <th scope="col" class="check-column"><input type="checkbox" /></th>
-               <th scope="col"><?php _e('Plugin'); ?></th>
-               <th scope="col" class="num"><?php _e('Version'); ?></th>
-               <th scope="col"><?php _e('Description'); ?></th>
-               <th scope="col" class="action-links"><?php _e('Action'); ?></th>
+               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
+               <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
+               <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
        </tr>
        </thead>
 
        <tfoot>
        <tr>
        </tr>
        </thead>
 
        <tfoot>
        <tr>
-               <th scope="col" class="check-column"><input type="checkbox" /></th>
-               <th scope="col"><?php _e('Plugin'); ?></th>
-               <th scope="col" class="num"><?php _e('Version'); ?></th>
-               <th scope="col"><?php _e('Description'); ?></th>
-               <th scope="col" class="action-links"><?php _e('Action'); ?></th>
+               <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
+               <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
+               <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
        </tr>
        </tfoot>
 
        </tr>
        </tfoot>
 
@@ -273,34 +384,61 @@ function print_plugins_table($plugins, $context = '') {
 
        if ( empty($plugins) ) {
                echo '<tr>
 
        if ( empty($plugins) ) {
                echo '<tr>
-                       <td colspan="6">' . __('No plugins to show') . '</td>
+                       <td colspan="3">' . __('No plugins to show') . '</td>
                </tr>';
        }
        foreach ( (array)$plugins as $plugin_file => $plugin_data) {
                </tr>';
        }
        foreach ( (array)$plugins as $plugin_file => $plugin_data) {
-               $action_links = array();
+               $actions = array();
+               $is_active = is_plugin_active($plugin_file);
 
 
-               if ( 'active' == $context )
-                       $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
-               else //Inactive or Recently deactivated
-                       $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
+               if ( $is_active )
+                       $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
+               else
+                       $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
 
                if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
 
                if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
-                       $action_links[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
+                       $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
 
 
-               $action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, $plugin_data, $context );
-               $action_links = apply_filters( "plugin_action_links_$plugin_file", $action_links, $plugin_file, $plugin_data, $context );
+               if ( ! $is_active && current_user_can('delete_plugins') )
+                       $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
 
 
+               $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
+               $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
+               $action_count = count($actions);
+               $class = $is_active ? 'active' : 'inactive';
                echo "
                echo "
-       <tr class='$context'>
-               <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
-               <td class='name'>{$plugin_data['Title']}</td>
-               <td class='vers'>{$plugin_data['Version']}</td>
+       <tr class='$class'>
+               <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
+               <td class='plugin-title'><strong>{$plugin_data['Name']}</strong></td>
                <td class='desc'><p>{$plugin_data['Description']}</p></td>
                <td class='desc'><p>{$plugin_data['Description']}</p></td>
-               <td class='togl action-links'>";
-               if ( !empty($action_links) )
-                       echo implode(' | ', $action_links);
-               echo '</td>
-       </tr>';
+       </tr>
+       <tr class='$class second'>
+               <td></td>
+               <td class='plugin-title'>";
+               echo '<div class="row-actions-visible">';
+               foreach ( $actions as $action => $link ) {
+                       $sep = end($actions) == $link ? '' : ' | ';
+                       echo "<span class='$action'>$link$sep</span>";
+               }
+               echo "</div></td>
+               <td class='desc'>";
+               $plugin_meta = array();
+               if ( !empty($plugin_data['Version']) )
+                       $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']);
+               if ( !empty($plugin_data['Author']) ) {
+                       $author = $plugin_data['Author'];
+                       if ( !empty($plugin_data['AuthorURI']) )
+                               $author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
+                       $plugin_meta[] = sprintf( __('By %s'), $author );
+               }
+               if ( ! empty($plugin_data['PluginURI']) )
+                       $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __('Visit plugin site') . '</a>';
+
+               $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $context);
+               echo implode(' | ', $plugin_meta);
+               echo "</td>
+       </tr>\n";
+
                do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
                do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
        }
                do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
                do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
        }
@@ -315,81 +453,103 @@ function print_plugins_table($plugins, $context = '') {
  *
  * @param string $context
  */
  *
  * @param string $context
  */
-function print_plugin_actions($context) {
+function print_plugin_actions($context, $field_name = 'action' ) {
 ?>
        <div class="alignleft actions">
 ?>
        <div class="alignleft actions">
-               <select name="action">
+               <select name="<?php echo $field_name; ?>">
                        <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
                        <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
-       <?php if( 'active' != $context ) : ?>
+       <?php if ( 'active' != $context ) : ?>
                        <option value="activate-selected"><?php _e('Activate'); ?></option>
        <?php endif; ?>
                        <option value="activate-selected"><?php _e('Activate'); ?></option>
        <?php endif; ?>
-       <?php if ( 'active' == $context ) : ?>
+       <?php if ( 'inactive' != $context && 'recent' != $context ) : ?>
                        <option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
        <?php endif; ?>
                        <option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
        <?php endif; ?>
-       <?php if( current_user_can('delete_plugins') && ( 'recent' == $context || 'inactive' == $context ) ) : ?>
+       <?php if ( current_user_can('delete_plugins') && ( 'active' != $context ) ) : ?>
                        <option value="delete-selected"><?php _e('Delete'); ?></option>
        <?php endif; ?>
                </select>
                        <option value="delete-selected"><?php _e('Delete'); ?></option>
        <?php endif; ?>
                </select>
-               <input type="submit" name="doaction_active" value="<?php _e('Apply'); ?>" class="button-secondary action" />
+               <input type="submit" name="doaction_active" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary action" />
        <?php if( 'recent' == $context ) : ?>
        <?php if( 'recent' == $context ) : ?>
-               <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
+               <input type="submit" name="clear-recent-list" value="<?php esc_attr_e('Clear List') ?>" class="button-secondary" />
        <?php endif; ?>
        </div>
 <?php
 }
 ?>
 
        <?php endif; ?>
        </div>
 <?php
 }
 ?>
 
-<?php if ( ! empty($active_plugins) ) : ?>
-<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
-<form method="post" action="<?php echo admin_url('plugins.php') ?>">
-<?php wp_nonce_field('bulk-manage-plugins') ?>
-
-<div class="tablenav">
-<?php print_plugin_actions('active') ?>
-</div>
-<div class="clear"></div>
-<?php print_plugins_table($active_plugins, 'active') ?>
+<form method="get" action="">
+<p class="search-box">
+       <label class="screen-reader-text" for="plugin-search-input"><?php _e( 'Search Plugins' ); ?>:</label>
+       <input type="text" id="plugin-search-input" name="s" value="<?php _admin_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Plugins' ); ?>" class="button" />
+</p>
 </form>
 
 </form>
 
-<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p>
-<?php endif; ?>
-
-<?php if ( ! empty($recent_plugins) ) : ?>
-<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
-<p><?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?></p>
 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
 <?php wp_nonce_field('bulk-manage-plugins') ?>
+<input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" />
+<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
+
+<ul class="subsubsub">
+<?php
+$status_links = array();
+$class = ( 'all' == $status ) ? ' class="current"' : '';
+$status_links[] = "<li><a href='plugins.php?plugin_status=all' $class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_all_plugins, 'plugins' ), number_format_i18n( $total_all_plugins ) ) . '</a>';
+if ( ! empty($active_plugins) ) {
+       $class = ( 'active' == $status ) ? ' class="current"' : '';
+       $status_links[] = "<li><a href='plugins.php?plugin_status=active' $class>" . sprintf( _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $total_active_plugins ), number_format_i18n( $total_active_plugins ) ) . '</a>';
+}
+if ( ! empty($recent_plugins) ) {
+       $class = ( 'recent' == $status ) ? ' class="current"' : '';
+       $status_links[] = "<li><a href='plugins.php?plugin_status=recent' $class>" . sprintf( _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $total_recent_plugins ), number_format_i18n( $total_recent_plugins ) ) . '</a>';
+}
+if ( ! empty($inactive_plugins) ) {
+       $class = ( 'inactive' == $status ) ? ' class="current"' : '';
+       $status_links[] = "<li><a href='plugins.php?plugin_status=inactive' $class>" . sprintf( _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $total_inactive_plugins ), number_format_i18n( $total_inactive_plugins ) ) . '</a>';
+}
+if ( ! empty($upgrade_plugins) ) {
+       $class = ( 'upgrade' == $status ) ? ' class="current"' : '';
+       $status_links[] = "<li><a href='plugins.php?plugin_status=upgrade' $class>" . sprintf( _n( 'Upgrade Available <span class="count">(%s)</span>', 'Upgrade Available <span class="count">(%s)</span>', $total_upgrade_plugins ), number_format_i18n( $total_upgrade_plugins ) ) . '</a>';
+}
+if ( ! empty($search_plugins) ) {
+       $class = ( 'search' == $status ) ? ' class="current"' : '';
+       $term = isset($_REQUEST['s']) ? urlencode(stripslashes($_REQUEST['s'])) : '';
+       $status_links[] = "<li><a href='plugins.php?s=$term' $class>" . sprintf( _n( 'Search Results <span class="count">(%s)</span>', 'Search Results <span class="count">(%s)</span>', $total_search_plugins ), number_format_i18n( $total_search_plugins ) ) . '</a>';
+}
+echo implode( " |</li>\n", $status_links ) . '</li>';
+unset( $status_links );
+?>
+</ul>
 
 <div class="tablenav">
 
 <div class="tablenav">
-<?php print_plugin_actions('recent') ?>
+<?php
+if ( $page_links )
+       echo '<div class="tablenav-pages">', $page_links_text, '</div>';
+
+print_plugin_actions($status);
+?>
 </div>
 <div class="clear"></div>
 </div>
 <div class="clear"></div>
-<?php print_plugins_table($recent_plugins, 'recent') ?>
-</form>
-<?php endif; ?>
-
-<?php if ( ! empty($inactive_plugins) ) : ?>
-<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
-<form method="post" action="<?php echo admin_url('plugins.php') ?>">
-<?php wp_nonce_field('bulk-manage-plugins') ?>
+<?php
+       if ( $total_this_page > $plugins_per_page )
+               $plugins = array_slice($plugins, $start, $plugins_per_page);
 
 
+       print_plugins_table($plugins, $status);
+?>
 <div class="tablenav">
 <div class="tablenav">
-<?php print_plugin_actions('inactive') ?>
+<?php
+if ( $page_links )
+       echo "<div class='tablenav-pages'>$page_links_text</div>";
+
+print_plugin_actions($status, "action2");
+?>
 </div>
 </div>
-<div class="clear"></div>
-<?php print_plugins_table($inactive_plugins, 'inactive') ?>
 </form>
 </form>
-<?php endif; ?>
 
 <?php if ( empty($all_plugins) ) : ?>
 <p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
 <?php endif; ?>
 
 
 <?php if ( empty($all_plugins) ) : ?>
 <p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
 <?php endif; ?>
 
-<h2><?php _e('Get More Plugins'); ?></h2>
-<p><?php _e('You can find additional plugins for your site by using the new <a href="plugin-install.php">Plugin Browser/Installer</a> functionality, Or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually.'); ?></p>
-<p><?php printf(__('To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory.'), WP_PLUGIN_DIR); ?></p>
-<p><?php _e('Once a plugin has been installed, you may activate it here.'); ?></p>
-
 </div>
 
 <?php
 </div>
 
 <?php
index 5f04fa71ff0f7613874c7573dbf28599b5465390..008778faeb2409b081f87685557a665464b6a7b5 100644 (file)
@@ -38,21 +38,14 @@ function redirect_post($post_ID = '') {
                        $location = 'sidebar.php?a=c';
                elseif ( isset($_POST['publish']) )
                        $location = 'sidebar.php?a=b';
                        $location = 'sidebar.php?a=c';
                elseif ( isset($_POST['publish']) )
                        $location = 'sidebar.php?a=b';
-       } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
-               if ( isset($_POST['_wp_original_http_referer']) && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false )
-                       $location = add_query_arg( array(
-                               '_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ),
-                               'message' => 1
-                       ), get_edit_post_link( $post_ID, 'url' ) );
-               else {
-                       if ( isset( $_POST['publish'] ) ) {
-                               if ( 'pending' == get_post_status( $post_ID ) )
-                                       $location = add_query_arg( 'message', 8, get_edit_post_link( $post_ID, 'url' ) );
-                               else
-                                       $location = add_query_arg( 'message', 6, get_edit_post_link( $post_ID, 'url' ) );
-                       } else {
-                               $location = add_query_arg( 'message', 7, get_edit_post_link( $post_ID, 'url' ) );
-                       }
+       } elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) ) {
+               if ( isset( $_POST['publish'] ) ) {
+                       if ( 'pending' == get_post_status( $post_ID ) )
+                               $location = add_query_arg( 'message', 8, get_edit_post_link( $post_ID, 'url' ) );
+                       else
+                               $location = add_query_arg( 'message', 6, get_edit_post_link( $post_ID, 'url' ) );
+               } else {
+                       $location = add_query_arg( 'message', 1, get_edit_post_link( $post_ID, 'url' ) );
                }
        } elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
                $location = add_query_arg( 'message', 2, wp_get_referer() );
                }
        } elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
                $location = add_query_arg( 'message', 2, wp_get_referer() );
@@ -62,15 +55,6 @@ function redirect_post($post_ID = '') {
                $location = add_query_arg( 'message', 3, wp_get_referer() );
                $location = explode('#', $location);
                $location = $location[0] . '#postcustom';
                $location = add_query_arg( 'message', 3, wp_get_referer() );
                $location = explode('#', $location);
                $location = $location[0] . '#postcustom';
-       } elseif (!empty($referredby) && $referredby != $referer) {
-               $location = $_POST['referredby'];
-               $location = remove_query_arg('_wp_original_http_referer', $location);
-               if ( false !== strpos($location, 'edit.php') || false !== strpos($location, 'edit-post-drafts.php') )
-                       $location = add_query_arg('posted', $post_ID, $location);
-               elseif ( false !== strpos($location, 'wp-admin') )
-                       $location = "post-new.php?posted=$post_ID";
-       } elseif ( isset($_POST['publish']) ) {
-               $location = "post-new.php?posted=$post_ID";
        } elseif ($action == 'editattachment') {
                $location = 'attachments.php';
        } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {
        } elseif ($action == 'editattachment') {
                $location = 'attachments.php';
        } elseif ( 'post-quickpress-save-cont' == $_POST['action'] ) {
@@ -131,7 +115,7 @@ case 'edit':
        $post_ID = $p = (int) $_GET['post'];
        $post = get_post($post_ID);
 
        $post_ID = $p = (int) $_GET['post'];
        $post = get_post($post_ID);
 
-       if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") );
+       if ( empty($post->ID) ) wp_die( __('You attempted to edit a post that doesn&#8217;t exist. Perhaps it was deleted?') );
 
        if ( 'post' != $post->post_type ) {
                wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
 
        if ( 'post' != $post->post_type ) {
                wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
@@ -151,7 +135,7 @@ case 'edit':
                if ( $last = wp_check_post_lock( $post->ID ) ) {
                        $last_user = get_userdata( $last );
                        $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
                if ( $last = wp_check_post_lock( $post->ID ) ) {
                        $last_user = get_userdata( $last );
                        $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
-                       $message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
+                       $message = sprintf( __( 'Warning: %s is currently editing this post' ), esc_html( $last_user_name ) );
                        $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
                        add_action('admin_notices', create_function( '', "echo '$message';" ) );
                } else {
                        $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
                        add_action('admin_notices', create_function( '', "echo '$message';" ) );
                } else {
index 1823d2173e99ef57b38491fa0072ffe7ecab535e..c6632b51952c56529521c22099020612847d4fbf 100644 (file)
@@ -8,22 +8,10 @@
 
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
+header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 
 
-if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' ) );
-
-/**
- * Replace forward slash with backslash and slash.
- *
- * @package WordPress
- * @subpackage Press_This
- * @since 2.6.0
- *
- * @param string $string
- * @return string
- */
-function preg_quote2($string) {
-       return str_replace('/', '\/', preg_quote($string));
-}
+if ( ! current_user_can('edit_posts') )
+       wp_die( __( 'Cheatin&#8217; uh?' ) );
 
 /**
  * Convert characters.
 
 /**
  * Convert characters.
@@ -54,25 +42,25 @@ function aposfix($text) {
 function press_it() {
        // define some basic variables
        $quick['post_status'] = 'draft'; // set as draft first
 function press_it() {
        // define some basic variables
        $quick['post_status'] = 'draft'; // set as draft first
-       $quick['post_category'] = $_REQUEST['post_category'];
-       $quick['tags_input'] = $_REQUEST['tags_input'];
-       $quick['post_title'] = $_REQUEST['title'];
+       $quick['post_category'] = isset($_REQUEST['post_category']) ? $_REQUEST['post_category'] : null;
+       $quick['tax_input'] = isset($_REQUEST['tax_input']) ? $_REQUEST['tax_input'] : '';
+       $quick['post_title'] = isset($_REQUEST['title']) ? $_REQUEST['title'] : '';
        $quick['post_content'] = '';
 
        // insert the post with nothing in it, to get an ID
        $post_ID = wp_insert_post($quick, true);
        $quick['post_content'] = '';
 
        // insert the post with nothing in it, to get an ID
        $post_ID = wp_insert_post($quick, true);
-       $content = $_REQUEST['content'];
+       $content = isset($_REQUEST['content']) ? $_REQUEST['content'] : '';
 
 
-       if($_REQUEST['photo_src'])
+       $upload = false;
+       if( !empty($_REQUEST['photo_src']) && current_user_can('upload_files') )
                foreach( (array) $_REQUEST['photo_src'] as $key => $image)
                        // see if files exist in content - we don't want to upload non-used selected files.
                        if( strpos($_REQUEST['content'], $image) !== false ) {
                foreach( (array) $_REQUEST['photo_src'] as $key => $image)
                        // see if files exist in content - we don't want to upload non-used selected files.
                        if( strpos($_REQUEST['content'], $image) !== false ) {
-                               $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
+                               $desc = isset($_REQUEST['photo_description'][$key]) ? $_REQUEST['photo_description'][$key] : '';
+                               $upload = media_sideload_image($image, $post_ID, $desc);
 
 
-                               // Replace the POSTED content <img> with correct uploaded ones.
-                               // escape quote for matching
-                               $quoted = preg_quote2($image);
-                               if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content);
+                               // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
+                               if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote($image, '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
                        }
 
        // set the post_content and status
                        }
 
        // set the post_content and status
@@ -94,23 +82,25 @@ function press_it() {
 }
 
 // For submitted posts.
 }
 
 // For submitted posts.
-if ( 'post' == $_REQUEST['action'] ) {
+if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) {
        check_admin_referer('press-this');
        $post_ID = press_it();
        $posted =  $post_ID;
        check_admin_referer('press-this');
        $post_ID = press_it();
        $posted =  $post_ID;
+} else {
+       $post_ID = 0;
 }
 
 // Set Variables
 }
 
 // Set Variables
-$title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
-$selection = trim( aposfix( stripslashes($_GET['s']) ) );
+$title = isset($_GET['t']) ? esc_html(aposfix(stripslashes($_GET['t']))) : '';
+$selection = isset($_GET['s']) ? trim( aposfix( stripslashes($_GET['s']) ) ) : '';
 if ( ! empty($selection) ) {
        $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
        $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
 }
 if ( ! empty($selection) ) {
        $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
        $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
 }
-$url = clean_url($_GET['u']);
-$image = $_GET['i'];
+$url = isset($_GET['u']) ? esc_url($_GET['u']) : '';
+$image = isset($_GET['i']) ? $_GET['i'] : '';
 
 
-if($_REQUEST['ajax']) {
+if ( !empty($_REQUEST['ajax']) ) {
 switch ($_REQUEST['ajax']) {
        case 'video': ?>
                <script type="text/javascript" charset="utf-8">
 switch ($_REQUEST['ajax']) {
        case 'video': ?>
                <script type="text/javascript" charset="utf-8">
@@ -145,12 +135,12 @@ switch ($_REQUEST['ajax']) {
                <h3 class="tb"><label for="this_photo_description"><?php _e('Description') ?></label></h3>
                <div class="titlediv">
                <div class="titlewrap">
                <h3 class="tb"><label for="this_photo_description"><?php _e('Description') ?></label></h3>
                <div class="titlediv">
                <div class="titlewrap">
-                       <input id="this_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
+                       <input id="this_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/>
                </div>
                </div>
 
                </div>
                </div>
 
-               <p class="centered"><input type="hidden" name="this_photo" value="<?php echo attribute_escape($image); ?>" id="this_photo" />
-                       <a href="#" class="select"><img src="<?php echo clean_url($image); ?>" alt="<?php echo attribute_escape(__('Click to insert.')); ?>" title="<?php echo attribute_escape(__('Click to insert.')); ?>" /></a></p>
+               <p class="centered"><input type="hidden" name="this_photo" value="<?php echo esc_attr($image); ?>" id="this_photo" />
+                       <a href="#" class="select"><img src="<?php echo esc_url($image); ?>" alt="<?php echo esc_attr(__('Click to insert.')); ?>" title="<?php echo esc_attr(__('Click to insert.')); ?>" /></a></p>
 
                <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
 
 
                <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
 
@@ -178,7 +168,7 @@ switch ($_REQUEST['ajax']) {
                <h3 class="tb"><label for="photo_description"><?php _e('Description') ?></label></h3>
                <div id="titlediv">
                        <div class="titlewrap">
                <h3 class="tb"><label for="photo_description"><?php _e('Description') ?></label></h3>
                <div id="titlediv">
                        <div class="titlewrap">
-                       <input id="this_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
+                       <input id="this_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/>
                        </div>
                </div>
 
                        </div>
                </div>
 
@@ -215,7 +205,7 @@ switch ($_REQUEST['ajax']) {
                                                $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
                                        else
                                                $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
                                                $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
                                        else
                                                $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
-                               $sources[] = clean_url($src);
+                               $sources[] = esc_url($src);
                        }
                        return "'" . implode("','", $sources) . "'";
                }
                        }
                        return "'" . implode("','", $sources) . "'";
                }
@@ -232,7 +222,7 @@ switch ($_REQUEST['ajax']) {
                        var my_src = eval(
                                jQuery.ajax({
                                        type: "GET",
                        var my_src = eval(
                                jQuery.ajax({
                                        type: "GET",
-                                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+                                       url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
                                        cache : false,
                                        async : false,
                                        data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
                                        cache : false,
                                        async : false,
                                        data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
@@ -243,7 +233,7 @@ switch ($_REQUEST['ajax']) {
                                var my_src = eval(
                                jQuery.ajax({
                                        type: "GET",
                                var my_src = eval(
                                jQuery.ajax({
                                        type: "GET",
-                                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+                                       url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
                                        cache : false,
                                        async : false,
                                        data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
                                        cache : false,
                                        async : false,
                                        data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
@@ -338,7 +328,16 @@ die;
        wp_enqueue_style( 'colors' );
        wp_enqueue_script( 'post' );
        wp_enqueue_script('editor');
        wp_enqueue_style( 'colors' );
        wp_enqueue_script( 'post' );
        wp_enqueue_script('editor');
+?>
+<script type="text/javascript">
+//<![CDATA[
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
+var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
+//]]>
+</script>
 
 
+<?php
        do_action('admin_print_styles');
        do_action('admin_print_scripts');
        do_action('admin_head');
        do_action('admin_print_styles');
        do_action('admin_print_scripts');
        do_action('admin_head');
@@ -349,23 +348,6 @@ die;
        }
 ?>
        <script type="text/javascript">
        }
 ?>
        <script type="text/javascript">
-    jQuery('#tags-input').hide();
-       tag_update_quickclicks();
-       // add the quickadd form
-       jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="submit" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" onclick="return false;" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
-
-       jQuery('#tagadd').click( tag_flush_to_text );
-       jQuery('#newtag').focus(function() {
-               if ( this.value == postL10n.addTag )
-                       jQuery(this).val( '' ).removeClass( 'form-input-tip' );
-       });
-       jQuery('#newtag').blur(function() {
-               if ( this.value == '' )
-                       jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
-       });
-       // auto-save tags on post save/publish
-       jQuery('#publish').click( tag_save_on_publish );
-       jQuery('#save').click( tag_save_on_publish );
        function insert_plain_editor(text) {
                edCanvas = document.getElementById('content');
                edInsertContent(edCanvas, text);
        function insert_plain_editor(text) {
                edCanvas = document.getElementById('content');
                edInsertContent(edCanvas, text);
@@ -395,15 +377,17 @@ die;
                jQuery('#extra_fields').show();
                switch(tab_name) {
                        case 'video' :
                jQuery('#extra_fields').show();
                switch(tab_name) {
                        case 'video' :
-                               jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
+                               jQuery('#extra_fields').load('<?php echo esc_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo esc_attr($selection); ?>'}, function() {
                                        <?php
                                        $content = '';
                                        if ( preg_match("/youtube\.com\/watch/i", $url) ) {
                                                list($domain, $video_id) = split("v=", $url);
                                        <?php
                                        $content = '';
                                        if ( preg_match("/youtube\.com\/watch/i", $url) ) {
                                                list($domain, $video_id) = split("v=", $url);
+                                               $video_id = esc_attr($video_id);
                                                $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
 
                                        } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
                                                list($domain, $video_id) = split(".com/", $url);
                                                $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
 
                                        } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
                                                list($domain, $video_id) = split(".com/", $url);
+                                               $video_id = esc_attr($video_id);
                                                $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />      <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
 
                                                if ( trim($selection) == '' )
                                                $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />      <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
 
                                                if ( trim($selection) == '' )
@@ -418,11 +402,11 @@ die;
                                return false;
                                break;
                        case 'photo' :
                                return false;
                                break;
                        case 'photo' :
-                               jQuery('#extra_fields').before('<p id="waiting"><img src="images/loading.gif" alt="" /> <?php echo js_escape( __( 'Loading...' ) ); ?></p>');
+                               jQuery('#extra_fields').before('<p id="waiting"><img src="images/wpspin_light.gif" alt="" /> <?php echo esc_js( __( 'Loading...' ) ); ?></p>');
                                jQuery.ajax({
                                        type: "GET",
                                        cache : false,
                                jQuery.ajax({
                                        type: "GET",
                                        cache : false,
-                                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+                                       url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
                                        data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
                                        dataType : "script",
                                        success : function() {
                                        data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
                                        dataType : "script",
                                        success : function() {
@@ -469,22 +453,37 @@ die;
                        <!-- This div holds the photo metadata -->
                        <div class="photolist"></div>
 
                        <!-- This div holds the photo metadata -->
                        <div class="photolist"></div>
 
+                       <div id="submitdiv" class="stuffbox">
+                               <h3><?php _e('Publish') ?></h3>
+                               <div class="inside">
+                                       <p>
+                                               <input class="button" type="submit" name="draft" value="<?php esc_attr_e('Save Draft') ?>" id="save" />
+                                               <?php if ( current_user_can('publish_posts') ) { ?>
+                                                       <input class="button-primary" type="submit" name="publish" value="<?php esc_attr_e('Publish') ?>" id="publish" />
+                                               <?php } else { ?>
+                                                       <br /><br /><input class="button-primary" type="submit" name="review" value="<?php esc_attr_e('Submit for Review') ?>" id="review" />
+                                               <?php } ?>
+                                               <img src="images/wpspin_light.gif" alt="" id="saving" style="display:none;" />
+                                       </p>
+                               </div>
+                       </div>
+
                        <div id="categorydiv" class="stuffbox">
                        <div id="categorydiv" class="stuffbox">
-                               <h2><?php _e('Categories') ?></h2>
+                               <h3><?php _e('Categories') ?></h3>
                                <div class="inside">
 
                                <div class="inside">
 
-                                       <div id="categories-all" class="ui-tabs-panel">
+                                       <div id="categories-all" class="tabs-panel">
                                                <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
                                                <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-                                                       <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
+                                                       <?php wp_category_checklist($post_ID, false) ?>
                                                </ul>
                                        </div>
 
                                        <div id="category-adder" class="wp-hidden-children">
                                                <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a>
                                                <p id="category-add" class="wp-hidden-child">
                                                </ul>
                                        </div>
 
                                        <div id="category-adder" class="wp-hidden-children">
                                                <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a>
                                                <p id="category-add" class="wp-hidden-child">
-                                                       <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
-                                                       <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
-                                                       <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
+                                                       <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
+                                                       <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
+                                                       <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
                                                        <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
                                                        <span id="category-ajax-response"></span>
                                                </p>
                                                        <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
                                                        <span id="category-ajax-response"></span>
                                                </p>
@@ -492,25 +491,21 @@ die;
                                </div>
                        </div>
 
                                </div>
                        </div>
 
-                       <div class="stuffbox">
-                               <h2><?php _e('Tags') ?></h2>
+                       <div id="tagsdiv-post_tag" class="stuffbox" >
+                               <h3><span><?php _e('Post Tags'); ?></span></h3>
                                <div class="inside">
                                <div class="inside">
-
-                                       <div id="jaxtag">
-                                               <label class="hidden" for="newtag"><?php _e('Tags'); ?></label>
-                                               <input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" />
+                                       <div class="tagsdiv" id="post_tag">
+                                               <p class="jaxtag">
+                                                       <label class="screen-reader-text" for="newtag"><?php _e('Post Tags'); ?></label>
+                                                       <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" />
+                                                       <span class="ajaxtag" style="display:none;">
+                                                               <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php esc_attr_e('Add new tag'); ?>" />
+                                                               <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
+                                                       </span>
+                                               </p>
+                                               <div class="tagchecklist"></div>
                                        </div>
                                        </div>
-                                       <div id="tagchecklist"></div>
-                               </div>
-                       </div>
-                       <div id="submitdiv" class="postbox">
-                               <h2><?php _e('Publish') ?></h2>
-                               <div class="inside">
-                                       <p>
-                                               <input class="button" type="submit" name="draft" value="<?php _e('Save Draft') ?>" id="save" />
-                                               <input class="button-primary" type="submit" name="publish" value="<?php _e('Publish') ?>" id="publish" />
-                                               <img src="images/loading-publish.gif" alt="" id="saving" style="display:none;"/>
-                                       </p>
+                                       <p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags in Post Tags'); ?></a></p>
                                </div>
                        </div>
                </div>
                                </div>
                        </div>
                </div>
@@ -523,7 +518,7 @@ die;
 
                <div id="titlediv">
                        <div class="titlewrap">
 
                <div id="titlediv">
                        <div class="titlewrap">
-                               <input name="title" id="title" class="text" value="<?php echo attribute_escape($title);?>"/>
+                               <input name="title" id="title" class="text" value="<?php echo esc_attr($title);?>"/>
                        </div>
                </div>
 
                        </div>
                </div>
 
@@ -531,9 +526,11 @@ die;
 
                <div class="postdivrich">
                        <ul id="actions">
 
                <div class="postdivrich">
                        <ul id="actions">
+
                                <li id="photo_button">
                                <li id="photo_button">
-                                       Add: <a title="<?php _e('Insert an Image'); ?>" href="#">
+                                       Add: <?php if ( current_user_can('upload_files') ) { ?><a title="<?php _e('Insert an Image'); ?>" href="#">
 <img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a>
 <img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a>
+                                       <?php } ?>
                                </li>
                                <li id="video_button">
                                        <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="images/media-button-video.gif"/></a>
                                </li>
                                <li id="video_button">
                                        <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="images/media-button-video.gif"/></a>
@@ -542,9 +539,9 @@ die;
                                <li id="switcher">
                                        <?php wp_print_scripts( 'quicktags' ); ?>
                                        <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?>
                                <li id="switcher">
                                        <?php wp_print_scripts( 'quicktags' ); ?>
                                        <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?>
-                                       <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
-                                       <a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
-                                       <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
+                                       <a id="edButtonHTML" onclick="switchEditors.go('content', 'html');"><?php _e('HTML'); ?></a>
+                                       <a id="edButtonPreview" class="active" onclick="switchEditors.go('content', 'tinymce');"><?php _e('Visual'); ?></a>
+                                       <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('content')" /></div>
                                </li>
                                <?php } ?>
                        </ul>
                                </li>
                                <?php } ?>
                        </ul>
@@ -559,5 +556,7 @@ die;
        </div>
 </div>
 </form>
        </div>
 </div>
 </form>
+<?php do_action('admin_print_footer_scripts'); ?>
+<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
 </body>
 </html>
 </body>
 </html>
index c93357cc36cb06d8971999d9457912a5e7fe6150..9c3ce3630b4accc1725a639c15391fc635a998a2 100644 (file)
@@ -177,7 +177,7 @@ foreach ( _wp_post_revision_fields() as $field => $field_title ) :
        ?>
 
        <tr id="revision-field-<?php echo $field; ?>">
        ?>
 
        <tr id="revision-field-<?php echo $field; ?>">
-               <th scope="row"><?php echo wp_specialchars( $field_title ); ?></th>
+               <th scope="row"><?php echo esc_html( $field_title ); ?></th>
                <td><div class="pre"><?php echo $content; ?></div></td>
        </tr>
 
                <td><div class="pre"><?php echo $content; ?></div></td>
        </tr>
 
index 467711aa45fa109abc597c47ce8aeedc1b370e62..d56c2ef62049482418b6f092c64423214b5288f8 100644 (file)
@@ -211,7 +211,7 @@ td.available-theme {
 #normal-sortables .postbox .submit {
        float: left;
 }
 #normal-sortables .postbox .submit {
        float: left;
 }
-#post-body #tagsdiv #newtag {
+#post-body .tagsdiv #newtag {
        margin-right: 0;
        margin-left: 5px;
 }
        margin-right: 0;
        margin-left: 5px;
 }
@@ -221,18 +221,18 @@ td.available-theme {
 #comment-status-radio input {
        margin: 2px 0 5px 3px;
 }
 #comment-status-radio input {
        margin: 2px 0 5px 3px;
 }
-#tagchecklist {
+.tagchecklist {
        margin-left: 0;
        margin-right: 10px;
 }
        margin-left: 0;
        margin-right: 10px;
 }
-#tagchecklist strong {
+.tagchecklist strong {
        margin-left: 0;
        margin-right: -8px;
 }
        margin-left: 0;
        margin-right: -8px;
 }
-#tagchecklist span {
+.tagchecklist span {
        float: right;
 }
        float: right;
 }
-#tagchecklist span a {
+.tagchecklist span a {
        margin: 6px -9px 0 0;
        float: right;
 }
        margin: 6px -9px 0 0;
        float: right;
 }
@@ -242,7 +242,7 @@ td.available-theme {
 #poststuff h2 {
        clear: right;
 }
 #poststuff h2 {
        clear: right;
 }
-.setting-description, .form-wrap p {
+.description, .form-wrap p {
        font-family: Tahoma, Arial;
 }
 /* 1500 - 1800
        font-family: Tahoma, Arial;
 }
 /* 1500 - 1800
@@ -292,7 +292,7 @@ td.available-theme {
        margin-left: 0;
        margin-right: 120px;
 }
        margin-left: 0;
        margin-right: 120px;
 }
-#post-body ul#category-tabs li.ui-tabs-selected {
+#post-body ul#category-tabs li.tabs {
        -moz-border-radius: 0 3px 3px 0;
        -webkit-border-top-left-radius: 0;
        -webkit-border-top-right-radius: 3px;
        -moz-border-radius: 0 3px 3px 0;
        -webkit-border-top-left-radius: 0;
        -webkit-border-top-right-radius: 3px;
@@ -308,13 +308,13 @@ td.available-theme {
        text-align: left;
        margin: 0 0 0 -120px;
 }
        text-align: left;
        margin: 0 0 0 -120px;
 }
-#post-body #categorydiv div.ui-tabs-panel,
-#post-body #linkcategorydiv div.ui-tabs-panel {
+#post-body #categorydiv div.tabs-panel,
+#post-body #linkcategorydiv div.tabs-panel {
        margin: 0 120px 0 5px;
 }
 /* 1800 - 2000
 =================================== */
        margin: 0 120px 0 5px;
 }
 /* 1800 - 2000
 =================================== */
-#side-info-column #category-tabs li {
+#side-sortables #category-tabs li {
        padding-right: 0;
        padding-left: 8px;
 }
        padding-right: 0;
        padding-left: 8px;
 }
@@ -529,6 +529,14 @@ td.action-links, th.action-links {
        padding-left: 0;
        padding-right: 25px;
 }
        padding-left: 0;
        padding-right: 25px;
 }
+
+ol {
+       list-style-type:decimal;
+       margin-left:0;
+       margin-right:2em;
+}
+
+
 /* TinyMCE
 =================================== */
 .clearlooks2 .mceTop .mceLeft {
 /* TinyMCE
 =================================== */
 .clearlooks2 .mceTop .mceLeft {
index 4b0b564998067fe941f9af3b5dc96e77c91a2257..01b8f6a5fab00e4d0daf08e1d84074d1d22e9dd7 100644 (file)
@@ -26,24 +26,24 @@ define('WPINC', 'wp-includes');
 define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
 /**#@-*/
 
 define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
 /**#@-*/
 
-require_once('../wp-includes/compat.php');
-require_once('../wp-includes/functions.php');
-require_once('../wp-includes/classes.php');
+require_once(ABSPATH . WPINC . '/compat.php');
+require_once(ABSPATH . WPINC . '/functions.php');
+require_once(ABSPATH . WPINC . '/classes.php');
 
 
-if (!file_exists('../wp-config-sample.php'))
+if (!file_exists(ABSPATH . 'wp-config-sample.php'))
        wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
 
        wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
 
-$configFile = file('../wp-config-sample.php');
+$configFile = file(ABSPATH . 'wp-config-sample.php');
 
 
-if ( !is_writable('../'))
+if ( !is_writable(ABSPATH))
        wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
 
 // Check if wp-config.php has been created
        wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
 
 // Check if wp-config.php has been created
-if (file_exists('../wp-config.php'))
+if (file_exists(ABSPATH . 'wp-config.php'))
        wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
 
        wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
 
-// Check if wp-config.php exists above the root directory
-if (file_exists('../../wp-config.php') && ! file_exists('../../wp-load.php'))
+// Check if wp-config.php exists above the root directory but is not part of another install
+if (file_exists(ABSPATH . '../wp-config.php') && ! file_exists(ABSPATH . '../wp-settings.php'))
        wp_die("<p>The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
 
 if (isset($_GET['step']))
        wp_die("<p>The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
 
 if (isset($_GET['step']))
@@ -155,7 +155,7 @@ switch($step) {
        if ( !empty($wpdb->error) )
                wp_die($wpdb->error->get_error_message());
 
        if ( !empty($wpdb->error) )
                wp_die($wpdb->error->get_error_message());
 
-       $handle = fopen('../wp-config.php', 'w');
+       $handle = fopen(ABSPATH . 'wp-config.php', 'w');
 
        foreach ($configFile as $line_num => $line) {
                switch (substr($line,0,16)) {
 
        foreach ($configFile as $line_num => $line) {
                switch (substr($line,0,16)) {
@@ -179,7 +179,7 @@ switch($step) {
                }
        }
        fclose($handle);
                }
        }
        fclose($handle);
-       chmod('../wp-config.php', 0666);
+       chmod(ABSPATH . 'wp-config.php', 0666);
 
        display_header();
 ?>
 
        display_header();
 ?>
index 210c0b9bfdc2b6b4fcbb91bf70547a2a39a539c0..62a375d40b73ed6472d6ac643f5f2a8b9c57128e 100644 (file)
@@ -88,10 +88,10 @@ form {
 <form name="post" action="post.php" method="post">
 <div>
 <input type="hidden" name="action" value="post" />
 <form name="post" action="post.php" method="post">
 <div>
 <input type="hidden" name="action" value="post" />
-<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
+<input type="hidden" name="user_ID" value="<?php echo esc_attr($user_ID) ?>" />
 <input type="hidden" name="mode" value="sidebar" />
 <input type="hidden" name="mode" value="sidebar" />
-<input type="hidden" name="ping_status" value="<?php echo $post->ping_status; ?>" />
-<input type="hidden" name="comment_status" value="<?php echo $post->comment_status; ?>" />
+<input type="hidden" name="ping_status" value="<?php echo esc_attr($post->ping_status); ?>" />
+<input type="hidden" name="comment_status" value="<?php echo esc_attr($post->comment_status); ?>" />
 <?php wp_nonce_field('add-post');
 
 if ( 'b' == $_GET['a'] )
 <?php wp_nonce_field('add-post');
 
 if ( 'b' == $_GET['a'] )
@@ -116,9 +116,9 @@ elseif ( 'c' == $_GET['a'] )
 </div>
 
 <p>
 </div>
 
 <p>
-<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" accesskey="s" class="button" value="<?php _e('Save as Draft'); ?>" />
+<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" accesskey="s" class="button" value="<?php esc_attr_e('Save as Draft'); ?>" />
 <?php if ( current_user_can('publish_posts') ) : ?>
 <?php if ( current_user_can('publish_posts') ) : ?>
-<input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php _e('Publish') ?>" class="button button-highlighted" />
+<input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php esc_attr_e('Publish') ?>" class="button button-highlighted" />
 <?php endif; ?>
 </p>
 </div>
 <?php endif; ?>
 </p>
 </div>
index 361f26b61c3d258ad740ac46df38df9619aee39c..db79d786ea1fded62d83b5181d40a98453d97e3d 100644 (file)
@@ -77,17 +77,33 @@ default:
        if ( !current_user_can('edit_themes') )
                wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
 
        if ( !current_user_can('edit_themes') )
                wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
 
+       if ( use_codepress() )
+               wp_enqueue_script( 'codepress' );
+
        require_once('admin-header.php');
 
        update_recently_edited($file);
 
        require_once('admin-header.php');
 
        update_recently_edited($file);
 
-       if (!is_file($real_file))
+       if ( !is_file($real_file) )
                $error = 1;
 
                $error = 1;
 
-       if (!$error && filesize($real_file) > 0) {
+       if ( !$error && filesize($real_file) > 0 ) {
                $f = fopen($real_file, 'r');
                $content = fread($f, filesize($real_file));
                $f = fopen($real_file, 'r');
                $content = fread($f, filesize($real_file));
-               $content = htmlspecialchars($content);
+
+               if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) {
+                       $functions = wp_doc_link_parse( $content );
+
+                       $docs_select = '<select name="docs-list" id="docs-list">';
+                       $docs_select .= '<option value="">' . esc_attr__( 'Function Name...' ) . '</option>';
+                       foreach ( $functions as $function ) {
+                               $docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
+                       }
+                       $docs_select .= '</select>';
+               }
+
+               $content = htmlspecialchars( $content );
+               $codepress_lang = codepress_get_lang($real_file);
        }
 
        ?>
        }
 
        ?>
@@ -100,7 +116,7 @@ $desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 <div class="bordertitle">
        <form id="themeselector" action="theme-editor.php" method="post">
                <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
 <div class="bordertitle">
        <form id="themeselector" action="theme-editor.php" method="post">
                <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
@@ -110,12 +126,12 @@ $desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (
        $theme_name = $a_theme['Name'];
        if ($theme_name == $theme) $selected = " selected='selected'";
        else $selected = '';
        $theme_name = $a_theme['Name'];
        if ($theme_name == $theme) $selected = " selected='selected'";
        else $selected = '';
-       $theme_name = attribute_escape($theme_name);
+       $theme_name = esc_attr($theme_name);
        echo "\n\t<option value=\"$theme_name\" $selected>$theme_name</option>";
 }
 ?>
                </select>
        echo "\n\t<option value=\"$theme_name\" $selected>$theme_name</option>";
 }
 ?>
                </select>
-               <input type="submit" name="Submit" value="<?php _e('Select') ?>" class="button" />
+               <input type="submit" name="Submit" value="<?php esc_attr_e('Select') ?>" class="button" />
        </form>
 </div>
 <div class="tablenav">
        </form>
 </div>
 <div class="tablenav">
@@ -136,7 +152,7 @@ if ($allowed_files) :
 <?php
        $template_mapping = array();
        $template_dir = $themes[$theme]['Template Dir'];
 <?php
        $template_mapping = array();
        $template_dir = $themes[$theme]['Template Dir'];
-       foreach($themes[$theme]['Template Files'] as $template_file) {
+       foreach ( $themes[$theme]['Template Files'] as $template_file ) {
                $description = trim( get_file_description($template_file) );
                $template_show = basename($template_file);
                $filedesc = ( $description != $template_file ) ? "$description <span class='nonessential'>($template_show)</span>" : "$description";
                $description = trim( get_file_description($template_file) );
                $template_show = basename($template_file);
                $filedesc = ( $description != $template_file ) ? "$description <span class='nonessential'>($template_show)</span>" : "$description";
@@ -158,11 +174,11 @@ if ($allowed_files) :
                <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
 <?php endwhile; ?>
        </ul>
                <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
 <?php endwhile; ?>
        </ul>
-       <h4><?php echo _c('Styles|Theme stylesheets in theme editor'); ?></h4>
+       <h4><?php /* translators: Theme stylesheets in theme editor */ echo _x('Styles', 'Theme stylesheets in theme editor'); ?></h4>
        <ul>
 <?php
        $template_mapping = array();
        <ul>
 <?php
        $template_mapping = array();
-       foreach($themes[$theme]['Stylesheet Files'] as $style_file) {
+       foreach ( $themes[$theme]['Stylesheet Files'] as $style_file ) {
                $description = trim( get_file_description($style_file) );
                $style_show = basename($style_file);
                $filedesc = ( $description != $style_file ) ? "$description <span class='nonessential'>($style_show)</span>" : "$description";
                $description = trim( get_file_description($style_file) );
                $style_show = basename($style_file);
                $filedesc = ( $description != $style_file ) ? "$description <span class='nonessential'>($style_show)</span>" : "$description";
@@ -182,17 +198,24 @@ if ($allowed_files) :
        ?>
        <form name="template" id="template" action="theme-editor.php" method="post">
        <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
        ?>
        <form name="template" id="template" action="theme-editor.php" method="post">
        <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
-                <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
+                <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
                 <input type="hidden" name="action" value="update" />
                 <input type="hidden" name="action" value="update" />
-                <input type="hidden" name="file" value="<?php echo $file ?>" />
-                <input type="hidden" name="theme" value="<?php echo $theme ?>" />
+                <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
+                <input type="hidden" name="theme" value="<?php echo esc_attr($theme) ?>" />
                 </div>
                 </div>
+       <?php if ( isset($functions ) && count($functions) ) { ?>
+               <div id="documentation">
+               <label for="docs-list"><?php _e('Documentation:') ?></label>
+               <?php echo $docs_select; ?>
+               <input type="button" class="button" value=" <?php esc_attr_e( 'Lookup' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" />
+               </div>
+       <?php } ?>
 
                <div>
 <?php if ( is_writeable($real_file) ) : ?>
                        <p class="submit">
 <?php
 
                <div>
 <?php if ( is_writeable($real_file) ) : ?>
                        <p class="submit">
 <?php
-       echo "<input type='submit' name='submit' class='button-primary' value='" . __('Update File') . "' tabindex='2' />";
+       echo "<input type='submit' name='submit' class='button-primary' value='" . esc_attr__('Update File') . "' tabindex='2' />";
 ?>
 </p>
 <?php else : ?>
 ?>
 </p>
 <?php else : ?>
diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php
new file mode 100644 (file)
index 0000000..8bfe387
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Install theme administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once('admin.php');
+
+if ( ! current_user_can('install_themes') )
+       wp_die(__('You do not have sufficient permissions to install themes on this blog.'));
+
+include(ABSPATH . 'wp-admin/includes/theme-install.php');
+
+$title = __('Install Themes');
+$parent_file = 'themes.php';
+
+wp_reset_vars( array('tab', 'paged') );
+wp_enqueue_style( 'theme-install' );
+wp_enqueue_script( 'theme-install' );
+
+add_thickbox();
+wp_enqueue_script( 'theme-preview' );
+
+//These are the tabs which are shown on the page,
+$tabs = array();
+$tabs['dashboard'] = __('Search');
+if ( 'search' == $tab )
+       $tabs['search'] = __('Search Results');
+$tabs['upload'] = __('Upload');
+$tabs['featured'] = __('Featured');
+//$tabs['popular']  = __('Popular');
+$tabs['new']      = __('Newest');
+$tabs['updated']  = __('Recently Updated');
+
+$nonmenu_tabs = array('theme-information'); //Valid actions to perform which do not have a Menu item.
+
+$tabs = apply_filters('install_themes_tabs', $tabs );
+$nonmenu_tabs = apply_filters('install_themes_nonmenu_tabs', $nonmenu_tabs);
+
+//If a non-valid menu tab has been selected, And its not a non-menu action.
+if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
+       $tab_actions = array_keys($tabs);
+       $tab = $tab_actions[0];
+}
+if( empty($paged) )
+       $paged = 1;
+
+$body_id = $tab;
+
+do_action('install_themes_pre_' . $tab); //Used to override the general interface, Eg, install or theme information.
+
+include('admin-header.php');
+?>
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo esc_html( $title ); ?></h2>
+
+       <ul class="subsubsub">
+<?php
+$display_tabs = array();
+foreach ( (array)$tabs as $action => $text ) {
+       $sep = ( end($tabs) != $text ) ? ' | ' : '';
+       $class = ( $action == $tab ) ? ' class="current"' : '';
+       $href = admin_url('theme-install.php?tab='. $action);
+       echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
+}
+?>
+       </ul>
+       <br class="clear" />
+       <?php do_action('install_themes_' . $tab, $paged); ?>
+</div>
+<?php
+include('admin-footer.php');
index 15b3e5bfc359b962396767f29fbaeb5eb95b2e3e..f008307ebba49a2dd9b6f24cd4827dde141c398b 100644 (file)
 require_once('admin.php');
 
 if ( isset($_GET['action']) ) {
 require_once('admin.php');
 
 if ( isset($_GET['action']) ) {
-       check_admin_referer('switch-theme_' . $_GET['template']);
-
-       if ('activate' == $_GET['action']) {
+       if ( 'activate' == $_GET['action'] ) {
+               check_admin_referer('switch-theme_' . $_GET['template']);
                switch_theme($_GET['template'], $_GET['stylesheet']);
                wp_redirect('themes.php?activated=true');
                exit;
                switch_theme($_GET['template'], $_GET['stylesheet']);
                wp_redirect('themes.php?activated=true');
                exit;
+       } else if ( 'delete' == $_GET['action'] ) {
+               check_admin_referer('delete-theme_' . $_GET['template']);
+               if ( !current_user_can('update_themes') )
+                       wp_die( __( 'Cheatin&#8217; uh?' ) );
+               delete_theme($_GET['template']);
+               wp_redirect('themes.php?deleted=true');
+               exit;
        }
 }
 
 $title = __('Manage Themes');
 $parent_file = 'themes.php';
 
        }
 }
 
 $title = __('Manage Themes');
 $parent_file = 'themes.php';
 
+$help = '<p>' . __('Themes give your WordPress style. Once a theme is installed, you may preview it, activate it or deactivate it here.') . '</p>';
+if ( current_user_can('install_themes') ) {
+       $help .= '<p>' . sprintf(__('You can find additional themes for your site by using the new <a href="%1$s">Theme Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/themes/">WordPress Theme Directory</a> directly and installing manually.  To install a theme <em>manually</em>, <a href="%2$s">upload its ZIP archive with the new uploader</a> or copy its folder via FTP into your <code>wp-content/themes</code> directory.'), 'theme-install.php', 'theme-install.php?tab=upload' ) . '</p>';
+       $help .= '<p>' . __('Once a theme is uploaded, you should see it on this page.') . '</p>' ;
+}
+
+add_contextual_help('themes', $help);
+
 add_thickbox();
 wp_enqueue_script( 'theme-preview' );
 
 add_thickbox();
 wp_enqueue_script( 'theme-preview' );
 
@@ -30,15 +44,22 @@ require_once('admin-header.php');
 
 <?php if ( ! validate_current_theme() ) : ?>
 <div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
 
 <?php if ( ! validate_current_theme() ) : ?>
 <div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
-<?php elseif ( isset($_GET['activated']) ) : ?>
-<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), get_bloginfo('url') . '/'); ?></p></div>
+<?php elseif ( isset($_GET['activated']) ) :
+               if ( isset($wp_registered_sidebars) && count( (array) $wp_registered_sidebars ) ) { ?>
+<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. This theme supports widgets, please visit the <a href="%s">widgets settings page</a> to configure them.'), admin_url('widgets.php') ); ?></p></div><?php
+               } else { ?>
+<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), get_bloginfo('url') . '/'); ?></p></div><?php
+               }
+       elseif ( isset($_GET['deleted']) ) : ?>
+<div id="message3" class="updated fade"><p><?php _e('Theme deleted.') ?></p></div>
 <?php endif; ?>
 
 <?php
 $themes = get_themes();
 $ct = current_theme_info();
 <?php endif; ?>
 
 <?php
 $themes = get_themes();
 $ct = current_theme_info();
+unset($themes[$ct->name]);
 
 
-ksort( $themes );
+uksort( $themes, "strnatcasecmp" );
 $theme_total = count( $themes );
 $per_page = 15;
 
 $theme_total = count( $themes );
 $per_page = 15;
 
@@ -74,7 +95,7 @@ $themes = array_slice( $themes, $start, $per_page );
 function theme_update_available( $theme ) {
        static $themes_update;
        if ( !isset($themes_update) )
 function theme_update_available( $theme ) {
        static $themes_update;
        if ( !isset($themes_update) )
-               $themes_update = get_option('update_themes');
+               $themes_update = get_transient('update_themes');
 
        if ( is_object($theme) && isset($theme->stylesheet) )
                $stylesheet = $theme->stylesheet;
 
        if ( is_object($theme) && isset($theme->stylesheet) )
                $stylesheet = $theme->stylesheet;
@@ -85,15 +106,17 @@ function theme_update_available( $theme ) {
 
        if ( isset($themes_update->response[ $stylesheet ]) ) {
                $update = $themes_update->response[ $stylesheet ];
 
        if ( isset($themes_update->response[ $stylesheet ]) ) {
                $update = $themes_update->response[ $stylesheet ];
+               $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : '');
                $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
                $update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
                $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
                $update_url = wp_nonce_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
+               $update_onclick = 'onclick="if ( confirm(\'' . esc_js( __("Upgrading this theme will lose any customizations you have made.  'Cancel' to stop, 'OK' to upgrade.") ) . '\') ) {return true;}return false;"';
 
                if ( ! current_user_can('update_themes') )
 
                if ( ! current_user_can('update_themes') )
-                       printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.</p>'), $ct->name, $details_url, $update['new_version']);
+                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
                else if ( empty($update->package) )
                else if ( empty($update->package) )
-                       printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.</p>'), $ct->name, $details_url, $update['new_version']);
+                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this theme</em>.') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
                else
                else
-                       printf( __('<p>There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s">upgrade automatically</a>.</p>'), $ct->name, $details_url, $update['new_version'], $update_url );
+                       printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s" %5$s >upgrade automatically</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );
        }
 }
 
        }
 }
 
@@ -101,15 +124,17 @@ function theme_update_available( $theme ) {
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <h3><?php _e('Current Theme'); ?></h3>
 <div id="current-theme">
 <?php if ( $ct->screenshot ) : ?>
 
 <h3><?php _e('Current Theme'); ?></h3>
 <div id="current-theme">
 <?php if ( $ct->screenshot ) : ?>
-<img src="<?php echo WP_CONTENT_URL . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
+<img src="<?php echo content_url($ct->stylesheet_dir . '/' . $ct->screenshot); ?>" alt="<?php _e('Current theme preview'); ?>" />
 <?php endif; ?>
 <?php endif; ?>
-<h4><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h4>
-<p class="description"><?php echo $ct->description; ?></p>
+<h4><?php
+       /* translators: 1: theme title, 2: theme version, 3: theme author */
+       printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h4>
+<p class="theme-description"><?php echo $ct->description; ?></p>
 <?php if ($ct->parent_theme) { ?>
        <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
 <?php } else { ?>
 <?php if ($ct->parent_theme) { ?>
        <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
 <?php } else { ?>
@@ -121,10 +146,13 @@ function theme_update_available( $theme ) {
 <?php theme_update_available($ct); ?>
 
 </div>
 <?php theme_update_available($ct); ?>
 
 </div>
+
 <div class="clear"></div>
 <h3><?php _e('Available Themes'); ?></h3>
 <div class="clear"></div>
 
 <div class="clear"></div>
 <h3><?php _e('Available Themes'); ?></h3>
 <div class="clear"></div>
 
+<?php if ( $theme_total ) { ?>
+
 <?php if ( $page_links ) : ?>
 <div class="tablenav">
 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
 <?php if ( $page_links ) : ?>
 <div class="tablenav">
 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
@@ -136,7 +164,6 @@ function theme_update_available( $theme ) {
 </div>
 <?php endif; ?>
 
 </div>
 <?php endif; ?>
 
-<?php if ( 1 < $theme_total ) { ?>
 <table id="availablethemes" cellspacing="0" cellpadding="0">
 <?php
 $style = '';
 <table id="availablethemes" cellspacing="0" cellpadding="0">
 <?php
 $style = '';
@@ -144,6 +171,7 @@ $style = '';
 $theme_names = array_keys($themes);
 natcasesort($theme_names);
 
 $theme_names = array_keys($themes);
 natcasesort($theme_names);
 
+$table = array();
 $rows = ceil(count($theme_names) / 3);
 for ( $row = 1; $row <= $rows; $row++ )
        for ( $col = 1; $col <= 3; $col++ )
 $rows = ceil(count($theme_names) / 3);
 for ( $row = 1; $row <= $rows; $row++ )
        for ( $col = 1; $col <= 3; $col++ )
@@ -170,35 +198,55 @@ foreach ( $cols as $col => $theme_name ) {
        $author = $themes[$theme_name]['Author'];
        $screenshot = $themes[$theme_name]['Screenshot'];
        $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
        $author = $themes[$theme_name]['Author'];
        $screenshot = $themes[$theme_name]['Screenshot'];
        $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
-       $preview_link = clean_url( get_option('home') . '/');
-       $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link ) );
-       $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) );
+       $template_dir = $themes[$theme_name]['Template Dir'];
+       $parent_theme = $themes[$theme_name]['Parent Theme'];
+       $preview_link = esc_url(get_option('home') . '/');
+       if ( is_ssl() )
+               $preview_link = str_replace( 'http://', 'https://', $preview_link );
+       $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), $preview_link ) );
+       $preview_text = esc_attr( sprintf( __('Preview of &#8220;%s&#8221;'), $title ) );
        $tags = $themes[$theme_name]['Tags'];
        $tags = $themes[$theme_name]['Tags'];
-       $thickbox_class = 'thickbox';
+       $thickbox_class = 'thickbox thickbox-preview';
        $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
        $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
-       $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) );
+       $activate_text = esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $title ) );
+       $actions = array();
+       $actions[] = '<a href="' . $activate_link .  '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>';
+       $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $theme_name)) . '">' . __('Preview') . '</a>';
+       if ( current_user_can('update_themes') )
+               $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "if ( confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete."), $theme_name )) . "') ) {return true;}return false;" . '">' . __('Delete') . '</a>';
+       $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]);
+
+       $actions = implode ( ' | ', $actions );
 ?>
 ?>
-               <a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
+               <a href="<?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
 <?php if ( $screenshot ) : ?>
 <?php if ( $screenshot ) : ?>
-                       <img src="<?php echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
+                       <img src="<?php echo content_url($stylesheet_dir . '/' . $screenshot); ?>" alt="" />
 <?php endif; ?>
                </a>
 <?php endif; ?>
                </a>
-               <h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
-               <p><?php echo $description; ?></p>
+<h3><?php
+       /* translators: 1: theme title, 2: theme version, 3: theme author */
+       printf(__('%1$s %2$s by %3$s'), $title, $version, $author) ; ?></h3>
+<p class="description"><?php echo $description; ?></p>
+<span class='action-links'><?php echo $actions ?></span>
+       <?php if ($parent_theme) {
+       /* translators: 1: theme title, 2:  template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?>
+       <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $title, $template_dir, $stylesheet_dir, $title, $parent_theme); ?></p>
+<?php } else { ?>
+       <p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $title, $template_dir, $stylesheet_dir); ?></p>
+<?php } ?>
 <?php if ( $tags ) : ?>
 <?php if ( $tags ) : ?>
-               <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
+<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
 <?php endif; ?>
                <?php theme_update_available( $themes[$theme_name] ); ?>
 <?php endif; ?>
                <?php theme_update_available( $themes[$theme_name] ); ?>
-               <noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript>
-               <div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div>
 <?php endif; // end if not empty theme_name ?>
        </td>
 <?php } // end foreach $cols ?>
 </tr>
 <?php } // end foreach $table ?>
 </table>
 <?php endif; // end if not empty theme_name ?>
        </td>
 <?php } // end foreach $cols ?>
 </tr>
 <?php } // end foreach $table ?>
 </table>
-<?php } ?>
-
+<?php } else { ?>
+<p><?php _e('You only have one theme installed at the moment so there is nothing to show you here.  Maybe you should download some more to try out.'); ?></p>
+<?php } // end if $theme_total?>
 <br class="clear" />
 
 <?php if ( $page_links ) : ?>
 <br class="clear" />
 
 <?php if ( $page_links ) : ?>
@@ -246,10 +294,6 @@ if ( count($broken_themes) ) {
 <?php
 }
 ?>
 <?php
 }
 ?>
-
-<h2><?php _e('Get More Themes'); ?></h2>
-<p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you should see it on this page.'); ?></p>
-
 </div>
 
 <?php require('admin-footer.php'); ?>
 </div>
 
 <?php require('admin-footer.php'); ?>
index 98be1ff7978d56791521ad4867189b72c85d56f3..aa953ef825b83d084d497ea75a1cc8d604835eae 100644 (file)
@@ -17,7 +17,7 @@ require_once('admin-header.php');
 screen_icon();
 ?>
 <div class="wrap">
 screen_icon();
 ?>
 <div class="wrap">
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <div class="tool-box">
 <?php
 
 <div class="tool-box">
 <?php
@@ -45,7 +45,7 @@ if ( ! $is_opera ) {
        <p><?php
 
        if ( $is_chrome )
        <p><?php
 
        if ( $is_chrome )
-               _e('Gears is installed and enabled on this computer. You can disable it from your browser&#8217;s Options, Under the Hood menu.');
+               _e('Gears is installed and enabled on this computer. You can disable it from the Under the Hood tab in Chrome&#8217;s Options menu.');
        elseif ( $is_safari )
                _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
        else
        elseif ( $is_safari )
                _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
        else
@@ -77,16 +77,20 @@ if ( ! $is_opera ) {
 } ?>
 </div>
 
 } ?>
 </div>
 
-<?php if ( current_user_can('publish_posts') ) : ?>
+<?php if ( current_user_can('edit_posts') ) : ?>
 <div class="tool-box">
        <h3 class="title"><?php _e('Press This') ?></h3>
        <p><?php _e('Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.');?></p>
 
        <p><?php _e('Use Press This to clip text, images and videos from any web page. Then edit and add more straight from Press This before you save or publish it in a post on your blog.'); ?></p>
        <p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?></p>
 <div class="tool-box">
        <h3 class="title"><?php _e('Press This') ?></h3>
        <p><?php _e('Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.');?></p>
 
        <p><?php _e('Use Press This to clip text, images and videos from any web page. Then edit and add more straight from Press This before you save or publish it in a post on your blog.'); ?></p>
        <p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?></p>
-       <p class="pressthis"><a href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
+       <p class="pressthis"><a href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>" title="<?php echo esc_attr(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
 </div>
 </div>
-<?php endif; ?>
+<?php
+endif;
+
+do_action( 'tool_box' );
+?>
 </div>
 <?php
 include('admin-footer.php');
 </div>
 <?php
 include('admin-footer.php');
index 258400990d8281b2091e2900504d17f477e7c426..1f45824216e580fe1105195f072eeac60cc08c06 100644 (file)
@@ -13,6 +13,7 @@ if ( ! current_user_can('update_plugins') )
        wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
 
 function list_core_update( $update ) {
        wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
 
 function list_core_update( $update ) {
+       global $wp_local_package;
        $version_string = 'en_US' == $update->locale ?
                        $update->current : sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
        $current = false;
        $version_string = 'en_US' == $update->locale ?
                        $update->current : sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
        $current = false;
@@ -40,16 +41,18 @@ function list_core_update( $update ) {
        echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
        wp_nonce_field('upgrade-core');
        echo '<p>';
        echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
        wp_nonce_field('upgrade-core');
        echo '<p>';
-       echo '<input id="upgrade" class="button" type="submit" value="' . $submit . '" name="upgrade" />&nbsp;';
-       echo '<input name="version" value="'.$update->current.'" type="hidden"/>';
-       echo '<input name="locale" value="'.$update->locale.'" type="hidden"/>';
-       echo '<a href="' . $update->package . '" class="button">' . $download . '</a>&nbsp;';
+       echo '<input id="upgrade" class="button" type="submit" value="' . esc_attr($submit) . '" name="upgrade" />&nbsp;';
+       echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
+       echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
+       echo '<a href="' . esc_url($update->package) . '" class="button">' . $download . '</a>&nbsp;';
        if ( 'en_US' != $update->locale )
                if ( !isset( $update->dismissed ) || !$update->dismissed )
        if ( 'en_US' != $update->locale )
                if ( !isset( $update->dismissed ) || !$update->dismissed )
-                       echo '<input id="dismiss" class="button" type="submit" value="' . attribute_escape(__('Hide this update')) . '" name="dismiss" />';
+                       echo '<input id="dismiss" class="button" type="submit" value="' . esc_attr__('Hide this update') . '" name="dismiss" />';
                else
                else
-                       echo '<input id="undismiss" class="button" type="submit" value="' . attribute_escape(__('Bring back this update')) . '" name="undismiss" />';
+                       echo '<input id="undismiss" class="button" type="submit" value="' . esc_attr__('Bring back this update') . '" name="undismiss" />';
        echo '</p>';
        echo '</p>';
+       if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
+           echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
        echo '</form>';
 
 }
        echo '</form>';
 
 }
@@ -58,8 +61,8 @@ function dismissed_updates() {
        $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
        if ( $dismissed ) {
 
        $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
        if ( $dismissed ) {
 
-               $show_text = js_escape(__('Show hidden updates'));
-               $hide_text = js_escape(__('Hide hidden updates'));
+               $show_text = esc_js(__('Show hidden updates'));
+               $hide_text = esc_js(__('Hide hidden updates'));
        ?>
        <script type="text/javascript">
 
        ?>
        <script type="text/javascript">
 
@@ -139,7 +142,7 @@ function do_core_upgrade( $reinstall = false ) {
        else
                $url = 'update-core.php?action=do-core-upgrade';
        $url = wp_nonce_url($url, 'upgrade-core');
        else
                $url = 'update-core.php?action=do-core-upgrade';
        $url = wp_nonce_url($url, 'upgrade-core');
-       if ( false === ($credentials = request_filesystem_credentials($url)) )
+       if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) )
                return;
 
        $version = isset( $_POST['version'] )? $_POST['version'] : false;
                return;
 
        $version = isset( $_POST['version'] )? $_POST['version'] : false;
@@ -149,8 +152,8 @@ function do_core_upgrade( $reinstall = false ) {
                return;
 
 
                return;
 
 
-       if ( ! WP_Filesystem($credentials) ) {
-               request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+       if ( ! WP_Filesystem($credentials, ABSPATH) ) {
+               request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again
                return;
        }
 ?>
                return;
        }
 ?>
@@ -203,6 +206,7 @@ function do_undismiss_core_update() {
 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
 
 if ( 'upgrade-core' == $action ) {
 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
 
 if ( 'upgrade-core' == $action ) {
+       wp_version_check();
        $title = __('Upgrade WordPress');
        $parent_file = 'tools.php';
        require_once('admin-header.php');
        $title = __('Upgrade WordPress');
        $parent_file = 'tools.php';
        require_once('admin-header.php');
index a60aa6e4420fc798c8dbd335c01811cd654cfe9a..7b36416527e95ffd289e6357569380fc799d588e 100644 (file)
@@ -47,10 +47,10 @@ if ( $response['response']['code'] != 200 )
 $body = str_replace(array("\r\n", "\r"), "\n", $response['body']);
 $returns = explode("\n", $body);
 
 $body = str_replace(array("\r\n", "\r"), "\n", $response['body']);
 $returns = explode("\n", $body);
 
-foreach ($returns as $return) :
+foreach ($returns as $return) {
        $time = substr($return, 0, 19);
        $uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
        $time = substr($return, 0, 19);
        $uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
-       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_updated = %s WHERE link_url = %s", $time, $uri) );
-endforeach;
+       $wdpdb->update( $wpdb->links, array('link_updated' => $time), array('link_url' => $uri) );
+}
 
 ?>
 
 ?>
index 803f50e27d3d0b71f2c9f2461123b7bf58125576..f05de5dffa0b4091722a0bc19b913f590992ac76 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
 <?php
 /**
- * Update Plugin/Theme administration panel.
+ * Update/Install Plugin/Theme administration panel.
  *
  * @package WordPress
  * @subpackage Administration
  *
  * @package WordPress
  * @subpackage Administration
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
 
-if ( ! current_user_can('update_plugins') )
-       wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
-
-/**
- * Plugin upgrade display.
- *
- * @since 2.5
- *
- * @param string $plugin Plugin
- */
-function do_plugin_upgrade($plugin) {
-       global $wp_filesystem;
-
-       $url = wp_nonce_url("update.php?action=upgrade-plugin&plugin=$plugin", "upgrade-plugin_$plugin");
-       if ( false === ($credentials = request_filesystem_credentials($url)) )
-               return;
-
-       if ( ! WP_Filesystem($credentials) ) {
-               $error = true;
-               if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() )
-                       $error = $wp_filesystem->errors;
-               request_filesystem_credentials($url, '', $error); //Failed to connect, Error and request again
-               return;
-       }
-
-       echo '<div class="wrap">';
-       echo '<h2>' . __('Upgrade Plugin') . '</h2>';
-       if ( $wp_filesystem->errors->get_error_code() ) {
-               foreach ( $wp_filesystem->errors->get_error_messages() as $message )
-                       show_message($message);
-               echo '</div>';
-               return;
-       }
-
-       $was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is
-
-       $result = wp_update_plugin($plugin, 'show_message');
-
-       if ( is_wp_error($result) ) {
-               show_message($result);
-               show_message( __('Plugin upgrade Failed') );
-       } else {
-               $plugin_file = $result;
-               show_message( __('Plugin upgraded successfully') );
-               if( $result && $was_activated ){
-                       show_message(__('Attempting reactivation of the plugin'));
-                       echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) .'"></iframe>';
-               }
-               $update_actions =  array(
-                       'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . attribute_escape(__('Activate this plugin')) . '" target="_parent">' . __('Activate Plugin') . '</a>',
-                       'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . attribute_escape(__('Goto plugins page')) . '" target="_parent">' . __('Return to Plugins page') . '</a>'
-               );
-               if ( $was_activated )
-                       unset( $update_actions['activate_plugin'] );
-
-               $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $plugin_file);
-               if ( ! empty($update_actions) )
-                       show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
-       }
-       echo '</div>';
-}
-
-/**
- * Theme upgrade display.
- *
- * @since 2.5
- *
- * @param string $plugin Plugin
- */
-function do_theme_upgrade($theme) {
-       global $wp_filesystem;
-
-       $url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($theme), 'upgrade-plugin_' . urlencode($theme));
-       if ( false === ($credentials = request_filesystem_credentials($url)) )
-               return;
-
-       if ( ! WP_Filesystem($credentials) ) {
-               $error = true;
-               if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() )
-                       $error = $wp_filesystem->errors;
-               request_filesystem_credentials($url, '', $error); //Failed to connect, Error and request again
-               return;
-       }
-
-       echo '<div class="wrap">';
-       echo '<h2>' . __('Upgrade Theme') . '</h2>';
-       if ( $wp_filesystem->errors->get_error_code() ) {
-               foreach ( $wp_filesystem->errors->get_error_messages() as $message )
-                       show_message($message);
-               echo '</div>';
-               return;
-       }
-
-       //TODO: Is theme currently active?
-       $was_current = false; //is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is
-
-       $result = wp_update_theme($theme, 'show_message');
-
-       if ( is_wp_error($result) ) {
-               show_message($result);
-               show_message( __('Installation Failed') );
-       } else {
-               //Result is the new plugin file relative to WP_PLUGIN_DIR
-               show_message( __('Theme upgraded successfully') );
-               if( $result && $was_current ){
-                       show_message(__('Setting theme as Current'));
-                       //TODO: Actually set it as active again.
-                       //echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>';
-               }
-       }
-       echo '</div>';
-}
+include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
 
 if ( isset($_GET['action']) ) {
 
 if ( isset($_GET['action']) ) {
-       $plugin = isset($_GET['plugin']) ? trim($_GET['plugin']) : '';
+       $plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
        $theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
        $theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
-       $action = isset($_GET['action']) ? $_GET['action'] : '';
+       $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
 
        if ( 'upgrade-plugin' == $action ) {
 
        if ( 'upgrade-plugin' == $action ) {
+               if ( ! current_user_can('update_plugins') )
+                       wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
+
                check_admin_referer('upgrade-plugin_' . $plugin);
                check_admin_referer('upgrade-plugin_' . $plugin);
+
                $title = __('Upgrade Plugin');
                $parent_file = 'plugins.php';
                $title = __('Upgrade Plugin');
                $parent_file = 'plugins.php';
+               $submenu_file = 'plugins.php';
                require_once('admin-header.php');
                require_once('admin-header.php');
-               do_plugin_upgrade($plugin);
+
+               $nonce = 'upgrade-plugin_' . $plugin;
+               $url = 'update.php?action=upgrade-plugin&plugin=' . $plugin;
+
+               $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
+               $upgrader->upgrade($plugin);
+
                include('admin-footer.php');
                include('admin-footer.php');
+
        } elseif ('activate-plugin' == $action ) {
        } elseif ('activate-plugin' == $action ) {
+               if ( ! current_user_can('update_plugins') )
+                       wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
+
                check_admin_referer('activate-plugin_' . $plugin);
                if( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
                        wp_redirect( 'update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
                check_admin_referer('activate-plugin_' . $plugin);
                if( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
                        wp_redirect( 'update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
@@ -153,14 +57,137 @@ if ( isset($_GET['action']) ) {
                        include(WP_PLUGIN_DIR . '/' . $plugin);
                }
                iframe_footer();
                        include(WP_PLUGIN_DIR . '/' . $plugin);
                }
                iframe_footer();
+       } elseif ( 'install-plugin' == $action ) {
+
+               if ( ! current_user_can('install_plugins') )
+                       wp_die(__('You do not have sufficient permissions to install plugins for this blog.'));
+
+               include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api..
+
+               check_admin_referer('install-plugin_' . $plugin);
+               $api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
+
+               if ( is_wp_error($api) )
+                       wp_die($api);
+
+               $title = __('Plugin Install');
+               $parent_file = 'plugins.php';
+               $submenu_file = 'plugin-install.php';
+               require_once('admin-header.php');
+
+               $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
+               $nonce = 'install-plugin_' . $plugin;
+               $url = 'update.php?action=install-plugin&plugin=' . $plugin;
+               $type = 'web'; //Install plugin type, From Web or an Upload.
+
+               $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
+               $upgrader->install($api->download_link);
+
+               include('admin-footer.php');
+
+       } elseif ( 'upload-plugin' == $action ) {
+
+               if ( ! current_user_can('install_plugins') )
+                       wp_die(__('You do not have sufficient permissions to install plugins for this blog.'));
+
+               check_admin_referer('plugin-upload');
+
+               $file_upload = new File_Upload_Upgrader('pluginzip', 'package');
+
+               $title = __('Upload Plugin');
+               $parent_file = 'plugins.php';
+               $submenu_file = 'plugin-install.php';
+               require_once('admin-header.php');
+
+               $title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) );
+               $nonce = 'plugin-upload';
+               $url = add_query_arg(array('package' => $file_upload->filename ), 'update.php?action=upload-plugin');
+               $type = 'upload'; //Install plugin type, From Web or an Upload.
+
+               $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
+               $upgrader->install( $file_upload->package );
+
+               include('admin-footer.php');
+
        } elseif ( 'upgrade-theme' == $action ) {
        } elseif ( 'upgrade-theme' == $action ) {
+
+               if ( ! current_user_can('update_themes') )
+                       wp_die(__('You do not have sufficient permissions to update themes for this blog.'));
+
                check_admin_referer('upgrade-theme_' . $theme);
                check_admin_referer('upgrade-theme_' . $theme);
+
+               add_thickbox();
+               wp_enqueue_script('theme-preview');
                $title = __('Upgrade Theme');
                $parent_file = 'themes.php';
                $title = __('Upgrade Theme');
                $parent_file = 'themes.php';
+               $submenu_file = 'themes.php';
                require_once('admin-header.php');
                require_once('admin-header.php');
-               do_theme_upgrade($theme);
+
+               $nonce = 'upgrade-theme_' . $theme;
+               $url = 'update.php?action=upgrade-theme&theme=' . $theme;
+
+               $upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
+               $upgrader->upgrade($theme);
+
                include('admin-footer.php');
                include('admin-footer.php');
-       }
-}
 
 
-?>
+       } elseif ( 'install-theme' == $action ) {
+
+               if ( ! current_user_can('install_themes') )
+                       wp_die(__('You do not have sufficient permissions to install themes for this blog.'));
+
+               include_once ABSPATH . 'wp-admin/includes/theme-install.php'; //for themes_api..
+
+               check_admin_referer('install-theme_' . $theme);
+               $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
+
+               if ( is_wp_error($api) )
+                       wp_die($api);
+
+               add_thickbox();
+               wp_enqueue_script('theme-preview');
+               $title = __('Install Themes');
+               $parent_file = 'themes.php';
+               $submenu_file = 'theme-install.php';
+               require_once('admin-header.php');
+
+               $title = sprintf( __('Installing theme: %s'), $api->name . ' ' . $api->version );
+               $nonce = 'install-theme_' . $theme;
+               $url = 'update.php?action=install-theme&theme=' . $theme;
+               $type = 'web'; //Install theme type, From Web or an Upload.
+
+               $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
+               $upgrader->install($api->download_link);
+
+               include('admin-footer.php');
+
+       } elseif ( 'upload-theme' == $action ) {
+
+               if ( ! current_user_can('install_themes') )
+                       wp_die(__('You do not have sufficient permissions to install themes for this blog.'));
+
+               check_admin_referer('theme-upload');
+
+               $file_upload = new File_Upload_Upgrader('themezip', 'package');
+
+               $title = __('Upload Theme');
+               $parent_file = 'themes.php';
+               $submenu_file = 'theme-install.php';
+               add_thickbox();
+               wp_enqueue_script('theme-preview');
+               require_once('admin-header.php');
+
+               $title = sprintf( __('Installing Theme from uploaded file: %s'), basename( $file_upload->filename ) );
+               $nonce = 'theme-upload';
+               $url = add_query_arg(array('package' => $file_upload->filename), 'update.php?action=upload-theme');
+               $type = 'upload'; //Install plugin type, From Web or an Upload.
+
+               $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
+               $upgrader->install( $file_upload->package );
+
+               include('admin-footer.php');
+
+       } else {
+               do_action('update-custom_' . $action);
+       }
+}
\ No newline at end of file
index e26a92e367384093bac65cbaa9005fd07eeb7275..6f19e70cb4a1968db9571d387e23d182f9b138ca 100644 (file)
  * @since unknown
  * @var bool
  */
  * @since unknown
  * @var bool
  */
-define('WP_INSTALLING', true);
+define( 'WP_INSTALLING', true );
 
 /** Load WordPress Bootstrap */
 
 /** Load WordPress Bootstrap */
-require('../wp-load.php');
+require( '../wp-load.php' );
 
 timer_start();
 
 timer_start();
-require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
+require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
 
 
-if ( isset($_GET['step']) )
+delete_transient('update_core');
+
+if ( isset( $_GET['step'] ) )
        $step = $_GET['step'];
 else
        $step = 0;
        $step = $_GET['step'];
 else
        $step = 0;
@@ -28,61 +30,61 @@ else
 // Do it.  No output.
 if ( 'upgrade_db' === $step ) {
        wp_upgrade();
 // Do it.  No output.
 if ( 'upgrade_db' === $step ) {
        wp_upgrade();
-       die('0');
+       die( '0' );
 }
 
 $step = (int) $step;
 
 }
 
 $step = (int) $step;
 
-@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
 ?>
 <!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" <?php language_attributes(); ?>>
 <head>
 ?>
 <!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" <?php language_attributes(); ?>>
 <head>
-       <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
-       <title><?php _e('WordPress &rsaquo; Upgrade'); ?></title>
+       <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
+       <title><?php _e( 'WordPress &rsaquo; Upgrade' ); ?></title>
        <?php wp_admin_css( 'install', true ); ?>
 </head>
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
 
        <?php wp_admin_css( 'install', true ); ?>
 </head>
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
 
-<?php if ( get_option('db_version') == $wp_db_version || !is_blog_installed()) : ?>
+<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?>
 
 
-<h2><?php _e('No Upgrade Required'); ?></h2>
-<p><?php _e('Your WordPress database is already up-to-date!'); ?></p>
-<p class="step"><a class="button" href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></p>
+<h2><?php _e( 'No Upgrade Required' ); ?></h2>
+<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
+<p class="step"><a class="button" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
 
 <?php else :
 
 <?php else :
-switch($step) :
+switch ( $step ) :
        case 0:
        case 0:
-               $goback = stripslashes(wp_get_referer());
-               $goback = clean_url($goback, null, 'url');
-               $goback = urlencode($goback);
+               $goback = stripslashes( wp_get_referer() );
+               $goback = esc_url_raw( $goback );
+               $goback = urlencode( $goback );
 ?>
 ?>
-<h2><?php _e('Database Upgrade Required'); ?></h2>
-<p><?php _e('Your WordPress database is out-of-date, and must be upgraded before you can continue.'); ?></p>
-<p><?php _e('The upgrade process may take a while, so please be patient.'); ?></p>
-<p class="step"><a class="button" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress'); ?></a></p>
+<h2><?php _e( 'Database Upgrade Required' ); ?></h2>
+<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to upgrade your database to the newest version.' ); ?></p>
+<p><?php _e( 'The upgrade process may take a little while, so please be patient.' ); ?></p>
+<p class="step"><a class="button" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e( 'Upgrade WordPress Database' ); ?></a></p>
 <?php
                break;
        case 1:
                wp_upgrade();
 
                if ( empty( $_GET['backto'] ) )
 <?php
                break;
        case 1:
                wp_upgrade();
 
                if ( empty( $_GET['backto'] ) )
-                       $backto = __get_option('home') . '/';
+                       $backto = __get_option( 'home' ) . '/';
                else {
                else {
-                       $backto = stripslashes(urldecode($_GET['backto']));
-                       $backto = clean_url($backto, null, 'url');
+                       $backto = stripslashes( urldecode( $_GET['backto'] ) );
+                       $backto = esc_url_raw( $backto  );
                }
 ?>
                }
 ?>
-<h2><?php _e('Upgrade Complete'); ?></h2>
-       <p><?php _e('Your WordPress database has been successfully upgraded!'); ?></p>
-       <p class="step"><a class="button" href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></p>
+<h2><?php _e( 'Upgrade Complete' ); ?></h2>
+       <p><?php _e( 'Your WordPress database has been successfully upgraded!' ); ?></p>
+       <p class="step"><a class="button" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
 
 <!--
 <pre>
 
 <!--
 <pre>
-<?php printf(__('%s queries'), $wpdb->num_queries); ?>
+<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?>
 
 
-<?php printf(__('%s seconds'), timer_stop(0)); ?>
+<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?>
 </pre>
 -->
 
 </pre>
 -->
 
index 7b57f6495c3f561729c48e6d04238552e848571e..61e1d16e509a04ff4156be810754c8871f7012e4 100644 (file)
@@ -10,7 +10,6 @@
 require_once('admin.php');
 wp_enqueue_script( 'wp-ajax-response' );
 wp_enqueue_script( 'jquery-ui-draggable' );
 require_once('admin.php');
 wp_enqueue_script( 'wp-ajax-response' );
 wp_enqueue_script( 'jquery-ui-draggable' );
-wp_enqueue_script( 'jquery-ui-resizable' );
 
 if (!current_user_can('upload_files'))
        wp_die(__('You do not have permission to upload files.'));
 
 if (!current_user_can('upload_files'))
        wp_die(__('You do not have permission to upload files.'));
@@ -121,9 +120,9 @@ if ( isset($_GET['detached']) ) {
        }
 
        $post_mime_types = array(
        }
 
        $post_mime_types = array(
-                               'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')),
-                               'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')),
-                               'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')),
+                               'image' => array(__('Images'), __('Manage Images'), _n_noop('Image (%s)', 'Images (%s)')),
+                               'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio (%s)', 'Audio (%s)')),
+                               'video' => array(__('Video'), __('Manage Video'), _n_noop('Video (%s)', 'Video (%s)')),
                        );
        $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
                        );
        $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
@@ -136,6 +135,7 @@ if ( isset($_GET['detached']) ) {
        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
 }
 
        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
 }
 
+wp_enqueue_script('media');
 require_once('admin-header.php'); ?>
 
 <?php
 require_once('admin-header.php'); ?>
 
 <?php
@@ -146,7 +146,7 @@ if ( isset($_GET['posted']) && (int) $_GET['posted'] ) {
 
 if ( isset($_GET['attached']) && (int) $_GET['attached'] ) {
        $attached = (int) $_GET['attached'];
 
 if ( isset($_GET['attached']) && (int) $_GET['attached'] ) {
        $attached = (int) $_GET['attached'];
-       $message = sprintf( __ngettext('Reattached %d attachment', 'Reattached %d attachments', $attached), $attached );
+       $message = sprintf( _n('Reattached %d attachment', 'Reattached %d attachments', $attached), $attached );
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
 }
 
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
 }
 
@@ -164,9 +164,9 @@ if ( isset($_GET['message']) && (int) $_GET['message'] ) {
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
+<h2><?php echo esc_html( $title );
 if ( isset($_GET['s']) && $_GET['s'] )
 if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( get_search_query() ) ); ?>
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
 </h2>
 
 <?php
 </h2>
 
 <?php
@@ -187,7 +187,7 @@ foreach ( $matches as $type => $reals )
                $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
 
 $class = empty($_GET['post_mime_type']) && ! isset($_GET['detached']) ? ' class="current"' : '';
                $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
 
 $class = empty($_GET['post_mime_type']) && ! isset($_GET['detached']) ? ' class="current"' : '';
-$type_links[] = "<li><a href='upload.php'$class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts ), number_format_i18n( $_total_posts ) ) . '</a>';
+$type_links[] = "<li><a href='upload.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</a>';
 foreach ( $post_mime_types as $mime_type => $label ) {
        $class = '';
 
 foreach ( $post_mime_types as $mime_type => $label ) {
        $class = '';
 
@@ -197,7 +197,7 @@ foreach ( $post_mime_types as $mime_type => $label ) {
        if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
                $class = ' class="current"';
 
        if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
                $class = ' class="current"';
 
-       $type_links[] = "<li><a href='upload.php?post_mime_type=$mime_type'$class>" . sprintf( __ngettext( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
+       $type_links[] = "<li><a href='upload.php?post_mime_type=$mime_type'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
 }
 $class = isset($_GET['detached']) ? ' class="current"' : '';
 $type_links[] = '<li><a href="upload.php?detached=1"' . $class . '>' . __('Unattached') . '</a>';
 }
 $class = isset($_GET['detached']) ? ' class="current"' : '';
 $type_links[] = '<li><a href="upload.php?detached=1"' . $class . '>' . __('Unattached') . '</a>';
@@ -209,9 +209,9 @@ unset($type_links);
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
-       <label class="hidden" for="media-search-input"><?php _e( 'Search Media' ); ?>:</label>
-       <input type="text" class="search-input" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
-       <input type="submit" value="<?php _e( 'Search Media' ); ?>" class="button" />
+       <label class="screen-reader-text" for="media-search-input"><?php _e( 'Search Media' ); ?>:</label>
+       <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Media' ); ?>" class="button" />
 </p>
 </form>
 
 </p>
 </form>
 
@@ -247,7 +247,7 @@ if ( $page_links ) : ?>
 <option value="attach"><?php _e('Attach to a post'); ?></option>
 <?php } ?>
 </select>
 <option value="attach"><?php _e('Attach to a post'); ?></option>
 <?php } ?>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
 <?php wp_nonce_field('bulk-media'); ?>
 
 <?php
 <?php wp_nonce_field('bulk-media'); ?>
 
 <?php
@@ -272,7 +272,7 @@ foreach ($arc_result as $arc_row) {
        else
                $default = '';
 
        else
                $default = '';
 
-       echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
+       echo "<option$default value='" . esc_attr("$arc_row->yyear$arc_row->mmonth") . "'>";
        echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
        echo "</option>\n";
 }
        echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
        echo "</option>\n";
 }
@@ -280,12 +280,12 @@ foreach ($arc_result as $arc_row) {
 </select>
 <?php endif; // month_count ?>
 
 </select>
 <?php endif; // month_count ?>
 
-<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
+<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
 
 <?php } // ! is_singular ?>
 
 <?php if ( isset($_GET['detached']) ) { ?>
 
 <?php } // ! is_singular ?>
 
 <?php if ( isset($_GET['detached']) ) { ?>
-       <input type="submit" id="find_detached" name="find_detached" value="<?php _e('Scan for lost attachments'); ?>" class="button-secondary" />
+       <input type="submit" id="find_detached" name="find_detached" value="<?php esc_attr_e('Scan for lost attachments'); ?>" class="button-secondary" />
 <?php } ?>
 
 </div>
 <?php } ?>
 
 </div>
@@ -301,8 +301,9 @@ foreach ($arc_result as $arc_row) {
 <tr>
        <th scope="col" class="check-column"><input type="checkbox" /></th>
        <th scope="col"></th>
 <tr>
        <th scope="col" class="check-column"><input type="checkbox" /></th>
        <th scope="col"></th>
-       <th scope="col"><?php echo _c('Media|media column header'); ?></th>
-       <th scope="col"><?php echo _c('Date Added|media column header'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
 </tr>
 </thead>
 
 </tr>
 </thead>
 
@@ -310,8 +311,9 @@ foreach ($arc_result as $arc_row) {
 <tr>
        <th scope="col" class="check-column"><input type="checkbox" /></th>
        <th scope="col"></th>
 <tr>
        <th scope="col" class="check-column"><input type="checkbox" /></th>
        <th scope="col"></th>
-       <th scope="col"><?php echo _c('Media|media column header'); ?></th>
-       <th scope="col"><?php echo _c('Date Added|media column header'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
+       <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
 </tr>
 </tfoot>
 
 </tr>
 </tfoot>
 
@@ -320,29 +322,30 @@ foreach ($arc_result as $arc_row) {
        if ( $orphans ) {
                foreach ( $orphans as $post ) {
                        $class = 'alternate' == $class ? '' : 'alternate';
        if ( $orphans ) {
                foreach ( $orphans as $post ) {
                        $class = 'alternate' == $class ? '' : 'alternate';
-                       $att_title = wp_specialchars( _draft_or_post_title($post->ID) );
+                       $att_title = esc_html( _draft_or_post_title($post->ID) );
 ?>
        <tr id='post-<?php echo $post->ID; ?>' class='<?php echo $class; ?>' valign="top">
 ?>
        <tr id='post-<?php echo $post->ID; ?>' class='<?php echo $class; ?>' valign="top">
-               <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php echo $post->ID; ?>" /></th>
+               <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php echo esc_attr($post->ID); ?>" /></th>
 
                <td class="media-icon"><?php
                if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) { ?>
 
                <td class="media-icon"><?php
                if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) { ?>
-                       <a href="media.php?action=edit&amp;attachment_id=<?php echo $post->ID; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $thumb; ?></a>
+                       <a href="media.php?action=edit&amp;attachment_id=<?php echo $post->ID; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $thumb; ?></a>
 <?php  } ?></td>
 
 <?php  } ?></td>
 
-               <td><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
+               <td class="media column-media"><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
                <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
 
                <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
 
-               <p>
+               <div class="row-actions">
                <?php
                $actions = array();
                if ( current_user_can('edit_post', $post->ID) )
                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
                if ( current_user_can('delete_post', $post->ID) )
                <?php
                $actions = array();
                if ( current_user_can('edit_post', $post->ID) )
                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
                if ( current_user_can('delete_post', $post->ID) )
-                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
-               $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                       $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+               $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                if ( current_user_can('edit_post', $post->ID) )
                        $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;">'.__('Attach').'</a>';
                if ( current_user_can('edit_post', $post->ID) )
                        $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;">'.__('Attach').'</a>';
+               $actions = apply_filters( 'media_row_actions', $actions, $post );
                $action_count = count($actions);
                $i = 0;
                foreach ( $actions as $action => $link ) {
                $action_count = count($actions);
                $i = 0;
                foreach ( $actions as $action => $link ) {
@@ -350,8 +353,8 @@ foreach ($arc_result as $arc_row) {
                        ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
                        echo "<span class='$action'>$link$sep</span>";
                } ?>
                        ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
                        echo "<span class='$action'>$link$sep</span>";
                } ?>
-               </p></td>
-
+               </div></td>
+               <td class="author column-author"><?php $author = get_userdata($post->post_author); echo $author->display_name; ?></td>
 <?php  if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
                        $t_time = $h_time = __('Unpublished');
                } else {
 <?php  if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
                        $t_time = $h_time = __('Unpublished');
                } else {
@@ -367,12 +370,12 @@ foreach ($arc_result as $arc_row) {
                                $h_time = mysql2date(__('Y/m/d'), $m_time);
                        }
                } ?>
                                $h_time = mysql2date(__('Y/m/d'), $m_time);
                        }
                } ?>
-               <td><?php echo $h_time ?></td>
+               <td class="date column-date"><?php echo $h_time ?></td>
        </tr>
 <?php  }
 
        } else { ?>
        </tr>
 <?php  }
 
        } else { ?>
-       <tr><td colspan="5"><?php _e('No posts found.') ?></td></tr>
+       <tr><td colspan="5"><?php _e('No media attachments found.') ?></td></tr>
 <?php } ?>
 </tbody>
 </table>
 <?php } ?>
 </tbody>
 </table>
@@ -400,7 +403,7 @@ if ( $page_links )
 <option value="attach"><?php _e('Attach to a post'); ?></option>
 <?php } ?>
 </select>
 <option value="attach"><?php _e('Attach to a post'); ?></option>
 <?php } ?>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
 <br class="clear" />
 </div>
 
 <br class="clear" />
@@ -410,26 +413,5 @@ if ( $page_links )
 
 </div>
 
 
 </div>
 
-<script type="text/javascript">
-/* <![CDATA[ */
-(function($){
-       $(document).ready(function(){
-               $('#doaction, #doaction2').click(function(e){
-                       if ( $('select[name^="action"]').val() == 'delete' ) {
-                               var m = '<?php echo js_escape(__("You are about to delete the selected attachments.\n  'Cancel' to stop, 'OK' to delete.")); ?>';
-                               return showNotice.warn(m);
-                       } else if ( $('select[name^="action"]').val() == 'attach' ) {
-                               e.preventDefault();
-                               findPosts.open();
-                       }
-               });
-       });
-})(jQuery);
-columns.init('upload');
-/* ]]> */
-</script>
-
 <?php
 <?php
-
 include('admin-footer.php');
 include('admin-footer.php');
-?>
index 0cedd29c1ceaa973d883312ef77ee4a2264807fa..6736e1c8acefd59231797d1fd36614da2849cd08 100644 (file)
@@ -9,76 +9,14 @@
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 /** WordPress Administration Bootstrap */
 require_once('admin.php');
 
-if ( defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE )
-       $is_profile_page = true;
-else
-       $is_profile_page = false;
-
-/**
- * Display JavaScript for profile page.
- *
- * @since 2.5.0
- */
-function profile_js ( ) {
-?>
-<script type="text/javascript">
-(function($){
-
-       function check_pass_strength () {
-
-               var pass = $('#pass1').val();
-               var user = $('#user_login').val();
-
-               $('#pass-strength-result').removeClass('short bad good strong');
-               if ( ! pass ) {
-                       $('#pass-strength-result').html( pwsL10n.empty );
-                       return;
-               }
+if ( !defined('IS_PROFILE_PAGE') )
+       define('IS_PROFILE_PAGE', false);
 
 
-               var strength = passwordStrength(pass, user);
-
-               if ( 2 == strength )
-                       $('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
-               else if ( 3 == strength )
-                       $('#pass-strength-result').addClass('good').html( pwsL10n.good );
-               else if ( 4 == strength )
-                       $('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
-               else
-                       // this catches 'Too short' and the off chance anything else comes along
-                       $('#pass-strength-result').addClass('short').html( pwsL10n.short );
-
-       }
-
-       function update_nickname () {
-
-               var nickname = $('#nickname').val();
-               var display_nickname = $('#display_nickname').val();
-
-               if ( nickname == '' ) {
-                       $('#display_nickname').remove();
-               }
-               $('#display_nickname').val(nickname).html(nickname);
-
-       }
+wp_enqueue_script('user-profile');
+wp_enqueue_script('password-strength-meter');
 
 
-       $(document).ready( function() {
-               $('#nickname').blur(update_nickname);
-               $('#pass1').val('').keyup( check_pass_strength );
-               $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
-    });
-})(jQuery);
-</script>
-<?php
-}
-
-if ( $is_profile_page ) {
-       add_action('admin_head', 'profile_js');
-       wp_enqueue_script('jquery');
-       wp_enqueue_script('password-strength-meter');
-}
-
-$title = $is_profile_page? __('Profile') : __('Edit User');
-if ( current_user_can('edit_users') && !$is_profile_page )
+$title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
+if ( current_user_can('edit_users') && !IS_PROFILE_PAGE )
        $submenu_file = 'users.php';
 else
        $submenu_file = 'profile.php';
        $submenu_file = 'users.php';
 else
        $submenu_file = 'profile.php';
@@ -91,7 +29,7 @@ $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashe
 $user_id = (int) $user_id;
 
 if ( !$user_id ) {
 $user_id = (int) $user_id;
 
 if ( !$user_id ) {
-       if ( $is_profile_page ) {
+       if ( IS_PROFILE_PAGE ) {
                $current_user = wp_get_current_user();
                $user_id = $current_user->ID;
        } else {
                $current_user = wp_get_current_user();
                $user_id = $current_user->ID;
        } else {
@@ -101,6 +39,11 @@ if ( !$user_id ) {
        wp_die( __('Invalid user ID.') );
 }
 
        wp_die( __('Invalid user ID.') );
 }
 
+$all_post_caps = array('posts', 'pages');
+$user_can_edit = false;
+foreach ( $all_post_caps as $post_cap )
+       $user_can_edit |= current_user_can("edit_$post_cap");
+
 /**
  * Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
  *
 /**
  * Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
  *
@@ -133,15 +76,15 @@ check_admin_referer('update-user_' . $user_id);
 if ( !current_user_can('edit_user', $user_id) )
        wp_die(__('You do not have permission to edit this user.'));
 
 if ( !current_user_can('edit_user', $user_id) )
        wp_die(__('You do not have permission to edit this user.'));
 
-if ($is_profile_page)
-       do_action('personal_options_update');
+if ( IS_PROFILE_PAGE )
+       do_action('personal_options_update', $user_id);
 else
 else
-       do_action('edit_user_profile_update');
+       do_action('edit_user_profile_update', $user_id);
 
 $errors = edit_user($user_id);
 
 if ( !is_wp_error( $errors ) ) {
 
 $errors = edit_user($user_id);
 
 if ( !is_wp_error( $errors ) ) {
-       $redirect = ($is_profile_page? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
+       $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
        $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
        wp_redirect($redirect);
        exit;
        $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
        wp_redirect($redirect);
        exit;
@@ -159,7 +102,7 @@ include ('admin-header.php');
 <?php if ( isset($_GET['updated']) ) : ?>
 <div id="message" class="updated fade">
        <p><strong><?php _e('User updated.') ?></strong></p>
 <?php if ( isset($_GET['updated']) ) : ?>
 <div id="message" class="updated fade">
        <p><strong><?php _e('User updated.') ?></strong></p>
-       <?php if ( $wp_http_referer && !$is_profile_page ) : ?>
+       <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
        <p><a href="users.php"><?php _e('&larr; Back to Authors and Users'); ?></a></p>
        <?php endif; ?>
 </div>
        <p><a href="users.php"><?php _e('&larr; Back to Authors and Users'); ?></a></p>
        <?php endif; ?>
 </div>
@@ -177,12 +120,12 @@ include ('admin-header.php');
 
 <div class="wrap" id="profile-page">
 <?php screen_icon(); ?>
 
 <div class="wrap" id="profile-page">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 <form id="your-profile" action="" method="post">
 <?php wp_nonce_field('update-user_' . $user_id) ?>
 <?php if ( $wp_http_referer ) : ?>
 
 <form id="your-profile" action="" method="post">
 <?php wp_nonce_field('update-user_' . $user_id) ?>
 <?php if ( $wp_http_referer ) : ?>
-       <input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
+       <input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
 <?php endif; ?>
 <p>
 <input type="hidden" name="from" value="profile" />
 <?php endif; ?>
 <p>
 <input type="hidden" name="from" value="profile" />
@@ -192,7 +135,7 @@ include ('admin-header.php');
 <h3><?php _e('Personal Options'); ?></h3>
 
 <table class="form-table">
 <h3><?php _e('Personal Options'); ?></h3>
 
 <table class="form-table">
-<?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?>
+<?php if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) : // don't bother showing the option if the editor has been removed ?>
        <tr>
                <th scope="row"><?php _e('Visual Editor')?></th>
                <td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked('false', $profileuser->rich_editing); ?> /> <?php _e('Disable the visual editor when writing'); ?></label></td>
        <tr>
                <th scope="row"><?php _e('Visual Editor')?></th>
                <td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked('false', $profileuser->rich_editing); ?> /> <?php _e('Disable the visual editor when writing'); ?></label></td>
@@ -201,13 +144,13 @@ include ('admin-header.php');
 <?php if (count($_wp_admin_css_colors) > 1 ) : ?>
 <tr>
 <th scope="row"><?php _e('Admin Color Scheme')?></th>
 <?php if (count($_wp_admin_css_colors) > 1 ) : ?>
 <tr>
 <th scope="row"><?php _e('Admin Color Scheme')?></th>
-<td><fieldset><legend class="hidden"><?php _e('Admin Color Scheme')?></legend>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Admin Color Scheme')?></span></legend>
 <?php
 $current_color = get_user_option('admin_color', $user_id);
 if ( empty($current_color) )
        $current_color = 'fresh';
 foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
 <?php
 $current_color = get_user_option('admin_color', $user_id);
 if ( empty($current_color) )
        $current_color = 'fresh';
 foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
-<div class="color-option"><input name="admin_color" id="admin_color_<?php echo $color; ?>" type="radio" value="<?php echo $color ?>" class="tog" <?php checked($color, $current_color); ?> />
+<div class="color-option"><input name="admin_color" id="admin_color_<?php echo $color; ?>" type="radio" value="<?php echo esc_attr($color) ?>" class="tog" <?php checked($color, $current_color); ?> />
        <table class="color-palette">
        <tr>
        <?php foreach ( $color_info->colors as $html_color ): ?>
        <table class="color-palette">
        <tr>
        <?php foreach ( $color_info->colors as $html_color ): ?>
@@ -221,17 +164,19 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
        <?php endforeach; ?>
 </fieldset></td>
 </tr>
        <?php endforeach; ?>
 </fieldset></td>
 </tr>
+<?php if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
 <tr>
 <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
 <tr>
 <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
-<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e( 'Enable keyboard shortcuts for comment moderation. <a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>' ); ?></label></td>
+<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>'); ?></td>
 </tr>
 <?php
 endif;
 </tr>
 <?php
 endif;
+endif;
 do_action('personal_options', $profileuser);
 ?>
 </table>
 <?php
 do_action('personal_options', $profileuser);
 ?>
 </table>
 <?php
-       if ( $is_profile_page )
+       if ( IS_PROFILE_PAGE )
                do_action('profile_personal_options', $profileuser);
 ?>
 
                do_action('profile_personal_options', $profileuser);
 ?>
 
@@ -240,65 +185,67 @@ do_action('personal_options', $profileuser);
 <table class="form-table">
        <tr>
                <th><label for="user_login"><?php _e('Username'); ?></label></th>
 <table class="form-table">
        <tr>
                <th><label for="user_login"><?php _e('Username'); ?></label></th>
-               <td><input type="text" name="user_login" id="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" class="regular-text" /> <?php _e('Your username cannot be changed.'); ?></td>
+               <td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Your username cannot be changed.'); ?></span></td>
        </tr>
 
        </tr>
 
-<?php if ( !$is_profile_page ): ?>
+<?php if ( !IS_PROFILE_PAGE ): ?>
 <tr><th><label for="role"><?php _e('Role:') ?></label></th>
 <tr><th><label for="role"><?php _e('Role:') ?></label></th>
+<td><select name="role" id="role">
 <?php
 <?php
-// print_r($profileuser);
-echo '<td><select name="role" id="role">';
-$role_list = '';
-$user_has_role = false;
-foreach($wp_roles->role_names as $role => $name) {
-       $name = translate_with_context($name);
-       if ( $profileuser->has_cap($role) ) {
-               $selected = ' selected="selected"';
-               $user_has_role = true;
-       } else {
-               $selected = '';
-       }
-       $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>";
-}
-if ( $user_has_role )
-       $role_list .= '<option value="">' . __('&mdash; No role for this blog &mdash;') . '</option>';
+// Get the highest/primary role for this user
+// TODO: create a function that does this: wp_get_user_role()
+$user_roles = $profileuser->roles;
+$user_role = array_shift($user_roles);
+
+// print the full list of roles with the primary one selected.
+wp_dropdown_roles($user_role);
+
+// print the 'no role' option. Make it selected if the user has no role yet.
+if ( $user_role )
+       echo '<option value="">' . __('&mdash; No role for this blog &mdash;') . '</option>';
 else
 else
-       $role_list .= '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
-echo $role_list . '</select></td></tr>';
+       echo '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
 ?>
 ?>
-<?php endif; ?>
+</select></td></tr>
+<?php endif; //!IS_PROFILE_PAGE ?>
 
 <tr>
        <th><label for="first_name"><?php _e('First name') ?></label></th>
 
 <tr>
        <th><label for="first_name"><?php _e('First name') ?></label></th>
-       <td><input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" class="regular-text" /></td>
+       <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
        <th><label for="last_name"><?php _e('Last name') ?></label></th>
 </tr>
 
 <tr>
        <th><label for="last_name"><?php _e('Last name') ?></label></th>
-       <td><input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" class="regular-text" /></td>
+       <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
 </tr>
 
 <tr>
-       <th><label for="nickname"><?php _e('Nickname') ?></label></th>
-       <td><input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" class="regular-text" /></td>
+       <th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+       <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
 </tr>
 
 <tr>
-       <th><label for="display_name"><?php _e('Display name publicly&nbsp;as') ?></label></th>
+       <th><label for="display_name"><?php _e('Display name publicly as') ?></label></th>
        <td>
                <select name="display_name" id="display_name">
                <?php
                        $public_display = array();
        <td>
                <select name="display_name" id="display_name">
                <?php
                        $public_display = array();
-                       $public_display['display_displayname'] = $profileuser->display_name;
-                       $public_display['display_nickname'] = $profileuser->nickname;
-                       $public_display['display_username'] = $profileuser->user_login;
-                       $public_display['display_firstname'] = $profileuser->first_name;
-                       $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
-                       $public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
-                       $public_display = array_unique(array_filter(array_map('trim', $public_display)));
-                       foreach($public_display as $id => $item) {
+                       $public_display['display_nickname']  = $profileuser->nickname;
+                       $public_display['display_username']  = $profileuser->user_login;
+                       if ( !empty($profileuser->first_name) )
+                               $public_display['display_firstname'] = $profileuser->first_name;
+                       if ( !empty($profileuser->last_name) )
+                               $public_display['display_lastname'] = $profileuser->last_name;
+                       if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
+                               $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
+                               $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
+                       }
+                       if ( !in_array( $profileuser->display_name, $public_display ) )// Only add this if it isn't duplicated elsewhere
+                               $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
+                       $public_display = array_map( 'trim', $public_display );
+                       foreach ( $public_display as $id => $item ) {
                ?>
                ?>
-                       <option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
+                       <option id="<?php echo $id; ?>" value="<?php echo esc_attr($item); ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
                <?php
                        }
                ?>
                <?php
                        }
                ?>
@@ -311,65 +258,64 @@ echo $role_list . '</select></td></tr>';
 
 <table class="form-table">
 <tr>
 
 <table class="form-table">
 <tr>
-       <th><label for="email"><?php _e('E-mail') ?></label></th>
-       <td><input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" class="regular-text" /> <?php _e('Required.');?></td>
+       <th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+       <td><input type="text" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
        <th><label for="url"><?php _e('Website') ?></label></th>
 </tr>
 
 <tr>
        <th><label for="url"><?php _e('Website') ?></label></th>
-       <td><input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" class="regular-text" /></td>
+       <td><input type="text" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
 </tr>
 
 <tr>
 </tr>
 
 <tr>
-       <th><label for="aim"><?php _e('AIM') ?></label></th>
-       <td><input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" class="regular-text" /></td>
+       <th><label for="aim"><?php echo apply_filters('user_aim_label', __('AIM')); ?></label></th>
+       <td><input type="text" name="aim" id="aim" value="<?php echo esc_attr($profileuser->aim) ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
 </tr>
 
 <tr>
-       <th><label for="yim"><?php _e('Yahoo IM') ?></label></th>
-       <td><input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" class="regular-text" /></td>
+       <th><label for="yim"><?php echo apply_filters('user_yim_label', __('Yahoo IM')); ?></label></th>
+       <td><input type="text" name="yim" id="yim" value="<?php echo esc_attr($profileuser->yim) ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
 </tr>
 
 <tr>
-       <th><label for="jabber"><?php _e('Jabber / Google Talk') ?></label></th>
-       <td><input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" class="regular-text" /></td>
+       <th><label for="jabber"><?php echo apply_filters('user_jabber_label', __('Jabber / Google Talk')); ?></label></th>
+       <td><input type="text" name="jabber" id="jabber" value="<?php echo esc_attr($profileuser->jabber) ?>" class="regular-text" /></td>
 </tr>
 </table>
 
 </tr>
 </table>
 
-<h3><?php $is_profile_page? _e('About Yourself') : _e('About the user'); ?></h3>
+<h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3>
 
 <table class="form-table">
 <tr>
        <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
 
 <table class="form-table">
 <tr>
        <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
-       <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea><br /><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></td>
+       <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea><br />
+       <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td>
 </tr>
 
 <?php
 </tr>
 
 <?php
-$show_password_fields = apply_filters('show_password_fields', true);
+$show_password_fields = apply_filters('show_password_fields', true, $profileuser);
 if ( $show_password_fields ) :
 ?>
 if ( $show_password_fields ) :
 ?>
-<tr>
+<tr id="password">
        <th><label for="pass1"><?php _e('New Password'); ?></label></th>
        <th><label for="pass1"><?php _e('New Password'); ?></label></th>
-       <td><input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> <?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?><br />
-               <input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" /> <?php _e("Type your new password again."); ?><br />
-       <?php if ( $is_profile_page ): ?>
+       <td><input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> <span class="description"><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?></span><br />
+               <input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" /> <span class="description"><?php _e("Type your new password again."); ?></span><br />
                <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
                <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
-               <p><?php _e('Hint: Your password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
-       <?php endif; ?>
+               <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
        </td>
 </tr>
 <?php endif; ?>
 </table>
 
 <?php
        </td>
 </tr>
 <?php endif; ?>
 </table>
 
 <?php
-       if ( $is_profile_page ) {
-               do_action('show_user_profile');
+       if ( IS_PROFILE_PAGE ) {
+               do_action('show_user_profile', $profileuser);
        } else {
        } else {
-               do_action('edit_user_profile');
+               do_action('edit_user_profile', $profileuser);
        }
 ?>
 
        }
 ?>
 
-<?php if (count($profileuser->caps) > count($profileuser->roles)): ?>
+<?php if (count($profileuser->caps) > count($profileuser->roles) && apply_filters('additional_capabilities_display', true, $profileuser)): ?>
 <br class="clear" />
        <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
                <tr>
 <br class="clear" />
        <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
                <tr>
@@ -390,8 +336,8 @@ if ( $show_password_fields ) :
 
 <p class="submit">
        <input type="hidden" name="action" value="update" />
 
 <p class="submit">
        <input type="hidden" name="action" value="update" />
-       <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
-       <input type="submit" class="button-primary" value="<?php $is_profile_page? _e('Update Profile') : _e('Update User') ?>" name="submit" />
+       <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
+       <input type="submit" class="button-primary" value="<?php IS_PROFILE_PAGE ? esc_attr_e('Update Profile') : esc_attr_e('Update User') ?>" name="submit" />
 </p>
 </form>
 </div>
 </p>
 </form>
 </div>
index 0c98ad8dcf67cad9ef26122fc9eb764219c69fc1..9d143253b6b18b3477ce5bf93ea7af16b8a557aa 100644 (file)
@@ -36,7 +36,9 @@ if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
 $title = __('Add New User');
 $parent_file = 'users.php';
 
 $title = __('Add New User');
 $parent_file = 'users.php';
 
-wp_enqueue_script('admin-users');
+wp_enqueue_script('wp-ajax-response');
+wp_enqueue_script('user-profile');
+wp_enqueue_script('password-strength-meter');
 
 require_once ('admin-header.php');
 
 
 require_once ('admin-header.php');
 
@@ -87,35 +89,45 @@ foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name
        if ( ! isset($$var) )
                $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
 }
        if ( ! isset($$var) )
                $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
 }
+$new_user_send_password = !$_POST || isset($_POST['send_password']);
 ?>
 <table class="form-table">
        <tr class="form-field form-required">
 ?>
 <table class="form-table">
        <tr class="form-field form-required">
-               <th scope="row"><label for="user_login"><?php _e('Username (required)') ?></label><input name="action" type="hidden" id="action" value="adduser" /></th>
-               <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" aria-required="true" /></td>
+               <th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label>
+               <input name="action" type="hidden" id="action" value="adduser" /></th>
+               <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" /></td>
        </tr>
        <tr class="form-field">
                <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
        </tr>
        <tr class="form-field">
                <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
-               <td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td>
+               <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td>
        </tr>
        <tr class="form-field">
                <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
        </tr>
        <tr class="form-field">
                <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
-               <td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td>
+               <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" /></td>
        </tr>
        <tr class="form-field form-required">
        </tr>
        <tr class="form-field form-required">
-               <th scope="row"><label for="email"><?php _e('E-mail (required)') ?></label></th>
-               <td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
+               <th scope="row"><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+               <td><input name="email" type="text" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td>
        </tr>
        <tr class="form-field">
                <th scope="row"><label for="url"><?php _e('Website') ?></label></th>
        </tr>
        <tr class="form-field">
                <th scope="row"><label for="url"><?php _e('Website') ?></label></th>
-               <td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td>
+               <td><input name="url" type="text" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td>
        </tr>
 
 <?php if ( apply_filters('show_password_fields', true) ) : ?>
        <tr class="form-field form-required">
        </tr>
 
 <?php if ( apply_filters('show_password_fields', true) ) : ?>
        <tr class="form-field form-required">
-               <th scope="row"><label for="pass1"><?php _e('Password (twice)') ?> </label></th>
+               <th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php _e('(twice, required)'); ?></span></label></th>
                <td><input name="pass1" type="password" id="pass1" autocomplete="off" />
                <br />
                <td><input name="pass1" type="password" id="pass1" autocomplete="off" />
                <br />
-               <input name="pass2" type="password" id="pass2" autocomplete="off"/></td>
+               <input name="pass2" type="password" id="pass2" autocomplete="off" />
+               <br />
+               <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
+               <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
+               </td>
+       </tr>
+       <tr>
+               <th scope="row"><label for="send_password"><?php _e('Send Password?') ?></label></th>
+               <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked($new_user_send_password, true); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
        </tr>
 <?php endif; ?>
 
        </tr>
 <?php endif; ?>
 
@@ -132,12 +144,11 @@ foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name
        </tr>
 </table>
 <p class="submit">
        </tr>
 </table>
 <p class="submit">
-       <input name="adduser" type="submit" id="addusersub" class="button-primary" value="<?php _e('Add User') ?>" />
+       <input name="adduser" type="submit" id="addusersub" class="button-primary" value="<?php esc_attr_e('Add User') ?>" />
 </p>
 </form>
 
 </div>
 </p>
 </form>
 
 </div>
-
 <?php
 include('admin-footer.php');
 <?php
 include('admin-footer.php');
-?>
\ No newline at end of file
+?>
index 61fd687dcaf5c01ff516531a2fd409d5979d50f8..758a5927edc2ecc50e8770cb2bad6e99e338bbb9 100644 (file)
@@ -28,10 +28,10 @@ if ( empty($doaction) ) {
 }
 
 if ( empty($_REQUEST) ) {
 }
 
 if ( empty($_REQUEST) ) {
-       $referer = '<input type="hidden" name="wp_http_referer" value="'. attribute_escape(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
+       $referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr(stripslashes($_SERVER['REQUEST_URI'])) . '" />';
 } elseif ( isset($_REQUEST['wp_http_referer']) ) {
        $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), stripslashes($_REQUEST['wp_http_referer']));
 } elseif ( isset($_REQUEST['wp_http_referer']) ) {
        $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), stripslashes($_REQUEST['wp_http_referer']));
-       $referer = '<input type="hidden" name="wp_http_referer" value="' . attribute_escape($redirect) . '" />';
+       $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />';
 } else {
        $redirect = 'users.php';
        $referer = '';
 } else {
        $redirect = 'users.php';
        $referer = '';
@@ -39,6 +39,7 @@ if ( empty($_REQUEST) ) {
 
 switch ($doaction) {
 
 
 switch ($doaction) {
 
+/* Bulk Dropdown menu Role changes */
 case 'promote':
        check_admin_referer('bulk-users');
 
 case 'promote':
        check_admin_referer('bulk-users');
 
@@ -47,8 +48,9 @@ case 'promote':
                exit();
        }
 
                exit();
        }
 
-       if ( !current_user_can('edit_users') )
-               wp_die(__('You can&#8217;t edit users.'));
+       $editable_roles = get_editable_roles();
+       if (!$editable_roles[$_REQUEST['new_role']])
+               wp_die(__('You can&#8217;t give users that role.'));
 
        $userids = $_REQUEST['users'];
        $update = 'promote';
 
        $userids = $_REQUEST['users'];
        $update = 'promote';
@@ -147,7 +149,7 @@ case 'delete':
                if ( $id == $current_user->ID ) {
                        echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
                } else {
                if ( $id == $current_user->ID ) {
                        echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
                } else {
-                       echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "</li>\n";
+                       echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1s: %2s'), $id, $user->user_login) . "</li>\n";
                        $go_delete = true;
                }
        }
                        $go_delete = true;
                }
        }
@@ -155,7 +157,7 @@ case 'delete':
        $user_dropdown = '<select name="reassign_user">';
        foreach ( (array) $all_logins as $login )
                if ( $login->ID == $current_user->ID || !in_array($login->ID, $userids) )
        $user_dropdown = '<select name="reassign_user">';
        foreach ( (array) $all_logins as $login )
                if ( $login->ID == $current_user->ID || !in_array($login->ID, $userids) )
-                       $user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
+                       $user_dropdown .= "<option value=\"" . esc_attr($login->ID) . "\">{$login->user_login}</option>";
        $user_dropdown .= '</select>';
        ?>
        </ul>
        $user_dropdown .= '</select>';
        ?>
        </ul>
@@ -168,7 +170,7 @@ case 'delete':
                <?php echo '<label for="delete_option1">'.__('Attribute all posts and links to:')."</label> $user_dropdown"; ?></li>
        </ul></fieldset>
        <input type="hidden" name="action" value="dodelete" />
                <?php echo '<label for="delete_option1">'.__('Attribute all posts and links to:')."</label> $user_dropdown"; ?></li>
        </ul></fieldset>
        <input type="hidden" name="action" value="dodelete" />
-       <p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" class="button-secondary" /></p>
+       <p class="submit"><input type="submit" name="submit" value="<?php esc_attr_e('Confirm Deletion'); ?>" class="button-secondary" /></p>
 <?php else : ?>
        <p><?php _e('There are no valid users selected for deletion.'); ?></p>
 <?php endif; ?>
 <?php else : ?>
        <p><?php _e('There are no valid users selected for deletion.'); ?></p>
 <?php endif; ?>
@@ -185,8 +187,6 @@ default:
                exit;
        }
 
                exit;
        }
 
-       wp_enqueue_script('admin-users');
-
        include('admin-header.php');
 
        $usersearch = isset($_GET['usersearch']) ? $_GET['usersearch'] : null;
        include('admin-header.php');
 
        $usersearch = isset($_GET['usersearch']) ? $_GET['usersearch'] : null;
@@ -202,7 +202,7 @@ default:
                case 'del':
                case 'del_many':
                        $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
                case 'del':
                case 'del_many':
                        $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
-                       $messages[] = '<div id="message" class="updated fade"><p>' . sprintf(__ngettext('%s user deleted', '%s users deleted', $delete_count), $delete_count) . '</p></div>';
+                       $messages[] = '<div id="message" class="updated fade"><p>' . sprintf(_n('%s user deleted', '%s users deleted', $delete_count), $delete_count) . '</p></div>';
                        break;
                case 'add':
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('New user created.') . '</p></div>';
                        break;
                case 'add':
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('New user created.') . '</p></div>';
@@ -211,11 +211,11 @@ default:
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('Changed roles.') . '</p></div>';
                        break;
                case 'err_admin_role':
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('Changed roles.') . '</p></div>';
                        break;
                case 'err_admin_role':
-                       $messages[] = '<div id="message" class="error"><p>' . __("The current user's role must have user editing capabilities.") . '</p></div>';
+                       $messages[] = '<div id="message" class="error"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('Other user roles have been changed.') . '</p></div>';
                        break;
                case 'err_admin_del':
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('Other user roles have been changed.') . '</p></div>';
                        break;
                case 'err_admin_del':
-                       $messages[] = '<div id="message" class="error"><p>' . __("You can't delete the current user.") . '</p></div>';
+                       $messages[] = '<div id="message" class="error"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been deleted.') . '</p></div>';
                        break;
                }
                        $messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been deleted.') . '</p></div>';
                        break;
                }
@@ -239,9 +239,9 @@ if ( ! empty($messages) ) {
 
 <div class="wrap">
 <?php screen_icon(); ?>
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title );
-if ( isset($_GET['s']) && $_GET['s'] )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', wp_specialchars( get_search_query() ) ); ?>
+<h2><?php echo esc_html( $title );
+if ( isset($_GET['usersearch']) && $_GET['usersearch'] )
+       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $_GET['usersearch'] ) ); ?>
 </h2>
 
 <div class="filter">
 </h2>
 
 <div class="filter">
@@ -264,7 +264,7 @@ unset($users_of_blog);
 
 $current_role = false;
 $class = empty($role) ? ' class="current"' : '';
 
 $current_role = false;
 $class = empty($role) ? ' class="current"' : '';
-$role_links[] = "<li><a href='users.php'$class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users ), number_format_i18n( $total_users ) ) . '</a>';
+$role_links[] = "<li><a href='users.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
 foreach ( $wp_roles->get_names() as $this_role => $name ) {
        if ( !isset($avail_roles[$this_role]) )
                continue;
 foreach ( $wp_roles->get_names() as $this_role => $name ) {
        if ( !isset($avail_roles[$this_role]) )
                continue;
@@ -276,8 +276,9 @@ foreach ( $wp_roles->get_names() as $this_role => $name ) {
                $class = ' class="current"';
        }
 
                $class = ' class="current"';
        }
 
-       $name = translate_with_context($name);
-       $name = sprintf( _c('%1$s <span class="count">(%2$s)</span>|user role with count'), $name, $avail_roles[$this_role] );
+       $name = translate_user_role( $name );
+       /* translators: User role name with count */
+       $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] );
        $role_links[] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
 }
 echo implode( " |</li>\n", $role_links) . '</li>';
        $role_links[] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
 }
 echo implode( " |</li>\n", $role_links) . '</li>';
@@ -289,9 +290,9 @@ unset($role_links);
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
 
 <form class="search-form" action="" method="get">
 <p class="search-box">
-       <label class="hidden" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label>
-       <input type="text" class="search-input" id="user-search-input" name="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" />
-       <input type="submit" value="<?php _e( 'Search Users' ); ?>" class="button" />
+       <label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label>
+       <input type="text" id="user-search-input" name="usersearch" value="<?php echo esc_attr($wp_user_search->search_term); ?>" />
+       <input type="submit" value="<?php esc_attr_e( 'Search Users' ); ?>" class="button" />
 </p>
 </form>
 
 </p>
 </form>
 
@@ -307,9 +308,9 @@ unset($role_links);
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
-<label class="hidden" for="new_role"><?php _e('Change role to&hellip;') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option><?php wp_dropdown_roles(); ?></select>
-<input type="submit" value="<?php _e('Change'); ?>" name="changeit" class="button-secondary" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<label class="screen-reader-text" for="new_role"><?php _e('Change role to&hellip;') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option><?php wp_dropdown_roles(); ?></select>
+<input type="submit" value="<?php esc_attr_e('Change'); ?>" name="changeit" class="button-secondary" />
 <?php wp_nonce_field('bulk-users'); ?>
 </div>
 
 <?php wp_nonce_field('bulk-users'); ?>
 </div>
 
@@ -373,7 +374,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
 <option value="delete"><?php _e('Delete'); ?></option>
 </select>
-<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
 </div>
 
 <br class="clear" />
 </div>
 
 <br class="clear" />
@@ -387,7 +388,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
 <?php
        foreach ( array('user_login' => 'user_login', 'first_name' => 'user_firstname', 'last_name' => 'user_lastname', 'email' => 'user_email', 'url' => 'user_uri', 'role' => 'user_role') as $formpost => $var ) {
                $var = 'new_' . $var;
 <?php
        foreach ( array('user_login' => 'user_login', 'first_name' => 'user_firstname', 'last_name' => 'user_lastname', 'email' => 'user_email', 'url' => 'user_uri', 'role' => 'user_role') as $formpost => $var ) {
                $var = 'new_' . $var;
-               $$var = isset($_REQUEST[$formpost]) ? attribute_escape(stripslashes($_REQUEST[$formpost])) : '';
+               $$var = isset($_REQUEST[$formpost]) ? esc_attr(stripslashes($_REQUEST[$formpost])) : '';
        }
        unset($name);
 ?>
        }
        unset($name);
 ?>
index 95e82814882746892e42ea9e8f0536268f06b082..4ead317a74d7fe46e0a86d87140a4a51bb59d265 100644 (file)
@@ -15,7 +15,7 @@ require_once(ABSPATH . 'wp-admin/includes/widgets.php');
 if ( ! current_user_can('switch_themes') )
        wp_die( __( 'Cheatin&#8217; uh?' ));
 
 if ( ! current_user_can('switch_themes') )
        wp_die( __( 'Cheatin&#8217; uh?' ));
 
-wp_enqueue_script( array( 'wp-lists', 'admin-widgets' ) );
+wp_enqueue_script('admin-widgets');
 wp_admin_css( 'widgets' );
 
 do_action( 'sidebar_admin_setup' );
 wp_admin_css( 'widgets' );
 
 do_action( 'sidebar_admin_setup' );
@@ -23,20 +23,98 @@ do_action( 'sidebar_admin_setup' );
 $title = __( 'Widgets' );
 $parent_file = 'themes.php';
 
 $title = __( 'Widgets' );
 $parent_file = 'themes.php';
 
-// $sidebar = What sidebar are we editing?
-if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']]) ) {
-       $sidebar = attribute_escape( $_GET['sidebar'] );
-} elseif ( is_array($wp_registered_sidebars) && !empty($wp_registered_sidebars) ) {
-       // By default we look at the first defined sidebar
-       $sidebar = array_shift( $keys = array_keys($wp_registered_sidebars) );
-} else {
-       // If no sidebars, die.
+// register the inactive_widgets area as sidebar
+register_sidebar(array(
+       'name' => __('Inactive Widgets'),
+       'id' => 'wp_inactive_widgets',
+       'before_widget' => '',
+       'after_widget' => '',
+       'before_title' => '',
+       'after_title' => '',
+));
+
+// These are the widgets grouped by sidebar
+$sidebars_widgets = wp_get_sidebars_widgets();
+if ( empty( $sidebars_widgets ) )
+       $sidebars_widgets = wp_get_widget_defaults();
+
+// look for "lost" widgets, this has to run at least on each theme change
+function retrieve_widgets() {
+       global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets;
+
+       $_sidebars_widgets = array();
+       $sidebars = array_keys($wp_registered_sidebars);
+
+       unset( $sidebars_widgets['array_version'] );
+
+       $old = array_keys($sidebars_widgets);
+       sort($old);
+       sort($sidebars);
+
+       if ( $old == $sidebars )
+               return;
+
+       // Move the known-good ones first
+       foreach ( $sidebars as $id ) {
+               if ( array_key_exists( $id, $sidebars_widgets ) ) {
+                       $_sidebars_widgets[$id] = $sidebars_widgets[$id];
+                       unset($sidebars_widgets[$id], $sidebars[$id]);
+               }
+       }
+
+       // if new theme has less sidebars than the old theme
+       if ( !empty($sidebars_widgets) ) {
+               foreach ( $sidebars_widgets as $lost => $val ) {
+                       if ( is_array($val) )
+                               $_sidebars_widgets['wp_inactive_widgets'] = array_merge( (array) $_sidebars_widgets['wp_inactive_widgets'], $val );
+               }
+       }
+
+       // discard invalid, theme-specific widgets from sidebars
+       $shown_widgets = array();
+       foreach ( $_sidebars_widgets as $sidebar => $widgets ) {
+               if ( !is_array($widgets) )
+                       continue;
+
+               $_widgets = array();
+               foreach ( $widgets as $widget ) {
+                       if ( isset($wp_registered_widgets[$widget]) )
+                               $_widgets[] = $widget;
+               }
+               $_sidebars_widgets[$sidebar] = $_widgets;
+               $shown_widgets = array_merge($shown_widgets, $_widgets);
+       }
+
+       $sidebars_widgets = $_sidebars_widgets;
+       unset($_sidebars_widgets, $_widgets);
+
+       // find hidden/lost multi-widget instances
+       $lost_widgets = array();
+       foreach ( $wp_registered_widgets as $key => $val ) {
+               if ( in_array($key, $shown_widgets, true) )
+                       continue;
+
+               $number = preg_replace('/.+?-([0-9]+)$/', '$1', $key);
+
+               if ( 2 > (int) $number )
+                       continue;
+
+               $lost_widgets[] = $key;
+       }
+
+       $sidebars_widgets['wp_inactive_widgets'] = array_merge($lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets']);
+       wp_set_sidebars_widgets($sidebars_widgets);
+}
+retrieve_widgets();
+
+if ( count($wp_registered_sidebars) == 1 ) {
+       // If only "wp_inactive_widgets" is defined the theme has no sidebars, die.
        require_once( 'admin-header.php' );
 ?>
 
        <div class="wrap">
        <?php screen_icon(); ?>
        require_once( 'admin-header.php' );
 ?>
 
        <div class="wrap">
        <?php screen_icon(); ?>
-       <h2><?php echo wp_specialchars( $title ); ?></h2>
+       <h2><?php echo esc_html( $title ); ?></h2>
                <div class="error">
                        <p><?php _e( 'No Sidebars Defined' ); ?></p>
                </div>
                <div class="error">
                        <p><?php _e( 'No Sidebars Defined' ); ?></p>
                </div>
@@ -48,279 +126,267 @@ if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']])
        exit;
 }
 
        exit;
 }
 
-// These are the widgets grouped by sidebar
-$sidebars_widgets = wp_get_sidebars_widgets();
-if ( empty( $sidebars_widgets ) )
-       $sidebars_widgets = wp_get_widget_defaults();
+// We're saving a widget without js
+if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) {
+       $widget_id = $_POST['widget-id'];
+       check_admin_referer("save-delete-widget-$widget_id");
 
 
-// for the sake of PHP warnings
-if ( empty( $sidebars_widgets[$sidebar] ) )
-       $sidebars_widgets[$sidebar] = array();
-
-$http_post = 'post' == strtolower($_SERVER['REQUEST_METHOD']);
-
-// We're updating a sidebar
-if ( $http_post && isset($sidebars_widgets[$_POST['sidebar']]) ) {
-       check_admin_referer( 'edit-sidebar_' . $_POST['sidebar'] );
-
-       /* Hack #1
-        * The widget_control is overloaded.  It updates the widget's options AND echoes out the widget's HTML form.
-        * Since we want to update before sending out any headers, we have to catch it with an output buffer,
-        */
-       ob_start();
-               /* There can be multiple widgets of the same type, but the widget_control for that
-                * widget type needs only be called once if it's a multi-widget.
-                */
-               $already_done = array();
-
-               foreach ( $wp_registered_widget_controls as $name => $control ) {
-                       if ( in_array( $control['callback'], $already_done ) )
-                               continue;
-
-                       if ( is_callable( $control['callback'] ) ) {
-                               call_user_func_array( $control['callback'], $control['params'] );
-                               $control_output = ob_get_contents();
-                               if ( false !== strpos( $control_output, '%i%' ) ) // if it's a multi-widget, only call control function once.
-                                       $already_done[] = $control['callback'];
+       $number = isset($_POST['multi_number']) ? (int) $_POST['multi_number'] : '';
+       if ( $number ) {
+               foreach ( $_POST as $key => $val ) {
+                       if ( is_array($val) && preg_match('/__i__|%i%/', key($val)) ) {
+                               $_POST[$key] = array( $number => array_shift($val) );
+                               break;
                        }
                        }
-
-                       ob_clean();
                }
                }
-       ob_end_clean();
+       }
 
 
-       // Prophylactic.  Take out empty ids.
-       foreach ( (array) $_POST['widget-id'] as $key => $val )
-               if ( !$val )
-                       unset($_POST['widget-id'][$key]);
+       $sidebar_id = $_POST['sidebar'];
+       $position = isset($_POST[$sidebar_id . '_position']) ? (int) $_POST[$sidebar_id . '_position'] - 1 : 0;
 
 
-       // Reset the key numbering and store
-       $new_sidebar = isset( $_POST['widget-id'] ) && is_array( $_POST['widget-id'] ) ? array_values( $_POST['widget-id'] ) : array();
-       $sidebars_widgets[$_POST['sidebar']] = $new_sidebar;
-       wp_set_sidebars_widgets( $sidebars_widgets );
+       $id_base = $_POST['id_base'];
+       $sidebar = isset($sidebars_widgets[$sidebar_id]) ? $sidebars_widgets[$sidebar_id] : array();
 
 
-       wp_redirect( add_query_arg( 'message', 'updated' ) );
-       exit;
-}
+       // delete
+       if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) {
 
 
-// What widget (if any) are we editing
-$edit_widget = -1;
-
-$query_args = array('add', 'remove', 'key', 'edit', '_wpnonce', 'message', 'base' );
-
-if ( isset($_GET['add']) && $_GET['add'] ) {
-       // Add to the end of the sidebar
-       $control_callback;
-       if ( isset($wp_registered_widgets[$_GET['add']]) ) {
-               check_admin_referer( "add-widget_$_GET[add]" );
-               $sidebars_widgets[$sidebar][] = $_GET['add'];
-               wp_set_sidebars_widgets( $sidebars_widgets );
-       } elseif ( isset($_GET['base']) && isset($_GET['key']) ) { // It's a multi-widget
-               check_admin_referer( "add-widget_$_GET[add]" );
-               // Copy minimal info from an existing instance of this widget to a new instance
-               foreach ( $wp_registered_widget_controls as $control ) {
-                       if ( $_GET['base'] === $control['id_base'] ) {
-                               $control_callback = $control['callback'];
-                               $num = (int) $_GET['key'];
-                               $control['params'][0]['number'] = $num;
-                               $control['id'] = $control['id_base'] . '-' . $num;
-                               $wp_registered_widget_controls[$control['id']] = $control;
-                               $sidebars_widgets[$sidebar][] = $control['id'];
-                               break;
-                       }
+               if ( !in_array($widget_id, $sidebar, true) ) {
+                       wp_redirect('widgets.php?error=0');
+                       exit;
                }
                }
-       }
-
-       // it's a multi-widget.  The only way to add multi-widgets without JS is to actually submit POST content...
-       // so here we go
-       if ( is_callable( $control_callback ) ) {
-               require_once( 'admin-header.php' );
-       ?>
-               <div class="wrap">
-               <h2><?php _e( 'Add Widget' ); ?></h2>
-               <br />
-               <form action="<?php echo clean_url( remove_query_arg( $query_args ) ); ?>" method="post">
-
-                       <ul class="widget-control-list">
-                               <li class="widget-list-control-item">
-                                       <div class="widget-top">
-                                       <h4 class="widget-title"><?php echo $control['name']; ?></h4>
-                                       </div>
-                                       <div class="widget-control" style="display: block;">
-       <?php
-                                               call_user_func_array( $control_callback, $control['params'] );
-       ?>
-                                               <div class="widget-control-actions">
-                                                       <input type="submit" class="button" value="<?php _e( 'Add Widget' ); ?>" />
-                                                       <input type="hidden" id='sidebar' name='sidebar' value="<?php echo $sidebar; ?>" />
-       <?php   wp_nonce_field ( 'edit-sidebar_' . $sidebar );
-               foreach ( $sidebars_widgets[$sidebar] as $sidebar_widget_id ) : ?>
-                                                       <input type="hidden" name='widget-id[]' value="<?php echo $sidebar_widget_id; ?>" />
-       <?php   endforeach; ?>
-                                               </div>
-                                       </div>
-                               </li>
-                       </ul>
-               </form>
-               </div>
-       <?php
 
 
-               require_once( 'admin-footer.php' );
-               exit;
-       }
-       wp_redirect( remove_query_arg( $query_args ) );
-       exit;
-} elseif ( isset($_GET['remove']) && $_GET['remove'] && isset($_GET['key']) && is_numeric($_GET['key']) ) {
-       // Remove from sidebar the widget of type $_GET['remove'] and in position $_GET['key']
-       $key = (int) $_GET['key'];
-       if ( -1 < $key && ( $keys = array_keys($sidebars_widgets[$sidebar], $_GET['remove']) ) && in_array($key, $keys) ) {
-               check_admin_referer( "remove-widget_$_GET[remove]" );
-               unset($sidebars_widgets[$sidebar][$key]);
-               $sidebars_widgets[$sidebar] = array_values($sidebars_widgets[$sidebar]);
-               wp_set_sidebars_widgets( $sidebars_widgets );
+               $sidebar = array_diff( $sidebar, array($widget_id) );
+               $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
        }
        }
-       wp_redirect( remove_query_arg( $query_args ) );
-       exit;
-} elseif ( isset($_GET['edit']) && $_GET['edit'] && isset($_GET['key']) && is_numeric($_GET['key']) ) {
-       // Edit widget of type $_GET['edit'] and position $_GET['key']
-       $key = (int) $_GET['key'];
-       if ( -1 < $key && ( $keys = array_keys($sidebars_widgets[$sidebar], $_GET['edit']) ) && in_array($key, $keys) )
-               $edit_widget = $key;
-}
 
 
-// Total number of registered sidebars
-$sidebar_widget_count = count($sidebars_widgets[$sidebar]);
+       $_POST['widget-id'] = $sidebar;
 
 
-// This is sort of lame since "widget" won't be converted to "widgets" in the JS
-if ( 1 < $sidebars_count = count($wp_registered_sidebars) )
-       $sidebar_info_text = __ngettext( 'You are using %1$s widget in the "%2$s" sidebar.', 'You are using %1$s widgets in the "%2$s" sidebar.', $sidebar_widget_count );
-else
-       $sidebar_info_text = __ngettext( 'You are using %1$s widget in the sidebar.', 'You are using %1$s widgets in the sidebar.', $sidebar_widget_count );
+       foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
+               if ( $name != $id_base || !is_callable($control['callback']) )
+                       continue;
 
 
+               ob_start();
+                       call_user_func_array( $control['callback'], $control['params'] );
+               ob_end_clean();
 
 
-$sidebar_info_text = sprintf( wp_specialchars( $sidebar_info_text ), "<span id='widget-count'>$sidebar_widget_count</span>", $wp_registered_sidebars[$sidebar]['name'] );
+               break;
+       }
 
 
-$page = isset($_GET['apage']) ? abs( (int) $_GET['apage'] ) : 1;
+       $sidebars_widgets[$sidebar_id] = $sidebar;
 
 
-/* TODO: Paginate widgets list
-$page_links = paginate_links( array(
-       'base'    => add_query_arg( 'apage', '%#%' ),
-       'format'  => '',
-       'total'   => ceil(($total = 105 )/ 10),
-       'current' => $page
-));
-*/
-$page_links = '&nbsp;';
+       // remove old position
+       if ( !isset($_POST['delete_widget']) ) {
+               foreach ( $sidebars_widgets as $key => $sb ) {
+                       if ( is_array($sb) )
+                               $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) );
+               }
+               array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id );
+       }
 
 
-// Unsanitized!
-$widget_search = isset($_GET['s']) ? $_GET['s'] : false;
+       wp_set_sidebars_widgets($sidebars_widgets);
+       wp_redirect('widgets.php?message=0');
+       exit;
+}
 
 
-// Not entirely sure what all should be here
-$show_values = array(
-       ''       => $widget_search ? __( 'Show any widgets' ) : __( 'Show all widgets' ),
-       'unused' => __( 'Show unused widgets' ),
-       'used'   => __( 'Show used widgets' )
-);
+// Output the widget form without js
+if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
+       $widget_id = $_GET['editwidget'];
+
+       if ( isset($_GET['addnew']) ) {
+               // Default to the first sidebar
+               $sidebar = array_shift( $keys = array_keys($wp_registered_sidebars) );
+
+               if ( isset($_GET['base']) && isset($_GET['num']) ) { // multi-widget
+                       // Copy minimal info from an existing instance of this widget to a new instance
+                       foreach ( $wp_registered_widget_controls as $control ) {
+                               if ( $_GET['base'] === $control['id_base'] ) {
+                                       $control_callback = $control['callback'];
+                                       $multi_number = (int) $_GET['num'];
+                                       $control['params'][0]['number'] = -1;
+                                       $widget_id = $control['id'] = $control['id_base'] . '-' . $multi_number;
+                                       $wp_registered_widget_controls[$control['id']] = $control;
+                                       break;
+                               }
+                       }
+               }
+       }
 
 
-$show = isset($_GET['show']) && isset($show_values[$_GET['show']]) ? attribute_escape( $_GET['show'] ) : false;
+       if ( isset($wp_registered_widget_controls[$widget_id]) && !isset($control) ) {
+               $control = $wp_registered_widget_controls[$widget_id];
+               $control_callback = $control['callback'];
+       } elseif ( !isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id]) ) {
+               $name = esc_html( strip_tags($wp_registered_widgets[$widget_id]['name']) );
+       }
 
 
-$messages = array(
-       'updated' => __('Changes saved.')
-);
+       if ( !isset($name) )
+               $name = esc_html( strip_tags($control['name']) );
 
 
-require_once( 'admin-header.php' ); ?>
+       if ( !isset($sidebar) )
+               $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets';
 
 
-<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-<?php endif; ?>
+       if ( !isset($multi_number) )
+               $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : '';
 
 
-<div class="wrap">
-<?php screen_icon(); ?>
-<h2><?php echo wp_specialchars( $title ); ?></h2>
-
-       <form id="widgets-filter" action="" method="get">
-
-       <div class="widget-liquid-left-holder">
-       <div id="available-widgets-filter" class="widget-liquid-left">
-               <h3><label for="show"><?php _e('Available Widgets'); ?></label></h3>
-               <div class="nav">
-                       <select name="show" id="show">
-<?php foreach ( $show_values as $show_value => $show_text ) : $show_value = attribute_escape( $show_value ); ?>
-                               <option value='<?php echo $show_value; ?>'<?php selected( $show_value, $show ); ?>><?php echo wp_specialchars( $show_text ); ?></option>
-<?php endforeach; ?>
-                       </select>
-                       <input type="submit" value="<?php _e('Show' ); ?>" class="button-secondary" />
-                       <p class="pagenav">
-                               <?php echo $page_links; ?>
-                       </p>
-               </div>
-       </div>
-       </div>
+       $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id'];
 
 
-       <div id="available-sidebars" class="widget-liquid-right">
-               <h3><label for="sidebar-selector"><?php _e('Current Widgets'); ?></label></h3>
+       // show the widget form
+       $width = ' style="width:' . max($control['width'], 350) . 'px"';
+       $key = isset($_GET['key']) ? (int) $_GET['key'] : 0;
 
 
-               <div class="nav">
-                       <select id="sidebar-selector" name="sidebar">
-<?php foreach ( $wp_registered_sidebars as $sidebar_id => $registered_sidebar ) : $sidebar_id = attribute_escape( $sidebar_id ); ?>
-                               <option value='<?php echo $sidebar_id; ?>'<?php selected( $sidebar_id, $sidebar ); ?>><?php echo wp_specialchars( $registered_sidebar['name'] ); ?></option>
-<?php endforeach; ?>
-                       </select>
-                       <input type="submit" value="<?php _e('Show' ); ?>" class="button-secondary" />
-               </div>
+       require_once( 'admin-header.php' ); ?>
+       <div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php echo esc_html( $title ); ?></h2>
+       <div class="editwidget"<?php echo $width; ?>>
+       <h3><?php printf( __( 'Widget %s' ), $name ); ?></h3>
 
 
+       <form action="widgets.php" method="post">
+       <div class="widget-inside">
+<?php
+       if ( is_callable( $control_callback ) )
+               call_user_func_array( $control_callback, $control['params'] );
+       else
+               echo '<p>' . __('There are no options for this widget.') . "</p>\n"; ?>
        </div>
 
        </div>
 
+       <p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p>
+       <div class="widget-position">
+       <table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody>
+<?php  foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) {
+               echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr($sbname) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>";
+               if ( 'wp_inactive_widgets' == $sbname ) {
+                       echo '&nbsp;';
+               } else {
+                       if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) {
+                               $j = 1;
+                       } else {
+                               $j = count($sidebars_widgets[$sbname]);
+                               if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) )
+                                       $j++;
+                       }
+                       $selected = '';
+                       echo "\t\t<select name='{$sbname}_position'>\n";
+                       echo "\t\t<option value=''>" . __('-- select --') . "</option>\n";
+                       for ( $i = 1; $i <= $j; $i++ ) {
+                               if ( in_array($widget_id, $sidebars_widgets[$sbname], true) )
+                                       $selected = selected( $i, $key + 1, false );
+                               echo "\t\t<option value='$i'$selected> $i </option>\n";
+                       }
+                       echo "\t\t</select>\n";
+               }
+               echo "</td></tr>\n";
+       } ?>
+       </tbody></table>
+       </div>
+
+       <div class="widget-control-actions">
+<?php  if ( isset($_GET['addnew']) ) { ?>
+       <a href="widgets.php" class="button alignleft"><?php _e('Cancel'); ?></a>
+<?php  } else { ?>
+       <input type="submit" name="removewidget" class="button alignleft" value="<?php esc_attr_e('Remove'); ?>" />
+<?php  } ?>
+       <input type="submit" name="savewidget" class="button-primary alignright" value="<?php esc_attr_e('Save Widget'); ?>" />
+       <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" />
+       <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
+       <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
+<?php  wp_nonce_field("save-delete-widget-$widget_id"); ?>
+       <br class="clear" />
+       </div>
        </form>
        </form>
+       </div>
+       </div>
+<?php
+       require_once( 'admin-footer.php' );
+       exit;
+}
 
 
-       <div id="widget-content" class="widget-liquid-left-holder">
+$widgets_access = get_user_setting( 'widgets_access' );
+if ( isset($_GET['widgets-access']) ) {
+       $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
+       set_user_setting( 'widgets_access', $widgets_access );
+}
 
 
-               <div id="available-widgets" class="widget-liquid-left">
+if ( 'on' == $widgets_access )
+       add_filter( 'admin_body_class', create_function('', '{return " widgets_access ";}') );
 
 
-                       <?php wp_list_widgets( $show, $widget_search ); // This lists all the widgets for the query ( $show, $search ) ?>
+$messages = array(
+       __('Changes saved.')
+);
 
 
-                       <div class="nav">
-                               <p class="pagenav">
-                                       <?php echo $page_links; ?>
-                               </p>
-                       </div>
-               </div>
-       </div>
+$errors = array(
+       __('Error while saving.'),
+       __('Error in displaying the widget settings form.')
+);
 
 
-       <form id="widget-controls" action="" method="post">
+require_once( 'admin-header.php' ); ?>
 
 
-       <div id="current-widgets-head" class="widget-liquid-right">
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo esc_html( $title ); ?></h2>
 
 
-               <div id="sidebar-info">
-                       <p><?php echo $sidebar_info_text; ?></p>
-                       <p><?php _e( 'Add more from the Available Widgets section.' ); ?></p>
+<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php } ?>
+<?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?>
+<div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
+<?php } ?>
+
+<div class="widget-liquid-left">
+<div id="widgets-left">
+       <div id="available-widgets" class="widgets-holder-wrap">
+               <div class="sidebar-name">
+               <div class="sidebar-name-arrow"><br /></div>
+               <h3><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _e('Deactivate'); ?> <span></span></span></h3></div>
+               <div class="widget-holder">
+               <p class="description"><?php _e('Drag widgets from here to a sidebar on the right to activate them. Drag widgets back here to deactivate them and delete their settings.'); ?></p>
+               <div id="widget-list">
+               <?php wp_list_widgets(); ?>
                </div>
                </div>
-
+               <br class='clear' />
+               </div>
+               <br class="clear" />
        </div>
 
        </div>
 
-       <div id="current-widgets" class="widget-liquid-right">
-               <div id="current-sidebar">
-
-                       <?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
-
+       <div class="widgets-holder-wrap">
+               <div class="sidebar-name">
+               <div class="sidebar-name-arrow"><br /></div>
+               <h3><?php _e('Inactive Widgets'); ?>
+               <span><img src="images/wpspin_light.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
+               <div class="widget-holder inactive">
+               <p class="description"><?php _e('Drag widgets here to remove them from the sidebar but keep their settings.'); ?></p>
+               <?php wp_list_widget_controls('wp_inactive_widgets'); ?>
+               <br class="clear" />
                </div>
                </div>
+       </div>
+</div>
+</div>
 
 
-               <p class="submit">
-                       <input type="hidden" id='sidebar' name='sidebar' value="<?php echo $sidebar; ?>" />
-                       <input type="hidden" id="generated-time" name="generated-time" value="<?php echo time() - 1199145600; // Jan 1, 2008 ?>" />
-                       <input type="submit" name="save-widgets" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" />
+<div class="widget-liquid-right">
+<div id="widgets-right">
 <?php
 <?php
-                       wp_nonce_field( 'edit-sidebar_' . $sidebar );
-?>
-               </p>
+$i = 0;
+foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
+       if ( 'wp_inactive_widgets' == $sidebar )
+               continue;
+       $closed = $i ? ' closed' : ''; ?>
+       <div class="widgets-holder-wrap<?php echo $closed; ?>">
+       <div class="sidebar-name">
+       <div class="sidebar-name-arrow"><br /></div>
+       <h3><?php echo esc_html( $registered_sidebar['name'] ); ?>
+       <span><img src="images/wpspin_dark.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
+       <?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
        </div>
        </div>
-
-       </form>
-       <br class="clear" />
-
+<?php
+       $i++;
+} ?>
+</div>
+</div>
+<form action="" method="post">
+<?php wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ); ?>
+</form>
+<br class="clear" />
 </div>
 
 </div>
 
-<?php do_action( 'sidebar_admin_page' ); ?>
-
-<?php require_once( 'admin-footer.php' ); ?>
-
-
+<?php
+do_action( 'sidebar_admin_page' );
+require_once( 'admin-footer.php' );
index a2b3b9ac7e668a450d1a241cdc5384872acbd77d..21284cba7bd6a788eb203f88a6a164e7c35bf38b 100644 (file)
@@ -1,5 +1,32 @@
+textarea,
+input,
+select {
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 4px;
+       -khtml-border-radius: 4px;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
+}
+
+input[type="checkbox"],
+input[type="radio"],
+input[type="image"] {
+       border: 0 none;
+}
+
+p,
+ul,
+ol,
+blockquote,
+input,
+select {
+       font-size: 12px;
+}
 
 
-p, ul, ol, blockquote { font-size: 12px; }
+select option {
+       padding: 2px;
+}
 
 .plugins .name,
 #pass-strength-result.strong,
 
 .plugins .name,
 #pass-strength-result.strong,
@@ -15,10 +42,71 @@ p, ul, ol, blockquote { font-size: 12px; }
        padding: 0;
 }
 
        padding: 0;
 }
 
+.plugins .desc p {
+       margin: 0 0 8px;
+}
+
+.plugins td.desc {
+       line-height: 1.5em;
+}
+
+.plugins .desc ul,
+.plugins .desc ol {
+       margin: 0 0 0 2em;
+}
+
+.plugins .desc ul {
+       list-style-type: disc;
+}
+
 .plugins .action-links { 
        white-space: nowrap;
 }
 
 .plugins .action-links { 
        white-space: nowrap;
 }
 
+.plugins .row-actions-visible {
+       padding: 0;
+}
+
+.widefat tbody.plugins th.check-column {
+       padding: 7px 0;
+}
+
+.widefat .plugins td,
+.widefat .plugins th {
+       border-bottom: 0 none;
+}
+
+#install-plugins .plugins td,
+#install-plugins .plugins th {
+       border-bottom-style: solid;
+       border-bottom-width: 1px;
+}
+
+.plugins .inactive td,
+.plugins .inactive th,
+.plugins .active td,
+.plugins .active th {
+       border-top-style: solid;
+       border-top-width: 1px;
+       padding: 5px 7px 0;
+}
+
+#wpbody-content .plugins .plugin-title {
+       padding-right: 12px;
+}
+
+.plugins .second td,
+.plugins .second th {
+       border-top: 0 none;
+       padding: 0 7px 5px;
+}
+
+.plugins-php .widefat tfoot th,
+.plugins-php .widefat tfoot td {
+       border-top-style: solid;
+       border-top-width: 1px;
+}
+
 .import-system {
        font-size: 16px;
 }
 .import-system {
        font-size: 16px;
 }
@@ -90,7 +178,7 @@ table#availablethemes td.bottom {
        margin: 0;
 }
 
        margin: 0;
 }
 
-#current-theme .description {
+#current-theme .theme-description {
        margin-top: 5px;
 }
 
        margin-top: 5px;
 }
 
@@ -109,6 +197,11 @@ table#availablethemes td.bottom {
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
+#TB_window #TB_title {
+       background-color: #222;
+       color: #cfcfcf;
+}
+
 .checkbox {
        border: none;
        margin: 0;
 .checkbox {
        border: none;
        margin: 0;
@@ -259,6 +352,11 @@ form p.submit a.cancel:hover {
        margin-left: 18px;
 }
 
        margin-left: 18px;
 }
 
+#post-status-display,
+#post-visibility-display {
+       font-weight: bold;
+}
+
 .side-info {
        margin: 0;
        padding: 4px;
 .side-info {
        margin: 0;
        padding: 4px;
@@ -285,7 +383,6 @@ form p.submit a.cancel:hover {
 .button-secondary,
 .button-highlighted,
 #postcustomstuff .submit input {
 .button-secondary,
 .button-highlighted,
 #postcustomstuff .submit input {
-       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
        text-decoration: none;
        font-size: 11px !important;
        line-height: 16px;
        text-decoration: none;
        font-size: 11px !important;
        line-height: 16px;
@@ -309,6 +406,7 @@ a.button-secondary {
        line-height: 1.2em;
        -webkit-border-radius: 10px;
        padding: 4px 10px;
        line-height: 1.2em;
        -webkit-border-radius: 10px;
        padding: 4px 10px;
+       white-space: nowrap;
 }
 
 #doaction,
 }
 
 #doaction,
@@ -330,12 +428,9 @@ a.button-secondary {
 }
 
 #wpcontent select {
 }
 
 #wpcontent select {
-       font: 11px/20px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
        padding: 2px;
        padding: 2px;
-       border-width: 1px;
-       border-style: solid;
        height: 2em;
        height: 2em;
-       vertical-align: top;
+       font-size: 11px;
 }
 
 #wpcontent option {
 }
 
 #wpcontent option {
@@ -363,10 +458,6 @@ a.button-secondary {
        line-height: 150%;
 }
 
        line-height: 150%;
 }
 
-table .vers {
-       text-align: center;
-}
-
 textarea.all-options, input.all-options {
        width: 250px;
 }
 textarea.all-options, input.all-options {
        width: 250px;
 }
@@ -440,15 +531,9 @@ textarea.all-options, input.all-options {
        margin: 3px 1px 4px;
        line-height: 18px;
        display: inline-block;
        margin: 3px 1px 4px;
        line-height: 18px;
        display: inline-block;
-       border-width: 1px;
-       border-style: solid;
        min-width: 26px;
        padding: 2px 4px;
        font-size: 12px;
        min-width: 26px;
        padding: 2px 4px;
        font-size: 12px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
 }
 
 #ed_reply_toolbar input {
 }
 
 #ed_reply_toolbar input {
@@ -675,7 +760,8 @@ p.pagenav {
        font-size: 11px;
 }
 
        font-size: 11px;
 }
 
-.tablenav .tablenav-pages a, .tablenav-pages span.current  {
+.tablenav .tablenav-pages a,
+.tablenav-pages span.current  {
        text-decoration: none;
        border: none;
        padding: 3px 6px;
        text-decoration: none;
        border: none;
        padding: 3px 6px;
@@ -709,18 +795,24 @@ td.media-icon img {
        max-height: 60px;
 }
 
        max-height: 60px;
 }
 
-#update-nag, .plugin-update {
+#update-nag {
        line-height: 29px;
        font-size: 12px;
        text-align: center;
        line-height: 29px;
        font-size: 12px;
        text-align: center;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
-       border-top-width: 1px;
-       border-top-style: solid;
 }
 
 }
 
-#update-nag a, .plugin-update a {
-       font-size: 1.1em;
+#update-nag {
+       border-width: 1px 0;
+       border-style: solid none;
+}
+
+.plugins .plugin-update {
+       padding: 0;
+}
+
+.plugin-update .update-message {
+       margin: 0 10px 8px 31px;
+       font-weight: bold;
 }
 
 #pass-strength-result {
 }
 
 #pass-strength-result {
@@ -743,6 +835,11 @@ div.comment-item:hover .row-actions {
        visibility: visible;
 }
 
        visibility: visible;
 }
 
+.row-actions-visible {
+       padding: 2px 0 0;
+       cursor: pointer;
+}
+
 /* Admin Header */
 #wphead-info {
        margin: 0 0 0 15px;
 /* Admin Header */
 #wphead-info {
        margin: 0 0 0 15px;
@@ -792,8 +889,29 @@ div.comment-item:hover .row-actions {
        padding: 12px 10px 5px;
 }
 
        padding: 12px 10px 5px;
 }
 
-#wphead h1 span {
+#wphead #site-visit-button {
+       background-repeat:repeat-x;
+       background-position:0 0;
+       -moz-border-radius:3px;
+       -webkit-border-radius:3px;
+       -khtml-border-radius:3px;
+       border-radius:3px;
+       cursor:pointer; /* to keep IE happy */
+       display:-moz-inline-stack; /* to keep FF2 happy */
+       display:inline-block;
        font-size: 50%;
        font-size: 50%;
+       font-style:normal;
+       line-height:17px;
+       margin-left:5px;
+       padding:0 6px;
+       vertical-align:middle;
+}
+
+#wphead h1 a:hover {
+       text-decoration:none;
+}
+#wphead h1 a:hover #site-title {
+       text-decoration:underline;
 }
 
 /* side admin menu */
 }
 
 /* side admin menu */
@@ -846,7 +964,8 @@ div.comment-item:hover .row-actions {
        display: none;
 }
 
        display: none;
 }
 
-#adminmenu li.wp-menu-open .wp-submenu {
+#adminmenu li.wp-menu-open .wp-submenu,
+.no-js #adminmenu .open-if-no-js .wp-submenu {
        display: block;
 }
 
        display: block;
 }
 
@@ -967,10 +1086,15 @@ div.comment-item:hover .row-actions {
        height: 21px;
        padding: 0;
        margin: 0;
        height: 21px;
        padding: 0;
        margin: 0;
+}
+
+#adminmenu a.separator {
        cursor: w-resize;
        cursor: w-resize;
+       height: 20px;
+       padding: 0;
 }
 
 }
 
-.folded #adminmenu li.wp-menu-separator {
+.folded #adminmenu a.separator {
        cursor: e-resize;
 }
 
        cursor: e-resize;
 }
 
@@ -1031,6 +1155,15 @@ div.comment-item:hover .row-actions {
        border-bottom-width: 1px;
        border-bottom-style: solid;
 }
        border-bottom-width: 1px;
        border-bottom-style: solid;
 }
+
+#adminmenu .wp-menu-image a {
+       height: 24px;
+}
+
+#adminmenu .wp-menu-image img {
+       padding: 6px 0 0 1px;
+}
+
 /* end side admin menu */
 
 /* comments/plugins bubble in menu */
 /* end side admin menu */
 
 /* comments/plugins bubble in menu */
@@ -1084,7 +1217,7 @@ div.comment-item:hover .row-actions {
 
 .post-com-count span {
        font-size: 9px;
 
 .post-com-count span {
        font-size: 9px;
-       font-weight: bild;
+       font-weight: bold;
        height: 1.7em;
        line-height: 1.70em;
        min-width: 0.7em;
        height: 1.7em;
        line-height: 1.70em;
        min-width: 0.7em;
@@ -1112,7 +1245,11 @@ strong .post-com-count {
 }
 
 .response-links {
 }
 
 .response-links {
-       margin: 4px 0;
+       float: left;
+}
+
+#the-comment-list .attachment-80x60 {
+       padding: 4px 8px;
 }
 
 /* Admin Footer */
 }
 
 /* Admin Footer */
@@ -1200,12 +1337,12 @@ strong .post-com-count {
 .form-table table.color-palette {
        vertical-align: bottom;
        float: left;
 .form-table table.color-palette {
        vertical-align: bottom;
        float: left;
-       margin: -8px 3px 8px;
+       margin: -12px 3px 11px;
 }
 
 .form-table .color-palette td {
        border-width: 1px 1px 0;
 }
 
 .form-table .color-palette td {
        border-width: 1px 1px 0;
-       border-stile: solid solid none;
+       border-style: solid solid none;
        height: 10px;
        line-height: 20px;
        width: 10px;
        height: 10px;
        line-height: 20px;
        width: 10px;
@@ -1215,8 +1352,9 @@ textarea.large-text {
        width: 99%;
 }
 
        width: 99%;
 }
 
-.form-table input.regular-text {
-       width: 325px;
+.form-table input.regular-text,
+#adduser .form-field input {
+       width: 25em;
 }
 
 .form-table input.small-text {
 }
 
 .form-table input.small-text {
@@ -1228,10 +1366,6 @@ textarea.large-text {
        margin-bottom: 6px;
 }
 
        margin-bottom: 6px;
 }
 
-#profile-page .form-table input[type=text] {
-       width: 300px;
-}
-
 #profile-page .form-table #rich_editing {
        margin-right: 5px
 }
 #profile-page .form-table #rich_editing {
        margin-right: 5px
 }
@@ -1279,11 +1413,16 @@ table.form-table td .updated {
        width: 95%;
 }
 
        width: 95%;
 }
 
+p.description,
 .form-wrap p {
        margin: 2px 0 5px;
 }
 
 .form-wrap p {
        margin: 2px 0 5px;
 }
 
-.setting-description, .form-wrap p {
+p.help,
+p.description,
+span.description,
+.form-wrap p {
+       font-size: 12px;
        font-style: italic;
        font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
        font-style: italic;
        font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
@@ -1305,6 +1444,7 @@ table.form-table td .updated {
 .tagcloud {
        width: 97%;
        margin: 0 0 40px;
 .tagcloud {
        width: 97%;
        margin: 0 0 40px;
+       text-align: justify;
 }
 
 .tagcloud h3 {
 }
 
 .tagcloud h3 {
@@ -1312,10 +1452,14 @@ table.form-table td .updated {
 }
 
 /* Post Screen */
 }
 
 /* Post Screen */
-#normal-sortables {
+#post-body #normal-sortables {
        min-height: 50px;
 }
 
        min-height: 50px;
 }
 
+#post-body #advanced-sortables {
+       min-height: 20px;
+}
+
 .postbox {
        position: relative;
        min-width: 255px;
 .postbox {
        position: relative;
        min-width: 255px;
@@ -1340,10 +1484,6 @@ table.form-table td .updated {
        padding: 3px 7px;
 }
 
        padding: 3px 7px;
 }
 
-#side-sortables {
-       min-height: 300px;
-}
-
 #side-sortables .submitbox .submit input,
 #side-sortables .submitbox .submit .preview,
 #side-sortables .submitbox .submit a.preview:hover {
 #side-sortables .submitbox .submit input,
 #side-sortables .submitbox .submit .preview,
 #side-sortables .submitbox .submit a.preview:hover {
@@ -1356,29 +1496,39 @@ table.form-table td .updated {
 }
 
 #side-sortables .comments-box,
 }
 
 #side-sortables .comments-box,
-#side-sortables #show-comments {
-       display: none;
+#normal-sortables .comments-box {
+       border: 0 none;
+}
+
+#side-sortables .comments-box thead th,
+#normal-sortables .comments-box thead th {
+       background: transparent;
+       padding: 0 7px 4px;
+       font-style: italic;
+}
+
+#commentsdiv img.waiting {
+       padding-left: 5px;
+       vertical-align: middle;
 }
 
 }
 
-#post-body #tagsdiv #newtag {
+#post-body .tagsdiv #newtag {
        margin-right: 5px;
        width: 16em;
 }
 
        margin-right: 5px;
        width: 16em;
 }
 
-#side-info-column input#post_password {
+#side-sortables input#post_password {
        width: 94%
 }
 
        width: 94%
 }
 
-#side-info-column #tagsdiv #newtag {
+#side-sortables .tagsdiv #newtag {
        width: 68%;
 }
 
 #post-status-info {
        width: 68%;
 }
 
 #post-status-info {
-       font-size: 12px;
-       line-height: 2;
-       padding: 0 15px 0 7px;
        border-width: 0 1px 1px;
        border-style: none solid solid;
        border-width: 0 1px 1px;
        border-style: none solid solid;
+       width: 100%;
        -moz-border-radius: 0 0 6px 6px;
        -webkit-border-bottom-left-radius: 6px;
        -webkit-border-bottom-right-radius: 6px;
        -moz-border-radius: 0 0 6px 6px;
        -webkit-border-bottom-left-radius: 6px;
        -webkit-border-bottom-right-radius: 6px;
@@ -1388,21 +1538,27 @@ table.form-table td .updated {
        border-bottom-right-radius: 6px;
 }
 
        border-bottom-right-radius: 6px;
 }
 
+#post-status-info td {
+       font-size: 11px;
+}
+
+.autosave-info {
+       padding: 2px 15px 2px 2px;
+       text-align: right;
+}
+
 #editorcontent #post-status-info {
        border: none;
 }
 
 #editorcontent #post-status-info {
        border: none;
 }
 
-#post-body-content .wp_themeSkin .mceStatusbar a.mceResize {
+#post-body .wp_themeSkin .mceStatusbar a.mceResize {
        display: block;
        display: block;
-       float: right;
        background: transparent url(images/resize.gif) no-repeat scroll right bottom;
        width: 12px;
        background: transparent url(images/resize.gif) no-repeat scroll right bottom;
        width: 12px;
-       height: 12px;
        cursor: se-resize;
        margin: 0 2px;
        position: relative;
        cursor: se-resize;
        margin: 0 2px;
        position: relative;
-       right: 0;
-       top: 31px;
+       top: 22px;
 }
 
 
 }
 
 
@@ -1426,18 +1582,18 @@ table.form-table td .updated {
        padding: 5px 0;
 }
 
        padding: 5px 0;
 }
 
-#tagchecklist {
+.tagchecklist {
        margin-left: 10px;
        font-size: 12px;
        overflow: auto;
 }
 
        margin-left: 10px;
        font-size: 12px;
        overflow: auto;
 }
 
-#tagchecklist strong {
+.tagchecklist strong {
        margin-left: -8px;
        position: absolute;
 }
 
        margin-left: -8px;
        position: absolute;
 }
 
-#tagchecklist span {
+.tagchecklist span {
        margin-right: 25px;
        display: block;
        float: left;
        margin-right: 25px;
        display: block;
        float: left;
@@ -1447,7 +1603,7 @@ table.form-table td .updated {
        cursor: default;
 }
 
        cursor: default;
 }
 
-#tagchecklist span a {
+.tagchecklist span a {
        margin: 6px 0pt 0pt -9px;
        cursor: pointer;
        width: 10px;
        margin: 6px 0pt 0pt -9px;
        cursor: pointer;
        width: 10px;
@@ -1498,19 +1654,20 @@ table.form-table td .updated {
        clear: left;
 }
 
        clear: left;
 }
 
-.ui-sortable .postbox h3 {
-       cursor: pointer;
+.widget .widget-top,
+.postbox h3 {
+       cursor: move;
        -webkit-user-select: none;
        -moz-user-select: none;
        -khtml-user-select: none;
        user-select: none;
 }
 
        -webkit-user-select: none;
        -moz-user-select: none;
        -khtml-user-select: none;
        user-select: none;
 }
 
-.ui-sortable .postbox .hndle span {
+.postbox .hndle span {
        padding: 6px 0;
 }
 
        padding: 6px 0;
 }
 
-.ui-sortable .postbox .hndle {
+.postbox .hndle {
        cursor: move;
 }
 
        cursor: move;
 }
 
@@ -1519,7 +1676,11 @@ table.form-table td .updated {
        font-weight: normal;
 }
 
        font-weight: normal;
 }
 
-.meta-box-sortables .postbox .handlediv {
+#dashboard-widgets .meta-box-sortables {
+       margin: 0 5px;
+}
+
+.postbox .handlediv {
        float: right;
        width: 23px;
        height: 26px;
        float: right;
        width: 23px;
        height: 26px;
@@ -1528,7 +1689,7 @@ table.form-table td .updated {
 .sortable-placeholder {
        border-width: 1px;
        border-style: dashed;
 .sortable-placeholder {
        border-width: 1px;
        border-style: dashed;
-       z-index: -1;
+       margin-bottom: 20px;
 }
 
 #poststuff h3,
 }
 
 #poststuff h3,
@@ -1540,9 +1701,9 @@ table.form-table td .updated {
        line-height: 1;
 }
 
        line-height: 1;
 }
 
-.metabox-holder .postbox,
-#poststuff .postbox,
-#poststuff .stuffbox {
+.widget,
+.postbox,
+.stuffbox {
        margin-bottom: 20px;
        border-width: 1px;
        border-style: solid;
        margin-bottom: 20px;
        border-width: 1px;
        border-style: solid;
@@ -1553,9 +1714,10 @@ table.form-table td .updated {
        border-radius: 6px;
 }
 
        border-radius: 6px;
 }
 
-.metabox-holder .postbox h3,
-#poststuff .postbox h3,
-#poststuff .stuffbox h3 {
+.widget .widget-top,
+.postbox h3,
+.postbox h3,
+.stuffbox h3 {
        -moz-border-radius: 6px 6px 0 0;
        -webkit-border-top-right-radius: 6px;
        -webkit-border-top-left-radius: 6px;
        -moz-border-radius: 6px 6px 0 0;
        -webkit-border-top-right-radius: 6px;
        -webkit-border-top-left-radius: 6px;
@@ -1565,6 +1727,17 @@ table.form-table td .updated {
        border-top-left-radius: 6px;
 }
 
        border-top-left-radius: 6px;
 }
 
+.postbox.closed h3 {
+       -moz-border-radius-bottomleft:4px;
+       -webkit-border-bottom-left-radius: 4px;
+       -khtml-border-bottom-left-radius: 4px;
+       border-bottom-left-radius: 4px;
+       -moz-border-radius-bottomright:4px;
+       -webkit-border-bottom-right-radius: 4px;
+       -khtml-border-bottom-right-radius: 4px;
+       border-bottom-right-radius: 4px;
+}
+
 .postbox table.form-table {
        margin-bottom: 0;
 }
 .postbox table.form-table {
        margin-bottom: 0;
 }
@@ -1629,7 +1802,7 @@ table.form-table td .updated {
 }
 
 #poststuff .inside-submitbox,
 }
 
 #poststuff .inside-submitbox,
-#side-info-column .inside-submitbox {
+#side-sortables .inside-submitbox {
        margin: 0 3px;
        font-size: 11px;
 }
        margin: 0 3px;
        font-size: 11px;
 }
@@ -1677,16 +1850,12 @@ input#link_url {
 }
 
 .wp_themeSkin tr.mceFirst td.mceToolbar {
 }
 
 .wp_themeSkin tr.mceFirst td.mceToolbar {
-       background-image: url("images/ed-bg.gif");
-       background-position: left top;
-       background-repeat: repeat-x;
        border-width: 0 0 1px;
        border-style: none none solid;
 }
 
        border-width: 0 0 1px;
        border-style: none none solid;
 }
 
-#poststuff #edButtonPreview,
-#poststuff #edButtonHTML {
-       display: block;
+#edButtonPreview,
+#edButtonHTML {
        height: 18px;
        margin: 5px 5px 0 0;
        padding: 4px 5px 2px;
        height: 18px;
        margin: 5px 5px 0 0;
        padding: 4px 5px 2px;
@@ -1703,6 +1872,10 @@ input#link_url {
        border-top-left-radius: 3px;
 }
 
        border-top-left-radius: 3px;
 }
 
+.js .theEditor {
+       color: white;
+}
+
 #poststuff #edButtonHTML {
        margin-right: 15px;
 }
 #poststuff #edButtonHTML {
        margin-right: 15px;
 }
@@ -1765,7 +1938,7 @@ input#link_url {
        margin: 0 0 8px;
 }
 
        margin: 0 0 8px;
 }
 
-#side-info-column #category-adder {
+#side-sortables #category-adder {
        margin: 0;
 }
 
        margin: 0;
 }
 
@@ -1773,11 +1946,11 @@ input#link_url {
        width: 30%;
 }
 
        width: 30%;
 }
 
-#side-info-column #category-add input {
+#side-sortables #category-add input {
        width: 94%;
 }
 
        width: 94%;
 }
 
-#side-info-column #category-add select {
+#side-sortables #category-add select {
        width: 100%;
 }
 
        width: 100%;
 }
 
@@ -1790,7 +1963,7 @@ input#link_url {
        width: 120px;
        text-align: right;
        /* Negative margin for the sake of those without JS: all tabs display */
        width: 120px;
        text-align: right;
        /* Negative margin for the sake of those without JS: all tabs display */
-       margin: 0 -120px 0 0;
+       margin: 0 -120px 0 5px;
        padding: 0;
 }
 
        padding: 0;
 }
 
@@ -1798,7 +1971,7 @@ input#link_url {
        padding: 8px;
 }
 
        padding: 8px;
 }
 
-#post-body ul#category-tabs li.ui-tabs-selected {
+#post-body ul#category-tabs li.tabs {
        -moz-border-radius: 3px 0 0 3px;
        -webkit-border-top-left-radius: 3px;
        -webkit-border-bottom-left-radius: 3px;
        -moz-border-radius: 3px 0 0 3px;
        -webkit-border-top-left-radius: 3px;
        -webkit-border-bottom-left-radius: 3px;
@@ -1808,37 +1981,35 @@ input#link_url {
        border-bottom-left-radius: 3px;
 }
 
        border-bottom-left-radius: 3px;
 }
 
-#post-body ul#category-tabs li.ui-tabs-selected a {
+#post-body ul#category-tabs li.tabs a {
        font-weight: bold;
        text-decoration: none;
 }
 
        font-weight: bold;
        text-decoration: none;
 }
 
-#categorydiv div.ui-tabs-panel,
-#linkcategorydiv div.ui-tabs-panel {
+#categorydiv div.tabs-panel,
+#linkcategorydiv div.tabs-panel {
        height: 150px;
        overflow: auto;
        padding: 0.5em 0.9em;
        height: 150px;
        overflow: auto;
        padding: 0.5em 0.9em;
+       border-style: solid;
+       border-width: 1px;
 }
 
 }
 
-#post-body #categorydiv div.ui-tabs-panel,
-#post-body #linkcategorydiv div.ui-tabs-panel {
-       margin: 0 5px 0 120px;
-       height: 10em;
-       overflow: auto;
-       border-width: 4px;
-       border-style: solid;
+#post-body #categorydiv div.tabs-panel,
+#post-body #linkcategorydiv div.tabs-panel {
+       margin: 0 5px 0 125px;
 }
 
 }
 
-#side-info-column #category-tabs li {
+#side-sortables #category-tabs li {
        display: inline;
        padding-right: 8px;
 }
 
        display: inline;
        padding-right: 8px;
 }
 
-#side-info-column #category-tabs a {
+#side-sortables #category-tabs a {
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
-#side-info-column #category-tabs {
+#side-sortables #category-tabs {
        margin-bottom: 3px;
 }
 
        margin-bottom: 3px;
 }
 
@@ -1865,7 +2036,7 @@ ul.categorychecklist li {
        margin-bottom: 0px;
 }
 
        margin-bottom: 0px;
 }
 
-#categorydiv .ui-tabs-panel {
+#categorydiv .tabs-panel {
        border-width: 3px;
        border-style: solid; 
 }
        border-width: 3px;
        border-style: solid; 
 }
@@ -1874,6 +2045,17 @@ ul#category-tabs {
        margin-top: 12px;
 }
 
        margin-top: 12px;
 }
 
+ul#category-tabs li.tabs {
+       border-style: solid solid none;
+       border-width: 1px 1px 0;
+}
+
+#post-body #category-tabs li.tabs {
+       border-style: solid none solid solid;
+       border-width: 1px 0 1px 1px;
+       margin-right: -1px;
+}
+
 ul#category-tabs li {
        padding: 5px 8px;
        -moz-border-radius: 3px 3px 0 0;
 ul#category-tabs li {
        padding: 5px 8px;
        -moz-border-radius: 3px 3px 0 0;
@@ -1896,10 +2078,8 @@ p.search-box {
        margin: -5px 0 0;
 }
 
        margin: -5px 0 0;
 }
 
-.search-input {
-       border-width: 1px;
-       border-style: solid;
-       padding: 2px;
+.screen-per-page {
+       width: 3em;
 }
 
 #posts-filter fieldset {
 }
 
 #posts-filter fieldset {
@@ -1920,19 +2100,24 @@ p.search-box {
 
 /* Edit posts */
 
 
 /* Edit posts */
 
-td.post-title strong {
+td.post-title strong, td.plugin-title strong {
        display: block;
        margin-bottom: .2em;
 }
 
        display: block;
        margin-bottom: .2em;
 }
 
-td.post-title p {
+td.post-title p, td.plugin-title p {
        margin: 6px 0;
 }
 
        margin: 6px 0;
 }
 
+td.plugin-title {
+       white-space: nowrap;
+}
+
 /* Global classes */
 
 .wp-hidden-children .wp-hidden-child,
 /* Global classes */
 
 .wp-hidden-children .wp-hidden-child,
-.ui-tabs-hide {
+.ui-tabs-hide,
+#codepress-off {
        display: none;
 }
 
        display: none;
 }
 
@@ -1998,11 +2183,20 @@ body.wp-admin {
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
+.indicator-hint {
+       padding-top: 8px;
+}
+
+#display_name {
+       width: 15em;
+}
+
 .tablenav .delete {
        margin-right: 20px;
 }
 
 .tablenav .delete {
        margin-right: 20px;
 }
 
-td.action-links, th.action-links {
+td.action-links,
+th.action-links {
        text-align: right;
 }
 
        text-align: right;
 }
 
@@ -2032,6 +2226,7 @@ table.diff .diff-deletedline del, table.diff .diff-addedline ins {
 
 #wp-word-count {
        display: block;
 
 #wp-word-count {
        display: block;
+       padding: 2px 7px;
 }
 
 fieldset {
 }
 
 fieldset {
@@ -2293,7 +2488,7 @@ fieldset {
        margin: 0 9px 0 0;
 }
 
        margin: 0 9px 0 0;
 }
 
-#screen-meta .invisible {
+#screen-meta .screen-reader-text {
        visibility: hidden;
 }
 
        visibility: hidden;
 }
 
@@ -2444,6 +2639,12 @@ tr.inline-edit-row td {
        margin: 0.5em 0 0;
 }
 
        margin: 0.5em 0 0;
 }
 
+.inline-edit-row span.error {
+       line-height: 22px;
+       margin: 0 15px;
+       padding: 3px 5px;
+}
+
 /*     Positioning */
 .inline-edit-row h4 {
        margin: .2em 0;
 /*     Positioning */
 .inline-edit-row h4 {
        margin: .2em 0;
@@ -2547,13 +2748,18 @@ tr.inline-edit-row td {
        width: 8em;
 }
 
        width: 8em;
 }
 
+.inline-edit-row .catshow,
+.inline-edit-row .cathide {
+       cursor: pointer;
+}
+
 ul.cat-checklist {
        height: 12em;
        border-style: solid;
        border-width: 1px;
        overflow-y: scroll;
        padding: 0 5px;
 ul.cat-checklist {
        height: 12em;
        border-style: solid;
        border-width: 1px;
        overflow-y: scroll;
        padding: 0 5px;
-       margin: 0 0 5px;
+       margin: 0;
 }
 
 #bulk-titles {
 }
 
 #bulk-titles {
@@ -2635,7 +2841,7 @@ table .inline-edit-row fieldset ul.cat-hover {
 }
 
 #wpbody-content .filename {
 }
 
 #wpbody-content .filename {
-       margin-left: 10px;
+       padding: 0 10px;
 }
 
 #wpbody-content .media-item .thumbnail {
 }
 
 #wpbody-content .media-item .thumbnail {
@@ -2661,7 +2867,7 @@ abbr.required {
 
 #wpbody-content .describe p.help {
        margin: 0;
 
 #wpbody-content .describe p.help {
        margin: 0;
-       padding: 0;
+       padding: 0 0 0 5px;
 }
 
 .describe-toggle-on, .describe-toggle-off {
 }
 
 .describe-toggle-on, .describe-toggle-off {
@@ -2690,10 +2896,7 @@ abbr.required {
 }
 
 #wpbody-content #media-items .filename {
 }
 
 #wpbody-content #media-items .filename {
-       float: left;
        line-height: 36px;
        line-height: 36px;
-       margin-left: 10px;
-       max-width: 430px;
        overflow: hidden;
 }
 
        overflow: hidden;
 }
 
@@ -2705,17 +2908,67 @@ abbr.required {
        max-height: 40px;
 }
 
        max-height: 40px;
 }
 
-.media-item  .startopen,
+.media-item .startopen,
 .media-item .startclosed {
        display: none;
 }
 
 .media-item .startclosed {
        display: none;
 }
 
+.media-item .original {
+       position: relative;
+       height: 34px;
+       text-align: center;
+}
+
+.media-item .percent {
+       font-weight: bold;
+}
+
+.crunching {
+       display: block;
+       line-height: 32px;
+       text-align: right;
+       margin-right: 5px;
+}
+
+button.dismiss {
+       position: absolute;
+       top: 7px;
+       right: 5px;
+       z-index: 4;
+       width: 8em;
+}
+
+.file-error {
+       float: left;
+       font-weight: bold;
+       padding: 10px;
+}
+
+.progress {
+       position: relative;
+       margin-bottom: -36px;
+       height: 36px;
+}
+
+.bar {
+       width: 0;
+       height: 100%;
+       border-right-width: 3px;
+       border-right-style: solid;
+}
+
+#media-items a.delete,
+#media-items a.del-link {
+       padding: 1px 4px 2px;
+}
+
+
 /* find posts */
 .find-box {
 /* find posts */
 .find-box {
-       width: 400px;
-       height: 250px;
+       width: 500px;
+       height: 300px;
        overflow: hidden;
        overflow: hidden;
-       padding: 33px 5px 50px;
+       padding: 33px 5px 40px;
        position: absolute;
        z-index: 1000;
 }
        position: absolute;
        z-index: 1000;
 }
@@ -2753,20 +3006,25 @@ abbr.required {
 }
 
 #find-posts-response .found-radio {
 }
 
 #find-posts-response .found-radio {
-       padding: 8px 0 0 8px;
+       padding: 5px 0 0 8px;
        width: 15px;
 }
 
 .find-box-buttons {
        width: 15px;
 }
 
 .find-box-buttons {
-       bottom: 12px;
-       left: 12px;
-       position: absolute;
+       width: 480px;
+       margin: 8px;
 }
 
 .find-box-search label {
        padding-right: 6px;
 }
 
 }
 
 .find-box-search label {
        padding-right: 6px;
 }
 
+.find-box #resize-se {
+       position: absolute;
+       right: 1px;
+       bottom: 1px;
+}
+
 /* favorite-actions */
 #favorite-actions {
        float: right;
 /* favorite-actions */
 #favorite-actions {
        float: right;
@@ -2822,9 +3080,6 @@ abbr.required {
 }
 
 #favorite-actions .slide-down {
 }
 
 #favorite-actions .slide-down {
-       background-image: url(images/fav-top.png);
-       background-repeat: repeat-x;
-       background-position: 0 top;
        -moz-border-radius: 12px 12px 0 0;
        -webkit-border-bottom-right-radius: 0;
        -webkit-border-bottom-left-radius: 0;
        -moz-border-radius: 12px 12px 0 0;
        -webkit-border-bottom-right-radius: 0;
        -webkit-border-bottom-left-radius: 0;
@@ -2849,8 +3104,14 @@ form.upgrade {
        margin-top: 8px;
 }
 
        margin-top: 8px;
 }
 
-#tagsdiv #the-tagcloud {
-       margin: 5px 5px 10px;
+form.upgrade .hint {
+       font-style: italic;
+       font-size: 85%;
+       margin: -0.5em 0 2em 0;
+}
+
+#poststuff .inside .the-tagcloud {
+       margin: 5px 0 10px;
        padding: 8px;
        border-width: 1px;
        border-style: solid;
        padding: 8px;
        border-width: 1px;
        border-style: solid;
@@ -2877,9 +3138,13 @@ table.fixed {
        table-layout: fixed;
 }
 
        table-layout: fixed;
 }
 
+.fixed .column-rating,
+.fixed .column-visible {
+       width: 8%;
+}
+
 .fixed .column-date,
 .fixed .column-parent,
 .fixed .column-date,
 .fixed .column-parent,
-.fixed .column-visible,
 .fixed .column-links {
        width: 10%;
 }
 .fixed .column-links {
        width: 10%;
 }
@@ -2895,6 +3160,7 @@ table.fixed {
 
 .fixed .column-comments {
        width: 4em;
 
 .fixed .column-comments {
        width: 4em;
+       padding-top: 8px;
 }
 
 .fixed .column-slug {
 }
 
 .fixed .column-slug {
@@ -2920,8 +3186,10 @@ table.fixed {
        overflow: hidden;
 }
 
        overflow: hidden;
 }
 
-.widefat th {
-       text-shadow: rgba(255,255,255,0.8) 0 1px 0;
+table .vers,
+table .column-visible,
+table .column-rating {
+       text-align: center;
 }
 
 .icon32 {
 }
 
 .icon32 {
@@ -2940,3 +3208,92 @@ table.fixed {
        line-height: 1;
        padding-left: 25px;
 }
        line-height: 1;
        padding-left: 25px;
 }
+
+ol {
+       list-style-type: decimal;
+       margin-left: 2em;
+}
+
+.postbox-container {
+       float: left;
+       padding-right: 0.5%;
+}
+
+.postbox-container .meta-box-sortables {
+       min-height: 300px;
+}
+
+.temp-border {
+       border: 1px dotted #ccc;
+}
+
+.columns-prefs label {
+       padding: 0 5px;
+}
+
+.theme-install-php h4,
+.plugin-install-php h4 {
+       margin: 2.5em 0 8px;
+}
+
+p.install-help {
+       margin: 8px 0;
+       font-style: italic;
+}
+
+p.popular-tags {
+       -moz-border-radius: 8px;
+       -khtml-border-radius: 8px;
+       -webkit-border-radius: 8px;
+       border-radius: 8px;
+       border-width: 1px;
+       border-style: solid;
+       line-height: 2em;
+       padding: 8px 12px 12px;
+       text-align: justify;
+}
+
+p.popular-tags a {
+       padding: 0 3px;
+}
+
+.stuffbox .editcomment {
+       clear: none;
+}
+
+.ajax-feedback {
+       visibility: hidden;
+       vertical-align: bottom;
+}
+
+.tagsdiv .newtag {
+       width: 180px;
+}
+
+.tagsdiv .the-tags {
+       display: block;
+       height: 60px;
+       margin: 0 auto;
+       overflow: auto;
+       width: 260px;
+}
+
+#post-body-content .tagsdiv .the-tags {
+       margin: 0 5px;
+}
+
+label,
+#your-profile label + a {
+       vertical-align: middle;
+}
+
+.plugin-update-tr .update-message {
+       margin: 5px;
+       padding: 3px 5px;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 5px;
+       -khtml-border-radius: 5px;
+       -webkit-border-radius: 5px;
+       border-radius: 5px;
+}
index 15d924abb08fcb9331a070ba8695c807df998564..0ada250e3aa73de4d81e303ea007474035aa811e 100644 (file)
@@ -26,6 +26,9 @@ require_once(ABSPATH . WPINC . '/atomlib.php');
 /** Feed Handling API */
 require_once(ABSPATH . WPINC . '/feed.php');
 
 /** Feed Handling API */
 require_once(ABSPATH . WPINC . '/feed.php');
 
+/** Admin Image API for metadata updating */
+require_once(ABSPATH . '/wp-admin/includes/image.php');
+
 $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
 
 /**
 $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
 
 /**
@@ -349,9 +352,9 @@ class AtomServer {
                if( !current_user_can( 'edit_posts' ) )
                        $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
 
                if( !current_user_can( 'edit_posts' ) )
                        $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
 
-               $entries_url = attribute_escape($this->get_entries_url());
-               $categories_url = attribute_escape($this->get_categories_url());
-               $media_url = attribute_escape($this->get_attachments_url());
+               $entries_url = esc_attr($this->get_entries_url());
+               $categories_url = esc_attr($this->get_categories_url());
+               $media_url = esc_attr($this->get_attachments_url());
                foreach ($this->media_content_types as $med) {
                        $accepted_media_types = $accepted_media_types . "<accept>" . $med . "</accept>";
                }
                foreach ($this->media_content_types as $med) {
                        $accepted_media_types = $accepted_media_types . "<accept>" . $med . "</accept>";
                }
@@ -389,12 +392,12 @@ EOD;
                if( !current_user_can( 'edit_posts' ) )
                        $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
 
                if( !current_user_can( 'edit_posts' ) )
                        $this->auth_required( __( 'Sorry, you do not have the right to access this blog.' ) );
 
-               $home = attribute_escape(get_bloginfo_rss('home'));
+               $home = esc_attr(get_bloginfo_rss('home'));
 
                $categories = "";
                $cats = get_categories("hierarchical=0&hide_empty=0");
                foreach ((array) $cats as $cat) {
 
                $categories = "";
                $cats = get_categories("hierarchical=0&hide_empty=0");
                foreach ((array) $cats as $cat) {
-                       $categories .= "    <category term=\"" . attribute_escape($cat->name) .  "\" />\n";
+                       $categories .= "    <category term=\"" . esc_attr($cat->name) .  "\" />\n";
 }
                $output = <<<EOD
 <app:categories xmlns:app="$this->ATOMPUB_NS"
 }
                $output = <<<EOD
 <app:categories xmlns:app="$this->ATOMPUB_NS"
@@ -475,6 +478,8 @@ EOD;
                // this could affect our ability to send back the right headers
                @wp_set_post_categories($postID, $post_category);
 
                // this could affect our ability to send back the right headers
                @wp_set_post_categories($postID, $post_category);
 
+               do_action( 'atompub_create_post', $postID, $entry );
+
                $output = $this->get_entry($postID);
 
                log_app('function',"create_post($postID)");
                $output = $this->get_entry($postID);
 
                log_app('function',"create_post($postID)");
@@ -553,6 +558,8 @@ EOD;
                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
                }
 
                        $this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
                }
 
+               do_action( 'atompub_put_post', $ID, $parsed );
+
                log_app('function',"put_post($postID)");
                $this->ok();
        }
                log_app('function',"put_post($postID)");
                $this->ok();
        }
@@ -698,7 +705,7 @@ EOD;
                extract($entry);
 
                $post_title = $parsed->title[1];
                extract($entry);
 
                $post_title = $parsed->title[1];
-               $post_content = $parsed->content[1];
+               $post_content = $parsed->summary[1];
                $pubtimes = $this->get_publish_time($parsed->updated);
                $post_modified = $pubtimes[0];
                $post_modified_gmt = $pubtimes[1];
                $pubtimes = $this->get_publish_time($parsed->updated);
                $post_modified = $pubtimes[0];
                $post_modified_gmt = $pubtimes[1];
@@ -814,9 +821,12 @@ EOD;
                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
                }
 
                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
                }
 
+               $upload_dir = wp_upload_dir( );
                $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
                $filetype = wp_check_filetype($location);
 
                $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
                $filetype = wp_check_filetype($location);
 
+               $location = "{$upload_dir['basedir']}/{$location}";
+
                if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
                        $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
 
                if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
                        $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
 
@@ -843,6 +853,8 @@ EOD;
                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.'));
                }
 
                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.'));
                }
 
+               wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
+
                log_app('function',"put_file($postID)");
                $this->ok();
        }
                log_app('function',"put_file($postID)");
                $this->ok();
        }
@@ -1067,6 +1079,8 @@ EOD;
                log_app('function',"get_feed($page, '$post_type')");
                ob_start();
 
                log_app('function',"get_feed($page, '$post_type')");
                ob_start();
 
+               $this->ENTRY_PATH = $post_type;
+
                if(!isset($page)) {
                        $page = 1;
                }
                if(!isset($page)) {
                        $page = 1;
                }
@@ -1074,7 +1088,7 @@ EOD;
 
                $count = get_option('posts_per_rss');
 
 
                $count = get_option('posts_per_rss');
 
-               wp('what_to_show=posts&posts_per_page=' . $count . '&offset=' . ($count * ($page-1) . '&orderby=modified'));
+               wp('posts_per_page=' . $count . '&offset=' . ($count * ($page-1) . '&orderby=modified'));
 
                $post = $GLOBALS['post'];
                $posts = $GLOBALS['posts'];
 
                $post = $GLOBALS['post'];
                $posts = $GLOBALS['posts'];
@@ -1092,7 +1106,7 @@ EOD;
                $self_page = $page > 1 ? $page : NULL;
 ?><feed xmlns="<?php echo $this->ATOM_NS ?>" xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
 <id><?php $this->the_entries_url() ?></id>
                $self_page = $page > 1 ? $page : NULL;
 ?><feed xmlns="<?php echo $this->ATOM_NS ?>" xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
 <id><?php $this->the_entries_url() ?></id>
-<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
+<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
 <title type="text"><?php bloginfo_rss('name') ?></title>
 <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
 <link rel="first" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url() ?>" />
 <title type="text"><?php bloginfo_rss('name') ?></title>
 <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
 <link rel="first" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url() ?>" />
@@ -1104,7 +1118,7 @@ EOD;
 <?php endif; ?>
 <link rel="last" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($last_page) ?>" />
 <link rel="self" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($self_page) ?>" />
 <?php endif; ?>
 <link rel="last" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($last_page) ?>" />
 <link rel="self" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($self_page) ?>" />
-<rights type="text">Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></rights>
+<rights type="text">Copyright <?php echo date('Y'); ?></rights>
 <?php the_generator( 'atom' ); ?>
 <?php if ( have_posts() ) {
                        while ( have_posts() ) {
 <?php the_generator( 'atom' ); ?>
 <?php if ( have_posts() ) {
                        while ( have_posts() ) {
@@ -1136,6 +1150,7 @@ EOD;
                                $varname = 'p';
                                break;
                        case 'attachment':
                                $varname = 'p';
                                break;
                        case 'attachment':
+                               $this->ENTRY_PATH = 'attachment';
                                $varname = 'attachment_id';
                                break;
                }
                                $varname = 'attachment_id';
                                break;
                }
@@ -1174,8 +1189,8 @@ EOD;
        </app:control>
        <author>
                <name><?php the_author()?></name>
        </app:control>
        <author>
                <name><?php the_author()?></name>
-<?php if (get_the_author_url() && get_the_author_url() != 'http://') { ?>
-               <uri><?php the_author_url()?></uri>
+<?php if ( get_the_author_meta('url') && get_the_author_meta('url') != 'http://' ) { ?>
+               <uri><?php the_author_meta('url') ?></uri>
 <?php } ?>
        </author>
 <?php if($GLOBALS['post']->post_type == 'attachment') { ?>
 <?php } ?>
        </author>
 <?php if($GLOBALS['post']->post_type == 'attachment') { ?>
@@ -1189,9 +1204,7 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
 <?php endif; ?>
 <?php } ?>
        <link rel="edit" href="<?php $this->the_entry_url() ?>" />
 <?php endif; ?>
 <?php } ?>
        <link rel="edit" href="<?php $this->the_entry_url() ?>" />
-<?php foreach(get_the_category() as $category) { ?>
-       <category scheme="<?php bloginfo_rss('home') ?>" term="<?php echo $category->name?>" />
-<?php } ?>
+       <?php the_category_rss( 'atom' ); ?>
 <?php list($content_type, $content) = prep_atom_text_construct(get_the_excerpt()); ?>
        <summary type="<?php echo $content_type ?>"><?php echo $content ?></summary>
 </entry>
 <?php list($content_type, $content) = prep_atom_text_construct(get_the_excerpt()); ?>
        <summary type="<?php echo $content_type ?>"><?php echo $content ?></summary>
 </entry>
@@ -1319,7 +1332,7 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
        function redirect($url) {
 
                log_app('Status','302: Redirect');
        function redirect($url) {
 
                log_app('Status','302: Redirect');
-               $escaped_url = attribute_escape($url);
+               $escaped_url = esc_attr($url);
                $content = <<<EOD
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <html>
                $content = <<<EOD
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <html>
@@ -1479,12 +1492,13 @@ EOD;
                // If Basic Auth is working...
                if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
                        log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
                // If Basic Auth is working...
                if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
                        log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
-                       $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
-                       if ( $user && !is_wp_error($user) ) {
-                               wp_set_current_user($user->ID);
-                               log_app("authenticate()", $_SERVER['PHP_AUTH_USER']);
-                               return true;
-                       }
+               }
+
+               $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
+               if ( $user && !is_wp_error($user) ) {
+                       wp_set_current_user($user->ID);
+                       log_app("authenticate()", $user->user_login);
+                       return true;
                }
 
                return false;
                }
 
                return false;
index 64cc8e3295661ffc2482f3c246af2540f16f7ebf..8289bb44147b307d86ffe7913c196c87f6541da9 100644 (file)
@@ -30,6 +30,8 @@ if ( empty($status->comment_status) ) {
 } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) {
        do_action('comment_on_draft', $comment_post_ID);
        exit;
 } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) {
        do_action('comment_on_draft', $comment_post_ID);
        exit;
+} else {
+       do_action('pre_comment_on_post', $comment_post_ID);
 }
 
 $comment_author       = ( isset($_POST['author']) )  ? trim(strip_tags($_POST['author'])) : null;
 }
 
 $comment_author       = ( isset($_POST['author']) )  ? trim(strip_tags($_POST['author'])) : null;
@@ -52,7 +54,7 @@ if ( $user->ID ) {
                }
        }
 } else {
                }
        }
 } else {
-       if ( get_option('comment_registration') )
+       if ( get_option('comment_registration') || 'private' == $status->post_status )
                wp_die( __('Sorry, you must be logged in to post a comment.') );
 }
 
                wp_die( __('Sorry, you must be logged in to post a comment.') );
 }
 
@@ -76,9 +78,10 @@ $comment_id = wp_new_comment( $commentdata );
 
 $comment = get_comment($comment_id);
 if ( !$user->ID ) {
 
 $comment = get_comment($comment_id);
 if ( !$user->ID ) {
-       setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
-       setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
-       setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
+       $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000);
+       setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
+       setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
+       setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
 }
 
 $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
 }
 
 $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
index c0013a38433652f7d4941a165dcecd7d360294d7..2e316c7776292710881136804eb394c70635d018 100644 (file)
@@ -38,6 +38,7 @@ define('DB_COLLATE', '');
  *\r
  * Change these to different unique phrases!\r
  * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}\r
  *\r
  * Change these to different unique phrases!\r
  * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}\r
+ * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.\r
  *\r
  * @since 2.6.0\r
  */\r
  *\r
  * @since 2.6.0\r
  */\r
@@ -73,4 +74,3 @@ if ( !defined('ABSPATH') )
 \r
 /** Sets up WordPress vars and included files. */\r
 require_once(ABSPATH . 'wp-settings.php');\r
 \r
 /** Sets up WordPress vars and included files. */\r
 require_once(ABSPATH . 'wp-settings.php');\r
-?>\r
index 20034734795715c418aa3745b9239e64e84d1c7d..d08343f28aecc37d9b55b78a120461913c6c397f 100644 (file)
@@ -3,7 +3,7 @@
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code>&lt;?php akismet_counter(); ?&gt;</code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code>&lt;?php akismet_counter(); ?&gt;</code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
-Version: 2.2.3
+Version: 2.2.4
 Author: Matt Mullenweg
 Author URI: http://ma.tt/
 */
 Author: Matt Mullenweg
 Author URI: http://ma.tt/
 */
@@ -176,7 +176,7 @@ addLoadEvent(resizeIframeInit);
 function akismet_stats_display() {
        global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
        $blog = urlencode( get_option('home') );
 function akismet_stats_display() {
        global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
        $blog = urlencode( get_option('home') );
-       $url = "http://".get_option('wordpress_api_key').".web.akismet.com/1.0/user-stats.php?blog={$blog}";
+       $url = "http://".akismet_get_key().".web.akismet.com/1.0/user-stats.php?blog={$blog}";
        ?>
        <div class="wrap">
        <iframe src="<?php echo $url; ?>" width="100%" height="100%" frameborder="0" id="akismet-stats-frame"></iframe>
        ?>
        <div class="wrap">
        <iframe src="<?php echo $url; ?>" width="100%" height="100%" frameborder="0" id="akismet-stats-frame"></iframe>
@@ -184,6 +184,13 @@ function akismet_stats_display() {
        <?php
 }
 
        <?php
 }
 
+function akismet_get_key() {
+       global $wpcom_api_key;
+       if ( !empty($wpcom_api_key) )
+               return $wpcom_api_key;
+       return get_option('wordpress_api_key');
+}
+
 function akismet_verify_key( $key ) {
        global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
        $blog = urlencode( get_option('home') );
 function akismet_verify_key( $key ) {
        global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
        $blog = urlencode( get_option('home') );
@@ -236,6 +243,9 @@ function akismet_auto_check_comment( $comment ) {
        $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
        $comment['referrer']   = $_SERVER['HTTP_REFERER'];
        $comment['blog']       = get_option('home');
        $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
        $comment['referrer']   = $_SERVER['HTTP_REFERER'];
        $comment['blog']       = get_option('home');
+       $comment['blog_lang']  = get_locale();
+       $comment['blog_charset'] = get_option('blog_charset');
+       $comment['permalink']  = get_permalink($comment['comment_post_ID']);
 
        $ignore = array( 'HTTP_COOKIE' );
 
 
        $ignore = array( 'HTTP_COOKIE' );
 
@@ -276,21 +286,31 @@ function akismet_delete_old() {
 }
 
 function akismet_submit_nonspam_comment ( $comment_id ) {
 }
 
 function akismet_submit_nonspam_comment ( $comment_id ) {
-       global $wpdb, $akismet_api_host, $akismet_api_port;
+       global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site;
        $comment_id = (int) $comment_id;
        $comment_id = (int) $comment_id;
-
+       
        $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");
        if ( !$comment ) // it was deleted
                return;
        $comment->blog = get_option('home');
        $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");
        if ( !$comment ) // it was deleted
                return;
        $comment->blog = get_option('home');
+       $comment->blog_lang = get_locale();
+       $comment->blog_charset = get_option('blog_charset');
+       $comment->permalink = get_permalink($comment->comment_post_ID);
+       if ( is_object($current_user) ) {
+           $comment->reporter = $current_user->user_login;
+       }
+       if ( is_object($current_site) ) {
+               $comment->site_domain = $current_site->domain;
+       }
        $query_string = '';
        foreach ( $comment as $key => $data )
                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
        $query_string = '';
        foreach ( $comment as $key => $data )
                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
+
        $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-ham", $akismet_api_port);
 }
 
 function akismet_submit_spam_comment ( $comment_id ) {
        $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-ham", $akismet_api_port);
 }
 
 function akismet_submit_spam_comment ( $comment_id ) {
-       global $wpdb, $akismet_api_host, $akismet_api_port;
+       global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site;
        $comment_id = (int) $comment_id;
 
        $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");
        $comment_id = (int) $comment_id;
 
        $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");
@@ -299,6 +319,15 @@ function akismet_submit_spam_comment ( $comment_id ) {
        if ( 'spam' != $comment->comment_approved )
                return;
        $comment->blog = get_option('home');
        if ( 'spam' != $comment->comment_approved )
                return;
        $comment->blog = get_option('home');
+       $comment->blog_lang = get_locale();
+       $comment->blog_charset = get_option('blog_charset');
+       $comment->permalink = get_permalink($comment->comment_post_ID);
+       if ( is_object($current_user) ) {
+           $comment->reporter = $current_user->user_login;
+       }
+       if ( is_object($current_site) ) {
+               $comment->site_domain = $current_site->domain;
+       }
        $query_string = '';
        foreach ( $comment as $key => $data )
                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
        $query_string = '';
        foreach ( $comment as $key => $data )
                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
@@ -787,6 +816,9 @@ function akismet_recheck_queue() {
                $c['user_agent'] = $c['comment_agent'];
                $c['referrer']   = '';
                $c['blog']       = get_option('home');
                $c['user_agent'] = $c['comment_agent'];
                $c['referrer']   = '';
                $c['blog']       = get_option('home');
+               $c['blog_lang']  = get_locale();
+               $c['blog_charset'] = get_option('blog_charset');
+               $c['permalink']  = get_permalink($c['comment_post_ID']);
                $id = (int) $c['comment_ID'];
 
                $query_string = '';
                $id = (int) $c['comment_ID'];
 
                $query_string = '';
@@ -816,6 +848,9 @@ function akismet_check_db_comment( $id ) {
        $c['user_agent'] = $c['comment_agent'];
        $c['referrer']   = '';
        $c['blog']       = get_option('home');
        $c['user_agent'] = $c['comment_agent'];
        $c['referrer']   = '';
        $c['blog']       = get_option('home');
+       $c['blog_lang']  = get_locale();
+       $c['blog_charset'] = get_option('blog_charset');
+       $c['permalink']  = get_permalink($c['comment_post_ID']);
        $id = $c['comment_ID'];
 
        $query_string = '';
        $id = $c['comment_ID'];
 
        $query_string = '';
diff --git a/wp-content/plugins/index.php b/wp-content/plugins/index.php
new file mode 100644 (file)
index 0000000..4e6c07c
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+// Silence is golden.
+?>
\ No newline at end of file
index fdcb8932252537f02137a59b26a74ff275aa4c66..68d5a9c22668dab708f1861f23da7ae25f6ee821 100644 (file)
@@ -30,7 +30,7 @@ while( have_posts()) : the_post();
 
 <p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p>
 
 
 <p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p>
 
-<?php if ('open' == $post->ping_status) { ?>
+<?php if ( pings_open() ) { ?>
 <p><?php _e("The <abbr title=\"Universal Resource Locator\">URL</abbr> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
 <?php } ?>
 
 <p><?php _e("The <abbr title=\"Universal Resource Locator\">URL</abbr> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p>
 <?php } ?>
 
@@ -49,7 +49,7 @@ if ( post_password_required($commentstatus) ) {  // and it doesn't match the coo
 <?php foreach ($comments as $comment) { ?>
        <li id="comment-<?php comment_ID() ?>">
        <?php comment_text() ?>
 <?php foreach ($comments as $comment) { ?>
        <li id="comment-<?php comment_ID() ?>">
        <?php comment_text() ?>
-       <p><cite><?php comment_type(_c('Comment|noun'), __('Trackback'), __('Pingback')); ?> <?php _e("by"); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
+       <p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e("by"); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
        </li>
 
 <?php } // end for each comment ?>
        </li>
 
 <?php } // end for each comment ?>
@@ -58,26 +58,26 @@ if ( post_password_required($commentstatus) ) {  // and it doesn't match the coo
        <p><?php _e("No comments yet."); ?></p>
 <?php } ?>
 
        <p><?php _e("No comments yet."); ?></p>
 <?php } ?>
 
-<?php if ('open' == $commentstatus->comment_status) { ?>
+<?php if ( comments_open($commentstatus) ) { ?>
 <h2><?php _e("Leave a comment"); ?></h2>
 <p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 <h2><?php _e("Leave a comment"); ?></h2>
 <p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
-<?php if ( $user_ID ) : ?>
-<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(); ?>" title="<?php echo attribute_escape(__('Log out of this account')); ?>"><?php _e('Log out &raquo;'); ?></a></p>
+<?php if ( is_user_logged_in() ) : ?>
+<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(); ?>" title="<?php echo esc_attr(__('Log out of this account')); ?>"><?php _e('Log out &raquo;'); ?></a></p>
 <?php else : ?>
        <p>
 <?php else : ?>
        <p>
-         <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
+         <input type="text" name="author" id="author" class="textarea" value="<?php echo esc_attr($comment_author); ?>" size="28" tabindex="1" />
           <label for="author"><?php _e("Name"); ?></label>
        </p>
 
        <p>
           <label for="author"><?php _e("Name"); ?></label>
        </p>
 
        <p>
-         <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
+         <input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="28" tabindex="2" />
           <label for="email"><?php _e("E-mail"); ?></label>
        </p>
 
        <p>
           <label for="email"><?php _e("E-mail"); ?></label>
        </p>
 
        <p>
-         <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
+         <input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="28" tabindex="3" />
           <label for="url"><?php _e("<abbr title=\"Universal Resource Locator\">URL</abbr>"); ?></label>
        </p>
 <?php endif; ?>
           <label for="url"><?php _e("<abbr title=\"Universal Resource Locator\">URL</abbr>"); ?></label>
        </p>
 <?php endif; ?>
@@ -90,8 +90,8 @@ if ( post_password_required($commentstatus) ) {  // and it doesn't match the coo
 
        <p>
          <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
 
        <p>
          <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
-         <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($_SERVER["REQUEST_URI"]); ?>" />
-         <input name="submit" type="submit" tabindex="5" value="<?php _e("Say It!"); ?>" />
+         <input type="hidden" name="redirect_to" value="<?php echo esc_attr($_SERVER["REQUEST_URI"]); ?>" />
+         <input name="submit" type="submit" tabindex="5" value="<?php esc_attr_e("Say It!"); ?>" />
        </p>
        <?php do_action('comment_form', $post->ID); ?>
 </form>
        </p>
        <?php do_action('comment_form', $post->ID); ?>
 </form>
index b3fe7291504986d8b7787fcc53cba93fab26253a..57d6cf3cceda737853b88f101bec1f2b99593c95 100644 (file)
@@ -14,14 +14,14 @@ if ( post_password_required() ) : ?>
 <?php endif; ?>
 </h2>
 
 <?php endif; ?>
 </h2>
 
-<?php if ( $comments ) : ?>
+<?php if ( have_comments() ) : ?>
 <ol id="commentlist">
 
 <?php foreach ($comments as $comment) : ?>
        <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
        <?php echo get_avatar( $comment, 32 ); ?>
        <?php comment_text() ?>
 <ol id="commentlist">
 
 <?php foreach ($comments as $comment) : ?>
        <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
        <?php echo get_avatar( $comment, 32 ); ?>
        <?php comment_text() ?>
-       <p><cite><?php comment_type(_c('Comment|noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
+       <p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> &#8212; <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
        </li>
 
 <?php endforeach; ?>
        </li>
 
 <?php endforeach; ?>
@@ -41,25 +41,25 @@ if ( post_password_required() ) : ?>
 <?php if ( comments_open() ) : ?>
 <h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>
 
 <?php if ( comments_open() ) : ?>
 <h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>
 
-<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
-<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), get_option('siteurl')."/wp-login.php?redirect_to=".urlencode(get_permalink()));?></p>
+<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
+<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() ) );?></p>
 <?php else : ?>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 
 <?php else : ?>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 
-<?php if ( $user_ID ) : ?>
+<?php if ( is_user_logged_in() ) : ?>
 
 <p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>
 
 <?php else : ?>
 
 
 <p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>
 
 <?php else : ?>
 
-<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
+<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
 <label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
 
 <label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
 
-<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
+<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
 <label for="email"><small><?php _e('Mail (will not be published)');?> <?php if ($req) _e('(required)'); ?></small></label></p>
 
 <label for="email"><small><?php _e('Mail (will not be published)');?> <?php if ($req) _e('(required)'); ?></small></label></p>
 
-<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
+<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
 <label for="url"><small><?php _e('Website'); ?></small></label></p>
 
 <?php endif; ?>
 <label for="url"><small><?php _e('Website'); ?></small></label></p>
 
 <?php endif; ?>
@@ -68,7 +68,7 @@ if ( post_password_required() ) : ?>
 
 <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
 
 
 <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
 
-<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php echo attribute_escape(__('Submit Comment')); ?>" />
+<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
 <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
 </p>
 <?php do_action('comment_form', $post->ID); ?>
 <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
 </p>
 <?php do_action('comment_form', $post->ID); ?>
index 40d4a46f8e19caf50fc7def8e33c738a26687272..1bc06e22ad63d82b9e1b5b843205c714dd391dd2 100644 (file)
@@ -3,6 +3,9 @@
  * @package WordPress
  * @subpackage Classic_Theme
  */
  * @package WordPress
  * @subpackage Classic_Theme
  */
+
+automatic_feed_links();
+
 if ( function_exists('register_sidebar') )
        register_sidebar(array(
                'before_widget' => '<li id="%1$s" class="widget %2$s">',
 if ( function_exists('register_sidebar') )
        register_sidebar(array(
                'before_widget' => '<li id="%1$s" class="widget %2$s">',
index e08c95d05bfe8e1737342a7e22c5ae7c755f7487..f16c2805fbbf2ec63f7f38da4494e6e03a67ccb6 100644 (file)
                @import url( <?php bloginfo('stylesheet_url'); ?> );
        </style>
 
                @import url( <?php bloginfo('stylesheet_url'); ?> );
        </style>
 
-       <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
-       <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
-       <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php bloginfo('atom_url'); ?>" />
-
        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
        <?php wp_get_archives('type=monthly&format=link'); ?>
        <?php //comments_popup_script(); // off by default ?>
        <?php wp_head(); ?>
 </head>
 
        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
        <?php wp_get_archives('type=monthly&format=link'); ?>
        <?php //comments_popup_script(); // off by default ?>
        <?php wp_head(); ?>
 </head>
 
-<body>
+<body <?php body_class(); ?>>
 <div id="rap">
 <h1 id="header"><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
 
 <div id="rap">
 <h1 id="header"><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
 
index 0c8a12eac2926498a6ef60ce4da69511aea45e13..ab7d7458f5a4556d87fd55c9e9cfca02a4396e1d 100644 (file)
@@ -18,7 +18,7 @@
    <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
        <div>
                <input type="text" name="s" id="s" size="15" /><br />
    <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
        <div>
                <input type="text" name="s" id="s" size="15" /><br />
-               <input type="submit" value="<?php _e('Search'); ?>" />
+               <input type="submit" value="<?php esc_attr_e('Search'); ?>" />
        </div>
        </form>
  </li>
        </div>
        </form>
  </li>
index 93dc883bc0c6fde21d3bcc90f03b2b5aeab2d988..a3b8df9165a1e41dcc61658ef81d6eb0f698e629 100644 (file)
@@ -12,6 +12,11 @@ This is just a basic layout, with only the bare minimum defined.
 Please tweak this and make it your own. :)
 */
 
 Please tweak this and make it your own. :)
 */
 
+.screen-reader-text {
+     position: absolute;
+     left: -1000em;
+}
+
 a {
        color: #675;
 }
 a {
        color: #675;
 }
index 3d4d8b8e9420879b4bbeeb83fc2041158c9c79eb..70c2a8cec8273aba0febc3543d65a7519339dad3 100644 (file)
@@ -7,7 +7,7 @@
 get_header();
 ?>
 
 get_header();
 ?>
 
-       <div id="content" class="narrowcolumn">
+       <div id="content" class="narrowcolumn" role="main">
 
                <?php if (have_posts()) : ?>
 
 
                <?php if (have_posts()) : ?>
 
index b54c07f3e46ddaec397bf3b4df7fe81750f8c922..49fe744a32ed12a653a4aaf76d2006c2187c0ba6 100644 (file)
@@ -29,7 +29,7 @@ while ( have_posts() ) : the_post();
 
 <p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p>
 
 
 <p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p>
 
-<?php if ('open' == $post->ping_status) { ?>
+<?php if ( pings_open() ) { ?>
 <p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p>
 <?php } ?>
 
 <p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p>
 <?php } ?>
 
@@ -57,7 +57,7 @@ if ( post_password_required($post) ) {  // and it doesn't match the cookie
        <p>No comments yet.</p>
 <?php } ?>
 
        <p>No comments yet.</p>
 <?php } ?>
 
-<?php if ('open' == $post->comment_status) { ?>
+<?php if ( comments_open() ) { ?>
 <h2>Leave a comment</h2>
 <p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>
 
 <h2>Leave a comment</h2>
 <p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p>
 
@@ -66,17 +66,17 @@ if ( post_password_required($post) ) {  // and it doesn't match the cookie
        <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
 <?php else : ?>
        <p>
        <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
 <?php else : ?>
        <p>
-         <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
+         <input type="text" name="author" id="author" class="textarea" value="<?php echo esc_attr($comment_author); ?>" size="28" tabindex="1" />
           <label for="author">Name</label>
        </p>
 
        <p>
           <label for="author">Name</label>
        </p>
 
        <p>
-         <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="28" tabindex="2" />
+         <input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="28" tabindex="2" />
           <label for="email">E-mail</label>
        </p>
 
        <p>
           <label for="email">E-mail</label>
        </p>
 
        <p>
-         <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" />
+         <input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="28" tabindex="3" />
           <label for="url"><abbr title="Universal Resource Locator">URL</abbr></label>
        </p>
 <?php endif; ?>
           <label for="url"><abbr title="Universal Resource Locator">URL</abbr></label>
        </p>
 <?php endif; ?>
@@ -89,7 +89,7 @@ if ( post_password_required($post) ) {  // and it doesn't match the cookie
 
        <p>
       <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
 
        <p>
       <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
-         <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($_SERVER["REQUEST_URI"]); ?>" />
+         <input type="hidden" name="redirect_to" value="<?php echo esc_attr($_SERVER["REQUEST_URI"]); ?>" />
          <input name="submit" type="submit" tabindex="5" value="Say It!" />
        </p>
        <?php do_action('comment_form', $post->ID); ?>
          <input name="submit" type="submit" tabindex="5" value="Say It!" />
        </p>
        <?php do_action('comment_form', $post->ID); ?>
index 94a677a92f3aa9f6c14c8aed0d8b98ce69c83b14..7e81cdb3521748659a22d4e2242ddc1491387cf8 100644 (file)
@@ -35,7 +35,7 @@
        </div>
  <?php else : // this is displayed if there are no comments so far ?>
 
        </div>
  <?php else : // this is displayed if there are no comments so far ?>
 
-       <?php if ('open' == $post->comment_status) : ?>
+       <?php if ( comments_open() ) : ?>
                <!-- If comments are open, but there are no comments. -->
 
         <?php else : // comments are closed ?>
                <!-- If comments are open, but there are no comments. -->
 
         <?php else : // comments are closed ?>
@@ -46,7 +46,7 @@
 <?php endif; ?>
 
 
 <?php endif; ?>
 
 
-<?php if ('open' == $post->comment_status) : ?>
+<?php if ( comments_open() ) : ?>
 
 <div id="respond">
 
 
 <div id="respond">
 
        <small><?php cancel_comment_reply_link(); ?></small>
 </div>
 
        <small><?php cancel_comment_reply_link(); ?></small>
 </div>
 
-<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
-<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
+<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
+<p>You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.</p>
 <?php else : ?>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 
 <?php else : ?>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 
-<?php if ( $user_ID ) : ?>
+<?php if ( is_user_logged_in() ) : ?>
 
 <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
 
 <?php else : ?>
 
 
 <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
 
 <?php else : ?>
 
-<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
+<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
 <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
 
 <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
 
-<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
+<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
 <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
 
 <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
 
-<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
+<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
 <label for="url"><small>Website</small></label></p>
 
 <?php endif; ?>
 <label for="url"><small>Website</small></label></p>
 
 <?php endif; ?>
index 49ab67660d6dea787700b635b32bb7ab3a4496ac..02f6d1930a4efa93c08ade1aecfa1d3e97564ecc 100644 (file)
@@ -6,7 +6,7 @@
 ?>
 
 <hr />
 ?>
 
 <hr />
-<div id="footer">
+<div id="footer" role="contentinfo">
 <!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
        <p>
                <?php bloginfo('name'); ?> is proudly powered by
 <!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
        <p>
                <?php bloginfo('name'); ?> is proudly powered by
index 340d23c333cbbbe6c990992cccc549d2d784df2b..9ad4ef2348e99138291869c9a19cf17f78117b8c 100644 (file)
@@ -4,13 +4,16 @@
  * @subpackage Default_Theme
  */
 
  * @subpackage Default_Theme
  */
 
-if ( function_exists('register_sidebar') )
-    register_sidebar(array(
-        'before_widget' => '<li id="%1$s" class="widget %2$s">',
-        'after_widget' => '</li>',
-        'before_title' => '<h2 class="widgettitle">',
-        'after_title' => '</h2>',
-    ));
+automatic_feed_links();
+
+if ( function_exists('register_sidebar') ) {
+       register_sidebar(array(
+               'before_widget' => '<li id="%1$s" class="widget %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '<h2 class="widgettitle">',
+               'after_title' => '</h2>',
+       ));
+}
 
 /** @ignore */
 function kubrick_head() {
 
 /** @ignore */
 function kubrick_head() {
@@ -150,7 +153,7 @@ function kubrick_add_theme_page() {
                }
                add_action('admin_head', 'kubrick_theme_page_head');
        }
                }
                add_action('admin_head', 'kubrick_theme_page_head');
        }
-       add_theme_page(__('Customize Header'), __('Header Image and Color'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
+       add_theme_page(__('Custom Header'), __('Custom Header'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
 }
 
 function kubrick_theme_page_head() {
 }
 
 function kubrick_theme_page_head() {
@@ -163,7 +166,7 @@ function kubrick_theme_page_head() {
                kUpdate(ColorPicker_targetInput.id);
        }
        function PopupWindow_populate(contents) {
                kUpdate(ColorPicker_targetInput.id);
        }
        function PopupWindow_populate(contents) {
-               contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" class="button-secondary" value="<?php echo attribute_escape(__('Close Color Picker')); ?>" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
+               contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" class="button-secondary" value="<?php esc_attr_e('Close Color Picker'); ?>" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
                this.contents = contents;
                this.populated = false;
        }
                this.contents = contents;
                this.populated = false;
        }
@@ -248,13 +251,13 @@ function kubrick_theme_page_head() {
                document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
        }
        function kRevert() {
                document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
        }
        function kRevert() {
-               document.getElementById('headerimage').value = '<?php echo js_escape(kubrick_header_image()); ?>';
-               document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo js_escape(kubrick_upper_color()); ?>';
-               document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo js_escape(kubrick_lower_color()); ?>';
-               document.getElementById('header').style.background = 'url("<?php echo js_escape(kubrick_header_image_url()); ?>") center no-repeat';
+               document.getElementById('headerimage').value = '<?php echo esc_js(kubrick_header_image()); ?>';
+               document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo esc_js(kubrick_upper_color()); ?>';
+               document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo esc_js(kubrick_lower_color()); ?>';
+               document.getElementById('header').style.background = 'url("<?php echo esc_js(kubrick_header_image_url()); ?>") center no-repeat';
                document.getElementById('header').style.color = '';
                document.getElementById('header').style.color = '';
-               document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo js_escape(kubrick_header_color_string()); ?>';
-               document.getElementById('fontdisplay').value = '<?php echo js_escape(kubrick_header_display_string()); ?>';
+               document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo esc_js(kubrick_header_color_string()); ?>';
+               document.getElementById('fontdisplay').value = '<?php echo esc_js(kubrick_header_display_string()); ?>';
                document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
        }
        function kInit() {
                document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
        }
        function kInit() {
@@ -377,43 +380,43 @@ function kubrick_theme_page() {
                <div id="nonJsForm">
                        <form method="post" action="">
                                <?php wp_nonce_field('kubrick-header'); ?>
                <div id="nonJsForm">
                        <form method="post" action="">
                                <?php wp_nonce_field('kubrick-header'); ?>
-                               <div class="zerosize"><input type="submit" name="defaultsubmit" value="<?php echo attribute_escape(__('Save')); ?>" /></div>
-                                       <label for="njfontcolor"><?php _e('Font Color:'); ?></label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo attribute_escape(kubrick_header_color()); ?>" /> <?php printf(__('Any CSS color (%s or %s or %s)'), '<code>red</code>', '<code>#FF0000</code>', '<code>rgb(255, 0, 0)</code>'); ?><br />
-                                       <label for="njuppercolor"><?php _e('Upper Color:'); ?></label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo attribute_escape(kubrick_upper_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
-                               <label for="njlowercolor"><?php _e('Lower Color:'); ?></label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo attribute_escape(kubrick_lower_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
-                               <input type="hidden" name="hi" id="hi" value="<?php echo attribute_escape(kubrick_header_image()); ?>" />
-                               <input type="submit" name="toggledisplay" id="toggledisplay" value="<?php echo attribute_escape(__('Toggle Text')); ?>" />
-                               <input type="submit" name="defaults" value="<?php echo attribute_escape(__('Use Defaults')); ?>" />
-                               <input type="submit" class="defbutton" name="submitform" value="&nbsp;&nbsp;<?php _e('Save'); ?>&nbsp;&nbsp;" />
+                               <div class="zerosize"><input type="submit" name="defaultsubmit" value="<?php esc_attr_e('Save'); ?>" /></div>
+                                       <label for="njfontcolor"><?php _e('Font Color:'); ?></label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo esc_attr(kubrick_header_color()); ?>" /> <?php printf(__('Any CSS color (%s or %s or %s)'), '<code>red</code>', '<code>#FF0000</code>', '<code>rgb(255, 0, 0)</code>'); ?><br />
+                                       <label for="njuppercolor"><?php _e('Upper Color:'); ?></label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo esc_attr(kubrick_upper_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
+                               <label for="njlowercolor"><?php _e('Lower Color:'); ?></label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo esc_attr(kubrick_lower_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
+                               <input type="hidden" name="hi" id="hi" value="<?php echo esc_attr(kubrick_header_image()); ?>" />
+                               <input type="submit" name="toggledisplay" id="toggledisplay" value="<?php esc_attr_e('Toggle Text'); ?>" />
+                               <input type="submit" name="defaults" value="<?php esc_attr_e('Use Defaults'); ?>" />
+                               <input type="submit" class="defbutton" name="submitform" value="&nbsp;&nbsp;<?php esc_attr_e('Save'); ?>&nbsp;&nbsp;" />
                                <input type="hidden" name="action" value="save" />
                                <input type="hidden" name="njform" value="true" />
                        </form>
                </div>
                <div id="jsForm">
                                <input type="hidden" name="action" value="save" />
                                <input type="hidden" name="njform" value="true" />
                        </form>
                </div>
                <div id="jsForm">
-                       <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo attribute_escape($_SERVER['REQUEST_URI']); ?>">
+                       <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo esc_attr($_SERVER['REQUEST_URI']); ?>">
                                <?php wp_nonce_field('kubrick-header'); ?>
                                <?php wp_nonce_field('kubrick-header'); ?>
-       <input type="button"  class="button-secondary" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="<?php echo attribute_escape(__('Font Color')); ?>"></input>
-               <input type="button" class="button-secondary" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="<?php echo attribute_escape(__('Upper Color')); ?>"></input>
-               <input type="button" class="button-secondary" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="<?php echo attribute_escape(__('Lower Color')); ?>"></input>
-                               <input type="button" class="button-secondary" name="revert" value="<?php echo attribute_escape(__('Revert')); ?>" onclick="kRevert()" />
-                               <input type="button" class="button-secondary" value="<?php echo attribute_escape(__('Advanced')); ?>" onclick="toggleAdvanced()" />
+       <input type="button"  class="button-secondary" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="<?php esc_attr_e('Font Color'); ?>"></input>
+               <input type="button" class="button-secondary" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="<?php esc_attr_e('Upper Color'); ?>"></input>
+               <input type="button" class="button-secondary" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="<?php esc_attr_e('Lower Color'); ?>"></input>
+                               <input type="button" class="button-secondary" name="revert" value="<?php esc_attr_e('Revert'); ?>" onclick="kRevert()" />
+                               <input type="button" class="button-secondary" value="<?php esc_attr_e('Advanced'); ?>" onclick="toggleAdvanced()" />
                                <input type="hidden" name="action" value="save" />
                                <input type="hidden" name="action" value="save" />
-                               <input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo attribute_escape(kubrick_header_display()); ?>" />
-                               <input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo attribute_escape(kubrick_header_color()); ?>" />
-                               <input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo attribute_escape(kubrick_upper_color()); ?>" />
-                               <input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo attribute_escape(kubrick_lower_color()); ?>" />
-                               <input type="hidden" name="headerimage" id="headerimage" value="<?php echo attribute_escape(kubrick_header_image()); ?>" />
-                               <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php echo attribute_escape(__('Update Header')); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
+                               <input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo esc_attr(kubrick_header_display()); ?>" />
+                               <input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo esc_attr(kubrick_header_color()); ?>" />
+                               <input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo esc_attr(kubrick_upper_color()); ?>" />
+                               <input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo esc_attr(kubrick_lower_color()); ?>" />
+                               <input type="hidden" name="headerimage" id="headerimage" value="<?php echo esc_attr(kubrick_header_image()); ?>" />
+                               <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php esc_attr_e('Update Header'); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
                        </form>
                        <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
                        <div id="advanced">
                                <form id="jsAdvanced" style="display:none;" action="">
                                        <?php wp_nonce_field('kubrick-header'); ?>
                        </form>
                        <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
                        <div id="advanced">
                                <form id="jsAdvanced" style="display:none;" action="">
                                        <?php wp_nonce_field('kubrick-header'); ?>
-                                       <label for="advfontcolor"><?php _e('Font Color (CSS):'); ?> </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo attribute_escape(kubrick_header_color()); ?>" /><br />
-                                       <label for="advuppercolor"><?php _e('Upper Color (HEX):');?> </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo attribute_escape(kubrick_upper_color()); ?>" /><br />
-                                       <label for="advlowercolor"><?php _e('Lower Color (HEX):'); ?> </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo attribute_escape(kubrick_lower_color()); ?>" /><br />
-                                       <input type="button" class="button-secondary" name="default" value="<?php echo attribute_escape(__('Select Default Colors')); ?>" onclick="kDefaults()" /><br />
-                                       <input type="button" class="button-secondary" onclick="toggleDisplay();return false;" name="pick" id="pick" value="<?php echo attribute_escape(__('Toggle Text Display')); ?>"></input><br />
+                                       <label for="advfontcolor"><?php _e('Font Color (CSS):'); ?> </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo esc_attr(kubrick_header_color()); ?>" /><br />
+                                       <label for="advuppercolor"><?php _e('Upper Color (HEX):');?> </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo esc_attr(kubrick_upper_color()); ?>" /><br />
+                                       <label for="advlowercolor"><?php _e('Lower Color (HEX):'); ?> </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo esc_attr(kubrick_lower_color()); ?>" /><br />
+                                       <input type="button" class="button-secondary" name="default" value="<?php esc_attr_e('Select Default Colors'); ?>" onclick="kDefaults()" /><br />
+                                       <input type="button" class="button-secondary" onclick="toggleDisplay();return false;" name="pick" id="pick" value="<?php esc_attr_e('Toggle Text Display'); ?>"></input><br />
                                </form>
                        </div>
                </div>
                                </form>
                        </div>
                </div>
index 558689f624373d8d80eb706c6223963830dea767..5c21f94d185c2f692a4902dede17dbbc5cc87cac 100644 (file)
 <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
 
 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
 <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
 
 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
-<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
-<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
 
 <style type="text/css" media="screen">
 
 <?php
 // Checks to see whether it needs a sidebar or not
 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
 
 <style type="text/css" media="screen">
 
 <?php
 // Checks to see whether it needs a sidebar or not
-if ( !empty($withcomments) && !is_single() ) {
+if ( empty($withcomments) && !is_single() ) {
 ?>
        #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; }
 <?php } else { // No sidebar ?>
 ?>
        #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; }
 <?php } else { // No sidebar ?>
@@ -34,11 +32,11 @@ if ( !empty($withcomments) && !is_single() ) {
 
 <?php wp_head(); ?>
 </head>
 
 <?php wp_head(); ?>
 </head>
-<body>
+<body <?php body_class(); ?>>
 <div id="page">
 
 
 <div id="page">
 
 
-<div id="header">
+<div id="header" role="banner">
        <div id="headerimg">
                <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
                <div class="description"><?php bloginfo('description'); ?></div>
        <div id="headerimg">
                <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
                <div class="description"><?php bloginfo('description'); ?></div>
index 80dad8ace8383ac856b13e3a6e208d4a065dc75f..4312630feea4d52f94138445d6326c4e5f69d020 100644 (file)
@@ -32,19 +32,19 @@ get_header();
                                                <?php the_taxonomies(); ?>
                                                You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
 
                                                <?php the_taxonomies(); ?>
                                                You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
 
-                                               <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
+                                               <?php if ( comments_open() && pings_open() ) {
                                                        // Both Comments and Pings are open ?>
                                                        You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
 
                                                        // Both Comments and Pings are open ?>
                                                        You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
 
-                                               <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
+                                               <?php } elseif ( !comments_open() && pings_open() ) {
                                                        // Only Pings are Open ?>
                                                        Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
 
                                                        // Only Pings are Open ?>
                                                        Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
 
-                                               <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
+                                               <?php } elseif ( comments_open() && !pings_open() ) {
                                                        // Comments are open, Pings are not ?>
                                                        You can skip to the end and leave a response. Pinging is currently not allowed.
 
                                                        // Comments are open, Pings are not ?>
                                                        You can skip to the end and leave a response. Pinging is currently not allowed.
 
-                                               <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
+                                               <?php } elseif ( !comments_open() && !pings_open() ) {
                                                        // Neither Comments, nor Pings are open ?>
                                                        Both comments and pings are currently closed.
 
                                                        // Neither Comments, nor Pings are open ?>
                                                        Both comments and pings are currently closed.
 
index 0d70c2305df51787000a1debf7af0dcc8f2090d0..ae5bf8057b501eb4cea0a34eaa64e09e8ca04359 100644 (file)
@@ -6,7 +6,7 @@
 
 get_header(); ?>
 
 
 get_header(); ?>
 
-       <div id="content" class="narrowcolumn">
+       <div id="content" class="narrowcolumn" role="main">
 
        <?php if (have_posts()) : ?>
 
 
        <?php if (have_posts()) : ?>
 
index bd77efb67992319d0f01092ce80499425a4c0614..660e47744b2cee9bc4126f6c8ce89a01e36c9c52 100644 (file)
@@ -6,7 +6,7 @@
 
 get_header(); ?>
 
 
 get_header(); ?>
 
-       <div id="content" class="narrowcolumn">
+       <div id="content" class="narrowcolumn" role="main">
 
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div class="post" id="post-<?php the_ID(); ?>">
 
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div class="post" id="post-<?php the_ID(); ?>">
@@ -24,4 +24,4 @@ get_header(); ?>
 
 <?php get_sidebar(); ?>
 
 
 <?php get_sidebar(); ?>
 
-<?php get_footer(); ?>
\ No newline at end of file
+<?php get_footer(); ?>
index 80b88900593b654c751fdaa15b0df48bbd92aa16..ba2361b1e5bd01f1d73e638ffe9bd980373a84ae 100644 (file)
-/*\r
-Theme name: WordPress Default - kubrick -\r
-Editors: Navid Kashani\r
-Persian Wordpress Project : wp-persian.com\r
-*/\r
-body, .commentlist li, #commentform input, #commentform textarea, #commentform p, #sidebar, #wp-calendar caption  {\r
-       font-family:tahoma, arial;\r
-}\r
-#page {\r
-       text-align:right;\r
-       direction:rtl;\r
-}\r
-h1, h2, h3, #sidebar h2 {\r
-       font-family:arial, tahoma;\r
-}\r
-.commentlist li .avatar {\r
-       float:left;\r
-}\r
-#header {\r
-       margin:0 1px 0 0;\r
-}\r
-.narrowcolumn {\r
-       float:right;\r
-       padding: 0 45px 20px 0;\r
-}\r
-.widecolumn {\r
-       margin: 5px 150px 0 0;\r
-}\r
-.widecolumn .smallattachment {\r
-       margin: 5px 0 5px 5px;\r
-}\r
-.postmetadata {\r
-       clear:right;\r
-}\r
-#sidebar {\r
-       margin-left: 0;\r
-       margin-right: 545px;\r
-}\r
-img.alignright {\r
-       margin: 0 7px 2px 0;\r
-}\r
-\r
-img.alignleft {\r
-       margin: 0 0 2px 7px;\r
-}\r
-\r
-.alignright {\r
-       float: left;\r
-}\r
-\r
-.alignleft {\r
-       float: right;\r
-}\r
-code {\r
-       display:block;\r
-       direction:ltr;\r
-       text-align:left;\r
-}\r
-acronym, abbr, span.caps {\r
-       letter-spacing:0; /* fix opera bug */\r
-}\r
-html>body .entry ul {\r
-       padding:0 10px 0 0;\r
-       text-indent:10px;\r
-}\r
-html>body .entry li {\r
-       margin: 7px 10px 8px 0;\r
-}\r
-.entry ol {\r
-       padding: 0 35px 0 0;\r
-}\r
-#sidebar ul ul, #sidebar ul ol {\r
-       margin: 5px 10px 0 0;\r
-}\r
-#sidebar ul ul ul, #sidebar ul ol {\r
-       margin: 0 10px 0 0;\r
-}\r
-#commentform input {\r
-       margin: 5px 0 1px 5px;\r
-}\r
-#commentform #submit {\r
-       float:left;\r
-}\r
-.commentlist p {\r
-       margin: 10px 0 10px 5px;\r
-}\r
-#wp-calendar #next a {\r
-       padding-right:0;\r
-       padding-left:10px;\r
-       text-align:left;\r
-}\r
-#wp-calendar #prev a {\r
-       padding-left:0;\r
-       padding-right:10px;\r
-       text-align:right;\r
-}\r
-blockquote {\r
-       margin: 15px 10px 0 30px;\r
-       padding-left: 0;\r
-       padding-right: 20px;\r
-       border-left: 0 none;\r
-       border-right: 5px solid #ddd;\r
-}\r
-#email, #url {\r
-       direction:ltr;\r
+/*
+Theme name: WordPress Default - kubrick -
+Editors: Navid Kashani
+Persian Wordpress Project : wp-persian.com
+*/
+body, .commentlist li, #commentform input, #commentform textarea, #commentform p, #sidebar, #wp-calendar caption  {
+       font-family:tahoma, arial;
+}
+#page {
+       text-align:right;
+       direction:rtl;
+}
+h1, h2, h3, #sidebar h2 {
+       font-family:arial, tahoma;
+}
+.commentlist li .avatar {
+       float:left;
+}
+
+.commentlist li {
+       padding: 5px 10px 10px 5px;
+       }
+.commentlist li ul li { 
+       margin-left: -5px;
+       margin-right: 10px;
+}
+
+.commentlist p {
+       margin: 10px 0 10px 5px;
+}
+#header {
+       margin:0 1px 0 0;
+}
+.narrowcolumn {
+       float:right;
+       padding: 0 45px 20px 0;
+}
+.widecolumn {
+       margin: 5px 150px 0 0;
+}
+.widecolumn .smallattachment {
+       margin: 5px 0 5px 5px;
+}
+.postmetadata {
+       clear:right;
+}
+#sidebar {
+       margin-left: 0;
+       margin-right: 545px;
+}
+img.alignright {
+       margin: 0 7px 2px 0;
+}
+
+img.alignleft {
+       margin: 0 0 2px 7px;
+}
+
+.alignright {
+       float: left;
+}
+
+.alignleft {
+       float: right;
+}
+code {
+       display:block;
+       direction:ltr;
+       text-align:left;
+}
+acronym, abbr, span.caps {
+       letter-spacing:0; /* fix opera bug */
+}
+html>body .entry ul {
+       padding:0 10px 0 0;
+       text-indent:10px;
+}
+html>body .entry li {
+       margin: 7px 10px 8px 0;
+}
+.entry ol {
+       padding: 0 35px 0 0;
+}
+#sidebar ul ul, #sidebar ul ol {
+       margin: 5px 10px 0 0;
+}
+#sidebar ul ul ul, #sidebar ul ol {
+       margin: 0 10px 0 0;
+}
+#commentform {
+       margin: 5px 0 0 10px;
+       }
+#commentform input {
+       margin: 5px 0 1px 5px;
+}
+#commentform #submit {
+       float:left;
+}
+.commentlist p {
+       margin: 10px 0 10px 5px;
+}
+
+.children .even, .alt {
+       border-left: 0;
+       border-right: 1px solid #ddd;
+}
+
+#wp-calendar #next a {
+       padding-right:0;
+       padding-left:10px;
+       text-align:left;
+}
+#wp-calendar #prev a {
+       padding-left:0;
+       padding-right:10px;
+       text-align:right;
+}
+blockquote {
+       margin: 15px 10px 0 30px;
+       padding-left: 0;
+       padding-right: 20px;
+       border-left: 0 none;
+       border-right: 5px solid #ddd;
+}
+#email, #url {
+       direction:ltr;
 }
\ No newline at end of file
 }
\ No newline at end of file
index 3e93ffce75973920931ace9cdfd1f7a38de8940c..4e7ad6dd6bc045ea7dd8c2574baa6fa799143541 100644 (file)
@@ -6,7 +6,7 @@
 
 get_header(); ?>
 
 
 get_header(); ?>
 
-       <div id="content" class="narrowcolumn">
+       <div id="content" class="narrowcolumn" role="main">
 
        <?php if (have_posts()) : ?>
 
 
        <?php if (have_posts()) : ?>
 
@@ -45,4 +45,4 @@ get_header(); ?>
 
 <?php get_sidebar(); ?>
 
 
 <?php get_sidebar(); ?>
 
-<?php get_footer(); ?>
\ No newline at end of file
+<?php get_footer(); ?>
index 79c3122939d659bd0c5457ab0295567c32c20e75..d73b632344a9d2d393e3caa2fdf20e22730c9d33 100644 (file)
@@ -4,7 +4,7 @@
  * @subpackage Default_Theme
  */
 ?>
  * @subpackage Default_Theme
  */
 ?>
-       <div id="sidebar">
+       <div id="sidebar" role="complementary">
                <ul>
                        <?php   /* Widgetized sidebar, if you have the plugin installed. */
                                        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
                <ul>
                        <?php   /* Widgetized sidebar, if you have the plugin installed. */
                                        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
 
                        <?php } ?>
 
 
                        <?php } ?>
 
-                       </li> <?php }?>
-
+                       </li>
+               <?php }?>
+               </ul>
+               <ul role="navigation">
                        <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
 
                        <li><h2>Archives</h2>
                        <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
 
                        <li><h2>Archives</h2>
@@ -58,7 +60,8 @@
                        </li>
 
                        <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
                        </li>
 
                        <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
-
+               </ul>
+               <ul>
                        <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
                                <?php wp_list_bookmarks(); ?>
 
                        <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
                                <?php wp_list_bookmarks(); ?>
 
index 5658bbf45c4ada04bdcf617dc2e6aebc71bb1d7e..c9cb4d82f3b30fd114f69c13a964e8a26689430e 100644 (file)
@@ -7,7 +7,7 @@
 get_header();
 ?>
 
 get_header();
 ?>
 
-       <div id="content" class="widecolumn">
+       <div id="content" class="widecolumn" role="main">
 
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 
 
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 
@@ -30,25 +30,25 @@ get_header();
                                                This entry was posted
                                                <?php /* This is commented, because it requires a little adjusting sometimes.
                                                        You'll need to download this plugin, and follow the instructions:
                                                This entry was posted
                                                <?php /* This is commented, because it requires a little adjusting sometimes.
                                                        You'll need to download this plugin, and follow the instructions:
-                                                       http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
+                                                       http://binarybonsai.com/wordpress/time-since/ */
                                                        /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
                                                on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
                                                and is filed under <?php the_category(', ') ?>.
                                                You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
 
                                                        /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
                                                on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
                                                and is filed under <?php the_category(', ') ?>.
                                                You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
 
-                                               <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
+                                               <?php if ( comments_open() && pings_open() ) {
                                                        // Both Comments and Pings are open ?>
                                                        You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
 
                                                        // Both Comments and Pings are open ?>
                                                        You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
 
-                                               <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
+                                               <?php } elseif ( !comments_open() && pings_open() ) {
                                                        // Only Pings are Open ?>
                                                        Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
 
                                                        // Only Pings are Open ?>
                                                        Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
 
-                                               <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
+                                               <?php } elseif ( comments_open() && !pings_open() ) {
                                                        // Comments are open, Pings are not ?>
                                                        You can skip to the end and leave a response. Pinging is currently not allowed.
 
                                                        // Comments are open, Pings are not ?>
                                                        You can skip to the end and leave a response. Pinging is currently not allowed.
 
-                                               <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
+                                               <?php } elseif ( !comments_open() && !pings_open() ) {
                                                        // Neither Comments, nor Pings are open ?>
                                                        Both comments and pings are currently closed.
 
                                                        // Neither Comments, nor Pings are open ?>
                                                        Both comments and pings are currently closed.
 
index 2edff6a4f8d1b0be7c5a39c9fa5c3c10dacfc04f..d64c5e7d4119bef9b4a52b0418095bdd7040012f 100644 (file)
@@ -46,7 +46,7 @@ body {
        }
 
 #content {
        }
 
 #content {
-       font-size: 1.2em
+       font-size: 1.2em;
        }
 
 .widecolumn .entry p {
        }
 
 .widecolumn .entry p {
@@ -81,7 +81,7 @@ border: 1px solid #ddd;
 }
 
 #footer {
 }
 
 #footer {
-       background: #eee url('images/kubrickfooter.jpg') no-repeat top;
+       background: #e7e7e7 url('images/kubrickfooter.jpg') no-repeat top;
        border: none;
        }
 
        border: none;
        }
 
@@ -140,6 +140,14 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
        color: #b85b5a;
        }
 
        color: #b85b5a;
        }
 
+.sticky {
+       background: #f7f7f7;
+       padding: 0 10px 10px;
+       }
+.sticky h2 {
+       padding-top: 10px;
+       }
+
 .commentlist li, #commentform input, #commentform textarea {
        font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
        }
 .commentlist li, #commentform input, #commentform textarea {
        font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
        }
@@ -392,7 +400,7 @@ img.alignleft {
        }
 
 .alignleft {
        }
 
 .alignleft {
-       float: left
+       float: left;
        }
 /* End Images */
 
        }
 /* End Images */
 
@@ -646,6 +654,11 @@ blockquote cite {
 .hidden {
        display: none;
        }
 .hidden {
        display: none;
        }
+       
+.screen-reader-text {
+     position: absolute;
+     left: -1000em;
+}
 
 hr {
        display: none;
 
 hr {
        display: none;
diff --git a/wp-content/themes/index.php b/wp-content/themes/index.php
new file mode 100644 (file)
index 0000000..4e6c07c
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+// Silence is golden.
+?>
\ No newline at end of file
index f7b3fa16b3c19c9017c1fb65f1da54900bb974d6..b7fd6f53dc39c8cebe2596fbb02eeafef19b987b 100644 (file)
 
 ignore_user_abort(true);
 
 
 ignore_user_abort(true);
 
+if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') )
+       die();
+
 /**
  * Tell WordPress we are doing the CRON task.
  *
  * @var bool
  */
 define('DOING_CRON', true);
 /**
  * Tell WordPress we are doing the CRON task.
  *
  * @var bool
  */
 define('DOING_CRON', true);
-/** Setup WordPress environment */
-require_once('./wp-load.php');
 
 
-if ( $_GET['check'] != wp_hash('187425') )
-       exit;
+if ( !defined('ABSPATH') ) {
+       /** Setup WordPress environment */
+       require_once('./wp-load.php');
+}
 
 
-$local_time = time();
+if ( false === $crons = _get_cron_array() )
+       die();
 
 
-$crons = _get_cron_array();
 $keys = array_keys( $crons );
 $keys = array_keys( $crons );
+$local_time = time();
 
 
-if (!is_array($crons) || $keys[0] > $local_time) {
-       update_option('doing_cron', 0);
-       return;
-}
+if ( isset($keys[0]) && $keys[0] > $local_time )
+       die();
 
 foreach ($crons as $timestamp  => $cronhooks) {
 
 foreach ($crons as $timestamp  => $cronhooks) {
-
        if ( $timestamp > $local_time )
                break;
 
        if ( $timestamp > $local_time )
                break;
 
@@ -56,8 +57,4 @@ foreach ($crons as $timestamp  => $cronhooks) {
        }
 }
 
        }
 }
 
-update_option('doing_cron', 0);
-
 die();
 die();
-
-?>
index 7cc6291c6d5c60aa235a5b133c6d0c690f837c1d..19e7b8680606f0cd108367239a032dbb00998d0d 100644 (file)
@@ -51,191 +51,72 @@ function the_author($deprecated = '', $deprecated_echo = true) {
 }
 
 /**
 }
 
 /**
- * Retrieve the description of the author of the current post.
+ * Retrieve the author who last edited the current post.
  *
  *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's description.
- */
-function get_the_author_description() {
-       global $authordata;
-       return $authordata->description;
-}
-
-/**
- * Display the description of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_description
- * @since 1.0.0
- * @see get_the_author_description()
- */
-function the_author_description() {
-       echo get_the_author_description();
-}
-
-/**
- * Retrieve the login name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's login name (username).
- */
-function get_the_author_login() {
-       global $authordata;
-       return $authordata->user_login;
-}
-
-/**
- * Display the login name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_login
- * @since 0.71
- * @see get_the_author_login()
- */
-function the_author_login() {
-       echo get_the_author_login();
-}
-
-/**
- * Retrieve the first name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's first name.
- */
-function get_the_author_firstname() {
-       global $authordata;
-       return $authordata->first_name;
-}
-
-/**
- * Display the first name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
- * @since 0.71
- * @uses get_the_author_firstname()
- */
-function the_author_firstname() {
-       echo get_the_author_firstname();
-}
-
-/**
- * Retrieve the last name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's last name.
- */
-function get_the_author_lastname() {
-       global $authordata;
-       return $authordata->last_name;
-}
-
-/**
- * Display the last name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
- * @since 0.71
- * @uses get_the_author_lastname()
+ * @since 2.8
+ * @uses $post The current post's DB object.
+ * @uses get_post_meta() Retrieves the ID of the author who last edited the current post.
+ * @uses get_userdata() Retrieves the author's DB object.
+ * @uses apply_filters() Calls 'the_modified_author' hook on the author display name.
+ * @return string The author's display name.
  */
  */
-function the_author_lastname() {
-       echo get_the_author_lastname();
+function get_the_modified_author() {
+       global $post;
+       if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) {
+               $last_user = get_userdata($last_id);
+               return apply_filters('the_modified_author', $last_user->display_name);
+       }
 }
 
 /**
 }
 
 /**
- * Retrieve the nickname of the author of the current post.
+ * Display the name of the author who last edited the current post.
  *
  *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's nickname.
+ * @since 2.8
+ * @see get_the_author()
+ * @return string The author's display name, from get_the_modified_author().
  */
  */
-function get_the_author_nickname() {
-       global $authordata;
-       return $authordata->nickname;
+function the_modified_author() {
+       echo get_the_modified_author();
 }
 
 /**
 }
 
 /**
- * Display the nickname of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
- * @since 0.71
- * @uses get_the_author_nickname()
+ * Retrieve the requested data of the author of the current post.
+ * @link http://codex.wordpress.org/Template_Tags/the_author_meta
+ * @since 2.8.0
+ * @uses $authordata The current author's DB object (if $user_id not specified).
+ * @param string $field selects the field of the users record.
+ * @param int $user_id Optional. User ID.
+ * @return string The author's field from the current author's DB object.
  */
  */
-function the_author_nickname() {
-       echo get_the_author_nickname();
-}
+function get_the_author_meta($field = '', $user_id = false) {
+       if ( ! $user_id )
+               global $authordata;
+       else
+               $authordata = get_userdata( $user_id );
 
 
-/**
- * Retrieve the ID of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return int The author's ID.
- */
-function get_the_author_ID() {
-       global $authordata;
-       return (int) $authordata->ID;
-}
+       $field = strtolower($field);
+       $user_field = "user_$field";
 
 
-/**
- * Display the ID of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_ID
- * @since 0.71
- * @uses get_the_author_ID()
- */
-function the_author_ID() {
-       echo get_the_author_id();
-}
+       if ( 'id' == $field )
+               $value = isset($authordata->ID) ? (int)$authordata->ID : 0;
+       elseif ( isset($authordata->$user_field) )
+               $value = $authordata->$user_field;
+       else
+               $value = isset($authordata->$field) ? $authordata->$field : '';
 
 
-/**
- * Retrieve the email of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's username.
- */
-function get_the_author_email() {
-       global $authordata;
-       return $authordata->user_email;
+       return apply_filters('get_the_author_' . $field, $value);
 }
 
 /**
 }
 
 /**
- * Display the email of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_email
- * @since 0.71
- * @uses get_the_author_email()
+ * Retrieve the requested data of the author of the current post.
+ * @link http://codex.wordpress.org/Template_Tags/the_author_meta
+ * @since 2.8.0
+ * @param string $field selects the field of the users record.
+ * @param int $user_id Optional. User ID.
+ * @echo string The author's field from the current author's DB object.
  */
  */
-function the_author_email() {
-       echo apply_filters('the_author_email', get_the_author_email() );
-}
-
-/**
- * Retrieve the URL to the home page of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The URL to the author's page.
- */
-function get_the_author_url() {
-       global $authordata;
-
-       if ( 'http://' == $authordata->user_url )
-               return '';
-
-       return $authordata->user_url;
-}
-
-/**
- * Display the URL to the home page of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_url
- * @since 0.71
- * @uses get_the_author_url()
- */
-function the_author_url() {
-       echo get_the_author_url();
+function the_author_meta($field = '', $user_id = false) {
+       echo apply_filters('the_author_' . $field, get_the_author_meta($field, $user_id));
 }
 
 /**
 }
 
 /**
@@ -246,109 +127,17 @@ function the_author_url() {
  *
  * @link http://codex.wordpress.org/Template_Tags/the_author_link
  * @since 2.1
  *
  * @link http://codex.wordpress.org/Template_Tags/the_author_link
  * @since 2.1
- * @uses get_the_author_url()
+ * @uses get_the_author_meta()
  * @uses the_author()
  */
 function the_author_link() {
  * @uses the_author()
  */
 function the_author_link() {
-       if (get_the_author_url()) {
-               echo '<a href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
+       if ( get_the_author_meta('url') ) {
+               echo '<a href="' . get_the_author_meta('url') . '" title="' . sprintf(__("Visit %s&#8217;s website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
        } else {
                the_author();
        }
 }
 
        } else {
                the_author();
        }
 }
 
-/**
- * Retrieve the ICQ number of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's ICQ number.
- */
-function get_the_author_icq() {
-       global $authordata;
-       return $authordata->icq;
-}
-
-/**
- * Display the ICQ number of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_icq
- * @since 0.71
- * @see get_the_author_icq()
- */
-function the_author_icq() {
-       echo get_the_author_icq();
-}
-
-/**
- * Retrieve the AIM name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's AIM name.
- */
-function get_the_author_aim() {
-       global $authordata;
-       return str_replace(' ', '+', $authordata->aim);
-}
-
-/**
- * Display the AIM name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_aim
- * @since 0.71
- * @see get_the_author_aim()
- */
-function the_author_aim() {
-       echo get_the_author_aim();
-}
-
-/**
- * Retrieve the Yahoo! IM name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's Yahoo! IM name.
- */
-function get_the_author_yim() {
-       global $authordata;
-       return $authordata->yim;
-}
-
-/**
- * Display the Yahoo! IM name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_yim
- * @since 0.71
- * @see get_the_author_yim()
- */
-function the_author_yim() {
-       echo get_the_author_yim();
-}
-
-/**
- * Retrieve the MSN address of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's MSN address.
- */
-function get_the_author_msn() {
-       global $authordata;
-       return $authordata->msn;
-}
-
-/**
- * Display the MSN address of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_msn
- * @since 0.71
- * @see get_the_author_msn()
- */
-function the_author_msn() {
-       echo get_the_author_msn();
-}
-
 /**
  * Retrieve the number of posts by the author of the current post.
  *
 /**
  * Retrieve the number of posts by the author of the current post.
  *
@@ -392,7 +181,7 @@ function the_author_posts_link($deprecated = '') {
        printf(
                '<a href="%1$s" title="%2$s">%3$s</a>',
                get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
        printf(
                '<a href="%1$s" title="%2$s">%3$s</a>',
                get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
-               sprintf( __( 'Posts by %s' ), attribute_escape( get_the_author() ) ),
+               sprintf( __( 'Posts by %s' ), esc_attr( get_the_author() ) ),
                get_the_author()
        );
 }
                get_the_author()
        );
 }
@@ -427,30 +216,26 @@ function get_author_posts_url($author_id, $author_nicename = '') {
        return $link;
 }
 
        return $link;
 }
 
-/**
- * Retrieve the specified author's preferred display name.
- *
- * @since 1.0.0
- * @param int $auth_id The ID of the author.
- * @return string The author's display name.
- */
-function get_author_name( $auth_id ) {
-       $authordata = get_userdata( $auth_id );
-       return $authordata->display_name;
-}
-
 /**
  * List all the authors of the blog, with several options available.
  *
 /**
  * List all the authors of the blog, with several options available.
  *
- * optioncount (boolean) (false): Show the count in parenthesis next to the
- *             author's name.
- * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by
- *             default.
- * show_fullname (boolean) (false): Show their full names.
- * hide_empty (boolean) (true): Don't show authors without any posts.
- * feed (string) (''): If isn't empty, show links to author's feeds.
- * feed_image (string) (''): If isn't empty, use this image to link to feeds.
- * echo (boolean) (true): Set to false to return the output, instead of echoing.
+ * <ul>
+ * <li>optioncount (boolean) (false): Show the count in parenthesis next to the
+ * author's name.</li>
+ * <li>exclude_admin (boolean) (true): Exclude the 'admin' user that is
+ * installed bydefault.</li>
+ * <li>show_fullname (boolean) (false): Show their full names.</li>
+ * <li>hide_empty (boolean) (true): Don't show authors without any posts.</li>
+ * <li>feed (string) (''): If isn't empty, show links to author's feeds.</li>
+ * <li>feed_image (string) (''): If isn't empty, use this image to link to
+ * feeds.</li>
+ * <li>echo (boolean) (true): Set to false to return the output, instead of
+ * echoing.</li>
+ * <li>style (string) ('list'): Whether to display list of authors in list form
+ * or as a string.</li>
+ * <li>html (bool) (true): Whether to list the items in html for or plaintext.
+ * </li>
+ * </ul>
  *
  * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
  * @since 1.2.0
  *
  * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
  * @since 1.2.0
@@ -463,12 +248,12 @@ function wp_list_authors($args = '') {
        $defaults = array(
                'optioncount' => false, 'exclude_admin' => true,
                'show_fullname' => false, 'hide_empty' => true,
        $defaults = array(
                'optioncount' => false, 'exclude_admin' => true,
                'show_fullname' => false, 'hide_empty' => true,
-               'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true
+               'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true,
+               'style' => 'list', 'html' => true
        );
 
        $r = wp_parse_args( $args, $defaults );
        extract($r, EXTR_SKIP);
        );
 
        $r = wp_parse_args( $args, $defaults );
        extract($r, EXTR_SKIP);
-
        $return = '';
 
        /** @todo Move select to get_authors(). */
        $return = '';
 
        /** @todo Move select to get_authors(). */
@@ -480,6 +265,9 @@ function wp_list_authors($args = '') {
        }
 
        foreach ( (array) $authors as $author ) {
        }
 
        foreach ( (array) $authors as $author ) {
+
+               $link = '';
+
                $author = get_userdata( $author->ID );
                $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
                $name = $author->display_name;
                $author = get_userdata( $author->ID );
                $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
                $name = $author->display_name;
@@ -487,13 +275,24 @@ function wp_list_authors($args = '') {
                if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
                        $name = "$author->first_name $author->last_name";
 
                if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
                        $name = "$author->first_name $author->last_name";
 
-               if ( !($posts == 0 && $hide_empty) )
+               if( !$html ) {
+                       if ( $posts == 0 ) {
+                               if ( ! $hide_empty )
+                                       $return .= $name . ', ';
+                       } else
+                               $return .= $name . ', ';
+
+                       // No need to go further to process HTML.
+                       continue;
+               }
+
+               if ( !($posts == 0 && $hide_empty) && 'list' == $style )
                        $return .= '<li>';
                if ( $posts == 0 ) {
                        $return .= '<li>';
                if ( $posts == 0 ) {
-                       if ( !$hide_empty )
+                       if ( ! $hide_empty )
                                $link = $name;
                } else {
                                $link = $name;
                } else {
-                       $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), attribute_escape($author->display_name)) . '">' . $name . '</a>';
+                       $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), esc_attr($author->display_name)) . '">' . $name . '</a>';
 
                        if ( (! empty($feed_image)) || (! empty($feed)) ) {
                                $link .= ' ';
 
                        if ( (! empty($feed_image)) || (! empty($feed)) ) {
                                $link .= ' ';
@@ -526,10 +325,15 @@ function wp_list_authors($args = '') {
 
                }
 
 
                }
 
-               if ( !($posts == 0 && $hide_empty) )
+               if ( !($posts == 0 && $hide_empty) && 'list' == $style )
                        $return .= $link . '</li>';
                        $return .= $link . '</li>';
+               else if ( ! $hide_empty )
+                       $return .= $link . ', ';
        }
        }
-       if ( !$echo )
+
+       $return = trim($return, ', ');
+
+       if ( ! $echo )
                return $return;
        echo $return;
 }
                return $return;
        echo $return;
 }
index 844f664f772a4b8633105e516ba99635df4371aa..bb4f6ef37aacb19c02d5b2b60152c5de81c97744 100644 (file)
@@ -70,14 +70,10 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 
                $the_link = '#';
                if ( !empty($bookmark->link_url) )
 
                $the_link = '#';
                if ( !empty($bookmark->link_url) )
-                       $the_link = clean_url($bookmark->link_url);
+                       $the_link = esc_url($bookmark->link_url);
 
 
-               $rel = $bookmark->link_rel;
-               if ( '' != $rel )
-                       $rel = ' rel="' . $rel . '"';
-
-               $desc = attribute_escape(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display'));
-               $name = attribute_escape(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display'));
+               $desc = esc_attr(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display'));
+               $name = esc_attr(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display'));
                $title = $desc;
 
                if ( $show_updated )
                $title = $desc;
 
                if ( $show_updated )
@@ -87,26 +83,31 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
                                $title .= ')';
                        }
 
                                $title .= ')';
                        }
 
+               $alt = ' alt="' . $name . ( $show_description ? ' ' . $title : '' ) . '"';
+
                if ( '' != $title )
                        $title = ' title="' . $title . '"';
 
                if ( '' != $title )
                        $title = ' title="' . $title . '"';
 
-               $alt = ' alt="' . $name . '"';
+               $rel = $bookmark->link_rel;
+               if ( '' != $rel )
+                       $rel = ' rel="' . $rel . '"';
 
                $target = $bookmark->link_target;
                if ( '' != $target )
                        $target = ' target="' . $target . '"';
 
 
                $target = $bookmark->link_target;
                if ( '' != $target )
                        $target = ' target="' . $target . '"';
 
-               $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
+               $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';
 
                $output .= $link_before;
 
                if ( $bookmark->link_image != null && $show_images ) {
 
                $output .= $link_before;
 
                if ( $bookmark->link_image != null && $show_images ) {
-                       if ( strpos($bookmark->link_image, 'http') !== false )
+                       if ( strpos($bookmark->link_image, 'http') === 0 )
                                $output .= "<img src=\"$bookmark->link_image\" $alt $title />";
                        else // If it's a relative path
                                $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />";
 
                                $output .= "<img src=\"$bookmark->link_image\" $alt $title />";
                        else // If it's a relative path
                                $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />";
 
-                       if ($show_name) $output .= $name;
+                       if ( $show_name )
+                               $output .= " $name";
                } else {
                        $output .= $name;
                }
                } else {
                        $output .= $name;
                }
@@ -121,9 +122,8 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
                if ( $show_description && '' != $desc )
                        $output .= $between . $desc;
 
                if ( $show_description && '' != $desc )
                        $output .= $between . $desc;
 
-               if ($show_rating) {
+               if ( $show_rating )
                        $output .= $between . sanitize_bookmark_field('link_rating', $bookmark->link_rating, $bookmark->link_id, 'display');
                        $output .= $between . sanitize_bookmark_field('link_rating', $bookmark->link_rating, $bookmark->link_id, 'display');
-               }
 
                $output .= "$after\n";
        } // end while
 
                $output .= "$after\n";
        } // end while
index 3a04a5cd6ec3d08250e5ab8572d91f1e4f96c69b..81df5a796d9daf028dae6a344e6585afc505a5f9 100644 (file)
@@ -142,10 +142,15 @@ function get_bookmarks($args = '') {
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );
 
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );
 
+       $cache = array();
        $key = md5( serialize( $r ) );
        $key = md5( serialize( $r ) );
-       if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) )
-               if ( isset( $cache[ $key ] ) )
+       if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
+               if ( is_array($cache) && isset( $cache[ $key ] ) )
                        return apply_filters('get_bookmarks', $cache[ $key ], $r );
                        return apply_filters('get_bookmarks', $cache[ $key ], $r );
+       }
+
+       if ( !is_array($cache) )
+               $cache = array();
 
        $inclusions = '';
        if ( !empty($include) ) {
 
        $inclusions = '';
        if ( !empty($include) ) {
@@ -180,9 +185,14 @@ function get_bookmarks($args = '') {
        if (!empty($exclusions))
                $exclusions .= ')';
 
        if (!empty($exclusions))
                $exclusions .= ')';
 
-       if ( ! empty($category_name) ) {
-               if ( $category = get_term_by('name', $category_name, 'link_category') )
+       if ( !empty($category_name) ) {
+               if ( $category = get_term_by('name', $category_name, 'link_category') ) {
                        $category = $category->term_id;
                        $category = $category->term_id;
+               } else {
+                       $cache[ $key ] = array();
+                       wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
+                       return apply_filters( 'get_bookmarks', array(), $r );
+               }
        }
 
        if ( ! empty($search) ) {
        }
 
        if ( ! empty($search) ) {
@@ -335,7 +345,7 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
                if ( in_array($field, $format_to_edit) ) {
                        $value = format_to_edit($value);
                } else {
                if ( in_array($field, $format_to_edit) ) {
                        $value = format_to_edit($value);
                } else {
-                       $value = attribute_escape($value);
+                       $value = esc_attr($value);
                }
        } else if ( 'db' == $context ) {
                $value = apply_filters("pre_$field", $value);
                }
        } else if ( 'db' == $context ) {
                $value = apply_filters("pre_$field", $value);
@@ -345,9 +355,9 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
        }
 
        if ( 'attribute' == $context )
        }
 
        if ( 'attribute' == $context )
-               $value = attribute_escape($value);
+               $value = esc_attr($value);
        else if ( 'js' == $context )
        else if ( 'js' == $context )
-               $value = js_escape($value);
+               $value = esc_js($value);
 
        return $value;
 }
 
        return $value;
 }
index 3fc9f0da87bb69ffa5724dca2cb291d2c28b54ce..c17e2f13258049fecfe19bc08c4c0ff98a54a618 100644 (file)
@@ -279,7 +279,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                        $redirect_url .= '?' . $redirect['query'];
        }
 
                        $redirect_url .= '?' . $redirect['query'];
        }
 
-       if ( !$redirect_url || $redirect_url == $requested_url )
+       if ( $redirect_url == $requested_url )
                return false;
 
        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
                return false;
 
        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
index ab6ec3524d7e9a813673337207c4b4018bf3cc51..cccd68daba7441ab92637656a1bc043d13661054 100644 (file)
@@ -534,9 +534,9 @@ class WP_User {
                $this->allcaps = array();
                foreach ( (array) $this->roles as $role ) {
                        $role =& $wp_roles->get_role( $role );
                $this->allcaps = array();
                foreach ( (array) $this->roles as $role ) {
                        $role =& $wp_roles->get_role( $role );
-                       $this->allcaps = array_merge( $this->allcaps, $role->capabilities );
+                       $this->allcaps = array_merge( (array) $this->allcaps, (array) $role->capabilities );
                }
                }
-               $this->allcaps = array_merge( $this->allcaps, $this->caps );
+               $this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps );
        }
 
        /**
        }
 
        /**
@@ -905,7 +905,7 @@ function map_meta_cap( $cap, $user_id ) {
                $caps[] = $cap;
        }
 
                $caps[] = $cap;
        }
 
-       return $caps;
+       return apply_filters('map_meta_cap', $caps, $cap, $user_id, $args);
 }
 
 /**
 }
 
 /**
index 5d2240d0ba732807946ff73f8a23bfcb7aea1c53..61f2faf1aa53ece138c28a4b9ffc0824fe7dc5d7 100644 (file)
@@ -6,40 +6,6 @@
  * @subpackage Template
  */
 
  * @subpackage Template
  */
 
-/**
- * Retrieve category children list separated before and after the term IDs.
- *
- * @since 1.2.0
- *
- * @param int $id Category ID to retrieve children.
- * @param string $before Optional. Prepend before category term ID.
- * @param string $after Optional, default is empty string. Append after category term ID.
- * @param array $visited Optional. Category Term IDs that have already been added.
- * @return string
- */
-function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
-       if ( 0 == $id )
-               return '';
-
-       $chain = '';
-       /** TODO: consult hierarchy */
-       $cat_ids = get_all_category_ids();
-       foreach ( (array) $cat_ids as $cat_id ) {
-               if ( $cat_id == $id )
-                       continue;
-
-               $category = get_category( $cat_id );
-               if ( is_wp_error( $category ) )
-                       return $category;
-               if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
-                       $visited[] = $category->term_id;
-                       $chain .= $before.$category->term_id.$after;
-                       $chain .= get_category_children( $category->term_id, $before, $after );
-               }
-       }
-       return $chain;
-}
-
 /**
  * Retrieve category link URL.
  *
 /**
  * Retrieve category link URL.
  *
@@ -327,11 +293,7 @@ function the_category( $separator = '', $parents='', $post_id = false ) {
  * @return string Category description, available.
  */
 function category_description( $category = 0 ) {
  * @return string Category description, available.
  */
 function category_description( $category = 0 ) {
-       global $cat;
-       if ( !$category )
-               $category = $cat;
-
-       return get_term_field( 'description', $category, 'category' );
+       return term_description( $category, 'category' );
 }
 
 /**
 }
 
 /**
@@ -370,7 +332,7 @@ function category_description( $category = 0 ) {
 function wp_dropdown_categories( $args = '' ) {
        $defaults = array(
                'show_option_all' => '', 'show_option_none' => '',
 function wp_dropdown_categories( $args = '' ) {
        $defaults = array(
                'show_option_all' => '', 'show_option_none' => '',
-               'orderby' => 'ID', 'order' => 'ASC',
+               'orderby' => 'id', 'order' => 'ASC',
                'show_last_update' => 0, 'show_count' => 0,
                'hide_empty' => 1, 'child_of' => 0,
                'exclude' => '', 'echo' => 1,
                'show_last_update' => 0, 'show_count' => 0,
                'hide_empty' => 1, 'child_of' => 0,
                'exclude' => '', 'echo' => 1,
@@ -560,20 +522,20 @@ function wp_tag_cloud( $args = '' ) {
        $defaults = array(
                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
                'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
        $defaults = array(
                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
                'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
-               'exclude' => '', 'include' => '', 'link' => 'view'
+               'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true
        );
        $args = wp_parse_args( $args, $defaults );
 
        );
        $args = wp_parse_args( $args, $defaults );
 
-       $tags = get_tags( array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
+       $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
 
        if ( empty( $tags ) )
                return;
 
        foreach ( $tags as $key => $tag ) {
                if ( 'edit' == $args['link'] )
 
        if ( empty( $tags ) )
                return;
 
        foreach ( $tags as $key => $tag ) {
                if ( 'edit' == $args['link'] )
-                       $link = get_edit_tag_link( $tag->term_id );
+                       $link = get_edit_tag_link( $tag->term_id, $args['taxonomy'] );
                else
                else
-                       $link = get_tag_link( $tag->term_id );
+                       $link = get_term_link( intval($tag->term_id), $args['taxonomy'] );
                if ( is_wp_error( $link ) )
                        return false;
 
                if ( is_wp_error( $link ) )
                        return false;
 
@@ -585,7 +547,7 @@ function wp_tag_cloud( $args = '' ) {
 
        $return = apply_filters( 'wp_tag_cloud', $return, $args );
 
 
        $return = apply_filters( 'wp_tag_cloud', $return, $args );
 
-       if ( 'array' == $args['format'] )
+       if ( 'array' == $args['format'] || empty($args['echo']) )
                return $return;
 
        echo $return;
                return $return;
 
        echo $return;
@@ -598,7 +560,7 @@ function wp_tag_cloud( $args = '' ) {
  * @return string text for the tooltip of a tag link.
  */
 function default_topic_count_text( $count ) {
  * @return string text for the tooltip of a tag link.
  */
 function default_topic_count_text( $count ) {
-       return sprintf( __ngettext('%s topic', '%s topics', $count), number_format_i18n( $count ) );
+       return sprintf( _n('%s topic', '%s topics', $count), number_format_i18n( $count ) );
 }
 
 /**
 }
 
 /**
@@ -611,6 +573,9 @@ function default_topic_count_text( $count ) {
  * 'format' argument will format the tags in a UL HTML list. The array value for
  * the 'format' argument will return in PHP array type format.
  *
  * 'format' argument will format the tags in a UL HTML list. The array value for
  * the 'format' argument will return in PHP array type format.
  *
+ * The 'tag_cloud_sort' filter allows you to override the sorting done
+ * by the 'orderby' argument; passed to the filter: $tags array and $args array.
+ *
  * The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
  * The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC' or
  * 'RAND'.
  * The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
  * The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC' or
  * 'RAND'.
@@ -634,11 +599,12 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
                'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
                'topic_count_text_callback' => 'default_topic_count_text',
                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
                'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
                'topic_count_text_callback' => 'default_topic_count_text',
+               'filter' => 1,
        );
 
        if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
                $body = 'return sprintf (
        );
 
        if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
                $body = 'return sprintf (
-                       __ngettext('.var_export($args['single_text'], true).', '.var_export($args['multiple_text'], true).', $count),
+                       _n('.var_export($args['single_text'], true).', '.var_export($args['multiple_text'], true).', $count),
                        number_format_i18n( $count ));';
                $args['topic_count_text_callback'] = create_function('$count', $body);
        }
                        number_format_i18n( $count ));';
                $args['topic_count_text_callback'] = create_function('$count', $body);
        }
@@ -656,13 +622,18 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
        else
                uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') );
 
        else
                uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') );
 
+        $tags = apply_filters( 'tag_cloud_sort', $tags, $args );
+
        if ( 'DESC' == $order )
                $tags = array_reverse( $tags, true );
        elseif ( 'RAND' == $order ) {
        if ( 'DESC' == $order )
                $tags = array_reverse( $tags, true );
        elseif ( 'RAND' == $order ) {
-               $keys = array_rand( $tags, count( $tags ) );
+               $keys = (array) array_rand( $tags, count( $tags ) );
+               $temp = array();
                foreach ( $keys as $key )
                        $temp[$key] = $tags[$key];
                foreach ( $keys as $key )
                        $temp[$key] = $tags[$key];
+
                $tags = $temp;
                $tags = $temp;
+               $temp = null;
                unset( $temp );
        }
 
                unset( $temp );
        }
 
@@ -688,10 +659,10 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
 
        foreach ( $tags as $key => $tag ) {
                $count = $counts[ $key ];
 
        foreach ( $tags as $key => $tag ) {
                $count = $counts[ $key ];
-               $tag_link = '#' != $tag->link ? clean_url( $tag->link ) : '#';
+               $tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#';
                $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
                $tag_name = $tags[ $key ]->name;
                $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
                $tag_name = $tags[ $key ]->name;
-               $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( $topic_count_text_callback( $count ) ) . "'$rel style='font-size: " .
+               $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( $topic_count_text_callback( $count ) ) . "'$rel style='font-size: " .
                        ( $smallest + ( ( $count - $min_count ) * $font_step ) )
                        . "$unit;'>$tag_name</a>";
        }
                        ( $smallest + ( ( $count - $min_count ) * $font_step ) )
                        . "$unit;'>$tag_name</a>";
        }
@@ -710,7 +681,10 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
                break;
        endswitch;
 
                break;
        endswitch;
 
-       return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
+    if ( $filter )
+               return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
+    else
+               return $return;
 }
 
 //
 }
 
 //
@@ -810,7 +784,7 @@ function get_the_tags( $id = 0 ) {
  * @return string
  */
 function get_the_tag_list( $before = '', $sep = '', $after = '' ) {
  * @return string
  */
 function get_the_tag_list( $before = '', $sep = '', $after = '' ) {
-       return apply_filters( 'the_tags', get_the_term_list( 0, 'post_tag', $before, $sep, $after ) );
+       return apply_filters( 'the_tags', get_the_term_list( 0, 'post_tag', $before, $sep, $after ), $before, $sep, $after);
 }
 
 /**
 }
 
 /**
@@ -823,8 +797,40 @@ function get_the_tag_list( $before = '', $sep = '', $after = '' ) {
  * @param string $after Optional. After list.
  * @return string
  */
  * @param string $after Optional. After list.
  * @return string
  */
-function the_tags( $before = 'Tags: ', $sep = ', ', $after = '' ) {
-       return the_terms( 0, 'post_tag', $before, $sep, $after );
+function the_tags( $before = null, $sep = ', ', $after = '' ) {
+       if ( null === $before )
+               $before = __('Tags: ');
+       echo get_the_tag_list($before, $sep, $after);
+}
+
+/**
+ * Retrieve tag description.
+ *
+ * @since 2.8
+ *
+ * @param int $tag Optional. Tag ID. Will use global tag ID by default.
+ * @return string Tag description, available.
+ */
+function tag_description( $tag = 0 ) {
+       return term_description( $tag );
+}
+
+/**
+ * Retrieve term description.
+ *
+ * @since 2.8
+ *
+ * @param int $term Optional. Term ID. Will use global term ID by default.
+ * @return string Term description, available.
+ */
+function term_description( $term = 0, $taxonomy = 'post_tag' ) {
+       if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
+               global $wp_query;
+               $term = $wp_query->get_queried_object();
+               $taxonomy = $term->taxonomy;
+               $term = $term->term_id;
+       }
+       return get_term_field( 'description', $term, $taxonomy );
 }
 
 /**
 }
 
 /**
index fb81dfb2b774d03bd1324e963753ab5576ffc52e..372c4c70cb770d68c70ab815a898afdd82484635 100644 (file)
@@ -172,21 +172,6 @@ function get_cat_ID( $cat_name='General' ) {
 }
 
 
 }
 
 
-/**
- * Retrieve the category name by the category ID.
- *
- * @since 0.71
- * @deprecated Use get_cat_name()
- * @see get_cat_name() get_catname() is deprecated in favor of get_cat_name().
- *
- * @param int $cat_ID Category ID
- * @return string category name
- */
-function get_catname( $cat_ID ) {
-       return get_cat_name( $cat_ID );
-}
-
-
 /**
  * Retrieve the name of a category from its ID.
  *
 /**
  * Retrieve the name of a category from its ID.
  *
@@ -215,14 +200,13 @@ function get_cat_name( $cat_id ) {
  * @return bool Whether $cat2 is child of $cat1
  */
 function cat_is_ancestor_of( $cat1, $cat2 ) {
  * @return bool Whether $cat2 is child of $cat1
  */
 function cat_is_ancestor_of( $cat1, $cat2 ) {
-       if ( is_int( $cat1 ) )
+       if ( ! isset($cat1->term_id) )
                $cat1 = &get_category( $cat1 );
                $cat1 = &get_category( $cat1 );
-       if ( is_int( $cat2 ) )
+       if ( ! isset($cat2->parent) )
                $cat2 = &get_category( $cat2 );
 
                $cat2 = &get_category( $cat2 );
 
-       if ( !$cat1->term_id || !$cat2->parent )
+       if ( empty($cat1->term_id) || empty($cat2->parent) )
                return false;
                return false;
-
        if ( $cat2->parent == $cat1->term_id )
                return true;
 
        if ( $cat2->parent == $cat1->term_id )
                return true;
 
index 63fc53eca0a00d2ef0c06a9cef4eb80918a0935d..a4bcfbd572a0904c942fd6de2ac860eef56e62af 100644 (file)
@@ -158,7 +158,7 @@ class IXR_Message {
     }
     function parse() {
         // first remove the XML declaration
     }
     function parse() {
         // first remove the XML declaration
-        $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
+        $this->message = preg_replace('/<\?xml.*?\?'.'>/', '', $this->message);
         if (trim($this->message) == '') {
             return false;
         }
         if (trim($this->message) == '') {
             return false;
         }
@@ -301,6 +301,7 @@ class IXR_Server {
         if (!$data) {
             global $HTTP_RAW_POST_DATA;
             if (!$HTTP_RAW_POST_DATA) {
         if (!$data) {
             global $HTTP_RAW_POST_DATA;
             if (!$HTTP_RAW_POST_DATA) {
+               header( 'Content-Type: text/plain' );
                die('XML-RPC server accepts POST requests only.');
             }
             $data = $HTTP_RAW_POST_DATA;
                die('XML-RPC server accepts POST requests only.');
             }
             $data = $HTTP_RAW_POST_DATA;
@@ -495,6 +496,7 @@ class IXR_Client {
     var $port;
     var $path;
     var $useragent;
     var $port;
     var $path;
     var $useragent;
+       var $headers;
     var $response;
     var $message = false;
     var $debug = false;
     var $response;
     var $message = false;
     var $debug = false;
@@ -528,14 +530,21 @@ class IXR_Client {
         $xml = $request->getXml();
         $r = "\r\n";
         $request  = "POST {$this->path} HTTP/1.0$r";
         $xml = $request->getXml();
         $r = "\r\n";
         $request  = "POST {$this->path} HTTP/1.0$r";
-        $request .= "Host: {$this->server}$r";
-        $request .= "Content-Type: text/xml$r";
-        $request .= "User-Agent: {$this->useragent}$r";
-        $request .= "Content-length: {$length}$r$r";
+
+               $this->headers['Host']                  = $this->server;
+               $this->headers['Content-Type']  = 'text/xml';
+               $this->headers['User-Agent']    = $this->useragent;
+               $this->headers['Content-Length']= $length;
+
+               foreach( $this->headers as $header => $value ) {
+                       $request .= "{$header}: {$value}{$r}";
+               }
+               $request .= $r;
+
         $request .= $xml;
         // Now send the request
         if ($this->debug) {
         $request .= $xml;
         // Now send the request
         if ($this->debug) {
-            echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n";
+            echo '<pre class="ixr_request">'.htmlspecialchars($request)."\n</pre>\n\n";
         }
         if ($this->timeout) {
             $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
         }
         if ($this->timeout) {
             $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
@@ -548,6 +557,7 @@ class IXR_Client {
         }
         fputs($fp, $request);
         $contents = '';
         }
         fputs($fp, $request);
         $contents = '';
+        $debug_contents = '';
         $gotFirstLine = false;
         $gettingHeaders = true;
         while (!feof($fp)) {
         $gotFirstLine = false;
         $gettingHeaders = true;
         while (!feof($fp)) {
@@ -555,7 +565,7 @@ class IXR_Client {
             if (!$gotFirstLine) {
                 // Check line for '200'
                 if (strstr($line, '200') === false) {
             if (!$gotFirstLine) {
                 // Check line for '200'
                 if (strstr($line, '200') === false) {
-                    $this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200');
+                    $this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200');
                     return false;
                 }
                 $gotFirstLine = true;
                     return false;
                 }
                 $gotFirstLine = true;
@@ -566,9 +576,12 @@ class IXR_Client {
             if (!$gettingHeaders) {
                 $contents .= trim($line);
             }
             if (!$gettingHeaders) {
                 $contents .= trim($line);
             }
+            if ($this->debug) {
+                $debug_contents .= $line;
+            }
         }
         if ($this->debug) {
         }
         if ($this->debug) {
-            echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n";
+            echo '<pre class="ixr_response">'.htmlspecialchars($debug_contents)."\n</pre>\n\n";
         }
         // Now parse what we've got back
         $this->message = new IXR_Message($contents);
         }
         // Now parse what we've got back
         $this->message = new IXR_Message($contents);
diff --git a/wp-includes/class-feed.php b/wp-includes/class-feed.php
new file mode 100644 (file)
index 0000000..7012439
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+
+if ( !class_exists('SimplePie') )
+       require_once (ABSPATH . WPINC . '/class-simplepie.php');
+
+class WP_Feed_Cache extends SimplePie_Cache {
+       /**
+        * Don't call the constructor. Please.
+        *
+        * @access private
+        */
+       function WP_Feed_Cache() {
+               trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
+       }
+
+       /**
+        * Create a new SimplePie_Cache object
+        *
+        * @static
+        * @access public
+        */
+       function create($location, $filename, $extension) {
+               return new WP_Feed_Cache_Transient($location, $filename, $extension);
+       }
+}
+
+class WP_Feed_Cache_Transient {
+       var $name;
+       var $mod_name;
+       var $lifetime = 43200; //Default lifetime in cache of 12 hours
+
+       function WP_Feed_Cache_Transient($location, $filename, $extension) {
+               $this->name = 'feed_' . $filename;
+               $this->mod_name = 'feed_mod_' . $filename;
+               $this->lifetime = apply_filters('wp_feed_cache_transient_lifetime', $this->lifetime);
+       }
+
+       function save($data) {
+               if ( is_a($data, 'SimplePie') )
+                       $data = $data->data;
+
+               set_transient($this->name, $data, $this->lifetime);
+               set_transient($this->mod_name, time(), $this->lifetime);
+               return true;
+       }
+
+       function load() {
+               return get_transient($this->name);
+       }
+
+       function mtime() {
+               return get_transient($this->mod_name);
+       }
+
+       function touch() {
+               return set_transient($this->mod_name, time(), $this->lifetime);
+       }
+
+       function unlink() {
+               delete_transient($this->name);
+               delete_transient($this->mod_name);
+               return true;
+       }
+}
+
+class WP_SimplePie_File extends SimplePie_File {
+
+       function WP_SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) {
+               $this->url = $url;
+               $this->timeout = $timeout;
+               $this->redirects = $redirects;
+               $this->headers = $headers;
+               $this->useragent = $useragent;
+
+               $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE;
+
+               if ( preg_match('/^http(s)?:\/\//i', $url) ) {
+                       $args = array( 'timeout' => $this->timeout, 'redirection' => $this->redirects);
+
+                       if ( !empty($this->headers) )
+                               $args['headers'] = $this->headers;
+
+                       if ( SIMPLEPIE_USERAGENT != $this->useragent ) //Use default WP user agent unless custom has been specified
+                               $args['user-agent'] = $this->useragent;
+
+                       $res = wp_remote_request($url, $args);
+
+                       if ( is_wp_error($res) ) {
+                               $this->error = 'WP HTTP Error: ' . $res->get_error_message();
+                               $this->success = false;
+                       } else {
+                               $this->headers = $res['headers'];
+                               $this->body = $res['body'];
+                               $this->status_code = $res['response']['code'];
+                       }
+               } else {
+                       if ( ! $this->body = file_get_contents($url) ) {
+                               $this->error = 'file_get_contents could not read the file';
+                               $this->success = false;
+                       }
+               }
+       }
+}
\ No newline at end of file
index 25e5570a3f7269e1da4c9fb5c3cfe006c3ce1de9..e9fb2b080acc40010f5531e5b3a1d415bab584e9 100644 (file)
@@ -2,7 +2,7 @@
 /*~ class.phpmailer.php
 .---------------------------------------------------------------------------.
 |  Software: PHPMailer - PHP email class                                    |
 /*~ class.phpmailer.php
 .---------------------------------------------------------------------------.
 |  Software: PHPMailer - PHP email class                                    |
-|   Version: 2.0.2                                                          |
+|   Version: 2.0.4                                                          |
 |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
 |      Info: http://phpmailer.sourceforge.net                               |
 |   Support: http://sourceforge.net/projects/phpmailer/                     |
 |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
 |      Info: http://phpmailer.sourceforge.net                               |
 |   Support: http://sourceforge.net/projects/phpmailer/                     |
@@ -28,7 +28,7 @@
  * PHPMailer - PHP email transport class
  * @package PHPMailer
  * @author Andy Prevost
  * PHPMailer - PHP email transport class
  * @package PHPMailer
  * @author Andy Prevost
- * @copyright 2004 - 2008 Andy Prevost
+ * @copyright 2004 - 2009 Andy Prevost
  */
 
 class PHPMailer {
  */
 
 class PHPMailer {
@@ -139,7 +139,7 @@ class PHPMailer {
    * Holds PHPMailer version.
    * @var string
    */
    * Holds PHPMailer version.
    * @var string
    */
-  var $Version           = "2.0.2";
+  var $Version           = "2.0.4";
 
   /**
    * Sets the email address that a reading confirmation will be sent.
 
   /**
    * Sets the email address that a reading confirmation will be sent.
@@ -257,6 +257,7 @@ class PHPMailer {
   var $language        = array();
   var $error_count     = 0;
   var $LE              = "\n";
   var $language        = array();
   var $error_count     = 0;
   var $LE              = "\n";
+  var $sign_cert_file  = "";
   var $sign_key_file   = "";
   var $sign_key_pass   = "";
 
   var $sign_key_file   = "";
   var $sign_key_pass   = "";
 
@@ -649,8 +650,20 @@ class PHPMailer {
     } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
       include($lang_path.'phpmailer.lang-en.php');
     } else {
     } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
       include($lang_path.'phpmailer.lang-en.php');
     } else {
-      $this->SetError('Could not load language file');
-      return false;
+      $PHPMAILER_LANG = array();
+      $PHPMAILER_LANG["provide_address"]      = 'You must provide at least one ' .
+      $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+      $PHPMAILER_LANG["execute"]              = 'Could not execute: ';
+      $PHPMAILER_LANG["instantiate"]          = 'Could not instantiate mail function.';
+      $PHPMAILER_LANG["authenticate"]         = 'SMTP Error: Could not authenticate.';
+      $PHPMAILER_LANG["from_failed"]          = 'The following From address failed: ';
+      $PHPMAILER_LANG["recipients_failed"]    = 'SMTP Error: The following ' .
+      $PHPMAILER_LANG["data_not_accepted"]    = 'SMTP Error: Data not accepted.';
+      $PHPMAILER_LANG["connect_host"]         = 'SMTP Error: Could not connect to SMTP host.';
+      $PHPMAILER_LANG["file_access"]          = 'Could not access file: ';
+      $PHPMAILER_LANG["file_open"]            = 'File Error: Could not open file: ';
+      $PHPMAILER_LANG["encoding"]             = 'Unknown encoding: ';
+      $PHPMAILER_LANG["signing"]              = 'Signing Error: ';
     }
     $this->language = $PHPMAILER_LANG;
 
     }
     $this->language = $PHPMAILER_LANG;
 
@@ -864,9 +877,6 @@ class PHPMailer {
       } elseif (count($this->cc) == 0) {
         $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
       }
       } elseif (count($this->cc) == 0) {
         $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
       }
-      if(count($this->cc) > 0) {
-        $result .= $this->AddrAppend('Cc', $this->cc);
-      }
     }
 
     $from = array();
     }
 
     $from = array();
@@ -1007,9 +1017,13 @@ class PHPMailer {
       fclose($fp);
       $signed = tempnam("", "signed");
 
       fclose($fp);
       $signed = tempnam("", "signed");
 
-      if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
+      if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
         $fp = fopen($signed, "r");
         $result = fread($fp, filesize($this->sign_key_file));
         $fp = fopen($signed, "r");
         $result = fread($fp, filesize($this->sign_key_file));
+        $result = '';
+        while(!feof($fp)){
+          $result = $result . fread($fp, 1024);
+        }
         fclose($fp);
       } else {
         $this->SetError($this->Lang("signing").openssl_error_string());
         fclose($fp);
       } else {
         $this->SetError($this->Lang("signing").openssl_error_string());
@@ -1159,14 +1173,14 @@ class PHPMailer {
       $cid         = $this->attachment[$i][7];
 
       $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
       $cid         = $this->attachment[$i][7];
 
       $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
-      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
+      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
       $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
 
       if($disposition == 'inline') {
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
       }
 
       $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
 
       if($disposition == 'inline') {
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
       }
 
-      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
+      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
 
       /* Encode as string attachment */
       if($bString) {
 
       /* Encode as string attachment */
       if($bString) {
@@ -1399,7 +1413,16 @@ class PHPMailer {
       } // end of for
       $output .= $newline.$eol;
     } // end of while
       } // end of for
       $output .= $newline.$eol;
     } // end of while
-    return trim($output);
+    return $output;
+  }
+
+  /**
+   * Callback for converting to "=XX".
+   * @access private
+   * @return string
+   */
+  function EncodeQ_callback ($matches) {
+    return sprintf('=%02X', ord($matches[1]));
   }
 
   /**
   }
 
   /**
@@ -1413,15 +1436,18 @@ class PHPMailer {
 
     switch (strtolower($position)) {
       case 'phrase':
 
     switch (strtolower($position)) {
       case 'phrase':
-        $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+        $encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/",
+                                         array('PHPMailer', 'EncodeQ_callback'), $encoded);
         break;
       case 'comment':
         break;
       case 'comment':
-        $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+        $encoded = preg_replace_callback("/([\(\)\"])/",
+                                         array('PHPMailer', 'EncodeQ_callback'), $encoded);
+        break;
       case 'text':
       default:
         /* Replace every high ascii, control =, ? and _ characters */
       case 'text':
       default:
         /* Replace every high ascii, control =, ? and _ characters */
-        $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
-              "'='.sprintf('%02X', ord('\\1'))", $encoded);
+        $encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/',
+                                         array('PHPMailer', 'EncodeQ_callback'), $encoded);
         break;
     }
 
         break;
     }
 
@@ -1710,8 +1736,7 @@ class PHPMailer {
           $ext = $fileParts[1];
           $mimeType = $this->_mime_types($ext);
           if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
           $ext = $fileParts[1];
           $mimeType = $this->_mime_types($ext);
           if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
-          if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
-          $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
+          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
           if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
             $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
           }
           if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
             $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
           }
@@ -1722,7 +1747,7 @@ class PHPMailer {
     $this->Body = $message;
     $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
     if ( !empty($textMsg) && empty($this->AltBody) ) {
     $this->Body = $message;
     $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
     if ( !empty($textMsg) && empty($this->AltBody) ) {
-      $this->AltBody = $textMsg;
+      $this->AltBody = html_entity_decode($textMsg);
     }
     if ( empty($this->AltBody) ) {
       $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
     }
     if ( empty($this->AltBody) ) {
       $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
@@ -1736,93 +1761,92 @@ class PHPMailer {
    */
   function _mime_types($ext = '') {
     $mimes = array(
    */
   function _mime_types($ext = '') {
     $mimes = array(
-      'hqx'  =>  'application/mac-binhex40',
-      'cpt'   =>  'application/mac-compactpro',
-      'doc'   =>  'application/msword',
+      'ai'    =>  'application/postscript',
+      'aif'   =>  'audio/x-aiff',
+      'aifc'  =>  'audio/x-aiff',
+      'aiff'  =>  'audio/x-aiff',
+      'avi'   =>  'video/x-msvideo',
       'bin'   =>  'application/macbinary',
       'bin'   =>  'application/macbinary',
-      'dms'   =>  'application/octet-stream',
-      'lha'   =>  'application/octet-stream',
-      'lzh'   =>  'application/octet-stream',
-      'exe'   =>  'application/octet-stream',
+      'bmp'   =>  'image/bmp',
       'class' =>  'application/octet-stream',
       'class' =>  'application/octet-stream',
-      'psd'   =>  'application/octet-stream',
-      'so'    =>  'application/octet-stream',
-      'sea'   =>  'application/octet-stream',
-      'dll'   =>  'application/octet-stream',
-      'oda'   =>  'application/oda',
-      'pdf'   =>  'application/pdf',
-      'ai'    =>  'application/postscript',
-      'eps'   =>  'application/postscript',
-      'ps'    =>  'application/postscript',
-      'smi'   =>  'application/smil',
-      'smil'  =>  'application/smil',
-      'mif'   =>  'application/vnd.mif',
-      'xls'   =>  'application/vnd.ms-excel',
-      'ppt'   =>  'application/vnd.ms-powerpoint',
-      'wbxml' =>  'application/vnd.wap.wbxml',
-      'wmlc'  =>  'application/vnd.wap.wmlc',
+      'cpt'   =>  'application/mac-compactpro',
+      'css'   =>  'text/css',
       'dcr'   =>  'application/x-director',
       'dir'   =>  'application/x-director',
       'dcr'   =>  'application/x-director',
       'dir'   =>  'application/x-director',
-      'dxr'   =>  'application/x-director',
+      'dll'   =>  'application/octet-stream',
+      'dms'   =>  'application/octet-stream',
+      'doc'   =>  'application/msword',
       'dvi'   =>  'application/x-dvi',
       'dvi'   =>  'application/x-dvi',
+      'dxr'   =>  'application/x-director',
+      'eml'   =>  'message/rfc822',
+      'eps'   =>  'application/postscript',
+      'exe'   =>  'application/octet-stream',
+      'gif'   =>  'image/gif',
       'gtar'  =>  'application/x-gtar',
       'gtar'  =>  'application/x-gtar',
-      'php'   =>  'application/x-httpd-php',
-      'php4'  =>  'application/x-httpd-php',
-      'php3'  =>  'application/x-httpd-php',
-      'phtml' =>  'application/x-httpd-php',
-      'phps'  =>  'application/x-httpd-php-source',
+      'htm'   =>  'text/html',
+      'html'  =>  'text/html',
+      'jpe'   =>  'image/jpeg',
+      'jpeg'  =>  'image/jpeg',
+      'jpg'   =>  'image/jpeg',
+      'hqx'   =>  'application/mac-binhex40',
       'js'    =>  'application/x-javascript',
       'js'    =>  'application/x-javascript',
-      'swf'   =>  'application/x-shockwave-flash',
-      'sit'   =>  'application/x-stuffit',
-      'tar'   =>  'application/x-tar',
-      'tgz'   =>  'application/x-tar',
-      'xhtml' =>  'application/xhtml+xml',
-      'xht'   =>  'application/xhtml+xml',
-      'zip'   =>  'application/zip',
+      'lha'   =>  'application/octet-stream',
+      'log'   =>  'text/plain',
+      'lzh'   =>  'application/octet-stream',
       'mid'   =>  'audio/midi',
       'midi'  =>  'audio/midi',
       'mid'   =>  'audio/midi',
       'midi'  =>  'audio/midi',
-      'mpga'  =>  'audio/mpeg',
+      'mif'   =>  'application/vnd.mif',
+      'mov'   =>  'video/quicktime',
+      'movie' =>  'video/x-sgi-movie',
       'mp2'   =>  'audio/mpeg',
       'mp3'   =>  'audio/mpeg',
       'mp2'   =>  'audio/mpeg',
       'mp3'   =>  'audio/mpeg',
-      'aif'   =>  'audio/x-aiff',
-      'aiff'  =>  'audio/x-aiff',
-      'aifc'  =>  'audio/x-aiff',
+      'mpe'   =>  'video/mpeg',
+      'mpeg'  =>  'video/mpeg',
+      'mpg'   =>  'video/mpeg',
+      'mpga'  =>  'audio/mpeg',
+      'oda'   =>  'application/oda',
+      'pdf'   =>  'application/pdf',
+      'php'   =>  'application/x-httpd-php',
+      'php3'  =>  'application/x-httpd-php',
+      'php4'  =>  'application/x-httpd-php',
+      'phps'  =>  'application/x-httpd-php-source',
+      'phtml' =>  'application/x-httpd-php',
+      'png'   =>  'image/png',
+      'ppt'   =>  'application/vnd.ms-powerpoint',
+      'ps'    =>  'application/postscript',
+      'psd'   =>  'application/octet-stream',
+      'qt'    =>  'video/quicktime',
+      'ra'    =>  'audio/x-realaudio',
       'ram'   =>  'audio/x-pn-realaudio',
       'rm'    =>  'audio/x-pn-realaudio',
       'rpm'   =>  'audio/x-pn-realaudio-plugin',
       'ram'   =>  'audio/x-pn-realaudio',
       'rm'    =>  'audio/x-pn-realaudio',
       'rpm'   =>  'audio/x-pn-realaudio-plugin',
-      'ra'    =>  'audio/x-realaudio',
+      'rtf'   =>  'text/rtf',
+      'rtx'   =>  'text/richtext',
       'rv'    =>  'video/vnd.rn-realvideo',
       'rv'    =>  'video/vnd.rn-realvideo',
-      'wav'   =>  'audio/x-wav',
-      'bmp'   =>  'image/bmp',
-      'gif'   =>  'image/gif',
-      'jpeg'  =>  'image/jpeg',
-      'jpg'   =>  'image/jpeg',
-      'jpe'   =>  'image/jpeg',
-      'png'   =>  'image/png',
-      'tiff'  =>  'image/tiff',
-      'tif'   =>  'image/tiff',
-      'css'   =>  'text/css',
-      'html'  =>  'text/html',
-      'htm'   =>  'text/html',
+      'sea'   =>  'application/octet-stream',
       'shtml' =>  'text/html',
       'shtml' =>  'text/html',
-      'txt'   =>  'text/plain',
+      'sit'   =>  'application/x-stuffit',
+      'so'    =>  'application/octet-stream',
+      'smi'   =>  'application/smil',
+      'smil'  =>  'application/smil',
+      'swf'   =>  'application/x-shockwave-flash',
+      'tar'   =>  'application/x-tar',
       'text'  =>  'text/plain',
       'text'  =>  'text/plain',
-      'log'   =>  'text/plain',
-      'rtx'   =>  'text/richtext',
-      'rtf'   =>  'text/rtf',
-      'xml'   =>  'text/xml',
-      'xsl'   =>  'text/xml',
-      'mpeg'  =>  'video/mpeg',
-      'mpg'   =>  'video/mpeg',
-      'mpe'   =>  'video/mpeg',
-      'qt'    =>  'video/quicktime',
-      'mov'   =>  'video/quicktime',
-      'avi'   =>  'video/x-msvideo',
-      'movie' =>  'video/x-sgi-movie',
-      'doc'   =>  'application/msword',
+      'txt'   =>  'text/plain',
+      'tgz'   =>  'application/x-tar',
+      'tif'   =>  'image/tiff',
+      'tiff'  =>  'image/tiff',
+      'wav'   =>  'audio/x-wav',
+      'wbxml' =>  'application/vnd.wap.wbxml',
+      'wmlc'  =>  'application/vnd.wap.wmlc',
       'word'  =>  'application/msword',
       'word'  =>  'application/msword',
+      'xht'   =>  'application/xhtml+xml',
+      'xhtml' =>  'application/xhtml+xml',
       'xl'    =>  'application/excel',
       'xl'    =>  'application/excel',
-      'eml'   =>  'message/rfc822'
+      'xls'   =>  'application/vnd.ms-excel',
+      'xml'   =>  'text/xml',
+      'xsl'   =>  'text/xml',
+      'zip'   =>  'application/zip'
     );
     return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
   }
     );
     return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
   }
@@ -1886,7 +1910,8 @@ class PHPMailer {
    * @param string $key_filename Parameter File Name
    * @param string $key_pass Password for private key
    */
    * @param string $key_filename Parameter File Name
    * @param string $key_pass Password for private key
    */
-  function Sign($key_filename, $key_pass) {
+  function Sign($cert_filename, $key_filename, $key_pass) {
+    $this->sign_cert_file = $cert_filename;
     $this->sign_key_file = $key_filename;
     $this->sign_key_pass = $key_pass;
   }
     $this->sign_key_file = $key_filename;
     $this->sign_key_pass = $key_pass;
   }
diff --git a/wp-includes/class-simplepie.php b/wp-includes/class-simplepie.php
new file mode 100644 (file)
index 0000000..21cc5d2
--- /dev/null
@@ -0,0 +1,13672 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2008, Ryan Parman and Geoffrey Sneddon
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ *     * Redistributions of source code must retain the above copyright notice, this list of
+ *       conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above copyright notice, this list
+ *       of conditions and the following disclaimer in the documentation and/or other materials
+ *       provided with the distribution.
+ *
+ *     * Neither the name of the SimplePie Team nor the names of its contributors may be used
+ *       to endorse or promote products derived from this software without specific prior
+ *       written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
+ * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package SimplePie
+ * @version 1.1.3
+ * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @link http://simplepie.org/ SimplePie
+ * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @todo phpDoc comments
+ */
+
+/**
+ * SimplePie Name
+ */
+define('SIMPLEPIE_NAME', 'SimplePie');
+
+/**
+ * SimplePie Version
+ */
+define('SIMPLEPIE_VERSION', '1.1.3');
+
+/**
+ * SimplePie Build
+ */
+define('SIMPLEPIE_BUILD', 20081219);
+
+/**
+ * SimplePie Website URL
+ */
+define('SIMPLEPIE_URL', 'http://simplepie.org');
+
+/**
+ * SimplePie Useragent
+ * @see SimplePie::set_useragent()
+ */
+define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
+
+/**
+ * SimplePie Linkback
+ */
+define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
+
+/**
+ * No Autodiscovery
+ * @see SimplePie::set_autodiscovery_level()
+ */
+define('SIMPLEPIE_LOCATOR_NONE', 0);
+
+/**
+ * Feed Link Element Autodiscovery
+ * @see SimplePie::set_autodiscovery_level()
+ */
+define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1);
+
+/**
+ * Local Feed Extension Autodiscovery
+ * @see SimplePie::set_autodiscovery_level()
+ */
+define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2);
+
+/**
+ * Local Feed Body Autodiscovery
+ * @see SimplePie::set_autodiscovery_level()
+ */
+define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4);
+
+/**
+ * Remote Feed Extension Autodiscovery
+ * @see SimplePie::set_autodiscovery_level()
+ */
+define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8);
+
+/**
+ * Remote Feed Body Autodiscovery
+ * @see SimplePie::set_autodiscovery_level()
+ */
+define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16);
+
+/**
+ * All Feed Autodiscovery
+ * @see SimplePie::set_autodiscovery_level()
+ */
+define('SIMPLEPIE_LOCATOR_ALL', 31);
+
+/**
+ * No known feed type
+ */
+define('SIMPLEPIE_TYPE_NONE', 0);
+
+/**
+ * RSS 0.90
+ */
+define('SIMPLEPIE_TYPE_RSS_090', 1);
+
+/**
+ * RSS 0.91 (Netscape)
+ */
+define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2);
+
+/**
+ * RSS 0.91 (Userland)
+ */
+define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4);
+
+/**
+ * RSS 0.91 (both Netscape and Userland)
+ */
+define('SIMPLEPIE_TYPE_RSS_091', 6);
+
+/**
+ * RSS 0.92
+ */
+define('SIMPLEPIE_TYPE_RSS_092', 8);
+
+/**
+ * RSS 0.93
+ */
+define('SIMPLEPIE_TYPE_RSS_093', 16);
+
+/**
+ * RSS 0.94
+ */
+define('SIMPLEPIE_TYPE_RSS_094', 32);
+
+/**
+ * RSS 1.0
+ */
+define('SIMPLEPIE_TYPE_RSS_10', 64);
+
+/**
+ * RSS 2.0
+ */
+define('SIMPLEPIE_TYPE_RSS_20', 128);
+
+/**
+ * RDF-based RSS
+ */
+define('SIMPLEPIE_TYPE_RSS_RDF', 65);
+
+/**
+ * Non-RDF-based RSS (truly intended as syndication format)
+ */
+define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190);
+
+/**
+ * All RSS
+ */
+define('SIMPLEPIE_TYPE_RSS_ALL', 255);
+
+/**
+ * Atom 0.3
+ */
+define('SIMPLEPIE_TYPE_ATOM_03', 256);
+
+/**
+ * Atom 1.0
+ */
+define('SIMPLEPIE_TYPE_ATOM_10', 512);
+
+/**
+ * All Atom
+ */
+define('SIMPLEPIE_TYPE_ATOM_ALL', 768);
+
+/**
+ * All feed types
+ */
+define('SIMPLEPIE_TYPE_ALL', 1023);
+
+/**
+ * No construct
+ */
+define('SIMPLEPIE_CONSTRUCT_NONE', 0);
+
+/**
+ * Text construct
+ */
+define('SIMPLEPIE_CONSTRUCT_TEXT', 1);
+
+/**
+ * HTML construct
+ */
+define('SIMPLEPIE_CONSTRUCT_HTML', 2);
+
+/**
+ * XHTML construct
+ */
+define('SIMPLEPIE_CONSTRUCT_XHTML', 4);
+
+/**
+ * base64-encoded construct
+ */
+define('SIMPLEPIE_CONSTRUCT_BASE64', 8);
+
+/**
+ * IRI construct
+ */
+define('SIMPLEPIE_CONSTRUCT_IRI', 16);
+
+/**
+ * A construct that might be HTML
+ */
+define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
+
+/**
+ * All constructs
+ */
+define('SIMPLEPIE_CONSTRUCT_ALL', 63);
+
+/**
+ * PCRE for HTML attributes
+ */
+define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*');
+
+/**
+ * PCRE for XML attributes
+ */
+define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*');
+
+/**
+ * XML Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace');
+
+/**
+ * Atom 1.0 Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom');
+
+/**
+ * Atom 0.3 Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#');
+
+/**
+ * RDF Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
+
+/**
+ * RSS 0.90 Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/');
+
+/**
+ * RSS 1.0 Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/');
+
+/**
+ * RSS 1.0 Content Module Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/');
+
+/**
+ * RSS 2.0 Namespace
+ * (Stupid, I know, but I'm certain it will confuse people less with support.)
+ */
+define('SIMPLEPIE_NAMESPACE_RSS_20', '');
+
+/**
+ * DC 1.0 Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/');
+
+/**
+ * DC 1.1 Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/');
+
+/**
+ * W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#');
+
+/**
+ * GeoRSS Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss');
+
+/**
+ * Media RSS Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/');
+
+/**
+ * Wrong Media RSS Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
+
+/**
+ * iTunes RSS Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
+
+/**
+ * XHTML Namespace
+ */
+define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml');
+
+/**
+ * IANA Link Relations Registry
+ */
+define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/');
+
+/**
+ * Whether we're running on PHP5
+ */
+define('SIMPLEPIE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>='));
+
+/**
+ * No file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_NONE', 0);
+
+/**
+ * Remote file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
+
+/**
+ * Local file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
+
+/**
+ * fsockopen() file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
+
+/**
+ * cURL file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_CURL', 8);
+
+/**
+ * file_get_contents() file source
+ */
+define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
+
+/**
+ * SimplePie
+ *
+ * @package SimplePie
+ * @version "Razzleberry"
+ * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @todo Option for type of fetching (cache, not modified header, fetch, etc.)
+ */
+class SimplePie
+{
+       /**
+        * @var array Raw data
+        * @access private
+        */
+       var $data = array();
+
+       /**
+        * @var mixed Error string
+        * @access private
+        */
+       var $error;
+
+       /**
+        * @var object Instance of SimplePie_Sanitize (or other class)
+        * @see SimplePie::set_sanitize_class()
+        * @access private
+        */
+       var $sanitize;
+
+       /**
+        * @var string SimplePie Useragent
+        * @see SimplePie::set_useragent()
+        * @access private
+        */
+       var $useragent = SIMPLEPIE_USERAGENT;
+
+       /**
+        * @var string Feed URL
+        * @see SimplePie::set_feed_url()
+        * @access private
+        */
+       var $feed_url;
+
+       /**
+        * @var object Instance of SimplePie_File to use as a feed
+        * @see SimplePie::set_file()
+        * @access private
+        */
+       var $file;
+
+       /**
+        * @var string Raw feed data
+        * @see SimplePie::set_raw_data()
+        * @access private
+        */
+       var $raw_data;
+
+       /**
+        * @var int Timeout for fetching remote files
+        * @see SimplePie::set_timeout()
+        * @access private
+        */
+       var $timeout = 10;
+
+       /**
+        * @var bool Forces fsockopen() to be used for remote files instead
+        * of cURL, even if a new enough version is installed
+        * @see SimplePie::force_fsockopen()
+        * @access private
+        */
+       var $force_fsockopen = false;
+
+       /**
+        * @var bool Force the given data/URL to be treated as a feed no matter what
+        * it appears like
+        * @see SimplePie::force_feed()
+        * @access private
+        */
+       var $force_feed = false;
+
+       /**
+        * @var bool Enable/Disable XML dump
+        * @see SimplePie::enable_xml_dump()
+        * @access private
+        */
+       var $xml_dump = false;
+
+       /**
+        * @var bool Enable/Disable Caching
+        * @see SimplePie::enable_cache()
+        * @access private
+        */
+       var $cache = true;
+
+       /**
+        * @var int Cache duration (in seconds)
+        * @see SimplePie::set_cache_duration()
+        * @access private
+        */
+       var $cache_duration = 3600;
+
+       /**
+        * @var int Auto-discovery cache duration (in seconds)
+        * @see SimplePie::set_autodiscovery_cache_duration()
+        * @access private
+        */
+       var $autodiscovery_cache_duration = 604800; // 7 Days.
+
+       /**
+        * @var string Cache location (relative to executing script)
+        * @see SimplePie::set_cache_location()
+        * @access private
+        */
+       var $cache_location = './cache';
+
+       /**
+        * @var string Function that creates the cache filename
+        * @see SimplePie::set_cache_name_function()
+        * @access private
+        */
+       var $cache_name_function = 'md5';
+
+       /**
+        * @var bool Reorder feed by date descending
+        * @see SimplePie::enable_order_by_date()
+        * @access private
+        */
+       var $order_by_date = true;
+
+       /**
+        * @var mixed Force input encoding to be set to the follow value
+        * (false, or anything type-cast to false, disables this feature)
+        * @see SimplePie::set_input_encoding()
+        * @access private
+        */
+       var $input_encoding = false;
+
+       /**
+        * @var int Feed Autodiscovery Level
+        * @see SimplePie::set_autodiscovery_level()
+        * @access private
+        */
+       var $autodiscovery = SIMPLEPIE_LOCATOR_ALL;
+
+       /**
+        * @var string Class used for caching feeds
+        * @see SimplePie::set_cache_class()
+        * @access private
+        */
+       var $cache_class = 'SimplePie_Cache';
+
+       /**
+        * @var string Class used for locating feeds
+        * @see SimplePie::set_locator_class()
+        * @access private
+        */
+       var $locator_class = 'SimplePie_Locator';
+
+       /**
+        * @var string Class used for parsing feeds
+        * @see SimplePie::set_parser_class()
+        * @access private
+        */
+       var $parser_class = 'SimplePie_Parser';
+
+       /**
+        * @var string Class used for fetching feeds
+        * @see SimplePie::set_file_class()
+        * @access private
+        */
+       var $file_class = 'SimplePie_File';
+
+       /**
+        * @var string Class used for items
+        * @see SimplePie::set_item_class()
+        * @access private
+        */
+       var $item_class = 'SimplePie_Item';
+
+       /**
+        * @var string Class used for authors
+        * @see SimplePie::set_author_class()
+        * @access private
+        */
+       var $author_class = 'SimplePie_Author';
+
+       /**
+        * @var string Class used for categories
+        * @see SimplePie::set_category_class()
+        * @access private
+        */
+       var $category_class = 'SimplePie_Category';
+
+       /**
+        * @var string Class used for enclosures
+        * @see SimplePie::set_enclosures_class()
+        * @access private
+        */
+       var $enclosure_class = 'SimplePie_Enclosure';
+
+       /**
+        * @var string Class used for Media RSS <media:text> captions
+        * @see SimplePie::set_caption_class()
+        * @access private
+        */
+       var $caption_class = 'SimplePie_Caption';
+
+       /**
+        * @var string Class used for Media RSS <media:copyright>
+        * @see SimplePie::set_copyright_class()
+        * @access private
+        */
+       var $copyright_class = 'SimplePie_Copyright';
+
+       /**
+        * @var string Class used for Media RSS <media:credit>
+        * @see SimplePie::set_credit_class()
+        * @access private
+        */
+       var $credit_class = 'SimplePie_Credit';
+
+       /**
+        * @var string Class used for Media RSS <media:rating>
+        * @see SimplePie::set_rating_class()
+        * @access private
+        */
+       var $rating_class = 'SimplePie_Rating';
+
+       /**
+        * @var string Class used for Media RSS <media:restriction>
+        * @see SimplePie::set_restriction_class()
+        * @access private
+        */
+       var $restriction_class = 'SimplePie_Restriction';
+
+       /**
+        * @var string Class used for content-type sniffing
+        * @see SimplePie::set_content_type_sniffer_class()
+        * @access private
+        */
+       var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
+
+       /**
+        * @var string Class used for item sources.
+        * @see SimplePie::set_source_class()
+        * @access private
+        */
+       var $source_class = 'SimplePie_Source';
+
+       /**
+        * @var mixed Set javascript query string parameter (false, or
+        * anything type-cast to false, disables this feature)
+        * @see SimplePie::set_javascript()
+        * @access private
+        */
+       var $javascript = 'js';
+
+       /**
+        * @var int Maximum number of feeds to check with autodiscovery
+        * @see SimplePie::set_max_checked_feeds()
+        * @access private
+        */
+       var $max_checked_feeds = 10;
+
+       /**
+        * @var string Web-accessible path to the handler_favicon.php file.
+        * @see SimplePie::set_favicon_handler()
+        * @access private
+        */
+       var $favicon_handler = '';
+
+       /**
+        * @var string Web-accessible path to the handler_image.php file.
+        * @see SimplePie::set_image_handler()
+        * @access private
+        */
+       var $image_handler = '';
+
+       /**
+        * @var array Stores the URLs when multiple feeds are being initialized.
+        * @see SimplePie::set_feed_url()
+        * @access private
+        */
+       var $multifeed_url = array();
+
+       /**
+        * @var array Stores SimplePie objects when multiple feeds initialized.
+        * @access private
+        */
+       var $multifeed_objects = array();
+
+       /**
+        * @var array Stores the get_object_vars() array for use with multifeeds.
+        * @see SimplePie::set_feed_url()
+        * @access private
+        */
+       var $config_settings = null;
+
+       /**
+        * @var integer Stores the number of items to return per-feed with multifeeds.
+        * @see SimplePie::set_item_limit()
+        * @access private
+        */
+       var $item_limit = 0;
+
+       /**
+        * @var array Stores the default attributes to be stripped by strip_attributes().
+        * @see SimplePie::strip_attributes()
+        * @access private
+        */
+       var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
+
+       /**
+        * @var array Stores the default tags to be stripped by strip_htmltags().
+        * @see SimplePie::strip_htmltags()
+        * @access private
+        */
+       var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
+
+       /**
+        * The SimplePie class contains feed level data and options
+        *
+        * There are two ways that you can create a new SimplePie object. The first
+        * is by passing a feed URL as a parameter to the SimplePie constructor
+        * (as well as optionally setting the cache location and cache expiry). This
+        * will initialise the whole feed with all of the default settings, and you
+        * can begin accessing methods and properties immediately.
+        *
+        * The second way is to create the SimplePie object with no parameters
+        * at all. This will enable you to set configuration options. After setting
+        * them, you must initialise the feed using $feed->init(). At that point the
+        * object's methods and properties will be available to you. This format is
+        * what is used throughout this documentation.
+        *
+        * @access public
+        * @since 1.0 Preview Release
+        * @param string $feed_url This is the URL you want to parse.
+        * @param string $cache_location This is where you want the cache to be stored.
+        * @param int $cache_duration This is the number of seconds that you want to store the cache file for.
+        */
+       function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null)
+       {
+               // Other objects, instances created here so we can set options on them
+               $this->sanitize =& new SimplePie_Sanitize;
+
+               // Set options if they're passed to the constructor
+               if ($cache_location !== null)
+               {
+                       $this->set_cache_location($cache_location);
+               }
+
+               if ($cache_duration !== null)
+               {
+                       $this->set_cache_duration($cache_duration);
+               }
+
+               // Only init the script if we're passed a feed URL
+               if ($feed_url !== null)
+               {
+                       $this->set_feed_url($feed_url);
+                       $this->init();
+               }
+       }
+
+       /**
+        * Used for converting object to a string
+        */
+       function __toString()
+       {
+               return md5(serialize($this->data));
+       }
+
+       /**
+        * Remove items that link back to this before destroying this object
+        */
+       function __destruct()
+       {
+               if (!empty($this->data['items']))
+               {
+                       foreach ($this->data['items'] as $item)
+                       {
+                               $item->__destruct();
+                       }
+                       unset($this->data['items']);
+               }
+               if (!empty($this->data['ordered_items']))
+               {
+                       foreach ($this->data['ordered_items'] as $item)
+                       {
+                               $item->__destruct();
+                       }
+                       unset($this->data['ordered_items']);
+               }
+       }
+
+       /**
+        * Force the given data/URL to be treated as a feed no matter what it
+        * appears like
+        *
+        * @access public
+        * @since 1.1
+        * @param bool $enable Force the given data/URL to be treated as a feed
+        */
+       function force_feed($enable = false)
+       {
+               $this->force_feed = (bool) $enable;
+       }
+
+       /**
+        * This is the URL of the feed you want to parse.
+        *
+        * This allows you to enter the URL of the feed you want to parse, or the
+        * website you want to try to use auto-discovery on. This takes priority
+        * over any set raw data.
+        *
+        * You can set multiple feeds to mash together by passing an array instead
+        * of a string for the $url. Remember that with each additional feed comes
+        * additional processing and resources.
+        *
+        * @access public
+        * @since 1.0 Preview Release
+        * @param mixed $url This is the URL (or array of URLs) that you want to parse.
+        * @see SimplePie::set_raw_data()
+        */
+       function set_feed_url($url)
+       {
+               if (is_array($url))
+               {
+                       $this->multifeed_url = array();
+                       foreach ($url as $value)
+                       {
+                               $this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1);
+                       }
+               }
+               else
+               {
+                       $this->feed_url = SimplePie_Misc::fix_protocol($url, 1);
+               }
+       }
+
+       /**
+        * Provides an instance of SimplePie_File to use as a feed
+        *
+        * @access public
+        * @param object &$file Instance of SimplePie_File (or subclass)
+        * @return bool True on success, false on failure
+        */
+       function set_file(&$file)
+       {
+               if (is_a($file, 'SimplePie_File'))
+               {
+                       $this->feed_url = $file->url;
+                       $this->file =& $file;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to use a string of RSS/Atom data instead of a remote feed.
+        *
+        * If you have a feed available as a string in PHP, you can tell SimplePie
+        * to parse that data string instead of a remote feed. Any set feed URL
+        * takes precedence.
+        *
+        * @access public
+        * @since 1.0 Beta 3
+        * @param string $data RSS or Atom data as a string.
+        * @see SimplePie::set_feed_url()
+        */
+       function set_raw_data($data)
+       {
+               $this->raw_data = $data;
+       }
+
+       /**
+        * Allows you to override the default timeout for fetching remote feeds.
+        *
+        * This allows you to change the maximum time the feed's server to respond
+        * and send the feed back.
+        *
+        * @access public
+        * @since 1.0 Beta 3
+        * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed.
+        */
+       function set_timeout($timeout = 10)
+       {
+               $this->timeout = (int) $timeout;
+       }
+
+       /**
+        * Forces SimplePie to use fsockopen() instead of the preferred cURL
+        * functions.
+        *
+        * @access public
+        * @since 1.0 Beta 3
+        * @param bool $enable Force fsockopen() to be used
+        */
+       function force_fsockopen($enable = false)
+       {
+               $this->force_fsockopen = (bool) $enable;
+       }
+
+       /**
+        * Outputs the raw XML content of the feed, after it has gone through
+        * SimplePie's filters.
+        *
+        * Used only for debugging, this function will output the XML content as
+        * text/xml. When SimplePie reads in a feed, it does a bit of cleaning up
+        * before trying to parse it. Many parts of the feed are re-written in
+        * memory, and in the end, you have a parsable feed. XML dump shows you the
+        * actual XML that SimplePie tries to parse, which may or may not be very
+        * different from the original feed.
+        *
+        * @access public
+        * @since 1.0 Preview Release
+        * @param bool $enable Enable XML dump
+        */
+       function enable_xml_dump($enable = false)
+       {
+               $this->xml_dump = (bool) $enable;
+       }
+
+       /**
+        * Enables/disables caching in SimplePie.
+        *
+        * This option allows you to disable caching all-together in SimplePie.
+        * However, disabling the cache can lead to longer load times.
+        *
+        * @access public
+        * @since 1.0 Preview Release
+        * @param bool $enable Enable caching
+        */
+       function enable_cache($enable = true)
+       {
+               $this->cache = (bool) $enable;
+       }
+
+       /**
+        * Set the length of time (in seconds) that the contents of a feed
+        * will be cached.
+        *
+        * @access public
+        * @param int $seconds The feed content cache duration.
+        */
+       function set_cache_duration($seconds = 3600)
+       {
+               $this->cache_duration = (int) $seconds;
+       }
+
+       /**
+        * Set the length of time (in seconds) that the autodiscovered feed
+        * URL will be cached.
+        *
+        * @access public
+        * @param int $seconds The autodiscovered feed URL cache duration.
+        */
+       function set_autodiscovery_cache_duration($seconds = 604800)
+       {
+               $this->autodiscovery_cache_duration = (int) $seconds;
+       }
+
+       /**
+        * Set the file system location where the cached files should be stored.
+        *
+        * @access public
+        * @param string $location The file system location.
+        */
+       function set_cache_location($location = './cache')
+       {
+               $this->cache_location = (string) $location;
+       }
+
+       /**
+        * Determines whether feed items should be sorted into reverse chronological order.
+        *
+        * @access public
+        * @param bool $enable Sort as reverse chronological order.
+        */
+       function enable_order_by_date($enable = true)
+       {
+               $this->order_by_date = (bool) $enable;
+       }
+
+       /**
+        * Allows you to override the character encoding reported by the feed.
+        *
+        * @access public
+        * @param string $encoding Character encoding.
+        */
+       function set_input_encoding($encoding = false)
+       {
+               if ($encoding)
+               {
+                       $this->input_encoding = (string) $encoding;
+               }
+               else
+               {
+                       $this->input_encoding = false;
+               }
+       }
+
+       /**
+        * Set how much feed autodiscovery to do
+        *
+        * @access public
+        * @see SIMPLEPIE_LOCATOR_NONE
+        * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY
+        * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION
+        * @see SIMPLEPIE_LOCATOR_LOCAL_BODY
+        * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION
+        * @see SIMPLEPIE_LOCATOR_REMOTE_BODY
+        * @see SIMPLEPIE_LOCATOR_ALL
+        * @param int $level Feed Autodiscovery Level (level can be a
+        * combination of the above constants, see bitwise OR operator)
+        */
+       function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
+       {
+               $this->autodiscovery = (int) $level;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for caching.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_cache_class($class = 'SimplePie_Cache')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache'))
+               {
+                       $this->cache_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for auto-discovery.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_locator_class($class = 'SimplePie_Locator')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator'))
+               {
+                       $this->locator_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for XML parsing.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_parser_class($class = 'SimplePie_Parser')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser'))
+               {
+                       $this->parser_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for remote file fetching.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_file_class($class = 'SimplePie_File')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File'))
+               {
+                       $this->file_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for data sanitization.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_sanitize_class($class = 'SimplePie_Sanitize')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize'))
+               {
+                       $this->sanitize =& new $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for handling feed items.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_item_class($class = 'SimplePie_Item')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item'))
+               {
+                       $this->item_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for handling author data.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_author_class($class = 'SimplePie_Author')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author'))
+               {
+                       $this->author_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for handling category data.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_category_class($class = 'SimplePie_Category')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category'))
+               {
+                       $this->category_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for feed enclosures.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_enclosure_class($class = 'SimplePie_Enclosure')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure'))
+               {
+                       $this->enclosure_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for <media:text> captions
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_caption_class($class = 'SimplePie_Caption')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption'))
+               {
+                       $this->caption_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for <media:copyright>
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_copyright_class($class = 'SimplePie_Copyright')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright'))
+               {
+                       $this->copyright_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for <media:credit>
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_credit_class($class = 'SimplePie_Credit')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit'))
+               {
+                       $this->credit_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for <media:rating>
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_rating_class($class = 'SimplePie_Rating')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating'))
+               {
+                       $this->rating_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for <media:restriction>
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_restriction_class($class = 'SimplePie_Restriction')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction'))
+               {
+                       $this->restriction_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses for content-type sniffing.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer'))
+               {
+                       $this->content_type_sniffer_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to change which class SimplePie uses item sources.
+        * Useful when you are overloading or extending SimplePie's default classes.
+        *
+        * @access public
+        * @param string $class Name of custom class.
+        * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
+        * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+        */
+       function set_source_class($class = 'SimplePie_Source')
+       {
+               if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source'))
+               {
+                       $this->source_class = $class;
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Allows you to override the default user agent string.
+        *
+        * @access public
+        * @param string $ua New user agent string.
+        */
+       function set_useragent($ua = SIMPLEPIE_USERAGENT)
+       {
+               $this->useragent = (string) $ua;
+       }
+
+       /**
+        * Set callback function to create cache filename with
+        *
+        * @access public
+        * @param mixed $function Callback function
+        */
+       function set_cache_name_function($function = 'md5')
+       {
+               if (is_callable($function))
+               {
+                       $this->cache_name_function = $function;
+               }
+       }
+
+       /**
+        * Set javascript query string parameter
+        *
+        * @access public
+        * @param mixed $get Javascript query string parameter
+        */
+       function set_javascript($get = 'js')
+       {
+               if ($get)
+               {
+                       $this->javascript = (string) $get;
+               }
+               else
+               {
+                       $this->javascript = false;
+               }
+       }
+
+       /**
+        * Set options to make SP as fast as possible.  Forgoes a
+        * substantial amount of data sanitization in favor of speed.
+        *
+        * @access public
+        * @param bool $set Whether to set them or not
+        */
+       function set_stupidly_fast($set = false)
+       {
+               if ($set)
+               {
+                       $this->enable_order_by_date(false);
+                       $this->remove_div(false);
+                       $this->strip_comments(false);
+                       $this->strip_htmltags(false);
+                       $this->strip_attributes(false);
+                       $this->set_image_handler(false);
+               }
+       }
+
+       /**
+        * Set maximum number of feeds to check with autodiscovery
+        *
+        * @access public
+        * @param int $max Maximum number of feeds to check
+        */
+       function set_max_checked_feeds($max = 10)
+       {
+               $this->max_checked_feeds = (int) $max;
+       }
+
+       function remove_div($enable = true)
+       {
+               $this->sanitize->remove_div($enable);
+       }
+
+       function strip_htmltags($tags = '', $encode = null)
+       {
+               if ($tags === '')
+               {
+                       $tags = $this->strip_htmltags;
+               }
+               $this->sanitize->strip_htmltags($tags);
+               if ($encode !== null)
+               {
+                       $this->sanitize->encode_instead_of_strip($tags);
+               }
+       }
+
+       function encode_instead_of_strip($enable = true)
+       {
+               $this->sanitize->encode_instead_of_strip($enable);
+       }
+
+       function strip_attributes($attribs = '')
+       {
+               if ($attribs === '')
+               {
+                       $attribs = $this->strip_attributes;
+               }
+               $this->sanitize->strip_attributes($attribs);
+       }
+
+       function set_output_encoding($encoding = 'UTF-8')
+       {
+               $this->sanitize->set_output_encoding($encoding);
+       }
+
+       function strip_comments($strip = false)
+       {
+               $this->sanitize->strip_comments($strip);
+       }
+
+       /**
+        * Set element/attribute key/value pairs of HTML attributes
+        * containing URLs that need to be resolved relative to the feed
+        *
+        * @access public
+        * @since 1.0
+        * @param array $element_attribute Element/attribute key/value pairs
+        */
+       function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite'))
+       {
+               $this->sanitize->set_url_replacements($element_attribute);
+       }
+
+       /**
+        * Set the handler to enable the display of cached favicons.
+        *
+        * @access public
+        * @param str $page Web-accessible path to the handler_favicon.php file.
+        * @param str $qs The query string that the value should be passed to.
+        */
+       function set_favicon_handler($page = false, $qs = 'i')
+       {
+               if ($page != false)
+               {
+                       $this->favicon_handler = $page . '?' . $qs . '=';
+               }
+               else
+               {
+                       $this->favicon_handler = '';
+               }
+       }
+
+       /**
+        * Set the handler to enable the display of cached images.
+        *
+        * @access public
+        * @param str $page Web-accessible path to the handler_image.php file.
+        * @param str $qs The query string that the value should be passed to.
+        */
+       function set_image_handler($page = false, $qs = 'i')
+       {
+               if ($page != false)
+               {
+                       $this->sanitize->set_image_handler($page . '?' . $qs . '=');
+               }
+               else
+               {
+                       $this->image_handler = '';
+               }
+       }
+
+       /**
+        * Set the limit for items returned per-feed with multifeeds.
+        *
+        * @access public
+        * @param integer $limit The maximum number of items to return.
+        */
+       function set_item_limit($limit = 0)
+       {
+               $this->item_limit = (int) $limit;
+       }
+
+       function init()
+       {
+               if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
+               {
+                       return false;
+               }
+               if (isset($_GET[$this->javascript]))
+               {
+                       if (function_exists('ob_gzhandler'))
+                       {
+                               ob_start('ob_gzhandler');
+                       }
+                       header('Content-type: text/javascript; charset: UTF-8');
+                       header('Cache-Control: must-revalidate');
+                       header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
+                       ?>
+function embed_odeo(link) {
+       document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
+}
+
+function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
+       if (placeholder != '') {
+               document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+       }
+       else {
+               document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+       }
+}
+
+function embed_flash(bgcolor, width, height, link, loop, type) {
+       document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
+}
+
+function embed_flv(width, height, link, placeholder, loop, player) {
+       document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
+}
+
+function embed_wmedia(width, height, link) {
+       document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
+}
+                       <?php
+                       exit;
+               }
+
+               // Pass whatever was set with config options over to the sanitizer.
+               $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class);
+               $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen);
+
+               if ($this->feed_url !== null || $this->raw_data !== null)
+               {
+                       $this->data = array();
+                       $this->multifeed_objects = array();
+                       $cache = false;
+
+                       if ($this->feed_url !== null)
+                       {
+                               $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url);
+                               // Decide whether to enable caching
+                               if ($this->cache && $parsed_feed_url['scheme'] !== '')
+                               {
+                                       $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
+                               }
+                               // If it's enabled and we don't want an XML dump, use the cache
+                               if ($cache && !$this->xml_dump)
+                               {
+                                       // Load the Cache
+                                       $this->data = $cache->load();
+                                       if (!empty($this->data))
+                                       {
+                                               // If the cache is for an outdated build of SimplePie
+                                               if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD)
+                                               {
+                                                       $cache->unlink();
+                                                       $this->data = array();
+                                               }
+                                               // If we've hit a collision just rerun it with caching disabled
+                                               elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url)
+                                               {
+                                                       $cache = false;
+                                                       $this->data = array();
+                                               }
+                                               // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL.
+                                               elseif (isset($this->data['feed_url']))
+                                               {
+                                                       // If the autodiscovery cache is still valid use it.
+                                                       if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
+                                                       {
+                                                               // Do not need to do feed autodiscovery yet.
+                                                               if ($this->data['feed_url'] == $this->data['url'])
+                                                               {
+                                                                       $cache->unlink();
+                                                                       $this->data = array();
+                                                               }
+                                                               else
+                                                               {
+                                                                       $this->set_feed_url($this->data['feed_url']);
+                                                                       return $this->init();
+                                                               }
+                                                       }
+                                               }
+                                               // Check if the cache has been updated
+                                               elseif ($cache->mtime() + $this->cache_duration < time())
+                                               {
+                                                       // If we have last-modified and/or etag set
+                                                       if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag']))
+                                                       {
+                                                               $headers = array();
+                                                               if (isset($this->data['headers']['last-modified']))
+                                                               {
+                                                                       $headers['if-modified-since'] = $this->data['headers']['last-modified'];
+                                                               }
+                                                               if (isset($this->data['headers']['etag']))
+                                                               {
+                                                                       $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"';
+                                                               }
+                                                               $file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen);
+                                                               if ($file->success)
+                                                               {
+                                                                       if ($file->status_code == 304)
+                                                                       {
+                                                                               $cache->touch();
+                                                                               return true;
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               $headers = $file->headers;
+                                                                       }
+                                                               }
+                                                               else
+                                                               {
+                                                                       unset($file);
+                                                               }
+                                                       }
+                                               }
+                                               // If the cache is still valid, just return true
+                                               else
+                                               {
+                                                       return true;
+                                               }
+                                       }
+                                       // If the cache is empty, delete it
+                                       else
+                                       {
+                                               $cache->unlink();
+                                               $this->data = array();
+                                       }
+                               }
+                               // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
+                               if (!isset($file))
+                               {
+                                       if (is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url)
+                                       {
+                                               $file =& $this->file;
+                                       }
+                                       else
+                                       {
+                                               $file =& new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen);
+                                       }
+                               }
+                               // If the file connection has an error, set SimplePie::error to that and quit
+                               if (!$file->success)
+                               {
+                                       $this->error = $file->error;
+                                       if (!empty($this->data))
+                                       {
+                                               return true;
+                                       }
+                                       else
+                                       {
+                                               return false;
+                                       }
+                               }
+
+                               if (!$this->force_feed)
+                               {
+                                       // Check if the supplied URL is a feed, if it isn't, look for it.
+                                       $locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
+                                       if (!$locate->is_feed($file))
+                                       {
+                                               // We need to unset this so that if SimplePie::set_file() has been called that object is untouched
+                                               unset($file);
+                                               if ($file = $locate->find($this->autodiscovery))
+                                               {
+                                                       if ($cache)
+                                                       {
+                                                               $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
+                                                               if (!$cache->save($this))
+                                                               {
+                                                                       trigger_error("$cache->name is not writeable", E_USER_WARNING);
+                                                               }
+                                                               $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
+                                                       }
+                                                       $this->feed_url = $file->url;
+                                               }
+                                               else
+                                               {
+                                                       $this->error = "A feed could not be found at $this->feed_url";
+                                                       SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+                                                       return false;
+                                               }
+                                       }
+                                       $locate = null;
+                               }
+
+                               $headers = $file->headers;
+                               $data = $file->body;
+                               $sniffer = new $this->content_type_sniffer_class($file);
+                               $sniffed = $sniffer->get_type();
+                       }
+                       else
+                       {
+                               $data = $this->raw_data;
+                       }
+
+                       // Set up array of possible encodings
+                       $encodings = array();
+
+                       // First check to see if input has been overridden.
+                       if ($this->input_encoding !== false)
+                       {
+                               $encodings[] = $this->input_encoding;
+                       }
+
+                       $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity');
+                       $text_types = array('text/xml', 'text/xml-external-parsed-entity');
+
+                       // RFC 3023 (only applies to sniffed content)
+                       if (isset($sniffed))
+                       {
+                               if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml')
+                               {
+                                       if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
+                                       {
+                                               $encodings[] = strtoupper($charset[1]);
+                                       }
+                                       $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
+                                       $encodings[] = 'UTF-8';
+                               }
+                               elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
+                               {
+                                       if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
+                                       {
+                                               $encodings[] = $charset[1];
+                                       }
+                                       $encodings[] = 'US-ASCII';
+                               }
+                               // Text MIME-type default
+                               elseif (substr($sniffed, 0, 5) === 'text/')
+                               {
+                                       $encodings[] = 'US-ASCII';
+                               }
+                       }
+
+                       // Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1
+                       $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
+                       $encodings[] = 'UTF-8';
+                       $encodings[] = 'ISO-8859-1';
+
+                       // There's no point in trying an encoding twice
+                       $encodings = array_unique($encodings);
+
+                       // If we want the XML, just output that with the most likely encoding and quit
+                       if ($this->xml_dump)
+                       {
+                               header('Content-type: text/xml; charset=' . $encodings[0]);
+                               echo $data;
+                               exit;
+                       }
+
+                       // Loop through each possible encoding, till we return something, or run out of possibilities
+                       foreach ($encodings as $encoding)
+                       {
+                               // Change the encoding to UTF-8 (as we always use UTF-8 internally)
+                               if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'))
+                               {
+                                       // Create new parser
+                                       $parser =& new $this->parser_class();
+
+                                       // If it's parsed fine
+                                       if ($parser->parse($utf8_data, 'UTF-8'))
+                                       {
+                                               $this->data = $parser->get_data();
+                                               if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE)
+                                               {
+                                                       if (isset($headers))
+                                                       {
+                                                               $this->data['headers'] = $headers;
+                                                       }
+                                                       $this->data['build'] = SIMPLEPIE_BUILD;
+
+                                                       // Cache the file if caching is enabled
+                                                       if ($cache && !$cache->save($this))
+                                                       {
+                                                               trigger_error("$cache->name is not writeable", E_USER_WARNING);
+                                                       }
+                                                       return true;
+                                               }
+                                               else
+                                               {
+                                                       $this->error = "A feed could not be found at $this->feed_url";
+                                                       SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+                                                       return false;
+                                               }
+                                       }
+                               }
+                       }
+                       // We have an error, just set SimplePie::error to it and quit
+                       $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
+                       SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
+                       return false;
+               }
+               elseif (!empty($this->multifeed_url))
+               {
+                       $i = 0;
+                       $success = 0;
+                       $this->multifeed_objects = array();
+                       foreach ($this->multifeed_url as $url)
+                       {
+                               if (SIMPLEPIE_PHP5)
+                               {
+                                       // This keyword needs to defy coding standards for PHP4 compatibility
+                                       $this->multifeed_objects[$i] = clone($this);
+                               }
+                               else
+                               {
+                                       $this->multifeed_objects[$i] = $this;
+                               }
+                               $this->multifeed_objects[$i]->set_feed_url($url);
+                               $success |= $this->multifeed_objects[$i]->init();
+                               $i++;
+                       }
+                       return (bool) $success;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+
+       /**
+        * Return the error message for the occured error
+        *
+        * @access public
+        * @return string Error message
+        */
+       function error()
+       {
+               return $this->error;
+       }
+
+       function get_encoding()
+       {
+               return $this->sanitize->output_encoding;
+       }
+
+       function handle_content_type($mime = 'text/html')
+       {
+               if (!headers_sent())
+               {
+                       $header = "Content-type: $mime;";
+                       if ($this->get_encoding())
+                       {
+                               $header .= ' charset=' . $this->get_encoding();
+                       }
+                       else
+                       {
+                               $header .= ' charset=UTF-8';
+                       }
+                       header($header);
+               }
+       }
+
+       function get_type()
+       {
+               if (!isset($this->data['type']))
+               {
+                       $this->data['type'] = SIMPLEPIE_TYPE_ALL;
+                       if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
+                       {
+                               $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10;
+                       }
+                       elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
+                       {
+                               $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03;
+                       }
+                       elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
+                       {
+                               if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
+                               || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
+                               || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
+                               || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
+                               {
+                                       $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10;
+                               }
+                               if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel'])
+                               || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
+                               || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
+                               || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
+                               {
+                                       $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
+                               }
+                       }
+                       elseif (isset($this->data['child']['']['rss']))
+                       {
+                               $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
+                               if (isset($this->data['child']['']['rss'][0]['attribs']['']['version']))
+                               {
+                                       switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version']))
+                                       {
+                                               case '0.91':
+                                                       $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
+                                                       if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+                                                       {
+                                                               switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+                                                               {
+                                                                       case '0':
+                                                                               $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
+                                                                               break;
+
+                                                                       case '24':
+                                                                               $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
+                                                                               break;
+                                                               }
+                                                       }
+                                                       break;
+
+                                               case '0.92':
+                                                       $this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
+                                                       break;
+
+                                               case '0.93':
+                                                       $this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
+                                                       break;
+
+                                               case '0.94':
+                                                       $this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
+                                                       break;
+
+                                               case '2.0':
+                                                       $this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
+                                                       break;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $this->data['type'] = SIMPLEPIE_TYPE_NONE;
+                       }
+               }
+               return $this->data['type'];
+       }
+
+       /**
+        * Returns the URL for the favicon of the feed's website.
+        *
+        * @todo Cache atom:icon
+        * @access public
+        * @since 1.0
+        */
+       function get_favicon()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif (($url = $this->get_link()) !== null && preg_match('/^http(s)?:\/\//i', $url))
+               {
+                       $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url);
+
+                       if ($this->cache && $this->favicon_handler)
+                       {
+                               $favicon_filename = call_user_func($this->cache_name_function, $favicon);
+                               $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi');
+
+                               if ($cache->load())
+                               {
+                                       return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
+                               }
+                               else
+                               {
+                                       $file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
+
+                                       if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
+                                       {
+                                               $sniffer = new $this->content_type_sniffer_class($file);
+                                               if (substr($sniffer->get_type(), 0, 6) === 'image/')
+                                               {
+                                                       if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+                                                       {
+                                                               return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
+                                                       }
+                                                       else
+                                                       {
+                                                               trigger_error("$cache->name is not writeable", E_USER_WARNING);
+                                                               return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * @todo If we have a perm redirect we should return the new URL
+        * @todo When we make the above change, let's support <itunes:new-feed-url> as well
+        * @todo Also, |atom:link|@rel=self
+        */
+       function subscribe_url()
+       {
+               if ($this->feed_url !== null)
+               {
+                       return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function subscribe_feed()
+       {
+               if ($this->feed_url !== null)
+               {
+                       return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function subscribe_outlook()
+       {
+               if ($this->feed_url !== null)
+               {
+                       return 'outlook' . $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function subscribe_podcast()
+       {
+               if ($this->feed_url !== null)
+               {
+                       return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 3), SIMPLEPIE_CONSTRUCT_IRI);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function subscribe_itunes()
+       {
+               if ($this->feed_url !== null)
+               {
+                       return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 4), SIMPLEPIE_CONSTRUCT_IRI);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * Creates the subscribe_* methods' return data
+        *
+        * @access private
+        * @param string $feed_url String to prefix to the feed URL
+        * @param string $site_url String to prefix to the site URL (and
+        * suffix to the feed URL)
+        * @return mixed URL if feed exists, false otherwise
+        */
+       function subscribe_service($feed_url, $site_url = null)
+       {
+               if ($this->subscribe_url())
+               {
+                       $return = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->feed_url);
+                       if ($site_url !== null && $this->get_link() !== null)
+                       {
+                               $return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link());
+                       }
+                       return $return;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function subscribe_aol()
+       {
+               return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url=');
+       }
+
+       function subscribe_bloglines()
+       {
+               return urldecode($this->subscribe_service('http://www.bloglines.com/sub/'));
+       }
+
+       function subscribe_eskobo()
+       {
+               return $this->subscribe_service('http://www.eskobo.com/?AddToMyPage=');
+       }
+
+       function subscribe_feedfeeds()
+       {
+               return $this->subscribe_service('http://www.feedfeeds.com/add?feed=');
+       }
+
+       function subscribe_feedster()
+       {
+               return $this->subscribe_service('http://www.feedster.com/myfeedster.php?action=addrss&confirm=no&rssurl=');
+       }
+
+       function subscribe_google()
+       {
+               return $this->subscribe_service('http://fusion.google.com/add?feedurl=');
+       }
+
+       function subscribe_gritwire()
+       {
+               return $this->subscribe_service('http://my.gritwire.com/feeds/addExternalFeed.aspx?FeedUrl=');
+       }
+
+       function subscribe_msn()
+       {
+               return $this->subscribe_service('http://my.msn.com/addtomymsn.armx?id=rss&ut=', '&ru=');
+       }
+
+       function subscribe_netvibes()
+       {
+               return $this->subscribe_service('http://www.netvibes.com/subscribe.php?url=');
+       }
+
+       function subscribe_newsburst()
+       {
+               return $this->subscribe_service('http://www.newsburst.com/Source/?add=');
+       }
+
+       function subscribe_newsgator()
+       {
+               return $this->subscribe_service('http://www.newsgator.com/ngs/subscriber/subext.aspx?url=');
+       }
+
+       function subscribe_odeo()
+       {
+               return $this->subscribe_service('http://www.odeo.com/listen/subscribe?feed=');
+       }
+
+       function subscribe_podnova()
+       {
+               return $this->subscribe_service('http://www.podnova.com/index_your_podcasts.srf?action=add&url=');
+       }
+
+       function subscribe_rojo()
+       {
+               return $this->subscribe_service('http://www.rojo.com/add-subscription?resource=');
+       }
+
+       function subscribe_yahoo()
+       {
+               return $this->subscribe_service('http://add.my.yahoo.com/rss?url=');
+       }
+
+       function get_feed_tags($namespace, $tag)
+       {
+               $type = $this->get_type();
+               if ($type & SIMPLEPIE_TYPE_ATOM_10)
+               {
+                       if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]))
+                       {
+                               return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag];
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_ATOM_03)
+               {
+                       if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]))
+                       {
+                               return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag];
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_RSS_RDF)
+               {
+                       if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]))
+                       {
+                               return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag];
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
+               {
+                       if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag]))
+                       {
+                               return $this->data['child']['']['rss'][0]['child'][$namespace][$tag];
+                       }
+               }
+               return null;
+       }
+
+       function get_channel_tags($namespace, $tag)
+       {
+               $type = $this->get_type();
+               if ($type & SIMPLEPIE_TYPE_ATOM_ALL)
+               {
+                       if ($return = $this->get_feed_tags($namespace, $tag))
+                       {
+                               return $return;
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_RSS_10)
+               {
+                       if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel'))
+                       {
+                               if (isset($channel[0]['child'][$namespace][$tag]))
+                               {
+                                       return $channel[0]['child'][$namespace][$tag];
+                               }
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_RSS_090)
+               {
+                       if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel'))
+                       {
+                               if (isset($channel[0]['child'][$namespace][$tag]))
+                               {
+                                       return $channel[0]['child'][$namespace][$tag];
+                               }
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
+               {
+                       if ($channel = $this->get_feed_tags('', 'channel'))
+                       {
+                               if (isset($channel[0]['child'][$namespace][$tag]))
+                               {
+                                       return $channel[0]['child'][$namespace][$tag];
+                               }
+                       }
+               }
+               return null;
+       }
+
+       function get_image_tags($namespace, $tag)
+       {
+               $type = $this->get_type();
+               if ($type & SIMPLEPIE_TYPE_RSS_10)
+               {
+                       if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image'))
+                       {
+                               if (isset($image[0]['child'][$namespace][$tag]))
+                               {
+                                       return $image[0]['child'][$namespace][$tag];
+                               }
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_RSS_090)
+               {
+                       if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image'))
+                       {
+                               if (isset($image[0]['child'][$namespace][$tag]))
+                               {
+                                       return $image[0]['child'][$namespace][$tag];
+                               }
+                       }
+               }
+               if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
+               {
+                       if ($image = $this->get_channel_tags('', 'image'))
+                       {
+                               if (isset($image[0]['child'][$namespace][$tag]))
+                               {
+                                       return $image[0]['child'][$namespace][$tag];
+                               }
+                       }
+               }
+               return null;
+       }
+
+       function get_base($element = array())
+       {
+               if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
+               {
+                       return $element['xml_base'];
+               }
+               elseif ($this->get_link() !== null)
+               {
+                       return $this->get_link();
+               }
+               else
+               {
+                       return $this->subscribe_url();
+               }
+       }
+
+       function sanitize($data, $type, $base = '')
+       {
+               return $this->sanitize->sanitize($data, $type, $base);
+       }
+
+       function get_title()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags('', 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_category($key = 0)
+       {
+               $categories = $this->get_categories();
+               if (isset($categories[$key]))
+               {
+                       return $categories[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_categories()
+       {
+               $categories = array();
+
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
+               {
+                       $term = null;
+                       $scheme = null;
+                       $label = null;
+                       if (isset($category['attribs']['']['term']))
+                       {
+                               $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($category['attribs']['']['scheme']))
+                       {
+                               $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($category['attribs']['']['label']))
+                       {
+                               $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       $categories[] =& new $this->category_class($term, $scheme, $label);
+               }
+               foreach ((array) $this->get_channel_tags('', 'category') as $category)
+               {
+                       $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+               {
+                       $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+               {
+                       $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+
+               if (!empty($categories))
+               {
+                       return SimplePie_Misc::array_unique($categories);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_author($key = 0)
+       {
+               $authors = $this->get_authors();
+               if (isset($authors[$key]))
+               {
+                       return $authors[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_authors()
+       {
+               $authors = array();
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
+               {
+                       $name = null;
+                       $uri = null;
+                       $email = null;
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+                       {
+                               $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+                       }
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $uri !== null)
+                       {
+                               $authors[] =& new $this->author_class($name, $uri, $email);
+                       }
+               }
+               if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
+               {
+                       $name = null;
+                       $url = null;
+                       $email = null;
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+                       {
+                               $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+                       }
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $url !== null)
+                       {
+                               $authors[] =& new $this->author_class($name, $url, $email);
+                       }
+               }
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+               {
+                       $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+               {
+                       $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+               {
+                       $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+
+               if (!empty($authors))
+               {
+                       return SimplePie_Misc::array_unique($authors);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_contributor($key = 0)
+       {
+               $contributors = $this->get_contributors();
+               if (isset($contributors[$key]))
+               {
+                       return $contributors[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_contributors()
+       {
+               $contributors = array();
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
+               {
+                       $name = null;
+                       $uri = null;
+                       $email = null;
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+                       {
+                               $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $uri !== null)
+                       {
+                               $contributors[] =& new $this->author_class($name, $uri, $email);
+                       }
+               }
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+               {
+                       $name = null;
+                       $url = null;
+                       $email = null;
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+                       {
+                               $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $url !== null)
+                       {
+                               $contributors[] =& new $this->author_class($name, $url, $email);
+                       }
+               }
+
+               if (!empty($contributors))
+               {
+                       return SimplePie_Misc::array_unique($contributors);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_link($key = 0, $rel = 'alternate')
+       {
+               $links = $this->get_links($rel);
+               if (isset($links[$key]))
+               {
+                       return $links[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * Added for parity between the parent-level and the item/entry-level.
+        */
+       function get_permalink()
+       {
+               return $this->get_link(0);
+       }
+
+       function get_links($rel = 'alternate')
+       {
+               if (!isset($this->data['links']))
+               {
+                       $this->data['links'] = array();
+                       if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+                       {
+                               foreach ($links as $link)
+                               {
+                                       if (isset($link['attribs']['']['href']))
+                                       {
+                                               $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+                                               $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+                                       }
+                               }
+                       }
+                       if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
+                       {
+                               foreach ($links as $link)
+                               {
+                                       if (isset($link['attribs']['']['href']))
+                                       {
+                                               $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+                                               $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+
+                                       }
+                               }
+                       }
+                       if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+                       if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+                       if ($links = $this->get_channel_tags('', 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+
+                       $keys = array_keys($this->data['links']);
+                       foreach ($keys as $key)
+                       {
+                               if (SimplePie_Misc::is_isegment_nz_nc($key))
+                               {
+                                       if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
+                                       {
+                                               $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
+                                               $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
+                                       }
+                                       else
+                                       {
+                                               $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
+                                       }
+                               }
+                               elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+                               {
+                                       $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
+                               }
+                               $this->data['links'][$key] = array_unique($this->data['links'][$key]);
+                       }
+               }
+
+               if (isset($this->data['links'][$rel]))
+               {
+                       return $this->data['links'][$rel];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_description()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags('', 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_copyright()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags('', 'copyright'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_language()
+       {
+               if ($return = $this->get_channel_tags('', 'language'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang']))
+               {
+                       return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang']))
+               {
+                       return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang']))
+               {
+                       return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif (isset($this->data['headers']['content-language']))
+               {
+                       return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_latitude()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+               {
+                       return (float) $match[1];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_longitude()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+               {
+                       return (float) $match[2];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_image_title()
+       {
+               if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_image_tags('', 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_image_url()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
+               {
+                       return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_image_tags('', 'url'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_image_link()
+       {
+               if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_image_tags('', 'link'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_image_width()
+       {
+               if ($return = $this->get_image_tags('', 'width'))
+               {
+                       return round($return[0]['data']);
+               }
+               elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+               {
+                       return 88.0;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_image_height()
+       {
+               if ($return = $this->get_image_tags('', 'height'))
+               {
+                       return round($return[0]['data']);
+               }
+               elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+               {
+                       return 31.0;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_item_quantity($max = 0)
+       {
+               $qty = count($this->get_items());
+               if ($max == 0)
+               {
+                       return $qty;
+               }
+               else
+               {
+                       return ($qty > $max) ? $max : $qty;
+               }
+       }
+
+       function get_item($key = 0)
+       {
+               $items = $this->get_items();
+               if (isset($items[$key]))
+               {
+                       return $items[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_items($start = 0, $end = 0)
+       {
+               if (!empty($this->multifeed_objects))
+               {
+                       return SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
+               }
+               elseif (!isset($this->data['items']))
+               {
+                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
+                       {
+                               $keys = array_keys($items);
+                               foreach ($keys as $key)
+                               {
+                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                               }
+                       }
+                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
+                       {
+                               $keys = array_keys($items);
+                               foreach ($keys as $key)
+                               {
+                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                               }
+                       }
+                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
+                       {
+                               $keys = array_keys($items);
+                               foreach ($keys as $key)
+                               {
+                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                               }
+                       }
+                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
+                       {
+                               $keys = array_keys($items);
+                               foreach ($keys as $key)
+                               {
+                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                               }
+                       }
+                       if ($items = $this->get_channel_tags('', 'item'))
+                       {
+                               $keys = array_keys($items);
+                               foreach ($keys as $key)
+                               {
+                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                               }
+                       }
+               }
+
+               if (!empty($this->data['items']))
+               {
+                       // If we want to order it by date, check if all items have a date, and then sort it
+                       if ($this->order_by_date)
+                       {
+                               if (!isset($this->data['ordered_items']))
+                               {
+                                       $do_sort = true;
+                                       foreach ($this->data['items'] as $item)
+                                       {
+                                               if (!$item->get_date('U'))
+                                               {
+                                                       $do_sort = false;
+                                                       break;
+                                               }
+                                       }
+                                       $item = null;
+                                       $this->data['ordered_items'] = $this->data['items'];
+                                       if ($do_sort)
+                                       {
+                                               usort($this->data['ordered_items'], array(&$this, 'sort_items'));
+                                       }
+                               }
+                               $items = $this->data['ordered_items'];
+                       }
+                       else
+                       {
+                               $items = $this->data['items'];
+                       }
+
+                       // Slice the data as desired
+                       if ($end == 0)
+                       {
+                               return array_slice($items, $start);
+                       }
+                       else
+                       {
+                               return array_slice($items, $start, $end);
+                       }
+               }
+               else
+               {
+                       return array();
+               }
+       }
+
+       function sort_items($a, $b)
+       {
+               return $a->get_date('U') <= $b->get_date('U');
+       }
+
+       function merge_items($urls, $start = 0, $end = 0, $limit = 0)
+       {
+               if (is_array($urls) && sizeof($urls) > 0)
+               {
+                       $items = array();
+                       foreach ($urls as $arg)
+                       {
+                               if (is_a($arg, 'SimplePie'))
+                               {
+                                       $items = array_merge($items, $arg->get_items(0, $limit));
+                               }
+                               else
+                               {
+                                       trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
+                               }
+                       }
+
+                       $do_sort = true;
+                       foreach ($items as $item)
+                       {
+                               if (!$item->get_date('U'))
+                               {
+                                       $do_sort = false;
+                                       break;
+                               }
+                       }
+                       $item = null;
+                       if ($do_sort)
+                       {
+                               usort($items, array('SimplePie', 'sort_items'));
+                       }
+
+                       if ($end == 0)
+                       {
+                               return array_slice($items, $start);
+                       }
+                       else
+                       {
+                               return array_slice($items, $start, $end);
+                       }
+               }
+               else
+               {
+                       trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
+                       return array();
+               }
+       }
+}
+
+class SimplePie_Item
+{
+       var $feed;
+       var $data = array();
+
+       function SimplePie_Item($feed, $data)
+       {
+               $this->feed = $feed;
+               $this->data = $data;
+       }
+
+       function __toString()
+       {
+               return md5(serialize($this->data));
+       }
+
+       /**
+        * Remove items that link back to this before destroying this object
+        */
+       function __destruct()
+       {
+               unset($this->feed);
+       }
+
+       function get_item_tags($namespace, $tag)
+       {
+               if (isset($this->data['child'][$namespace][$tag]))
+               {
+                       return $this->data['child'][$namespace][$tag];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_base($element = array())
+       {
+               return $this->feed->get_base($element);
+       }
+
+       function sanitize($data, $type, $base = '')
+       {
+               return $this->feed->sanitize($data, $type, $base);
+       }
+
+       function get_feed()
+       {
+               return $this->feed;
+       }
+
+       function get_id($hash = false)
+       {
+               if (!$hash)
+               {
+                       if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
+                       {
+                               return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
+                       {
+                               return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       elseif ($return = $this->get_item_tags('', 'guid'))
+                       {
+                               return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
+                       {
+                               return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
+                       {
+                               return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       elseif (($return = $this->get_permalink()) !== null)
+                       {
+                               return $return;
+                       }
+                       elseif (($return = $this->get_title()) !== null)
+                       {
+                               return $return;
+                       }
+               }
+               if ($this->get_permalink() !== null || $this->get_title() !== null)
+               {
+                       return md5($this->get_permalink() . $this->get_title());
+               }
+               else
+               {
+                       return md5(serialize($this->data));
+               }
+       }
+
+       function get_title()
+       {
+               if (!isset($this->data['title']))
+               {
+                       if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
+                       {
+                               $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
+                       {
+                               $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
+                       {
+                               $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
+                       {
+                               $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+                       }
+                       elseif ($return = $this->get_item_tags('', 'title'))
+                       {
+                               $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
+                       {
+                               $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
+                       {
+                               $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       else
+                       {
+                               $this->data['title'] = null;
+                       }
+               }
+               return $this->data['title'];
+       }
+
+       function get_description($description_only = false)
+       {
+               if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags('', 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif (!$description_only)
+               {
+                       return $this->get_content(true);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_content($content_only = false)
+       {
+               if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_content_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
+               }
+               elseif (!$content_only)
+               {
+                       return $this->get_description(true);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_category($key = 0)
+       {
+               $categories = $this->get_categories();
+               if (isset($categories[$key]))
+               {
+                       return $categories[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_categories()
+       {
+               $categories = array();
+
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
+               {
+                       $term = null;
+                       $scheme = null;
+                       $label = null;
+                       if (isset($category['attribs']['']['term']))
+                       {
+                               $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($category['attribs']['']['scheme']))
+                       {
+                               $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($category['attribs']['']['label']))
+                       {
+                               $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       $categories[] =& new $this->feed->category_class($term, $scheme, $label);
+               }
+               foreach ((array) $this->get_item_tags('', 'category') as $category)
+               {
+                       $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+               {
+                       $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+               {
+                       $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+
+               if (!empty($categories))
+               {
+                       return SimplePie_Misc::array_unique($categories);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_author($key = 0)
+       {
+               $authors = $this->get_authors();
+               if (isset($authors[$key]))
+               {
+                       return $authors[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_contributor($key = 0)
+       {
+               $contributors = $this->get_contributors();
+               if (isset($contributors[$key]))
+               {
+                       return $contributors[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_contributors()
+       {
+               $contributors = array();
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
+               {
+                       $name = null;
+                       $uri = null;
+                       $email = null;
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+                       {
+                               $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $uri !== null)
+                       {
+                               $contributors[] =& new $this->feed->author_class($name, $uri, $email);
+                       }
+               }
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+               {
+                       $name = null;
+                       $url = null;
+                       $email = null;
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+                       {
+                               $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $url !== null)
+                       {
+                               $contributors[] =& new $this->feed->author_class($name, $url, $email);
+                       }
+               }
+
+               if (!empty($contributors))
+               {
+                       return SimplePie_Misc::array_unique($contributors);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * @todo Atom inheritance (item author, source author, feed author)
+        */
+       function get_authors()
+       {
+               $authors = array();
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
+               {
+                       $name = null;
+                       $uri = null;
+                       $email = null;
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+                       {
+                               $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+                       }
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $uri !== null)
+                       {
+                               $authors[] =& new $this->feed->author_class($name, $uri, $email);
+                       }
+               }
+               if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
+               {
+                       $name = null;
+                       $url = null;
+                       $email = null;
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+                       {
+                               $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+                       }
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $url !== null)
+                       {
+                               $authors[] =& new $this->feed->author_class($name, $url, $email);
+                       }
+               }
+               if ($author = $this->get_item_tags('', 'author'))
+               {
+                       $authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+               }
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+               {
+                       $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+               {
+                       $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+               {
+                       $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+
+               if (!empty($authors))
+               {
+                       return SimplePie_Misc::array_unique($authors);
+               }
+               elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
+               {
+                       return $authors;
+               }
+               elseif ($authors = $this->feed->get_authors())
+               {
+                       return $authors;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_copyright()
+       {
+               if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_date($date_format = 'j F Y, g:i a')
+       {
+               if (!isset($this->data['date']))
+               {
+                       if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+                       elseif ($return = $this->get_item_tags('', 'pubDate'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
+                       {
+                               $this->data['date']['raw'] = $return[0]['data'];
+                       }
+
+                       if (!empty($this->data['date']['raw']))
+                       {
+                               $parser = SimplePie_Parse_Date::get();
+                               $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
+                       }
+                       else
+                       {
+                               $this->data['date'] = null;
+                       }
+               }
+               if ($this->data['date'])
+               {
+                       $date_format = (string) $date_format;
+                       switch ($date_format)
+                       {
+                               case '':
+                                       return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
+
+                               case 'U':
+                                       return $this->data['date']['parsed'];
+
+                               default:
+                                       return date($date_format, $this->data['date']['parsed']);
+                       }
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_local_date($date_format = '%c')
+       {
+               if (!$date_format)
+               {
+                       return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif (($date = $this->get_date('U')) !== null)
+               {
+                       return strftime($date_format, $date);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_permalink()
+       {
+               $link = $this->get_link();
+               $enclosure = $this->get_enclosure(0);
+               if ($link !== null)
+               {
+                       return $link;
+               }
+               elseif ($enclosure !== null)
+               {
+                       return $enclosure->get_link();
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_link($key = 0, $rel = 'alternate')
+       {
+               $links = $this->get_links($rel);
+               if ($links[$key] !== null)
+               {
+                       return $links[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_links($rel = 'alternate')
+       {
+               if (!isset($this->data['links']))
+               {
+                       $this->data['links'] = array();
+                       foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
+                       {
+                               if (isset($link['attribs']['']['href']))
+                               {
+                                       $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+                                       $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+
+                               }
+                       }
+                       foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
+                       {
+                               if (isset($link['attribs']['']['href']))
+                               {
+                                       $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+                                       $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+                               }
+                       }
+                       if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+                       if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+                       if ($links = $this->get_item_tags('', 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+                       if ($links = $this->get_item_tags('', 'guid'))
+                       {
+                               if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true')
+                               {
+                                       $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                               }
+                       }
+
+                       $keys = array_keys($this->data['links']);
+                       foreach ($keys as $key)
+                       {
+                               if (SimplePie_Misc::is_isegment_nz_nc($key))
+                               {
+                                       if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
+                                       {
+                                               $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
+                                               $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
+                                       }
+                                       else
+                                       {
+                                               $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
+                                       }
+                               }
+                               elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+                               {
+                                       $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
+                               }
+                               $this->data['links'][$key] = array_unique($this->data['links'][$key]);
+                       }
+               }
+               if (isset($this->data['links'][$rel]))
+               {
+                       return $this->data['links'][$rel];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * @todo Add ability to prefer one type of content over another (in a media group).
+        */
+       function get_enclosure($key = 0, $prefer = null)
+       {
+               $enclosures = $this->get_enclosures();
+               if (isset($enclosures[$key]))
+               {
+                       return $enclosures[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * Grabs all available enclosures (podcasts, etc.)
+        *
+        * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
+        *
+        * At this point, we're pretty much assuming that all enclosures for an item are the same content.  Anything else is too complicated to properly support.
+        *
+        * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
+        * @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists).
+        */
+       function get_enclosures()
+       {
+               if (!isset($this->data['enclosures']))
+               {
+                       $this->data['enclosures'] = array();
+
+                       // Elements
+                       $captions_parent = null;
+                       $categories_parent = null;
+                       $copyrights_parent = null;
+                       $credits_parent = null;
+                       $description_parent = null;
+                       $duration_parent = null;
+                       $hashes_parent = null;
+                       $keywords_parent = null;
+                       $player_parent = null;
+                       $ratings_parent = null;
+                       $restrictions_parent = null;
+                       $thumbnails_parent = null;
+                       $title_parent = null;
+
+                       // Let's do the channel and item-level ones first, and just re-use them if we need to.
+                       $parent = $this->get_feed();
+
+                       // CAPTIONS
+                       if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
+                       {
+                               foreach ($captions as $caption)
+                               {
+                                       $caption_type = null;
+                                       $caption_lang = null;
+                                       $caption_startTime = null;
+                                       $caption_endTime = null;
+                                       $caption_text = null;
+                                       if (isset($caption['attribs']['']['type']))
+                                       {
+                                               $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['attribs']['']['lang']))
+                                       {
+                                               $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['attribs']['']['start']))
+                                       {
+                                               $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['attribs']['']['end']))
+                                       {
+                                               $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['data']))
+                                       {
+                                               $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+                               }
+                       }
+                       elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
+                       {
+                               foreach ($captions as $caption)
+                               {
+                                       $caption_type = null;
+                                       $caption_lang = null;
+                                       $caption_startTime = null;
+                                       $caption_endTime = null;
+                                       $caption_text = null;
+                                       if (isset($caption['attribs']['']['type']))
+                                       {
+                                               $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['attribs']['']['lang']))
+                                       {
+                                               $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['attribs']['']['start']))
+                                       {
+                                               $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['attribs']['']['end']))
+                                       {
+                                               $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($caption['data']))
+                                       {
+                                               $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+                               }
+                       }
+                       if (is_array($captions_parent))
+                       {
+                               $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent));
+                       }
+
+                       // CATEGORIES
+                       foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
+                       {
+                               $term = null;
+                               $scheme = null;
+                               $label = null;
+                               if (isset($category['data']))
+                               {
+                                       $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               if (isset($category['attribs']['']['scheme']))
+                               {
+                                       $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               else
+                               {
+                                       $scheme = 'http://search.yahoo.com/mrss/category_schema';
+                               }
+                               if (isset($category['attribs']['']['label']))
+                               {
+                                       $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+                       }
+                       foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
+                       {
+                               $term = null;
+                               $scheme = null;
+                               $label = null;
+                               if (isset($category['data']))
+                               {
+                                       $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               if (isset($category['attribs']['']['scheme']))
+                               {
+                                       $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               else
+                               {
+                                       $scheme = 'http://search.yahoo.com/mrss/category_schema';
+                               }
+                               if (isset($category['attribs']['']['label']))
+                               {
+                                       $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+                       }
+                       foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category)
+                       {
+                               $term = null;
+                               $scheme = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
+                               $label = null;
+                               if (isset($category['attribs']['']['text']))
+                               {
+                                       $label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+
+                               if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category']))
+                               {
+                                       foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory)
+                                       {
+                                               if (isset($subcategory['attribs']['']['text']))
+                                               {
+                                                       $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label);
+                                       }
+                               }
+                       }
+                       if (is_array($categories_parent))
+                       {
+                               $categories_parent = array_values(SimplePie_Misc::array_unique($categories_parent));
+                       }
+
+                       // COPYRIGHT
+                       if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
+                       {
+                               $copyright_url = null;
+                               $copyright_label = null;
+                               if (isset($copyright[0]['attribs']['']['url']))
+                               {
+                                       $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               if (isset($copyright[0]['data']))
+                               {
+                                       $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               $copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+                       }
+                       elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
+                       {
+                               $copyright_url = null;
+                               $copyright_label = null;
+                               if (isset($copyright[0]['attribs']['']['url']))
+                               {
+                                       $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               if (isset($copyright[0]['data']))
+                               {
+                                       $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                               $copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+                       }
+
+                       // CREDITS
+                       if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
+                       {
+                               foreach ($credits as $credit)
+                               {
+                                       $credit_role = null;
+                                       $credit_scheme = null;
+                                       $credit_name = null;
+                                       if (isset($credit['attribs']['']['role']))
+                                       {
+                                               $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($credit['attribs']['']['scheme']))
+                                       {
+                                               $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       else
+                                       {
+                                               $credit_scheme = 'urn:ebu';
+                                       }
+                                       if (isset($credit['data']))
+                                       {
+                                               $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+                               }
+                       }
+                       elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
+                       {
+                               foreach ($credits as $credit)
+                               {
+                                       $credit_role = null;
+                                       $credit_scheme = null;
+                                       $credit_name = null;
+                                       if (isset($credit['attribs']['']['role']))
+                                       {
+                                               $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($credit['attribs']['']['scheme']))
+                                       {
+                                               $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       else
+                                       {
+                                               $credit_scheme = 'urn:ebu';
+                                       }
+                                       if (isset($credit['data']))
+                                       {
+                                               $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+                               }
+                       }
+                       if (is_array($credits_parent))
+                       {
+                               $credits_parent = array_values(SimplePie_Misc::array_unique($credits_parent));
+                       }
+
+                       // DESCRIPTION
+                       if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
+                       {
+                               if (isset($description_parent[0]['data']))
+                               {
+                                       $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                       }
+                       elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
+                       {
+                               if (isset($description_parent[0]['data']))
+                               {
+                                       $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                       }
+
+                       // DURATION
+                       if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration'))
+                       {
+                               $seconds = null;
+                               $minutes = null;
+                               $hours = null;
+                               if (isset($duration_parent[0]['data']))
+                               {
+                                       $temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                       if (sizeof($temp) > 0)
+                                       {
+                                               (int) $seconds = array_pop($temp);
+                                       }
+                                       if (sizeof($temp) > 0)
+                                       {
+                                               (int) $minutes = array_pop($temp);
+                                               $seconds += $minutes * 60;
+                                       }
+                                       if (sizeof($temp) > 0)
+                                       {
+                                               (int) $hours = array_pop($temp);
+                                               $seconds += $hours * 3600;
+                                       }
+                                       unset($temp);
+                                       $duration_parent = $seconds;
+                               }
+                       }
+
+                       // HASHES
+                       if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
+                       {
+                               foreach ($hashes_iterator as $hash)
+                               {
+                                       $value = null;
+                                       $algo = null;
+                                       if (isset($hash['data']))
+                                       {
+                                               $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($hash['attribs']['']['algo']))
+                                       {
+                                               $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       else
+                                       {
+                                               $algo = 'md5';
+                                       }
+                                       $hashes_parent[] = $algo.':'.$value;
+                               }
+                       }
+                       elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
+                       {
+                               foreach ($hashes_iterator as $hash)
+                               {
+                                       $value = null;
+                                       $algo = null;
+                                       if (isset($hash['data']))
+                                       {
+                                               $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($hash['attribs']['']['algo']))
+                                       {
+                                               $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       else
+                                       {
+                                               $algo = 'md5';
+                                       }
+                                       $hashes_parent[] = $algo.':'.$value;
+                               }
+                       }
+                       if (is_array($hashes_parent))
+                       {
+                               $hashes_parent = array_values(SimplePie_Misc::array_unique($hashes_parent));
+                       }
+
+                       // KEYWORDS
+                       if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
+                       {
+                               if (isset($keywords[0]['data']))
+                               {
+                                       $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                       foreach ($temp as $word)
+                                       {
+                                               $keywords_parent[] = trim($word);
+                                       }
+                               }
+                               unset($temp);
+                       }
+                       elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
+                       {
+                               if (isset($keywords[0]['data']))
+                               {
+                                       $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                       foreach ($temp as $word)
+                                       {
+                                               $keywords_parent[] = trim($word);
+                                       }
+                               }
+                               unset($temp);
+                       }
+                       elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
+                       {
+                               if (isset($keywords[0]['data']))
+                               {
+                                       $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                       foreach ($temp as $word)
+                                       {
+                                               $keywords_parent[] = trim($word);
+                                       }
+                               }
+                               unset($temp);
+                       }
+                       elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
+                       {
+                               if (isset($keywords[0]['data']))
+                               {
+                                       $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                       foreach ($temp as $word)
+                                       {
+                                               $keywords_parent[] = trim($word);
+                                       }
+                               }
+                               unset($temp);
+                       }
+                       if (is_array($keywords_parent))
+                       {
+                               $keywords_parent = array_values(SimplePie_Misc::array_unique($keywords_parent));
+                       }
+
+                       // PLAYER
+                       if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
+                       {
+                               if (isset($player_parent[0]['attribs']['']['url']))
+                               {
+                                       $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                               }
+                       }
+                       elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
+                       {
+                               if (isset($player_parent[0]['attribs']['']['url']))
+                               {
+                                       $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                               }
+                       }
+
+                       // RATINGS
+                       if ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
+                       {
+                               foreach ($ratings as $rating)
+                               {
+                                       $rating_scheme = null;
+                                       $rating_value = null;
+                                       if (isset($rating['attribs']['']['scheme']))
+                                       {
+                                               $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       else
+                                       {
+                                               $rating_scheme = 'urn:simple';
+                                       }
+                                       if (isset($rating['data']))
+                                       {
+                                               $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+                               }
+                       }
+                       elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
+                       {
+                               foreach ($ratings as $rating)
+                               {
+                                       $rating_scheme = 'urn:itunes';
+                                       $rating_value = null;
+                                       if (isset($rating['data']))
+                                       {
+                                               $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+                               }
+                       }
+                       elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
+                       {
+                               foreach ($ratings as $rating)
+                               {
+                                       $rating_scheme = null;
+                                       $rating_value = null;
+                                       if (isset($rating['attribs']['']['scheme']))
+                                       {
+                                               $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       else
+                                       {
+                                               $rating_scheme = 'urn:simple';
+                                       }
+                                       if (isset($rating['data']))
+                                       {
+                                               $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+                               }
+                       }
+                       elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
+                       {
+                               foreach ($ratings as $rating)
+                               {
+                                       $rating_scheme = 'urn:itunes';
+                                       $rating_value = null;
+                                       if (isset($rating['data']))
+                                       {
+                                               $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+                               }
+                       }
+                       if (is_array($ratings_parent))
+                       {
+                               $ratings_parent = array_values(SimplePie_Misc::array_unique($ratings_parent));
+                       }
+
+                       // RESTRICTIONS
+                       if ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
+                       {
+                               foreach ($restrictions as $restriction)
+                               {
+                                       $restriction_relationship = null;
+                                       $restriction_type = null;
+                                       $restriction_value = null;
+                                       if (isset($restriction['attribs']['']['relationship']))
+                                       {
+                                               $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($restriction['attribs']['']['type']))
+                                       {
+                                               $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($restriction['data']))
+                                       {
+                                               $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                               }
+                       }
+                       elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
+                       {
+                               foreach ($restrictions as $restriction)
+                               {
+                                       $restriction_relationship = 'allow';
+                                       $restriction_type = null;
+                                       $restriction_value = 'itunes';
+                                       if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+                                       {
+                                               $restriction_relationship = 'deny';
+                                       }
+                                       $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                               }
+                       }
+                       elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
+                       {
+                               foreach ($restrictions as $restriction)
+                               {
+                                       $restriction_relationship = null;
+                                       $restriction_type = null;
+                                       $restriction_value = null;
+                                       if (isset($restriction['attribs']['']['relationship']))
+                                       {
+                                               $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($restriction['attribs']['']['type']))
+                                       {
+                                               $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($restriction['data']))
+                                       {
+                                               $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                               }
+                       }
+                       elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
+                       {
+                               foreach ($restrictions as $restriction)
+                               {
+                                       $restriction_relationship = 'allow';
+                                       $restriction_type = null;
+                                       $restriction_value = 'itunes';
+                                       if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+                                       {
+                                               $restriction_relationship = 'deny';
+                                       }
+                                       $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                               }
+                       }
+                       if (is_array($restrictions_parent))
+                       {
+                               $restrictions_parent = array_values(SimplePie_Misc::array_unique($restrictions_parent));
+                       }
+
+                       // THUMBNAILS
+                       if ($thumbnails = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
+                       {
+                               foreach ($thumbnails as $thumbnail)
+                               {
+                                       if (isset($thumbnail['attribs']['']['url']))
+                                       {
+                                               $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                       }
+                               }
+                       }
+                       elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
+                       {
+                               foreach ($thumbnails as $thumbnail)
+                               {
+                                       if (isset($thumbnail['attribs']['']['url']))
+                                       {
+                                               $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                       }
+                               }
+                       }
+
+                       // TITLES
+                       if ($title_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
+                       {
+                               if (isset($title_parent[0]['data']))
+                               {
+                                       $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                       }
+                       elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
+                       {
+                               if (isset($title_parent[0]['data']))
+                               {
+                                       $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                               }
+                       }
+
+                       // Clear the memory
+                       unset($parent);
+
+                       // Attributes
+                       $bitrate = null;
+                       $channels = null;
+                       $duration = null;
+                       $expression = null;
+                       $framerate = null;
+                       $height = null;
+                       $javascript = null;
+                       $lang = null;
+                       $length = null;
+                       $medium = null;
+                       $samplingrate = null;
+                       $type = null;
+                       $url = null;
+                       $width = null;
+
+                       // Elements
+                       $captions = null;
+                       $categories = null;
+                       $copyrights = null;
+                       $credits = null;
+                       $description = null;
+                       $hashes = null;
+                       $keywords = null;
+                       $player = null;
+                       $ratings = null;
+                       $restrictions = null;
+                       $thumbnails = null;
+                       $title = null;
+
+                       // If we have media:group tags, loop through them.
+                       foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group)
+                       {
+                               // If we have media:content tags, loop through them.
+                               foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
+                               {
+                                       if (isset($content['attribs']['']['url']))
+                                       {
+                                               // Attributes
+                                               $bitrate = null;
+                                               $channels = null;
+                                               $duration = null;
+                                               $expression = null;
+                                               $framerate = null;
+                                               $height = null;
+                                               $javascript = null;
+                                               $lang = null;
+                                               $length = null;
+                                               $medium = null;
+                                               $samplingrate = null;
+                                               $type = null;
+                                               $url = null;
+                                               $width = null;
+
+                                               // Elements
+                                               $captions = null;
+                                               $categories = null;
+                                               $copyrights = null;
+                                               $credits = null;
+                                               $description = null;
+                                               $hashes = null;
+                                               $keywords = null;
+                                               $player = null;
+                                               $ratings = null;
+                                               $restrictions = null;
+                                               $thumbnails = null;
+                                               $title = null;
+
+                                               // Start checking the attributes of media:content
+                                               if (isset($content['attribs']['']['bitrate']))
+                                               {
+                                                       $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['channels']))
+                                               {
+                                                       $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['duration']))
+                                               {
+                                                       $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               else
+                                               {
+                                                       $duration = $duration_parent;
+                                               }
+                                               if (isset($content['attribs']['']['expression']))
+                                               {
+                                                       $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['framerate']))
+                                               {
+                                                       $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['height']))
+                                               {
+                                                       $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['lang']))
+                                               {
+                                                       $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['fileSize']))
+                                               {
+                                                       $length = ceil($content['attribs']['']['fileSize']);
+                                               }
+                                               if (isset($content['attribs']['']['medium']))
+                                               {
+                                                       $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['samplingrate']))
+                                               {
+                                                       $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['type']))
+                                               {
+                                                       $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['width']))
+                                               {
+                                                       $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+
+                                               // Checking the other optional media: elements. Priority: media:content, media:group, item, channel
+
+                                               // CAPTIONS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
+                                                       {
+                                                               $caption_type = null;
+                                                               $caption_lang = null;
+                                                               $caption_startTime = null;
+                                                               $caption_endTime = null;
+                                                               $caption_text = null;
+                                                               if (isset($caption['attribs']['']['type']))
+                                                               {
+                                                                       $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['lang']))
+                                                               {
+                                                                       $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['start']))
+                                                               {
+                                                                       $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['end']))
+                                                               {
+                                                                       $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['data']))
+                                                               {
+                                                                       $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+                                                       }
+                                                       if (is_array($captions))
+                                                       {
+                                                               $captions = array_values(SimplePie_Misc::array_unique($captions));
+                                                       }
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
+                                               {
+                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
+                                                       {
+                                                               $caption_type = null;
+                                                               $caption_lang = null;
+                                                               $caption_startTime = null;
+                                                               $caption_endTime = null;
+                                                               $caption_text = null;
+                                                               if (isset($caption['attribs']['']['type']))
+                                                               {
+                                                                       $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['lang']))
+                                                               {
+                                                                       $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['start']))
+                                                               {
+                                                                       $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['end']))
+                                                               {
+                                                                       $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['data']))
+                                                               {
+                                                                       $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+                                                       }
+                                                       if (is_array($captions))
+                                                       {
+                                                               $captions = array_values(SimplePie_Misc::array_unique($captions));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $captions = $captions_parent;
+                                               }
+
+                                               // CATEGORIES
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
+                                               {
+                                                       foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
+                                                       {
+                                                               $term = null;
+                                                               $scheme = null;
+                                                               $label = null;
+                                                               if (isset($category['data']))
+                                                               {
+                                                                       $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($category['attribs']['']['scheme']))
+                                                               {
+                                                                       $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $scheme = 'http://search.yahoo.com/mrss/category_schema';
+                                                               }
+                                                               if (isset($category['attribs']['']['label']))
+                                                               {
+                                                                       $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $categories[] =& new $this->feed->category_class($term, $scheme, $label);
+                                                       }
+                                               }
+                                               if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
+                                               {
+                                                       foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
+                                                       {
+                                                               $term = null;
+                                                               $scheme = null;
+                                                               $label = null;
+                                                               if (isset($category['data']))
+                                                               {
+                                                                       $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($category['attribs']['']['scheme']))
+                                                               {
+                                                                       $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $scheme = 'http://search.yahoo.com/mrss/category_schema';
+                                                               }
+                                                               if (isset($category['attribs']['']['label']))
+                                                               {
+                                                                       $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $categories[] =& new $this->feed->category_class($term, $scheme, $label);
+                                                       }
+                                               }
+                                               if (is_array($categories) && is_array($categories_parent))
+                                               {
+                                                       $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
+                                               }
+                                               elseif (is_array($categories))
+                                               {
+                                                       $categories = array_values(SimplePie_Misc::array_unique($categories));
+                                               }
+                                               elseif (is_array($categories_parent))
+                                               {
+                                                       $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
+                                               }
+
+                                               // COPYRIGHTS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
+                                               {
+                                                       $copyright_url = null;
+                                                       $copyright_label = null;
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
+                                                       {
+                                                               $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                       }
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+                                                       {
+                                                               $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                       }
+                                                       $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
+                                               {
+                                                       $copyright_url = null;
+                                                       $copyright_label = null;
+                                                       if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
+                                                       {
+                                                               $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                       }
+                                                       if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+                                                       {
+                                                               $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                       }
+                                                       $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+                                               }
+                                               else
+                                               {
+                                                       $copyrights = $copyrights_parent;
+                                               }
+
+                                               // CREDITS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
+                                                       {
+                                                               $credit_role = null;
+                                                               $credit_scheme = null;
+                                                               $credit_name = null;
+                                                               if (isset($credit['attribs']['']['role']))
+                                                               {
+                                                                       $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($credit['attribs']['']['scheme']))
+                                                               {
+                                                                       $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $credit_scheme = 'urn:ebu';
+                                                               }
+                                                               if (isset($credit['data']))
+                                                               {
+                                                                       $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+                                                       }
+                                                       if (is_array($credits))
+                                                       {
+                                                               $credits = array_values(SimplePie_Misc::array_unique($credits));
+                                                       }
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
+                                               {
+                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
+                                                       {
+                                                               $credit_role = null;
+                                                               $credit_scheme = null;
+                                                               $credit_name = null;
+                                                               if (isset($credit['attribs']['']['role']))
+                                                               {
+                                                                       $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($credit['attribs']['']['scheme']))
+                                                               {
+                                                                       $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $credit_scheme = 'urn:ebu';
+                                                               }
+                                                               if (isset($credit['data']))
+                                                               {
+                                                                       $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+                                                       }
+                                                       if (is_array($credits))
+                                                       {
+                                                               $credits = array_values(SimplePie_Misc::array_unique($credits));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $credits = $credits_parent;
+                                               }
+
+                                               // DESCRIPTION
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
+                                               {
+                                                       $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
+                                               {
+                                                       $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               else
+                                               {
+                                                       $description = $description_parent;
+                                               }
+
+                                               // HASHES
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
+                                                       {
+                                                               $value = null;
+                                                               $algo = null;
+                                                               if (isset($hash['data']))
+                                                               {
+                                                                       $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($hash['attribs']['']['algo']))
+                                                               {
+                                                                       $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $algo = 'md5';
+                                                               }
+                                                               $hashes[] = $algo.':'.$value;
+                                                       }
+                                                       if (is_array($hashes))
+                                                       {
+                                                               $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                       }
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
+                                               {
+                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
+                                                       {
+                                                               $value = null;
+                                                               $algo = null;
+                                                               if (isset($hash['data']))
+                                                               {
+                                                                       $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($hash['attribs']['']['algo']))
+                                                               {
+                                                                       $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $algo = 'md5';
+                                                               }
+                                                               $hashes[] = $algo.':'.$value;
+                                                       }
+                                                       if (is_array($hashes))
+                                                       {
+                                                               $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $hashes = $hashes_parent;
+                                               }
+
+                                               // KEYWORDS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
+                                               {
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
+                                                       {
+                                                               $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                                               foreach ($temp as $word)
+                                                               {
+                                                                       $keywords[] = trim($word);
+                                                               }
+                                                               unset($temp);
+                                                       }
+                                                       if (is_array($keywords))
+                                                       {
+                                                               $keywords = array_values(SimplePie_Misc::array_unique($keywords));
+                                                       }
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
+                                               {
+                                                       if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
+                                                       {
+                                                               $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                                               foreach ($temp as $word)
+                                                               {
+                                                                       $keywords[] = trim($word);
+                                                               }
+                                                               unset($temp);
+                                                       }
+                                                       if (is_array($keywords))
+                                                       {
+                                                               $keywords = array_values(SimplePie_Misc::array_unique($keywords));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $keywords = $keywords_parent;
+                                               }
+
+                                               // PLAYER
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
+                                               {
+                                                       $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
+                                               {
+                                                       $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                               }
+                                               else
+                                               {
+                                                       $player = $player_parent;
+                                               }
+
+                                               // RATINGS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
+                                                       {
+                                                               $rating_scheme = null;
+                                                               $rating_value = null;
+                                                               if (isset($rating['attribs']['']['scheme']))
+                                                               {
+                                                                       $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $rating_scheme = 'urn:simple';
+                                                               }
+                                                               if (isset($rating['data']))
+                                                               {
+                                                                       $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+                                                       }
+                                                       if (is_array($ratings))
+                                                       {
+                                                               $ratings = array_values(SimplePie_Misc::array_unique($ratings));
+                                                       }
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
+                                               {
+                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
+                                                       {
+                                                               $rating_scheme = null;
+                                                               $rating_value = null;
+                                                               if (isset($rating['attribs']['']['scheme']))
+                                                               {
+                                                                       $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $rating_scheme = 'urn:simple';
+                                                               }
+                                                               if (isset($rating['data']))
+                                                               {
+                                                                       $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+                                                       }
+                                                       if (is_array($ratings))
+                                                       {
+                                                               $ratings = array_values(SimplePie_Misc::array_unique($ratings));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $ratings = $ratings_parent;
+                                               }
+
+                                               // RESTRICTIONS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
+                                                       {
+                                                               $restriction_relationship = null;
+                                                               $restriction_type = null;
+                                                               $restriction_value = null;
+                                                               if (isset($restriction['attribs']['']['relationship']))
+                                                               {
+                                                                       $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($restriction['attribs']['']['type']))
+                                                               {
+                                                                       $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($restriction['data']))
+                                                               {
+                                                                       $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                                                       }
+                                                       if (is_array($restrictions))
+                                                       {
+                                                               $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
+                                                       }
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
+                                               {
+                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
+                                                       {
+                                                               $restriction_relationship = null;
+                                                               $restriction_type = null;
+                                                               $restriction_value = null;
+                                                               if (isset($restriction['attribs']['']['relationship']))
+                                                               {
+                                                                       $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($restriction['attribs']['']['type']))
+                                                               {
+                                                                       $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($restriction['data']))
+                                                               {
+                                                                       $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                                                       }
+                                                       if (is_array($restrictions))
+                                                       {
+                                                               $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $restrictions = $restrictions_parent;
+                                               }
+
+                                               // THUMBNAILS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
+                                                       {
+                                                               $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                                       }
+                                                       if (is_array($thumbnails))
+                                                       {
+                                                               $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+                                                       }
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
+                                               {
+                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
+                                                       {
+                                                               $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                                       }
+                                                       if (is_array($thumbnails))
+                                                       {
+                                                               $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $thumbnails = $thumbnails_parent;
+                                               }
+
+                                               // TITLES
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
+                                               {
+                                                       $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
+                                               {
+                                                       $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               else
+                                               {
+                                                       $title = $title_parent;
+                                               }
+
+                                               $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
+                                       }
+                               }
+                       }
+
+                       // If we have standalone media:content tags, loop through them.
+                       if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
+                       {
+                               foreach ((array) $this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
+                               {
+                                       if (isset($content['attribs']['']['url']))
+                                       {
+                                               // Attributes
+                                               $bitrate = null;
+                                               $channels = null;
+                                               $duration = null;
+                                               $expression = null;
+                                               $framerate = null;
+                                               $height = null;
+                                               $javascript = null;
+                                               $lang = null;
+                                               $length = null;
+                                               $medium = null;
+                                               $samplingrate = null;
+                                               $type = null;
+                                               $url = null;
+                                               $width = null;
+
+                                               // Elements
+                                               $captions = null;
+                                               $categories = null;
+                                               $copyrights = null;
+                                               $credits = null;
+                                               $description = null;
+                                               $hashes = null;
+                                               $keywords = null;
+                                               $player = null;
+                                               $ratings = null;
+                                               $restrictions = null;
+                                               $thumbnails = null;
+                                               $title = null;
+
+                                               // Start checking the attributes of media:content
+                                               if (isset($content['attribs']['']['bitrate']))
+                                               {
+                                                       $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['channels']))
+                                               {
+                                                       $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['duration']))
+                                               {
+                                                       $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               else
+                                               {
+                                                       $duration = $duration_parent;
+                                               }
+                                               if (isset($content['attribs']['']['expression']))
+                                               {
+                                                       $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['framerate']))
+                                               {
+                                                       $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['height']))
+                                               {
+                                                       $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['lang']))
+                                               {
+                                                       $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['fileSize']))
+                                               {
+                                                       $length = ceil($content['attribs']['']['fileSize']);
+                                               }
+                                               if (isset($content['attribs']['']['medium']))
+                                               {
+                                                       $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['samplingrate']))
+                                               {
+                                                       $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['type']))
+                                               {
+                                                       $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               if (isset($content['attribs']['']['width']))
+                                               {
+                                                       $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+
+                                               // Checking the other optional media: elements. Priority: media:content, media:group, item, channel
+
+                                               // CAPTIONS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
+                                                       {
+                                                               $caption_type = null;
+                                                               $caption_lang = null;
+                                                               $caption_startTime = null;
+                                                               $caption_endTime = null;
+                                                               $caption_text = null;
+                                                               if (isset($caption['attribs']['']['type']))
+                                                               {
+                                                                       $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['lang']))
+                                                               {
+                                                                       $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['start']))
+                                                               {
+                                                                       $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['attribs']['']['end']))
+                                                               {
+                                                                       $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($caption['data']))
+                                                               {
+                                                                       $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+                                                       }
+                                                       if (is_array($captions))
+                                                       {
+                                                               $captions = array_values(SimplePie_Misc::array_unique($captions));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $captions = $captions_parent;
+                                               }
+
+                                               // CATEGORIES
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
+                                               {
+                                                       foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
+                                                       {
+                                                               $term = null;
+                                                               $scheme = null;
+                                                               $label = null;
+                                                               if (isset($category['data']))
+                                                               {
+                                                                       $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($category['attribs']['']['scheme']))
+                                                               {
+                                                                       $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $scheme = 'http://search.yahoo.com/mrss/category_schema';
+                                                               }
+                                                               if (isset($category['attribs']['']['label']))
+                                                               {
+                                                                       $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $categories[] =& new $this->feed->category_class($term, $scheme, $label);
+                                                       }
+                                               }
+                                               if (is_array($categories) && is_array($categories_parent))
+                                               {
+                                                       $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
+                                               }
+                                               elseif (is_array($categories))
+                                               {
+                                                       $categories = array_values(SimplePie_Misc::array_unique($categories));
+                                               }
+                                               elseif (is_array($categories_parent))
+                                               {
+                                                       $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
+                                               }
+                                               else
+                                               {
+                                                       $categories = null;
+                                               }
+
+                                               // COPYRIGHTS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
+                                               {
+                                                       $copyright_url = null;
+                                                       $copyright_label = null;
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
+                                                       {
+                                                               $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                       }
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+                                                       {
+                                                               $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                       }
+                                                       $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label);
+                                               }
+                                               else
+                                               {
+                                                       $copyrights = $copyrights_parent;
+                                               }
+
+                                               // CREDITS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
+                                                       {
+                                                               $credit_role = null;
+                                                               $credit_scheme = null;
+                                                               $credit_name = null;
+                                                               if (isset($credit['attribs']['']['role']))
+                                                               {
+                                                                       $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($credit['attribs']['']['scheme']))
+                                                               {
+                                                                       $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $credit_scheme = 'urn:ebu';
+                                                               }
+                                                               if (isset($credit['data']))
+                                                               {
+                                                                       $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
+                                                       }
+                                                       if (is_array($credits))
+                                                       {
+                                                               $credits = array_values(SimplePie_Misc::array_unique($credits));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $credits = $credits_parent;
+                                               }
+
+                                               // DESCRIPTION
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
+                                               {
+                                                       $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               else
+                                               {
+                                                       $description = $description_parent;
+                                               }
+
+                                               // HASHES
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
+                                                       {
+                                                               $value = null;
+                                                               $algo = null;
+                                                               if (isset($hash['data']))
+                                                               {
+                                                                       $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($hash['attribs']['']['algo']))
+                                                               {
+                                                                       $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $algo = 'md5';
+                                                               }
+                                                               $hashes[] = $algo.':'.$value;
+                                                       }
+                                                       if (is_array($hashes))
+                                                       {
+                                                               $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $hashes = $hashes_parent;
+                                               }
+
+                                               // KEYWORDS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
+                                               {
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
+                                                       {
+                                                               $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                                                               foreach ($temp as $word)
+                                                               {
+                                                                       $keywords[] = trim($word);
+                                                               }
+                                                               unset($temp);
+                                                       }
+                                                       if (is_array($keywords))
+                                                       {
+                                                               $keywords = array_values(SimplePie_Misc::array_unique($keywords));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $keywords = $keywords_parent;
+                                               }
+
+                                               // PLAYER
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
+                                               {
+                                                       $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                               }
+                                               else
+                                               {
+                                                       $player = $player_parent;
+                                               }
+
+                                               // RATINGS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
+                                                       {
+                                                               $rating_scheme = null;
+                                                               $rating_value = null;
+                                                               if (isset($rating['attribs']['']['scheme']))
+                                                               {
+                                                                       $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               else
+                                                               {
+                                                                       $rating_scheme = 'urn:simple';
+                                                               }
+                                                               if (isset($rating['data']))
+                                                               {
+                                                                       $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value);
+                                                       }
+                                                       if (is_array($ratings))
+                                                       {
+                                                               $ratings = array_values(SimplePie_Misc::array_unique($ratings));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $ratings = $ratings_parent;
+                                               }
+
+                                               // RESTRICTIONS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
+                                                       {
+                                                               $restriction_relationship = null;
+                                                               $restriction_type = null;
+                                                               $restriction_value = null;
+                                                               if (isset($restriction['attribs']['']['relationship']))
+                                                               {
+                                                                       $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($restriction['attribs']['']['type']))
+                                                               {
+                                                                       $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($restriction['data']))
+                                                               {
+                                                                       $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                                                       }
+                                                       if (is_array($restrictions))
+                                                       {
+                                                               $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $restrictions = $restrictions_parent;
+                                               }
+
+                                               // THUMBNAILS
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
+                                               {
+                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
+                                                       {
+                                                               $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                                       }
+                                                       if (is_array($thumbnails))
+                                                       {
+                                                               $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $thumbnails = $thumbnails_parent;
+                                               }
+
+                                               // TITLES
+                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
+                                               {
+                                                       $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                               }
+                                               else
+                                               {
+                                                       $title = $title_parent;
+                                               }
+
+                                               $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
+                                       }
+                               }
+                       }
+
+                       foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
+                       {
+                               if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+                               {
+                                       // Attributes
+                                       $bitrate = null;
+                                       $channels = null;
+                                       $duration = null;
+                                       $expression = null;
+                                       $framerate = null;
+                                       $height = null;
+                                       $javascript = null;
+                                       $lang = null;
+                                       $length = null;
+                                       $medium = null;
+                                       $samplingrate = null;
+                                       $type = null;
+                                       $url = null;
+                                       $width = null;
+
+                                       $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+                                       if (isset($link['attribs']['']['type']))
+                                       {
+                                               $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($link['attribs']['']['length']))
+                                       {
+                                               $length = ceil($link['attribs']['']['length']);
+                                       }
+
+                                       // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
+                                       $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+                               }
+                       }
+
+                       foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
+                       {
+                               if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+                               {
+                                       // Attributes
+                                       $bitrate = null;
+                                       $channels = null;
+                                       $duration = null;
+                                       $expression = null;
+                                       $framerate = null;
+                                       $height = null;
+                                       $javascript = null;
+                                       $lang = null;
+                                       $length = null;
+                                       $medium = null;
+                                       $samplingrate = null;
+                                       $type = null;
+                                       $url = null;
+                                       $width = null;
+
+                                       $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+                                       if (isset($link['attribs']['']['type']))
+                                       {
+                                               $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($link['attribs']['']['length']))
+                                       {
+                                               $length = ceil($link['attribs']['']['length']);
+                                       }
+
+                                       // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
+                                       $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+                               }
+                       }
+
+                       if ($enclosure = $this->get_item_tags('', 'enclosure'))
+                       {
+                               if (isset($enclosure[0]['attribs']['']['url']))
+                               {
+                                       // Attributes
+                                       $bitrate = null;
+                                       $channels = null;
+                                       $duration = null;
+                                       $expression = null;
+                                       $framerate = null;
+                                       $height = null;
+                                       $javascript = null;
+                                       $lang = null;
+                                       $length = null;
+                                       $medium = null;
+                                       $samplingrate = null;
+                                       $type = null;
+                                       $url = null;
+                                       $width = null;
+
+                                       $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0]));
+                                       if (isset($enclosure[0]['attribs']['']['type']))
+                                       {
+                                               $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                       }
+                                       if (isset($enclosure[0]['attribs']['']['length']))
+                                       {
+                                               $length = ceil($enclosure[0]['attribs']['']['length']);
+                                       }
+
+                                       // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
+                                       $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+                               }
+                       }
+
+                       if (sizeof($this->data['enclosures']) == 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
+                       {
+                               // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
+                               $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
+                       }
+
+                       $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
+               }
+               if (!empty($this->data['enclosures']))
+               {
+                       return $this->data['enclosures'];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_latitude()
+       {
+               if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+               {
+                       return (float) $match[1];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_longitude()
+       {
+               if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+               {
+                       return (float) $match[2];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_source()
+       {
+               if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
+               {
+                       return new $this->feed->source_class($this, $return[0]);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * Creates the add_to_* methods' return data
+        *
+        * @access private
+        * @param string $item_url String to prefix to the item permalink
+        * @param string $title_url String to prefix to the item title
+        * (and suffix to the item permalink)
+        * @return mixed URL if feed exists, false otherwise
+        */
+       function add_to_service($item_url, $title_url = null, $summary_url = null)
+       {
+               if ($this->get_permalink() !== null)
+               {
+                       $return = $this->sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_permalink());
+                       if ($title_url !== null && $this->get_title() !== null)
+                       {
+                               $return .= $this->sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_title());
+                       }
+                       if ($summary_url !== null && $this->get_description() !== null)
+                       {
+                               $return .= $this->sanitize($summary_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_description());
+                       }
+                       return $return;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function add_to_blinklist()
+       {
+               return $this->add_to_service('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=', '&Title=');
+       }
+
+       function add_to_blogmarks()
+       {
+               return $this->add_to_service('http://blogmarks.net/my/new.php?mini=1&simple=1&url=', '&title=');
+       }
+
+       function add_to_delicious()
+       {
+               return $this->add_to_service('http://del.icio.us/post/?v=4&url=', '&title=');
+       }
+
+       function add_to_digg()
+       {
+               return $this->add_to_service('http://digg.com/submit?url=', '&title=', '&bodytext=');
+       }
+
+       function add_to_furl()
+       {
+               return $this->add_to_service('http://www.furl.net/storeIt.jsp?u=', '&t=');
+       }
+
+       function add_to_magnolia()
+       {
+               return $this->add_to_service('http://ma.gnolia.com/bookmarklet/add?url=', '&title=');
+       }
+
+       function add_to_myweb20()
+       {
+               return $this->add_to_service('http://myweb2.search.yahoo.com/myresults/bookmarklet?u=', '&t=');
+       }
+
+       function add_to_newsvine()
+       {
+               return $this->add_to_service('http://www.newsvine.com/_wine/save?u=', '&h=');
+       }
+
+       function add_to_reddit()
+       {
+               return $this->add_to_service('http://reddit.com/submit?url=', '&title=');
+       }
+
+       function add_to_segnalo()
+       {
+               return $this->add_to_service('http://segnalo.com/post.html.php?url=', '&title=');
+       }
+
+       function add_to_simpy()
+       {
+               return $this->add_to_service('http://www.simpy.com/simpy/LinkAdd.do?href=', '&title=');
+       }
+
+       function add_to_spurl()
+       {
+               return $this->add_to_service('http://www.spurl.net/spurl.php?v=3&url=', '&title=');
+       }
+
+       function add_to_wists()
+       {
+               return $this->add_to_service('http://wists.com/r.php?c=&r=', '&title=');
+       }
+
+       function search_technorati()
+       {
+               return $this->add_to_service('http://www.technorati.com/search/');
+       }
+}
+
+class SimplePie_Source
+{
+       var $item;
+       var $data = array();
+
+       function SimplePie_Source($item, $data)
+       {
+               $this->item = $item;
+               $this->data = $data;
+       }
+
+       function __toString()
+       {
+               return md5(serialize($this->data));
+       }
+
+       /**
+        * Remove items that link back to this before destroying this object
+        */
+       function __destruct()
+       {
+               unset($this->item);
+       }
+
+       function get_source_tags($namespace, $tag)
+       {
+               if (isset($this->data['child'][$namespace][$tag]))
+               {
+                       return $this->data['child'][$namespace][$tag];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_base($element = array())
+       {
+               return $this->item->get_base($element);
+       }
+
+       function sanitize($data, $type, $base = '')
+       {
+               return $this->item->sanitize($data, $type, $base);
+       }
+
+       function get_item()
+       {
+               return $this->item;
+       }
+
+       function get_title()
+       {
+               if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags('', 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_category($key = 0)
+       {
+               $categories = $this->get_categories();
+               if (isset($categories[$key]))
+               {
+                       return $categories[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_categories()
+       {
+               $categories = array();
+
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
+               {
+                       $term = null;
+                       $scheme = null;
+                       $label = null;
+                       if (isset($category['attribs']['']['term']))
+                       {
+                               $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($category['attribs']['']['scheme']))
+                       {
+                               $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($category['attribs']['']['label']))
+                       {
+                               $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       $categories[] =& new $this->item->feed->category_class($term, $scheme, $label);
+               }
+               foreach ((array) $this->get_source_tags('', 'category') as $category)
+               {
+                       $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+               {
+                       $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+               {
+                       $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+
+               if (!empty($categories))
+               {
+                       return SimplePie_Misc::array_unique($categories);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_author($key = 0)
+       {
+               $authors = $this->get_authors();
+               if (isset($authors[$key]))
+               {
+                       return $authors[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_authors()
+       {
+               $authors = array();
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
+               {
+                       $name = null;
+                       $uri = null;
+                       $email = null;
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+                       {
+                               $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+                       }
+                       if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $uri !== null)
+                       {
+                               $authors[] =& new $this->item->feed->author_class($name, $uri, $email);
+                       }
+               }
+               if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
+               {
+                       $name = null;
+                       $url = null;
+                       $email = null;
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+                       {
+                               $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+                       }
+                       if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $url !== null)
+                       {
+                               $authors[] =& new $this->item->feed->author_class($name, $url, $email);
+                       }
+               }
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+               {
+                       $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+               {
+                       $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+               {
+                       $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+               }
+
+               if (!empty($authors))
+               {
+                       return SimplePie_Misc::array_unique($authors);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_contributor($key = 0)
+       {
+               $contributors = $this->get_contributors();
+               if (isset($contributors[$key]))
+               {
+                       return $contributors[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_contributors()
+       {
+               $contributors = array();
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
+               {
+                       $name = null;
+                       $uri = null;
+                       $email = null;
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
+                       {
+                               $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $uri !== null)
+                       {
+                               $contributors[] =& new $this->item->feed->author_class($name, $uri, $email);
+                       }
+               }
+               foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
+               {
+                       $name = null;
+                       $url = null;
+                       $email = null;
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
+                       {
+                               $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
+                       {
+                               $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
+                       }
+                       if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
+                       {
+                               $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       if ($name !== null || $email !== null || $url !== null)
+                       {
+                               $contributors[] =& new $this->item->feed->author_class($name, $url, $email);
+                       }
+               }
+
+               if (!empty($contributors))
+               {
+                       return SimplePie_Misc::array_unique($contributors);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_link($key = 0, $rel = 'alternate')
+       {
+               $links = $this->get_links($rel);
+               if (isset($links[$key]))
+               {
+                       return $links[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * Added for parity between the parent-level and the item/entry-level.
+        */
+       function get_permalink()
+       {
+               return $this->get_link(0);
+       }
+
+       function get_links($rel = 'alternate')
+       {
+               if (!isset($this->data['links']))
+               {
+                       $this->data['links'] = array();
+                       if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
+                       {
+                               foreach ($links as $link)
+                               {
+                                       if (isset($link['attribs']['']['href']))
+                                       {
+                                               $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+                                               $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+                                       }
+                               }
+                       }
+                       if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
+                       {
+                               foreach ($links as $link)
+                               {
+                                       if (isset($link['attribs']['']['href']))
+                                       {
+                                               $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
+                                               $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
+
+                                       }
+                               }
+                       }
+                       if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+                       if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+                       if ($links = $this->get_source_tags('', 'link'))
+                       {
+                               $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
+                       }
+
+                       $keys = array_keys($this->data['links']);
+                       foreach ($keys as $key)
+                       {
+                               if (SimplePie_Misc::is_isegment_nz_nc($key))
+                               {
+                                       if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
+                                       {
+                                               $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
+                                               $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
+                                       }
+                                       else
+                                       {
+                                               $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
+                                       }
+                               }
+                               elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+                               {
+                                       $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
+                               }
+                               $this->data['links'][$key] = array_unique($this->data['links'][$key]);
+                       }
+               }
+
+               if (isset($this->data['links'][$rel]))
+               {
+                       return $this->data['links'][$rel];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_description()
+       {
+               if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags('', 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_copyright()
+       {
+               if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
+               {
+                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags('', 'copyright'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_language()
+       {
+               if ($return = $this->get_source_tags('', 'language'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               elseif (isset($this->data['xml_lang']))
+               {
+                       return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_latitude()
+       {
+               if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+               {
+                       return (float) $match[1];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_longitude()
+       {
+               if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
+               {
+                       return (float) $return[0]['data'];
+               }
+               elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
+               {
+                       return (float) $match[2];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_image_url()
+       {
+               if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
+               {
+                       return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
+               {
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
+               }
+               else
+               {
+                       return null;
+               }
+       }
+}
+
+class SimplePie_Author
+{
+       var $name;
+       var $link;
+       var $email;
+
+       // Constructor, used to input the data
+       function SimplePie_Author($name = null, $link = null, $email = null)
+       {
+               $this->name = $name;
+               $this->link = $link;
+               $this->email = $email;
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_name()
+       {
+               if ($this->name !== null)
+               {
+                       return $this->name;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_link()
+       {
+               if ($this->link !== null)
+               {
+                       return $this->link;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_email()
+       {
+               if ($this->email !== null)
+               {
+                       return $this->email;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+}
+
+class SimplePie_Category
+{
+       var $term;
+       var $scheme;
+       var $label;
+
+       // Constructor, used to input the data
+       function SimplePie_Category($term = null, $scheme = null, $label = null)
+       {
+               $this->term = $term;
+               $this->scheme = $scheme;
+               $this->label = $label;
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_term()
+       {
+               if ($this->term !== null)
+               {
+                       return $this->term;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_scheme()
+       {
+               if ($this->scheme !== null)
+               {
+                       return $this->scheme;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_label()
+       {
+               if ($this->label !== null)
+               {
+                       return $this->label;
+               }
+               else
+               {
+                       return $this->get_term();
+               }
+       }
+}
+
+class SimplePie_Enclosure
+{
+       var $bitrate;
+       var $captions;
+       var $categories;
+       var $channels;
+       var $copyright;
+       var $credits;
+       var $description;
+       var $duration;
+       var $expression;
+       var $framerate;
+       var $handler;
+       var $hashes;
+       var $height;
+       var $javascript;
+       var $keywords;
+       var $lang;
+       var $length;
+       var $link;
+       var $medium;
+       var $player;
+       var $ratings;
+       var $restrictions;
+       var $samplingrate;
+       var $thumbnails;
+       var $title;
+       var $type;
+       var $width;
+
+       // Constructor, used to input the data
+       function SimplePie_Enclosure($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
+       {
+               $this->bitrate = $bitrate;
+               $this->captions = $captions;
+               $this->categories = $categories;
+               $this->channels = $channels;
+               $this->copyright = $copyright;
+               $this->credits = $credits;
+               $this->description = $description;
+               $this->duration = $duration;
+               $this->expression = $expression;
+               $this->framerate = $framerate;
+               $this->hashes = $hashes;
+               $this->height = $height;
+               $this->javascript = $javascript;
+               $this->keywords = $keywords;
+               $this->lang = $lang;
+               $this->length = $length;
+               $this->link = $link;
+               $this->medium = $medium;
+               $this->player = $player;
+               $this->ratings = $ratings;
+               $this->restrictions = $restrictions;
+               $this->samplingrate = $samplingrate;
+               $this->thumbnails = $thumbnails;
+               $this->title = $title;
+               $this->type = $type;
+               $this->width = $width;
+               if (class_exists('idna_convert'))
+               {
+                       $idn =& new idna_convert;
+                       $parsed = SimplePie_Misc::parse_url($link);
+                       $this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+               }
+               $this->handler = $this->get_handler(); // Needs to load last
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_bitrate()
+       {
+               if ($this->bitrate !== null)
+               {
+                       return $this->bitrate;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_caption($key = 0)
+       {
+               $captions = $this->get_captions();
+               if (isset($captions[$key]))
+               {
+                       return $captions[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_captions()
+       {
+               if ($this->captions !== null)
+               {
+                       return $this->captions;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_category($key = 0)
+       {
+               $categories = $this->get_categories();
+               if (isset($categories[$key]))
+               {
+                       return $categories[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_categories()
+       {
+               if ($this->categories !== null)
+               {
+                       return $this->categories;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_channels()
+       {
+               if ($this->channels !== null)
+               {
+                       return $this->channels;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_copyright()
+       {
+               if ($this->copyright !== null)
+               {
+                       return $this->copyright;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_credit($key = 0)
+       {
+               $credits = $this->get_credits();
+               if (isset($credits[$key]))
+               {
+                       return $credits[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_credits()
+       {
+               if ($this->credits !== null)
+               {
+                       return $this->credits;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_description()
+       {
+               if ($this->description !== null)
+               {
+                       return $this->description;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_duration($convert = false)
+       {
+               if ($this->duration !== null)
+               {
+                       if ($convert)
+                       {
+                               $time = SimplePie_Misc::time_hms($this->duration);
+                               return $time;
+                       }
+                       else
+                       {
+                               return $this->duration;
+                       }
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_expression()
+       {
+               if ($this->expression !== null)
+               {
+                       return $this->expression;
+               }
+               else
+               {
+                       return 'full';
+               }
+       }
+
+       function get_extension()
+       {
+               if ($this->link !== null)
+               {
+                       $url = SimplePie_Misc::parse_url($this->link);
+                       if ($url['path'] !== '')
+                       {
+                               return pathinfo($url['path'], PATHINFO_EXTENSION);
+                       }
+               }
+               return null;
+       }
+
+       function get_framerate()
+       {
+               if ($this->framerate !== null)
+               {
+                       return $this->framerate;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_handler()
+       {
+               return $this->get_real_type(true);
+       }
+
+       function get_hash($key = 0)
+       {
+               $hashes = $this->get_hashes();
+               if (isset($hashes[$key]))
+               {
+                       return $hashes[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_hashes()
+       {
+               if ($this->hashes !== null)
+               {
+                       return $this->hashes;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_height()
+       {
+               if ($this->height !== null)
+               {
+                       return $this->height;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_language()
+       {
+               if ($this->lang !== null)
+               {
+                       return $this->lang;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_keyword($key = 0)
+       {
+               $keywords = $this->get_keywords();
+               if (isset($keywords[$key]))
+               {
+                       return $keywords[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_keywords()
+       {
+               if ($this->keywords !== null)
+               {
+                       return $this->keywords;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_length()
+       {
+               if ($this->length !== null)
+               {
+                       return $this->length;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_link()
+       {
+               if ($this->link !== null)
+               {
+                       return urldecode($this->link);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_medium()
+       {
+               if ($this->medium !== null)
+               {
+                       return $this->medium;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_player()
+       {
+               if ($this->player !== null)
+               {
+                       return $this->player;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_rating($key = 0)
+       {
+               $ratings = $this->get_ratings();
+               if (isset($ratings[$key]))
+               {
+                       return $ratings[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_ratings()
+       {
+               if ($this->ratings !== null)
+               {
+                       return $this->ratings;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_restriction($key = 0)
+       {
+               $restrictions = $this->get_restrictions();
+               if (isset($restrictions[$key]))
+               {
+                       return $restrictions[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_restrictions()
+       {
+               if ($this->restrictions !== null)
+               {
+                       return $this->restrictions;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_sampling_rate()
+       {
+               if ($this->samplingrate !== null)
+               {
+                       return $this->samplingrate;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_size()
+       {
+               $length = $this->get_length();
+               if ($length !== null)
+               {
+                       return round($length/1048576, 2);
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_thumbnail($key = 0)
+       {
+               $thumbnails = $this->get_thumbnails();
+               if (isset($thumbnails[$key]))
+               {
+                       return $thumbnails[$key];
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_thumbnails()
+       {
+               if ($this->thumbnails !== null)
+               {
+                       return $this->thumbnails;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_title()
+       {
+               if ($this->title !== null)
+               {
+                       return $this->title;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_type()
+       {
+               if ($this->type !== null)
+               {
+                       return $this->type;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_width()
+       {
+               if ($this->width !== null)
+               {
+                       return $this->width;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function native_embed($options='')
+       {
+               return $this->embed($options, true);
+       }
+
+       /**
+        * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
+        */
+       function embed($options = '', $native = false)
+       {
+               // Set up defaults
+               $audio = '';
+               $video = '';
+               $alt = '';
+               $altclass = '';
+               $loop = 'false';
+               $width = 'auto';
+               $height = 'auto';
+               $bgcolor = '#ffffff';
+               $mediaplayer = '';
+               $widescreen = false;
+               $handler = $this->get_handler();
+               $type = $this->get_real_type();
+
+               // Process options and reassign values as necessary
+               if (is_array($options))
+               {
+                       extract($options);
+               }
+               else
+               {
+                       $options = explode(',', $options);
+                       foreach($options as $option)
+                       {
+                               $opt = explode(':', $option, 2);
+                               if (isset($opt[0], $opt[1]))
+                               {
+                                       $opt[0] = trim($opt[0]);
+                                       $opt[1] = trim($opt[1]);
+                                       switch ($opt[0])
+                                       {
+                                               case 'audio':
+                                                       $audio = $opt[1];
+                                                       break;
+
+                                               case 'video':
+                                                       $video = $opt[1];
+                                                       break;
+
+                                               case 'alt':
+                                                       $alt = $opt[1];
+                                                       break;
+
+                                               case 'altclass':
+                                                       $altclass = $opt[1];
+                                                       break;
+
+                                               case 'loop':
+                                                       $loop = $opt[1];
+                                                       break;
+
+                                               case 'width':
+                                                       $width = $opt[1];
+                                                       break;
+
+                                               case 'height':
+                                                       $height = $opt[1];
+                                                       break;
+
+                                               case 'bgcolor':
+                                                       $bgcolor = $opt[1];
+                                                       break;
+
+                                               case 'mediaplayer':
+                                                       $mediaplayer = $opt[1];
+                                                       break;
+
+                                               case 'widescreen':
+                                                       $widescreen = $opt[1];
+                                                       break;
+                                       }
+                               }
+                       }
+               }
+
+               $mime = explode('/', $type, 2);
+               $mime = $mime[0];
+
+               // Process values for 'auto'
+               if ($width == 'auto')
+               {
+                       if ($mime == 'video')
+                       {
+                               if ($height == 'auto')
+                               {
+                                       $width = 480;
+                               }
+                               elseif ($widescreen)
+                               {
+                                       $width = round((intval($height)/9)*16);
+                               }
+                               else
+                               {
+                                       $width = round((intval($height)/3)*4);
+                               }
+                       }
+                       else
+                       {
+                               $width = '100%';
+                       }
+               }
+
+               if ($height == 'auto')
+               {
+                       if ($mime == 'audio')
+                       {
+                               $height = 0;
+                       }
+                       elseif ($mime == 'video')
+                       {
+                               if ($width == 'auto')
+                               {
+                                       if ($widescreen)
+                                       {
+                                               $height = 270;
+                                       }
+                                       else
+                                       {
+                                               $height = 360;
+                                       }
+                               }
+                               elseif ($widescreen)
+                               {
+                                       $height = round((intval($width)/16)*9);
+                               }
+                               else
+                               {
+                                       $height = round((intval($width)/4)*3);
+                               }
+                       }
+                       else
+                       {
+                               $height = 376;
+                       }
+               }
+               elseif ($mime == 'audio')
+               {
+                       $height = 0;
+               }
+
+               // Set proper placeholder value
+               if ($mime == 'audio')
+               {
+                       $placeholder = $audio;
+               }
+               elseif ($mime == 'video')
+               {
+                       $placeholder = $video;
+               }
+
+               $embed = '';
+
+               // Make sure the JS library is included
+               if (!$native)
+               {
+                       static $javascript_outputted = null;
+                       if (!$javascript_outputted && $this->javascript)
+                       {
+                               $embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>';
+                               $javascript_outputted = true;
+                       }
+               }
+
+               // Odeo Feed MP3's
+               if ($handler == 'odeo')
+               {
+                       if ($native)
+                       {
+                               $embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url=' . $this->get_link() . '"></embed>';
+                       }
+                       else
+                       {
+                               $embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>';
+                       }
+               }
+
+               // Flash
+               elseif ($handler == 'flash')
+               {
+                       if ($native)
+                       {
+                               $embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
+                       }
+                       else
+                       {
+                               $embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
+                       }
+               }
+
+               // Flash Media Player file types.
+               // Preferred handler for MP3 file types.
+               elseif ($handler == 'fmedia' || ($handler == 'mp3' && $mediaplayer != ''))
+               {
+                       $height += 20;
+                       if ($native)
+                       {
+                               $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
+                       }
+                       else
+                       {
+                               $embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
+                       }
+               }
+
+               // QuickTime 7 file types.  Need to test with QuickTime 6.
+               // Only handle MP3's if the Flash Media Player is not present.
+               elseif ($handler == 'quicktime' || ($handler == 'mp3' && $mediaplayer == ''))
+               {
+                       $height += 16;
+                       if ($native)
+                       {
+                               if ($placeholder != ""){
+                                       $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
+                               }
+                               else {
+                                       $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
+                               }
+                       }
+                       else
+                       {
+                               $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
+                       }
+               }
+
+               // Windows Media
+               elseif ($handler == 'wmedia')
+               {
+                       $height += 45;
+                       if ($native)
+                       {
+                               $embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
+                       }
+                       else
+                       {
+                               $embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
+                       }
+               }
+
+               // Everything else
+               else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
+
+               return $embed;
+       }
+
+       function get_real_type($find_handler = false)
+       {
+               // If it's Odeo, let's get it out of the way.
+               if (substr(strtolower($this->get_link()), 0, 15) == 'http://odeo.com')
+               {
+                       return 'odeo';
+               }
+
+               // Mime-types by handler.
+               $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
+               $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
+               $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
+               $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
+               $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
+
+               if ($this->get_type() !== null)
+               {
+                       $type = strtolower($this->type);
+               }
+               else
+               {
+                       $type = null;
+               }
+
+               // If we encounter an unsupported mime-type, check the file extension and guess intelligently.
+               if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
+               {
+                       switch (strtolower($this->get_extension()))
+                       {
+                               // Audio mime-types
+                               case 'aac':
+                               case 'adts':
+                                       $type = 'audio/acc';
+                                       break;
+
+                               case 'aif':
+                               case 'aifc':
+                               case 'aiff':
+                               case 'cdda':
+                                       $type = 'audio/aiff';
+                                       break;
+
+                               case 'bwf':
+                                       $type = 'audio/wav';
+                                       break;
+
+                               case 'kar':
+                               case 'mid':
+                               case 'midi':
+                               case 'smf':
+                                       $type = 'audio/midi';
+                                       break;
+
+                               case 'm4a':
+                                       $type = 'audio/x-m4a';
+                                       break;
+
+                               case 'mp3':
+                               case 'swa':
+                                       $type = 'audio/mp3';
+                                       break;
+
+                               case 'wav':
+                                       $type = 'audio/wav';
+                                       break;
+
+                               case 'wax':
+                                       $type = 'audio/x-ms-wax';
+                                       break;
+
+                               case 'wma':
+                                       $type = 'audio/x-ms-wma';
+                                       break;
+
+                               // Video mime-types
+                               case '3gp':
+                               case '3gpp':
+                                       $type = 'video/3gpp';
+                                       break;
+
+                               case '3g2':
+                               case '3gp2':
+                                       $type = 'video/3gpp2';
+                                       break;
+
+                               case 'asf':
+                                       $type = 'video/x-ms-asf';
+                                       break;
+
+                               case 'flv':
+                                       $type = 'video/x-flv';
+                                       break;
+
+                               case 'm1a':
+                               case 'm1s':
+                               case 'm1v':
+                               case 'm15':
+                               case 'm75':
+                               case 'mp2':
+                               case 'mpa':
+                               case 'mpeg':
+                               case 'mpg':
+                               case 'mpm':
+                               case 'mpv':
+                                       $type = 'video/mpeg';
+                                       break;
+
+                               case 'm4v':
+                                       $type = 'video/x-m4v';
+                                       break;
+
+                               case 'mov':
+                               case 'qt':
+                                       $type = 'video/quicktime';
+                                       break;
+
+                               case 'mp4':
+                               case 'mpg4':
+                                       $type = 'video/mp4';
+                                       break;
+
+                               case 'sdv':
+                                       $type = 'video/sd-video';
+                                       break;
+
+                               case 'wm':
+                                       $type = 'video/x-ms-wm';
+                                       break;
+
+                               case 'wmv':
+                                       $type = 'video/x-ms-wmv';
+                                       break;
+
+                               case 'wvx':
+                                       $type = 'video/x-ms-wvx';
+                                       break;
+
+                               // Flash mime-types
+                               case 'spl':
+                                       $type = 'application/futuresplash';
+                                       break;
+
+                               case 'swf':
+                                       $type = 'application/x-shockwave-flash';
+                                       break;
+                       }
+               }
+
+               if ($find_handler)
+               {
+                       if (in_array($type, $types_flash))
+                       {
+                               return 'flash';
+                       }
+                       elseif (in_array($type, $types_fmedia))
+                       {
+                               return 'fmedia';
+                       }
+                       elseif (in_array($type, $types_quicktime))
+                       {
+                               return 'quicktime';
+                       }
+                       elseif (in_array($type, $types_wmedia))
+                       {
+                               return 'wmedia';
+                       }
+                       elseif (in_array($type, $types_mp3))
+                       {
+                               return 'mp3';
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+               else
+               {
+                       return $type;
+               }
+       }
+}
+
+class SimplePie_Caption
+{
+       var $type;
+       var $lang;
+       var $startTime;
+       var $endTime;
+       var $text;
+
+       // Constructor, used to input the data
+       function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
+       {
+               $this->type = $type;
+               $this->lang = $lang;
+               $this->startTime = $startTime;
+               $this->endTime = $endTime;
+               $this->text = $text;
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_endtime()
+       {
+               if ($this->endTime !== null)
+               {
+                       return $this->endTime;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_language()
+       {
+               if ($this->lang !== null)
+               {
+                       return $this->lang;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_starttime()
+       {
+               if ($this->startTime !== null)
+               {
+                       return $this->startTime;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_text()
+       {
+               if ($this->text !== null)
+               {
+                       return $this->text;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_type()
+       {
+               if ($this->type !== null)
+               {
+                       return $this->type;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+}
+
+class SimplePie_Credit
+{
+       var $role;
+       var $scheme;
+       var $name;
+
+       // Constructor, used to input the data
+       function SimplePie_Credit($role = null, $scheme = null, $name = null)
+       {
+               $this->role = $role;
+               $this->scheme = $scheme;
+               $this->name = $name;
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_role()
+       {
+               if ($this->role !== null)
+               {
+                       return $this->role;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_scheme()
+       {
+               if ($this->scheme !== null)
+               {
+                       return $this->scheme;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_name()
+       {
+               if ($this->name !== null)
+               {
+                       return $this->name;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+}
+
+class SimplePie_Copyright
+{
+       var $url;
+       var $label;
+
+       // Constructor, used to input the data
+       function SimplePie_Copyright($url = null, $label = null)
+       {
+               $this->url = $url;
+               $this->label = $label;
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_url()
+       {
+               if ($this->url !== null)
+               {
+                       return $this->url;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_attribution()
+       {
+               if ($this->label !== null)
+               {
+                       return $this->label;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+}
+
+class SimplePie_Rating
+{
+       var $scheme;
+       var $value;
+
+       // Constructor, used to input the data
+       function SimplePie_Rating($scheme = null, $value = null)
+       {
+               $this->scheme = $scheme;
+               $this->value = $value;
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_scheme()
+       {
+               if ($this->scheme !== null)
+               {
+                       return $this->scheme;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_value()
+       {
+               if ($this->value !== null)
+               {
+                       return $this->value;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+}
+
+class SimplePie_Restriction
+{
+       var $relationship;
+       var $type;
+       var $value;
+
+       // Constructor, used to input the data
+       function SimplePie_Restriction($relationship = null, $type = null, $value = null)
+       {
+               $this->relationship = $relationship;
+               $this->type = $type;
+               $this->value = $value;
+       }
+
+       function __toString()
+       {
+               // There is no $this->data here
+               return md5(serialize($this));
+       }
+
+       function get_relationship()
+       {
+               if ($this->relationship !== null)
+               {
+                       return $this->relationship;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_type()
+       {
+               if ($this->type !== null)
+               {
+                       return $this->type;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       function get_value()
+       {
+               if ($this->value !== null)
+               {
+                       return $this->value;
+               }
+               else
+               {
+                       return null;
+               }
+       }
+}
+
+/**
+ * @todo Move to properly supporting RFC2616 (HTTP/1.1)
+ */
+class SimplePie_File
+{
+       var $url;
+       var $useragent;
+       var $success = true;
+       var $headers = array();
+       var $body;
+       var $status_code;
+       var $redirects = 0;
+       var $error;
+       var $method = SIMPLEPIE_FILE_SOURCE_NONE;
+
+       function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
+       {
+               if (class_exists('idna_convert'))
+               {
+                       $idn =& new idna_convert;
+                       $parsed = SimplePie_Misc::parse_url($url);
+                       $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
+               }
+               $this->url = $url;
+               $this->useragent = $useragent;
+               if (preg_match('/^http(s)?:\/\//i', $url))
+               {
+                       if ($useragent === null)
+                       {
+                               $useragent = ini_get('user_agent');
+                               $this->useragent = $useragent;
+                       }
+                       if (!is_array($headers))
+                       {
+                               $headers = array();
+                       }
+                       if (!$force_fsockopen && function_exists('curl_exec'))
+                       {
+                               $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
+                               $fp = curl_init();
+                               $headers2 = array();
+                               foreach ($headers as $key => $value)
+                               {
+                                       $headers2[] = "$key: $value";
+                               }
+                               if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
+                               {
+                                       curl_setopt($fp, CURLOPT_ENCODING, '');
+                               }
+                               curl_setopt($fp, CURLOPT_URL, $url);
+                               curl_setopt($fp, CURLOPT_HEADER, 1);
+                               curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
+                               curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
+                               curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
+                               curl_setopt($fp, CURLOPT_REFERER, $url);
+                               curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
+                               curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
+                               if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
+                               {
+                                       curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
+                                       curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
+                               }
+
+                               $this->headers = curl_exec($fp);
+                               if (curl_errno($fp) == 23 || curl_errno($fp) == 61)
+                               {
+                                       curl_setopt($fp, CURLOPT_ENCODING, 'none');
+                                       $this->headers = curl_exec($fp);
+                               }
+                               if (curl_errno($fp))
+                               {
+                                       $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
+                                       $this->success = false;
+                               }
+                               else
+                               {
+                                       $info = curl_getinfo($fp);
+                                       curl_close($fp);
+                                       $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
+                                       $this->headers = array_pop($this->headers);
+                                       $parser =& new SimplePie_HTTP_Parser($this->headers);
+                                       if ($parser->parse())
+                                       {
+                                               $this->headers = $parser->headers;
+                                               $this->body = $parser->body;
+                                               $this->status_code = $parser->status_code;
+                                               if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
+                                               {
+                                                       $this->redirects++;
+                                                       $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
+                                                       return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
+                               $url_parts = parse_url($url);
+                               if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) == 'https')
+                               {
+                                       $url_parts['host'] = "ssl://$url_parts[host]";
+                                       $url_parts['port'] = 443;
+                               }
+                               if (!isset($url_parts['port']))
+                               {
+                                       $url_parts['port'] = 80;
+                               }
+                               $fp = @fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, $timeout);
+                               if (!$fp)
+                               {
+                                       $this->error = 'fsockopen error: ' . $errstr;
+                                       $this->success = false;
+                               }
+                               else
+                               {
+                                       stream_set_timeout($fp, $timeout);
+                                       if (isset($url_parts['path']))
+                                       {
+                                               if (isset($url_parts['query']))
+                                               {
+                                                       $get = "$url_parts[path]?$url_parts[query]";
+                                               }
+                                               else
+                                               {
+                                                       $get = $url_parts['path'];
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $get = '/';
+                                       }
+                                       $out = "GET $get HTTP/1.0\r\n";
+                                       $out .= "Host: $url_parts[host]\r\n";
+                                       $out .= "User-Agent: $useragent\r\n";
+                                       if (extension_loaded('zlib'))
+                                       {
+                                               $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
+                                       }
+
+                                       if (isset($url_parts['user']) && isset($url_parts['pass']))
+                                       {
+                                               $out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
+                                       }
+                                       foreach ($headers as $key => $value)
+                                       {
+                                               $out .= "$key: $value\r\n";
+                                       }
+                                       $out .= "Connection: Close\r\n\r\n";
+                                       fwrite($fp, $out);
+
+                                       $info = stream_get_meta_data($fp);
+
+                                       $this->headers = '';
+                                       while (!$info['eof'] && !$info['timed_out'])
+                                       {
+                                               $this->headers .= fread($fp, 1160);
+                                               $info = stream_get_meta_data($fp);
+                                       }
+                                       if (!$info['timed_out'])
+                                       {
+                                               $parser =& new SimplePie_HTTP_Parser($this->headers);
+                                               if ($parser->parse())
+                                               {
+                                                       $this->headers = $parser->headers;
+                                                       $this->body = $parser->body;
+                                                       $this->status_code = $parser->status_code;
+                                                       if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
+                                                       {
+                                                               $this->redirects++;
+                                                               $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
+                                                               return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
+                                                       }
+                                                       if (isset($this->headers['content-encoding']))
+                                                       {
+                                                               // Hey, we act dumb elsewhere, so let's do that here too
+                                                               switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
+                                                               {
+                                                                       case 'gzip':
+                                                                       case 'x-gzip':
+                                                                               $decoder = new SimplePie_gzdecode($this->body);
+                                                                               if (!$decoder->parse())
+                                                                               {
+                                                                                       $this->error = 'Unable to decode HTTP "gzip" stream';
+                                                                                       $this->success = false;
+                                                                               }
+                                                                               else
+                                                                               {
+                                                                                       $this->body = $decoder->data;
+                                                                               }
+                                                                               break;
+
+                                                                       case 'deflate':
+                                                                               if (($body = gzuncompress($this->body)) === false)
+                                                                               {
+                                                                                       if (($body = gzinflate($this->body)) === false)
+                                                                                       {
+                                                                                               $this->error = 'Unable to decode HTTP "deflate" stream';
+                                                                                               $this->success = false;
+                                                                                       }
+                                                                               }
+                                                                               $this->body = $body;
+                                                                               break;
+
+                                                                       default:
+                                                                               $this->error = 'Unknown content coding';
+                                                                               $this->success = false;
+                                                               }
+                                                       }
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $this->error = 'fsocket timed out';
+                                               $this->success = false;
+                                       }
+                                       fclose($fp);
+                               }
+                       }
+               }
+               else
+               {
+                       $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
+                       if (!$this->body = file_get_contents($url))
+                       {
+                               $this->error = 'file_get_contents could not read the file';
+                               $this->success = false;
+                       }
+               }
+       }
+}
+
+/**
+ * HTTP Response Parser
+ *
+ * @package SimplePie
+ */
+class SimplePie_HTTP_Parser
+{
+       /**
+        * HTTP Version
+        *
+        * @access public
+        * @var float
+        */
+       var $http_version = 0.0;
+
+       /**
+        * Status code
+        *
+        * @access public
+        * @var int
+        */
+       var $status_code = 0;
+
+       /**
+        * Reason phrase
+        *
+        * @access public
+        * @var string
+        */
+       var $reason = '';
+
+       /**
+        * Key/value pairs of the headers
+        *
+        * @access public
+        * @var array
+        */
+       var $headers = array();
+
+       /**
+        * Body of the response
+        *
+        * @access public
+        * @var string
+        */
+       var $body = '';
+
+       /**
+        * Current state of the state machine
+        *
+        * @access private
+        * @var string
+        */
+       var $state = 'http_version';
+
+       /**
+        * Input data
+        *
+        * @access private
+        * @var string
+        */
+       var $data = '';
+
+       /**
+        * Input data length (to avoid calling strlen() everytime this is needed)
+        *
+        * @access private
+        * @var int
+        */
+       var $data_length = 0;
+
+       /**
+        * Current position of the pointer
+        *
+        * @var int
+        * @access private
+        */
+       var $position = 0;
+
+       /**
+        * Name of the hedaer currently being parsed
+        *
+        * @access private
+        * @var string
+        */
+       var $name = '';
+
+       /**
+        * Value of the hedaer currently being parsed
+        *
+        * @access private
+        * @var string
+        */
+       var $value = '';
+
+       /**
+        * Create an instance of the class with the input data
+        *
+        * @access public
+        * @param string $data Input data
+        */
+       function SimplePie_HTTP_Parser($data)
+       {
+               $this->data = $data;
+               $this->data_length = strlen($this->data);
+       }
+
+       /**
+        * Parse the input data
+        *
+        * @access public
+        * @return bool true on success, false on failure
+        */
+       function parse()
+       {
+               while ($this->state && $this->state !== 'emit' && $this->has_data())
+               {
+                       $state = $this->state;
+                       $this->$state();
+               }
+               $this->data = '';
+               if ($this->state === 'emit' || $this->state === 'body')
+               {
+                       return true;
+               }
+               else
+               {
+                       $this->http_version = '';
+                       $this->status_code = '';
+                       $this->reason = '';
+                       $this->headers = array();
+                       $this->body = '';
+                       return false;
+               }
+       }
+
+       /**
+        * Check whether there is data beyond the pointer
+        *
+        * @access private
+        * @return bool true if there is further data, false if not
+        */
+       function has_data()
+       {
+               return (bool) ($this->position < $this->data_length);
+       }
+
+       /**
+        * See if the next character is LWS
+        *
+        * @access private
+        * @return bool true if the next character is LWS, false if not
+        */
+       function is_linear_whitespace()
+       {
+               return (bool) ($this->data[$this->position] === "\x09"
+                       || $this->data[$this->position] === "\x20"
+                       || ($this->data[$this->position] === "\x0A"
+                               && isset($this->data[$this->position + 1])
+                               && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
+       }
+
+       /**
+        * Parse the HTTP version
+        *
+        * @access private
+        */
+       function http_version()
+       {
+               if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/')
+               {
+                       $len = strspn($this->data, '0123456789.', 5);
+                       $this->http_version = substr($this->data, 5, $len);
+                       $this->position += 5 + $len;
+                       if (substr_count($this->http_version, '.') <= 1)
+                       {
+                               $this->http_version = (float) $this->http_version;
+                               $this->position += strspn($this->data, "\x09\x20", $this->position);
+                               $this->state = 'status';
+                       }
+                       else
+                       {
+                               $this->state = false;
+                       }
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       /**
+        * Parse the status code
+        *
+        * @access private
+        */
+       function status()
+       {
+               if ($len = strspn($this->data, '0123456789', $this->position))
+               {
+                       $this->status_code = (int) substr($this->data, $this->position, $len);
+                       $this->position += $len;
+                       $this->state = 'reason';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       /**
+        * Parse the reason phrase
+        *
+        * @access private
+        */
+       function reason()
+       {
+               $len = strcspn($this->data, "\x0A", $this->position);
+               $this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20");
+               $this->position += $len + 1;
+               $this->state = 'new_line';
+       }
+
+       /**
+        * Deal with a new line, shifting data around as needed
+        *
+        * @access private
+        */
+       function new_line()
+       {
+               $this->value = trim($this->value, "\x0D\x20");
+               if ($this->name !== '' && $this->value !== '')
+               {
+                       $this->name = strtolower($this->name);
+                       if (isset($this->headers[$this->name]))
+                       {
+                               $this->headers[$this->name] .= ', ' . $this->value;
+                       }
+                       else
+                       {
+                               $this->headers[$this->name] = $this->value;
+                       }
+               }
+               $this->name = '';
+               $this->value = '';
+               if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A")
+               {
+                       $this->position += 2;
+                       $this->state = 'body';
+               }
+               elseif ($this->data[$this->position] === "\x0A")
+               {
+                       $this->position++;
+                       $this->state = 'body';
+               }
+               else
+               {
+                       $this->state = 'name';
+               }
+       }
+
+       /**
+        * Parse a header name
+        *
+        * @access private
+        */
+       function name()
+       {
+               $len = strcspn($this->data, "\x0A:", $this->position);
+               if (isset($this->data[$this->position + $len]))
+               {
+                       if ($this->data[$this->position + $len] === "\x0A")
+                       {
+                               $this->position += $len;
+                               $this->state = 'new_line';
+                       }
+                       else
+                       {
+                               $this->name = substr($this->data, $this->position, $len);
+                               $this->position += $len + 1;
+                               $this->state = 'value';
+                       }
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       /**
+        * Parse LWS, replacing consecutive LWS characters with a single space
+        *
+        * @access private
+        */
+       function linear_whitespace()
+       {
+               do
+               {
+                       if (substr($this->data, $this->position, 2) === "\x0D\x0A")
+                       {
+                               $this->position += 2;
+                       }
+                       elseif ($this->data[$this->position] === "\x0A")
+                       {
+                               $this->position++;
+                       }
+                       $this->position += strspn($this->data, "\x09\x20", $this->position);
+               } while ($this->has_data() && $this->is_linear_whitespace());
+               $this->value .= "\x20";
+       }
+
+       /**
+        * See what state to move to while within non-quoted header values
+        *
+        * @access private
+        */
+       function value()
+       {
+               if ($this->is_linear_whitespace())
+               {
+                       $this->linear_whitespace();
+               }
+               else
+               {
+                       switch ($this->data[$this->position])
+                       {
+                               case '"':
+                                       $this->position++;
+                                       $this->state = 'quote';
+                                       break;
+
+                               case "\x0A":
+                                       $this->position++;
+                                       $this->state = 'new_line';
+                                       break;
+
+                               default:
+                                       $this->state = 'value_char';
+                                       break;
+                       }
+               }
+       }
+
+       /**
+        * Parse a header value while outside quotes
+        *
+        * @access private
+        */
+       function value_char()
+       {
+               $len = strcspn($this->data, "\x09\x20\x0A\"", $this->position);
+               $this->value .= substr($this->data, $this->position, $len);
+               $this->position += $len;
+               $this->state = 'value';
+       }
+
+       /**
+        * See what state to move to while within quoted header values
+        *
+        * @access private
+        */
+       function quote()
+       {
+               if ($this->is_linear_whitespace())
+               {
+                       $this->linear_whitespace();
+               }
+               else
+               {
+                       switch ($this->data[$this->position])
+                       {
+                               case '"':
+                                       $this->position++;
+                                       $this->state = 'value';
+                                       break;
+
+                               case "\x0A":
+                                       $this->position++;
+                                       $this->state = 'new_line';
+                                       break;
+
+                               case '\\':
+                                       $this->position++;
+                                       $this->state = 'quote_escaped';
+                                       break;
+
+                               default:
+                                       $this->state = 'quote_char';
+                                       break;
+                       }
+               }
+       }
+
+       /**
+        * Parse a header value while within quotes
+        *
+        * @access private
+        */
+       function quote_char()
+       {
+               $len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position);
+               $this->value .= substr($this->data, $this->position, $len);
+               $this->position += $len;
+               $this->state = 'value';
+       }
+
+       /**
+        * Parse an escaped character within quotes
+        *
+        * @access private
+        */
+       function quote_escaped()
+       {
+               $this->value .= $this->data[$this->position];
+               $this->position++;
+               $this->state = 'quote';
+       }
+
+       /**
+        * Parse the body
+        *
+        * @access private
+        */
+       function body()
+       {
+               $this->body = substr($this->data, $this->position);
+               $this->state = 'emit';
+       }
+}
+
+/**
+ * gzdecode
+ *
+ * @package SimplePie
+ */
+class SimplePie_gzdecode
+{
+       /**
+        * Compressed data
+        *
+        * @access private
+        * @see gzdecode::$data
+        */
+       var $compressed_data;
+
+       /**
+        * Size of compressed data
+        *
+        * @access private
+        */
+       var $compressed_size;
+
+       /**
+        * Minimum size of a valid gzip string
+        *
+        * @access private
+        */
+       var $min_compressed_size = 18;
+
+       /**
+        * Current position of pointer
+        *
+        * @access private
+        */
+       var $position = 0;
+
+       /**
+        * Flags (FLG)
+        *
+        * @access private
+        */
+       var $flags;
+
+       /**
+        * Uncompressed data
+        *
+        * @access public
+        * @see gzdecode::$compressed_data
+        */
+       var $data;
+
+       /**
+        * Modified time
+        *
+        * @access public
+        */
+       var $MTIME;
+
+       /**
+        * Extra Flags
+        *
+        * @access public
+        */
+       var $XFL;
+
+       /**
+        * Operating System
+        *
+        * @access public
+        */
+       var $OS;
+
+       /**
+        * Subfield ID 1
+        *
+        * @access public
+        * @see gzdecode::$extra_field
+        * @see gzdecode::$SI2
+        */
+       var $SI1;
+
+       /**
+        * Subfield ID 2
+        *
+        * @access public
+        * @see gzdecode::$extra_field
+        * @see gzdecode::$SI1
+        */
+       var $SI2;
+
+       /**
+        * Extra field content
+        *
+        * @access public
+        * @see gzdecode::$SI1
+        * @see gzdecode::$SI2
+        */
+       var $extra_field;
+
+       /**
+        * Original filename
+        *
+        * @access public
+        */
+       var $filename;
+
+       /**
+        * Human readable comment
+        *
+        * @access public
+        */
+       var $comment;
+
+       /**
+        * Don't allow anything to be set
+        *
+        * @access public
+        */
+       function __set($name, $value)
+       {
+               trigger_error("Cannot write property $name", E_USER_ERROR);
+       }
+
+       /**
+        * Set the compressed string and related properties
+        *
+        * @access public
+        */
+       function SimplePie_gzdecode($data)
+       {
+               $this->compressed_data = $data;
+               $this->compressed_size = strlen($data);
+       }
+
+       /**
+        * Decode the GZIP stream
+        *
+        * @access public
+        */
+       function parse()
+       {
+               if ($this->compressed_size >= $this->min_compressed_size)
+               {
+                       // Check ID1, ID2, and CM
+                       if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
+                       {
+                               return false;
+                       }
+
+                       // Get the FLG (FLaGs)
+                       $this->flags = ord($this->compressed_data[3]);
+
+                       // FLG bits above (1 << 4) are reserved
+                       if ($this->flags > 0x1F)
+                       {
+                               return false;
+                       }
+
+                       // Advance the pointer after the above
+                       $this->position += 4;
+
+                       // MTIME
+                       $mtime = substr($this->compressed_data, $this->position, 4);
+                       // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
+                       if (current(unpack('S', "\x00\x01")) === 1)
+                       {
+                               $mtime = strrev($mtime);
+                       }
+                       $this->MTIME = current(unpack('l', $mtime));
+                       $this->position += 4;
+
+                       // Get the XFL (eXtra FLags)
+                       $this->XFL = ord($this->compressed_data[$this->position++]);
+
+                       // Get the OS (Operating System)
+                       $this->OS = ord($this->compressed_data[$this->position++]);
+
+                       // Parse the FEXTRA
+                       if ($this->flags & 4)
+                       {
+                               // Read subfield IDs
+                               $this->SI1 = $this->compressed_data[$this->position++];
+                               $this->SI2 = $this->compressed_data[$this->position++];
+
+                               // SI2 set to zero is reserved for future use
+                               if ($this->SI2 === "\x00")
+                               {
+                                       return false;
+                               }
+
+                               // Get the length of the extra field
+                               $len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+                               $position += 2;
+
+                               // Check the length of the string is still valid
+                               $this->min_compressed_size += $len + 4;
+                               if ($this->compressed_size >= $this->min_compressed_size)
+                               {
+                                       // Set the extra field to the given data
+                                       $this->extra_field = substr($this->compressed_data, $this->position, $len);
+                                       $this->position += $len;
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       }
+
+                       // Parse the FNAME
+                       if ($this->flags & 8)
+                       {
+                               // Get the length of the filename
+                               $len = strspn($this->compressed_data, "\x00", $this->position);
+
+                               // Check the length of the string is still valid
+                               $this->min_compressed_size += $len + 1;
+                               if ($this->compressed_size >= $this->min_compressed_size)
+                               {
+                                       // Set the original filename to the given string
+                                       $this->filename = substr($this->compressed_data, $this->position, $len);
+                                       $this->position += $len + 1;
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       }
+
+                       // Parse the FCOMMENT
+                       if ($this->flags & 16)
+                       {
+                               // Get the length of the comment
+                               $len = strspn($this->compressed_data, "\x00", $this->position);
+
+                               // Check the length of the string is still valid
+                               $this->min_compressed_size += $len + 1;
+                               if ($this->compressed_size >= $this->min_compressed_size)
+                               {
+                                       // Set the original comment to the given string
+                                       $this->comment = substr($this->compressed_data, $this->position, $len);
+                                       $this->position += $len + 1;
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       }
+
+                       // Parse the FHCRC
+                       if ($this->flags & 2)
+                       {
+                               // Check the length of the string is still valid
+                               $this->min_compressed_size += $len + 2;
+                               if ($this->compressed_size >= $this->min_compressed_size)
+                               {
+                                       // Read the CRC
+                                       $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
+
+                                       // Check the CRC matches
+                                       if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
+                                       {
+                                               $this->position += 2;
+                                       }
+                                       else
+                                       {
+                                               return false;
+                                       }
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       }
+
+                       // Decompress the actual data
+                       if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
+                       {
+                               return false;
+                       }
+                       else
+                       {
+                               $this->position = $this->compressed_size - 8;
+                       }
+
+                       // Check CRC of data
+                       $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+                       $this->position += 4;
+                       /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
+                       {
+                               return false;
+                       }*/
+
+                       // Check ISIZE of data
+                       $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
+                       $this->position += 4;
+                       if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
+                       {
+                               return false;
+                       }
+
+                       // Wow, against all odds, we've actually got a valid gzip string
+                       return true;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+}
+
+class SimplePie_Cache
+{
+       /**
+        * Don't call the constructor. Please.
+        *
+        * @access private
+        */
+       function SimplePie_Cache()
+       {
+               trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
+       }
+
+       /**
+        * Create a new SimplePie_Cache object
+        *
+        * @static
+        * @access public
+        */
+       function create($location, $filename, $extension)
+       {
+               return new SimplePie_Cache_File($location, $filename, $extension);
+       }
+}
+
+class SimplePie_Cache_File
+{
+       var $location;
+       var $filename;
+       var $extension;
+       var $name;
+
+       function SimplePie_Cache_File($location, $filename, $extension)
+       {
+               $this->location = $location;
+               $this->filename = rawurlencode($filename);
+               $this->extension = rawurlencode($extension);
+               $this->name = "$location/$this->filename.$this->extension";
+       }
+
+       function save($data)
+       {
+               if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
+               {
+                       if (is_a($data, 'SimplePie'))
+                       {
+                               $data = $data->data;
+                       }
+
+                       $data = serialize($data);
+
+                       if (function_exists('file_put_contents'))
+                       {
+                               return (bool) file_put_contents($this->name, $data);
+                       }
+                       else
+                       {
+                               $fp = fopen($this->name, 'wb');
+                               if ($fp)
+                               {
+                                       fwrite($fp, $data);
+                                       fclose($fp);
+                                       return true;
+                               }
+                       }
+               }
+               return false;
+       }
+
+       function load()
+       {
+               if (file_exists($this->name) && is_readable($this->name))
+               {
+                       return unserialize(file_get_contents($this->name));
+               }
+               return false;
+       }
+
+       function mtime()
+       {
+               if (file_exists($this->name))
+               {
+                       return filemtime($this->name);
+               }
+               return false;
+       }
+
+       function touch()
+       {
+               if (file_exists($this->name))
+               {
+                       return touch($this->name);
+               }
+               return false;
+       }
+
+       function unlink()
+       {
+               if (file_exists($this->name))
+               {
+                       return unlink($this->name);
+               }
+               return false;
+       }
+}
+
+class SimplePie_Misc
+{
+       function time_hms($seconds)
+       {
+               $time = '';
+
+               $hours = floor($seconds / 3600);
+               $remainder = $seconds % 3600;
+               if ($hours > 0)
+               {
+                       $time .= $hours.':';
+               }
+
+               $minutes = floor($remainder / 60);
+               $seconds = $remainder % 60;
+               if ($minutes < 10 && $hours > 0)
+               {
+                       $minutes = '0' . $minutes;
+               }
+               if ($seconds < 10)
+               {
+                       $seconds = '0' . $seconds;
+               }
+
+               $time .= $minutes.':';
+               $time .= $seconds;
+
+               return $time;
+       }
+
+       function absolutize_url($relative, $base)
+       {
+               if ($relative !== '')
+               {
+                       $relative = SimplePie_Misc::parse_url($relative);
+                       if ($relative['scheme'] !== '')
+                       {
+                               $target = $relative;
+                       }
+                       elseif ($base !== '')
+                       {
+                               $base = SimplePie_Misc::parse_url($base);
+                               $target = SimplePie_Misc::parse_url('');
+                               if ($relative['authority'] !== '')
+                               {
+                                       $target = $relative;
+                                       $target['scheme'] = $base['scheme'];
+                               }
+                               else
+                               {
+                                       $target['scheme'] = $base['scheme'];
+                                       $target['authority'] = $base['authority'];
+                                       if ($relative['path'] !== '')
+                                       {
+                                               if (strpos($relative['path'], '/') === 0)
+                                               {
+                                                       $target['path'] = $relative['path'];
+                                               }
+                                               elseif ($base['authority'] !== '' && $base['path'] === '')
+                                               {
+                                                       $target['path'] = '/' . $relative['path'];
+                                               }
+                                               elseif (($last_segment = strrpos($base['path'], '/')) !== false)
+                                               {
+                                                       $target['path'] = substr($base['path'], 0, $last_segment + 1) . $relative['path'];
+                                               }
+                                               else
+                                               {
+                                                       $target['path'] = $relative['path'];
+                                               }
+                                               $target['query'] = $relative['query'];
+                                       }
+                                       else
+                                       {
+                                               $target['path'] = $base['path'];
+                                               if ($relative['query'] !== '')
+                                               {
+                                                       $target['query'] = $relative['query'];
+                                               }
+                                               elseif ($base['query'] !== '')
+                                               {
+                                                       $target['query'] = $base['query'];
+                                               }
+                                       }
+                               }
+                               $target['fragment'] = $relative['fragment'];
+                       }
+                       else
+                       {
+                               // No base URL, just return the relative URL
+                               $target = $relative;
+                       }
+                       $return = SimplePie_Misc::compress_parse_url($target['scheme'], $target['authority'], $target['path'], $target['query'], $target['fragment']);
+               }
+               else
+               {
+                       $return = $base;
+               }
+               $return = SimplePie_Misc::normalize_url($return);
+               return $return;
+       }
+
+       function remove_dot_segments($input)
+       {
+               $output = '';
+               while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input == '.' || $input == '..')
+               {
+                       // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
+                       if (strpos($input, '../') === 0)
+                       {
+                               $input = substr($input, 3);
+                       }
+                       elseif (strpos($input, './') === 0)
+                       {
+                               $input = substr($input, 2);
+                       }
+                       // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
+                       elseif (strpos($input, '/./') === 0)
+                       {
+                               $input = substr_replace($input, '/', 0, 3);
+                       }
+                       elseif ($input == '/.')
+                       {
+                               $input = '/';
+                       }
+                       // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
+                       elseif (strpos($input, '/../') === 0)
+                       {
+                               $input = substr_replace($input, '/', 0, 4);
+                               $output = substr_replace($output, '', strrpos($output, '/'));
+                       }
+                       elseif ($input == '/..')
+                       {
+                               $input = '/';
+                               $output = substr_replace($output, '', strrpos($output, '/'));
+                       }
+                       // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
+                       elseif ($input == '.' || $input == '..')
+                       {
+                               $input = '';
+                       }
+                       // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
+                       elseif (($pos = strpos($input, '/', 1)) !== false)
+                       {
+                               $output .= substr($input, 0, $pos);
+                               $input = substr_replace($input, '', 0, $pos);
+                       }
+                       else
+                       {
+                               $output .= $input;
+                               $input = '';
+                       }
+               }
+               return $output . $input;
+       }
+
+       function get_element($realname, $string)
+       {
+               $return = array();
+               $name = preg_quote($realname, '/');
+               if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
+               {
+                       for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
+                       {
+                               $return[$i]['tag'] = $realname;
+                               $return[$i]['full'] = $matches[$i][0][0];
+                               $return[$i]['offset'] = $matches[$i][0][1];
+                               if (strlen($matches[$i][3][0]) <= 2)
+                               {
+                                       $return[$i]['self_closing'] = true;
+                               }
+                               else
+                               {
+                                       $return[$i]['self_closing'] = false;
+                                       $return[$i]['content'] = $matches[$i][4][0];
+                               }
+                               $return[$i]['attribs'] = array();
+                               if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER))
+                               {
+                                       for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
+                                       {
+                                               if (count($attribs[$j]) == 2)
+                                               {
+                                                       $attribs[$j][2] = $attribs[$j][1];
+                                               }
+                                               $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
+                                       }
+                               }
+                       }
+               }
+               return $return;
+       }
+
+       function element_implode($element)
+       {
+               $full = "<$element[tag]";
+               foreach ($element['attribs'] as $key => $value)
+               {
+                       $key = strtolower($key);
+                       $full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
+               }
+               if ($element['self_closing'])
+               {
+                       $full .= ' />';
+               }
+               else
+               {
+                       $full .= ">$element[content]</$element[tag]>";
+               }
+               return $full;
+       }
+
+       function error($message, $level, $file, $line)
+       {
+               switch ($level)
+               {
+                       case E_USER_ERROR:
+                               $note = 'PHP Error';
+                               break;
+                       case E_USER_WARNING:
+                               $note = 'PHP Warning';
+                               break;
+                       case E_USER_NOTICE:
+                               $note = 'PHP Notice';
+                               break;
+                       default:
+                               $note = 'Unknown Error';
+                               break;
+               }
+               error_log("$note: $message in $file on line $line", 0);
+               return $message;
+       }
+
+       /**
+        * If a file has been cached, retrieve and display it.
+        *
+        * This is most useful for caching images (get_favicon(), etc.),
+        * however it works for all cached files.  This WILL NOT display ANY
+        * file/image/page/whatever, but rather only display what has already
+        * been cached by SimplePie.
+        *
+        * @access public
+        * @see SimplePie::get_favicon()
+        * @param str $identifier_url URL that is used to identify the content.
+        * This may or may not be the actual URL of the live content.
+        * @param str $cache_location Location of SimplePie's cache.  Defaults
+        * to './cache'.
+        * @param str $cache_extension The file extension that the file was
+        * cached with.  Defaults to 'spc'.
+        * @param str $cache_class Name of the cache-handling class being used
+        * in SimplePie.  Defaults to 'SimplePie_Cache', and should be left
+        * as-is unless you've overloaded the class.
+        * @param str $cache_name_function Obsolete. Exists for backwards
+        * compatibility reasons only.
+        */
+       function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5')
+       {
+               $cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension);
+
+               if ($file = $cache->load())
+               {
+                       if (isset($file['headers']['content-type']))
+                       {
+                               header('Content-type:' . $file['headers']['content-type']);
+                       }
+                       else
+                       {
+                               header('Content-type: application/octet-stream');
+                       }
+                       header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
+                       echo $file['body'];
+                       exit;
+               }
+
+               die('Cached file for ' . $identifier_url . ' cannot be found.');
+       }
+
+       function fix_protocol($url, $http = 1)
+       {
+               $url = SimplePie_Misc::normalize_url($url);
+               $parsed = SimplePie_Misc::parse_url($url);
+               if ($parsed['scheme'] !== '' && $parsed['scheme'] != 'http' && $parsed['scheme'] != 'https')
+               {
+                       return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
+               }
+
+               if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url))
+               {
+                       return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
+               }
+
+               if ($http == 2 && $parsed['scheme'] !== '')
+               {
+                       return "feed:$url";
+               }
+               elseif ($http == 3 && strtolower($parsed['scheme']) == 'http')
+               {
+                       return substr_replace($url, 'podcast', 0, 4);
+               }
+               elseif ($http == 4 && strtolower($parsed['scheme']) == 'http')
+               {
+                       return substr_replace($url, 'itpc', 0, 4);
+               }
+               else
+               {
+                       return $url;
+               }
+       }
+
+       function parse_url($url)
+       {
+               static $cache = array();
+               if (isset($cache[$url]))
+               {
+                       return $cache[$url];
+               }
+               elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
+               {
+                       for ($i = count($match); $i <= 9; $i++)
+                       {
+                               $match[$i] = '';
+                       }
+                       return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
+               }
+               else
+               {
+                       return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
+               }
+       }
+
+       function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
+       {
+               $return = '';
+               if ($scheme !== '')
+               {
+                       $return .= "$scheme:";
+               }
+               if ($authority !== '')
+               {
+                       $return .= "//$authority";
+               }
+               if ($path !== '')
+               {
+                       $return .= $path;
+               }
+               if ($query !== '')
+               {
+                       $return .= "?$query";
+               }
+               if ($fragment !== '')
+               {
+                       $return .= "#$fragment";
+               }
+               return $return;
+       }
+
+       function normalize_url($url)
+       {
+               $url = preg_replace_callback('/%([0-9A-Fa-f]{2})/', array('SimplePie_Misc', 'percent_encoding_normalization'), $url);
+               $url = SimplePie_Misc::parse_url($url);
+               $url['scheme'] = strtolower($url['scheme']);
+               if ($url['authority'] !== '')
+               {
+                       $url['authority'] = strtolower($url['authority']);
+                       $url['path'] = SimplePie_Misc::remove_dot_segments($url['path']);
+               }
+               return SimplePie_Misc::compress_parse_url($url['scheme'], $url['authority'], $url['path'], $url['query'], $url['fragment']);
+       }
+
+       function percent_encoding_normalization($match)
+       {
+               $integer = hexdec($match[1]);
+               if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E)
+               {
+                       return chr($integer);
+               }
+               else
+               {
+                       return strtoupper($match[0]);
+               }
+       }
+
+       /**
+        * Remove bad UTF-8 bytes
+        *
+        * PCRE Pattern to locate bad bytes in a UTF-8 string comes from W3C
+        * FAQ: Multilingual Forms (modified to include full ASCII range)
+        *
+        * @author Geoffrey Sneddon
+        * @see http://www.w3.org/International/questions/qa-forms-utf-8
+        * @param string $str String to remove bad UTF-8 bytes from
+        * @return string UTF-8 string
+        */
+       function utf8_bad_replace($str)
+       {
+               if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str)))
+               {
+                       return $return;
+               }
+               elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8')))
+               {
+                       return $return;
+               }
+               elseif (preg_match_all('/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches))
+               {
+                       return implode("\xEF\xBF\xBD", $matches[0]);
+               }
+               elseif ($str !== '')
+               {
+                       return "\xEF\xBF\xBD";
+               }
+               else
+               {
+                       return '';
+               }
+       }
+
+       /**
+        * Converts a Windows-1252 encoded string to a UTF-8 encoded string
+        *
+        * @static
+        * @access public
+        * @param string $string Windows-1252 encoded string
+        * @return string UTF-8 encoded string
+        */
+       function windows_1252_to_utf8($string)
+       {
+               static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF");
+
+               return strtr($string, $convert_table);
+       }
+
+       function change_encoding($data, $input, $output)
+       {
+               $input = SimplePie_Misc::encoding($input);
+               $output = SimplePie_Misc::encoding($output);
+
+               // We fail to fail on non US-ASCII bytes
+               if ($input === 'US-ASCII')
+               {
+                       static $non_ascii_octects = '';
+                       if (!$non_ascii_octects)
+                       {
+                               for ($i = 0x80; $i <= 0xFF; $i++)
+                               {
+                                       $non_ascii_octects .= chr($i);
+                               }
+                       }
+                       $data = substr($data, 0, strcspn($data, $non_ascii_octects));
+               }
+
+               // This is first, as behaviour of this is completely predictable
+               if ($input === 'Windows-1252' && $output === 'UTF-8')
+               {
+                       return SimplePie_Misc::windows_1252_to_utf8($data);
+               }
+               // This is second, as behaviour of this varies only with PHP version
+               elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input)))
+               {
+                       return $return;
+               }
+               // This is last, as behaviour of this varies with OS userland and PHP version
+               elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
+               {
+                       return $return;
+               }
+               // If we can't do anything, just fail
+               else
+               {
+                       return false;
+               }
+       }
+
+       function encoding($charset)
+       {
+               /* Character sets are case-insensitive, and also need some further
+               normalization in the real world (though we'll return them in the form given
+               in their registration). */
+               switch (strtolower(preg_replace('/[\x09-\x0D\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]/', '', $charset)))
+               {
+                       case 'adobestandardencoding':
+                       case 'csadobestandardencoding':
+                               return 'Adobe-Standard-Encoding';
+
+                       case 'adobesymbolencoding':
+                       case 'cshppsmath':
+                               return 'Adobe-Symbol-Encoding';
+
+                       case 'ami1251':
+                       case 'ami1251':
+                       case 'amiga1251':
+                       case 'amiga1251':
+                               return 'Amiga-1251';
+
+                       case 'ansix31101983':
+                       case 'csat5001983':
+                       case 'csiso99naplps':
+                       case 'isoir99':
+                       case 'naplps':
+                               return 'ANSI_X3.110-1983';
+
+                       case 'arabic7':
+                       case 'asmo449':
+                       case 'csiso89asmo449':
+                       case 'isoir89':
+                       case 'iso9036':
+                               return 'ASMO_449';
+
+                       case 'big5':
+                       case 'csbig5':
+                       case 'xxbig5':
+                               return 'Big5';
+
+                       case 'big5hkscs':
+                               return 'Big5-HKSCS';
+
+                       case 'bocu1':
+                       case 'csbocu1':
+                               return 'BOCU-1';
+
+                       case 'brf':
+                       case 'csbrf':
+                               return 'BRF';
+
+                       case 'bs4730':
+                       case 'csiso4unitedkingdom':
+                       case 'gb':
+                       case 'isoir4':
+                       case 'iso646gb':
+                       case 'uk':
+                               return 'BS_4730';
+
+                       case 'bsviewdata':
+                       case 'csiso47bsviewdata':
+                       case 'isoir47':
+                               return 'BS_viewdata';
+
+                       case 'cesu8':
+                       case 'cscesu8':
+                               return 'CESU-8';
+
+                       case 'ca':
+                       case 'csa71':
+                       case 'csaz243419851':
+                       case 'csiso121canadian1':
+                       case 'isoir121':
+                       case 'iso646ca':
+                               return 'CSA_Z243.4-1985-1';
+
+                       case 'csa72':
+                       case 'csaz243419852':
+                       case 'csiso122canadian2':
+                       case 'isoir122':
+                       case 'iso646ca2':
+                               return 'CSA_Z243.4-1985-2';
+
+                       case 'csaz24341985gr':
+                       case 'csiso123csaz24341985gr':
+                       case 'isoir123':
+                               return 'CSA_Z243.4-1985-gr';
+
+                       case 'csiso139csn369103':
+                       case 'csn369103':
+                       case 'isoir139':
+                               return 'CSN_369103';
+
+                       case 'csdecmcs':
+                       case 'dec':
+                       case 'decmcs':
+                               return 'DEC-MCS';
+
+                       case 'csiso21german':
+                       case 'de':
+                       case 'din66003':
+                       case 'isoir21':
+                       case 'iso646de':
+                               return 'DIN_66003';
+
+                       case 'csdkus':
+                       case 'dkus':
+                               return 'dk-us';
+
+                       case 'csiso646danish':
+                       case 'dk':
+                       case 'ds2089':
+                       case 'ds2089':
+                       case 'iso646dk':
+                               return 'DS_2089';
+
+                       case 'csibmebcdicatde':
+                       case 'ebcdicatde':
+                               return 'EBCDIC-AT-DE';
+
+                       case 'csebcdicatdea':
+                       case 'ebcdicatdea':
+                               return 'EBCDIC-AT-DE-A';
+
+                       case 'csebcdiccafr':
+                       case 'ebcdiccafr':
+                               return 'EBCDIC-CA-FR';
+
+                       case 'csebcdicdkno':
+                       case 'ebcdicdkno':
+                               return 'EBCDIC-DK-NO';
+
+                       case 'csebcdicdknoa':
+                       case 'ebcdicdknoa':
+                               return 'EBCDIC-DK-NO-A';
+
+                       case 'csebcdices':
+                       case 'ebcdices':
+                               return 'EBCDIC-ES';
+
+                       case 'csebcdicesa':
+                       case 'ebcdicesa':
+                               return 'EBCDIC-ES-A';
+
+                       case 'csebcdicess':
+                       case 'ebcdicess':
+                               return 'EBCDIC-ES-S';
+
+                       case 'csebcdicfise':
+                       case 'ebcdicfise':
+                               return 'EBCDIC-FI-SE';
+
+                       case 'csebcdicfisea':
+                       case 'ebcdicfisea':
+                               return 'EBCDIC-FI-SE-A';
+
+                       case 'csebcdicfr':
+                       case 'ebcdicfr':
+                               return 'EBCDIC-FR';
+
+                       case 'csebcdicit':
+                       case 'ebcdicit':
+                               return 'EBCDIC-IT';
+
+                       case 'csebcdicpt':
+                       case 'ebcdicpt':
+                               return 'EBCDIC-PT';
+
+                       case 'csebcdicuk':
+                       case 'ebcdicuk':
+                               return 'EBCDIC-UK';
+
+                       case 'csebcdicus':
+                       case 'ebcdicus':
+                               return 'EBCDIC-US';
+
+                       case 'csiso111ecmacyrillic':
+                       case 'ecmacyrillic':
+                       case 'isoir111':
+                       case 'koi8e':
+                               return 'ECMA-cyrillic';
+
+                       case 'csiso17spanish':
+                       case 'es':
+                       case 'isoir17':
+                       case 'iso646es':
+                               return 'ES';
+
+                       case 'csiso85spanish2':
+                       case 'es2':
+                       case 'isoir85':
+                       case 'iso646es2':
+                               return 'ES2';
+
+                       case 'cseucfixwidjapanese':
+                       case 'extendedunixcodefixedwidthforjapanese':
+                               return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
+
+                       case 'cseucpkdfmtjapanese':
+                       case 'eucjp':
+                       case 'extendedunixcodepackedformatforjapanese':
+                               return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
+
+                       case 'gb18030':
+                               return 'GB18030';
+
+                       case 'cp936':
+                       case 'gbk':
+                       case 'ms936':
+                       case 'windows936':
+                       case 'csgb2312':
+                       case 'gb2312':
+                       case 'chinese':
+                       case 'csiso58gb231280':
+                       case 'gb231280':
+                       case 'isoir58':
+                               return 'GBK';
+
+                       case 'cn':
+                       case 'csiso57gb1988':
+                       case 'gb198880':
+                       case 'isoir57':
+                       case 'iso646cn':
+                               return 'GB_1988-80';
+
+                       case 'csiso153gost1976874':
+                       case 'gost1976874':
+                       case 'isoir153':
+                       case 'stsev35888':
+                               return 'GOST_19768-74';
+
+                       case 'csiso150':
+                       case 'csiso150greekccitt':
+                       case 'greekccitt':
+                       case 'isoir150':
+                               return 'greek-ccitt';
+
+                       case 'csiso88greek7':
+                       case 'greek7':
+                       case 'isoir88':
+                               return 'greek7';
+
+                       case 'csiso18greek7old':
+                       case 'greek7old':
+                       case 'isoir18':
+                               return 'greek7-old';
+
+                       case 'cshpdesktop':
+                       case 'hpdesktop':
+                               return 'HP-DeskTop';
+
+                       case 'cshplegal':
+                       case 'hplegal':
+                               return 'HP-Legal';
+
+                       case 'cshpmath8':
+                       case 'hpmath8':
+                               return 'HP-Math8';
+
+                       case 'cshppifont':
+                       case 'hppifont':
+                               return 'HP-Pi-font';
+
+                       case 'cshproman8':
+                       case 'hproman8':
+                       case 'r8':
+                       case 'roman8':
+                               return 'hp-roman8';
+
+                       case 'hzgb2312':
+                               return 'HZ-GB-2312';
+
+                       case 'csibmsymbols':
+                       case 'ibmsymbols':
+                               return 'IBM-Symbols';
+
+                       case 'csibmthai':
+                       case 'ibmthai':
+                               return 'IBM-Thai';
+
+                       case 'ccsid00858':
+                       case 'cp00858':
+                       case 'ibm00858':
+                       case 'pcmultilingual850euro':
+                               return 'IBM00858';
+
+                       case 'ccsid00924':
+                       case 'cp00924':
+                       case 'ebcdiclatin9euro':
+                       case 'ibm00924':
+                               return 'IBM00924';
+
+                       case 'ccsid01140':
+                       case 'cp01140':
+                       case 'ebcdicus37euro':
+                       case 'ibm01140':
+                               return 'IBM01140';
+
+                       case 'ccsid01141':
+                       case 'cp01141':
+                       case 'ebcdicde273euro':
+                       case 'ibm01141':
+                               return 'IBM01141';
+
+                       case 'ccsid01142':
+                       case 'cp01142':
+                       case 'ebcdicdk277euro':
+                       case 'ebcdicno277euro':
+                       case 'ibm01142':
+                               return 'IBM01142';
+
+                       case 'ccsid01143':
+                       case 'cp01143':
+                       case 'ebcdicfi278euro':
+                       case 'ebcdicse278euro':
+                       case 'ibm01143':
+                               return 'IBM01143';
+
+                       case 'ccsid01144':
+                       case 'cp01144':
+                       case 'ebcdicit280euro':
+                       case 'ibm01144':
+                               return 'IBM01144';
+
+                       case 'ccsid01145':
+                       case 'cp01145':
+                       case 'ebcdices284euro':
+                       case 'ibm01145':
+                               return 'IBM01145';
+
+                       case 'ccsid01146':
+                       case 'cp01146':
+                       case 'ebcdicgb285euro':
+                       case 'ibm01146':
+                               return 'IBM01146';
+
+                       case 'ccsid01147':
+                       case 'cp01147':
+                       case 'ebcdicfr297euro':
+                       case 'ibm01147':
+                               return 'IBM01147';
+
+                       case 'ccsid01148':
+                       case 'cp01148':
+                       case 'ebcdicinternational500euro':
+                       case 'ibm01148':
+                               return 'IBM01148';
+
+                       case 'ccsid01149':
+                       case 'cp01149':
+                       case 'ebcdicis871euro':
+                       case 'ibm01149':
+                               return 'IBM01149';
+
+                       case 'cp037':
+                       case 'csibm037':
+                       case 'ebcdiccpca':
+                       case 'ebcdiccpnl':
+                       case 'ebcdiccpus':
+                       case 'ebcdiccpwt':
+                       case 'ibm037':
+                               return 'IBM037';
+
+                       case 'cp038':
+                       case 'csibm038':
+                       case 'ebcdicint':
+                       case 'ibm038':
+                               return 'IBM038';
+
+                       case 'cp273':
+                       case 'csibm273':
+                       case 'ibm273':
+                               return 'IBM273';
+
+                       case 'cp274':
+                       case 'csibm274':
+                       case 'ebcdicbe':
+                       case 'ibm274':
+                               return 'IBM274';
+
+                       case 'cp275':
+                       case 'csibm275':
+                       case 'ebcdicbr':
+                       case 'ibm275':
+                               return 'IBM275';
+
+                       case 'csibm277':
+                       case 'ebcdiccpdk':
+                       case 'ebcdiccpno':
+                       case 'ibm277':
+                               return 'IBM277';
+
+                       case 'cp278':
+                       case 'csibm278':
+                       case 'ebcdiccpfi':
+                       case 'ebcdiccpse':
+                       case 'ibm278':
+                               return 'IBM278';
+
+                       case 'cp280':
+                       case 'csibm280':
+                       case 'ebcdiccpit':
+                       case 'ibm280':
+                               return 'IBM280';
+
+                       case 'cp281':
+                       case 'csibm281':
+                       case 'ebcdicjpe':
+                       case 'ibm281':
+                               return 'IBM281';
+
+                       case 'cp284':
+                       case 'csibm284':
+                       case 'ebcdiccpes':
+                       case 'ibm284':
+                               return 'IBM284';
+
+                       case 'cp285':
+                       case 'csibm285':
+                       case 'ebcdiccpgb':
+                       case 'ibm285':
+                               return 'IBM285';
+
+                       case 'cp290':
+                       case 'csibm290':
+                       case 'ebcdicjpkana':
+                       case 'ibm290':
+                               return 'IBM290';
+
+                       case 'cp297':
+                       case 'csibm297':
+                       case 'ebcdiccpfr':
+                       case 'ibm297':
+                               return 'IBM297';
+
+                       case 'cp420':
+                       case 'csibm420':
+                       case 'ebcdiccpar1':
+                       case 'ibm420':
+                               return 'IBM420';
+
+                       case 'cp423':
+                       case 'csibm423':
+                       case 'ebcdiccpgr':
+                       case 'ibm423':
+                               return 'IBM423';
+
+                       case 'cp424':
+                       case 'csibm424':
+                       case 'ebcdiccphe':
+                       case 'ibm424':
+                               return 'IBM424';
+
+                       case '437':
+                       case 'cp437':
+                       case 'cspc8codepage437':
+                       case 'ibm437':
+                               return 'IBM437';
+
+                       case 'cp500':
+                       case 'csibm500':
+                       case 'ebcdiccpbe':
+                       case 'ebcdiccpch':
+                       case 'ibm500':
+                               return 'IBM500';
+
+                       case 'cp775':
+                       case 'cspc775baltic':
+                       case 'ibm775':
+                               return 'IBM775';
+
+                       case '850':
+                       case 'cp850':
+                       case 'cspc850multilingual':
+                       case 'ibm850':
+                               return 'IBM850';
+
+                       case '851':
+                       case 'cp851':
+                       case 'csibm851':
+                       case 'ibm851':
+                               return 'IBM851';
+
+                       case '852':
+                       case 'cp852':
+                       case 'cspcp852':
+                       case 'ibm852':
+                               return 'IBM852';
+
+                       case '855':
+                       case 'cp855':
+                       case 'csibm855':
+                       case 'ibm855':
+                               return 'IBM855';
+
+                       case '857':
+                       case 'cp857':
+                       case 'csibm857':
+                       case 'ibm857':
+                               return 'IBM857';
+
+                       case '860':
+                       case 'cp860':
+                       case 'csibm860':
+                       case 'ibm860':
+                               return 'IBM860';
+
+                       case '861':
+                       case 'cpis':
+                       case 'cp861':
+                       case 'csibm861':
+                       case 'ibm861':
+                               return 'IBM861';
+
+                       case '862':
+                       case 'cp862':
+                       case 'cspc862latinhebrew':
+                       case 'ibm862':
+                               return 'IBM862';
+
+                       case '863':
+                       case 'cp863':
+                       case 'csibm863':
+                       case 'ibm863':
+                               return 'IBM863';
+
+                       case 'cp864':
+                       case 'csibm864':
+                       case 'ibm864':
+                               return 'IBM864';
+
+                       case '865':
+                       case 'cp865':
+                       case 'csibm865':
+                       case 'ibm865':
+                               return 'IBM865';
+
+                       case '866':
+                       case 'cp866':
+                       case 'csibm866':
+                       case 'ibm866':
+                               return 'IBM866';
+
+                       case 'cpar':
+                       case 'cp868':
+                       case 'csibm868':
+                       case 'ibm868':
+                               return 'IBM868';
+
+                       case '869':
+                       case 'cpgr':
+                       case 'cp869':
+                       case 'csibm869':
+                       case 'ibm869':
+                               return 'IBM869';
+
+                       case 'cp870':
+                       case 'csibm870':
+                       case 'ebcdiccproece':
+                       case 'ebcdiccpyu':
+                       case 'ibm870':
+                               return 'IBM870';
+
+                       case 'cp871':
+                       case 'csibm871':
+                       case 'ebcdiccpis':
+                       case 'ibm871':
+                               return 'IBM871';
+
+                       case 'cp880':
+                       case 'csibm880':
+                       case 'ebcdiccyrillic':
+                       case 'ibm880':
+                               return 'IBM880';
+
+                       case 'cp891':
+                       case 'csibm891':
+                       case 'ibm891':
+                               return 'IBM891';
+
+                       case 'cp903':
+                       case 'csibm903':
+                       case 'ibm903':
+                               return 'IBM903';
+
+                       case '904':
+                       case 'cp904':
+                       case 'csibbm904':
+                       case 'ibm904':
+                               return 'IBM904';
+
+                       case 'cp905':
+                       case 'csibm905':
+                       case 'ebcdiccptr':
+                       case 'ibm905':
+                               return 'IBM905';
+
+                       case 'cp918':
+                       case 'csibm918':
+                       case 'ebcdiccpar2':
+                       case 'ibm918':
+                               return 'IBM918';
+
+                       case 'cp1026':
+                       case 'csibm1026':
+                       case 'ibm1026':
+                               return 'IBM1026';
+
+                       case 'ibm1047':
+                       case 'ibm1047':
+                               return 'IBM1047';
+
+                       case 'csiso143iecp271':
+                       case 'iecp271':
+                       case 'isoir143':
+                               return 'IEC_P27-1';
+
+                       case 'csiso49inis':
+                       case 'inis':
+                       case 'isoir49':
+                               return 'INIS';
+
+                       case 'csiso50inis8':
+                       case 'inis8':
+                       case 'isoir50':
+                               return 'INIS-8';
+
+                       case 'csiso51iniscyrillic':
+                       case 'iniscyrillic':
+                       case 'isoir51':
+                               return 'INIS-cyrillic';
+
+                       case 'csinvariant':
+                       case 'invariant':
+                               return 'INVARIANT';
+
+                       case 'iso2022cn':
+                               return 'ISO-2022-CN';
+
+                       case 'iso2022cnext':
+                               return 'ISO-2022-CN-EXT';
+
+                       case 'csiso2022jp':
+                       case 'iso2022jp':
+                               return 'ISO-2022-JP';
+
+                       case 'csiso2022jp2':
+                       case 'iso2022jp2':
+                               return 'ISO-2022-JP-2';
+
+                       case 'csiso2022kr':
+                       case 'iso2022kr':
+                               return 'ISO-2022-KR';
+
+                       case 'cswindows30latin1':
+                       case 'iso88591windows30latin1':
+                               return 'ISO-8859-1-Windows-3.0-Latin-1';
+
+                       case 'cswindows31latin1':
+                       case 'iso88591windows31latin1':
+                               return 'ISO-8859-1-Windows-3.1-Latin-1';
+
+                       case 'csisolatin2':
+                       case 'iso88592':
+                       case 'isoir101':
+                       case 'iso88592':
+                       case 'iso885921987':
+                       case 'l2':
+                       case 'latin2':
+                               return 'ISO-8859-2';
+
+                       case 'cswindows31latin2':
+                       case 'iso88592windowslatin2':
+                               return 'ISO-8859-2-Windows-Latin-2';
+
+                       case 'csisolatin3':
+                       case 'iso88593':
+                       case 'isoir109':
+                       case 'iso88593':
+                       case 'iso885931988':
+                       case 'l3':
+                       case 'latin3':
+                               return 'ISO-8859-3';
+
+                       case 'csisolatin4':
+                       case 'iso88594':
+                       case 'isoir110':
+                       case 'iso88594':
+                       case 'iso885941988':
+                       case 'l4':
+                       case 'latin4':
+                               return 'ISO-8859-4';
+
+                       case 'csisolatincyrillic':
+                       case 'cyrillic':
+                       case 'iso88595':
+                       case 'isoir144':
+                       case 'iso88595':
+                       case 'iso885951988':
+                               return 'ISO-8859-5';
+
+                       case 'arabic':
+                       case 'asmo708':
+                       case 'csisolatinarabic':
+                       case 'ecma114':
+                       case 'iso88596':
+                       case 'isoir127':
+                       case 'iso88596':
+                       case 'iso885961987':
+                               return 'ISO-8859-6';
+
+                       case 'csiso88596e':
+                       case 'iso88596e':
+                       case 'iso88596e':
+                               return 'ISO-8859-6-E';
+
+                       case 'csiso88596i':
+                       case 'iso88596i':
+                       case 'iso88596i':
+                               return 'ISO-8859-6-I';
+
+                       case 'csisolatingreek':
+                       case 'ecma118':
+                       case 'elot928':
+                       case 'greek':
+                       case 'greek8':
+                       case 'iso88597':
+                       case 'isoir126':
+                       case 'iso88597':
+                       case 'iso885971987':
+                               return 'ISO-8859-7';
+
+                       case 'csisolatinhebrew':
+                       case 'hebrew':
+                       case 'iso88598':
+                       case 'isoir138':
+                       case 'iso88598':
+                       case 'iso885981988':
+                               return 'ISO-8859-8';
+
+                       case 'csiso88598e':
+                       case 'iso88598e':
+                       case 'iso88598e':
+                               return 'ISO-8859-8-E';
+
+                       case 'csiso88598i':
+                       case 'iso88598i':
+                       case 'iso88598i':
+                               return 'ISO-8859-8-I';
+
+                       case 'cswindows31latin5':
+                       case 'iso88599windowslatin5':
+                               return 'ISO-8859-9-Windows-Latin-5';
+
+                       case 'csisolatin6':
+                       case 'iso885910':
+                       case 'isoir157':
+                       case 'iso8859101992':
+                       case 'l6':
+                       case 'latin6':
+                               return 'ISO-8859-10';
+
+                       case 'iso885913':
+                               return 'ISO-8859-13';
+
+                       case 'iso885914':
+                       case 'isoceltic':
+                       case 'isoir199':
+                       case 'iso885914':
+                       case 'iso8859141998':
+                       case 'l8':
+                       case 'latin8':
+                               return 'ISO-8859-14';
+
+                       case 'iso885915':
+                       case 'iso885915':
+                       case 'latin9':
+                               return 'ISO-8859-15';
+
+                       case 'iso885916':
+                       case 'isoir226':
+                       case 'iso885916':
+                       case 'iso8859162001':
+                       case 'l10':
+                       case 'latin10':
+                               return 'ISO-8859-16';
+
+                       case 'iso10646j1':
+                               return 'ISO-10646-J-1';
+
+                       case 'csunicode':
+                       case 'iso10646ucs2':
+                               return 'ISO-10646-UCS-2';
+
+                       case 'csucs4':
+                       case 'iso10646ucs4':
+                               return 'ISO-10646-UCS-4';
+
+                       case 'csunicodeascii':
+                       case 'iso10646ucsbasic':
+                               return 'ISO-10646-UCS-Basic';
+
+                       case 'csunicodelatin1':
+                       case 'iso10646':
+                       case 'iso10646unicodelatin1':
+                               return 'ISO-10646-Unicode-Latin1';
+
+                       case 'csiso10646utf1':
+                       case 'iso10646utf1':
+                               return 'ISO-10646-UTF-1';
+
+                       case 'csiso115481':
+                       case 'iso115481':
+                       case 'iso115481':
+                       case 'isotr115481':
+                               return 'ISO-11548-1';
+
+                       case 'csiso90':
+                       case 'isoir90':
+                               return 'iso-ir-90';
+
+                       case 'csunicodeibm1261':
+                       case 'isounicodeibm1261':
+                               return 'ISO-Unicode-IBM-1261';
+
+                       case 'csunicodeibm1264':
+                       case 'isounicodeibm1264':
+                               return 'ISO-Unicode-IBM-1264';
+
+                       case 'csunicodeibm1265':
+                       case 'isounicodeibm1265':
+                               return 'ISO-Unicode-IBM-1265';
+
+                       case 'csunicodeibm1268':
+                       case 'isounicodeibm1268':
+                               return 'ISO-Unicode-IBM-1268';
+
+                       case 'csunicodeibm1276':
+                       case 'isounicodeibm1276':
+                               return 'ISO-Unicode-IBM-1276';
+
+                       case 'csiso646basic1983':
+                       case 'iso646basic1983':
+                       case 'ref':
+                               return 'ISO_646.basic:1983';
+
+                       case 'csiso2intlrefversion':
+                       case 'irv':
+                       case 'isoir2':
+                       case 'iso646irv1983':
+                               return 'ISO_646.irv:1983';
+
+                       case 'csiso2033':
+                       case 'e13b':
+                       case 'isoir98':
+                       case 'iso20331983':
+                               return 'ISO_2033-1983';
+
+                       case 'csiso5427cyrillic':
+                       case 'isoir37':
+                       case 'iso5427':
+                               return 'ISO_5427';
+
+                       case 'isoir54':
+                       case 'iso5427cyrillic1981':
+                       case 'iso54271981':
+                               return 'ISO_5427:1981';
+
+                       case 'csiso5428greek':
+                       case 'isoir55':
+                       case 'iso54281980':
+                               return 'ISO_5428:1980';
+
+                       case 'csiso6937add':
+                       case 'isoir152':
+                       case 'iso6937225':
+                               return 'ISO_6937-2-25';
+
+                       case 'csisotextcomm':
+                       case 'isoir142':
+                       case 'iso69372add':
+                               return 'ISO_6937-2-add';
+
+                       case 'csiso8859supp':
+                       case 'isoir154':
+                       case 'iso8859supp':
+                       case 'latin125':
+                               return 'ISO_8859-supp';
+
+                       case 'csiso10367box':
+                       case 'isoir155':
+                       case 'iso10367box':
+                               return 'ISO_10367-box';
+
+                       case 'csiso15italian':
+                       case 'isoir15':
+                       case 'iso646it':
+                       case 'it':
+                               return 'IT';
+
+                       case 'csiso13jisc6220jp':
+                       case 'isoir13':
+                       case 'jisc62201969':
+                       case 'jisc62201969jp':
+                       case 'katakana':
+                       case 'x02017':
+                               return 'JIS_C6220-1969-jp';
+
+                       case 'csiso14jisc6220ro':
+                       case 'isoir14':
+                       case 'iso646jp':
+                       case 'jisc62201969ro':
+                       case 'jp':
+                               return 'JIS_C6220-1969-ro';
+
+                       case 'csiso42jisc62261978':
+                       case 'isoir42':
+                       case 'jisc62261978':
+                               return 'JIS_C6226-1978';
+
+                       case 'csiso87jisx0208':
+                       case 'isoir87':
+                       case 'jisc62261983':
+                       case 'jisx02081983':
+                       case 'x0208':
+                               return 'JIS_C6226-1983';
+
+                       case 'csiso91jisc62291984a':
+                       case 'isoir91':
+                       case 'jisc62291984a':
+                       case 'jpocra':
+                               return 'JIS_C6229-1984-a';
+
+                       case 'csiso92jisc62991984b':
+                       case 'isoir92':
+                       case 'iso646jpocrb':
+                       case 'jisc62291984b':
+                       case 'jpocrb':
+                               return 'JIS_C6229-1984-b';
+
+                       case 'csiso93jis62291984badd':
+                       case 'isoir93':
+                       case 'jisc62291984badd':
+                       case 'jpocrbadd':
+                               return 'JIS_C6229-1984-b-add';
+
+                       case 'csiso94jis62291984hand':
+                       case 'isoir94':
+                       case 'jisc62291984hand':
+                       case 'jpocrhand':
+                               return 'JIS_C6229-1984-hand';
+
+                       case 'csiso95jis62291984handadd':
+                       case 'isoir95':
+                       case 'jisc62291984handadd':
+                       case 'jpocrhandadd':
+                               return 'JIS_C6229-1984-hand-add';
+
+                       case 'csiso96jisc62291984kana':
+                       case 'isoir96':
+                       case 'jisc62291984kana':
+                               return 'JIS_C6229-1984-kana';
+
+                       case 'csjisencoding':
+                       case 'jisencoding':
+                               return 'JIS_Encoding';
+
+                       case 'cshalfwidthkatakana':
+                       case 'jisx0201':
+                       case 'x0201':
+                               return 'JIS_X0201';
+
+                       case 'csiso159jisx02121990':
+                       case 'isoir159':
+                       case 'jisx02121990':
+                       case 'x0212':
+                               return 'JIS_X0212-1990';
+
+                       case 'csiso141jusib1002':
+                       case 'isoir141':
+                       case 'iso646yu':
+                       case 'js':
+                       case 'jusib1002':
+                       case 'yu':
+                               return 'JUS_I.B1.002';
+
+                       case 'csiso147macedonian':
+                       case 'isoir147':
+                       case 'jusib1003mac':
+                       case 'macedonian':
+                               return 'JUS_I.B1.003-mac';
+
+                       case 'csiso146serbian':
+                       case 'isoir146':
+                       case 'jusib1003serb':
+                       case 'serbian':
+                               return 'JUS_I.B1.003-serb';
+
+                       case 'koi7switched':
+                               return 'KOI7-switched';
+
+                       case 'cskoi8r':
+                       case 'koi8r':
+                               return 'KOI8-R';
+
+                       case 'koi8u':
+                               return 'KOI8-U';
+
+                       case 'csksc5636':
+                       case 'iso646kr':
+                       case 'ksc5636':
+                               return 'KSC5636';
+
+                       case 'cskz1048':
+                       case 'kz1048':
+                       case 'rk1048':
+                       case 'strk10482002':
+                               return 'KZ-1048';
+
+                       case 'csiso19latingreek':
+                       case 'isoir19':
+                       case 'latingreek':
+                               return 'latin-greek';
+
+                       case 'csiso27latingreek1':
+                       case 'isoir27':
+                       case 'latingreek1':
+                               return 'Latin-greek-1';
+
+                       case 'csiso158lap':
+                       case 'isoir158':
+                       case 'lap':
+                       case 'latinlap':
+                               return 'latin-lap';
+
+                       case 'csmacintosh':
+                       case 'mac':
+                       case 'macintosh':
+                               return 'macintosh';
+
+                       case 'csmicrosoftpublishing':
+                       case 'microsoftpublishing':
+                               return 'Microsoft-Publishing';
+
+                       case 'csmnem':
+                       case 'mnem':
+                               return 'MNEM';
+
+                       case 'csmnemonic':
+                       case 'mnemonic':
+                               return 'MNEMONIC';
+
+                       case 'csiso86hungarian':
+                       case 'hu':
+                       case 'isoir86':
+                       case 'iso646hu':
+                       case 'msz77953':
+                               return 'MSZ_7795.3';
+
+                       case 'csnatsdano':
+                       case 'isoir91':
+                       case 'natsdano':
+                               return 'NATS-DANO';
+
+                       case 'csnatsdanoadd':
+                       case 'isoir92':
+                       case 'natsdanoadd':
+                               return 'NATS-DANO-ADD';
+
+                       case 'csnatssefi':
+                       case 'isoir81':
+                       case 'natssefi':
+                               return 'NATS-SEFI';
+
+                       case 'csnatssefiadd':
+                       case 'isoir82':
+                       case 'natssefiadd':
+                               return 'NATS-SEFI-ADD';
+
+                       case 'csiso151cuba':
+                       case 'cuba':
+                       case 'isoir151':
+                       case 'iso646cu':
+                       case 'ncnc001081':
+                               return 'NC_NC00-10:81';
+
+                       case 'csiso69french':
+                       case 'fr':
+                       case 'isoir69':
+                       case 'iso646fr':
+                       case 'nfz62010':
+                               return 'NF_Z_62-010';
+
+                       case 'csiso25french':
+                       case 'isoir25':
+                       case 'iso646fr1':
+                       case 'nfz620101973':
+                               return 'NF_Z_62-010_(1973)';
+
+                       case 'csiso60danishnorwegian':
+                       case 'csiso60norwegian1':
+                       case 'isoir60':
+                       case 'iso646no':
+                       case 'no':
+                       case 'ns45511':
+                               return 'NS_4551-1';
+
+                       case 'csiso61norwegian2':
+                       case 'isoir61':
+                       case 'iso646no2':
+                       case 'no2':
+                       case 'ns45512':
+                               return 'NS_4551-2';
+
+                       case 'osdebcdicdf03irv':
+                               return 'OSD_EBCDIC_DF03_IRV';
+
+                       case 'osdebcdicdf041':
+                               return 'OSD_EBCDIC_DF04_1';
+
+                       case 'osdebcdicdf0415':
+                               return 'OSD_EBCDIC_DF04_15';
+
+                       case 'cspc8danishnorwegian':
+                       case 'pc8danishnorwegian':
+                               return 'PC8-Danish-Norwegian';
+
+                       case 'cspc8turkish':
+                       case 'pc8turkish':
+                               return 'PC8-Turkish';
+
+                       case 'csiso16portuguese':
+                       case 'isoir16':
+                       case 'iso646pt':
+                       case 'pt':
+                               return 'PT';
+
+                       case 'csiso84portuguese2':
+                       case 'isoir84':
+                       case 'iso646pt2':
+                       case 'pt2':
+                               return 'PT2';
+
+                       case 'cp154':
+                       case 'csptcp154':
+                       case 'cyrillicasian':
+                       case 'pt154':
+                       case 'ptcp154':
+                               return 'PTCP154';
+
+                       case 'scsu':
+                               return 'SCSU';
+
+                       case 'csiso10swedish':
+                       case 'fi':
+                       case 'isoir10':
+                       case 'iso646fi':
+                       case 'iso646se':
+                       case 'se':
+                       case 'sen850200b':
+                               return 'SEN_850200_B';
+
+                       case 'csiso11swedishfornames':
+                       case 'isoir11':
+                       case 'iso646se2':
+                       case 'se2':
+                       case 'sen850200c':
+                               return 'SEN_850200_C';
+
+                       case 'csshiftjis':
+                       case 'mskanji':
+                       case 'shiftjis':
+                               return 'Shift_JIS';
+
+                       case 'csiso102t617bit':
+                       case 'isoir102':
+                       case 't617bit':
+                               return 'T.61-7bit';
+
+                       case 'csiso103t618bit':
+                       case 'isoir103':
+                       case 't61':
+                       case 't618bit':
+                               return 'T.61-8bit';
+
+                       case 'csiso128t101g2':
+                       case 'isoir128':
+                       case 't101g2':
+                               return 'T.101-G2';
+
+                       case 'cstscii':
+                       case 'tscii':
+                               return 'TSCII';
+
+                       case 'csunicode11':
+                       case 'unicode11':
+                               return 'UNICODE-1-1';
+
+                       case 'csunicode11utf7':
+                       case 'unicode11utf7':
+                               return 'UNICODE-1-1-UTF-7';
+
+                       case 'csunknown8bit':
+                       case 'unknown8bit':
+                               return 'UNKNOWN-8BIT';
+
+                       case 'ansix341968':
+                       case 'ansix341986':
+                       case 'ascii':
+                       case 'cp367':
+                       case 'csascii':
+                       case 'ibm367':
+                       case 'isoir6':
+                       case 'iso646us':
+                       case 'iso646irv1991':
+                       case 'us':
+                       case 'usascii':
+                               return 'US-ASCII';
+
+                       case 'csusdk':
+                       case 'usdk':
+                               return 'us-dk';
+
+                       case 'utf7':
+                               return 'UTF-7';
+
+                       case 'utf8':
+                               return 'UTF-8';
+
+                       case 'utf16':
+                               return 'UTF-16';
+
+                       case 'utf16be':
+                               return 'UTF-16BE';
+
+                       case 'utf16le':
+                               return 'UTF-16LE';
+
+                       case 'utf32':
+                               return 'UTF-32';
+
+                       case 'utf32be':
+                               return 'UTF-32BE';
+
+                       case 'utf32le':
+                               return 'UTF-32LE';
+
+                       case 'csventurainternational':
+                       case 'venturainternational':
+                               return 'Ventura-International';
+
+                       case 'csventuramath':
+                       case 'venturamath':
+                               return 'Ventura-Math';
+
+                       case 'csventuraus':
+                       case 'venturaus':
+                               return 'Ventura-US';
+
+                       case 'csiso70videotexsupp1':
+                       case 'isoir70':
+                       case 'videotexsuppl':
+                               return 'videotex-suppl';
+
+                       case 'csviqr':
+                       case 'viqr':
+                               return 'VIQR';
+
+                       case 'csviscii':
+                       case 'viscii':
+                               return 'VISCII';
+
+                       case 'cswindows31j':
+                       case 'windows31j':
+                               return 'Windows-31J';
+
+                       case 'iso885911':
+                       case 'tis620':
+                               return 'Windows-874';
+
+                       case 'cseuckr':
+                       case 'euckr':
+                       case 'windows949':
+                       case 'csksc56011987':
+                       case 'isoir149':
+                       case 'korean':
+                       case 'ksc5601':
+                       case 'ksc56011987':
+                       case 'ksc56011989':
+                               return 'Windows-949';
+
+                       case 'windows1250':
+                               return 'windows-1250';
+
+                       case 'windows1251':
+                               return 'windows-1251';
+
+                       case 'cp819':
+                       case 'csisolatin1':
+                       case 'ibm819':
+                       case 'iso88591':
+                       case 'isoir100':
+                       case 'iso885911987':
+                       case 'l1':
+                       case 'latin1':
+                       case 'windows1252':
+                               return 'Windows-1252';
+
+                       case 'windows1252':
+                               return 'windows-1252';
+
+                       case 'windows1253':
+                               return 'windows-1253';
+
+                       case 'csisolatin5':
+                       case 'iso88599':
+                       case 'isoir148':
+                       case 'iso885991989':
+                       case 'l5':
+                       case 'latin5':
+                       case 'windows1254':
+                               return 'Windows-1254';
+
+                       case 'windows1254':
+                               return 'windows-1254';
+
+                       case 'windows1255':
+                               return 'windows-1255';
+
+                       case 'windows1256':
+                               return 'windows-1256';
+
+                       case 'windows1257':
+                               return 'windows-1257';
+
+                       case 'windows1258':
+                               return 'windows-1258';
+
+                       default:
+                               return $charset;
+               }
+       }
+
+       function get_curl_version()
+       {
+               if (is_array($curl = curl_version()))
+               {
+                       $curl = $curl['version'];
+               }
+               elseif (substr($curl, 0, 5) == 'curl/')
+               {
+                       $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
+               }
+               elseif (substr($curl, 0, 8) == 'libcurl/')
+               {
+                       $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
+               }
+               else
+               {
+                       $curl = 0;
+               }
+               return $curl;
+       }
+
+       function is_subclass_of($class1, $class2)
+       {
+               if (func_num_args() != 2)
+               {
+                       trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
+               }
+               elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
+               {
+                       return is_subclass_of($class1, $class2);
+               }
+               elseif (is_string($class1) && is_string($class2))
+               {
+                       if (class_exists($class1))
+                       {
+                               if (class_exists($class2))
+                               {
+                                       $class2 = strtolower($class2);
+                                       while ($class1 = strtolower(get_parent_class($class1)))
+                                       {
+                                               if ($class1 == $class2)
+                                               {
+                                                       return true;
+                                               }
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * Strip HTML comments
+        *
+        * @access public
+        * @param string $data Data to strip comments from
+        * @return string Comment stripped string
+        */
+       function strip_comments($data)
+       {
+               $output = '';
+               while (($start = strpos($data, '<!--')) !== false)
+               {
+                       $output .= substr($data, 0, $start);
+                       if (($end = strpos($data, '-->', $start)) !== false)
+                       {
+                               $data = substr_replace($data, '', 0, $end + 3);
+                       }
+                       else
+                       {
+                               $data = '';
+                       }
+               }
+               return $output . $data;
+       }
+
+       function parse_date($dt)
+       {
+               $parser = SimplePie_Parse_Date::get();
+               return $parser->parse($dt);
+       }
+
+       /**
+        * Decode HTML entities
+        *
+        * @static
+        * @access public
+        * @param string $data Input data
+        * @return string Output data
+        */
+       function entities_decode($data)
+       {
+               $decoder = new SimplePie_Decode_HTML_Entities($data);
+               return $decoder->parse();
+       }
+
+       /**
+        * Remove RFC822 comments
+        *
+        * @access public
+        * @param string $data Data to strip comments from
+        * @return string Comment stripped string
+        */
+       function uncomment_rfc822($string)
+       {
+               $string = (string) $string;
+               $position = 0;
+               $length = strlen($string);
+               $depth = 0;
+
+               $output = '';
+
+               while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
+               {
+                       $output .= substr($string, $position, $pos - $position);
+                       $position = $pos + 1;
+                       if ($string[$pos - 1] !== '\\')
+                       {
+                               $depth++;
+                               while ($depth && $position < $length)
+                               {
+                                       $position += strcspn($string, '()', $position);
+                                       if ($string[$position - 1] === '\\')
+                                       {
+                                               $position++;
+                                               continue;
+                                       }
+                                       elseif (isset($string[$position]))
+                                       {
+                                               switch ($string[$position])
+                                               {
+                                                       case '(':
+                                                               $depth++;
+                                                               break;
+
+                                                       case ')':
+                                                               $depth--;
+                                                               break;
+                                               }
+                                               $position++;
+                                       }
+                                       else
+                                       {
+                                               break;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $output .= '(';
+                       }
+               }
+               $output .= substr($string, $position);
+
+               return $output;
+       }
+
+       function parse_mime($mime)
+       {
+               if (($pos = strpos($mime, ';')) === false)
+               {
+                       return trim($mime);
+               }
+               else
+               {
+                       return trim(substr($mime, 0, $pos));
+               }
+       }
+
+       function htmlspecialchars_decode($string, $quote_style)
+       {
+               if (function_exists('htmlspecialchars_decode'))
+               {
+                       return htmlspecialchars_decode($string, $quote_style);
+               }
+               else
+               {
+                       return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
+               }
+       }
+
+       function atom_03_construct_type($attribs)
+       {
+               if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) == 'base64'))
+               {
+                       $mode = SIMPLEPIE_CONSTRUCT_BASE64;
+               }
+               else
+               {
+                       $mode = SIMPLEPIE_CONSTRUCT_NONE;
+               }
+               if (isset($attribs['']['type']))
+               {
+                       switch (strtolower(trim($attribs['']['type'])))
+                       {
+                               case 'text':
+                               case 'text/plain':
+                                       return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+
+                               case 'html':
+                               case 'text/html':
+                                       return SIMPLEPIE_CONSTRUCT_HTML | $mode;
+
+                               case 'xhtml':
+                               case 'application/xhtml+xml':
+                                       return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
+
+                               default:
+                                       return SIMPLEPIE_CONSTRUCT_NONE | $mode;
+                       }
+               }
+               else
+               {
+                       return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+               }
+       }
+
+       function atom_10_construct_type($attribs)
+       {
+               if (isset($attribs['']['type']))
+               {
+                       switch (strtolower(trim($attribs['']['type'])))
+                       {
+                               case 'text':
+                                       return SIMPLEPIE_CONSTRUCT_TEXT;
+
+                               case 'html':
+                                       return SIMPLEPIE_CONSTRUCT_HTML;
+
+                               case 'xhtml':
+                                       return SIMPLEPIE_CONSTRUCT_XHTML;
+
+                               default:
+                                       return SIMPLEPIE_CONSTRUCT_NONE;
+                       }
+               }
+               return SIMPLEPIE_CONSTRUCT_TEXT;
+       }
+
+       function atom_10_content_construct_type($attribs)
+       {
+               if (isset($attribs['']['type']))
+               {
+                       $type = strtolower(trim($attribs['']['type']));
+                       switch ($type)
+                       {
+                               case 'text':
+                                       return SIMPLEPIE_CONSTRUCT_TEXT;
+
+                               case 'html':
+                                       return SIMPLEPIE_CONSTRUCT_HTML;
+
+                               case 'xhtml':
+                                       return SIMPLEPIE_CONSTRUCT_XHTML;
+                       }
+                       if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) == 'text/')
+                       {
+                               return SIMPLEPIE_CONSTRUCT_NONE;
+                       }
+                       else
+                       {
+                               return SIMPLEPIE_CONSTRUCT_BASE64;
+                       }
+               }
+               else
+               {
+                       return SIMPLEPIE_CONSTRUCT_TEXT;
+               }
+       }
+
+       function is_isegment_nz_nc($string)
+       {
+               return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
+       }
+
+       function space_seperated_tokens($string)
+       {
+               $space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
+               $string_length = strlen($string);
+
+               $position = strspn($string, $space_characters);
+               $tokens = array();
+
+               while ($position < $string_length)
+               {
+                       $len = strcspn($string, $space_characters, $position);
+                       $tokens[] = substr($string, $position, $len);
+                       $position += $len;
+                       $position += strspn($string, $space_characters, $position);
+               }
+
+               return $tokens;
+       }
+
+       function array_unique($array)
+       {
+               if (version_compare(PHP_VERSION, '5.2', '>='))
+               {
+                       return array_unique($array);
+               }
+               else
+               {
+                       $array = (array) $array;
+                       $new_array = array();
+                       $new_array_strings = array();
+                       foreach ($array as $key => $value)
+                       {
+                               if (is_object($value))
+                               {
+                                       if (method_exists($value, '__toString'))
+                                       {
+                                               $cmp = $value->__toString();
+                                       }
+                                       else
+                                       {
+                                               trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
+                                       }
+                               }
+                               elseif (is_array($value))
+                               {
+                                       $cmp = (string) reset($value);
+                               }
+                               else
+                               {
+                                       $cmp = (string) $value;
+                               }
+                               if (!in_array($cmp, $new_array_strings))
+                               {
+                                       $new_array[$key] = $value;
+                                       $new_array_strings[] = $cmp;
+                               }
+                       }
+                       return $new_array;
+               }
+       }
+
+       /**
+        * Converts a unicode codepoint to a UTF-8 character
+        *
+        * @static
+        * @access public
+        * @param int $codepoint Unicode codepoint
+        * @return string UTF-8 character
+        */
+       function codepoint_to_utf8($codepoint)
+       {
+               static $cache = array();
+               $codepoint = (int) $codepoint;
+               if (isset($cache[$codepoint]))
+               {
+                       return $cache[$codepoint];
+               }
+               elseif ($codepoint < 0)
+               {
+                       return $cache[$codepoint] = false;
+               }
+               else if ($codepoint <= 0x7f)
+               {
+                       return $cache[$codepoint] = chr($codepoint);
+               }
+               else if ($codepoint <= 0x7ff)
+               {
+                       return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+               }
+               else if ($codepoint <= 0xffff)
+               {
+                       return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+               }
+               else if ($codepoint <= 0x10ffff)
+               {
+                       return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+               }
+               else
+               {
+                       // U+FFFD REPLACEMENT CHARACTER
+                       return $cache[$codepoint] = "\xEF\xBF\xBD";
+               }
+       }
+
+       /**
+        * Re-implementation of PHP 5's stripos()
+        *
+        * Returns the numeric position of the first occurrence of needle in the
+        * haystack string.
+        *
+        * @static
+        * @access string
+        * @param object $haystack
+        * @param string $needle Note that the needle may be a string of one or more
+        *     characters. If needle is not a string, it is converted to an integer
+        *     and applied as the ordinal value of a character.
+        * @param int $offset The optional offset parameter allows you to specify which
+        *     character in haystack to start searching. The position returned is still
+        *     relative to the beginning of haystack.
+        * @return bool If needle is not found, stripos() will return boolean false.
+        */
+       function stripos($haystack, $needle, $offset = 0)
+       {
+               if (function_exists('stripos'))
+               {
+                       return stripos($haystack, $needle, $offset);
+               }
+               else
+               {
+                       if (is_string($needle))
+                       {
+                               $needle = strtolower($needle);
+                       }
+                       elseif (is_int($needle) || is_bool($needle) || is_double($needle))
+                       {
+                               $needle = strtolower(chr($needle));
+                       }
+                       else
+                       {
+                               trigger_error('needle is not a string or an integer', E_USER_WARNING);
+                               return false;
+                       }
+
+                       return strpos(strtolower($haystack), $needle, $offset);
+               }
+       }
+
+       /**
+        * Similar to parse_str()
+        *
+        * Returns an associative array of name/value pairs, where the value is an
+        * array of values that have used the same name
+        *
+        * @static
+        * @access string
+        * @param string $str The input string.
+        * @return array
+        */
+       function parse_str($str)
+       {
+               $return = array();
+               $str = explode('&', $str);
+
+               foreach ($str as $section)
+               {
+                       if (strpos($section, '=') !== false)
+                       {
+                               list($name, $value) = explode('=', $section, 2);
+                               $return[urldecode($name)][] = urldecode($value);
+                       }
+                       else
+                       {
+                               $return[urldecode($section)][] = null;
+                       }
+               }
+
+               return $return;
+       }
+
+       /**
+        * Detect XML encoding, as per XML 1.0 Appendix F.1
+        *
+        * @todo Add support for EBCDIC
+        * @param string $data XML data
+        * @return array Possible encodings
+        */
+       function xml_encoding($data)
+       {
+               // UTF-32 Big Endian BOM
+               if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
+               {
+                       $encoding[] = 'UTF-32BE';
+               }
+               // UTF-32 Little Endian BOM
+               elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
+               {
+                       $encoding[] = 'UTF-32LE';
+               }
+               // UTF-16 Big Endian BOM
+               elseif (substr($data, 0, 2) === "\xFE\xFF")
+               {
+                       $encoding[] = 'UTF-16BE';
+               }
+               // UTF-16 Little Endian BOM
+               elseif (substr($data, 0, 2) === "\xFF\xFE")
+               {
+                       $encoding[] = 'UTF-16LE';
+               }
+               // UTF-8 BOM
+               elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
+               {
+                       $encoding[] = 'UTF-8';
+               }
+               // UTF-32 Big Endian Without BOM
+               elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C")
+               {
+                       if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
+                       {
+                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
+                               if ($parser->parse())
+                               {
+                                       $encoding[] = $parser->encoding;
+                               }
+                       }
+                       $encoding[] = 'UTF-32BE';
+               }
+               // UTF-32 Little Endian Without BOM
+               elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
+               {
+                       if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
+                       {
+                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
+                               if ($parser->parse())
+                               {
+                                       $encoding[] = $parser->encoding;
+                               }
+                       }
+                       $encoding[] = 'UTF-32LE';
+               }
+               // UTF-16 Big Endian Without BOM
+               elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
+               {
+                       if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
+                       {
+                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
+                               if ($parser->parse())
+                               {
+                                       $encoding[] = $parser->encoding;
+                               }
+                       }
+                       $encoding[] = 'UTF-16BE';
+               }
+               // UTF-16 Little Endian Without BOM
+               elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
+               {
+                       if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
+                       {
+                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
+                               if ($parser->parse())
+                               {
+                                       $encoding[] = $parser->encoding;
+                               }
+                       }
+                       $encoding[] = 'UTF-16LE';
+               }
+               // US-ASCII (or superset)
+               elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
+               {
+                       if ($pos = strpos($data, "\x3F\x3E"))
+                       {
+                               $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+                               if ($parser->parse())
+                               {
+                                       $encoding[] = $parser->encoding;
+                               }
+                       }
+                       $encoding[] = 'UTF-8';
+               }
+               // Fallback to UTF-8
+               else
+               {
+                       $encoding[] = 'UTF-8';
+               }
+               return $encoding;
+       }
+}
+
+/**
+ * Decode HTML Entities
+ *
+ * This implements HTML5 as of revision 967 (2007-06-28)
+ *
+ * @package SimplePie
+ */
+class SimplePie_Decode_HTML_Entities
+{
+       /**
+        * Data to be parsed
+        *
+        * @access private
+        * @var string
+        */
+       var $data = '';
+
+       /**
+        * Currently consumed bytes
+        *
+        * @access private
+        * @var string
+        */
+       var $consumed = '';
+
+       /**
+        * Position of the current byte being parsed
+        *
+        * @access private
+        * @var int
+        */
+       var $position = 0;
+
+       /**
+        * Create an instance of the class with the input data
+        *
+        * @access public
+        * @param string $data Input data
+        */
+       function SimplePie_Decode_HTML_Entities($data)
+       {
+               $this->data = $data;
+       }
+
+       /**
+        * Parse the input data
+        *
+        * @access public
+        * @return string Output data
+        */
+       function parse()
+       {
+               while (($this->position = strpos($this->data, '&', $this->position)) !== false)
+               {
+                       $this->consume();
+                       $this->entity();
+                       $this->consumed = '';
+               }
+               return $this->data;
+       }
+
+       /**
+        * Consume the next byte
+        *
+        * @access private
+        * @return mixed The next byte, or false, if there is no more data
+        */
+       function consume()
+       {
+               if (isset($this->data[$this->position]))
+               {
+                       $this->consumed .= $this->data[$this->position];
+                       return $this->data[$this->position++];
+               }
+               else
+               {
+                       $this->consumed = false;
+                       return false;
+               }
+       }
+
+       /**
+        * Consume a range of characters
+        *
+        * @access private
+        * @param string $chars Characters to consume
+        * @return mixed A series of characters that match the range, or false
+        */
+       function consume_range($chars)
+       {
+               if ($len = strspn($this->data, $chars, $this->position))
+               {
+                       $data = substr($this->data, $this->position, $len);
+                       $this->consumed .= $data;
+                       $this->position += $len;
+                       return $data;
+               }
+               else
+               {
+                       $this->consumed = false;
+                       return false;
+               }
+       }
+
+       /**
+        * Unconsume one byte
+        *
+        * @access private
+        */
+       function unconsume()
+       {
+               $this->consumed = substr($this->consumed, 0, -1);
+               $this->position--;
+       }
+
+       /**
+        * Decode an entity
+        *
+        * @access private
+        */
+       function entity()
+       {
+               switch ($this->consume())
+               {
+                       case "\x09":
+                       case "\x0A":
+                       case "\x0B":
+                       case "\x0B":
+                       case "\x0C":
+                       case "\x20":
+                       case "\x3C":
+                       case "\x26":
+                       case false:
+                               break;
+
+                       case "\x23":
+                               switch ($this->consume())
+                               {
+                                       case "\x78":
+                                       case "\x58":
+                                               $range = '0123456789ABCDEFabcdef';
+                                               $hex = true;
+                                               break;
+
+                                       default:
+                                               $range = '0123456789';
+                                               $hex = false;
+                                               $this->unconsume();
+                                               break;
+                               }
+
+                               if ($codepoint = $this->consume_range($range))
+                               {
+                                       static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
+
+                                       if ($hex)
+                                       {
+                                               $codepoint = hexdec($codepoint);
+                                       }
+                                       else
+                                       {
+                                               $codepoint = intval($codepoint);
+                                       }
+
+                                       if (isset($windows_1252_specials[$codepoint]))
+                                       {
+                                               $replacement = $windows_1252_specials[$codepoint];
+                                       }
+                                       else
+                                       {
+                                               $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
+                                       }
+
+                                       if ($this->consume() != ';')
+                                       {
+                                               $this->unconsume();
+                                       }
+
+                                       $consumed_length = strlen($this->consumed);
+                                       $this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
+                                       $this->position += strlen($replacement) - $consumed_length;
+                               }
+                               break;
+
+                       default:
+                               static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
+
+                               for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
+                               {
+                                       $consumed = substr($this->consumed, 1);
+                                       if (isset($entities[$consumed]))
+                                       {
+                                               $match = $consumed;
+                                       }
+                               }
+
+                               if ($match !== null)
+                               {
+                                       $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
+                                       $this->position += strlen($entities[$match]) - strlen($consumed) - 1;
+                               }
+                               break;
+               }
+       }
+}
+
+/**
+ * Date Parser
+ *
+ * @package SimplePie
+ */
+class SimplePie_Parse_Date
+{
+       /**
+        * Input data
+        *
+        * @access protected
+        * @var string
+        */
+       var $date;
+
+       /**
+        * List of days, calendar day name => ordinal day number in the week
+        *
+        * @access protected
+        * @var array
+        */
+       var $day = array(
+               // English
+               'mon' => 1,
+               'monday' => 1,
+               'tue' => 2,
+               'tuesday' => 2,
+               'wed' => 3,
+               'wednesday' => 3,
+               'thu' => 4,
+               'thursday' => 4,
+               'fri' => 5,
+               'friday' => 5,
+               'sat' => 6,
+               'saturday' => 6,
+               'sun' => 7,
+               'sunday' => 7,
+               // Dutch
+               'maandag' => 1,
+               'dinsdag' => 2,
+               'woensdag' => 3,
+               'donderdag' => 4,
+               'vrijdag' => 5,
+               'zaterdag' => 6,
+               'zondag' => 7,
+               // French
+               'lundi' => 1,
+               'mardi' => 2,
+               'mercredi' => 3,
+               'jeudi' => 4,
+               'vendredi' => 5,
+               'samedi' => 6,
+               'dimanche' => 7,
+               // German
+               'montag' => 1,
+               'dienstag' => 2,
+               'mittwoch' => 3,
+               'donnerstag' => 4,
+               'freitag' => 5,
+               'samstag' => 6,
+               'sonnabend' => 6,
+               'sonntag' => 7,
+               // Italian
+               'lunedì' => 1,
+               'martedì' => 2,
+               'mercoledì' => 3,
+               'giovedì' => 4,
+               'venerdì' => 5,
+               'sabato' => 6,
+               'domenica' => 7,
+               // Spanish
+               'lunes' => 1,
+               'martes' => 2,
+               'miércoles' => 3,
+               'jueves' => 4,
+               'viernes' => 5,
+               'sábado' => 6,
+               'domingo' => 7,
+               // Finnish
+               'maanantai' => 1,
+               'tiistai' => 2,
+               'keskiviikko' => 3,
+               'torstai' => 4,
+               'perjantai' => 5,
+               'lauantai' => 6,
+               'sunnuntai' => 7,
+               // Hungarian
+               'hétfő' => 1,
+               'kedd' => 2,
+               'szerda' => 3,
+               'csütörtok' => 4,
+               'péntek' => 5,
+               'szombat' => 6,
+               'vasárnap' => 7,
+               // Greek
+               'Δευ' => 1,
+               'Τρι' => 2,
+               'Τετ' => 3,
+               'Πεμ' => 4,
+               'Παρ' => 5,
+               'Σαβ' => 6,
+               'Κυρ' => 7,
+       );
+
+       /**
+        * List of months, calendar month name => calendar month number
+        *
+        * @access protected
+        * @var array
+        */
+       var $month = array(
+               // English
+               'jan' => 1,
+               'january' => 1,
+               'feb' => 2,
+               'february' => 2,
+               'mar' => 3,
+               'march' => 3,
+               'apr' => 4,
+               'april' => 4,
+               'may' => 5,
+               // No long form of May
+               'jun' => 6,
+               'june' => 6,
+               'jul' => 7,
+               'july' => 7,
+               'aug' => 8,
+               'august' => 8,
+               'sep' => 9,
+               'september' => 8,
+               'oct' => 10,
+               'october' => 10,
+               'nov' => 11,
+               'november' => 11,
+               'dec' => 12,
+               'december' => 12,
+               // Dutch
+               'januari' => 1,
+               'februari' => 2,
+               'maart' => 3,
+               'april' => 4,
+               'mei' => 5,
+               'juni' => 6,
+               'juli' => 7,
+               'augustus' => 8,
+               'september' => 9,
+               'oktober' => 10,
+               'november' => 11,
+               'december' => 12,
+               // French
+               'janvier' => 1,
+               'février' => 2,
+               'mars' => 3,
+               'avril' => 4,
+               'mai' => 5,
+               'juin' => 6,
+               'juillet' => 7,
+               'août' => 8,
+               'septembre' => 9,
+               'octobre' => 10,
+               'novembre' => 11,
+               'décembre' => 12,
+               // German
+               'januar' => 1,
+               'februar' => 2,
+               'märz' => 3,
+               'april' => 4,
+               'mai' => 5,
+               'juni' => 6,
+               'juli' => 7,
+               'august' => 8,
+               'september' => 9,
+               'oktober' => 10,
+               'november' => 11,
+               'dezember' => 12,
+               // Italian
+               'gennaio' => 1,
+               'febbraio' => 2,
+               'marzo' => 3,
+               'aprile' => 4,
+               'maggio' => 5,
+               'giugno' => 6,
+               'luglio' => 7,
+               'agosto' => 8,
+               'settembre' => 9,
+               'ottobre' => 10,
+               'novembre' => 11,
+               'dicembre' => 12,
+               // Spanish
+               'enero' => 1,
+               'febrero' => 2,
+               'marzo' => 3,
+               'abril' => 4,
+               'mayo' => 5,
+               'junio' => 6,
+               'julio' => 7,
+               'agosto' => 8,
+               'septiembre' => 9,
+               'setiembre' => 9,
+               'octubre' => 10,
+               'noviembre' => 11,
+               'diciembre' => 12,
+               // Finnish
+               'tammikuu' => 1,
+               'helmikuu' => 2,
+               'maaliskuu' => 3,
+               'huhtikuu' => 4,
+               'toukokuu' => 5,
+               'kesäkuu' => 6,
+               'heinäkuu' => 7,
+               'elokuu' => 8,
+               'suuskuu' => 9,
+               'lokakuu' => 10,
+               'marras' => 11,
+               'joulukuu' => 12,
+               // Hungarian
+               'január' => 1,
+               'február' => 2,
+               'március' => 3,
+               'április' => 4,
+               'május' => 5,
+               'június' => 6,
+               'július' => 7,
+               'augusztus' => 8,
+               'szeptember' => 9,
+               'október' => 10,
+               'november' => 11,
+               'december' => 12,
+               // Greek
+               'Ιαν' => 1,
+               'Φεβ' => 2,
+               'Μάώ' => 3,
+               'Μαώ' => 3,
+               'Απρ' => 4,
+               'Μάι' => 5,
+               'Μαϊ' => 5,
+               'Μαι' => 5,
+               'Ιούν' => 6,
+               'Ιον' => 6,
+               'Ιούλ' => 7,
+               'Ιολ' => 7,
+               'Αύγ' => 8,
+               'Αυγ' => 8,
+               'Σεπ' => 9,
+               'Οκτ' => 10,
+               'Νοέ' => 11,
+               'Δεκ' => 12,
+       );
+
+       /**
+        * List of timezones, abbreviation => offset from UTC
+        *
+        * @access protected
+        * @var array
+        */
+       var $timezone = array(
+               'ACDT' => 37800,
+               'ACIT' => 28800,
+               'ACST' => 34200,
+               'ACT' => -18000,
+               'ACWDT' => 35100,
+               'ACWST' => 31500,
+               'AEDT' => 39600,
+               'AEST' => 36000,
+               'AFT' => 16200,
+               'AKDT' => -28800,
+               'AKST' => -32400,
+               'AMDT' => 18000,
+               'AMT' => -14400,
+               'ANAST' => 46800,
+               'ANAT' => 43200,
+               'ART' => -10800,
+               'AZOST' => -3600,
+               'AZST' => 18000,
+               'AZT' => 14400,
+               'BIOT' => 21600,
+               'BIT' => -43200,
+               'BOT' => -14400,
+               'BRST' => -7200,
+               'BRT' => -10800,
+               'BST' => 3600,
+               'BTT' => 21600,
+               'CAST' => 18000,
+               'CAT' => 7200,
+               'CCT' => 23400,
+               'CDT' => -18000,
+               'CEDT' => 7200,
+               'CET' => 3600,
+               'CGST' => -7200,
+               'CGT' => -10800,
+               'CHADT' => 49500,
+               'CHAST' => 45900,
+               'CIST' => -28800,
+               'CKT' => -36000,
+               'CLDT' => -10800,
+               'CLST' => -14400,
+               'COT' => -18000,
+               'CST' => -21600,
+               'CVT' => -3600,
+               'CXT' => 25200,
+               'DAVT' => 25200,
+               'DTAT' => 36000,
+               'EADT' => -18000,
+               'EAST' => -21600,
+               'EAT' => 10800,
+               'ECT' => -18000,
+               'EDT' => -14400,
+               'EEST' => 10800,
+               'EET' => 7200,
+               'EGT' => -3600,
+               'EKST' => 21600,
+               'EST' => -18000,
+               'FJT' => 43200,
+               'FKDT' => -10800,
+               'FKST' => -14400,
+               'FNT' => -7200,
+               'GALT' => -21600,
+               'GEDT' => 14400,
+               'GEST' => 10800,
+               'GFT' => -10800,
+               'GILT' => 43200,
+               'GIT' => -32400,
+               'GST' => 14400,
+               'GST' => -7200,
+               'GYT' => -14400,
+               'HAA' => -10800,
+               'HAC' => -18000,
+               'HADT' => -32400,
+               'HAE' => -14400,
+               'HAP' => -25200,
+               'HAR' => -21600,
+               'HAST' => -36000,
+               'HAT' => -9000,
+               'HAY' => -28800,
+               'HKST' => 28800,
+               'HMT' => 18000,
+               'HNA' => -14400,
+               'HNC' => -21600,
+               'HNE' => -18000,
+               'HNP' => -28800,
+               'HNR' => -25200,
+               'HNT' => -12600,
+               'HNY' => -32400,
+               'IRDT' => 16200,
+               'IRKST' => 32400,
+               'IRKT' => 28800,
+               'IRST' => 12600,
+               'JFDT' => -10800,
+               'JFST' => -14400,
+               'JST' => 32400,
+               'KGST' => 21600,
+               'KGT' => 18000,
+               'KOST' => 39600,
+               'KOVST' => 28800,
+               'KOVT' => 25200,
+               'KRAST' => 28800,
+               'KRAT' => 25200,
+               'KST' => 32400,
+               'LHDT' => 39600,
+               'LHST' => 37800,
+               'LINT' => 50400,
+               'LKT' => 21600,
+               'MAGST' => 43200,
+               'MAGT' => 39600,
+               'MAWT' => 21600,
+               'MDT' => -21600,
+               'MESZ' => 7200,
+               'MEZ' => 3600,
+               'MHT' => 43200,
+               'MIT' => -34200,
+               'MNST' => 32400,
+               'MSDT' => 14400,
+               'MSST' => 10800,
+               'MST' => -25200,
+               'MUT' => 14400,
+               'MVT' => 18000,
+               'MYT' => 28800,
+               'NCT' => 39600,
+               'NDT' => -9000,
+               'NFT' => 41400,
+               'NMIT' => 36000,
+               'NOVST' => 25200,
+               'NOVT' => 21600,
+               'NPT' => 20700,
+               'NRT' => 43200,
+               'NST' => -12600,
+               'NUT' => -39600,
+               'NZDT' => 46800,
+               'NZST' => 43200,
+               'OMSST' => 25200,
+               'OMST' => 21600,
+               'PDT' => -25200,
+               'PET' => -18000,
+               'PETST' => 46800,
+               'PETT' => 43200,
+               'PGT' => 36000,
+               'PHOT' => 46800,
+               'PHT' => 28800,
+               'PKT' => 18000,
+               'PMDT' => -7200,
+               'PMST' => -10800,
+               'PONT' => 39600,
+               'PST' => -28800,
+               'PWT' => 32400,
+               'PYST' => -10800,
+               'PYT' => -14400,
+               'RET' => 14400,
+               'ROTT' => -10800,
+               'SAMST' => 18000,
+               'SAMT' => 14400,
+               'SAST' => 7200,
+               'SBT' => 39600,
+               'SCDT' => 46800,
+               'SCST' => 43200,
+               'SCT' => 14400,
+               'SEST' => 3600,
+               'SGT' => 28800,
+               'SIT' => 28800,
+               'SRT' => -10800,
+               'SST' => -39600,
+               'SYST' => 10800,
+               'SYT' => 7200,
+               'TFT' => 18000,
+               'THAT' => -36000,
+               'TJT' => 18000,
+               'TKT' => -36000,
+               'TMT' => 18000,
+               'TOT' => 46800,
+               'TPT' => 32400,
+               'TRUT' => 36000,
+               'TVT' => 43200,
+               'TWT' => 28800,
+               'UYST' => -7200,
+               'UYT' => -10800,
+               'UZT' => 18000,
+               'VET' => -14400,
+               'VLAST' => 39600,
+               'VLAT' => 36000,
+               'VOST' => 21600,
+               'VUT' => 39600,
+               'WAST' => 7200,
+               'WAT' => 3600,
+               'WDT' => 32400,
+               'WEST' => 3600,
+               'WFT' => 43200,
+               'WIB' => 25200,
+               'WIT' => 32400,
+               'WITA' => 28800,
+               'WKST' => 18000,
+               'WST' => 28800,
+               'YAKST' => 36000,
+               'YAKT' => 32400,
+               'YAPT' => 36000,
+               'YEKST' => 21600,
+               'YEKT' => 18000,
+       );
+
+       /**
+        * Cached PCRE for SimplePie_Parse_Date::$day
+        *
+        * @access protected
+        * @var string
+        */
+       var $day_pcre;
+
+       /**
+        * Cached PCRE for SimplePie_Parse_Date::$month
+        *
+        * @access protected
+        * @var string
+        */
+       var $month_pcre;
+
+       /**
+        * Array of user-added callback methods
+        *
+        * @access private
+        * @var array
+        */
+       var $built_in = array();
+
+       /**
+        * Array of user-added callback methods
+        *
+        * @access private
+        * @var array
+        */
+       var $user = array();
+
+       /**
+        * Create new SimplePie_Parse_Date object, and set self::day_pcre,
+        * self::month_pcre, and self::built_in
+        *
+        * @access private
+        */
+       function SimplePie_Parse_Date()
+       {
+               $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
+               $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
+
+               static $cache;
+               if (!isset($cache[get_class($this)]))
+               {
+                       if (extension_loaded('Reflection'))
+                       {
+                               $class = new ReflectionClass(get_class($this));
+                               $methods = $class->getMethods();
+                               $all_methods = array();
+                               foreach ($methods as $method)
+                               {
+                                       $all_methods[] = $method->getName();
+                               }
+                       }
+                       else
+                       {
+                               $all_methods = get_class_methods($this);
+                       }
+
+                       foreach ($all_methods as $method)
+                       {
+                               if (strtolower(substr($method, 0, 5)) === 'date_')
+                               {
+                                       $cache[get_class($this)][] = $method;
+                               }
+                       }
+               }
+
+               foreach ($cache[get_class($this)] as $method)
+               {
+                       $this->built_in[] = $method;
+               }
+       }
+
+       /**
+        * Get the object
+        *
+        * @access public
+        */
+       function get()
+       {
+               static $object;
+               if (!$object)
+               {
+                       $object = new SimplePie_Parse_Date;
+               }
+               return $object;
+       }
+
+       /**
+        * Parse a date
+        *
+        * @final
+        * @access public
+        * @param string $date Date to parse
+        * @return int Timestamp corresponding to date string, or false on failure
+        */
+       function parse($date)
+       {
+               foreach ($this->user as $method)
+               {
+                       if (($returned = call_user_func($method, $date)) !== false)
+                       {
+                               return $returned;
+                       }
+               }
+
+               foreach ($this->built_in as $method)
+               {
+                       if (($returned = call_user_func(array(&$this, $method), $date)) !== false)
+                       {
+                               return $returned;
+                       }
+               }
+
+               return false;
+       }
+
+       /**
+        * Add a callback method to parse a date
+        *
+        * @final
+        * @access public
+        * @param callback $callback
+        */
+       function add_callback($callback)
+       {
+               if (is_callable($callback))
+               {
+                       $this->user[] = $callback;
+               }
+               else
+               {
+                       trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
+               }
+       }
+
+       /**
+        * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
+        * well as allowing any of upper or lower case "T", horizontal tabs, or
+        * spaces to be used as the time seperator (including more than one))
+        *
+        * @access protected
+        * @return int Timestamp
+        */
+       function date_w3cdtf($date)
+       {
+               static $pcre;
+               if (!$pcre)
+               {
+                       $year = '([0-9]{4})';
+                       $month = $day = $hour = $minute = $second = '([0-9]{2})';
+                       $decimal = '([0-9]*)';
+                       $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
+                       $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/';
+               }
+               if (preg_match($pcre, $date, $match))
+               {
+                       /*
+                       Capturing subpatterns:
+                       1: Year
+                       2: Month
+                       3: Day
+                       4: Hour
+                       5: Minute
+                       6: Second
+                       7: Decimal fraction of a second
+                       8: Zulu
+                       9: Timezone ±
+                       10: Timezone hours
+                       11: Timezone minutes
+                       */
+
+                       // Fill in empty matches
+                       for ($i = count($match); $i <= 3; $i++)
+                       {
+                               $match[$i] = '1';
+                       }
+
+                       for ($i = count($match); $i <= 7; $i++)
+                       {
+                               $match[$i] = '0';
+                       }
+
+                       // Numeric timezone
+                       if (isset($match[9]) && $match[9] !== '')
+                       {
+                               $timezone = $match[10] * 3600;
+                               $timezone += $match[11] * 60;
+                               if ($match[9] === '-')
+                               {
+                                       $timezone = 0 - $timezone;
+                               }
+                       }
+                       else
+                       {
+                               $timezone = 0;
+                       }
+
+                       // Convert the number of seconds to an integer, taking decimals into account
+                       $second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
+
+                       return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+
+       /**
+        * Remove RFC822 comments
+        *
+        * @access protected
+        * @param string $data Data to strip comments from
+        * @return string Comment stripped string
+        */
+       function remove_rfc2822_comments($string)
+       {
+               $string = (string) $string;
+               $position = 0;
+               $length = strlen($string);
+               $depth = 0;
+
+               $output = '';
+
+               while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
+               {
+                       $output .= substr($string, $position, $pos - $position);
+                       $position = $pos + 1;
+                       if ($string[$pos - 1] !== '\\')
+                       {
+                               $depth++;
+                               while ($depth && $position < $length)
+                               {
+                                       $position += strcspn($string, '()', $position);
+                                       if ($string[$position - 1] === '\\')
+                                       {
+                                               $position++;
+                                               continue;
+                                       }
+                                       elseif (isset($string[$position]))
+                                       {
+                                               switch ($string[$position])
+                                               {
+                                                       case '(':
+                                                               $depth++;
+                                                               break;
+
+                                                       case ')':
+                                                               $depth--;
+                                                               break;
+                                               }
+                                               $position++;
+                                       }
+                                       else
+                                       {
+                                               break;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $output .= '(';
+                       }
+               }
+               $output .= substr($string, $position);
+
+               return $output;
+       }
+
+       /**
+        * Parse RFC2822's date format
+        *
+        * @access protected
+        * @return int Timestamp
+        */
+       function date_rfc2822($date)
+       {
+               static $pcre;
+               if (!$pcre)
+               {
+                       $wsp = '[\x09\x20]';
+                       $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
+                       $optional_fws = $fws . '?';
+                       $day_name = $this->day_pcre;
+                       $month = $this->month_pcre;
+                       $day = '([0-9]{1,2})';
+                       $hour = $minute = $second = '([0-9]{2})';
+                       $year = '([0-9]{2,4})';
+                       $num_zone = '([+\-])([0-9]{2})([0-9]{2})';
+                       $character_zone = '([A-Z]{1,5})';
+                       $zone = '(?:' . $num_zone . '|' . $character_zone . ')';
+                       $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
+               }
+               if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
+               {
+                       /*
+                       Capturing subpatterns:
+                       1: Day name
+                       2: Day
+                       3: Month
+                       4: Year
+                       5: Hour
+                       6: Minute
+                       7: Second
+                       8: Timezone ±
+                       9: Timezone hours
+                       10: Timezone minutes
+                       11: Alphabetic timezone
+                       */
+
+                       // Find the month number
+                       $month = $this->month[strtolower($match[3])];
+
+                       // Numeric timezone
+                       if ($match[8] !== '')
+                       {
+                               $timezone = $match[9] * 3600;
+                               $timezone += $match[10] * 60;
+                               if ($match[8] === '-')
+                               {
+                                       $timezone = 0 - $timezone;
+                               }
+                       }
+                       // Character timezone
+                       elseif (isset($this->timezone[strtoupper($match[11])]))
+                       {
+                               $timezone = $this->timezone[strtoupper($match[11])];
+                       }
+                       // Assume everything else to be -0000
+                       else
+                       {
+                               $timezone = 0;
+                       }
+
+                       // Deal with 2/3 digit years
+                       if ($match[4] < 50)
+                       {
+                               $match[4] += 2000;
+                       }
+                       elseif ($match[4] < 1000)
+                       {
+                               $match[4] += 1900;
+                       }
+
+                       // Second is optional, if it is empty set it to zero
+                       if ($match[7] !== '')
+                       {
+                               $second = $match[7];
+                       }
+                       else
+                       {
+                               $second = 0;
+                       }
+
+                       return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+
+       /**
+        * Parse RFC850's date format
+        *
+        * @access protected
+        * @return int Timestamp
+        */
+       function date_rfc850($date)
+       {
+               static $pcre;
+               if (!$pcre)
+               {
+                       $space = '[\x09\x20]+';
+                       $day_name = $this->day_pcre;
+                       $month = $this->month_pcre;
+                       $day = '([0-9]{1,2})';
+                       $year = $hour = $minute = $second = '([0-9]{2})';
+                       $zone = '([A-Z]{1,5})';
+                       $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
+               }
+               if (preg_match($pcre, $date, $match))
+               {
+                       /*
+                       Capturing subpatterns:
+                       1: Day name
+                       2: Day
+                       3: Month
+                       4: Year
+                       5: Hour
+                       6: Minute
+                       7: Second
+                       8: Timezone
+                       */
+
+                       // Month
+                       $month = $this->month[strtolower($match[3])];
+
+                       // Character timezone
+                       if (isset($this->timezone[strtoupper($match[8])]))
+                       {
+                               $timezone = $this->timezone[strtoupper($match[8])];
+                       }
+                       // Assume everything else to be -0000
+                       else
+                       {
+                               $timezone = 0;
+                       }
+
+                       // Deal with 2 digit year
+                       if ($match[4] < 50)
+                       {
+                               $match[4] += 2000;
+                       }
+                       else
+                       {
+                               $match[4] += 1900;
+                       }
+
+                       return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+
+       /**
+        * Parse C99's asctime()'s date format
+        *
+        * @access protected
+        * @return int Timestamp
+        */
+       function date_asctime($date)
+       {
+               static $pcre;
+               if (!$pcre)
+               {
+                       $space = '[\x09\x20]+';
+                       $wday_name = $this->day_pcre;
+                       $mon_name = $this->month_pcre;
+                       $day = '([0-9]{1,2})';
+                       $hour = $sec = $min = '([0-9]{2})';
+                       $year = '([0-9]{4})';
+                       $terminator = '\x0A?\x00?';
+                       $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
+               }
+               if (preg_match($pcre, $date, $match))
+               {
+                       /*
+                       Capturing subpatterns:
+                       1: Day name
+                       2: Month
+                       3: Day
+                       4: Hour
+                       5: Minute
+                       6: Second
+                       7: Year
+                       */
+
+                       $month = $this->month[strtolower($match[2])];
+                       return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
+               }
+               else
+               {
+                       return false;
+               }
+       }
+
+       /**
+        * Parse dates using strtotime()
+        *
+        * @access protected
+        * @return int Timestamp
+        */
+       function date_strtotime($date)
+       {
+               $strtotime = strtotime($date);
+               if ($strtotime === -1 || $strtotime === false)
+               {
+                       return false;
+               }
+               else
+               {
+                       return $strtotime;
+               }
+       }
+}
+
+/**
+ * Content-type sniffing
+ *
+ * @package SimplePie
+ */
+class SimplePie_Content_Type_Sniffer
+{
+       /**
+        * File object
+        *
+        * @var SimplePie_File
+        * @access private
+        */
+       var $file;
+
+       /**
+        * Create an instance of the class with the input file
+        *
+        * @access public
+        * @param SimplePie_Content_Type_Sniffer $file Input file
+        */
+       function SimplePie_Content_Type_Sniffer($file)
+       {
+               $this->file = $file;
+       }
+
+       /**
+        * Get the Content-Type of the specified file
+        *
+        * @access public
+        * @return string Actual Content-Type
+        */
+       function get_type()
+       {
+               if (isset($this->file->headers['content-type']))
+               {
+                       if (!isset($this->file->headers['content-encoding'])
+                               && ($this->file->headers['content-type'] === 'text/plain'
+                                       || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
+                                       || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'))
+                       {
+                               return $this->text_or_binary();
+                       }
+
+                       if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
+                       {
+                               $official = substr($this->file->headers['content-type'], 0, $pos);
+                       }
+                       else
+                       {
+                               $official = $this->file->headers['content-type'];
+                       }
+                       $official = strtolower($official);
+
+                       if ($official === 'unknown/unknown'
+                               || $official === 'application/unknown')
+                       {
+                               return $this->unknown();
+                       }
+                       elseif (substr($official, -4) === '+xml'
+                               || $official === 'text/xml'
+                               || $official === 'application/xml')
+                       {
+                               return $official;
+                       }
+                       elseif (substr($official, 0, 6) === 'image/')
+                       {
+                               if ($return = $this->image())
+                               {
+                                       return $return;
+                               }
+                               else
+                               {
+                                       return $official;
+                               }
+                       }
+                       elseif ($official === 'text/html')
+                       {
+                               return $this->feed_or_html();
+                       }
+                       else
+                       {
+                               return $official;
+                       }
+               }
+               else
+               {
+                       return $this->unknown();
+               }
+       }
+
+       /**
+        * Sniff text or binary
+        *
+        * @access private
+        * @return string Actual Content-Type
+        */
+       function text_or_binary()
+       {
+               if (substr($this->file->body, 0, 2) === "\xFE\xFF"
+                       || substr($this->file->body, 0, 2) === "\xFF\xFE"
+                       || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
+                       || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
+               {
+                       return 'text/plain';
+               }
+               elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
+               {
+                       return 'application/octect-stream';
+               }
+               else
+               {
+                       return 'text/plain';
+               }
+       }
+
+       /**
+        * Sniff unknown
+        *
+        * @access private
+        * @return string Actual Content-Type
+        */
+       function unknown()
+       {
+               $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
+               if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
+                       || strtolower(substr($this->file->body, $ws, 5)) === '<html'
+                       || strtolower(substr($this->file->body, $ws, 7)) === '<script')
+               {
+                       return 'text/html';
+               }
+               elseif (substr($this->file->body, 0, 5) === '%PDF-')
+               {
+                       return 'application/pdf';
+               }
+               elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
+               {
+                       return 'application/postscript';
+               }
+               elseif (substr($this->file->body, 0, 6) === 'GIF87a'
+                       || substr($this->file->body, 0, 6) === 'GIF89a')
+               {
+                       return 'image/gif';
+               }
+               elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
+               {
+                       return 'image/png';
+               }
+               elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
+               {
+                       return 'image/jpeg';
+               }
+               elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
+               {
+                       return 'image/bmp';
+               }
+               else
+               {
+                       return $this->text_or_binary();
+               }
+       }
+
+       /**
+        * Sniff images
+        *
+        * @access private
+        * @return string Actual Content-Type
+        */
+       function image()
+       {
+               if (substr($this->file->body, 0, 6) === 'GIF87a'
+                       || substr($this->file->body, 0, 6) === 'GIF89a')
+               {
+                       return 'image/gif';
+               }
+               elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
+               {
+                       return 'image/png';
+               }
+               elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
+               {
+                       return 'image/jpeg';
+               }
+               elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
+               {
+                       return 'image/bmp';
+               }
+               else
+               {
+                       return false;
+               }
+       }
+
+       /**
+        * Sniff HTML
+        *
+        * @access private
+        * @return string Actual Content-Type
+        */
+       function feed_or_html()
+       {
+               $len = strlen($this->file->body);
+               $pos = strspn($this->file->body, "\x09\x0A\x0D\x20");
+
+               while ($pos < $len)
+               {
+                       switch ($this->file->body[$pos])
+                       {
+                               case "\x09":
+                               case "\x0A":
+                               case "\x0D":
+                               case "\x20":
+                                       $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
+                                       continue 2;
+
+                               case '<':
+                                       $pos++;
+                                       break;
+
+                               default:
+                                       return 'text/html';
+                       }
+
+                       if (substr($this->file->body, $pos, 3) === '!--')
+                       {
+                               $pos += 3;
+                               if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
+                               {
+                                       $pos += 3;
+                               }
+                               else
+                               {
+                                       return 'text/html';
+                               }
+                       }
+                       elseif (substr($this->file->body, $pos, 1) === '!')
+                       {
+                               if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
+                               {
+                                       $pos++;
+                               }
+                               else
+                               {
+                                       return 'text/html';
+                               }
+                       }
+                       elseif (substr($this->file->body, $pos, 1) === '?')
+                       {
+                               if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
+                               {
+                                       $pos += 2;
+                               }
+                               else
+                               {
+                                       return 'text/html';
+                               }
+                       }
+                       elseif (substr($this->file->body, $pos, 3) === 'rss'
+                               || substr($this->file->body, $pos, 7) === 'rdf:RDF')
+                       {
+                               return 'application/rss+xml';
+                       }
+                       elseif (substr($this->file->body, $pos, 4) === 'feed')
+                       {
+                               return 'application/atom+xml';
+                       }
+                       else
+                       {
+                               return 'text/html';
+                       }
+               }
+
+               return 'text/html';
+       }
+}
+
+/**
+ * Parses the XML Declaration
+ *
+ * @package SimplePie
+ */
+class SimplePie_XML_Declaration_Parser
+{
+       /**
+        * XML Version
+        *
+        * @access public
+        * @var string
+        */
+       var $version = '1.0';
+
+       /**
+        * Encoding
+        *
+        * @access public
+        * @var string
+        */
+       var $encoding = 'UTF-8';
+
+       /**
+        * Standalone
+        *
+        * @access public
+        * @var bool
+        */
+       var $standalone = false;
+
+       /**
+        * Current state of the state machine
+        *
+        * @access private
+        * @var string
+        */
+       var $state = 'before_version_name';
+
+       /**
+        * Input data
+        *
+        * @access private
+        * @var string
+        */
+       var $data = '';
+
+       /**
+        * Input data length (to avoid calling strlen() everytime this is needed)
+        *
+        * @access private
+        * @var int
+        */
+       var $data_length = 0;
+
+       /**
+        * Current position of the pointer
+        *
+        * @var int
+        * @access private
+        */
+       var $position = 0;
+
+       /**
+        * Create an instance of the class with the input data
+        *
+        * @access public
+        * @param string $data Input data
+        */
+       function SimplePie_XML_Declaration_Parser($data)
+       {
+               $this->data = $data;
+               $this->data_length = strlen($this->data);
+       }
+
+       /**
+        * Parse the input data
+        *
+        * @access public
+        * @return bool true on success, false on failure
+        */
+       function parse()
+       {
+               while ($this->state && $this->state !== 'emit' && $this->has_data())
+               {
+                       $state = $this->state;
+                       $this->$state();
+               }
+               $this->data = '';
+               if ($this->state === 'emit')
+               {
+                       return true;
+               }
+               else
+               {
+                       $this->version = '';
+                       $this->encoding = '';
+                       $this->standalone = '';
+                       return false;
+               }
+       }
+
+       /**
+        * Check whether there is data beyond the pointer
+        *
+        * @access private
+        * @return bool true if there is further data, false if not
+        */
+       function has_data()
+       {
+               return (bool) ($this->position < $this->data_length);
+       }
+
+       /**
+        * Advance past any whitespace
+        *
+        * @return int Number of whitespace characters passed
+        */
+       function skip_whitespace()
+       {
+               $whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
+               $this->position += $whitespace;
+               return $whitespace;
+       }
+
+       /**
+        * Read value
+        */
+       function get_value()
+       {
+               $quote = substr($this->data, $this->position, 1);
+               if ($quote === '"' || $quote === "'")
+               {
+                       $this->position++;
+                       $len = strcspn($this->data, $quote, $this->position);
+                       if ($this->has_data())
+                       {
+                               $value = substr($this->data, $this->position, $len);
+                               $this->position += $len + 1;
+                               return $value;
+                       }
+               }
+               return false;
+       }
+
+       function before_version_name()
+       {
+               if ($this->skip_whitespace())
+               {
+                       $this->state = 'version_name';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function version_name()
+       {
+               if (substr($this->data, $this->position, 7) === 'version')
+               {
+                       $this->position += 7;
+                       $this->skip_whitespace();
+                       $this->state = 'version_equals';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function version_equals()
+       {
+               if (substr($this->data, $this->position, 1) === '=')
+               {
+                       $this->position++;
+                       $this->skip_whitespace();
+                       $this->state = 'version_value';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function version_value()
+       {
+               if ($this->version = $this->get_value())
+               {
+                       $this->skip_whitespace();
+                       if ($this->has_data())
+                       {
+                               $this->state = 'encoding_name';
+                       }
+                       else
+                       {
+                               $this->state = 'emit';
+                       }
+               }
+               else
+               {
+                       $this->state = 'standalone_name';
+               }
+       }
+
+       function encoding_name()
+       {
+               if (substr($this->data, $this->position, 8) === 'encoding')
+               {
+                       $this->position += 8;
+                       $this->skip_whitespace();
+                       $this->state = 'encoding_equals';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function encoding_equals()
+       {
+               if (substr($this->data, $this->position, 1) === '=')
+               {
+                       $this->position++;
+                       $this->skip_whitespace();
+                       $this->state = 'encoding_value';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function encoding_value()
+       {
+               if ($this->encoding = $this->get_value())
+               {
+                       $this->skip_whitespace();
+                       if ($this->has_data())
+                       {
+                               $this->state = 'standalone_name';
+                       }
+                       else
+                       {
+                               $this->state = 'emit';
+                       }
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function standalone_name()
+       {
+               if (substr($this->data, $this->position, 10) === 'standalone')
+               {
+                       $this->position += 10;
+                       $this->skip_whitespace();
+                       $this->state = 'standalone_equals';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function standalone_equals()
+       {
+               if (substr($this->data, $this->position, 1) === '=')
+               {
+                       $this->position++;
+                       $this->skip_whitespace();
+                       $this->state = 'standalone_value';
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+
+       function standalone_value()
+       {
+               if ($standalone = $this->get_value())
+               {
+                       switch ($standalone)
+                       {
+                               case 'yes':
+                                       $this->standalone = true;
+                                       break;
+
+                               case 'no':
+                                       $this->standalone = false;
+                                       break;
+
+                               default:
+                                       $this->state = false;
+                                       return;
+                       }
+
+                       $this->skip_whitespace();
+                       if ($this->has_data())
+                       {
+                               $this->state = false;
+                       }
+                       else
+                       {
+                               $this->state = 'emit';
+                       }
+               }
+               else
+               {
+                       $this->state = false;
+               }
+       }
+}
+
+class SimplePie_Locator
+{
+       var $useragent;
+       var $timeout;
+       var $file;
+       var $local = array();
+       var $elsewhere = array();
+       var $file_class = 'SimplePie_File';
+       var $cached_entities = array();
+       var $http_base;
+       var $base;
+       var $base_location = 0;
+       var $checked_feeds = 0;
+       var $max_checked_feeds = 10;
+       var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
+
+       function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer')
+       {
+               $this->file =& $file;
+               $this->file_class = $file_class;
+               $this->useragent = $useragent;
+               $this->timeout = $timeout;
+               $this->max_checked_feeds = $max_checked_feeds;
+               $this->content_type_sniffer_class = $content_type_sniffer_class;
+       }
+
+       function find($type = SIMPLEPIE_LOCATOR_ALL)
+       {
+               if ($this->is_feed($this->file))
+               {
+                       return $this->file;
+               }
+
+               if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
+               {
+                       $sniffer = new $this->content_type_sniffer_class($this->file);
+                       if ($sniffer->get_type() !== 'text/html')
+                       {
+                               return null;
+                       }
+               }
+
+               if ($type & ~SIMPLEPIE_LOCATOR_NONE)
+               {
+                       $this->get_base();
+               }
+
+               if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
+               {
+                       return $working;
+               }
+
+               if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
+               {
+                       if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local))
+                       {
+                               return $working;
+                       }
+
+                       if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local))
+                       {
+                               return $working;
+                       }
+
+                       if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere))
+                       {
+                               return $working;
+                       }
+
+                       if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere))
+                       {
+                               return $working;
+                       }
+               }
+               return null;
+       }
+
+       function is_feed(&$file)
+       {
+               if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
+               {
+                       $sniffer = new $this->content_type_sniffer_class($file);
+                       $sniffed = $sniffer->get_type();
+                       if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
+                       {
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+               elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
+               {
+                       return true;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+
+       function get_base()
+       {
+               $this->http_base = $this->file->url;
+               $this->base = $this->http_base;
+               $elements = SimplePie_Misc::get_element('base', $this->file->body);
+               foreach ($elements as $element)
+               {
+                       if ($element['attribs']['href']['data'] !== '')
+                       {
+                               $this->base = SimplePie_Misc::absolutize_url(trim($element['attribs']['href']['data']), $this->http_base);
+                               $this->base_location = $element['offset'];
+                               break;
+                       }
+               }
+       }
+
+       function autodiscovery()
+       {
+               $links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
+               $done = array();
+               foreach ($links as $link)
+               {
+                       if ($this->checked_feeds == $this->max_checked_feeds)
+                       {
+                               break;
+                       }
+                       if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data']))
+                       {
+                               $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
+
+                               if ($this->base_location < $link['offset'])
+                               {
+                                       $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
+                               }
+                               else
+                               {
+                                       $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
+                               }
+
+                               if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))))
+                               {
+                                       $this->checked_feeds++;
+                                       $feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
+                                       if ($this->is_feed($feed))
+                                       {
+                                               return $feed;
+                                       }
+                               }
+                               $done[] = $href;
+                       }
+               }
+               return null;
+       }
+
+       function get_links()
+       {
+               $links = SimplePie_Misc::get_element('a', $this->file->body);
+               foreach ($links as $link)
+               {
+                       if (isset($link['attribs']['href']['data']))
+                       {
+                               $href = trim($link['attribs']['href']['data']);
+                               $parsed = SimplePie_Misc::parse_url($href);
+                               if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme']))
+                               {
+                                       if ($this->base_location < $link['offset'])
+                                       {
+                                               $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
+                                       }
+                                       else
+                                       {
+                                               $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
+                                       }
+
+                                       $current = SimplePie_Misc::parse_url($this->file->url);
+
+                                       if ($parsed['authority'] === '' || $parsed['authority'] == $current['authority'])
+                                       {
+                                               $this->local[] = $href;
+                                       }
+                                       else
+                                       {
+                                               $this->elsewhere[] = $href;
+                                       }
+                               }
+                       }
+               }
+               $this->local = array_unique($this->local);
+               $this->elsewhere = array_unique($this->elsewhere);
+               if (!empty($this->local) || !empty($this->elsewhere))
+               {
+                       return true;
+               }
+               return null;
+       }
+
+       function extension(&$array)
+       {
+               foreach ($array as $key => $value)
+               {
+                       if ($this->checked_feeds == $this->max_checked_feeds)
+                       {
+                               break;
+                       }
+                       if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml')))
+                       {
+                               $this->checked_feeds++;
+                               $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
+                               if ($this->is_feed($feed))
+                               {
+                                       return $feed;
+                               }
+                               else
+                               {
+                                       unset($array[$key]);
+                               }
+                       }
+               }
+               return null;
+       }
+
+       function body(&$array)
+       {
+               foreach ($array as $key => $value)
+               {
+                       if ($this->checked_feeds == $this->max_checked_feeds)
+                       {
+                               break;
+                       }
+                       if (preg_match('/(rss|rdf|atom|xml)/i', $value))
+                       {
+                               $this->checked_feeds++;
+                               $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
+                               if ($this->is_feed($feed))
+                               {
+                                       return $feed;
+                               }
+                               else
+                               {
+                                       unset($array[$key]);
+                               }
+                       }
+               }
+               return null;
+       }
+}
+
+class SimplePie_Parser
+{
+       var $error_code;
+       var $error_string;
+       var $current_line;
+       var $current_column;
+       var $current_byte;
+       var $separator = ' ';
+       var $feed = false;
+       var $namespace = array('');
+       var $element = array('');
+       var $xml_base = array('');
+       var $xml_base_explicit = array(false);
+       var $xml_lang = array('');
+       var $data = array();
+       var $datas = array(array());
+       var $current_xhtml_construct = -1;
+       var $encoding;
+
+       function parse(&$data, $encoding)
+       {
+               // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
+               if (strtoupper($encoding) == 'US-ASCII')
+               {
+                       $this->encoding = 'UTF-8';
+               }
+               else
+               {
+                       $this->encoding = $encoding;
+               }
+
+               // Strip BOM:
+               // UTF-32 Big Endian BOM
+               if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
+               {
+                       $data = substr($data, 4);
+               }
+               // UTF-32 Little Endian BOM
+               elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
+               {
+                       $data = substr($data, 4);
+               }
+               // UTF-16 Big Endian BOM
+               elseif (substr($data, 0, 2) === "\xFE\xFF")
+               {
+                       $data = substr($data, 2);
+               }
+               // UTF-16 Little Endian BOM
+               elseif (substr($data, 0, 2) === "\xFF\xFE")
+               {
+                       $data = substr($data, 2);
+               }
+               // UTF-8 BOM
+               elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
+               {
+                       $data = substr($data, 3);
+               }
+
+               if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
+               {
+                       $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+                       if ($declaration->parse())
+                       {
+                               $data = substr($data, $pos + 2);
+                               $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
+                       }
+                       else
+                       {
+                               $this->error_string = 'SimplePie bug! Please report this!';
+                               return false;
+                       }
+               }
+
+               // Work around libxml bug
+               $data = str_replace('&lt;', '&#60;', $data);
+               $data = str_replace('&gt;', '&#62;', $data);
+               $data = str_replace('&amp;', '&#38;', $data);
+               $data = str_replace('&apos;', '&#39;', $data);
+               $data = str_replace('&quot;', '&#34;', $data);
+
+               $return = true;
+
+               // Create the parser
+               $xml = xml_parser_create_ns($this->encoding, $this->separator);
+               xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
+               xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
+               xml_set_object($xml, $this);
+               xml_set_character_data_handler($xml, 'cdata');
+               xml_set_element_handler($xml, 'tag_open', 'tag_close');
+
+               // Parse!
+               if (!xml_parse($xml, $data, true))
+               {
+                       $this->error_code = xml_get_error_code($xml);
+                       $this->error_string = xml_error_string($this->error_code);
+                       $return = false;
+               }
+               $this->current_line = xml_get_current_line_number($xml);
+               $this->current_column = xml_get_current_column_number($xml);
+               $this->current_byte = xml_get_current_byte_index($xml);
+               xml_parser_free($xml);
+               return $return;
+       }
+
+       function get_error_code()
+       {
+               return $this->error_code;
+       }
+
+       function get_error_string()
+       {
+               return $this->error_string;
+       }
+
+       function get_current_line()
+       {
+               return $this->current_line;
+       }
+
+       function get_current_column()
+       {
+               return $this->current_column;
+       }
+
+       function get_current_byte()
+       {
+               return $this->current_byte;
+       }
+
+       function get_data()
+       {
+               return $this->data;
+       }
+
+       function tag_open($parser, $tag, $attributes)
+       {
+               if ($this->feed === 0)
+               {
+                       return;
+               }
+               elseif ($this->feed == false)
+               {
+                       if (in_array($tag, array(
+                               SIMPLEPIE_NAMESPACE_ATOM_10 . $this->separator . 'feed',
+                               SIMPLEPIE_NAMESPACE_ATOM_03 . $this->separator . 'feed',
+                               'rss',
+                               SIMPLEPIE_NAMESPACE_RDF . $this->separator . 'RDF'
+                       )))
+                       {
+                                       $this->feed = 1;
+                       }
+               }
+               else
+               {
+                       $this->feed++;
+               }
+
+               list($this->namespace[], $this->element[]) = $this->split_ns($tag);
+
+               $attribs = array();
+               foreach ($attributes as $name => $value)
+               {
+                       list($attrib_namespace, $attribute) = $this->split_ns($name);
+                       $attribs[$attrib_namespace][$attribute] = $value;
+               }
+
+               if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base']))
+               {
+                       $this->xml_base[] = SimplePie_Misc::absolutize_url($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base));
+                       $this->xml_base_explicit[] = true;
+               }
+               else
+               {
+                       $this->xml_base[] = end($this->xml_base);
+                       $this->xml_base_explicit[] = end($this->xml_base_explicit);
+               }
+
+               if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang']))
+               {
+                       $this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang'];
+               }
+               else
+               {
+                       $this->xml_lang[] = end($this->xml_lang);
+               }
+
+               if ($this->current_xhtml_construct >= 0)
+               {
+                       $this->current_xhtml_construct++;
+                       if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML)
+                       {
+                               $this->data['data'] .= '<' . end($this->element);
+                               if (isset($attribs['']))
+                               {
+                                       foreach ($attribs[''] as $name => $value)
+                                       {
+                                               $this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"';
+                                       }
+                               }
+                               $this->data['data'] .= '>';
+                       }
+               }
+               else
+               {
+                       $this->datas[] =& $this->data;
+                       $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
+                       $this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
+                       if ((end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] == 'xml')
+                       || (end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] == 'xhtml'))
+                       {
+                               $this->current_xhtml_construct = 0;
+                       }
+               }
+       }
+
+       function cdata($parser, $cdata)
+       {
+               if ($this->current_xhtml_construct >= 0)
+               {
+                       $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
+               }
+               elseif ($this->feed > 1)
+               {
+                       $this->data['data'] .= $cdata;
+               }
+       }
+
+       function tag_close($parser, $tag)
+       {
+               if (!$this->feed)
+               {
+                       return;
+               }
+
+               if ($this->current_xhtml_construct >= 0)
+               {
+                       $this->current_xhtml_construct--;
+                       if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
+                       {
+                               $this->data['data'] .= '</' . end($this->element) . '>';
+                       }
+               }
+               if ($this->current_xhtml_construct == -1)
+               {
+                       $this->data =& $this->datas[$this->feed];
+                       array_pop($this->datas);
+               }
+
+               array_pop($this->element);
+               array_pop($this->namespace);
+               array_pop($this->xml_base);
+               array_pop($this->xml_base_explicit);
+               array_pop($this->xml_lang);
+               $this->feed--;
+       }
+
+       function split_ns($string)
+       {
+               static $cache = array();
+               if (!isset($cache[$string]))
+               {
+                       if ($pos = strpos($string, $this->separator))
+                       {
+                               static $separator_length;
+                               if (!$separator_length)
+                               {
+                                       $separator_length = strlen($this->separator);
+                               }
+                               $namespace = substr($string, 0, $pos);
+                               $local_name = substr($string, $pos + $separator_length);
+                               if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES)
+                               {
+                                       $namespace = SIMPLEPIE_NAMESPACE_ITUNES;
+                               }
+
+                               // Normalize the Media RSS namespaces
+                               if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG)
+                               {
+                                       $namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
+                               }
+                               $cache[$string] = array($namespace, $local_name);
+                       }
+                       else
+                       {
+                               $cache[$string] = array('', $string);
+                       }
+               }
+               return $cache[$string];
+       }
+}
+
+/**
+ * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags
+ */
+class SimplePie_Sanitize
+{
+       // Private vars
+       var $base;
+
+       // Options
+       var $remove_div = true;
+       var $image_handler = '';
+       var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
+       var $encode_instead_of_strip = false;
+       var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
+       var $strip_comments = false;
+       var $output_encoding = 'UTF-8';
+       var $enable_cache = true;
+       var $cache_location = './cache';
+       var $cache_name_function = 'md5';
+       var $cache_class = 'SimplePie_Cache';
+       var $file_class = 'SimplePie_File';
+       var $timeout = 10;
+       var $useragent = '';
+       var $force_fsockopen = false;
+
+       var $replace_url_attributes = array(
+               'a' => 'href',
+               'area' => 'href',
+               'blockquote' => 'cite',
+               'del' => 'cite',
+               'form' => 'action',
+               'img' => array('longdesc', 'src'),
+               'input' => 'src',
+               'ins' => 'cite',
+               'q' => 'cite'
+       );
+
+       function remove_div($enable = true)
+       {
+               $this->remove_div = (bool) $enable;
+       }
+
+       function set_image_handler($page = false)
+       {
+               if ($page)
+               {
+                       $this->image_handler = (string) $page;
+               }
+               else
+               {
+                       $this->image_handler = false;
+               }
+       }
+
+       function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache')
+       {
+               if (isset($enable_cache))
+               {
+                       $this->enable_cache = (bool) $enable_cache;
+               }
+
+               if ($cache_location)
+               {
+                       $this->cache_location = (string) $cache_location;
+               }
+
+               if ($cache_name_function)
+               {
+                       $this->cache_name_function = (string) $cache_name_function;
+               }
+
+               if ($cache_class)
+               {
+                       $this->cache_class = (string) $cache_class;
+               }
+       }
+
+       function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false)
+       {
+               if ($file_class)
+               {
+                       $this->file_class = (string) $file_class;
+               }
+
+               if ($timeout)
+               {
+                       $this->timeout = (string) $timeout;
+               }
+
+               if ($useragent)
+               {
+                       $this->useragent = (string) $useragent;
+               }
+
+               if ($force_fsockopen)
+               {
+                       $this->force_fsockopen = (string) $force_fsockopen;
+               }
+       }
+
+       function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'))
+       {
+               if ($tags)
+               {
+                       if (is_array($tags))
+                       {
+                               $this->strip_htmltags = $tags;
+                       }
+                       else
+                       {
+                               $this->strip_htmltags = explode(',', $tags);
+                       }
+               }
+               else
+               {
+                       $this->strip_htmltags = false;
+               }
+       }
+
+       function encode_instead_of_strip($encode = false)
+       {
+               $this->encode_instead_of_strip = (bool) $encode;
+       }
+
+       function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'))
+       {
+               if ($attribs)
+               {
+                       if (is_array($attribs))
+                       {
+                               $this->strip_attributes = $attribs;
+                       }
+                       else
+                       {
+                               $this->strip_attributes = explode(',', $attribs);
+                       }
+               }
+               else
+               {
+                       $this->strip_attributes = false;
+               }
+       }
+
+       function strip_comments($strip = false)
+       {
+               $this->strip_comments = (bool) $strip;
+       }
+
+       function set_output_encoding($encoding = 'UTF-8')
+       {
+               $this->output_encoding = (string) $encoding;
+       }
+
+       /**
+        * Set element/attribute key/value pairs of HTML attributes
+        * containing URLs that need to be resolved relative to the feed
+        *
+        * @access public
+        * @since 1.0
+        * @param array $element_attribute Element/attribute key/value pairs
+        */
+       function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite'))
+       {
+               $this->replace_url_attributes = (array) $element_attribute;
+       }
+
+       function sanitize($data, $type, $base = '')
+       {
+               $data = trim($data);
+               if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI)
+               {
+                       if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
+                       {
+                               if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
+                               {
+                                       $type |= SIMPLEPIE_CONSTRUCT_HTML;
+                               }
+                               else
+                               {
+                                       $type |= SIMPLEPIE_CONSTRUCT_TEXT;
+                               }
+                       }
+
+                       if ($type & SIMPLEPIE_CONSTRUCT_BASE64)
+                       {
+                               $data = base64_decode($data);
+                       }
+
+                       if ($type & SIMPLEPIE_CONSTRUCT_XHTML)
+                       {
+                               if ($this->remove_div)
+                               {
+                                       $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
+                                       $data = preg_replace('/<\/div>$/', '', $data);
+                               }
+                               else
+                               {
+                                       $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
+                               }
+                       }
+
+                       if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML))
+                       {
+                               // Strip comments
+                               if ($this->strip_comments)
+                               {
+                                       $data = SimplePie_Misc::strip_comments($data);
+                               }
+
+                               // Strip out HTML tags and attributes that might cause various security problems.
+                               // Based on recommendations by Mark Pilgrim at:
+                               // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely
+                               if ($this->strip_htmltags)
+                               {
+                                       foreach ($this->strip_htmltags as $tag)
+                                       {
+                                               $pcre = "/<($tag)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$tag" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>|(\/)?>)/siU';
+                                               while (preg_match($pcre, $data))
+                                               {
+                                                       $data = preg_replace_callback($pcre, array(&$this, 'do_strip_htmltags'), $data);
+                                               }
+                                       }
+                               }
+
+                               if ($this->strip_attributes)
+                               {
+                                       foreach ($this->strip_attributes as $attrib)
+                                       {
+                                               $data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) . '(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>/', '\1\2\3>', $data);
+                                       }
+                               }
+
+                               // Replace relative URLs
+                               $this->base = $base;
+                               foreach ($this->replace_url_attributes as $element => $attributes)
+                               {
+                                       $data = $this->replace_urls($data, $element, $attributes);
+                               }
+
+                               // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags.
+                               if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache)
+                               {
+                                       $images = SimplePie_Misc::get_element('img', $data);
+                                       foreach ($images as $img)
+                                       {
+                                               if (isset($img['attribs']['src']['data']))
+                                               {
+                                                       $image_url = call_user_func($this->cache_name_function, $img['attribs']['src']['data']);
+                                                       $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $image_url, 'spi');
+
+                                                       if ($cache->load())
+                                                       {
+                                                               $img['attribs']['src']['data'] = $this->image_handler . $image_url;
+                                                               $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
+                                                       }
+                                                       else
+                                                       {
+                                                               $file =& new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
+                                                               $headers = $file->headers;
+
+                                                               if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)))
+                                                               {
+                                                                       if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
+                                                                       {
+                                                                               $img['attribs']['src']['data'] = $this->image_handler . $image_url;
+                                                                               $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               trigger_error("$cache->name is not writeable", E_USER_WARNING);
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               // Having (possibly) taken stuff out, there may now be whitespace at the beginning/end of the data
+                               $data = trim($data);
+                       }
+
+                       if ($type & SIMPLEPIE_CONSTRUCT_IRI)
+                       {
+                               $data = SimplePie_Misc::absolutize_url($data, $base);
+                       }
+
+                       if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
+                       {
+                               $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
+                       }
+
+                       if ($this->output_encoding != 'UTF-8')
+                       {
+                               $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding);
+                       }
+               }
+               return $data;
+       }
+
+       function replace_urls($data, $tag, $attributes)
+       {
+               if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags))
+               {
+                       $elements = SimplePie_Misc::get_element($tag, $data);
+                       foreach ($elements as $element)
+                       {
+                               if (is_array($attributes))
+                               {
+                                       foreach ($attributes as $attribute)
+                                       {
+                                               if (isset($element['attribs'][$attribute]['data']))
+                                               {
+                                                       $element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base);
+                                                       $new_element = SimplePie_Misc::element_implode($element);
+                                                       $data = str_replace($element['full'], $new_element, $data);
+                                                       $element['full'] = $new_element;
+                                               }
+                                       }
+                               }
+                               elseif (isset($element['attribs'][$attributes]['data']))
+                               {
+                                       $element['attribs'][$attributes]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attributes]['data'], $this->base);
+                                       $data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data);
+                               }
+                       }
+               }
+               return $data;
+       }
+
+       function do_strip_htmltags($match)
+       {
+               if ($this->encode_instead_of_strip)
+               {
+                       if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
+                       {
+                               $match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8');
+                               $match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8');
+                               return "&lt;$match[1]$match[2]&gt;$match[3]&lt;/$match[1]&gt;";
+                       }
+                       else
+                       {
+                               return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8');
+                       }
+               }
+               elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
+               {
+                       return $match[4];
+               }
+               else
+               {
+                       return '';
+               }
+       }
+}
+
+?>
\ No newline at end of file
index 048bd0f7c0e0a11197abecb1d575b8464877420c..250153c172e55ccfa7e0f2ea2ae77ea8bf93d05a 100644 (file)
@@ -2,7 +2,7 @@
 /*~ class.smtp.php
 .---------------------------------------------------------------------------.
 |  Software: PHPMailer - PHP email class                                    |
 /*~ class.smtp.php
 .---------------------------------------------------------------------------.
 |  Software: PHPMailer - PHP email class                                    |
-|   Version: 2.0.2                                                          |
+|   Version: 2.0.4                                                          |
 |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
 |      Info: http://phpmailer.sourceforge.net                               |
 |   Support: http://sourceforge.net/projects/phpmailer/                     |
 |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
 |      Info: http://phpmailer.sourceforge.net                               |
 |   Support: http://sourceforge.net/projects/phpmailer/                     |
index e4c9c450b6711c29a1ca3bbb51db09f7cdd109ea..af3808b8c7e05ae9c25211f02ebac35b7ead684b 100644 (file)
@@ -22,6 +22,8 @@ class WP_Dependencies {
        var $to_do = array();
        var $done = array();
        var $args = array();
        var $to_do = array();
        var $done = array();
        var $args = array();
+       var $groups = array();
+       var $group = 0;
 
        function WP_Dependencies() {
                $args = func_get_args();
 
        function WP_Dependencies() {
                $args = func_get_args();
@@ -38,21 +40,26 @@ class WP_Dependencies {
         * @param mixed handles (optional) items to be processed.  (void) processes queue, (string) process that item, (array of strings) process those items
         * @return array Items that have been processed
         */
         * @param mixed handles (optional) items to be processed.  (void) processes queue, (string) process that item, (array of strings) process those items
         * @return array Items that have been processed
         */
-       function do_items( $handles = false ) {
+       function do_items( $handles = false, $group = false ) {
                // Print the queue if nothing is passed.  If a string is passed, print that script.  If an array is passed, print those scripts.
                $handles = false === $handles ? $this->queue : (array) $handles;
                $this->all_deps( $handles );
 
                // Print the queue if nothing is passed.  If a string is passed, print that script.  If an array is passed, print those scripts.
                $handles = false === $handles ? $this->queue : (array) $handles;
                $this->all_deps( $handles );
 
-               foreach( $this->to_do as $handle ) {
+               foreach( $this->to_do as $key => $handle ) {
                        if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) {
                        if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) {
-                               if ( $this->registered[$handle]->src ) { // Else it defines a group.
-                                       $this->do_item( $handle );
+
+                               if ( ! $this->registered[$handle]->src ) { // Defines a group.
+                                       $this->done[] = $handle;
+                                       continue;
                                }
                                }
-                               $this->done[] = $handle;
+
+                               if ( $this->do_item( $handle, $group ) )
+                                       $this->done[] = $handle;
+
+                               unset( $this->to_do[$key] );
                        }
                }
 
                        }
                }
 
-               $this->to_do = array();
                return $this->done;
        }
 
                return $this->done;
        }
 
@@ -69,17 +76,21 @@ class WP_Dependencies {
         * @param mixed handles Accepts (string) dep name or (array of strings) dep names
         * @param bool recursion Used internally when function calls itself
         */
         * @param mixed handles Accepts (string) dep name or (array of strings) dep names
         * @param bool recursion Used internally when function calls itself
         */
-       function all_deps( $handles, $recursion = false ) {
+       function all_deps( $handles, $recursion = false, $group = false ) {
                if ( !$handles = (array) $handles )
                        return false;
 
                foreach ( $handles as $handle ) {
                if ( !$handles = (array) $handles )
                        return false;
 
                foreach ( $handles as $handle ) {
-                       $handle = explode('?', $handle);
-                       if ( isset($handle[1]) )
-                               $this->args[$handle[0]] = $handle[1];
-                       $handle = $handle[0];
+                       $handle_parts = explode('?', $handle);
+                       $handle = $handle_parts[0];
+                       $queued = in_array($handle, $this->to_do, true);
 
 
-                       if ( isset($this->to_do[$handle]) ) // Already grobbed it and its deps
+                       if ( in_array($handle, $this->done, true) ) // Already done
+                               continue;
+
+                       $moved = $this->set_group( $handle, $recursion, $group );
+
+                       if ( $queued && !$moved ) // already queued and in the right group
                                continue;
 
                        $keep_going = true;
                                continue;
 
                        $keep_going = true;
@@ -87,7 +98,7 @@ class WP_Dependencies {
                                $keep_going = false; // Script doesn't exist
                        elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
                                $keep_going = false; // Script requires deps which don't exist (not a necessary check.  efficiency?)
                                $keep_going = false; // Script doesn't exist
                        elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
                                $keep_going = false; // Script requires deps which don't exist (not a necessary check.  efficiency?)
-                       elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true ) )
+                       elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $group ) )
                                $keep_going = false; // Script requires deps which don't exist
 
                        if ( !$keep_going ) { // Either script or its deps don't exist.
                                $keep_going = false; // Script requires deps which don't exist
 
                        if ( !$keep_going ) { // Either script or its deps don't exist.
@@ -97,11 +108,15 @@ class WP_Dependencies {
                                        continue; // We're at the top level.  Move on to the next one.
                        }
 
                                        continue; // We're at the top level.  Move on to the next one.
                        }
 
-                       $this->to_do[$handle] = true;
+                       if ( $queued ) // Already grobbed it and its deps
+                               continue;
+
+                       if ( isset($handle_parts[1]) )
+                               $this->args[$handle] = $handle_parts[1];
+
+                       $this->to_do[] = $handle;
                }
 
                }
 
-               if ( !$recursion ) // at the end
-                       $this->to_do = array_keys( $this->to_do );
                return true;
        }
 
                return true;
        }
 
@@ -181,6 +196,21 @@ class WP_Dependencies {
                return false;
        }
 
                return false;
        }
 
+       function set_group( $handle, $recursion, $group ) {
+               $group = (int) $group;
+
+               if ( $recursion )
+                       $group = min($this->group, $group);
+               else
+                       $this->group = $group;
+
+               if ( isset($this->groups[$handle]) && $this->groups[$handle] <= $group )
+                       return false;
+
+               $this->groups[$handle] = $group;
+               return true;
+       }
+
 }
 
 class _WP_Dependency {
 }
 
 class _WP_Dependency {
index 9b098aba1f9c38b2ee29a08c2c8a69250c7cb3ea..9fa96e9d020d5d22e3cb9039cecd9eeab7feaa84 100644 (file)
  */
 class WP_Scripts extends WP_Dependencies {
        var $base_url; // Full URL with trailing slash
  */
 class WP_Scripts extends WP_Dependencies {
        var $base_url; // Full URL with trailing slash
+       var $content_url;
        var $default_version;
        var $default_version;
+       var $in_footer = array();
+       var $concat = '';
+       var $concat_version = '';
+       var $do_concat = false;
+       var $print_html = '';
+       var $print_code = '';
+       var $ext_handles = '';
+       var $ext_version = '';
+       var $default_dirs;
 
        function __construct() {
                do_action_ref_array( 'wp_default_scripts', array(&$this) );
 
        function __construct() {
                do_action_ref_array( 'wp_default_scripts', array(&$this) );
@@ -30,57 +40,87 @@ class WP_Scripts extends WP_Dependencies {
         * Prints the scripts passed to it or the print queue.  Also prints all necessary dependencies.
         *
         * @param mixed handles (optional) Scripts to be printed.  (void) prints queue, (string) prints that script, (array of strings) prints those scripts.
         * Prints the scripts passed to it or the print queue.  Also prints all necessary dependencies.
         *
         * @param mixed handles (optional) Scripts to be printed.  (void) prints queue, (string) prints that script, (array of strings) prints those scripts.
+        * @param int group (optional) If scripts were queued in groups prints this group number.
         * @return array Scripts that have been printed
         */
         * @return array Scripts that have been printed
         */
-       function print_scripts( $handles = false ) {
-               return $this->do_items( $handles );
+       function print_scripts( $handles = false, $group = false ) {
+               return $this->do_items( $handles, $group );
        }
 
        }
 
-       function print_scripts_l10n( $handle ) {
+       function print_scripts_l10n( $handle, $echo = true ) {
                if ( empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1]) )
                        return false;
 
                $object_name = $this->registered[$handle]->extra['l10n'][0];
 
                if ( empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1]) )
                        return false;
 
                $object_name = $this->registered[$handle]->extra['l10n'][0];
 
-               echo "<script type='text/javascript'>\n";
-               echo "/* <![CDATA[ */\n";
-               echo "\t$object_name = {\n";
+               $data = "var $object_name = {\n";
                $eol = '';
                foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) {
                        if ( 'l10n_print_after' == $var ) {
                                $after = $val;
                                continue;
                        }
                $eol = '';
                foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) {
                        if ( 'l10n_print_after' == $var ) {
                                $after = $val;
                                continue;
                        }
-                       echo "$eol\t\t$var: \"" . js_escape( $val ) . '"';
+                       $data .= "$eol\t$var: \"" . esc_js( $val ) . '"';
                        $eol = ",\n";
                }
                        $eol = ",\n";
                }
-               echo "\n\t}\n";
-               echo isset($after) ? "\t$after\n" : '';
-               echo "/* ]]> */\n";
-               echo "</script>\n";
-
-               return true;
+               $data .= "\n};\n";
+               $data .= isset($after) ? "$after\n" : '';
+
+               if ( $echo ) {
+                       echo "<script type='text/javascript'>\n";
+                       echo "/* <![CDATA[ */\n";
+                       echo $data;
+                       echo "/* ]]> */\n";
+                       echo "</script>\n";
+                       return true;
+               } else {
+                       return $data;
+               }
        }
 
        }
 
-       function do_item( $handle ) {
+       function do_item( $handle, $group = false ) {
                if ( !parent::do_item($handle) )
                        return false;
 
                if ( !parent::do_item($handle) )
                        return false;
 
+               if ( 0 === $group && $this->groups[$handle] > 0 ) {
+                       $this->in_footer[] = $handle;
+                       return false;
+               }
+
+               if ( false === $group && in_array($handle, $this->in_footer, true) )
+                       $this->in_footer = array_diff( $this->in_footer, (array) $handle );
+
                $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
                if ( isset($this->args[$handle]) )
                        $ver .= '&amp;' . $this->args[$handle];
 
                $src = $this->registered[$handle]->src;
                $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
                if ( isset($this->args[$handle]) )
                        $ver .= '&amp;' . $this->args[$handle];
 
                $src = $this->registered[$handle]->src;
-               if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
+
+               if ( $this->do_concat ) {
+                       $srce = apply_filters( 'script_loader_src', $src, $handle );
+                       if ( $this->in_default_dir($srce) ) {
+                               $this->print_code .= $this->print_scripts_l10n( $handle, false );
+                               $this->concat .= "$handle,";
+                               $this->concat_version .= "$handle$ver";
+                               return true;
+                       } else {
+                               $this->ext_handles .= "$handle,";
+                               $this->ext_version .= "$handle$ver";
+                       }
+               }
+
+               $this->print_scripts_l10n( $handle );
+               if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
                        $src = $this->base_url . $src;
                }
 
                $src = add_query_arg('ver', $ver, $src);
                        $src = $this->base_url . $src;
                }
 
                $src = add_query_arg('ver', $ver, $src);
-               $src = clean_url(apply_filters( 'script_loader_src', $src, $handle ));
+               $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
 
 
-               $this->print_scripts_l10n( $handle );
-
-               echo "<script type='text/javascript' src='$src'></script>\n";
+               if ( $this->do_concat )
+                       $this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
+               else
+                       echo "<script type='text/javascript' src='$src'></script>\n";
 
                return true;
        }
 
                return true;
        }
@@ -101,10 +141,57 @@ class WP_Scripts extends WP_Dependencies {
                return $this->add_data( $handle, 'l10n', array( $object_name, $l10n ) );
        }
 
                return $this->add_data( $handle, 'l10n', array( $object_name, $l10n ) );
        }
 
-       function all_deps( $handles, $recursion = false ) {
+       function set_group( $handle, $recursion, $group = false ) {
+               $grp = isset($this->registered[$handle]->extra['group']) ? (int) $this->registered[$handle]->extra['group'] : 0;
+               if ( false !== $group && $grp > $group )
+                       $grp = $group;
+
+               return parent::set_group( $handle, $recursion, $grp );
+       }
+
+       function all_deps( $handles, $recursion = false, $group = false ) {
                $r = parent::all_deps( $handles, $recursion );
                if ( !$recursion )
                        $this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
                return $r;
        }
                $r = parent::all_deps( $handles, $recursion );
                if ( !$recursion )
                        $this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
                return $r;
        }
+
+       function do_head_items() {
+               $this->do_items(false, 0);
+               return $this->done;
+       }
+
+       function do_footer_items() {
+               if ( !empty($this->in_footer) ) {
+                       foreach( $this->in_footer as $key => $handle ) {
+                               if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
+                                       $this->do_item($handle);
+                                       $this->done[] = $handle;
+                                       unset( $this->in_footer[$key] );
+                               }
+                       }
+               }
+               return $this->done;
+       }
+
+       function in_default_dir($src) {
+               if ( ! $this->default_dirs )
+                       return true;
+
+               foreach ( (array) $this->default_dirs as $test ) {
+                       if ( 0 === strpos($src, $test) )
+                               return true;
+               }
+               return false;
+       }
+
+       function reset() {
+               $this->do_concat = false;
+               $this->print_code = '';
+               $this->concat = '';
+               $this->concat_version = '';
+               $this->print_html = '';
+               $this->ext_version = '';
+               $this->ext_handles = '';
+       }
 }
 }
index 3caf63971ec06630c6434a739b958f2207511693..731ae39cf47a6fcd6ecc9edffb16fee0739a185a 100644 (file)
  */
 class WP_Styles extends WP_Dependencies {
        var $base_url;
  */
 class WP_Styles extends WP_Dependencies {
        var $base_url;
+       var $content_url;
        var $default_version;
        var $text_direction = 'ltr';
        var $default_version;
        var $text_direction = 'ltr';
+       var $concat = '';
+       var $concat_version = '';
+       var $do_concat = false;
+       var $print_html = '';
+       var $default_dirs;
 
        function __construct() {
                do_action_ref_array( 'wp_default_styles', array(&$this) );
 
        function __construct() {
                do_action_ref_array( 'wp_default_styles', array(&$this) );
@@ -33,30 +39,45 @@ class WP_Styles extends WP_Dependencies {
                if ( isset($this->args[$handle]) )
                        $ver .= '&amp;' . $this->args[$handle];
 
                if ( isset($this->args[$handle]) )
                        $ver .= '&amp;' . $this->args[$handle];
 
+               if ( $this->do_concat ) {
+                       if ( $this->in_default_dir($this->registered[$handle]->src) && !isset($this->registered[$handle]->extra['conditional']) && !isset($this->registered[$handle]->extra['alt']) ) {
+                               $this->concat .= "$handle,";
+                               $this->concat_version .= "$handle$ver";
+                               return true;
+                       }
+               }
+
                if ( isset($this->registered[$handle]->args) )
                if ( isset($this->registered[$handle]->args) )
-                       $media = attribute_escape( $this->registered[$handle]->args );
+                       $media = esc_attr( $this->registered[$handle]->args );
                else
                        $media = 'all';
 
                $href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle );
                else
                        $media = 'all';
 
                $href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle );
+               $rel = isset($this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
+               $title = isset($this->registered[$handle]->extra['title']) ? "title='" . esc_attr( $this->registered[$handle]->extra['title'] ) . "'" : '';
 
 
-               $end_cond = '';
+               $end_cond = $tag = '';
                if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {
                if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {
-                       echo "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n";
+                       $tag .= "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n";
                        $end_cond = "<![endif]-->\n";
                }
 
                        $end_cond = "<![endif]-->\n";
                }
 
-               echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' href='$href' type='text/css' media='$media' />\n", $handle );
+               $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
                if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) {
                        if ( is_bool( $this->registered[$handle]->extra['rtl'] ) )
                if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) {
                        if ( is_bool( $this->registered[$handle]->extra['rtl'] ) )
-                               $rtl_href = str_replace( '.css', '-rtl.css', $href );
+                               $rtl_href = str_replace( '.css', '-rtl.css', $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" ));
                        else
                                $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );
 
                        else
                                $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );
 
-                       echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' href='$rtl_href' type='text/css' media='$media' />\n", $handle );
+                       $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );
                }
 
                }
 
-               echo $end_cond;
+               $tag .= $end_cond;
+
+               if ( $this->do_concat )
+                       $this->print_html .= $tag;
+               else
+                       echo $tag;
 
                // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules
 //             echo "<style type='text/css'>\n";
 
                // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules
 //             echo "<style type='text/css'>\n";
@@ -67,7 +88,7 @@ class WP_Styles extends WP_Dependencies {
                return true;
        }
 
                return true;
        }
 
-       function all_deps( $handles, $recursion = false ) {
+       function all_deps( $handles, $recursion = false, $group = false ) {
                $r = parent::all_deps( $handles, $recursion );
                if ( !$recursion )
                        $this->to_do = apply_filters( 'print_styles_array', $this->to_do );
                $r = parent::all_deps( $handles, $recursion );
                if ( !$recursion )
                        $this->to_do = apply_filters( 'print_styles_array', $this->to_do );
@@ -75,13 +96,24 @@ class WP_Styles extends WP_Dependencies {
        }
 
        function _css_href( $src, $ver, $handle ) {
        }
 
        function _css_href( $src, $ver, $handle ) {
-               if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
+               if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
                        $src = $this->base_url . $src;
                }
 
                $src = add_query_arg('ver', $ver, $src);
                $src = apply_filters( 'style_loader_src', $src, $handle );
                        $src = $this->base_url . $src;
                }
 
                $src = add_query_arg('ver', $ver, $src);
                $src = apply_filters( 'style_loader_src', $src, $handle );
-               return clean_url( $src );
+               return esc_url( $src );
+       }
+
+       function in_default_dir($src) {
+               if ( ! $this->default_dirs )
+                       return true;
+
+               foreach ( (array) $this->default_dirs as $test ) {
+                       if ( 0 === strpos($src, $test) )
+                               return true;
+               }
+               return false;
        }
 
 }
        }
 
 }
index 4bcd9fe8f63ed140fe3d8f7ab6dd02a42753d4d7..29c37535a7cd6e2142932e59f927885ca3bcd425 100644 (file)
@@ -36,7 +36,7 @@ class WP {
         * @since 2.0.0
         * @var array
         */
         * @since 2.0.0
         * @var array
         */
-       var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page');
+       var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page');
 
        /**
         * Extra query variables set by the user.
 
        /**
         * Extra query variables set by the user.
@@ -207,8 +207,8 @@ class WP {
                                        $request_match = $req_uri . '/' . $request;
                                }
 
                                        $request_match = $req_uri . '/' . $request;
                                }
 
-                               if (preg_match("!^$match!", $request_match, $matches) ||
-                                       preg_match("!^$match!", urldecode($request_match), $matches)) {
+                               if (preg_match("#^$match#", $request_match, $matches) ||
+                                       preg_match("#^$match#", urldecode($request_match), $matches)) {
                                        // Got a match.
                                        $this->matched_rule = $match;
 
                                        // Got a match.
                                        $this->matched_rule = $match;
 
@@ -253,7 +253,7 @@ class WP {
                $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
 
                foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
                $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
 
                foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
-                       if ( isset($t->query_var) )
+                       if ( $t->query_var )
                                $taxonomy_query_vars[$t->query_var] = $taxonomy;
 
                for ($i=0; $i<count($this->public_query_vars); $i += 1) {
                                $taxonomy_query_vars[$t->query_var] = $taxonomy;
 
                for ($i=0; $i<count($this->public_query_vars); $i += 1) {
@@ -302,16 +302,19 @@ class WP {
         * @since 2.0.0
         */
        function send_headers() {
         * @since 2.0.0
         */
        function send_headers() {
-               @header('X-Pingback: '. get_bloginfo('pingback_url'));
+               $headers = array('X-Pingback' => get_bloginfo('pingback_url'));
+               $status = null;
+               $exit_required = false;
+
                if ( is_user_logged_in() )
                if ( is_user_logged_in() )
-                       nocache_headers();
+                       $headers = array_merge($headers, wp_get_nocache_headers());
                if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
                if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
-                       status_header( 404 );
+                       $status = 404;
                        if ( !is_user_logged_in() )
                        if ( !is_user_logged_in() )
-                               nocache_headers();
-                       @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+                               $headers = array_merge($headers, wp_get_nocache_headers());
+                       $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
                } else if ( empty($this->query_vars['feed']) ) {
                } else if ( empty($this->query_vars['feed']) ) {
-                       @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+                       $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
                } else {
                        // We're showing a feed, so WP is indeed the only thing that last changed
                        if ( !empty($this->query_vars['withcomments'])
                } else {
                        // We're showing a feed, so WP is indeed the only thing that last changed
                        if ( !empty($this->query_vars['withcomments'])
@@ -329,8 +332,8 @@ class WP {
                        else
                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
                        $wp_etag = '"' . md5($wp_last_modified) . '"';
                        else
                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
                        $wp_etag = '"' . md5($wp_last_modified) . '"';
-                       @header("Last-Modified: $wp_last_modified");
-                       @header("ETag: $wp_etag");
+                       $headers['Last-Modified'] = $wp_last_modified;
+                       $headers['ETag'] = $wp_etag;
 
                        // Support for Conditional GET
                        if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
 
                        // Support for Conditional GET
                        if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
@@ -347,11 +350,21 @@ class WP {
                        if ( ($client_last_modified && $client_etag) ?
                                         (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
                                         (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
                        if ( ($client_last_modified && $client_etag) ?
                                         (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
                                         (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
-                               status_header( 304 );
-                               exit;
+                               $status = 304;
+                               $exit_required = true;
                        }
                }
 
                        }
                }
 
+               $headers = apply_filters('wp_headers', $headers, $this);
+
+               if ( ! empty( $status ) )
+                       status_header( $status );
+               foreach( (array) $headers as $name => $field_value )
+                       @header("{$name}: {$field_value}");
+
+               if ($exit_required)
+                       exit();
+
                do_action_ref_array('send_headers', array(&$this));
        }
 
                do_action_ref_array('send_headers', array(&$this));
        }
 
@@ -401,10 +414,10 @@ class WP {
                        $GLOBALS[$key] = $value;
                }
 
                        $GLOBALS[$key] = $value;
                }
 
-               $GLOBALS['query_string'] = $this->query_string;
+               $GLOBALS['query_string'] = $this->query_string;
                $GLOBALS['posts'] = & $wp_query->posts;
                $GLOBALS['posts'] = & $wp_query->posts;
-               $GLOBALS['post'] = $wp_query->post;
-               $GLOBALS['request'] = $wp_query->request;
+               $GLOBALS['post'] = $wp_query->post;
+               $GLOBALS['request'] = $wp_query->request;
 
                if ( is_single() || is_page() ) {
                        $GLOBALS['more'] = 1;
 
                if ( is_single() || is_page() ) {
                        $GLOBALS['more'] = 1;
@@ -1159,20 +1172,22 @@ class Walker_Page extends Walker {
                        $indent = '';
 
                extract($args, EXTR_SKIP);
                        $indent = '';
 
                extract($args, EXTR_SKIP);
-               $css_class = 'page_item page-item-'.$page->ID;
+               $css_class = array('page_item', 'page-item-'.$page->ID);
                if ( !empty($current_page) ) {
                        $_current_page = get_page( $current_page );
                        if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
                if ( !empty($current_page) ) {
                        $_current_page = get_page( $current_page );
                        if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
-                               $css_class .= ' current_page_ancestor';
+                               $css_class[] = 'current_page_ancestor';
                        if ( $page->ID == $current_page )
                        if ( $page->ID == $current_page )
-                               $css_class .= ' current_page_item';
+                               $css_class[] = 'current_page_item';
                        elseif ( $_current_page && $page->ID == $_current_page->post_parent )
                        elseif ( $_current_page && $page->ID == $_current_page->post_parent )
-                               $css_class .= ' current_page_parent';
+                               $css_class[] = 'current_page_parent';
                } elseif ( $page->ID == get_option('page_for_posts') ) {
                } elseif ( $page->ID == get_option('page_for_posts') ) {
-                       $css_class .= ' current_page_parent';
+                       $css_class[] = 'current_page_parent';
                }
 
                }
 
-               $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
+               $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
+
+               $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . esc_attr(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
 
                if ( !empty($show_date) ) {
                        if ( 'modified' == $show_date )
 
                if ( !empty($show_date) ) {
                        if ( 'modified' == $show_date )
@@ -1237,7 +1252,7 @@ class Walker_PageDropdown extends Walker {
                if ( $page->ID == $args['selected'] )
                        $output .= ' selected="selected"';
                $output .= '>';
                if ( $page->ID == $args['selected'] )
                        $output .= ' selected="selected"';
                $output .= '>';
-               $title = wp_specialchars($page->post_title);
+               $title = esc_html($page->post_title);
                $output .= "$pad$title";
                $output .= "</option>\n";
        }
                $output .= "$pad$title";
                $output .= "</option>\n";
        }
@@ -1310,13 +1325,13 @@ class Walker_Category extends Walker {
        function start_el(&$output, $category, $depth, $args) {
                extract($args);
 
        function start_el(&$output, $category, $depth, $args) {
                extract($args);
 
-               $cat_name = attribute_escape( $category->name);
+               $cat_name = esc_attr( $category->name);
                $cat_name = apply_filters( 'list_cats', $cat_name, $category );
                $link = '<a href="' . get_category_link( $category->term_id ) . '" ';
                if ( $use_desc_for_title == 0 || empty($category->description) )
                        $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
                else
                $cat_name = apply_filters( 'list_cats', $cat_name, $category );
                $link = '<a href="' . get_category_link( $category->term_id ) . '" ';
                if ( $use_desc_for_title == 0 || empty($category->description) )
                        $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
                else
-                       $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->description, $category )) . '"';
+                       $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
                $link .= '>';
                $link .= $cat_name . '</a>';
 
                $link .= '>';
                $link .= $cat_name . '</a>';
 
index a4a126bc4f647e0f4dc5cc927801b137699b6db8..2b6b60ac9744b9a99dd64af4de5df67fd03b8846 100644 (file)
@@ -193,7 +193,8 @@ function comment_author_IP() {
  */
 function get_comment_author_url() {
        global $comment;
  */
 function get_comment_author_url() {
        global $comment;
-       return apply_filters('get_comment_author_url', $comment->comment_author_url);
+       $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
+       return apply_filters('get_comment_author_url', $url);
 }
 
 /**
 }
 
 /**
@@ -292,7 +293,8 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
        // If the comment author has an id (registered), then print the log in name
        if ( $comment->user_id > 0 && $user = get_userdata($comment->user_id) ) {
                // For all registered users, 'byuser'
        // If the comment author has an id (registered), then print the log in name
        if ( $comment->user_id > 0 && $user = get_userdata($comment->user_id) ) {
                // For all registered users, 'byuser'
-               $classes[] = 'byuser comment-author-' . $user->user_nicename;
+               $classes[] = 'byuser';
+               $classes[] = 'comment-author-' . sanitize_html_class($user->user_nicename, $comment->user_id);
                // For comment authors who are the author of the post
                if ( $post = get_post($post_id) ) {
                        if ( $comment->user_id === $post->post_author )
                // For comment authors who are the author of the post
                if ( $post = get_post($post_id) ) {
                        if ( $comment->user_id === $post->post_author )
@@ -351,7 +353,7 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
 function get_comment_date( $d = '' ) {
        global $comment;
        if ( '' == $d )
 function get_comment_date( $d = '' ) {
        global $comment;
        if ( '' == $d )
-               $date = mysql2date( get_option('date_format'), $comment->comment_date);
+               $date = mysql2date(get_option('date_format'), $comment->comment_date);
        else
                $date = mysql2date($d, $comment->comment_date);
        return apply_filters('get_comment_date', $date, $d);
        else
                $date = mysql2date($d, $comment->comment_date);
        return apply_filters('get_comment_date', $date, $d);
@@ -442,7 +444,7 @@ function comment_ID() {
  *
  * @param object|string|int $comment Comment to retrieve.
  * @param array $args Optional args.
  *
  * @param object|string|int $comment Comment to retrieve.
  * @param array $args Optional args.
- * @return string The permalink to the current comment
+ * @return string The permalink to the given comment.
  */
 function get_comment_link( $comment = null, $args = array() ) {
        global $wp_rewrite, $in_comment_loop;
  */
 function get_comment_link( $comment = null, $args = array() ) {
        global $wp_rewrite, $in_comment_loop;
@@ -472,12 +474,14 @@ function get_comment_link( $comment = null, $args = array() ) {
                        $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args );
 
                if ( $wp_rewrite->using_permalinks() )
                        $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args );
 
                if ( $wp_rewrite->using_permalinks() )
-                       return user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' ) . '#comment-' . $comment->comment_ID;
+                       $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' );
                else
                else
-                       return add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ) . '#comment-' . $comment->comment_ID;
+                       $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) );
        } else {
        } else {
-               return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
+               $link = get_permalink( $comment->comment_post_ID );
        }
        }
+
+       return apply_filters( 'get_comment_link', $link . '#comment-' . $comment->comment_ID, $comment, $args );
 }
 
 /**
 }
 
 /**
@@ -587,15 +591,16 @@ function comment_text() {
  *
  * @param string $d Optional. The format of the time (defaults to user's config)
  * @param bool $gmt Whether to use the GMT date
  *
  * @param string $d Optional. The format of the time (defaults to user's config)
  * @param bool $gmt Whether to use the GMT date
+ * @param bool $translate Whether to translate the time (for use in feeds)
  * @return string The formatted time
  */
  * @return string The formatted time
  */
-function get_comment_time( $d = '', $gmt = false ) {
+function get_comment_time( $d = '', $gmt = false, $translate = true ) {
        global $comment;
        $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
        if ( '' == $d )
        global $comment;
        $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
        if ( '' == $d )
-               $date = mysql2date(get_option('time_format'), $comment_date);
+               $date = mysql2date(get_option('time_format'), $comment_date, $translate);
        else
        else
-               $date = mysql2date($d, $comment_date);
+               $date = mysql2date($d, $comment_date, $translate);
        return apply_filters('get_comment_time', $date, $d, $gmt);
 }
 
        return apply_filters('get_comment_time', $date, $d, $gmt);
 }
 
@@ -637,7 +642,10 @@ function get_comment_type() {
  * @param string $trackbacktxt The string to display for trackback type
  * @param string $pingbacktxt The string to display for pingback type
  */
  * @param string $trackbacktxt The string to display for trackback type
  * @param string $pingbacktxt The string to display for pingback type
  */
-function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') {
+function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) {
+    if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
+    if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
+    if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
        $type = get_comment_type();
        switch( $type ) {
                case 'trackback' :
        $type = get_comment_type();
        switch( $type ) {
                case 'trackback' :
@@ -814,11 +822,11 @@ function comments_template( $file = '/comments.php', $separate_comments = false
 
        /** @todo Use API instead of SELECTs. */
        if ( $user_ID) {
 
        /** @todo Use API instead of SELECTs. */
        if ( $user_ID) {
-               $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) )  ORDER BY comment_date", $post->ID, $user_ID));
+               $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) )  ORDER BY comment_date_gmt", $post->ID, $user_ID));
        } else if ( empty($comment_author) ) {
        } else if ( empty($comment_author) ) {
-               $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post->ID));
+               $comments = get_comments( array('post_id' => $post->ID, 'status' => 'approve', 'order' => 'ASC') );
        } else {
        } else {
-               $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date", $post->ID, $comment_author, $comment_author_email));
+               $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date_gmt", $post->ID, wp_specialchars_decode($comment_author,ENT_QUOTES), $comment_author_email));
        }
 
        // keep $comments for legacy's sake
        }
 
        // keep $comments for legacy's sake
@@ -838,7 +846,8 @@ function comments_template( $file = '/comments.php', $separate_comments = false
                $overridden_cpage = TRUE;
        }
 
                $overridden_cpage = TRUE;
        }
 
-       define('COMMENTS_TEMPLATE', true);
+       if ( !defined('COMMENTS_TEMPLATE') || !COMMENTS_TEMPLATE)
+               define('COMMENTS_TEMPLATE', true);
 
        $include = apply_filters('comments_template', STYLESHEETPATH . $file );
        if ( file_exists( $include ) )
 
        $include = apply_filters('comments_template', STYLESHEETPATH . $file );
        if ( file_exists( $include ) )
@@ -899,15 +908,17 @@ function comments_popup_script($width=400, $height=400, $file='') {
  * @param string $none The string to display when comments have been turned off
  * @return null Returns null on single posts and pages.
  */
  * @param string $none The string to display when comments have been turned off
  * @return null Returns null on single posts and pages.
  */
-function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = 'Comments Off' ) {
+function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
        global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
 
        global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
 
-       if ( is_single() || is_page() )
-               return;
+    if ( false === $zero ) $zero = __( 'No Comments' );
+    if ( false === $one ) $one = __( '1 Comment' );
+    if ( false === $more ) $more = __( '% Comments' );
+    if ( false === $none ) $none = __( 'Comments Off' );
 
        $number = get_comments_number( $id );
 
 
        $number = get_comments_number( $id );
 
-       if ( 0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status ) {
+       if ( 0 == $number && !comments_open() && !pings_open() ) {
                echo '<span' . ((!empty($css_class)) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
                return;
        }
                echo '<span' . ((!empty($css_class)) ? ' class="' . $css_class . '"' : '') . '>' . $none . '</span>';
                return;
        }
@@ -936,7 +947,7 @@ function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more =
        if ( !empty( $css_class ) ) {
                echo ' class="'.$css_class.'" ';
        }
        if ( !empty( $css_class ) ) {
                echo ' class="'.$css_class.'" ';
        }
-       $title = attribute_escape( get_the_title() );
+       $title = esc_attr( get_the_title() );
 
        echo apply_filters( 'comments_popup_link_attributes', '' );
 
 
        echo apply_filters( 'comments_popup_link_attributes', '' );
 
@@ -978,15 +989,15 @@ function get_comment_reply_link($args = array(), $comment = null, $post = null)
        $comment = get_comment($comment);
        $post = get_post($post);
 
        $comment = get_comment($comment);
        $post = get_post($post);
 
-       if ( 'open' != $post->comment_status )
+       if ( !comments_open($post->ID) )
                return false;
 
        $link = '';
 
        if ( get_option('comment_registration') && !$user_ID )
                return false;
 
        $link = '';
 
        if ( get_option('comment_registration') && !$user_ID )
-               $link = '<a rel="nofollow" href="' . site_url('wp-login.php?redirect_to=' . get_permalink()) . '">' . $login_text . '</a>';
+               $link = '<a rel="nofollow" class="comment-reply-login" href="' . esc_url( wp_login_url( get_permalink() ) ) . '">' . $login_text . '</a>';
        else
        else
-               $link = "<a rel='nofollow' class='comment-reply-link' href='" . wp_specialchars( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
+               $link = "<a rel='nofollow' class='comment-reply-link' href='" . esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
        return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
 }
 
        return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
 }
 
@@ -1030,12 +1041,12 @@ function get_post_reply_link($args = array(), $post = null) {
        $args = wp_parse_args($args, $defaults);
        extract($args, EXTR_SKIP);
        $post = get_post($post);
        $args = wp_parse_args($args, $defaults);
        extract($args, EXTR_SKIP);
        $post = get_post($post);
-       
+
        if ( !comments_open($post->ID) )
                return false;
 
        if ( get_option('comment_registration') && !$user_ID ) {
        if ( !comments_open($post->ID) )
                return false;
 
        if ( get_option('comment_registration') && !$user_ID ) {
-               $link = '<a rel="nofollow" href="' . site_url('wp-login.php?redirect_to=' . get_permalink()) . '">' . $login_text . '</a>';
+               $link = '<a rel="nofollow" href="' . wp_login_url( get_permalink() ) . '">' . $login_text . '</a>';
        } else {
                $link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
        }
        } else {
                $link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";
        }
@@ -1067,7 +1078,7 @@ function get_cancel_comment_reply_link($text = '') {
                $text = __('Click here to cancel reply.');
 
        $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
                $text = __('Click here to cancel reply.');
 
        $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
-       $link = wp_specialchars( remove_query_arg('replytocom') ) . '#respond';
+       $link = esc_html( remove_query_arg('replytocom') ) . '#respond';
        return apply_filters('cancel_comment_reply_link', '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>', $link, $text);
 }
 
        return apply_filters('cancel_comment_reply_link', '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>', $link, $text);
 }
 
@@ -1104,9 +1115,12 @@ function comment_id_fields() {
  * @param string $replytext Optional. Text to display when replying to a comment. Accepts "%s" for the author of the comment being replied to.
  * @param string $linktoparent Optional. Boolean to control making the author's name a link to their comment.
  */
  * @param string $replytext Optional. Text to display when replying to a comment. Accepts "%s" for the author of the comment being replied to.
  * @param string $linktoparent Optional. Boolean to control making the author's name a link to their comment.
  */
-function comment_form_title( $noreplytext = 'Leave a Reply', $replytext = 'Leave a Reply to %s', $linktoparent = TRUE ) {
+function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = TRUE ) {
        global $comment;
 
        global $comment;
 
+       if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
+       if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );
+
        $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
 
        if ( 0 == $replytoid )
        $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
 
        if ( 0 == $replytoid )
@@ -1219,7 +1233,7 @@ class Walker_Comment extends Walker {
 ?>
                <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
                <?php if ( 'ul' == $args['style'] ) : ?>
 ?>
                <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
                <?php if ( 'ul' == $args['style'] ) : ?>
-               <div id="div-comment-<?php comment_ID() ?>">
+               <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
                <?php endif; ?>
                <div class="comment-author vcard">
                <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
                <?php endif; ?>
                <div class="comment-author vcard">
                <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
index 18bf0e196541b858dc3e83841d49006bfb837d50..53e2233dc3c56be4acc1764cfb66c51e19015fb8 100644 (file)
@@ -168,6 +168,8 @@ function &get_comment(&$comment, $output = OBJECT) {
 /**
  * Retrieve a list of comments.
  *
 /**
  * Retrieve a list of comments.
  *
+ * The comment list can be for the blog as a whole or for an individual post.
+ *
  * The list of comment arguments are 'status', 'orderby', 'comment_date_gmt',
  * 'order', 'number', 'offset', and 'post_id'.
  *
  * The list of comment arguments are 'status', 'orderby', 'comment_date_gmt',
  * 'order', 'number', 'offset', and 'post_id'.
  *
@@ -252,8 +254,10 @@ function get_comments( $args = '' ) {
 function get_comment_statuses( ) {
        $status = array(
                'hold'          => __('Unapproved'),
 function get_comment_statuses( ) {
        $status = array(
                'hold'          => __('Unapproved'),
-               'approve'       => __('Approved'),
-               'spam'          => _c('Spam|adjective'),
+               /* translators: comment status  */
+               'approve'       => _x('Approved', 'adjective'),
+               /* translators: comment status */
+               'spam'          => _x('Spam', 'adjective'),
        );
 
        return $status;
        );
 
        return $status;
@@ -367,14 +371,14 @@ function sanitize_comment_cookies() {
        if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
                $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);
                $comment_author = stripslashes($comment_author);
        if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
                $comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);
                $comment_author = stripslashes($comment_author);
-               $comment_author = attribute_escape($comment_author);
+               $comment_author = esc_attr($comment_author);
                $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author;
        }
 
        if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
                $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
                $comment_author_email = stripslashes($comment_author_email);
                $_COOKIE['comment_author_'.COOKIEHASH] = $comment_author;
        }
 
        if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
                $comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
                $comment_author_email = stripslashes($comment_author_email);
-               $comment_author_email = attribute_escape($comment_author_email);
+               $comment_author_email = esc_attr($comment_author_email);
                $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
        }
 
                $_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
        }
 
@@ -408,9 +412,9 @@ function wp_allow_comment($commentdata) {
        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
        if ( $wpdb->get_var($dupe) ) {
                if ( defined('DOING_AJAX') )
        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
        if ( $wpdb->get_var($dupe) ) {
                if ( defined('DOING_AJAX') )
-                       die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
+                       die( __('Duplicate comment detected; it looks as though you&#8217;ve already said that!') );
 
 
-               wp_die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
+               wp_die( __('Duplicate comment detected; it looks as though you&#8217;ve already said that!') );
        }
 
        do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );
        }
 
        do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );
@@ -460,8 +464,8 @@ function check_comment_flood_db( $ip, $email, $date ) {
        if ( current_user_can( 'manage_options' ) )
                return; // don't throttle admins
        if ( $lasttime = $wpdb->get_var( $wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = %s OR comment_author_email = %s ORDER BY comment_date DESC LIMIT 1", $ip, $email) ) ) {
        if ( current_user_can( 'manage_options' ) )
                return; // don't throttle admins
        if ( $lasttime = $wpdb->get_var( $wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = %s OR comment_author_email = %s ORDER BY comment_date DESC LIMIT 1", $ip, $email) ) ) {
-               $time_lastcomment = mysql2date('U', $lasttime);
-               $time_newcomment  = mysql2date('U', $date);
+               $time_lastcomment = mysql2date('U', $lasttime, false);
+               $time_newcomment  = mysql2date('U', $date, false);
                $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
                if ( $flood_die ) {
                        do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
                $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
                if ( $flood_die ) {
                        do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
@@ -739,6 +743,13 @@ function wp_delete_comment($comment_id) {
        if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
                return false;
 
        if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
                return false;
 
+       // Move children up a level.
+       $children = $wpdb->get_col( $wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment_id) );
+       if ( !empty($children) ) {
+               $wpdb->update($wpdb->comments, array('comment_parent' => $comment->comment_parent), array('comment_parent' => $comment_id));
+               clean_comment_cache($children);
+       }
+
        $post_id = $comment->comment_post_ID;
        if ( $post_id && $comment->comment_approved == 1 )
                wp_update_comment_count($post_id);
        $post_id = $comment->comment_post_ID;
        if ( $post_id && $comment->comment_approved == 1 )
                wp_update_comment_count($post_id);
@@ -873,21 +884,24 @@ function wp_insert_comment($commentdata) {
                $comment_parent = 0;
        if ( ! isset($comment_approved) )
                $comment_approved = 1;
                $comment_parent = 0;
        if ( ! isset($comment_approved) )
                $comment_approved = 1;
+       if ( ! isset($comment_karma) )
+               $comment_karma = 0;
        if ( ! isset($user_id) )
                $user_id = 0;
        if ( ! isset($comment_type) )
                $comment_type = '';
 
        if ( ! isset($user_id) )
                $user_id = 0;
        if ( ! isset($comment_type) )
                $comment_type = '';
 
-       $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->comments
-       (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
-       VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d)",
-       $comment_post_ID, $comment_author, $comment_author_email, $comment_author_url, $comment_author_IP, $comment_date, $comment_date_gmt, $comment_content, $comment_approved, $comment_agent, $comment_type, $comment_parent, $user_id) );
+       $data = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id');
+       $wpdb->insert($wpdb->comments, $data);
 
        $id = (int) $wpdb->insert_id;
 
 
        $id = (int) $wpdb->insert_id;
 
-       if ( $comment_approved == 1)
+       if ( $comment_approved == 1 )
                wp_update_comment_count($comment_post_ID);
 
                wp_update_comment_count($comment_post_ID);
 
+       $comment = get_comment($id);
+       do_action('wp_insert_comment', $id, $comment);
+
        return $id;
 }
 
        return $id;
 }
 
@@ -1009,24 +1023,26 @@ function wp_new_comment( $commentdata ) {
  *
  * @param int $comment_id Comment ID.
  * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'delete'.
  *
  * @param int $comment_id Comment ID.
  * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'delete'.
+ * @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default is false.
  * @return bool False on failure or deletion and true on success.
  */
  * @return bool False on failure or deletion and true on success.
  */
-function wp_set_comment_status($comment_id, $comment_status) {
+function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
        global $wpdb;
 
        global $wpdb;
 
+       $status = '0';
        switch ( $comment_status ) {
                case 'hold':
        switch ( $comment_status ) {
                case 'hold':
-                       $query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID = %d LIMIT 1", $comment_id);
+                       $status = '0';
                        break;
                case 'approve':
                        break;
                case 'approve':
-                       $query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID = %d LIMIT 1", $comment_id);
+                       $status = '1';
                        if ( get_option('comments_notify') ) {
                                $comment = get_comment($comment_id);
                                wp_notify_postauthor($comment_id, $comment->comment_type);
                        }
                        break;
                case 'spam':
                        if ( get_option('comments_notify') ) {
                                $comment = get_comment($comment_id);
                                wp_notify_postauthor($comment_id, $comment->comment_type);
                        }
                        break;
                case 'spam':
-                       $query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID = %d LIMIT 1", $comment_id);
+                       $status = 'spam';
                        break;
                case 'delete':
                        return wp_delete_comment($comment_id);
                        break;
                case 'delete':
                        return wp_delete_comment($comment_id);
@@ -1035,8 +1051,12 @@ function wp_set_comment_status($comment_id, $comment_status) {
                        return false;
        }
 
                        return false;
        }
 
-       if ( !$wpdb->query($query) )
-               return false;
+       if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) {
+               if ( $wp_error )
+                       return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);
+               else
+                       return false;
+       }
 
        clean_comment_cache($comment_id);
 
 
        clean_comment_cache($comment_id);
 
@@ -1069,8 +1089,9 @@ function wp_update_comment($commentarr) {
        $comment = get_comment($commentarr['comment_ID'], ARRAY_A);
 
        // Escape data pulled from DB.
        $comment = get_comment($commentarr['comment_ID'], ARRAY_A);
 
        // Escape data pulled from DB.
-       foreach ( (array) $comment as $key => $value )
-               $comment[$key] = $wpdb->escape($value);
+       $comment = $wpdb->escape($comment);
+
+       $old_status = $comment['comment_approved'];
 
        // Merge old and new fields with new fields overwriting old ones.
        $commentarr = array_merge($comment, $commentarr);
 
        // Merge old and new fields with new fields overwriting old ones.
        $commentarr = array_merge($comment, $commentarr);
@@ -1091,23 +1112,8 @@ function wp_update_comment($commentarr) {
        else if ( 'approve' == $comment_approved )
                $comment_approved = 1;
 
        else if ( 'approve' == $comment_approved )
                $comment_approved = 1;
 
-       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->comments SET
-                       comment_content      = %s,
-                       comment_author       = %s,
-                       comment_author_email = %s,
-                       comment_approved     = %s,
-                       comment_author_url   = %s,
-                       comment_date         = %s,
-                       comment_date_gmt     = %s
-               WHERE comment_ID = %d",
-                       $comment_content,
-                       $comment_author,
-                       $comment_author_email,
-                       $comment_approved,
-                       $comment_author_url,
-                       $comment_date,
-                       $comment_date_gmt,
-                       $comment_ID) );
+       $data = compact('comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt');
+       $wpdb->update($wpdb->comments, $data, compact('comment_ID'));
 
        $rval = $wpdb->rows_affected;
 
 
        $rval = $wpdb->rows_affected;
 
@@ -1115,7 +1121,7 @@ function wp_update_comment($commentarr) {
        wp_update_comment_count($comment_post_ID);
        do_action('edit_comment', $comment_ID);
        $comment = get_comment($comment_ID);
        wp_update_comment_count($comment_post_ID);
        do_action('edit_comment', $comment_ID);
        $comment = get_comment($comment_ID);
-       wp_transition_comment_status($comment_approved, $comment->comment_approved, $comment);
+       wp_transition_comment_status($comment->comment_approved, $old_status, $comment);
        return $rval;
 }
 
        return $rval;
 }
 
@@ -1206,7 +1212,7 @@ function wp_update_comment_count_now($post_id) {
 
        $old = (int) $post->comment_count;
        $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) );
 
        $old = (int) $post->comment_count;
        $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) );
-       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $new, $post_id) );
+       $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) );
 
        if ( 'page' == $post->post_type )
                clean_page_cache( $post_id );
 
        if ( 'page' == $post->post_type )
                clean_page_cache( $post_id );
@@ -1247,7 +1253,12 @@ function discover_pingback_server_uri($url, $deprecated = 2048) {
        if ( ! isset( $parsed_url['host'] ) ) // Not an URL. This should never happen.
                return false;
 
        if ( ! isset( $parsed_url['host'] ) ) // Not an URL. This should never happen.
                return false;
 
-       $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.1' ) );
+       //Do not search for a pingback server on our own uploads
+       $uploads_dir = wp_upload_dir();
+       if ( 0 === strpos($url, $uploads_dir['baseurl']) )
+               return false;
+
+       $response = wp_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
 
        if ( is_wp_error( $response ) )
                return false;
 
        if ( is_wp_error( $response ) )
                return false;
@@ -1259,6 +1270,12 @@ function discover_pingback_server_uri($url, $deprecated = 2048) {
        if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )
                return false;
 
        if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )
                return false;
 
+       // Now do a GET since we're going to look in the html headers (and we're sure its not a binary file)
+       $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
+
+       if ( is_wp_error( $response ) )
+               return false;
+
        $contents = $response['body'];
 
        $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
        $contents = $response['body'];
 
        $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
@@ -1307,9 +1324,6 @@ function do_all_pings() {
        if ( is_array($trackbacks) )
                foreach ( $trackbacks as $trackback )
                        do_trackbacks($trackback);
        if ( is_array($trackbacks) )
                foreach ( $trackbacks as $trackback )
                        do_trackbacks($trackback);
-
-       //Do Update Services/Generic Pings
-       generic_ping();
 }
 
 /**
 }
 
 /**
@@ -1327,7 +1341,7 @@ function do_trackbacks($post_id) {
        $to_ping = get_to_ping($post_id);
        $pinged  = get_pung($post_id);
        if ( empty($to_ping) ) {
        $to_ping = get_to_ping($post_id);
        $pinged  = get_pung($post_id);
        if ( empty($to_ping) ) {
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = %d", $post_id) );
+               $wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id) );
                return;
        }
 
                return;
        }
 
@@ -1542,10 +1556,11 @@ function weblog_ping($server = '', $path = '') {
  * @package WordPress
  * @subpackage Cache
  *
  * @package WordPress
  * @subpackage Cache
  *
- * @param int $id Comment ID to remove from cache
+ * @param int|array $id Comment ID or array of comment IDs to remove from cache
  */
  */
-function clean_comment_cache($id) {
-       wp_cache_delete($id, 'comment');
+function clean_comment_cache($ids) {
+       foreach ( (array) $ids as $id )
+               wp_cache_delete($id, 'comment');
 }
 
 /**
 }
 
 /**
index 47e6c8ba7cc57d93fe3fa6ecfed4707b0c7dcebf..0043865000503fe8465d007c325a427ac3e1094d 100644 (file)
@@ -77,13 +77,13 @@ function hash_hmac($algo, $data, $key, $raw_output = false) {
 }
 endif;
 
 }
 endif;
 
-if ( ! function_exists('mb_strcut') ):
-       function mb_strcut( $str, $start, $length=null, $encoding=null ) {
-               return _mb_strcut($str, $start, $length, $encoding);
+if ( ! function_exists('mb_substr') ):
+       function mb_substr( $str, $start, $length=null, $encoding=null ) {
+               return _mb_substr($str, $start, $length, $encoding);
        }
 endif;
 
        }
 endif;
 
-function _mb_strcut( $str, $start, $length=null, $encoding=null ) {
+function _mb_substr( $str, $start, $length=null, $encoding=null ) {
        // the solution below, works only for utf-8, so in case of a different
        // charset, just use built-in substr
        $charset = get_option( 'blog_charset' );
        // the solution below, works only for utf-8, so in case of a different
        // charset, just use built-in substr
        $charset = get_option( 'blog_charset' );
@@ -99,7 +99,7 @@ function _mb_strcut( $str, $start, $length=null, $encoding=null ) {
 if ( !function_exists( 'htmlspecialchars_decode' ) ) {
        // Added in PHP 5.1.0
        // Error checks from PEAR::PHP_Compat
 if ( !function_exists( 'htmlspecialchars_decode' ) ) {
        // Added in PHP 5.1.0
        // Error checks from PEAR::PHP_Compat
-       function htmlspecialchars_decode( $str, $quote_style = ENT_COMPAT )
+       function htmlspecialchars_decode( $string, $quote_style = ENT_COMPAT )
        {
                if ( !is_scalar( $string ) ) {
                        trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $string ) . ' given', E_USER_WARNING );
        {
                if ( !is_scalar( $string ) ) {
                        trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $string ) . ' given', E_USER_WARNING );
@@ -111,7 +111,7 @@ if ( !function_exists( 'htmlspecialchars_decode' ) ) {
                        return;
                }
 
                        return;
                }
 
-               return wp_specialchars_decode( $str, $quote_style );
+               return wp_specialchars_decode( $string, $quote_style );
        }
 }
 
        }
 }
 
index c609ef8a18b39c376df10c1bccf816ef3fcd58b6..be9ea67e3c71c1ed5e9aa642e2df31584429b07b 100644 (file)
@@ -39,6 +39,9 @@ function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
  * specific interval, specified by you. The action will trigger when someone
  * visits your WordPress site, if the scheduled time has passed.
  *
  * specific interval, specified by you. The action will trigger when someone
  * visits your WordPress site, if the scheduled time has passed.
  *
+ * Valid values for the recurrence are hourly, daily and twicedaily.  These can
+ * be extended using the cron_schedules filter in wp_get_schedules().
+ *
  * @since 2.1.0
  *
  * @param int $timestamp Timestamp for when to run the event.
  * @since 2.1.0
  *
  * @param int $timestamp Timestamp for when to run the event.
@@ -85,8 +88,12 @@ function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
        if ( 0 == $interval )
                return false;
 
        if ( 0 == $interval )
                return false;
 
-       while ( $timestamp < time() + 1 )
-               $timestamp += $interval;
+       $now = time();
+
+    if ( $timestamp >= $now )
+        $timestamp = $now + $interval;
+    else
+        $timestamp = $now + ($interval - (($now - $timestamp) % $interval));
 
        wp_schedule_event( $timestamp, $recurrence, $hook, $args );
 }
 
        wp_schedule_event( $timestamp, $recurrence, $hook, $args );
 }
@@ -160,7 +167,13 @@ function wp_next_scheduled( $hook, $args = array() ) {
  *
  * @return null Cron could not be spawned, because it is not needed to run.
  */
  *
  * @return null Cron could not be spawned, because it is not needed to run.
  */
-function spawn_cron( $local_time ) {
+function spawn_cron( $local_time = 0 ) {
+
+       if ( !$local_time )
+               $local_time = time();
+
+       if ( defined('DOING_CRON') || isset($_GET['doing_wp_cron']) )
+               return;
 
        /*
         * do not even start the cron if local server timer has drifted
 
        /*
         * do not even start the cron if local server timer has drifted
@@ -170,38 +183,50 @@ function spawn_cron( $local_time ) {
        if ( !$timer_accurate )
                return;
 
        if ( !$timer_accurate )
                return;
 
+       /*
+       * multiple processes on multiple web servers can run this code concurrently
+       * try to make this as atomic as possible by setting doing_cron switch
+       */
+       $flag = get_transient('doing_cron');
+
+       if ( $flag > $local_time + 10*60 )
+               $flag = 0;
+
+       // don't run if another process is currently running it or more than once every 60 sec.
+       if ( $flag + 60 > $local_time )
+               return;
+
        //sanity check
        $crons = _get_cron_array();
        if ( !is_array($crons) )
                return;
 
        $keys = array_keys( $crons );
        //sanity check
        $crons = _get_cron_array();
        if ( !is_array($crons) )
                return;
 
        $keys = array_keys( $crons );
-       $timestamp =  $keys[0];
-       if ( $timestamp > $local_time )
+       if ( isset($keys[0]) && $keys[0] > $local_time )
                return;
 
                return;
 
-       $cron_url = get_option( 'siteurl' ) . '/wp-cron.php?check=' . wp_hash('187425');
-       /*
-       * multiple processes on multiple web servers can run this code concurrently
-       * try to make this as atomic as possible by setting doing_cron switch
-       */
-       $flag = get_option('doing_cron');
+       if ( defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON ) {
+               if ( !empty($_POST) || defined('DOING_AJAX') )
+                       return;
 
 
-       // clean up potential invalid value resulted from various system chaos
-       if ( $flag != 0 ) {
-               if ( $flag > $local_time + 10*60 || $flag < $local_time - 10*60 ) {
-                       update_option('doing_cron', 0);
-                       $flag = 0;
-               }
-       }
+               set_transient( 'doing_cron', $local_time );
+
+               ob_start();
+               wp_redirect( add_query_arg('doing_wp_cron', '', stripslashes($_SERVER['REQUEST_URI'])) );
+               echo ' ';
+
+               // flush any buffers and send the headers
+               while ( @ob_end_flush() );
+               flush();
 
 
-       //don't run if another process is currently running it
-       if ( $flag > $local_time )
+               @include_once(ABSPATH . 'wp-cron.php');
                return;
                return;
+       }
 
 
-       update_option( 'doing_cron', $local_time + 30 );
+       set_transient( 'doing_cron', $local_time );
 
 
-       wp_remote_post($cron_url, array('timeout' => 0.01, 'blocking' => false));
+       $cron_url = get_option( 'siteurl' ) . '/wp-cron.php?doing_wp_cron';
+       wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
 }
 
 /**
 }
 
 /**
@@ -214,19 +239,17 @@ function spawn_cron( $local_time ) {
 function wp_cron() {
 
        // Prevent infinite loops caused by lack of wp-cron.php
 function wp_cron() {
 
        // Prevent infinite loops caused by lack of wp-cron.php
-       if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false )
+       if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false || ( defined('DISABLE_WP_CRON') && DISABLE_WP_CRON ) )
                return;
 
                return;
 
-       $crons = _get_cron_array();
-
-       if ( !is_array($crons) )
+       if ( false === $crons = _get_cron_array() )
                return;
 
                return;
 
+       $local_time = time();
        $keys = array_keys( $crons );
        $keys = array_keys( $crons );
-       if ( isset($keys[0]) && $keys[0] > time() )
+       if ( isset($keys[0]) && $keys[0] > $local_time )
                return;
 
                return;
 
-       $local_time = time();
        $schedules = wp_get_schedules();
        foreach ( $crons as $timestamp => $cronhooks ) {
                if ( $timestamp > $local_time ) break;
        $schedules = wp_get_schedules();
        foreach ( $crons as $timestamp => $cronhooks ) {
                if ( $timestamp > $local_time ) break;
index 594937aa04bf677644647b745fd400e7685a9b97..b5f7be233da27da74a34a7f2db2c6ee956001a98 100644 (file)
@@ -20,7 +20,7 @@ foreach ( $filters as $filter ) {
        add_filter($filter, 'strip_tags');
        add_filter($filter, 'trim');
        add_filter($filter, 'wp_filter_kses');
        add_filter($filter, 'strip_tags');
        add_filter($filter, 'trim');
        add_filter($filter, 'wp_filter_kses');
-       add_filter($filter, 'wp_specialchars', 30);
+       add_filter($filter, '_wp_specialchars', 30);
 }
 
 // Kses only for textarea saves
 }
 
 // Kses only for textarea saves
@@ -43,7 +43,7 @@ $filters = array('pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_
 foreach ( $filters as $filter ) {
        add_filter($filter, 'strip_tags');
        add_filter($filter, 'trim');
 foreach ( $filters as $filter ) {
        add_filter($filter, 'strip_tags');
        add_filter($filter, 'trim');
-       add_filter($filter, 'sanitize_url');
+       add_filter($filter, 'esc_url_raw');
        add_filter($filter, 'wp_filter_kses');
 }
 
        add_filter($filter, 'wp_filter_kses');
 }
 
@@ -52,7 +52,7 @@ $filters = array('user_url', 'link_url', 'link_image', 'link_rss', 'comment_url'
 foreach ( $filters as $filter ) {
        add_filter($filter, 'strip_tags');
        add_filter($filter, 'trim');
 foreach ( $filters as $filter ) {
        add_filter($filter, 'strip_tags');
        add_filter($filter, 'trim');
-       add_filter($filter, 'clean_url');
+       add_filter($filter, 'esc_url');
        add_filter($filter, 'wp_filter_kses');
 }
 
        add_filter($filter, 'wp_filter_kses');
 }
 
@@ -76,11 +76,11 @@ foreach ( $filters as $filter ) {
 
 // Format strings for display.
 $filters = array('comment_author', 'term_name', 'link_name', 'link_description',
 
 // Format strings for display.
 $filters = array('comment_author', 'term_name', 'link_name', 'link_description',
-       'link_notes', 'bloginfo', 'wp_title');
+       'link_notes', 'bloginfo', 'wp_title', 'widget_title');
 foreach ( $filters as $filter ) {
        add_filter($filter, 'wptexturize');
        add_filter($filter, 'convert_chars');
 foreach ( $filters as $filter ) {
        add_filter($filter, 'wptexturize');
        add_filter($filter, 'convert_chars');
-       add_filter($filter, 'wp_specialchars');
+       add_filter($filter, 'esc_html');
 }
 
 // Format text area for display.
 }
 
 // Format text area for display.
@@ -131,19 +131,19 @@ add_filter('wp_sprintf', 'wp_sprintf_l', 10, 2);
 // RSS filters
 add_filter('the_title_rss', 'strip_tags');
 add_filter('the_title_rss', 'ent2ncr', 8);
 // RSS filters
 add_filter('the_title_rss', 'strip_tags');
 add_filter('the_title_rss', 'ent2ncr', 8);
-add_filter('the_title_rss', 'wp_specialchars');
+add_filter('the_title_rss', 'esc_html');
 add_filter('the_content_rss', 'ent2ncr', 8);
 add_filter('the_excerpt_rss', 'convert_chars');
 add_filter('the_excerpt_rss', 'ent2ncr', 8);
 add_filter('comment_author_rss', 'ent2ncr', 8);
 add_filter('comment_text_rss', 'ent2ncr', 8);
 add_filter('the_content_rss', 'ent2ncr', 8);
 add_filter('the_excerpt_rss', 'convert_chars');
 add_filter('the_excerpt_rss', 'ent2ncr', 8);
 add_filter('comment_author_rss', 'ent2ncr', 8);
 add_filter('comment_text_rss', 'ent2ncr', 8);
-add_filter('comment_text_rss', 'wp_specialchars');
+add_filter('comment_text_rss', 'esc_html');
 add_filter('bloginfo_rss', 'ent2ncr', 8);
 add_filter('the_author', 'ent2ncr', 8);
 
 // Misc filters
 add_filter('option_ping_sites', 'privacy_ping_filter');
 add_filter('bloginfo_rss', 'ent2ncr', 8);
 add_filter('the_author', 'ent2ncr', 8);
 
 // Misc filters
 add_filter('option_ping_sites', 'privacy_ping_filter');
-add_filter('option_blog_charset', 'wp_specialchars');
+add_filter('option_blog_charset', '_wp_specialchars'); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
 add_filter('option_home', '_config_wp_home');
 add_filter('option_siteurl', '_config_wp_siteurl');
 add_filter('tiny_mce_before_init', '_mce_set_direction');
 add_filter('option_home', '_config_wp_home');
 add_filter('option_siteurl', '_config_wp_siteurl');
 add_filter('tiny_mce_before_init', '_mce_set_direction');
@@ -164,25 +164,34 @@ add_filter( 'editable_slug', 'urldecode' );
 add_filter('atom_service_url','atom_service_url_filter');
 
 // Actions
 add_filter('atom_service_url','atom_service_url_filter');
 
 // Actions
+add_action('wp_head', 'wp_enqueue_scripts', 1);
+add_action('wp_head', 'feed_links_extra', 3);
 add_action('wp_head', 'rsd_link');
 add_action('wp_head', 'wlwmanifest_link');
 add_action('wp_head', 'rsd_link');
 add_action('wp_head', 'wlwmanifest_link');
+add_action('wp_head', 'index_rel_link');
+add_action('wp_head', 'parent_post_rel_link', 10, 0);
+add_action('wp_head', 'start_post_rel_link', 10, 0);
+add_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
 add_action('wp_head', 'locale_stylesheet');
 add_action('publish_future_post', 'check_and_publish_future_post', 10, 1);
 add_action('wp_head', 'noindex', 1);
 add_action('wp_head', 'locale_stylesheet');
 add_action('publish_future_post', 'check_and_publish_future_post', 10, 1);
 add_action('wp_head', 'noindex', 1);
-add_action('wp_head', 'wp_print_styles', 9);
-add_action('wp_head', 'wp_print_scripts');
+add_action('wp_head', 'wp_print_styles', 8);
+add_action('wp_head', 'wp_print_head_scripts', 9);
 add_action('wp_head', 'wp_generator');
 add_action('wp_head', 'wp_generator');
+add_action('wp_footer', 'wp_print_footer_scripts');
 if(!defined('DOING_CRON'))
 if(!defined('DOING_CRON'))
-       add_action('init', 'wp_cron');
+       add_action('sanitize_comment_cookies', 'wp_cron');
 add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
 add_action('do_feed_rss', 'do_feed_rss', 10, 1);
 add_action('do_feed_rss2', 'do_feed_rss2', 10, 1);
 add_action('do_feed_atom', 'do_feed_atom', 10, 1);
 add_action('do_pings', 'do_all_pings', 10, 1);
 add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
 add_action('do_feed_rss', 'do_feed_rss', 10, 1);
 add_action('do_feed_rss2', 'do_feed_rss2', 10, 1);
 add_action('do_feed_atom', 'do_feed_atom', 10, 1);
 add_action('do_pings', 'do_all_pings', 10, 1);
+add_action('do_generic_ping', 'generic_ping', 10, 1);
 add_action('do_robots', 'do_robots');
 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
 add_action('do_robots', 'do_robots');
 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
-add_action('admin_print_scripts', 'wp_print_scripts', 20);
-add_action('admin_print_styles', 'wp_print_styles', 20);
+add_action('admin_print_scripts', 'print_head_scripts', 20);
+add_action('admin_print_footer_scripts', 'print_footer_scripts', 20);
+add_action('admin_print_styles', 'print_admin_styles', 20);
 add_action('init', 'smilies_init', 5);
 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
 add_action( 'shutdown', 'wp_ob_end_flush_all', 1);
 add_action('init', 'smilies_init', 5);
 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
 add_action( 'shutdown', 'wp_ob_end_flush_all', 1);
@@ -199,4 +208,6 @@ add_action('edit_post', 'wp_check_for_changed_slugs');
 add_action('edit_form_advanced', 'wp_remember_old_slug');
 add_action('init', '_show_post_preview');
 
 add_action('edit_form_advanced', 'wp_remember_old_slug');
 add_action('init', '_show_post_preview');
 
+add_filter('pre_option_gmt_offset','wp_timezone_override_offset');
+
 ?>
 ?>
diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php
new file mode 100644 (file)
index 0000000..d2bebc8
--- /dev/null
@@ -0,0 +1,1030 @@
+<?php
+
+/**
+ * Default Widgets
+ *
+ * @package WordPress
+ * @subpackage Widgets
+ */
+
+/**
+ * Pages widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Pages extends WP_Widget {
+
+       function WP_Widget_Pages() {
+               $widget_ops = array('classname' => 'widget_pages', 'description' => __( 'Your blog&#8217;s WordPress Pages') );
+               $this->WP_Widget('pages', __('Pages'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract( $args );
+
+               $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title']);
+               $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
+               $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
+
+               if ( $sortby == 'menu_order' )
+                       $sortby = 'menu_order, post_title';
+
+               $out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );
+
+               if ( !empty( $out ) ) {
+                       echo $before_widget;
+                       if ( $title)
+                               echo $before_title . $title . $after_title;
+               ?>
+               <ul>
+                       <?php echo $out; ?>
+               </ul>
+               <?php
+                       echo $after_widget;
+               }
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $instance['title'] = strip_tags($new_instance['title']);
+               if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) {
+                       $instance['sortby'] = $new_instance['sortby'];
+               } else {
+                       $instance['sortby'] = 'menu_order';
+               }
+
+               $instance['exclude'] = strip_tags( $new_instance['exclude'] );
+
+               return $instance;
+       }
+
+       function form( $instance ) {
+               //Defaults
+               $instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
+               $title = esc_attr( $instance['title'] );
+               $exclude = esc_attr( $instance['exclude'] );
+       ?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
+               <p>
+                       <label for="<?php echo $this->get_field_id('sortby'); ?>"><?php _e( 'Sort by:' ); ?></label>
+                       <select name="<?php echo $this->get_field_name('sortby'); ?>" id="<?php echo $this->get_field_id('sortby'); ?>" class="widefat">
+                               <option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option>
+                               <option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option>
+                               <option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
+                       </select>
+               </p>
+               <p>
+                       <label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo $exclude; ?>" name="<?php echo $this->get_field_name('exclude'); ?>" id="<?php echo $this->get_field_id('exclude'); ?>" class="widefat" />
+                       <br />
+                       <small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
+               </p>
+<?php
+       }
+
+}
+
+/**
+ * Links widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Links extends WP_Widget {
+
+       function WP_Widget_Links() {
+               $widget_ops = array('description' => __( "Your blogroll" ) );
+               $this->WP_Widget('links', __('Links'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract($args, EXTR_SKIP);
+
+               $show_description = isset($instance['description']) ? $instance['description'] : false;
+               $show_name = isset($instance['name']) ? $instance['name'] : false;
+               $show_rating = isset($instance['rating']) ? $instance['rating'] : false;
+               $show_images = isset($instance['images']) ? $instance['images'] : true;
+               $category = isset($instance['category']) ? $instance['category'] : false;
+
+               if ( is_admin() && !$category ) {
+                       // Display All Links widget as such in the widgets screen
+                       echo $before_widget . $before_title. __('All Links') . $after_title . $after_widget;
+                       return;
+               }
+
+               $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
+               wp_list_bookmarks(apply_filters('widget_links_args', array(
+                       'title_before' => $before_title, 'title_after' => $after_title,
+                       'category_before' => $before_widget, 'category_after' => $after_widget,
+                       'show_images' => $show_images, 'show_description' => $show_description,
+                       'show_name' => $show_name, 'show_rating' => $show_rating,
+                       'category' => $category, 'class' => 'linkcat widget'
+               )));
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $new_instance = (array) $new_instance;
+               $instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0);
+               foreach ( $instance as $field => $val ) {
+                       if ( isset($new_instance[$field]) )
+                               $instance[$field] = 1;
+               }
+               $instance['category'] = intval($new_instance['category']);
+
+               return $instance;
+       }
+
+       function form( $instance ) {
+
+               //Defaults
+               $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false ) );
+               $link_cats = get_terms( 'link_category');
+?>
+               <p>
+               <label for="<?php echo $this->get_field_id('category'); ?>" class="screen-reader-text"><?php _e('Select Link Category'); ?></label>
+               <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>">
+               <option value=""><?php _e('All Links'); ?></option>
+               <?php
+               foreach ( $link_cats as $link_cat ) {
+                       echo '<option value="' . intval($link_cat->term_id) . '"'
+                               . ( $link_cat->term_id == $instance['category'] ? ' selected="selected"' : '' )
+                               . '>' . $link_cat->name . "</option>\n";
+               }
+               ?>
+               </select></p>
+               <p>
+               <input class="checkbox" type="checkbox" <?php checked($instance['images'], true) ?> id="<?php echo $this->get_field_id('images'); ?>" name="<?php echo $this->get_field_name('images'); ?>" />
+               <label for="<?php echo $this->get_field_id('images'); ?>"><?php _e('Show Link Image'); ?></label><br />
+               <input class="checkbox" type="checkbox" <?php checked($instance['name'], true) ?> id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" />
+               <label for="<?php echo $this->get_field_id('name'); ?>"><?php _e('Show Link Name'); ?></label><br />
+               <input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>" />
+               <label for="<?php echo $this->get_field_id('description'); ?>"><?php _e('Show Link Description'); ?></label><br />
+               <input class="checkbox" type="checkbox" <?php checked($instance['rating'], true) ?> id="<?php echo $this->get_field_id('rating'); ?>" name="<?php echo $this->get_field_name('rating'); ?>" />
+               <label for="<?php echo $this->get_field_id('rating'); ?>"><?php _e('Show Link Rating'); ?></label>
+               </p>
+<?php
+       }
+}
+
+/**
+ * Search widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Search extends WP_Widget {
+
+       function WP_Widget_Search() {
+               $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") );
+               $this->WP_Widget('search', __('Search'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract($args);
+               $title = apply_filters('widget_title', $instance['title']);
+
+               echo $before_widget;
+               if ( $title )
+                       echo $before_title . $title . $after_title;
+
+               // Use current theme search form if it exists
+               get_search_form();
+
+               echo $after_widget;
+       }
+
+       function form( $instance ) {
+               $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
+               $title = $instance['title'];
+?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
+<?php
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
+               $instance['title'] = strip_tags($new_instance['title']);
+               return $instance;
+       }
+
+}
+
+/**
+ * Archives widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Archives extends WP_Widget {
+
+       function WP_Widget_Archives() {
+               $widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your blog&#8217;s posts') );
+               $this->WP_Widget('archives', __('Archives'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract($args);
+               $c = $instance['count'] ? '1' : '0';
+               $d = $instance['dropdown'] ? '1' : '0';
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title']);
+
+               echo $before_widget;
+               if ( $title )
+                       echo $before_title . $title . $after_title;
+
+               if ( $d ) {
+?>
+               <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr(__('Select Month')); ?></option> <?php wp_get_archives(apply_filters('widget_archives_dropdown_args', array('type' => 'monthly', 'format' => 'option', 'show_post_count' => $c))); ?> </select>
+<?php
+               } else {
+?>
+               <ul>
+               <?php wp_get_archives(apply_filters('widget_archives_args', array('type' => 'monthly', 'show_post_count' => $c))); ?>
+               </ul>
+<?php
+               }
+
+               echo $after_widget;
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
+               $instance['title'] = strip_tags($new_instance['title']);
+               $instance['count'] = $new_instance['count'] ? 1 : 0;
+               $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
+
+               return $instance;
+       }
+
+       function form( $instance ) {
+               $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
+               $title = strip_tags($instance['title']);
+               $count = $instance['count'] ? 'checked="checked"' : '';
+               $dropdown = $instance['dropdown'] ? 'checked="checked"' : '';
+?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+               <p>
+                       <input class="checkbox" type="checkbox" <?php echo $count; ?> id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Show post counts'); ?></label>
+                       <br />
+                       <input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>" /> <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e('Display as a drop down'); ?></label>
+               </p>
+<?php
+       }
+}
+
+/**
+ * Meta widget class
+ *
+ * Displays log in/out, RSS feed links, etc.
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Meta extends WP_Widget {
+
+       function WP_Widget_Meta() {
+               $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
+               $this->WP_Widget('meta', __('Meta'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract($args);
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title']);
+
+               echo $before_widget;
+               if ( $title )
+                       echo $before_title . $title . $after_title;
+?>
+                       <ul>
+                       <?php wp_register(); ?>
+                       <li><?php wp_loginout(); ?></li>
+                       <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
+                       <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo esc_attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
+                       <li><a href="http://wordpress.org/" title="<?php echo esc_attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
+                       <?php wp_meta(); ?>
+                       </ul>
+<?php
+               echo $after_widget;
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $instance['title'] = strip_tags($new_instance['title']);
+
+               return $instance;
+       }
+
+       function form( $instance ) {
+               $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
+               $title = strip_tags($instance['title']);
+?>
+                       <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+<?php
+       }
+}
+
+/**
+ * Calendar widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Calendar extends WP_Widget {
+
+       function WP_Widget_Calendar() {
+               $widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your blog&#8217;s posts') );
+               $this->WP_Widget('calendar', __('Calendar'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract($args);
+               $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
+               echo $before_widget;
+               if ( $title )
+                       echo $before_title . $title . $after_title;
+               echo '<div id="calendar_wrap">';
+               get_calendar();
+               echo '</div>';
+               echo $after_widget;
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $instance['title'] = strip_tags($new_instance['title']);
+
+               return $instance;
+       }
+
+       function form( $instance ) {
+               $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
+               $title = strip_tags($instance['title']);
+?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
+               <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+<?php
+       }
+}
+
+/**
+ * Text widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Text extends WP_Widget {
+
+       function WP_Widget_Text() {
+               $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));
+               $control_ops = array('width' => 400, 'height' => 350);
+               $this->WP_Widget('text', __('Text'), $widget_ops, $control_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract($args);
+               $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
+               $text = apply_filters( 'widget_text', $instance['text'] );
+               echo $before_widget;
+               if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
+                       <div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>
+               <?php
+               echo $after_widget;
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $instance['title'] = strip_tags($new_instance['title']);
+               if ( current_user_can('unfiltered_html') )
+                       $instance['text'] =  $new_instance['text'];
+               else
+                       $instance['text'] = wp_filter_post_kses( $new_instance['text'] );
+               $instance['filter'] = isset($new_instance['filter']);
+               return $instance;
+       }
+
+       function form( $instance ) {
+               $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
+               $title = strip_tags($instance['title']);
+               $text = format_to_edit($instance['text']);
+?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
+               <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+
+               <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
+
+               <p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked($instance['filter']); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs.'); ?></label></p>
+<?php
+       }
+}
+
+/**
+ * Categories widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Categories extends WP_Widget {
+
+       function WP_Widget_Categories() {
+               $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories" ) );
+               $this->WP_Widget('categories', __('Categories'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract( $args );
+
+               $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title']);
+               $c = $instance['count'] ? '1' : '0';
+               $h = $instance['hierarchical'] ? '1' : '0';
+               $d = $instance['dropdown'] ? '1' : '0';
+
+               echo $before_widget;
+               if ( $title )
+                       echo $before_title . $title . $after_title;
+
+               $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
+
+               if ( $d ) {
+                       $cat_args['show_option_none'] = __('Select Category');
+                       wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args));
+?>
+
+<script type='text/javascript'>
+/* <![CDATA[ */
+       var dropdown = document.getElementById("cat");
+       function onCatChange() {
+               if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
+                       location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
+               }
+       }
+       dropdown.onchange = onCatChange;
+/* ]]> */
+</script>
+
+<?php
+               } else {
+?>
+               <ul>
+<?php
+               $cat_args['title_li'] = '';
+               wp_list_categories(apply_filters('widget_categories_args', $cat_args));
+?>
+               </ul>
+<?php
+               }
+
+               echo $after_widget;
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $instance['title'] = strip_tags($new_instance['title']);
+               $instance['count'] = $new_instance['count'] ? 1 : 0;
+               $instance['hierarchical'] = $new_instance['hierarchical'] ? 1 : 0;
+               $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0;
+
+               return $instance;
+       }
+
+       function form( $instance ) {
+               //Defaults
+               $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
+               $title = esc_attr( $instance['title'] );
+               $count = (bool) $instance['count'];
+               $hierarchical = (bool) $instance['hierarchical'];
+               $dropdown = (bool) $instance['dropdown'];
+?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
+               <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
+
+               <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> />
+               <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Show as dropdown' ); ?></label><br />
+
+               <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />
+               <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />
+
+               <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
+               <label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
+<?php
+       }
+
+}
+
+/**
+ * Recent_Posts widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Recent_Posts extends WP_Widget {
+
+       function WP_Widget_Recent_Posts() {
+               $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your blog") );
+               $this->WP_Widget('recent-posts', __('Recent Posts'), $widget_ops);
+               $this->alt_option_name = 'widget_recent_entries';
+
+               add_action( 'save_post', array(&$this, 'flush_widget_cache') );
+               add_action( 'deleted_post', array(&$this, 'flush_widget_cache') );
+               add_action( 'switch_theme', array(&$this, 'flush_widget_cache') );
+       }
+
+       function widget($args, $instance) {
+               $cache = wp_cache_get('widget_recent_posts', 'widget');
+
+               if ( !is_array($cache) )
+                       $cache = array();
+
+               if ( isset($cache[$args['widget_id']]) )
+                       return $cache[$args['widget_id']];
+
+               ob_start();
+               extract($args);
+
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title']);
+               if ( !$number = (int) $instance['number'] )
+                       $number = 10;
+               else if ( $number < 1 )
+                       $number = 1;
+               else if ( $number > 15 )
+                       $number = 15;
+
+               $r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
+               if ($r->have_posts()) :
+?>
+               <?php echo $before_widget; ?>
+               <?php if ( $title ) echo $before_title . $title . $after_title; ?>
+               <ul>
+               <?php  while ($r->have_posts()) : $r->the_post(); ?>
+               <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a></li>
+               <?php endwhile; ?>
+               </ul>
+               <?php echo $after_widget; ?>
+<?php
+                       wp_reset_query();  // Restore global post data stomped by the_post().
+               endif;
+
+               $cache[$args['widget_id']] = ob_get_flush();
+               wp_cache_add('widget_recent_posts', $cache, 'widget');
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $instance['title'] = strip_tags($new_instance['title']);
+               $instance['number'] = (int) $new_instance['number'];
+               $this->flush_widget_cache();
+
+               $alloptions = wp_cache_get( 'alloptions', 'options' );
+               if ( isset($alloptions['widget_recent_entries']) )
+                       delete_option('widget_recent_entries');
+
+               return $instance;
+       }
+
+       function flush_widget_cache() {
+               wp_cache_delete('widget_recent_posts', 'widget');
+       }
+
+       function form( $instance ) {
+               $title = esc_attr($instance['title']);
+               if ( !$number = (int) $instance['number'] )
+                       $number = 5;
+?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
+               <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
+
+               <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:'); ?></label>
+               <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /><br />
+               <small><?php _e('(at most 15)'); ?></small></p>
+<?php
+       }
+}
+
+/**
+ * Recent_Comments widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Recent_Comments extends WP_Widget {
+
+       function WP_Widget_Recent_Comments() {
+               $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'The most recent comments' ) );
+               $this->WP_Widget('recent-comments', __('Recent Comments'), $widget_ops);
+               $this->alt_option_name = 'widget_recent_comments';
+
+               if ( is_active_widget(false, false, $this->id_base) )
+                       add_action( 'wp_head', array(&$this, 'recent_comments_style') );
+
+               add_action( 'comment_post', array(&$this, 'flush_widget_cache') );
+               add_action( 'wp_set_comment_status', array(&$this, 'flush_widget_cache') );
+       }
+
+       function recent_comments_style() { ?>
+       <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
+<?php
+       }
+
+       function flush_widget_cache() {
+               wp_cache_delete('recent_comments', 'widget');
+       }
+
+       function widget( $args, $instance ) {
+               global $wpdb, $comments, $comment;
+
+               extract($args, EXTR_SKIP);
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Comments') : $instance['title']);
+               if ( !$number = (int) $instance['number'] )
+                       $number = 5;
+               else if ( $number < 1 )
+                       $number = 1;
+               else if ( $number > 15 )
+                       $number = 15;
+
+               if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
+                       $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 15");
+                       wp_cache_add( 'recent_comments', $comments, 'widget' );
+               }
+
+               $comments = array_slice( (array) $comments, 0, $number );
+?>
+               <?php echo $before_widget; ?>
+                       <?php if ( $title ) echo $before_title . $title . $after_title; ?>
+                       <ul id="recentcomments"><?php
+                       if ( $comments ) : foreach ( (array) $comments as $comment) :
+                       echo  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
+                       endforeach; endif;?></ul>
+               <?php echo $after_widget; ?>
+<?php
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance = $old_instance;
+               $instance['title'] = strip_tags($new_instance['title']);
+               $instance['number'] = (int) $new_instance['number'];
+               $this->flush_widget_cache();
+
+               $alloptions = wp_cache_get( 'alloptions', 'options' );
+               if ( isset($alloptions['widget_recent_comments']) )
+                       delete_option('widget_recent_comments');
+
+               return $instance;
+       }
+
+       function form( $instance ) {
+               $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
+               $number = isset($instance['number']) ? absint($instance['number']) : 5;
+?>
+               <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
+               <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
+
+               <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of comments to show:'); ?></label>
+               <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /><br />
+               <small><?php _e('(at most 15)'); ?></small></p>
+<?php
+       }
+}
+
+/**
+ * RSS widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_RSS extends WP_Widget {
+
+       function WP_Widget_RSS() {
+               $widget_ops = array( 'description' => __('Entries from any RSS or Atom feed') );
+               $control_ops = array( 'width' => 400, 'height' => 200 );
+               $this->WP_Widget( 'rss', __('RSS'), $widget_ops, $control_ops );
+       }
+
+       function widget($args, $instance) {
+
+               if ( isset($instance['error']) && $instance['error'] )
+                       return;
+
+               extract($args, EXTR_SKIP);
+
+               $url = $instance['url'];
+               while ( stristr($url, 'http') != $url )
+                       $url = substr($url, 1);
+
+               if ( empty($url) )
+                       return;
+
+               $rss = fetch_feed($url);
+               $title = $instance['title'];
+               $desc = '';
+               $link = '';
+
+               if ( ! is_wp_error($rss) ) {
+                       $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
+                       if ( empty($title) )
+                               $title = htmlentities(strip_tags($rss->get_title()));
+                       $link = esc_url(strip_tags($rss->get_permalink()));
+                       while ( stristr($link, 'http') != $link )
+                               $link = substr($link, 1);
+               }
+
+               if ( empty($title) )
+                       $title = empty($desc) ? __('Unknown Feed') : $desc;
+
+               $title = apply_filters('widget_title', $title );
+               $url = esc_url(strip_tags($url));
+               $icon = includes_url('images/rss.png');
+               if ( $title )
+                       $title = "<a class='rsswidget' href='$url' title='" . esc_attr(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
+
+               echo $before_widget;
+               if ( $title )
+                       echo $before_title . $title . $after_title;
+               wp_widget_rss_output( $rss, $instance );
+               echo $after_widget;
+       }
+
+       function update($new_instance, $old_instance) {
+               $testurl = $new_instance['url'] != $old_instance['url'];
+               return wp_widget_rss_process( $new_instance, $testurl );
+       }
+
+       function form($instance) {
+
+               if ( empty($instance) )
+                       $instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 );
+               $instance['number'] = $this->number;
+
+               wp_widget_rss_form( $instance );
+       }
+}
+
+/**
+ * Display the RSS entries in a list.
+ *
+ * @since 2.5.0
+ *
+ * @param string|array|object $rss RSS url.
+ * @param array $args Widget arguments.
+ */
+function wp_widget_rss_output( $rss, $args = array() ) {
+       if ( is_string( $rss ) ) {
+               $rss = fetch_feed($rss);
+       } elseif ( is_array($rss) && isset($rss['url']) ) {
+               $args = $rss;
+               $rss = fetch_feed($rss['url']);
+       } elseif ( !is_object($rss) ) {
+               return;
+       }
+
+       if ( is_wp_error($rss) ) {
+               if ( is_admin() || current_user_can('manage_options') )
+                       echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
+
+               return;
+       }
+
+       $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 );
+       $args = wp_parse_args( $args, $default_args );
+       extract( $args, EXTR_SKIP );
+
+       $items = (int) $items;
+       if ( $items < 1 || 20 < $items )
+               $items = 10;
+       $show_summary  = (int) $show_summary;
+       $show_author   = (int) $show_author;
+       $show_date     = (int) $show_date;
+
+       if ( !$rss->get_item_quantity() ) {
+               echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
+               return;
+       }
+
+       echo '<ul>';
+       foreach ( $rss->get_items(0, $items) as $item ) {
+               $link = $item->get_link();
+               while ( stristr($link, 'http') != $link )
+                       $link = substr($link, 1);
+               $link = esc_url(strip_tags($link));
+               $title = esc_attr(strip_tags($item->get_title()));
+               if ( empty($title) )
+                       $title = __('Untitled');
+
+               $desc = str_replace(array("\n", "\r"), ' ', esc_attr(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
+               $desc = wp_html_excerpt( $desc, 360 ) . ' [&hellip;]';
+               $desc = esc_html( $desc );
+
+               if ( $show_summary ) {
+                       $summary = "<div class='rssSummary'>$desc</div>";
+               } else {
+                       $summary = '';
+               }
+
+               $date = '';
+               if ( $show_date ) {
+                       $date = $item->get_date();
+
+                       if ( $date ) {
+                               if ( $date_stamp = strtotime( $date ) )
+                                       $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
+                               else
+                                       $date = '';
+                       }
+               }
+
+               $author = '';
+               if ( $show_author ) {
+                       $author = $item->get_author();
+                       if ( is_object($author) ) {
+                               $author = $author->get_name();
+                               $author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
+                       }
+               }
+
+               if ( $link == '' ) {
+                       echo "<li>$title{$date}{$summary}{$author}</li>";
+               } else {
+                       echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
+               }
+       }
+       echo '</ul>';
+}
+
+
+
+/**
+ * Display RSS widget options form.
+ *
+ * The options for what fields are displayed for the RSS form are all booleans
+ * and are as follows: 'url', 'title', 'items', 'show_summary', 'show_author',
+ * 'show_date'.
+ *
+ * @since 2.5.0
+ *
+ * @param array|string $args Values for input fields.
+ * @param array $inputs Override default display options.
+ */
+function wp_widget_rss_form( $args, $inputs = null ) {
+
+       $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true );
+       $inputs = wp_parse_args( $inputs, $default_inputs );
+       extract( $args );
+       extract( $inputs, EXTR_SKIP);
+
+       $number = esc_attr( $number );
+       $title  = esc_attr( $title );
+       $url    = esc_url( $url );
+       $items  = (int) $items;
+       if ( $items < 1 || 20 < $items )
+               $items  = 10;
+       $show_summary   = (int) $show_summary;
+       $show_author    = (int) $show_author;
+       $show_date      = (int) $show_date;
+
+       if ( !empty($error) )
+               echo '<p class="widget-error"><strong>' . sprintf( __('RSS Error: %s'), $error) . '</strong></p>';
+
+       if ( $inputs['url'] ) :
+?>
+       <p><label for="rss-url-<?php echo $number; ?>"><?php _e('Enter the RSS feed URL here:'); ?></label>
+       <input class="widefat" id="rss-url-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][url]" type="text" value="<?php echo $url; ?>" /></p>
+<?php endif; if ( $inputs['title'] ) : ?>
+       <p><label for="rss-title-<?php echo $number; ?>"><?php _e('Give the feed a title (optional):'); ?></label>
+       <input class="widefat" id="rss-title-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" /></p>
+<?php endif; if ( $inputs['items'] ) : ?>
+       <p><label for="rss-items-<?php echo $number; ?>"><?php _e('How many items would you like to display?'); ?></label>
+       <select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]">
+<?php
+               for ( $i = 1; $i <= 20; ++$i )
+                       echo "<option value='$i' " . ( $items == $i ? "selected='selected'" : '' ) . ">$i</option>";
+?>
+       </select></p>
+<?php endif; if ( $inputs['show_summary'] ) : ?>
+       <p><input id="rss-show-summary-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_summary]" type="checkbox" value="1" <?php if ( $show_summary ) echo 'checked="checked"'; ?>/>
+       <label for="rss-show-summary-<?php echo $number; ?>"><?php _e('Display item content?'); ?></label></p>
+<?php endif; if ( $inputs['show_author'] ) : ?>
+       <p><input id="rss-show-author-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_author]" type="checkbox" value="1" <?php if ( $show_author ) echo 'checked="checked"'; ?>/>
+       <label for="rss-show-author-<?php echo $number; ?>"><?php _e('Display item author if available?'); ?></label></p>
+<?php endif; if ( $inputs['show_date'] ) : ?>
+       <p><input id="rss-show-date-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_date]" type="checkbox" value="1" <?php if ( $show_date ) echo 'checked="checked"'; ?>/>
+       <label for="rss-show-date-<?php echo $number; ?>"><?php _e('Display item date?'); ?></label></p>
+<?php
+       endif;
+       foreach ( array_keys($default_inputs) as $input ) :
+               if ( 'hidden' === $inputs[$input] ) :
+                       $id = str_replace( '_', '-', $input );
+?>
+       <input type="hidden" id="rss-<?php echo $id; ?>-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][<?php echo $input; ?>]" value="<?php echo $$input; ?>" />
+<?php
+               endif;
+       endforeach;
+}
+
+/**
+ * Process RSS feed widget data and optionally retrieve feed items.
+ *
+ * The feed widget can not have more than 20 items or it will reset back to the
+ * default, which is 10.
+ *
+ * The resulting array has the feed title, feed url, feed link (from channel),
+ * feed items, error (if any), and whether to show summary, author, and date.
+ * All respectively in the order of the array elements.
+ *
+ * @since 2.5.0
+ *
+ * @param array $widget_rss RSS widget feed data. Expects unescaped data.
+ * @param bool $check_feed Optional, default is true. Whether to check feed for errors.
+ * @return array
+ */
+function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
+       $items = (int) $widget_rss['items'];
+       if ( $items < 1 || 20 < $items )
+               $items = 10;
+       $url           = esc_url_raw(strip_tags( $widget_rss['url'] ));
+       $title         = trim(strip_tags( $widget_rss['title'] ));
+       $show_summary  = (int) $widget_rss['show_summary'];
+       $show_author   = (int) $widget_rss['show_author'];
+       $show_date     = (int) $widget_rss['show_date'];
+
+       if ( $check_feed ) {
+               $rss = fetch_feed($url);
+               $error = false;
+               $link = '';
+               if ( is_wp_error($rss) ) {
+                       $error = $rss->get_error_message();
+               } else {
+                       $link = esc_url(strip_tags($rss->get_permalink()));
+                       while ( stristr($link, 'http') != $link )
+                               $link = substr($link, 1);
+               }
+       }
+
+       return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' );
+}
+
+/**
+ * Tag cloud widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Tag_Cloud extends WP_Widget {
+
+       function WP_Widget_Tag_Cloud() {
+               $widget_ops = array( 'description' => __( "Your most used tags in cloud format") );
+               $this->WP_Widget('tag_cloud', __('Tag Cloud'), $widget_ops);
+       }
+
+       function widget( $args, $instance ) {
+               extract($args);
+               $title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title']);
+
+               echo $before_widget;
+               if ( $title )
+                       echo $before_title . $title . $after_title;
+               echo '<div>';
+               wp_tag_cloud(apply_filters('widget_tag_cloud_args', array()));
+               echo "</div>\n";
+               echo $after_widget;
+       }
+
+       function update( $new_instance, $old_instance ) {
+               $instance['title'] = strip_tags(stripslashes($new_instance['title']));
+               return $instance;
+       }
+
+       function form( $instance ) {
+?>
+       <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
+       <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
+<?php
+       }
+}
+
+/**
+ * Register all of the default WordPress widgets on startup.
+ *
+ * Calls 'widgets_init' action after all of the WordPress widgets have been
+ * registered.
+ *
+ * @since 2.2.0
+ */
+function wp_widgets_init() {
+       if ( !is_blog_installed() )
+               return;
+
+       register_widget('WP_Widget_Pages');
+
+       register_widget('WP_Widget_Calendar');
+
+       register_widget('WP_Widget_Archives');
+
+       register_widget('WP_Widget_Links');
+
+       register_widget('WP_Widget_Meta');
+
+       register_widget('WP_Widget_Search');
+
+       register_widget('WP_Widget_Text');
+
+       register_widget('WP_Widget_Categories');
+
+       register_widget('WP_Widget_Recent_Posts');
+
+       register_widget('WP_Widget_Recent_Comments');
+
+       register_widget('WP_Widget_RSS');
+
+       register_widget('WP_Widget_Tag_Cloud');
+
+       do_action('widgets_init');
+}
+
+add_action('init', 'wp_widgets_init', 1);
index bcbec3bb8692fe439e011a8636c18bbd92c13d8d..010eb78ee104ff37fa950af45bcc2f52d7ec727d 100644 (file)
@@ -748,14 +748,13 @@ function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = '
 
 /**
  * @since 2.1
 
 /**
  * @since 2.1
- * @deprecated Use wp_print_scripts() or WP_Scripts.
- * @see wp_print_scripts()
- * @see WP_Scripts
+ * @deprecated Use wp_tiny_mce().
+ * @see wp_tiny_mce()
  */
 function tinymce_include() {
  */
 function tinymce_include() {
-       _deprecated_function(__FUNCTION__, '0.0', 'wp_print_scripts()/WP_Scripts');
+       _deprecated_function(__FUNCTION__, '0.0', 'wp_tiny_mce()');
 
 
-       wp_print_script('wp_tiny_mce');
+       wp_tiny_mce();
 }
 
 /**
 }
 
 /**
@@ -1002,13 +1001,13 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
                        $output .= get_option('links_recently_updated_prepend');
                $the_link = '#';
                if ( !empty($row->link_url) )
                        $output .= get_option('links_recently_updated_prepend');
                $the_link = '#';
                if ( !empty($row->link_url) )
-                       $the_link = clean_url($row->link_url);
+                       $the_link = esc_url($row->link_url);
                $rel = $row->link_rel;
                if ( '' != $rel )
                        $rel = ' rel="' . $rel . '"';
 
                $rel = $row->link_rel;
                if ( '' != $rel )
                        $rel = ' rel="' . $rel . '"';
 
-               $desc = attribute_escape(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
-               $name = attribute_escape(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
+               $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
+               $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
                $title = $desc;
 
                if ( $show_updated )
                $title = $desc;
 
                if ( $show_updated )
@@ -1304,4 +1303,391 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
        return get_comment($comment_ID, ARRAY_A);
 }
 
        return get_comment($comment_ID, ARRAY_A);
 }
 
+/**
+ * Retrieve the category name by the category ID.
+ *
+ * @since 0.71
+ * @deprecated Use get_cat_name()
+ * @see get_cat_name() get_catname() is deprecated in favor of get_cat_name().
+ *
+ * @param int $cat_ID Category ID
+ * @return string category name
+ */
+function get_catname( $cat_ID ) {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_cat_name()');
+       return get_cat_name( $cat_ID );
+}
+
+/**
+ * Retrieve category children list separated before and after the term IDs.
+ *
+ * @since 1.2.0
+ *
+ * @param int $id Category ID to retrieve children.
+ * @param string $before Optional. Prepend before category term ID.
+ * @param string $after Optional, default is empty string. Append after category term ID.
+ * @param array $visited Optional. Category Term IDs that have already been added.
+ * @return string
+ */
+function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_term_children()');
+       if ( 0 == $id )
+               return '';
+
+       $chain = '';
+       /** TODO: consult hierarchy */
+       $cat_ids = get_all_category_ids();
+       foreach ( (array) $cat_ids as $cat_id ) {
+               if ( $cat_id == $id )
+                       continue;
+
+               $category = get_category( $cat_id );
+               if ( is_wp_error( $category ) )
+                       return $category;
+               if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
+                       $visited[] = $category->term_id;
+                       $chain .= $before.$category->term_id.$after;
+                       $chain .= get_category_children( $category->term_id, $before, $after );
+               }
+       }
+       return $chain;
+}
+
+/**
+ * Retrieve the description of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's description.
+ * @deprecated Use the_author_meta('description')
+ */
+function get_the_author_description() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' );
+       return get_the_author_meta('description');
+}
+
+/**
+ * Display the description of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_description
+ * @since 1.0.0
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('description')
+ */
+function the_author_description() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'description\')' );
+       the_author_meta('description');
+}
+
+/**
+ * Retrieve the login name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's login name (username).
+ * @deprecated Use the_author_meta('login')
+ */
+function get_the_author_login() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' );
+       return get_the_author_meta('login');
+}
+
+/**
+ * Display the login name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_login
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('login')
+ */
+function the_author_login() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'login\')' );
+       the_author_meta('login');
+}
+
+/**
+ * Retrieve the first name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's first name.
+ * @deprecated Use the_author_meta('first_name')
+ */
+function get_the_author_firstname() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' );
+       return get_the_author_meta('first_name');
+}
+
+/**
+ * Display the first name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('first_name')
+ */
+function the_author_firstname() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' );
+       the_author_meta('first_name');
+}
+
+/**
+ * Retrieve the last name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's last name.
+ * @deprecated Use the_author_meta('last_name')
+ */
+function get_the_author_lastname() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' );
+       return get_the_author_meta('last_name');
+}
+
+/**
+ * Display the last name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('last_name')
+ */
+function the_author_lastname() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' );
+       the_author_meta('last_name');
+}
+
+/**
+ * Retrieve the nickname of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's nickname.
+ * @deprecated Use the_author_meta('nickname')
+ */
+function get_the_author_nickname() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' );
+       return get_the_author_meta('nickname');
+}
+
+/**
+ * Display the nickname of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('nickname')
+ */
+function the_author_nickname() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' );
+       the_author_meta('nickname');
+}
+
+/**
+ * Retrieve the email of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's username.
+ * @deprecated Use the_author_meta('email')
+ */
+function get_the_author_email() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' );
+       return get_the_author_meta('email');
+}
+
+/**
+ * Display the email of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_email
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('email')
+ */
+function the_author_email() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'email\')' );
+       the_author_meta('email');
+}
+
+/**
+ * Retrieve the ICQ number of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's ICQ number.
+ * @deprecated Use the_author_meta('icq')
+ */
+function get_the_author_icq() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' );
+       return get_the_author_meta('icq');
+}
+
+/**
+ * Display the ICQ number of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_icq
+ * @since 0.71
+ * @deprecated 2.8
+ * @see get_the_author_icq()
+ * @deprecated Use the_author_meta('icq')
+ */
+function the_author_icq() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'icq\')' );
+       the_author_meta('icq');
+}
+
+/**
+ * Retrieve the Yahoo! IM name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's Yahoo! IM name.
+ * @deprecated Use the_author_meta('yim')
+ */
+function get_the_author_yim() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' );
+       return get_the_author_meta('yim');
+}
+
+/**
+ * Display the Yahoo! IM name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_yim
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('yim')
+ */
+function the_author_yim() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'yim\')' );
+       the_author_meta('yim');
+}
+
+/**
+ * Retrieve the MSN address of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's MSN address.
+ * @deprecated Use the_author_meta('msn')
+ */
+function get_the_author_msn() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' );
+       return get_the_author_meta('msn');
+}
+
+/**
+ * Display the MSN address of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_msn
+ * @since 0.71
+ * @deprecated 2.8
+ * @see get_the_author_msn()
+ * @deprecated Use the_author_meta('msn')
+ */
+function the_author_msn() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'msn\')' );
+       the_author_meta('msn');
+}
+
+/**
+ * Retrieve the AIM address of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's AIM address.
+ * @deprecated Use the_author_meta('aim')
+ */
+function get_the_author_aim() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' );
+       return get_the_author_meta('aim');
+}
+
+/**
+ * Display the AIM address of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_aim
+ * @since 0.71
+ * @deprecated 2.8
+ * @see get_the_author_aim()
+ * @deprecated Use the_author_meta('aim')
+ */
+function the_author_aim() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'aim\')' );
+       the_author_meta('aim');
+}
+
+/**
+ * Retrieve the specified author's preferred display name.
+ *
+ * @since 1.0.0
+ * @deprecated 2.8
+ * @param int $auth_id The ID of the author.
+ * @return string The author's display name.
+ * @deprecated Use the_author_meta('display_name')
+ */
+function get_author_name( $auth_id = false ) {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );
+       return get_the_author_meta('display_name', $auth_id);
+}
+
+/**
+ * Retrieve the URL to the home page of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The URL to the author's page.
+ */
+function get_the_author_url() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' );
+       return get_the_author_meta('url');
+}
+
+/**
+ * Display the URL to the home page of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_url
+ * @since 0.71
+ * @deprecated 2.8
+ */
+function the_author_url() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'url\')' );
+       the_author_meta('url');
+}
+
+/**
+ * Retrieve the ID of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @return int The author's ID.
+ */
+function get_the_author_ID() {
+       _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' );
+       return get_the_author_meta('ID');
+}
+
+/**
+ * Display the ID of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_ID
+ * @since 0.71
+ * @deprecated 2.8
+ * @uses get_the_author_ID()
+*/
+function the_author_ID() {
+       _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
+       the_author_meta('ID');
+}
+
 ?>
\ No newline at end of file
 ?>
\ No newline at end of file
index e51b8da1b05e89f379e4443f0f9b3f6657b16f3f..7f7e6f511a4c4e636284f17ce8bd29a6450114af 100644 (file)
@@ -5,26 +5,26 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-header('Content-Type: application/atom+xml; charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
 echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';
 ?>
 <feed
        xmlns="http://www.w3.org/2005/Atom"
        xml:lang="<?php echo get_option('rss_language'); ?>"
        xmlns:thr="http://purl.org/syndication/thread/1.0"
 echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';
 ?>
 <feed
        xmlns="http://www.w3.org/2005/Atom"
        xml:lang="<?php echo get_option('rss_language'); ?>"
        xmlns:thr="http://purl.org/syndication/thread/1.0"
-       <?php do_action('atom_ns'); ?>
+       <?php do_action('atom_ns'); do_action('atom_comments_ns'); ?>
 >
        <title type="text"><?php
                if ( is_singular() )
                        printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
                elseif ( is_search() )
 >
        <title type="text"><?php
                if ( is_singular() )
                        printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
                elseif ( is_search() )
-                       printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), attribute_escape(get_search_query()));
+                       printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), esc_attr(get_search_query()));
                else
                        printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
        ?></title>
        <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
 
                else
                        printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
        ?></title>
        <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
 
-       <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated>
+       <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>
        <?php the_generator( 'atom' ); ?>
 
 <?php if ( is_singular() ) { ?>
        <?php the_generator( 'atom' ); ?>
 
 <?php if ( is_singular() ) { ?>
@@ -32,7 +32,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
        <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
        <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
 <?php } elseif(is_search()) { ?>
        <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
        <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
 <?php } elseif(is_search()) { ?>
-       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . attribute_escape(get_search_query()); ?>" />
+       <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . esc_attr(get_search_query()); ?>" />
        <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
        <id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
 <?php } else { ?>
        <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
        <id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
 <?php } else { ?>
@@ -40,7 +40,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
        <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
        <id><?php bloginfo_rss('comments_atom_url'); ?></id>
 <?php } ?>
        <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
        <id><?php bloginfo_rss('comments_atom_url'); ?></id>
 <?php } ?>
-
+<?php do_action('comments_atom_head'); ?>
 <?php
 if ( have_comments() ) : while ( have_comments() ) : the_comment();
        $comment_post = get_post($comment->comment_post_ID);
 <?php
 if ( have_comments() ) : while ( have_comments() ) : the_comment();
        $comment_post = get_post($comment->comment_post_ID);
@@ -65,8 +65,8 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
                </author>
 
                <id><?php comment_guid(); ?></id>
                </author>
 
                <id><?php comment_guid(); ?></id>
-               <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true), false); ?></updated>
-               <published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true), false); ?></published>
+               <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></updated>
+               <published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></published>
 <?php if ( post_password_required($comment_post) ) : ?>
                <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
 <?php else : // post pass ?>
 <?php if ( post_password_required($comment_post) ) : ?>
                <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
 <?php else : // post pass ?>
index f75e78466b537cc59d2dfe6a2cb88c810ddc7914..17b7833b7a1bfd43e9c60c8a5a092931996aa149 100644 (file)
@@ -5,11 +5,10 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-header('Content-Type: application/atom+xml; charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
 $more = 1;
 
 $more = 1;
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
 <feed
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:thr="http://purl.org/syndication/thread/1.0"
 <feed
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:thr="http://purl.org/syndication/thread/1.0"
@@ -20,7 +19,7 @@ $more = 1;
        <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
        <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
 
        <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
        <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
 
-       <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated>
+       <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
        <?php the_generator( 'atom' ); ?>
 
        <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
        <?php the_generator( 'atom' ); ?>
 
        <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
@@ -32,8 +31,8 @@ $more = 1;
        <entry>
                <author>
                        <name><?php the_author() ?></name>
        <entry>
                <author>
                        <name><?php the_author() ?></name>
-                       <?php $author_url = get_the_author_url(); if ( !empty($author_url) ) : ?>
-                       <uri><?php the_author_url()?></uri>
+                       <?php $author_url = get_the_author_meta('url'); if ( !empty($author_url) ) : ?>
+                       <uri><?php the_author_meta('url')?></uri>
                        <?php endif; ?>
                </author>
                <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
                        <?php endif; ?>
                </author>
                <title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
index 9be83012e5b3d411b398d7e6e61a5db8cc40fc17..eee132edb4e2f38593289a3ac5db9e671dd45733 100644 (file)
@@ -5,11 +5,10 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-header('Content-Type: application/rdf+xml; charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('rdf') . '; charset=' . get_option('blog_charset'), true);
 $more = 1;
 
 $more = 1;
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
 <rdf:RDF
        xmlns="http://purl.org/rss/1.0/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 <rdf:RDF
        xmlns="http://purl.org/rss/1.0/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -25,7 +24,7 @@ $more = 1;
        <description><?php bloginfo_rss('description') ?></description>
        <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
        <?php the_generator( 'rdf' ); ?>
        <description><?php bloginfo_rss('description') ?></description>
        <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
        <?php the_generator( 'rdf' ); ?>
-       <sy:updatePeriod>hourly</sy:updatePeriod>
+       <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency>1</sy:updateFrequency>
        <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
        <?php do_action('rdf_header'); ?>
        <sy:updateFrequency>1</sy:updateFrequency>
        <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
        <?php do_action('rdf_header'); ?>
index fdeeed87deb3f965d82c8d5f64ba9985d92383ac..e5c2fe830a851d7102df0aadb9d0621bb7d3f19d 100644 (file)
@@ -5,11 +5,10 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
 $more = 1;
 
 $more = 1;
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
 <?php the_generator( 'comment' ); ?>
 <rss version="0.92">
 <channel>
 <?php the_generator( 'comment' ); ?>
 <rss version="0.92">
 <channel>
index 871c5c16e068d0f5d2df4c75e6fb70bc4d169cd1..8232a0f1743a44d58e959cc7830143cb386fb36e 100644 (file)
@@ -5,7 +5,7 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-header('Content-Type: text/xml;charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
 
 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
 ?>
 
 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
 ?>
@@ -14,20 +14,21 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+       <?php do_action('rss2_ns'); do_action('rss2_comments_ns'); ?>
        >
 <channel>
        <title><?php
                if ( is_singular() )
                        printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
                elseif ( is_search() )
        >
 <channel>
        <title><?php
                if ( is_singular() )
                        printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
                elseif ( is_search() )
-                       printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s']));
+                       printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), esc_attr($wp_query->query_vars['s']));
                else
                        printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
        ?></title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
        <description><?php bloginfo_rss("description") ?></description>
                else
                        printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
        ?></title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
        <description><?php bloginfo_rss("description") ?></description>
-       <pubDate><?php echo gmdate('r'); ?></pubDate>
+       <lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
        <?php the_generator( 'rss2' ); ?>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
        <?php the_generator( 'rss2' ); ?>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
@@ -49,7 +50,7 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
                ?></title>
                <link><?php comment_link() ?></link>
                <dc:creator><?php echo get_comment_author_rss() ?></dc:creator>
                ?></title>
                <link><?php comment_link() ?></link>
                <dc:creator><?php echo get_comment_author_rss() ?></dc:creator>
-               <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
+               <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate>
                <guid isPermaLink="false"><?php comment_guid() ?></guid>
 <?php if ( post_password_required($comment_post) ) : ?>
                <description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
                <guid isPermaLink="false"><?php comment_guid() ?></guid>
 <?php if ( post_password_required($comment_post) ) : ?>
                <description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
index 77e17d546ff79b36e77f84142ba1d598a8362a6d..c4299cbea8363151a4d5d2a384b322a2afeea4e6 100644 (file)
@@ -5,11 +5,10 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
 $more = 1;
 
 $more = 1;
 
-?>
-<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
 
 <rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
 
 <rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
@@ -17,6 +16,7 @@ $more = 1;
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+       xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
        <?php do_action('rss2_ns'); ?>
 >
 
        <?php do_action('rss2_ns'); ?>
 >
 
@@ -25,7 +25,7 @@ $more = 1;
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss("description") ?></description>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss("description") ?></description>
-       <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
+       <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
        <?php the_generator( 'rss2' ); ?>
        <language><?php echo get_option('rss_language'); ?></language>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <?php the_generator( 'rss2' ); ?>
        <language><?php echo get_option('rss_language'); ?></language>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
@@ -52,6 +52,7 @@ $more = 1;
        <?php endif; ?>
 <?php endif; ?>
                <wfw:commentRss><?php echo get_post_comments_feed_link(); ?></wfw:commentRss>
        <?php endif; ?>
 <?php endif; ?>
                <wfw:commentRss><?php echo get_post_comments_feed_link(); ?></wfw:commentRss>
+               <slash:comments><?php echo get_comments_number(); ?></slash:comments>
 <?php rss_enclosure(); ?>
        <?php do_action('rss2_item'); ?>
        </item>
 <?php rss_enclosure(); ?>
        <?php do_action('rss2_item'); ?>
        </item>
index ad730f3817c84ce9576479f5fc937c03caf8177f..0226356419faa040de7997cf980f95076eec8ca3 100644 (file)
@@ -165,7 +165,7 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
        if ( $cut && !$encode_html )
                $encode_html = 2;
        if ( 1== $encode_html ) {
        if ( $cut && !$encode_html )
                $encode_html = 2;
        if ( 1== $encode_html ) {
-               $content = wp_specialchars($content);
+               $content = esc_html($content);
                $cut = 0;
        } elseif ( 0 == $encode_html ) {
                $content = make_url_footnote($content);
                $cut = 0;
        } elseif ( 0 == $encode_html ) {
                $content = make_url_footnote($content);
@@ -255,7 +255,7 @@ function get_comment_guid($comment_id = null) {
  * @since 1.5.0
  */
 function comment_link() {
  * @since 1.5.0
  */
 function comment_link() {
-       echo clean_url( get_comment_link() );
+       echo esc_url( get_comment_link() );
 }
 
 /**
 }
 
 /**
@@ -336,11 +336,11 @@ function get_the_category_rss($type = 'rss') {
 
        foreach ( $cat_names as $cat_name ) {
                if ( 'rdf' == $type )
 
        foreach ( $cat_names as $cat_name ) {
                if ( 'rdf' == $type )
-                       $the_list .= "\n\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
+                       $the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
                elseif ( 'atom' == $type )
                elseif ( 'atom' == $type )
-                       $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $cat_name ) );
+                       $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), esc_attr( $cat_name ) );
                else
                else
-                       $the_list .= "\n\t\t<category><![CDATA[" . html_entity_decode( $cat_name ) . "]]></category>\n";
+                       $the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n";
        }
 
        return apply_filters('the_category_rss', $the_list, $type);
        }
 
        return apply_filters('the_category_rss', $the_list, $type);
@@ -403,10 +403,10 @@ function rss_enclosure() {
        foreach ( (array) get_post_custom() as $key => $val) {
                if ($key == 'enclosure') {
                        foreach ( (array) $val as $enc ) {
        foreach ( (array) get_post_custom() as $key => $val) {
                if ($key == 'enclosure') {
                        foreach ( (array) $val as $enc ) {
-                               $enclosure = split("\n", $enc);
+                               $enclosure = explode("\n", $enc);
 
                                //only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3'
 
                                //only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3'
-                               $t = split('[ \t]', trim($enclosure[2]) );
+                               $t = preg_split('/[ \t]/', trim($enclosure[2]) );
                                $type = $t[0];
 
                                echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n");
                                $type = $t[0];
 
                                echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n");
@@ -503,7 +503,7 @@ function prep_atom_text_construct($data) {
 function self_link() {
        $host = @parse_url(get_option('home'));
        $host = $host['host'];
 function self_link() {
        $host = @parse_url(get_option('home'));
        $host = $host['host'];
-       echo clean_url(
+       echo esc_url(
                'http'
                . ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://'
                . $host
                'http'
                . ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://'
                . $host
@@ -511,4 +511,51 @@ function self_link() {
                );
 }
 
                );
 }
 
-?>
+/**
+ * Return the content type for specified feed type.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.8.0
+ */
+function feed_content_type( $type = '' ) {
+       if ( empty($type) )
+               $type = get_default_feed();
+
+       $types = array(
+               'rss'  => 'application/rss+xml',
+               'rss2' => 'application/rss+xml',
+               'rss-http'  => 'text/xml',
+               'atom' => 'application/atom+xml',
+               'rdf'  => 'application/rdf+xml'
+       );
+
+       $content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream';
+
+       return apply_filters( 'feed_content_type', $content_type, $type );
+}
+
+/**
+ * Build SimplePie object based on RSS or Atom feed from URL.
+ *
+ * @since 2.8
+ *
+ * @param string $url URL to retrieve feed
+ * @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success
+ */
+function fetch_feed($url) {
+       require_once (ABSPATH . WPINC . '/class-feed.php');
+
+       $feed = new SimplePie();
+       $feed->set_feed_url($url);
+       $feed->set_cache_class('WP_Feed_Cache');
+       $feed->set_file_class('WP_SimplePie_File');
+       $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200));
+       $feed->init();
+       $feed->handle_content_type();
+
+       if ( $feed->error() )
+               return new WP_Error('simplepie-error', $feed->error());
+
+       return $feed;
+}
index 53df8084b23f8d48ed8ce53a583b2212e39aed7d..26bfc694e05c6a63bef0633bfdfe01ca6808bf16 100644 (file)
  */
 function wptexturize($text) {
        global $wp_cockneyreplace;
  */
 function wptexturize($text) {
        global $wp_cockneyreplace;
-       $next = true;
-       $has_pre_parent = false;
        $output = '';
        $curl = '';
        $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
        $stop = count($textarr);
        $output = '';
        $curl = '';
        $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
        $stop = count($textarr);
+       
+       /* translators: opening curly quote */
+       $opening_quote = _x('&#8220;', 'opening curly quote');
+       /* translators: closing curly quote */
+       $closing_quote = _x('&#8221;', 'closing curly quote');
+       
+       $no_texturize_tags = apply_filters('no_texturize_tags', array('pre', 'code', 'kbd', 'style', 'script', 'tt'));
+       $no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', array('code'));
+       $no_texturize_tags_stack = array();
+       $no_texturize_shortcodes_stack = array();
 
        // if a plugin has provided an autocorrect array, use it
        if ( isset($wp_cockneyreplace) ) {
 
        // if a plugin has provided an autocorrect array, use it
        if ( isset($wp_cockneyreplace) ) {
@@ -44,28 +52,24 @@ function wptexturize($text) {
                $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
        }
 
                $cockneyreplace = array("&#8217;tain&#8217;t","&#8217;twere","&#8217;twas","&#8217;tis","&#8217;twill","&#8217;til","&#8217;bout","&#8217;nuff","&#8217;round","&#8217;cause");
        }
 
-       $static_characters = array_merge(array('---', ' -- ', '--', 'xn&#8211;', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney);
-       $static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', 'xn--', '&#8230;', '&#8220;', '&#8217;s', '&#8221;', ' &#8482;'), $cockneyreplace);
+       $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney);
+       $static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', $opening_quote, '&#8217;s', $closing_quote, ' &#8482;'), $cockneyreplace);
 
        $dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
 
        $dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
-       $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2');
+       $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '&#8217;$1', '$1&#215;$2');
 
        for ( $i = 0; $i < $stop; $i++ ) {
                $curl = $textarr[$i];
 
 
        for ( $i = 0; $i < $stop; $i++ ) {
                $curl = $textarr[$i];
 
-               if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag
+               if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0}
+                               && empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) { // If it's not a tag
                        // static strings
                        $curl = str_replace($static_characters, $static_replacements, $curl);
                        // regular expressions
                        $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
                        // static strings
                        $curl = str_replace($static_characters, $static_replacements, $curl);
                        // regular expressions
                        $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
-               } elseif (strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
-                       $next = false;
-               } elseif (strpos($curl, '<pre') !== false) {
-                       $has_pre_parent = true;
-               } elseif (strpos($curl, '</pre>') !== false) {
-                       $has_pre_parent = false;
                } else {
                } else {
-                       $next = true;
+                       wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>');
+                       wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']');
                }
 
                $curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&#038;$1', $curl);
                }
 
                $curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&#038;$1', $curl);
@@ -75,6 +79,21 @@ function wptexturize($text) {
        return $output;
 }
 
        return $output;
 }
 
+function wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>') {
+       $o = preg_quote($opening);
+       $c = preg_quote($closing);
+       foreach($disabled_elements as $element) {
+               if (preg_match('/^'.$o.$element.'\b/', $text)) array_push($stack, $element);
+               if (preg_match('/^'.$o.'\/'.$element.$c.'/', $text)) {
+                       $last = array_pop($stack);
+                       // disable texturize until we find a closing tag of our type (e.g. <pre>)
+                       // even if there was invalid nesting before that
+                       // Example: in the case <pre>sadsadasd</code>"baba"</pre> "baba" won't be texturized
+                       if ($last != $element) array_push($stack, $last);
+               }
+       }
+}
+
 /**
  * Accepts matches array from preg_replace_callback in wpautop() or a string.
  *
 /**
  * Accepts matches array from preg_replace_callback in wpautop() or a string.
  *
@@ -114,10 +133,12 @@ function clean_pre($matches) {
  * @return string Text which has been converted into correct paragraph tags.
  */
 function wpautop($pee, $br = 1) {
  * @return string Text which has been converted into correct paragraph tags.
  */
 function wpautop($pee, $br = 1) {
+       if ( trim($pee) === '' )
+               return '';
        $pee = $pee . "\n"; // just to make things a little easier, pad the end
        $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
        // Space things out a little
        $pee = $pee . "\n"; // just to make things a little easier, pad the end
        $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
        // Space things out a little
-       $allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
+       $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
        $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
        $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
        $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
        $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
        $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
        $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
@@ -131,9 +152,8 @@ function wpautop($pee, $br = 1) {
        $pee = '';
        foreach ( $pees as $tinkle )
                $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
        $pee = '';
        foreach ( $pees as $tinkle )
                $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
-       $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
-       $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*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
+       $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
        $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
        $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
        $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
        $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
@@ -148,7 +168,7 @@ function wpautop($pee, $br = 1) {
        $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
        $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
        if (strpos($pee, '<pre') !== false)
        $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
        $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
        if (strpos($pee, '<pre') !== false)
-               $pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee );
+               $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
        $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
        $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone
 
        $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
        $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone
 
@@ -158,26 +178,29 @@ function wpautop($pee, $br = 1) {
 /**
  * Checks to see if a string is utf8 encoded.
  *
 /**
  * Checks to see if a string is utf8 encoded.
  *
- * @author bmorel at ssi dot fr
+ * NOTE: This function checks for 5-Byte sequences, UTF8
+ *       has Bytes Sequences with a maximum length of 4.
  *
  *
+ * @author bmorel at ssi dot fr (modified)
  * @since 1.2.1
  *
  * @since 1.2.1
  *
- * @param string $Str The string to be checked
- * @return bool True if $Str fits a UTF-8 model, false otherwise.
+ * @param string $str The string to be checked
+ * @return bool True if $str fits a UTF-8 model, false otherwise.
  */
  */
-function seems_utf8($Str) { # by bmorel at ssi dot fr
-       $length = strlen($Str);
+function seems_utf8($str) {
+       $length = strlen($str);
        for ($i=0; $i < $length; $i++) {
        for ($i=0; $i < $length; $i++) {
-               if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb
-               elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb
-               elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n=2; # 1110bbbb
-               elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n=3; # 11110bbb
-               elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n=4; # 111110bb
-               elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b
+               $c = ord($str[$i]);
+               if ($c < 0x80) $n = 0; # 0bbbbbbb
+               elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb
+               elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb
+               elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb
+               elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb
+               elseif (($c & 0xFE) == 0xFC) $n=5; # 1111110b
                else return false; # Does not match any model
                for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
                else return false; # Does not match any model
                for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
-                       if ((++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80))
-                       return false;
+                       if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
+                               return false;
                }
        }
        return true;
                }
        }
        return true;
@@ -199,8 +222,7 @@ function seems_utf8($Str) { # by bmorel at ssi dot fr
  * @param boolean $double_encode Optional. Whether or not to encode existing html entities. Default is false.
  * @return string The encoded text with HTML entities.
  */
  * @param boolean $double_encode Optional. Whether or not to encode existing html entities. Default is false.
  * @return string The encoded text with HTML entities.
  */
-function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false )
-{
+function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
        $string = (string) $string;
 
        if ( 0 === strlen( $string ) ) {
        $string = (string) $string;
 
        if ( 0 === strlen( $string ) ) {
@@ -244,7 +266,7 @@ function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false
        // Handle double encoding ourselves
        if ( !$double_encode ) {
                $string = wp_specialchars_decode( $string, $_quote_style );
        // Handle double encoding ourselves
        if ( !$double_encode ) {
                $string = wp_specialchars_decode( $string, $_quote_style );
-               $string = preg_replace( '/&(#?x?[0-9]+|[a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
+               $string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
        }
 
        $string = @htmlspecialchars( $string, $quote_style, $charset );
        }
 
        $string = @htmlspecialchars( $string, $quote_style, $charset );
@@ -273,11 +295,10 @@ function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false
  * @since 2.8
  *
  * @param string $string The text which is to be decoded.
  * @since 2.8
  *
  * @param string $string The text which is to be decoded.
- * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old wp_specialchars() values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
+ * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old _wp_specialchars() values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
  * @return string The decoded text without HTML entities.
  */
  * @return string The decoded text without HTML entities.
  */
-function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES )
-{
+function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
        $string = (string) $string;
 
        if ( 0 === strlen( $string ) ) {
        $string = (string) $string;
 
        if ( 0 === strlen( $string ) ) {
@@ -289,7 +310,7 @@ function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES )
                return $string;
        }
 
                return $string;
        }
 
-       // Match the previous behaviour of wp_specialchars() when the $quote_style is not an accepted value
+       // Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value
        if ( empty( $quote_style ) ) {
                $quote_style = ENT_NOQUOTES;
        } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
        if ( empty( $quote_style ) ) {
                $quote_style = ENT_NOQUOTES;
        } elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
@@ -334,8 +355,7 @@ function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES )
  * @param boolean $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
  * @return string The checked text.
  */
  * @param boolean $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
  * @return string The checked text.
  */
-function wp_check_invalid_utf8( $string, $strip = false )
-{
+function wp_check_invalid_utf8( $string, $strip = false ) {
        $string = (string) $string;
 
        if ( 0 === strlen( $string ) ) {
        $string = (string) $string;
 
        if ( 0 === strlen( $string ) ) {
@@ -565,27 +585,27 @@ function remove_accents($string) {
 }
 
 /**
 }
 
 /**
- * Filters certain characters from the file name.
+ * Sanitizes a filename replacing whitespace with dashes
  *
  *
- * Turns all strings to lowercase removing most characters except alphanumeric
- * with spaces, dashes and periods. All spaces and underscores are converted to
- * dashes. Multiple dashes are converted to a single dash. Finally, if the file
- * name ends with a dash, it is removed.
+ * Removes special characters that are illegal in filenames on certain
+ * operating systems and special characters requiring special escaping
+ * to manipulate at the command line. Replaces spaces and consecutive
+ * dashes with a single dash. Trim period, dash and underscore from beginning
+ * and end of filename.
  *
  * @since 2.1.0
  *
  *
  * @since 2.1.0
  *
- * @param string $name The file name
- * @return string Sanitized file name
+ * @param string $filename The filename to be sanitized
+ * @return string The sanitized filename
  */
  */
-function sanitize_file_name( $name ) { // Like sanitize_title, but with periods
-       $name = strtolower( $name );
-       $name = preg_replace('/&.+?;/', '', $name); // kill entities
-       $name = str_replace( '_', '-', $name );
-       $name = preg_replace('/[^a-z0-9\s-.]/', '', $name);
-       $name = preg_replace('/\s+/', '-', $name);
-       $name = preg_replace('|-+|', '-', $name);
-       $name = trim($name, '-');
-       return $name;
+function sanitize_file_name( $filename ) {
+       $filename_raw = $filename;
+       $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}");
+       $special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw);
+       $filename = str_replace($special_chars, '', $filename);
+       $filename = preg_replace('/[\s-]+/', '-', $filename);
+       $filename = trim($filename, '.-_');
+       return apply_filters('sanitize_file_name', $filename, $filename_raw);
 }
 
 /**
 }
 
 /**
@@ -637,8 +657,9 @@ function sanitize_user( $username, $strict = false ) {
  * @return string The sanitized string.
  */
 function sanitize_title($title, $fallback_title = '') {
  * @return string The sanitized string.
  */
 function sanitize_title($title, $fallback_title = '') {
+       $raw_title = $title;
        $title = strip_tags($title);
        $title = strip_tags($title);
-       $title = apply_filters('sanitize_title', $title);
+       $title = apply_filters('sanitize_title', $title, $raw_title);
 
        if ( '' === $title || false === $title )
                $title = $fallback_title;
 
        if ( '' === $title || false === $title )
                $title = $fallback_title;
@@ -676,6 +697,7 @@ function sanitize_title_with_dashes($title) {
 
        $title = strtolower($title);
        $title = preg_replace('/&.+?;/', '', $title); // kill entities
 
        $title = strtolower($title);
        $title = preg_replace('/&.+?;/', '', $title); // kill entities
+       $title = str_replace('.', '-', $title);
        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
        $title = preg_replace('/\s+/', '-', $title);
        $title = preg_replace('|-+|', '-', $title);
        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
        $title = preg_replace('/\s+/', '-', $title);
        $title = preg_replace('|-+|', '-', $title);
@@ -702,6 +724,33 @@ function sanitize_sql_orderby( $orderby ){
        return $orderby;
 }
 
        return $orderby;
 }
 
+/**
+ * Santizes a html classname to ensure it only contains valid characters
+ *
+ * Strips the string down to A-Z,a-z,0-9,'-' if this results in an empty
+ * string then it will return the alternative value supplied.
+ *
+ * @todo Expand to support the full range of CDATA that a class attribute can contain.
+ *
+ * @since 2.8.0
+ *
+ * @param string $class The classname to be sanitized
+ * @param string $fallback The value to return if the sanitization end's up as an empty string.
+ * @return string The sanitized value
+ */
+function sanitize_html_class($class, $fallback){
+       //Strip out any % encoded octets
+       $sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $class);
+
+       //Limit to A-Z,a-z,0-9,'-'
+       $sanitized = preg_replace('/[^A-Za-z0-9-]/', '', $sanitized);
+
+       if ('' == $sanitized)
+               $sanitized = $fallback;
+
+       return apply_filters('sanitize_html_class',$sanitized, $class, $fallback);
+}
+
 /**
  * Converts a number of characters from a string.
  *
 /**
  * Converts a number of characters from a string.
  *
@@ -769,6 +818,18 @@ function convert_chars($content, $deprecated = '') {
        return $content;
 }
 
        return $content;
 }
 
+/**
+ * Callback used to change %uXXXX to &#YYY; syntax
+ *
+ * @since 2.8?
+ *
+ * @param array $matches Single Match
+ * @return string An HTML entity
+ */
+function funky_javascript_callback($matches) {
+       return "&#".base_convert($matches[1],16,10).";";
+}
+
 /**
  * Fixes javascript bugs in browsers.
  *
 /**
  * Fixes javascript bugs in browsers.
  *
@@ -785,9 +846,10 @@ function funky_javascript_fix($text) {
        // Fixes for browsers' javascript bugs
        global $is_macIE, $is_winIE;
 
        // Fixes for browsers' javascript bugs
        global $is_macIE, $is_winIE;
 
-       /** @todo use preg_replace_callback() instead */
        if ( $is_winIE || $is_macIE )
        if ( $is_winIE || $is_macIE )
-               $text =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $text);
+               $text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
+                                              "funky_javascript_callback",
+                                              $text);
 
        return $text;
 }
 
        return $text;
 }
@@ -848,7 +910,7 @@ function force_balance_tags( $text ) {
                // clear the shifter
                $tagqueue = '';
                // Pop or Push
                // clear the shifter
                $tagqueue = '';
                // Pop or Push
-               if ($regex[1][0] == "/") { // End Tag
+               if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
                        $tag = strtolower(substr($regex[1],1));
                        // if too many closing tags
                        if($stacksize <= 0) {
                        $tag = strtolower(substr($regex[1],1));
                        // if too many closing tags
                        if($stacksize <= 0) {
@@ -1122,17 +1184,11 @@ function antispambot($emailaddy, $mailto=0) {
  * @return string HTML A element with URI address.
  */
 function _make_url_clickable_cb($matches) {
  * @return string HTML A element with URI address.
  */
 function _make_url_clickable_cb($matches) {
-       $ret = '';
        $url = $matches[2];
        $url = $matches[2];
-       $url = clean_url($url);
+       $url = esc_url($url);
        if ( empty($url) )
                return $matches[0];
        if ( empty($url) )
                return $matches[0];
-       // removed trailing [.,;:] from URL
-       if ( in_array(substr($url, -1), array('.', ',', ';', ':')) === true ) {
-               $ret = substr($url, -1);
-               $url = substr($url, 0, strlen($url)-1);
-       }
-       return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $ret;
+       return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>";
 }
 
 /**
 }
 
 /**
@@ -1151,7 +1207,7 @@ function _make_web_ftp_clickable_cb($matches) {
        $ret = '';
        $dest = $matches[2];
        $dest = 'http://' . $dest;
        $ret = '';
        $dest = $matches[2];
        $dest = 'http://' . $dest;
-       $dest = clean_url($dest);
+       $dest = esc_url($dest);
        if ( empty($dest) )
                return $matches[0];
        // removed trailing [,;:] from URL
        if ( empty($dest) )
                return $matches[0];
        // removed trailing [,;:] from URL
@@ -1193,8 +1249,8 @@ function _make_email_clickable_cb($matches) {
 function make_clickable($ret) {
        $ret = ' ' . $ret;
        // in testing, using arrays here was found to be faster
 function make_clickable($ret) {
        $ret = ' ' . $ret;
        // in testing, using arrays here was found to be faster
-       $ret = preg_replace_callback('#([\s>])([\w]+?://[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_url_clickable_cb', $ret);
-       $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_web_ftp_clickable_cb', $ret);
+       $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/\-=?@\[\](+]|[.,;:](?![\s<])|(?(1)\)(?![\s<])|\)))+)#is', '_make_url_clickable_cb', $ret);
+       $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
        $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
        // this one is not in an array because we need it to run last, for cleanup of accidental links within links
        $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
        $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
        // this one is not in an array because we need it to run last, for cleanup of accidental links within links
        $ret = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $ret);
@@ -1236,29 +1292,59 @@ function wp_rel_nofollow_callback( $matches ) {
        return "<a $text rel=\"nofollow\">";
 }
 
        return "<a $text rel=\"nofollow\">";
 }
 
+
+/**
+ * Convert one smiley code to the icon graphic file equivalent.
+ *
+ * Looks up one smiley code in the $wpsmiliestrans global array and returns an
+ * <img> string for that smiley.
+ *
+ * @global array $wpsmiliestrans
+ * @since 2.8.0
+ *
+ * @param string $smiley Smiley code to convert to image.
+ * @return string Image string for smiley.
+ */
+function translate_smiley($smiley) {
+       global $wpsmiliestrans;
+
+       if (count($smiley) == 0) {
+               return '';
+       }
+
+       $siteurl = get_option( 'siteurl' );
+
+       $smiley = trim(reset($smiley));
+       $img = $wpsmiliestrans[$smiley];
+       $smiley_masked = esc_attr($smiley);
+
+       return " <img src='$siteurl/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
+}
+
+
 /**
  * Convert text equivalent of smilies to images.
  *
 /**
  * Convert text equivalent of smilies to images.
  *
- * Will only convert smilies if the option 'use_smilies' is true and the globals
- * used in the function aren't empty.
+ * Will only convert smilies if the option 'use_smilies' is true and the global
+ * used in the function isn't empty.
  *
  * @since 0.71
  *
  * @since 0.71
- * @uses $wp_smiliessearch, $wp_smiliesreplace Smiley replacement arrays.
+ * @uses $wp_smiliessearch
  *
  * @param string $text Content to convert smilies from text.
  * @return string Converted content with text smilies replaced with images.
  */
 function convert_smilies($text) {
  *
  * @param string $text Content to convert smilies from text.
  * @return string Converted content with text smilies replaced with images.
  */
 function convert_smilies($text) {
-       global $wp_smiliessearch, $wp_smiliesreplace;
+       global $wp_smiliessearch;
        $output = '';
        $output = '';
-       if ( get_option('use_smilies') && !empty($wp_smiliessearch) && !empty($wp_smiliesreplace) ) {
+       if ( get_option('use_smilies') && !empty($wp_smiliessearch) ) {
                // HTML loop taken from texturize function, could possible be consolidated
                $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
                $stop = count($textarr);// loop stuff
                for ($i = 0; $i < $stop; $i++) {
                        $content = $textarr[$i];
                        if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
                // HTML loop taken from texturize function, could possible be consolidated
                $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
                $stop = count($textarr);// loop stuff
                for ($i = 0; $i < $stop; $i++) {
                        $content = $textarr[$i];
                        if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
-                               $content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
+                               $content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
                        }
                        $output .= $content;
                }
                        }
                        $output .= $content;
                }
@@ -1270,24 +1356,76 @@ function convert_smilies($text) {
 }
 
 /**
 }
 
 /**
- * Checks to see if the text is a valid email address.
+ * Verifies that an email is valid.
+ *
+ * Does not grok i18n domains. Not RFC compliant.
  *
  * @since 0.71
  *
  *
  * @since 0.71
  *
- * @param string $user_email The email address to be checked.
- * @return bool Returns true if valid, otherwise false.
+ * @param string $email Email address to verify.
+ * @param boolean $check_dns Whether to check the DNS for the domain using checkdnsrr().
+ * @return string|bool Either false or the valid email address.
  */
  */
-function is_email($user_email) {
-       $chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i";
-       if (strpos($user_email, '@') !== false && strpos($user_email, '.') !== false) {
-               if (preg_match($chars, $user_email)) {
-                       return true;
-               } else {
-                       return false;
+function is_email( $email, $check_dns = false ) {
+       // Test for the minimum length the email can be
+       if ( strlen( $email ) < 3 ) {
+               return apply_filters( 'is_email', false, $email, 'email_too_short' );
+       }
+
+       // Test for an @ character after the first position
+       if ( strpos( $email, '@', 1 ) === false ) {
+               return apply_filters( 'is_email', false, $email, 'email_no_at' );
+       }
+
+       // Split out the local and domain parts
+       list( $local, $domain ) = explode( '@', $email, 2 );
+
+       // LOCAL PART
+       // Test for invalid characters
+       if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
+               return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
+       }
+
+       // DOMAIN PART
+       // Test for sequences of periods
+       if ( preg_match( '/\.{2,}/', $domain ) ) {
+               return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
+       }
+
+       // Test for leading and trailing periods and whitespace
+       if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
+               return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
+       }
+
+       // Split the domain into subs
+       $subs = explode( '.', $domain );
+
+       // Assume the domain will have at least two subs
+       if ( 2 > count( $subs ) ) {
+               return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
+       }
+
+       // Loop through each sub
+       foreach ( $subs as $sub ) {
+               // Test for leading and trailing hyphens and whitespace
+               if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
+                       return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
+               }
+
+               // Test for invalid characters
+               if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
+                       return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
                }
                }
-       } else {
-               return false;
        }
        }
+
+       // DNS
+       // Check the domain has a valid MX and A resource record
+       if ( $check_dns && function_exists( 'checkdnsrr' ) && !( checkdnsrr( $domain . '.', 'MX' ) || checkdnsrr( $domain . '.', 'A' ) ) ) {
+               return apply_filters( 'is_email', false, $email, 'dns_no_rr' );
+       }
+
+       // Congratulations your email made it!
+       return apply_filters( 'is_email', $email, $email, null );
 }
 
 /**
 }
 
 /**
@@ -1425,8 +1563,78 @@ function popuplinks($text) {
  * @param string $email Email address to filter.
  * @return string Filtered email address.
  */
  * @param string $email Email address to filter.
  * @return string Filtered email address.
  */
-function sanitize_email($email) {
-       return preg_replace('/[^a-z0-9+_.@-]/i', '', $email);
+function sanitize_email( $email ) {
+       // Test for the minimum length the email can be
+       if ( strlen( $email ) < 3 ) {
+               return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
+       }
+
+       // Test for an @ character after the first position
+       if ( strpos( $email, '@', 1 ) === false ) {
+               return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
+       }
+
+       // Split out the local and domain parts
+       list( $local, $domain ) = explode( '@', $email, 2 );
+
+       // LOCAL PART
+       // Test for invalid characters
+       $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
+       if ( '' === $local ) {
+               return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
+       }
+
+       // DOMAIN PART
+       // Test for sequences of periods
+       $domain = preg_replace( '/\.{2,}/', '', $domain );
+       if ( '' === $domain ) {
+               return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
+       }
+
+       // Test for leading and trailing periods and whitespace
+       $domain = trim( $domain, " \t\n\r\0\x0B." );
+       if ( '' === $domain ) {
+               return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
+       }
+
+       // Split the domain into subs
+       $subs = explode( '.', $domain );
+
+       // Assume the domain will have at least two subs
+       if ( 2 > count( $subs ) ) {
+               return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
+       }
+
+       // Create an array that will contain valid subs
+       $new_subs = array();
+
+       // Loop through each sub
+       foreach ( $subs as $sub ) {
+               // Test for leading and trailing hyphens
+               $sub = trim( $sub, " \t\n\r\0\x0B-" );
+
+               // Test for invalid characters
+               $sub = preg_replace( '/^[^a-z0-9-]+$/i', '', $sub );
+
+               // If there's anything left, add it to the valid subs
+               if ( '' !== $sub ) {
+                       $new_subs[] = $sub;
+               }
+       }
+
+       // If there aren't 2 or more valid subs
+       if ( 2 > count( $new_subs ) ) {
+               return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
+       }
+
+       // Join valid subs into the new domain
+       $domain = join( '.', $new_subs );
+
+       // Put the email back together
+       $email = $local . '@' . $domain;
+
+       // Congratulations your email made it!
+       return apply_filters( 'sanitize_email', $email, $email, null );
 }
 
 /**
 }
 
 /**
@@ -1450,19 +1658,19 @@ function human_time_diff( $from, $to = '' ) {
                if ($mins <= 1) {
                        $mins = 1;
                }
                if ($mins <= 1) {
                        $mins = 1;
                }
-               $since = sprintf(__ngettext('%s min', '%s mins', $mins), $mins);
+               $since = sprintf(_n('%s min', '%s mins', $mins), $mins);
        } else if (($diff <= 86400) && ($diff > 3600)) {
                $hours = round($diff / 3600);
                if ($hours <= 1) {
                        $hours = 1;
                }
        } else if (($diff <= 86400) && ($diff > 3600)) {
                $hours = round($diff / 3600);
                if ($hours <= 1) {
                        $hours = 1;
                }
-               $since = sprintf(__ngettext('%s hour', '%s hours', $hours), $hours);
+               $since = sprintf(_n('%s hour', '%s hours', $hours), $hours);
        } elseif ($diff >= 86400) {
                $days = round($diff / 86400);
                if ($days <= 1) {
                        $days = 1;
                }
        } elseif ($diff >= 86400) {
                $days = round($diff / 86400);
                if ($days <= 1) {
                        $days = 1;
                }
-               $since = sprintf(__ngettext('%s day', '%s days', $days), $days);
+               $since = sprintf(_n('%s day', '%s days', $days), $days);
        }
        return $since;
 }
        }
        return $since;
 }
@@ -1480,6 +1688,7 @@ function human_time_diff( $from, $to = '' ) {
  * @return string The excerpt.
  */
 function wp_trim_excerpt($text) {
  * @return string The excerpt.
  */
 function wp_trim_excerpt($text) {
+       $raw_excerpt = $text;
        if ( '' == $text ) {
                $text = get_the_content('');
 
        if ( '' == $text ) {
                $text = get_the_content('');
 
@@ -1496,7 +1705,7 @@ function wp_trim_excerpt($text) {
                        $text = implode(' ', $words);
                }
        }
                        $text = implode(' ', $words);
                }
        }
-       return $text;
+       return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
 }
 
 /**
 }
 
 /**
@@ -1815,7 +2024,7 @@ function wp_htmledit_pre($output) {
  * Checks and cleans a URL.
  *
  * A number of characters are removed from the URL. If the URL is for displaying
  * Checks and cleans a URL.
  *
  * A number of characters are removed from the URL. If the URL is for displaying
- * (the default behaviour) amperstands are also replaced. The 'clean_url' filter
+ * (the default behaviour) amperstands are also replaced. The 'esc_url' filter
  * is applied to the returned cleaned URL.
  *
  * @since 1.2.0
  * is applied to the returned cleaned URL.
  *
  * @since 1.2.0
@@ -1832,7 +2041,7 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
        $original_url = $url;
 
        if ('' == $url) return $url;
        $original_url = $url;
 
        if ('' == $url) return $url;
-       $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$*\'()\\x80-\\xff]|i', '', $url);
+       $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
        $strip = array('%0d', '%0a');
        $url = str_replace($strip, '', $url);
        $url = str_replace(';//', '://', $url);
        $strip = array('%0d', '%0a');
        $url = str_replace($strip, '', $url);
        $url = str_replace(';//', '://', $url);
@@ -1841,7 +2050,7 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
         * link starting with / or a php file).
         */
        if ( strpos($url, ':') === false &&
         * link starting with / or a php file).
         */
        if ( strpos($url, ':') === false &&
-               substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
+               substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
                $url = 'http://' . $url;
 
        // Replace ampersands and single quotes only when displaying.
                $url = 'http://' . $url;
 
        // Replace ampersands and single quotes only when displaying.
@@ -1859,9 +2068,62 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
 }
 
 /**
 }
 
 /**
- * Performs clean_url() for database usage.
+ * Escapes data for use in a MySQL query
+ *
+ * This is just a handy shortcut for $wpdb->escape(), for completeness' sake
+ *
+ * @since 2.8.0
+ * @param string $sql Unescaped SQL data
+ * @return string The cleaned $sql
+ */
+function esc_sql( $sql ) {
+       global $wpdb;
+       return $wpdb->escape( $sql );
+}
+
+
+/**
+ * Checks and cleans a URL.
+ *
+ * A number of characters are removed from the URL. If the URL is for displaying
+ * (the default behaviour) amperstands are also replaced. The 'esc_url' filter
+ * is applied to the returned cleaned URL.
+ *
+ * @since 2.8.0
+ * @uses esc_url()
+ * @uses wp_kses_bad_protocol() To only permit protocols in the URL set
+ *             via $protocols or the common ones set in the function.
+ *
+ * @param string $url The URL to be cleaned.
+ * @param array $protocols Optional. An array of acceptable protocols.
+ *             Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set.
+ * @return string The cleaned $url after the 'cleaned_url' filter is applied.
+ */
+function esc_url( $url, $protocols = null ) {
+       return clean_url( $url, $protocols, 'display' );
+}
+
+/**
+ * Performs esc_url() for database usage.
+ *
+ * @see esc_url()
+ * @see esc_url()
  *
  *
- * @see clean_url()
+ * @since 2.8.0
+ *
+ * @param string $url The URL to be cleaned.
+ * @param array $protocols An array of acceptable protocols.
+ * @return string The cleaned URL.
+ */
+function esc_url_raw( $url, $protocols = null ) {
+       return clean_url( $url, $protocols, 'db' );
+}
+
+/**
+ * Performs esc_url() for database or redirect usage.
+ *
+ * @see esc_url()
+ * @deprecated 2.8.0
  *
  * @since 2.3.1
  *
  *
  * @since 2.3.1
  *
@@ -1894,33 +2156,94 @@ function htmlentities2($myHTML) {
  *
  * The filter 'js_escape' is also applied here.
  *
  *
  * The filter 'js_escape' is also applied here.
  *
- * @since 2.0.4
+ * @since 2.8.0
  *
  * @param string $text The text to be escaped.
  * @return string Escaped text.
  */
  *
  * @param string $text The text to be escaped.
  * @return string Escaped text.
  */
-function js_escape($text) {
+function esc_js( $text ) {
        $safe_text = wp_check_invalid_utf8( $text );
        $safe_text = wp_check_invalid_utf8( $text );
-       $safe_text = wp_specialchars( $safe_text, ENT_COMPAT );
+       $safe_text = _wp_specialchars( $safe_text, ENT_COMPAT );
        $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
        $safe_text = preg_replace( "/\r?\n/", "\\n", addslashes( $safe_text ) );
        return apply_filters( 'js_escape', $safe_text, $text );
 }
 
        $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
        $safe_text = preg_replace( "/\r?\n/", "\\n", addslashes( $safe_text ) );
        return apply_filters( 'js_escape', $safe_text, $text );
 }
 
+/**
+ * Escape single quotes, specialchar double quotes, and fix line endings.
+ *
+ * The filter 'js_escape' is also applied by esc_js()
+ *
+ * @since 2.0.4
+ *
+ * @deprecated 2.8.0
+ * @see esc_js()
+ *
+ * @param string $text The text to be escaped.
+ * @return string Escaped text.
+ */
+function js_escape( $text ) {
+       return esc_js( $text );
+}
+
+/**
+ * Escaping for HTML blocks.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text
+ * @return string
+ */
+function esc_html( $text ) {
+       $safe_text = wp_check_invalid_utf8( $text );
+       $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
+       return apply_filters( 'esc_html', $safe_text, $text );
+       return $text;
+}
+
+/**
+ * Escaping for HTML blocks
+ * @deprecated 2.8.0
+ * @see esc_html()
+ */
+function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
+       if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args
+               $args = func_get_args();
+               return call_user_func_array( '_wp_specialchars', $args );
+       } else {
+               return esc_html( $string );
+       }
+}
+
 /**
  * Escaping for HTML attributes.
  *
 /**
  * Escaping for HTML attributes.
  *
- * @since 2.0.6
+ * @since 2.8.0
  *
  * @param string $text
  * @return string
  */
  *
  * @param string $text
  * @return string
  */
-function attribute_escape( $text ) {
+function esc_attr( $text ) {
        $safe_text = wp_check_invalid_utf8( $text );
        $safe_text = wp_check_invalid_utf8( $text );
-       $safe_text = wp_specialchars( $safe_text, ENT_QUOTES );
+       $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
        return apply_filters( 'attribute_escape', $safe_text, $text );
 }
 
        return apply_filters( 'attribute_escape', $safe_text, $text );
 }
 
+/**
+ * Escaping for HTML attributes.
+ *
+ * @since 2.0.6
+ *
+ * @deprecated 2.8.0
+ * @see esc_attr()
+ *
+ * @param string $text
+ * @return string
+ */
+function attribute_escape( $text ) {
+       return esc_attr( $text );
+}
+
 /**
  * Escape a HTML tag name.
  *
 /**
  * Escape a HTML tag name.
  *
@@ -2019,7 +2342,7 @@ function sanitize_option($option, $value) {
                        $value = addslashes($value);
                        $value = wp_filter_post_kses( $value ); // calls stripslashes then addslashes
                        $value = stripslashes($value);
                        $value = addslashes($value);
                        $value = wp_filter_post_kses( $value ); // calls stripslashes then addslashes
                        $value = stripslashes($value);
-                       $value = wp_specialchars( $value );
+                       $value = esc_html( $value );
                        break;
 
                case 'blog_charset':
                        break;
 
                case 'blog_charset':
@@ -2046,7 +2369,7 @@ function sanitize_option($option, $value) {
                case 'siteurl':
                case 'home':
                        $value = stripslashes($value);
                case 'siteurl':
                case 'home':
                        $value = stripslashes($value);
-                       $value = clean_url($value);
+                       $value = esc_url($value);
                        break;
                default :
                        $value = apply_filters("sanitize_option_{$option}", $value, $option);
                        break;
                default :
                        $value = apply_filters("sanitize_option_{$option}", $value, $option);
@@ -2093,15 +2416,15 @@ function wp_pre_kses_less_than( $text ) {
 /**
  * Callback function used by preg_replace.
  *
 /**
  * Callback function used by preg_replace.
  *
- * @uses wp_specialchars to format the $matches text.
+ * @uses esc_html to format the $matches text.
  * @since 2.3.0
  *
  * @param array $matches Populated by matches to preg_replace.
  * @since 2.3.0
  *
  * @param array $matches Populated by matches to preg_replace.
- * @return string The text returned after wp_specialchars if needed.
+ * @return string The text returned after esc_html if needed.
  */
 function wp_pre_kses_less_than_callback( $matches ) {
        if ( false === strpos($matches[0], '>') )
  */
 function wp_pre_kses_less_than_callback( $matches ) {
        if ( false === strpos($matches[0], '>') )
-               return wp_specialchars($matches[0]);
+               return esc_html($matches[0]);
        return $matches[0];
 }
 
        return $matches[0];
 }
 
@@ -2191,9 +2514,12 @@ function wp_sprintf_l($pattern, $args) {
 
        // Translate and filter the delimiter set (avoid ampersands and entities here)
        $l = apply_filters('wp_sprintf_l', array(
 
        // Translate and filter the delimiter set (avoid ampersands and entities here)
        $l = apply_filters('wp_sprintf_l', array(
-               'between'          => _c(', |between list items'),
-               'between_last_two' => _c(', and |between last two list items'),
-               'between_only_two' => _c(' and |between only two list items'),
+               /* translators: used between list items, there is a space after the coma */
+               'between'          => __(', '),
+               /* translators: used between list items, there is a space after the and */
+               'between_last_two' => __(', and '),
+               /* translators: used between only two list items, there is a space after the and */
+               'between_only_two' => __(' and '),
                ));
 
        $args = (array) $args;
                ));
 
        $args = (array) $args;
@@ -2205,7 +2531,7 @@ function wp_sprintf_l($pattern, $args) {
        while ( $i ) {
                $arg = array_shift($args);
                $i--;
        while ( $i ) {
                $arg = array_shift($args);
                $i--;
-               if ( $i == 1 )
+               if ( 0 == $i )
                        $result .= $l['between_last_two'] . $arg;
                else
                        $result .= $l['between'] . $arg;
                        $result .= $l['between_last_two'] . $arg;
                else
                        $result .= $l['between'] . $arg;
@@ -2228,7 +2554,7 @@ function wp_sprintf_l($pattern, $args) {
  */
 function wp_html_excerpt( $str, $count ) {
        $str = strip_tags( $str );
  */
 function wp_html_excerpt( $str, $count ) {
        $str = strip_tags( $str );
-       $str = mb_strcut( $str, 0, $count );
+       $str = mb_substr( $str, 0, $count );
        // remove part of an entity at the end
        $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str );
        return $str;
        // remove part of an entity at the end
        $str = preg_replace( '/&[^;\s]{0,6}$/', '', $str );
        return $str;
index 3ff8821adb02deefd1dcc44732a4539f7334def2..cfd12badb200e39f2eae932acaf0eafed7b6352c 100644 (file)
@@ -29,48 +29,18 @@ function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
                return false;
 
        if( 'G' == $dateformatstring ) {
                return false;
 
        if( 'G' == $dateformatstring ) {
-               return gmmktime(
-                       (int) substr( $m, 11, 2 ), (int) substr( $m, 14, 2 ), (int) substr( $m, 17, 2 ),
-                       (int) substr( $m, 5, 2 ), (int) substr( $m, 8, 2 ), (int) substr( $m, 0, 4 )
-               );
+               return strtotime( $m . ' +0000' );
        }
 
        }
 
-       $i = mktime(
-               (int) substr( $m, 11, 2 ), (int) substr( $m, 14, 2 ), (int) substr( $m, 17, 2 ),
-               (int) substr( $m, 5, 2 ), (int) substr( $m, 8, 2 ), (int) substr( $m, 0, 4 )
-       );
+       $i = strtotime( $m );
 
        if( 'U' == $dateformatstring )
                return $i;
 
 
        if( 'U' == $dateformatstring )
                return $i;
 
-       if ( -1 == $i || false == $i )
-               $i = 0;
-
-       if ( !empty( $wp_locale->month ) && !empty( $wp_locale->weekday ) && $translate ) {
-               $datemonth = $wp_locale->get_month( date( 'm', $i ) );
-               $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
-               $dateweekday = $wp_locale->get_weekday( date( 'w', $i ) );
-               $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
-               $datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) );
-               $datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) );
-               $dateformatstring = ' ' . $dateformatstring;
-               $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
-               $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
-               $dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring );
-               $dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
-               $dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring );
-               $dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
-
-               $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
-       }
-       $j = @date( $dateformatstring, $i );
-
-       /*
-       if ( !$j ) // for debug purposes
-               echo $i." ".$mysqlstring;
-       */
-
-       return $j;
+       if ( $translate)
+           return date_i18n( $dateformatstring, $i );
+       else
+           return date( $dateformatstring, $i );
 }
 
 /**
 }
 
 /**
@@ -108,8 +78,9 @@ function current_time( $type, $gmt = 0 ) {
  *
  * @since 0.71
  *
  *
  * @since 0.71
  *
- * @param string $dateformatstring Format to display the date
- * @param int $unixtimestamp Unix timestamp
+ * @param string $dateformatstring Format to display the date.
+ * @param int $unixtimestamp Optional. Unix timestamp.
+ * @param bool $gmt Optional, default is false. Whether to convert to GMT for time.
  * @return string The date, translated if locale specifies it.
  */
 function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
  * @return string The date, translated if locale specifies it.
  */
 function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
@@ -126,6 +97,10 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
                $gmt = true;
        }
 
                $gmt = true;
        }
 
+       // store original value for language with untypical grammars
+       // see http://core.trac.wordpress.org/ticket/9396
+       $req_format = $dateformatstring;
+
        $datefunc = $gmt? 'gmdate' : 'date';
 
        if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
        $datefunc = $gmt? 'gmdate' : 'date';
 
        if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
@@ -146,6 +121,8 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
                $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
        }
        $j = @$datefunc( $dateformatstring, $i );
                $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
        }
        $j = @$datefunc( $dateformatstring, $i );
+       // allow plugins to redo this entirely for languages with untypical grammars
+       $j = apply_filters('date_i18n', $j, $req_format, $i, $gmt);
        return $j;
 }
 
        return $j;
 }
 
@@ -163,7 +140,10 @@ function number_format_i18n( $number, $decimals = null ) {
        // let the user override the precision only
        $decimals = ( is_null( $decimals ) ) ? $wp_locale->number_format['decimals'] : intval( $decimals );
 
        // let the user override the precision only
        $decimals = ( is_null( $decimals ) ) ? $wp_locale->number_format['decimals'] : intval( $decimals );
 
-       return number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
+       $num = number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
+
+       // let the user translate digits from latin to localized language
+       return apply_filters( 'number_format_i18n', $num );
 }
 
 /**
 }
 
 /**
@@ -249,8 +229,7 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
  */
 function maybe_unserialize( $original ) {
        if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
  */
 function maybe_unserialize( $original ) {
        if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
-               if ( false !== $gm = @unserialize( $original ) )
-                       return $gm;
+               return @unserialize( $original );
        return $original;
 }
 
        return $original;
 }
 
@@ -403,13 +382,13 @@ function get_option( $setting, $default = false ) {
 function wp_protect_special_option( $option ) {
        $protected = array( 'alloptions', 'notoptions' );
        if ( in_array( $option, $protected ) )
 function wp_protect_special_option( $option ) {
        $protected = array( 'alloptions', 'notoptions' );
        if ( in_array( $option, $protected ) )
-               die( sprintf( __( '%s is a protected WP option and may not be modified' ), wp_specialchars( $option ) ) );
+               die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
 }
 
 /**
  * Print option value after sanitizing for forms.
  *
 }
 
 /**
  * Print option value after sanitizing for forms.
  *
- * @uses attribute_escape Sanitizes value.
+ * @uses attr Sanitizes value.
  * @since 1.5.0
  * @package WordPress
  * @subpackage Option
  * @since 1.5.0
  * @package WordPress
  * @subpackage Option
@@ -417,7 +396,7 @@ function wp_protect_special_option( $option ) {
  * @param string $option Option name.
  */
 function form_option( $option ) {
  * @param string $option Option name.
  */
 function form_option( $option ) {
-       echo attribute_escape (get_option( $option ) );
+       echo esc_attr(get_option( $option ) );
 }
 
 /**
 }
 
 /**
@@ -495,10 +474,15 @@ function wp_load_alloptions() {
  * value, but you will not be able to set whether it is autoloaded. If you want
  * to set whether an option autoloaded, then you need to use the add_option().
  *
  * value, but you will not be able to set whether it is autoloaded. If you want
  * to set whether an option autoloaded, then you need to use the add_option().
  *
- * When the option is updated, then the filter named
- * 'update_option_$option_name', with the $option_name as the $option_name
+ * Before the option is updated, then the filter named
+ * 'pre_update_option_$option_name', with the $option_name as the $option_name
  * parameter value, will be called. The hook should accept two parameters, the
  * parameter value, will be called. The hook should accept two parameters, the
- * first is the old parameter and the second is the new parameter.
+ * first is the new value and the second is the old value.  Whatever is
+ * returned will be used as the new value.
+ *
+ * After the value has been updated the action named 'update_option_$option_name'
+ * will be called.  This action receives two parameters the first being the old
+ * value and the second the new value.
  *
  * @since 1.0.0
  * @package WordPress
  *
  * @since 1.0.0
  * @package WordPress
@@ -546,7 +530,8 @@ function update_option( $option_name, $newvalue ) {
                wp_cache_set( $option_name, $newvalue, 'options' );
        }
 
                wp_cache_set( $option_name, $newvalue, 'options' );
        }
 
-       $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->options SET option_value = %s WHERE option_name = %s", $newvalue, $option_name ) );
+       $wpdb->update($wpdb->options, array('option_value' => $newvalue), array('option_name' => $option_name) );
+
        if ( $wpdb->rows_affected == 1 ) {
                do_action( "update_option_{$option_name}", $oldvalue, $_newvalue );
                return true;
        if ( $wpdb->rows_affected == 1 ) {
                do_action( "update_option_{$option_name}", $oldvalue, $_newvalue );
                return true;
@@ -613,7 +598,7 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
                wp_cache_set( 'notoptions', $notoptions, 'options' );
        }
 
                wp_cache_set( 'notoptions', $notoptions, 'options' );
        }
 
-       $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) );
+       $wpdb->insert($wpdb->options, array('option_name' => $name, 'option_value' => $value, 'autoload' => $autoload) );
 
        do_action( "add_option_{$name}", $name, $value );
        return;
 
        do_action( "add_option_{$name}", $name, $value );
        return;
@@ -653,6 +638,107 @@ function delete_option( $name ) {
        return true;
 }
 
        return true;
 }
 
+/**
+ * Delete a transient
+ *
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage Transient
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @return bool true if successful, false otherwise
+ */
+function delete_transient($transient) {
+       global $_wp_using_ext_object_cache, $wpdb;
+
+       if ( $_wp_using_ext_object_cache ) {
+               return wp_cache_delete($transient, 'transient');
+       } else {
+               $transient = '_transient_' . $wpdb->escape($transient);
+               return delete_option($transient);
+       }
+}
+
+/**
+ * Get the value of a transient
+ *
+ * If the transient does not exist or does not have a value, then the return value
+ * will be false.
+ *
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage Transient
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @return mixed Value of transient
+ */
+function get_transient($transient) {
+       global $_wp_using_ext_object_cache, $wpdb;
+
+       $pre = apply_filters( 'pre_transient_' . $transient, false );
+       if ( false !== $pre )
+               return $pre;
+
+       if ( $_wp_using_ext_object_cache ) {
+               $value = wp_cache_get($transient, 'transient');
+       } else {
+               $transient_option = '_transient_' . $wpdb->escape($transient);
+               // If option is not in alloptions, it is not autoloaded and thus has a timeout
+               $alloptions = wp_load_alloptions();
+               if ( !isset( $alloptions[$transient_option] ) ) {
+                       $transient_timeout = '_transient_timeout_' . $wpdb->escape($transient);
+                       if ( get_option($transient_timeout) < time() ) {
+                               delete_option($transient_option);
+                               delete_option($transient_timeout);
+                               return false;
+                       }
+               }
+
+               $value = get_option($transient_option);
+       }
+
+       return apply_filters('transient_' . $transient, $value);
+}
+
+/**
+ * Set/update the value of a transient
+ *
+ * You do not need to serialize values, if the value needs to be serialize, then
+ * it will be serialized before it is set.
+ *
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage Transient
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped
+ * @param mixed $value Transient value.
+ * @param int $expiration Time until expiration in seconds, default 0
+ * @return bool False if value was not set and true if value was set.
+ */
+function set_transient($transient, $value, $expiration = 0) {
+       global $_wp_using_ext_object_cache, $wpdb;
+
+       if ( $_wp_using_ext_object_cache ) {
+               return wp_cache_set($transient, $value, 'transient', $expiration);
+       } else {
+               $transient_timeout = '_transient_timeout_' . $transient;
+               $transient = '_transient_' . $transient;
+               $safe_transient = $wpdb->escape($transient);
+               if ( false === get_option( $safe_transient ) ) {
+                       $autoload = 'yes';
+                       if ( 0 != $expiration ) {
+                               $autoload = 'no';
+                               add_option($transient_timeout, time() + $expiration, '', 'no');
+                       }
+                       return add_option($transient, $value, '', $autoload);
+               } else {
+                       if ( 0 != $expiration )
+                               update_option($transient_timeout, time() + $expiration);
+                       return update_option($transient, $value);
+               }
+       }
+}
+
 /**
  * Saves and restores user interface settings stored in a cookie.
  *
 /**
  * Saves and restores user interface settings stored in a cookie.
  *
@@ -697,6 +783,7 @@ function wp_user_settings() {
 
        setcookie( 'wp-settings-' . $user->ID, $settings, time() + 31536000, SITECOOKIEPATH );
        setcookie( 'wp-settings-time-' . $user->ID, time(), time() + 31536000, SITECOOKIEPATH );
 
        setcookie( 'wp-settings-' . $user->ID, $settings, time() + 31536000, SITECOOKIEPATH );
        setcookie( 'wp-settings-time-' . $user->ID, time(), time() + 31536000, SITECOOKIEPATH );
+       $_COOKIE['wp-settings-' . $user->ID] = $settings;
 }
 
 /**
 }
 
 /**
@@ -712,44 +799,73 @@ function wp_user_settings() {
  */
 function get_user_setting( $name, $default = false ) {
 
  */
 function get_user_setting( $name, $default = false ) {
 
-       $arr = get_all_user_settings();
+       $all = get_all_user_settings();
 
 
-       return isset($arr[$name]) ? $arr[$name] : $default;
+       return isset($all[$name]) ? $all[$name] : $default;
+}
+
+/**
+ * Add or update user interface setting.
+ *
+ * Both $name and $value can contain only ASCII letters, numbers and underscores.
+ * This function has to be used before any output has started as it calls setcookie().
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ *
+ * @param string $name The name of the setting.
+ * @param string $value The value for the setting.
+ * @return bool true if set successfully/false if not.
+ */
+function set_user_setting( $name, $value ) {
+
+       if ( headers_sent() )
+               return false;
+
+       $all = get_all_user_settings();
+       $name = preg_replace( '/[^A-Za-z0-9_]+/', '', $name );
+
+       if ( empty($name) )
+               return false;
+
+       $all[$name] = $value;
+
+       return wp_set_all_user_settings($all);
 }
 
 /**
  * Delete user interface settings.
  *
  * Deleting settings would reset them to the defaults.
 }
 
 /**
  * Delete user interface settings.
  *
  * Deleting settings would reset them to the defaults.
+ * This function has to be used before any output has started as it calls setcookie().
  *
  * @package WordPress
  * @subpackage Option
  * @since 2.7.0
  *
  * @param mixed $names The name or array of names of the setting to be deleted.
  *
  * @package WordPress
  * @subpackage Option
  * @since 2.7.0
  *
  * @param mixed $names The name or array of names of the setting to be deleted.
+ * @return bool true if deleted successfully/false if not.
  */
 function delete_user_setting( $names ) {
  */
 function delete_user_setting( $names ) {
-       global $current_user;
 
 
-       $arr = get_all_user_settings();
+       if ( headers_sent() )
+               return false;
+
+       $all = get_all_user_settings();
        $names = (array) $names;
 
        foreach ( $names as $name ) {
        $names = (array) $names;
 
        foreach ( $names as $name ) {
-               if ( isset($arr[$name]) ) {
-                       unset($arr[$name]);
-                       $settings = '';
+               if ( isset($all[$name]) ) {
+                       unset($all[$name]);
+                       $deleted = true;
                }
        }
 
                }
        }
 
-       if ( isset($settings) ) {
-               foreach ( $arr as $k => $v )
-                       $settings .= $k . '=' . $v . '&';
+       if ( isset($deleted) )
+               return wp_set_all_user_settings($all);
 
 
-               $settings = rtrim($settings, '&');
-
-               update_user_option( $current_user->ID, 'user-settings', $settings );
-               setcookie('wp-settings-'.$current_user->ID, $settings, time() + 31536000, SITECOOKIEPATH);
-       }
+       return false;
 }
 
 /**
 }
 
 /**
@@ -762,19 +878,57 @@ function delete_user_setting( $names ) {
  * @return array the last saved user settings or empty array.
  */
 function get_all_user_settings() {
  * @return array the last saved user settings or empty array.
  */
 function get_all_user_settings() {
+       global $_updated_user_settings;
+
        if ( ! $user = wp_get_current_user() )
                return array();
 
        if ( ! $user = wp_get_current_user() )
                return array();
 
-       if ( isset($_COOKIE['wp-settings-'.$user->ID]) ) {
-               $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-'.$user->ID] );
+       if ( isset($_updated_user_settings) && is_array($_updated_user_settings) )
+               return $_updated_user_settings;
 
 
-               if ( $cookie && strpos($cookie, '=') ) { // the '=' cannot be 1st char
-                       parse_str($cookie, $arr);
-                       return $arr;
-               }
+       $all = array();
+       if ( isset($_COOKIE['wp-settings-' . $user->ID]) ) {
+               $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user->ID] );
+
+               if ( $cookie && strpos($cookie, '=') ) // the '=' cannot be 1st char
+                       parse_str($cookie, $all);
+
+       } else {
+               $option = get_user_option('user-settings', $user->ID);
+               if ( $option && is_string($option) )
+                       parse_str( $option, $all );
+       }
+
+       return $all;
+}
+
+/**
+ * Private. Set all user interface settings.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.8.0
+ *
+ */
+function wp_set_all_user_settings($all) {
+       global $_updated_user_settings;
+
+       if ( ! $user = wp_get_current_user() )
+               return false;
+
+       $_updated_user_settings = $all;
+       $settings = '';
+       foreach ( $all as $k => $v ) {
+               $v = preg_replace( '/[^A-Za-z0-9_]+/', '', $v );
+               $settings .= $k . '=' . $v . '&';
        }
 
        }
 
-       return array();
+       $settings = rtrim($settings, '&');
+
+       update_user_option( $user->ID, 'user-settings', $settings, false );
+       update_user_option( $user->ID, 'user-settings-time', time(), false );
+
+       return true;
 }
 
 /**
 }
 
 /**
@@ -788,8 +942,8 @@ function delete_all_user_settings() {
        if ( ! $user = wp_get_current_user() )
                return;
 
        if ( ! $user = wp_get_current_user() )
                return;
 
-       delete_usermeta( $user->ID, 'user-settings' );
-       setcookie('wp-settings-'.$user->ID, ' ', time() - 31536000, SITECOOKIEPATH);
+       update_user_option( $user->ID, 'user-settings', '', false );
+       setcookie('wp-settings-' . $user->ID, ' ', time() - 31536000, SITECOOKIEPATH);
 }
 
 /**
 }
 
 /**
@@ -856,9 +1010,7 @@ function make_url_footnote( $content ) {
 function xmlrpc_getposttitle( $content ) {
        global $post_default_title;
        if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {
 function xmlrpc_getposttitle( $content ) {
        global $post_default_title;
        if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {
-               $post_title = $matchtitle[0];
-               $post_title = preg_replace( '/<title>/si', '', $post_title );
-               $post_title = preg_replace( '/<\/title>/si', '', $post_title );
+               $post_title = $matchtitle[1];
        } else {
                $post_title = $post_default_title;
        }
        } else {
                $post_title = $post_default_title;
        }
@@ -977,7 +1129,8 @@ function debug_fclose( $fp ) {
 /**
  * Check content for video and audio links to add as enclosures.
  *
 /**
  * Check content for video and audio links to add as enclosures.
  *
- * Will not add enclosures that have already been added. This is called as
+ * Will not add enclosures that have already been added and will
+ * remove enclosures that are no longer in the post. This is called as
  * pingbacks and trackbacks.
  *
  * @package WordPress
  * pingbacks and trackbacks.
  *
  * @package WordPress
@@ -1008,6 +1161,12 @@ function do_enclose( $content, $post_ID ) {
        debug_fwrite( $log, 'Post contents:' );
        debug_fwrite( $log, $content . "\n" );
 
        debug_fwrite( $log, 'Post contents:' );
        debug_fwrite( $log, $content . "\n" );
 
+       foreach ( $pung as $link_test ) {
+               if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
+                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') );
+               }
+       }
+
        foreach ( (array) $post_links_temp[0] as $link_test ) {
                if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
                        $test = parse_url( $link_test );
        foreach ( (array) $post_links_temp[0] as $link_test ) {
                if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
                        $test = parse_url( $link_test );
@@ -1022,12 +1181,11 @@ function do_enclose( $content, $post_ID ) {
                if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url . '%' ) ) ) {
                        if ( $headers = wp_get_http_headers( $url) ) {
                                $len = (int) $headers['content-length'];
                if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url . '%' ) ) ) {
                        if ( $headers = wp_get_http_headers( $url) ) {
                                $len = (int) $headers['content-length'];
-                               $type = $wpdb->escape( $headers['content-type'] );
+                               $type = $headers['content-type'];
                                $allowed_types = array( 'video', 'audio' );
                                if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
                                        $meta_value = "$url\n$len\n$type\n";
                                $allowed_types = array( 'video', 'audio' );
                                if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
                                        $meta_value = "$url\n$len\n$type\n";
-                                       $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->postmeta` ( `post_id` , `meta_key` , `meta_value` )
-                                       VALUES ( %d, 'enclosure' , %s)", $post_ID, $meta_value ) );
+                                       $wpdb->insert($wpdb->postmeta, array('post_id' => $post_ID, 'meta_key' => 'enclosure', 'meta_value' => $meta_value) );
                                }
                        }
                }
                                }
                        }
                }
@@ -1314,6 +1472,7 @@ function get_status_header_desc( $code ) {
                $wp_header_to_desc = array(
                        100 => 'Continue',
                        101 => 'Switching Protocols',
                $wp_header_to_desc = array(
                        100 => 'Continue',
                        101 => 'Switching Protocols',
+                       102 => 'Processing',
 
                        200 => 'OK',
                        201 => 'Created',
 
                        200 => 'OK',
                        201 => 'Created',
@@ -1322,6 +1481,8 @@ function get_status_header_desc( $code ) {
                        204 => 'No Content',
                        205 => 'Reset Content',
                        206 => 'Partial Content',
                        204 => 'No Content',
                        205 => 'Reset Content',
                        206 => 'Partial Content',
+                       207 => 'Multi-Status',
+                       226 => 'IM Used',
 
                        300 => 'Multiple Choices',
                        301 => 'Moved Permanently',
 
                        300 => 'Multiple Choices',
                        301 => 'Moved Permanently',
@@ -1329,10 +1490,12 @@ function get_status_header_desc( $code ) {
                        303 => 'See Other',
                        304 => 'Not Modified',
                        305 => 'Use Proxy',
                        303 => 'See Other',
                        304 => 'Not Modified',
                        305 => 'Use Proxy',
+                       306 => 'Reserved',
                        307 => 'Temporary Redirect',
 
                        400 => 'Bad Request',
                        401 => 'Unauthorized',
                        307 => 'Temporary Redirect',
 
                        400 => 'Bad Request',
                        401 => 'Unauthorized',
+                       402 => 'Payment Required',
                        403 => 'Forbidden',
                        404 => 'Not Found',
                        405 => 'Method Not Allowed',
                        403 => 'Forbidden',
                        404 => 'Not Found',
                        405 => 'Method Not Allowed',
@@ -1348,13 +1511,20 @@ function get_status_header_desc( $code ) {
                        415 => 'Unsupported Media Type',
                        416 => 'Requested Range Not Satisfiable',
                        417 => 'Expectation Failed',
                        415 => 'Unsupported Media Type',
                        416 => 'Requested Range Not Satisfiable',
                        417 => 'Expectation Failed',
+                       422 => 'Unprocessable Entity',
+                       423 => 'Locked',
+                       424 => 'Failed Dependency',
+                       426 => 'Upgrade Required',
 
                        500 => 'Internal Server Error',
                        501 => 'Not Implemented',
                        502 => 'Bad Gateway',
                        503 => 'Service Unavailable',
                        504 => 'Gateway Timeout',
 
                        500 => 'Internal Server Error',
                        501 => 'Not Implemented',
                        502 => 'Bad Gateway',
                        503 => 'Service Unavailable',
                        504 => 'Gateway Timeout',
-                       505 => 'HTTP Version Not Supported'
+                       505 => 'HTTP Version Not Supported',
+                       506 => 'Variant Also Negotiates',
+                       507 => 'Insufficient Storage',
+                       510 => 'Not Extended'
                );
        }
 
                );
        }
 
@@ -1388,10 +1558,32 @@ function status_header( $header ) {
        if ( function_exists( 'apply_filters' ) )
                $status_header = apply_filters( 'status_header', $status_header, $header, $text, $protocol );
 
        if ( function_exists( 'apply_filters' ) )
                $status_header = apply_filters( 'status_header', $status_header, $header, $text, $protocol );
 
-       if ( version_compare( phpversion(), '4.3.0', '>=' ) )
-               return @header( $status_header, true, $header );
-       else
-               return @header( $status_header );
+       return @header( $status_header, true, $header );
+}
+
+/**
+ * Gets the header information to prevent caching.
+ *
+ * The several different headers cover the different ways cache prevention is handled
+ * by different browsers
+ *
+ * @since 2.8
+ *
+ * @uses apply_filters()
+ * @return array The associative array of header names and field values.
+ */
+function wp_get_nocache_headers() {
+       $headers = array(
+               'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
+               'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
+               'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
+               'Pragma' => 'no-cache',
+       );
+
+       if ( function_exists('apply_filters') ) {
+               $headers = apply_filters('nocache_headers', $headers);
+       }
+       return $headers;
 }
 
 /**
 }
 
 /**
@@ -1401,13 +1593,12 @@ function status_header( $header ) {
  * be sent so that all of them get the point that no caching should occur.
  *
  * @since 2.0.0
  * be sent so that all of them get the point that no caching should occur.
  *
  * @since 2.0.0
+ * @uses wp_get_nocache_headers()
  */
 function nocache_headers() {
  */
 function nocache_headers() {
-       // why are these @-silenced when other header calls aren't?
-       @header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
-       @header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
-       @header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
-       @header( 'Pragma: no-cache' );
+       $headers = wp_get_nocache_headers();
+       foreach( (array) $headers as $name => $field_value )
+               @header("{$name}: {$field_value}");
 }
 
 /**
 }
 
 /**
@@ -1471,7 +1662,7 @@ function do_feed() {
 
        $hook = 'do_feed_' . $feed;
        if ( !has_action($hook) ) {
 
        $hook = 'do_feed_' . $feed;
        if ( !has_action($hook) ) {
-               $message = sprintf( __( 'ERROR: %s is not a valid feed template' ), wp_specialchars($feed));
+               $message = sprintf( __( 'ERROR: %s is not a valid feed template' ), esc_html($feed));
                wp_die($message);
        }
 
                wp_die($message);
        }
 
@@ -1565,15 +1756,20 @@ function is_blog_installed() {
        global $wpdb;
 
        // Check cache first. If options table goes away and we have true cached, oh well.
        global $wpdb;
 
        // Check cache first. If options table goes away and we have true cached, oh well.
-       if ( wp_cache_get('is_blog_installed') )
+       if ( wp_cache_get( 'is_blog_installed' ) )
                return true;
 
        $suppress = $wpdb->suppress_errors();
                return true;
 
        $suppress = $wpdb->suppress_errors();
-       $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
-       $wpdb->suppress_errors($suppress);
+       $alloptions = wp_load_alloptions();
+       // If siteurl is not set to autoload, check it specifically
+       if ( !isset( $alloptions['siteurl'] ) )
+               $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
+       else
+               $installed = $alloptions['siteurl'];
+       $wpdb->suppress_errors( $suppress );
 
 
-       $installed = !empty( $installed ) ? true : false;
-       wp_cache_set('is_blog_installed', $installed);
+       $installed = !empty( $installed );
+       wp_cache_set( 'is_blog_installed', $installed );
 
        return $installed;
 }
 
        return $installed;
 }
@@ -1591,7 +1787,7 @@ function is_blog_installed() {
  */
 function wp_nonce_url( $actionurl, $action = -1 ) {
        $actionurl = str_replace( '&amp;', '&', $actionurl );
  */
 function wp_nonce_url( $actionurl, $action = -1 ) {
        $actionurl = str_replace( '&amp;', '&', $actionurl );
-       return wp_specialchars( add_query_arg( '_wpnonce', wp_create_nonce( $action ), $actionurl ) );
+       return esc_html( add_query_arg( '_wpnonce', wp_create_nonce( $action ), $actionurl ) );
 }
 
 /**
 }
 
 /**
@@ -1628,7 +1824,7 @@ function wp_nonce_url( $actionurl, $action = -1 ) {
  * @return string Nonce field.
  */
 function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
  * @return string Nonce field.
  */
 function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
-       $name = attribute_escape( $name );
+       $name = esc_attr( $name );
        $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
        if ( $echo )
                echo $nonce_field;
        $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
        if ( $echo )
                echo $nonce_field;
@@ -1653,7 +1849,7 @@ function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $ec
  * @return string Referer field.
  */
 function wp_referer_field( $echo = true) {
  * @return string Referer field.
  */
 function wp_referer_field( $echo = true) {
-       $ref = attribute_escape( $_SERVER['REQUEST_URI'] );
+       $ref = esc_attr( $_SERVER['REQUEST_URI'] );
        $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
 
        if ( $echo )
        $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
 
        if ( $echo )
@@ -1679,7 +1875,7 @@ function wp_referer_field( $echo = true) {
 function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
        $jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];
        $ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to;
 function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
        $jump_back_to = ( 'previous' == $jump_back_to ) ? wp_get_referer() : $_SERVER['REQUEST_URI'];
        $ref = ( wp_get_original_referer() ) ? wp_get_original_referer() : $jump_back_to;
-       $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . attribute_escape( stripslashes( $ref ) ) . '" />';
+       $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( stripslashes( $ref ) ) . '" />';
        if ( $echo )
                echo $orig_referer_field;
        return $orig_referer_field;
        if ( $echo )
                echo $orig_referer_field;
        return $orig_referer_field;
@@ -1869,15 +2065,15 @@ function wp_upload_dir( $time = null ) {
        $dir .= $subdir;
        $url .= $subdir;
 
        $dir .= $subdir;
        $url .= $subdir;
 
+       $uploads = apply_filters( 'upload_dir', array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ) );
+
        // Make sure we have an uploads dir
        // Make sure we have an uploads dir
-       if ( ! wp_mkdir_p( $dir ) ) {
-               $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
+       if ( ! wp_mkdir_p( $uploads['path'] ) ) {
+               $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] );
                return array( 'error' => $message );
        }
 
                return array( 'error' => $message );
        }
 
-       $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
-
-       return apply_filters( 'upload_dir', $uploads );
+       return $uploads;
 }
 
 /**
 }
 
 /**
@@ -1898,7 +2094,9 @@ function wp_upload_dir( $time = null ) {
  * @return string New filename, if given wasn't unique.
  */
 function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
  * @return string New filename, if given wasn't unique.
  */
 function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
-       $filename = strtolower( $filename );
+       // sanitize the file name before we begin processing
+       $filename = sanitize_file_name($filename);
+
        // separate the filename into a name and extension
        $info = pathinfo($filename);
        $ext = !empty($info['extension']) ? $info['extension'] : '';
        // separate the filename into a name and extension
        $info = pathinfo($filename);
        $ext = !empty($info['extension']) ? $info['extension'] : '';
@@ -1915,11 +2113,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )
                $number = '';
 
                if ( !empty( $ext ) )
                $number = '';
 
                if ( !empty( $ext ) )
-                       $ext = strtolower( ".$ext" );
-
-               $filename = str_replace( $ext, '', $filename );
-               // Strip % so the server doesn't try to decode entities.
-               $filename = str_replace('%', '', sanitize_title_with_dashes( $filename ) ) . $ext;
+                       $ext = ".$ext";
 
                while ( file_exists( $dir . "/$filename" ) ) {
                        if ( '' == "$number$ext" )
 
                while ( file_exists( $dir . "/$filename" ) ) {
                        if ( '' == "$number$ext" )
@@ -2007,7 +2201,7 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
 function wp_ext2type( $ext ) {
        $ext2type = apply_filters('ext2type', array(
                'audio' => array('aac','ac3','aif','aiff','mp1','mp2','mp3','m3a','m4a','m4b','ogg','ram','wav','wma'),
 function wp_ext2type( $ext ) {
        $ext2type = apply_filters('ext2type', array(
                'audio' => array('aac','ac3','aif','aiff','mp1','mp2','mp3','m3a','m4a','m4b','ogg','ram','wav','wma'),
-               'video' => array('asf','avi','divx','dv','mov','mpg','mpeg','mp4','mpv','ogm','qt','rm','vob','wmv'),
+               'video' => array('asf','avi','divx','dv','mov','mpg','mpeg','mp4','mpv','ogm','qt','rm','vob','wmv', 'm4v'),
                'document' => array('doc','docx','pages','odt','rtf','pdf'),
                'spreadsheet' => array('xls','xlsx','numbers','ods'),
                'interactive' => array('ppt','pptx','key','odp','swf'),
                'document' => array('doc','docx','pages','odt','rtf','pdf'),
                'spreadsheet' => array('xls','xlsx','numbers','ods'),
                'interactive' => array('ppt','pptx','key','odp','swf'),
@@ -2044,12 +2238,13 @@ function wp_check_filetype( $filename, $mimes = null ) {
                'avi' => 'video/avi',
                'divx' => 'video/divx',
                'mov|qt' => 'video/quicktime',
                'avi' => 'video/avi',
                'divx' => 'video/divx',
                'mov|qt' => 'video/quicktime',
-               'mpeg|mpg|mpe|mp4' => 'video/mpeg',
+               'mpeg|mpg|mpe' => 'video/mpeg',
                'txt|c|cc|h' => 'text/plain',
                'rtx' => 'text/richtext',
                'css' => 'text/css',
                'htm|html' => 'text/html',
                'mp3|m4a' => 'audio/mpeg',
                'txt|c|cc|h' => 'text/plain',
                'rtx' => 'text/richtext',
                'css' => 'text/css',
                'htm|html' => 'text/html',
                'mp3|m4a' => 'audio/mpeg',
+               'mp4|m4v' => 'video/mp4',
                'ra|ram' => 'audio/x-realaudio',
                'wav' => 'audio/wav',
                'ogg' => 'audio/ogg',
                'ra|ram' => 'audio/x-realaudio',
                'wav' => 'audio/wav',
                'ogg' => 'audio/ogg',
@@ -2125,65 +2320,73 @@ function wp_explain_nonce( $action ) {
                $noun = $matches[2];
 
                $trans = array();
                $noun = $matches[2];
 
                $trans = array();
-               $trans['update']['attachment'] = array( __( 'Your attempt to edit this attachment: &quot;%s&quot; has failed.' ), 'get_the_title' );
+               $trans['update']['attachment'] = array( __( 'Your attempt to edit this attachment: &#8220;%s&#8221; has failed.' ), 'get_the_title' );
 
                $trans['add']['category']      = array( __( 'Your attempt to add this category has failed.' ), false );
 
                $trans['add']['category']      = array( __( 'Your attempt to add this category has failed.' ), false );
-               $trans['delete']['category']   = array( __( 'Your attempt to delete this category: &quot;%s&quot; has failed.' ), 'get_catname' );
-               $trans['update']['category']   = array( __( 'Your attempt to edit this category: &quot;%s&quot; has failed.' ), 'get_catname' );
+               $trans['delete']['category']   = array( __( 'Your attempt to delete this category: &#8220;%s&#8221; has failed.' ), 'get_cat_name' );
+               $trans['update']['category']   = array( __( 'Your attempt to edit this category: &#8220;%s&#8221; has failed.' ), 'get_cat_name' );
 
 
-               $trans['delete']['comment']    = array( __( 'Your attempt to delete this comment: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['unapprove']['comment'] = array( __( 'Your attempt to unapprove this comment: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['approve']['comment']   = array( __( 'Your attempt to approve this comment: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['update']['comment']    = array( __( 'Your attempt to edit this comment: &quot;%s&quot; has failed.' ), 'use_id' );
+               $trans['delete']['comment']    = array( __( 'Your attempt to delete this comment: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['unapprove']['comment'] = array( __( 'Your attempt to unapprove this comment: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['approve']['comment']   = array( __( 'Your attempt to approve this comment: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['update']['comment']    = array( __( 'Your attempt to edit this comment: &#8220;%s&#8221; has failed.' ), 'use_id' );
                $trans['bulk']['comments']     = array( __( 'Your attempt to bulk modify comments has failed.' ), false );
                $trans['moderate']['comments'] = array( __( 'Your attempt to moderate comments has failed.' ), false );
 
                $trans['add']['bookmark']      = array( __( 'Your attempt to add this link has failed.' ), false );
                $trans['bulk']['comments']     = array( __( 'Your attempt to bulk modify comments has failed.' ), false );
                $trans['moderate']['comments'] = array( __( 'Your attempt to moderate comments has failed.' ), false );
 
                $trans['add']['bookmark']      = array( __( 'Your attempt to add this link has failed.' ), false );
-               $trans['delete']['bookmark']   = array( __( 'Your attempt to delete this link: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['update']['bookmark']   = array( __( 'Your attempt to edit this link: &quot;%s&quot; has failed.' ), 'use_id' );
+               $trans['delete']['bookmark']   = array( __( 'Your attempt to delete this link: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['update']['bookmark']   = array( __( 'Your attempt to edit this link: &#8220;%s&#8221; has failed.' ), 'use_id' );
                $trans['bulk']['bookmarks']    = array( __( 'Your attempt to bulk modify links has failed.' ), false );
 
                $trans['add']['page']          = array( __( 'Your attempt to add this page has failed.' ), false );
                $trans['bulk']['bookmarks']    = array( __( 'Your attempt to bulk modify links has failed.' ), false );
 
                $trans['add']['page']          = array( __( 'Your attempt to add this page has failed.' ), false );
-               $trans['delete']['page']       = array( __( 'Your attempt to delete this page: &quot;%s&quot; has failed.' ), 'get_the_title' );
-               $trans['update']['page']       = array( __( 'Your attempt to edit this page: &quot;%s&quot; has failed.' ), 'get_the_title' );
+               $trans['delete']['page']       = array( __( 'Your attempt to delete this page: &#8220;%s&#8221; has failed.' ), 'get_the_title' );
+               $trans['update']['page']       = array( __( 'Your attempt to edit this page: &#8220;%s&#8221; has failed.' ), 'get_the_title' );
 
 
-               $trans['edit']['plugin']       = array( __( 'Your attempt to edit this plugin file: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['activate']['plugin']   = array( __( 'Your attempt to activate this plugin: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['deactivate']['plugin'] = array( __( 'Your attempt to deactivate this plugin: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['upgrade']['plugin']    = array( __( 'Your attempt to upgrade this plugin: &quot;%s&quot; has failed.' ), 'use_id' );
+               $trans['edit']['plugin']       = array( __( 'Your attempt to edit this plugin file: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['activate']['plugin']   = array( __( 'Your attempt to activate this plugin: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['deactivate']['plugin'] = array( __( 'Your attempt to deactivate this plugin: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['upgrade']['plugin']    = array( __( 'Your attempt to upgrade this plugin: &#8220;%s&#8221; has failed.' ), 'use_id' );
 
                $trans['add']['post']          = array( __( 'Your attempt to add this post has failed.' ), false );
 
                $trans['add']['post']          = array( __( 'Your attempt to add this post has failed.' ), false );
-               $trans['delete']['post']       = array( __( 'Your attempt to delete this post: &quot;%s&quot; has failed.' ), 'get_the_title' );
-               $trans['update']['post']       = array( __( 'Your attempt to edit this post: &quot;%s&quot; has failed.' ), 'get_the_title' );
+               $trans['delete']['post']       = array( __( 'Your attempt to delete this post: &#8220;%s&#8221; has failed.' ), 'get_the_title' );
+               $trans['update']['post']       = array( __( 'Your attempt to edit this post: &#8220;%s&#8221; has failed.' ), 'get_the_title' );
 
                $trans['add']['user']          = array( __( 'Your attempt to add this user has failed.' ), false );
                $trans['delete']['users']      = array( __( 'Your attempt to delete users has failed.' ), false );
                $trans['bulk']['users']        = array( __( 'Your attempt to bulk modify users has failed.' ), false );
 
                $trans['add']['user']          = array( __( 'Your attempt to add this user has failed.' ), false );
                $trans['delete']['users']      = array( __( 'Your attempt to delete users has failed.' ), false );
                $trans['bulk']['users']        = array( __( 'Your attempt to bulk modify users has failed.' ), false );
-               $trans['update']['user']       = array( __( 'Your attempt to edit this user: &quot;%s&quot; has failed.' ), 'get_author_name' );
-               $trans['update']['profile']    = array( __( 'Your attempt to modify the profile for: &quot;%s&quot; has failed.' ), 'get_author_name' );
+               $trans['update']['user']       = array( __( 'Your attempt to edit this user: &#8220;%s&#8221; has failed.' ), 'get_the_author_meta', 'display_name' );
+               $trans['update']['profile']    = array( __( 'Your attempt to modify the profile for: &#8220;%s&#8221; has failed.' ), 'get_the_author_meta', 'display_name' );
 
                $trans['update']['options']    = array( __( 'Your attempt to edit your settings has failed.' ), false );
                $trans['update']['permalink']  = array( __( 'Your attempt to change your permalink structure to: %s has failed.' ), 'use_id' );
 
                $trans['update']['options']    = array( __( 'Your attempt to edit your settings has failed.' ), false );
                $trans['update']['permalink']  = array( __( 'Your attempt to change your permalink structure to: %s has failed.' ), 'use_id' );
-               $trans['edit']['file']         = array( __( 'Your attempt to edit this file: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['edit']['theme']        = array( __( 'Your attempt to edit this theme file: &quot;%s&quot; has failed.' ), 'use_id' );
-               $trans['switch']['theme']      = array( __( 'Your attempt to switch to this theme: &quot;%s&quot; has failed.' ), 'use_id' );
+               $trans['edit']['file']         = array( __( 'Your attempt to edit this file: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['edit']['theme']        = array( __( 'Your attempt to edit this theme file: &#8220;%s&#8221; has failed.' ), 'use_id' );
+               $trans['switch']['theme']      = array( __( 'Your attempt to switch to this theme: &#8220;%s&#8221; has failed.' ), 'use_id' );
 
                $trans['log']['out']           = array( sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'sitename' ) ), false );
 
                if ( isset( $trans[$verb][$noun] ) ) {
                        if ( !empty( $trans[$verb][$noun][1] ) ) {
                                $lookup = $trans[$verb][$noun][1];
 
                $trans['log']['out']           = array( sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'sitename' ) ), false );
 
                if ( isset( $trans[$verb][$noun] ) ) {
                        if ( !empty( $trans[$verb][$noun][1] ) ) {
                                $lookup = $trans[$verb][$noun][1];
+                               if ( isset($trans[$verb][$noun][2]) )
+                                       $lookup_value = $trans[$verb][$noun][2];
                                $object = $matches[4];
                                $object = $matches[4];
-                               if ( 'use_id' != $lookup )
-                                       $object = call_user_func( $lookup, $object );
-                               return sprintf( $trans[$verb][$noun][0], wp_specialchars($object) );
+                               if ( 'use_id' != $lookup ) {
+                                       if ( isset( $lookup_value ) )
+                                               $object = call_user_func( $lookup, $lookup_value, $object );
+                                       else
+                                               $object = call_user_func( $lookup, $object );
+                               }
+                               return sprintf( $trans[$verb][$noun][0], esc_html($object) );
                        } else {
                                return $trans[$verb][$noun][0];
                        }
                }
                        } else {
                                return $trans[$verb][$noun][0];
                        }
                }
-       }
 
 
-       return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), $matches[4] );
+               return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), $matches[4] );
+       } else {
+               return apply_filters( 'explain_nonce_' . $action, __( 'Are you sure you want to do this?' ) );
+       }
 }
 
 /**
 }
 
 /**
@@ -2200,11 +2403,11 @@ function wp_explain_nonce( $action ) {
  */
 function wp_nonce_ays( $action ) {
        $title = __( 'WordPress Failure Notice' );
  */
 function wp_nonce_ays( $action ) {
        $title = __( 'WordPress Failure Notice' );
-       $html = wp_specialchars( wp_explain_nonce( $action ) );
+       $html = esc_html( wp_explain_nonce( $action ) );
        if ( wp_get_referer() )
        if ( wp_get_referer() )
-               $html .= "</p><p><a href='" . remove_query_arg( 'updated', clean_url( wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
+               $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
        elseif ( 'log-out' == $action )
        elseif ( 'log-out' == $action )
-               $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_nonce_url( site_url('wp-login.php?action=logout', 'login'), 'log-out' ) );
+               $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() );
 
        wp_die( $html, $title);
 }
 
        wp_die( $html, $title);
 }
@@ -2230,6 +2433,8 @@ function wp_die( $message, $title = '', $args = array() ) {
        $defaults = array( 'response' => 500 );
        $r = wp_parse_args($args, $defaults);
 
        $defaults = array( 'response' => 500 );
        $r = wp_parse_args($args, $defaults);
 
+       $have_gettext = function_exists('__');
+
        if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
                if ( empty( $title ) ) {
                        $error_data = $message->get_error_data();
        if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
                if ( empty( $title ) ) {
                        $error_data = $message->get_error_data();
@@ -2252,6 +2457,11 @@ function wp_die( $message, $title = '', $args = array() ) {
                $message = "<p>$message</p>";
        }
 
                $message = "<p>$message</p>";
        }
 
+       if ( isset( $r['back_link'] ) && $r['back_link'] ) {
+               $back_text = $have_gettext? __('&laquo; Back') : '&laquo; Back';
+               $message .= "\n<p><a href='javascript:history.back()'>$back_text</p>";
+       }
+
        if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL )
                $admin_dir = WP_SITEURL . '/wp-admin/';
        elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) )
        if ( defined( 'WP_SITEURL' ) && '' != WP_SITEURL )
                $admin_dir = WP_SITEURL . '/wp-admin/';
        elseif ( function_exists( 'get_bloginfo' ) && '' != get_bloginfo( 'wpurl' ) )
@@ -2269,12 +2479,12 @@ function wp_die( $message, $title = '', $args = array() ) {
        }
 
        if ( empty($title) ) {
        }
 
        if ( empty($title) ) {
-               if ( function_exists( '__' ) )
-                       $title = __( 'WordPress &rsaquo; Error' );
-               else
-                       $title = 'WordPress &rsaquo; Error';
+               $title = $have_gettext? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
        }
 
        }
 
+       $text_direction = 'ltr';
+       if ( isset($r['text_direction']) && $r['text_direction'] == 'rtl' ) $text_direction = 'rtl';
+       if ( ( $wp_locale ) && ( 'rtl' == $wp_locale->text_direction ) ) $text_direction = 'rtl';
 ?>
 <!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" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
 ?>
 <!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" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>
@@ -2283,15 +2493,15 @@ function wp_die( $message, $title = '', $args = array() ) {
        <title><?php echo $title ?></title>
        <link rel="stylesheet" href="<?php echo $admin_dir; ?>css/install.css" type="text/css" />
 <?php
        <title><?php echo $title ?></title>
        <link rel="stylesheet" href="<?php echo $admin_dir; ?>css/install.css" type="text/css" />
 <?php
-if ( ( $wp_locale ) && ( 'rtl' == $wp_locale->text_direction ) ) : ?>
+if ( 'rtl' == $text_direction ) : ?>
        <link rel="stylesheet" href="<?php echo $admin_dir; ?>css/install-rtl.css" type="text/css" />
 <?php endif; ?>
 </head>
 <body id="error-page">
 <?php endif; ?>
        <?php echo $message; ?>
        <link rel="stylesheet" href="<?php echo $admin_dir; ?>css/install-rtl.css" type="text/css" />
 <?php endif; ?>
 </head>
 <body id="error-page">
 <?php endif; ?>
        <?php echo $message; ?>
-       <?php if ( strlen($message) < 512) echo str_repeat(' ', 512-strlen($message)); ?>
 </body>
 </body>
+<!-- Ticket #8942, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono -->
 </html>
 <?php
        die();
 </html>
 <?php
        die();
@@ -2366,6 +2576,7 @@ function _mce_set_direction( $input ) {
        return $input;
 }
 
        return $input;
 }
 
+
 /**
  * Convert smiley code to the icon graphic file equivalent.
  *
 /**
  * Convert smiley code to the icon graphic file equivalent.
  *
@@ -2376,25 +2587,19 @@ function _mce_set_direction( $input ) {
  * to an array, with the key the code the blogger types in and the value the
  * image file.
  *
  * to an array, with the key the code the blogger types in and the value the
  * image file.
  *
- * The $wp_smiliessearch global is for the regular expression array and is
- * set each time the function is called. The $wp_smiliesreplace is the full
- * replacement. Supposely, the $wp_smiliessearch array is looped over using
- * preg_replace() or just setting the array of $wp_smiliessearch along with the
- * array of $wp_smiliesreplace in the search and replace parameters of
- * preg_replace(), which would be faster and less overhead. Either way, both are
- * used with preg_replace() and can be defined after the function is called.
+ * The $wp_smiliessearch global is for the regular expression and is set each
+ * time the function is called.
  *
  * The full list of smilies can be found in the function and won't be listed in
  * the description. Probably should create a Codex page for it, so that it is
  * available.
  *
  * @global array $wpsmiliestrans
  *
  * The full list of smilies can be found in the function and won't be listed in
  * the description. Probably should create a Codex page for it, so that it is
  * available.
  *
  * @global array $wpsmiliestrans
- * @global array $wp_smiliesreplace
  * @global array $wp_smiliessearch
  * @since 2.2.0
  */
 function smilies_init() {
  * @global array $wp_smiliessearch
  * @since 2.2.0
  */
 function smilies_init() {
-       global $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace;
+       global $wpsmiliestrans, $wp_smiliessearch;
 
        // don't bother setting up smilies if they are disabled
        if ( !get_option( 'use_smilies' ) )
 
        // don't bother setting up smilies if they are disabled
        if ( !get_option( 'use_smilies' ) )
@@ -2449,12 +2654,38 @@ function smilies_init() {
                );
        }
 
                );
        }
 
-       $siteurl = get_option( 'siteurl' );
+       if (count($wpsmiliestrans) == 0) {
+               return;
+       }
+
+       /*
+        * NOTE: we sort the smilies in reverse key order. This is to make sure
+        * we match the longest possible smilie (:???: vs :?) as the regular
+        * expression used below is first-match
+        */
+       krsort($wpsmiliestrans);
+
+       $wp_smiliessearch = '/(?:\s|^)';
+
+       $subchar = '';
        foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
        foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
-               $wp_smiliessearch[] = '/(\s|^)' . preg_quote( $smiley, '/' ) . '(\s|$)/';
-               $smiley_masked = attribute_escape( trim( $smiley ) );
-               $wp_smiliesreplace[] = " <img src='$siteurl/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
+               $firstchar = substr($smiley, 0, 1);
+               $rest = substr($smiley, 1);
+
+               // new subpattern?
+               if ($firstchar != $subchar) {
+                       if ($subchar != '') {
+                               $wp_smiliessearch .= ')|(?:\s|^)';
+                       }
+                       $subchar = $firstchar;
+                       $wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
+               } else {
+                       $wp_smiliessearch .= '|';
+               }
+               $wp_smiliessearch .= preg_quote($rest);
        }
        }
+
+       $wp_smiliessearch .= ')(?:\s|$)/m';
 }
 
 /**
 }
 
 /**
@@ -2492,10 +2723,10 @@ function wp_parse_args( $args, $defaults = '' ) {
  * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
  */
 function wp_maybe_load_widgets() {
  * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
  */
 function wp_maybe_load_widgets() {
-       if ( !function_exists( 'dynamic_sidebar' ) ) {
-               require_once( ABSPATH . WPINC . '/widgets.php' );
-               add_action( '_admin_menu', 'wp_widgets_add_menu' );
-       }
+       if ( ! apply_filters('load_default_widgets', true) )
+               return;
+       require_once( ABSPATH . WPINC . '/default-widgets.php' );
+       add_action( '_admin_menu', 'wp_widgets_add_menu' );
 }
 
 /**
 }
 
 /**
@@ -2518,7 +2749,9 @@ function wp_widgets_add_menu() {
  * @since 2.2.0
  */
 function wp_ob_end_flush_all() {
  * @since 2.2.0
  */
 function wp_ob_end_flush_all() {
-       while ( @ob_end_flush() );
+       $levels = ob_get_level();
+       for ($i=0; $i<$levels; $i++)
+               ob_end_flush();
 }
 
 /**
 }
 
 /**
@@ -2590,12 +2823,12 @@ function dead_db() {
 }
 
 /**
 }
 
 /**
- * Converts value to positive integer.
+ * Converts value to nonnegative integer.
  *
  * @since 2.5.0
  *
  *
  * @since 2.5.0
  *
- * @param mixed $maybeint Data you wish to have convered to an absolute integer
- * @return int An absolute integer
+ * @param mixed $maybeint Data you wish to have convered to an nonnegative integer
+ * @return int An nonnegative integer
  */
 function absint( $maybeint ) {
        return abs( intval( $maybeint ) );
  */
 function absint( $maybeint ) {
        return abs( intval( $maybeint ) );
@@ -2621,6 +2854,7 @@ function url_is_accessable_via_ssl($url)
                curl_setopt($ch, CURLOPT_FAILONERROR, true);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($ch, CURLOPT_FAILONERROR, true);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+               curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
 
                curl_exec($ch);
 
 
                curl_exec($ch);
 
@@ -2895,23 +3129,159 @@ function wp_suspend_cache_invalidation($suspend = true) {
        return $current_suspend;
 }
 
        return $current_suspend;
 }
 
+function get_site_option( $key, $default = false, $use_cache = true ) {
+       return get_option($key, $default);
+}
+
+// expects $key, $value not to be SQL escaped
+function add_site_option( $key, $value ) {
+       return add_option($key, $value);
+}
+
+// expects $key, $value not to be SQL escaped
+function update_site_option( $key, $value ) {
+       return update_option($key, $value);
+}
+
 /**
 /**
- * Copy an object.
+ * gmt_offset modification for smart timezone handling
  *
  *
- * Returns a cloned copy of an object.
+ * Overrides the gmt_offset option if we have a timezone_string available
+ */
+function wp_timezone_override_offset() {
+       if (!wp_timezone_supported()) return false;
+
+       $tz = get_option('timezone_string');
+       if (empty($tz)) return false;
+
+       @date_default_timezone_set($tz);
+
+       $dateTimeZoneSelected = timezone_open($tz);
+       $dateTimeServer = date_create();
+       if ($dateTimeZoneSelected === false || $dateTimeServer === false) return false;
+
+       $timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer);
+       $timeOffset = $timeOffset / 3600;
+
+       return $timeOffset;
+}
+
+/**
+ * Check for PHP timezone support
  *
  *
- * @since 2.7.0
+ */
+function wp_timezone_supported() {
+       if (function_exists('date_default_timezone_set')
+               && function_exists('timezone_identifiers_list')
+               && function_exists('timezone_open')
+               && function_exists('timezone_offset_get')
+               )
+               return apply_filters('timezone_support',true);
+
+       return apply_filters('timezone_support',false);
+}
+
+/**
+ * Gives a nicely formatted list of timezone strings // temporary! Not in final
+ *
+ * @param string $selectedzone - which zone should be the selected one
  *
  *
- * @param object $object The object to clone
- * @return object The cloned object
  */
  */
-function wp_clone( $object ) {
-       static $can_clone;
-       if ( !isset( $can_clone ) ) {
-               $can_clone = version_compare( phpversion(), '5.0', '>=' );
+function wp_timezone_choice($selectedzone) {
+       static $mo_loaded = false;
+
+       $continents = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific', 'Etc');
+
+       // Load translations for continents and cities
+       if ( ! $mo_loaded ) {
+               $locale = get_locale();
+               $mofile = WP_LANG_DIR . "/continents-cities-$locale.mo";
+               load_textdomain('continents-cities', $mofile);
+               $mo_loaded = true;
+       }
+
+       $all = timezone_identifiers_list();
+
+       $i = 0;
+       foreach ( $all as $zone ) {
+               $zone = explode('/',$zone);
+               if ( ! in_array($zone[0], $continents) )
+                       continue;
+               if ( $zone[0] == 'Etc' && in_array($zone[1], array('UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu')) )
+                       continue;
+               $zonen[$i]['continent'] = isset($zone[0]) ? $zone[0] : '';
+               $zonen[$i]['city'] = isset($zone[1]) ? $zone[1] : '';
+               $zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : '';
+               $i++;
+       }
+
+       usort($zonen, create_function(
+               '$a, $b', '
+               $t = create_function(\'$s\', \'return translate(str_replace("_", " ", $s), "continents-cities");\');
+               $a_continent = $t($a["continent"]);
+               $b_continent = $t($b["continent"]);
+               $a_city = $t($a["city"]);
+               $b_city = $t($b["city"]);
+               $a_subcity = $t($a["subcity"]);
+               $b_subcity = $t($b["subcity"]);
+               if ( $a_continent == $b_continent && $a_city == $b_city )
+                       return strnatcasecmp($a_subcity, $b_subcity);
+               elseif ( $a_continent == $b_continent )
+                       return strnatcasecmp($a_city, $b_city);
+               else
+                       return strnatcasecmp($a_continent, $b_continent);
+               '));
+
+       $structure = '';
+       $pad = '&nbsp;&nbsp;&nbsp;';
+
+       if ( empty($selectedzone) )
+               $structure .= '<option selected="selected" value="">' . __('Select a city') . "</option>\n";
+       foreach ( $zonen as $zone ) {
+               extract($zone);
+               if ( empty($selectcontinent) && !empty($city) ) {
+                       $selectcontinent = $continent;
+                       $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
+               } elseif ( !empty($selectcontinent) && $selectcontinent != $continent ) {
+                       $structure .= "</optgroup>\n";
+                       $selectcontinent = '';
+                       if ( !empty($city) ) {
+                               $selectcontinent = $continent;
+                               $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
+                       }
+               }
+
+               if ( !empty($city) ) {
+                       $display = str_replace('_',' ',$city);
+                       $display = translate($display, "continents-cities");
+                       if ( !empty($subcity) ) {
+                               $display_subcity = str_replace('_', ' ', $subcity);
+                               $display_subcity = translate($display_subcity, "continents-cities");
+                               $city = $city . '/'. $subcity;
+                               $display = $display . '/' . $display_subcity;
+                       }
+                       if ( $continent == 'Etc' )
+                               $display = strtr($display, '+-', '-+');
+                       $structure .= "\t<option ".((($continent.'/'.$city)==$selectedzone)?'selected="selected"':'')." value=\"".($continent.'/'.$city)."\">$pad".$display."</option>\n"; //Timezone
+               } else {
+                       $structure .= "<option ".(($continent==$selectedzone)?'selected="selected"':'')." value=\"".$continent."\">" . translate($continent, "continents-cities") . "</option>\n"; //Timezone
+               }
        }
        }
-       return $can_clone ? clone( $object ) : $object;
+
+       if ( !empty($selectcontinent) )
+               $structure .= "</optgroup>\n";
+       return $structure;
 }
 
 
 }
 
 
+
+/**
+ * Strip close comment and close php tags from file headers used by WP
+ * See http://core.trac.wordpress.org/ticket/8497
+ *
+ * @since 2.8
+**/
+function _cleanup_header_comment($str) {
+       return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
+}
 ?>
 ?>
index 1f7e6aca71224e526e5730a73f671f2263e25457..0a60c96878c85fa2c798ef543c8dc5931304d797 100644 (file)
@@ -16,7 +16,7 @@
  * register/enqueue new scripts.
  *
  * @since r16
  * register/enqueue new scripts.
  *
  * @since r16
- * @see WP_Scripts::print_scripts()
+ * @see WP_Dependencies::print_scripts()
  */
 function wp_print_scripts( $handles = false ) {
        do_action( 'wp_print_scripts' );
  */
 function wp_print_scripts( $handles = false ) {
        do_action( 'wp_print_scripts' );
@@ -38,14 +38,16 @@ function wp_print_scripts( $handles = false ) {
  * Register new JavaScript file.
  *
  * @since r16
  * Register new JavaScript file.
  *
  * @since r16
- * @see WP_Scripts::add() For parameter information.
+ * @see WP_Dependencies::add() For parameter information.
  */
  */
-function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
+function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
                $wp_scripts = new WP_Scripts();
 
        $wp_scripts->add( $handle, $src, $deps, $ver );
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
                $wp_scripts = new WP_Scripts();
 
        $wp_scripts->add( $handle, $src, $deps, $ver );
+       if ( $in_footer )
+               $wp_scripts->add_data( $handle, 'group', 1 );
 }
 
 /**
 }
 
 /**
@@ -86,7 +88,7 @@ function wp_deregister_script( $handle ) {
  * @since r16
  * @see WP_Script::add(), WP_Script::enqueue()
 */
  * @since r16
  * @see WP_Script::add(), WP_Script::enqueue()
 */
-function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
+function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
                $wp_scripts = new WP_Scripts();
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
                $wp_scripts = new WP_Scripts();
@@ -94,6 +96,33 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false
        if ( $src ) {
                $_handle = explode('?', $handle);
                $wp_scripts->add( $_handle[0], $src, $deps, $ver );
        if ( $src ) {
                $_handle = explode('?', $handle);
                $wp_scripts->add( $_handle[0], $src, $deps, $ver );
+               if ( $in_footer )
+                       $wp_scripts->add_data( $_handle[0], 'group', 1 );
        }
        $wp_scripts->enqueue( $handle );
 }
        }
        $wp_scripts->enqueue( $handle );
 }
+
+/**
+ * Check whether script has been added to WordPress Scripts.
+ *
+ * The values for list defaults to 'queue', which is the same as enqueue for
+ * scripts.
+ *
+ * @since WP unknown; BP unknown
+ *
+ * @param string $handle Handle used to add script.
+ * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do'
+ * @return bool
+ */
+function wp_script_is( $handle, $list = 'queue' ) {
+       global $wp_scripts;
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               $wp_scripts = new WP_Scripts();
+
+       $query = $wp_scripts->query( $handle, $list );
+
+       if ( is_object( $query ) )
+               return true;
+
+       return $query;
+}
index 44e362c023337df7bd627abbc0f64ab1f9edbef4..22d1e160d5d83827c99eed2142f5c0127f7318d0 100644 (file)
@@ -77,3 +77,28 @@ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false,
        }
        $wp_styles->enqueue( $handle );
 }
        }
        $wp_styles->enqueue( $handle );
 }
+
+/**
+ * Check whether style has been added to WordPress Styles.
+ *
+ * The values for list defaults to 'queue', which is the same as enqueue for
+ * styles.
+ *
+ * @since WP unknown; BP unknown
+ *
+ * @param string $handle Handle used to add style.
+ * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do'
+ * @return bool
+ */
+function wp_style_is( $handle, $list = 'queue' ) {
+       global $wp_styles;
+       if ( !is_a($wp_styles, 'WP_Scripts') )
+               $wp_styles = new WP_Styles();
+
+       $query = $wp_styles->query( $handle, $list );
+
+       if ( is_object( $query ) )
+               return true;
+
+       return $query;
+}
index f2e087149eb4d1c129bde843270e736a3c4d2e76..68c73cedaaf2bb70b6f0dce82c8370efbc3ca1d3 100644 (file)
@@ -23,7 +23,7 @@
  * @param string $name The name of the specialised header.
  */
 function get_header( $name = null ) {
  * @param string $name The name of the specialised header.
  */
 function get_header( $name = null ) {
-       do_action( 'get_header' );
+       do_action( 'get_header', $name );
 
        $templates = array();
        if ( isset($name) )
 
        $templates = array();
        if ( isset($name) )
@@ -52,7 +52,7 @@ function get_header( $name = null ) {
  * @param string $name The name of the specialised footer.
  */
 function get_footer( $name = null ) {
  * @param string $name The name of the specialised footer.
  */
 function get_footer( $name = null ) {
-       do_action( 'get_footer' );
+       do_action( 'get_footer', $name );
 
        $templates = array();
        if ( isset($name) )
 
        $templates = array();
        if ( isset($name) )
@@ -81,7 +81,7 @@ function get_footer( $name = null ) {
  * @param string $name The name of the specialised sidebar.
  */
 function get_sidebar( $name = null ) {
  * @param string $name The name of the specialised sidebar.
  */
 function get_sidebar( $name = null ) {
-       do_action( 'get_sidebar' );
+       do_action( 'get_sidebar', $name );
 
        $templates = array();
        if ( isset($name) )
 
        $templates = array();
        if ( isset($name) )
@@ -98,20 +98,33 @@ function get_sidebar( $name = null ) {
  *
  * Will first attempt to locate the searchform.php file in either the child or
  * the parent, then load it. If it doesn't exist, then the default search form
  *
  * Will first attempt to locate the searchform.php file in either the child or
  * the parent, then load it. If it doesn't exist, then the default search form
- * will be displayed.
+ * will be displayed. The default search form is HTML, which will be displayed.
+ * There is a filter applied to the search form HTML in order to edit or replace
+ * it. The filter is 'get_search_form'.
+ *
+ * This function is primarily used by themes which want to hardcode the search
+ * form into the sidebar and also by the search widget in WordPress.
+ *
+ * There is also an action that is called whenever the function is run called,
+ * 'get_search_form'. This can be useful for outputting JavaScript that the
+ * search relies on or various formatting that applies to the beginning of the
+ * search. To give a few examples of what it can be used for.
  *
  * @since 2.7.0
  */
 function get_search_form() {
        do_action( 'get_search_form' );
 
  *
  * @since 2.7.0
  */
 function get_search_form() {
        do_action( 'get_search_form' );
 
-       if ( '' != locate_template(array('searchform.php'), true) )
+       $search_form_template = locate_template(array('searchform.php'));
+       if ( '' != $search_form_template ) {
+               require($search_form_template);
                return;
                return;
+       }
 
 
-       $form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
-       <label class="hidden" for="s">' . __('Search for:') . '</label>
-       <div><input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
-       <input type="submit" id="searchsubmit" value="'.attribute_escape(__('Search')).'" />
+       $form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" >
+       <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
+       <input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
+       <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
        </div>
        </form>';
 
        </div>
        </form>';
 
@@ -126,12 +139,14 @@ function get_search_form() {
  *
  * @since 1.5.0
  * @uses apply_filters() Calls 'loginout' hook on HTML link content.
  *
  * @since 1.5.0
  * @uses apply_filters() Calls 'loginout' hook on HTML link content.
+ *
+ * @param string $redirect Optional path to redirect to on login/logout.
  */
  */
-function wp_loginout() {
+function wp_loginout($redirect = '') {
        if ( ! is_user_logged_in() )
        if ( ! is_user_logged_in() )
-               $link = '<a href="' . wp_login_url() . '">' . __('Log in') . '</a>';
+               $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
        else
        else
-               $link = '<a href="' . wp_logout_url() . '">' . __('Log out') . '</a>';
+               $link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
 
        echo apply_filters('loginout', $link);
 }
 
        echo apply_filters('loginout', $link);
 }
@@ -144,14 +159,20 @@ function wp_loginout() {
  * @since 2.7
  * @uses wp_nonce_url() To protect against CSRF
  * @uses site_url() To generate the log in URL
  * @since 2.7
  * @uses wp_nonce_url() To protect against CSRF
  * @uses site_url() To generate the log in URL
+ * @uses apply_filters() calls 'logout_url' hook on final logout url
  *
  * @param string $redirect Path to redirect to on logout.
  */
 function wp_logout_url($redirect = '') {
  *
  * @param string $redirect Path to redirect to on logout.
  */
 function wp_logout_url($redirect = '') {
-       if ( strlen($redirect) )
-               $redirect = "&redirect_to=$redirect";
+       $args = array( 'action' => 'logout' );
+       if ( !empty($redirect) ) {
+               $args['redirect_to'] = $redirect;
+       }
 
 
-       return wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' );
+       $logout_url = add_query_arg($args, site_url('wp-login.php', 'login'));
+       $logout_url = wp_nonce_url( $logout_url, 'log-out' );
+
+       return apply_filters('logout_url', $logout_url, $redirect);
 }
 
 /**
 }
 
 /**
@@ -161,14 +182,39 @@ function wp_logout_url($redirect = '') {
  *
  * @since 2.7
  * @uses site_url() To generate the log in URL
  *
  * @since 2.7
  * @uses site_url() To generate the log in URL
+ * @uses apply_filters() calls 'login_url' hook on final login url
  *
  * @param string $redirect Path to redirect to on login.
  */
 function wp_login_url($redirect = '') {
  *
  * @param string $redirect Path to redirect to on login.
  */
 function wp_login_url($redirect = '') {
-       if ( strlen($redirect) )
-               $redirect = "?redirect_to=$redirect";
+       $login_url = site_url('wp-login.php', 'login');
+
+       if ( !empty($redirect) ) {
+               $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
+       }
 
 
-       return site_url("wp-login.php$redirect", 'login');
+       return apply_filters('login_url', $login_url, $redirect);
+}
+
+/**
+ * Returns the Lost Password URL.
+ *
+ * Returns the URL that allows the user to retrieve the lost password
+ *
+ * @since 2.8.0
+ * @uses site_url() To generate the lost password URL
+ * @uses apply_filters() calls 'lostpassword_url' hook on the lostpassword url
+ *
+ * @param string $redirect Path to redirect to on login.
+ */
+function wp_lostpassword_url($redirect = '') {
+       $args = array( 'action' => 'lostpassword' );
+       if ( !empty($redirect) ) {
+               $args['redirect_to'] = $redirect;
+       }
+
+       $lostpassword_url = add_query_arg($args, site_url('wp-login.php', 'login'));
+       return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
 }
 
 /**
 }
 
 /**
@@ -375,6 +421,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
        $year = get_query_var('year');
        $monthnum = get_query_var('monthnum');
        $day = get_query_var('day');
        $year = get_query_var('year');
        $monthnum = get_query_var('monthnum');
        $day = get_query_var('day');
+       $search = get_query_var('s');
        $title = '';
 
        $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
        $title = '';
 
        $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
@@ -432,7 +479,7 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
        }
 
        // If there is a post
        }
 
        // If there is a post
-       if ( is_single() ||  ( is_page() && !is_front_page() ) ) {
+       if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
                $post = $wp_query->get_queried_object();
                $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
        }
                $post = $wp_query->get_queried_object();
                $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
        }
@@ -447,6 +494,12 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
                $title = "$tax$t_sep$term";
        }
 
                $title = "$tax$t_sep$term";
        }
 
+       //If it's a search
+       if ( is_search() ) {
+               /* translators: 1: separator, 2: search phrase */
+               $title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search));
+       }
+
        if ( is_404() ) {
                $title = __('Page not found');
        }
        if ( is_404() ) {
                $title = __('Page not found');
        }
@@ -660,8 +713,8 @@ function single_month_title($prefix = '', $display = true ) {
  */
 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
        $text = wptexturize($text);
  */
 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
        $text = wptexturize($text);
-       $title_text = attribute_escape($text);
-       $url = clean_url($url);
+       $title_text = esc_attr($text);
+       $url = esc_url($url);
 
        if ('link' == $format)
                $link_html = "\t<link rel='archives' title='$title_text' href='$url' />\n";
 
        if ('link' == $format)
                $link_html = "\t<link rel='archives' title='$title_text' href='$url' />\n";
@@ -750,7 +803,7 @@ function wp_get_archives($args = '') {
        $output = '';
 
        if ( 'monthly' == $type ) {
        $output = '';
 
        if ( 'monthly' == $type ) {
-               $query = "SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit";
+               $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit";
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                if ( !isset( $cache[ $key ] ) ) {
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                if ( !isset( $cache[ $key ] ) ) {
@@ -771,7 +824,7 @@ function wp_get_archives($args = '') {
                        }
                }
        } elseif ('yearly' == $type) {
                        }
                }
        } elseif ('yearly' == $type) {
-               $query = "SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC $limit";
+               $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC $limit";
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                if ( !isset( $cache[ $key ] ) ) {
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                if ( !isset( $cache[ $key ] ) ) {
@@ -792,7 +845,7 @@ function wp_get_archives($args = '') {
                        }
                }
        } elseif ( 'daily' == $type ) {
                        }
                }
        } elseif ( 'daily' == $type ) {
-               $query = "SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC $limit";
+               $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC $limit";
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                if ( !isset( $cache[ $key ] ) ) {
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                if ( !isset( $cache[ $key ] ) ) {
@@ -902,22 +955,29 @@ function calendar_week_mod($num) {
 function get_calendar($initial = true) {
        global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
 
 function get_calendar($initial = true) {
        global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
 
+       $cache = array();
        $key = md5( $m . $monthnum . $year );
        if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
        $key = md5( $m . $monthnum . $year );
        if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
-               if ( isset( $cache[ $key ] ) ) {
+               if ( is_array($cache) && isset( $cache[ $key ] ) ) {
                        echo $cache[ $key ];
                        return;
                }
        }
 
                        echo $cache[ $key ];
                        return;
                }
        }
 
-       ob_start();
+       if ( !is_array($cache) )
+               $cache = array();
+
        // Quick check. If we have no posts at all, abort!
        if ( !$posts ) {
        // Quick check. If we have no posts at all, abort!
        if ( !$posts ) {
-               $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
-               if ( !$gotsome )
+               $gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
+               if ( !$gotsome ) {
+                       $cache[ $key ] = '';
+                       wp_cache_set( 'get_calendar', $cache, 'calendar' );
                        return;
                        return;
+               }
        }
 
        }
 
+       ob_start();
        if ( isset($_GET['w']) )
                $w = ''.intval($_GET['w']);
 
        if ( isset($_GET['w']) )
                $w = ''.intval($_GET['w']);
 
@@ -961,8 +1021,10 @@ function get_calendar($initial = true) {
                        ORDER   BY post_date ASC
                        LIMIT 1");
 
                        ORDER   BY post_date ASC
                        LIMIT 1");
 
+       /* translators: Calendar caption: 1: month name, 2: 4-digit year */
+       $calendar_caption = _x('%1$s %2$s', 'calendar caption');
        echo '<table id="wp-calendar" summary="' . __('Calendar') . '">
        echo '<table id="wp-calendar" summary="' . __('Calendar') . '">
-       <caption>' . sprintf(_c('%1$s %2$s|Used as a calendar caption'), $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
+       <caption>' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
        <thead>
        <tr>';
 
        <thead>
        <tr>';
 
@@ -1039,8 +1101,7 @@ function get_calendar($initial = true) {
        if ( $ak_post_titles ) {
                foreach ( (array) $ak_post_titles as $ak_post_title ) {
 
        if ( $ak_post_titles ) {
                foreach ( (array) $ak_post_titles as $ak_post_title ) {
 
-                               $post_title = apply_filters( "the_title", $ak_post_title->post_title );
-                               $post_title = str_replace('"', '&quot;', wptexturize( $post_title ));
+                               $post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title ) );
 
                                if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
                                        $ak_titles_for_day['day_'.$ak_post_title->dom] = '';
 
                                if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
                                        $ak_titles_for_day['day_'.$ak_post_title->dom] = '';
@@ -1141,7 +1202,7 @@ function allowed_tags() {
  */
 function the_date_xml() {
        global $post;
  */
 function the_date_xml() {
        global $post;
-       echo mysql2date('Y-m-d', $post->post_date);
+       echo mysql2date('Y-m-d', $post->post_date, false);
 }
 
 /**
 }
 
 /**
@@ -1169,12 +1230,13 @@ function the_date($d='', $before='', $after='', $echo = true) {
                        $the_date .= mysql2date($d, $post->post_date);
                $the_date .= $after;
                $previousday = $day;
                        $the_date .= mysql2date($d, $post->post_date);
                $the_date .= $after;
                $previousday = $day;
-       }
+
        $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
        if ( $echo )
                echo $the_date;
        else
                return $the_date;
        $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
        if ( $echo )
                echo $the_date;
        else
                return $the_date;
+       }
 }
 
 /**
 }
 
 /**
@@ -1199,9 +1261,9 @@ function the_modified_date($d = '') {
  */
 function get_the_modified_date($d = '') {
        if ( '' == $d )
  */
 function get_the_modified_date($d = '') {
        if ( '' == $d )
-               $the_time = get_post_modified_time(get_option('date_format'));
+               $the_time = get_post_modified_time(get_option('date_format'), null, null, true);
        else
        else
-               $the_time = get_post_modified_time($d);
+               $the_time = get_post_modified_time($d, null, null, true);
        return apply_filters('get_the_modified_date', $the_time, $d);
 }
 
        return apply_filters('get_the_modified_date', $the_time, $d);
 }
 
@@ -1229,9 +1291,9 @@ function get_the_time( $d = '', $post = null ) {
        $post = get_post($post);
 
        if ( '' == $d )
        $post = get_post($post);
 
        if ( '' == $d )
-               $the_time = get_post_time(get_option('time_format'), false, $post);
+               $the_time = get_post_time(get_option('time_format'), false, $post, true);
        else
        else
-               $the_time = get_post_time($d, false, $post);
+               $the_time = get_post_time($d, false, $post, true);
        return apply_filters('get_the_time', $the_time, $d, $post);
 }
 
        return apply_filters('get_the_time', $the_time, $d, $post);
 }
 
@@ -1243,9 +1305,10 @@ function get_the_time( $d = '', $post = null ) {
  * @param string $d Either 'G', 'U', or php date format.
  * @param bool $gmt Whether of not to return the gmt time.
  * @param int|object $post Optional post ID or object. Default is global $post object.
  * @param string $d Either 'G', 'U', or php date format.
  * @param bool $gmt Whether of not to return the gmt time.
  * @param int|object $post Optional post ID or object. Default is global $post object.
+ * @param bool $translate Whether to translate the time string or not
  * @return string
  */
  * @return string
  */
-function get_post_time( $d = 'U', $gmt = false, $post = null ) { // returns timestamp
+function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { // returns timestamp
        $post = get_post($post);
 
        if ( $gmt )
        $post = get_post($post);
 
        if ( $gmt )
@@ -1253,7 +1316,7 @@ function get_post_time( $d = 'U', $gmt = false, $post = null ) { // returns time
        else
                $time = $post->post_date;
 
        else
                $time = $post->post_date;
 
-       $time = mysql2date($d, $time);
+       $time = mysql2date($d, $time, $translate);
        return apply_filters('get_post_time', $time, $d, $gmt);
 }
 
        return apply_filters('get_post_time', $time, $d, $gmt);
 }
 
@@ -1278,9 +1341,9 @@ function the_modified_time($d = '') {
  */
 function get_the_modified_time($d = '') {
        if ( '' == $d )
  */
 function get_the_modified_time($d = '') {
        if ( '' == $d )
-               $the_time = get_post_modified_time(get_option('time_format'));
+               $the_time = get_post_modified_time(get_option('time_format'), null, null, true);
        else
        else
-               $the_time = get_post_modified_time($d);
+               $the_time = get_post_modified_time($d, null, null, true);
        return apply_filters('get_the_modified_time', $the_time, $d);
 }
 
        return apply_filters('get_the_modified_time', $the_time, $d);
 }
 
@@ -1291,18 +1354,20 @@ function get_the_modified_time($d = '') {
  *
  * @param string $d Either 'G', 'U', or php date format.
  * @param bool $gmt Whether of not to return the gmt time.
  *
  * @param string $d Either 'G', 'U', or php date format.
  * @param bool $gmt Whether of not to return the gmt time.
+ * @param int|object $post A post_id or post object
+ * @param bool translate Whether to translate the result or not
  * @return string Returns timestamp
  */
  * @return string Returns timestamp
  */
-function get_post_modified_time( $d = 'U', $gmt = false ) {
-       global $post;
+function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
+       $post = get_post($post);
 
        if ( $gmt )
                $time = $post->post_modified_gmt;
        else
                $time = $post->post_modified;
 
        if ( $gmt )
                $time = $post->post_modified_gmt;
        else
                $time = $post->post_modified;
-       $time = mysql2date($d, $time);
+       $time = mysql2date($d, $time, $translate);
 
 
-       return apply_filters('get_the_modified_time', $time, $d, $gmt);
+       return apply_filters('get_post_modified_time', $time, $d, $gmt);
 }
 
 /**
 }
 
 /**
@@ -1314,7 +1379,7 @@ function get_post_modified_time( $d = 'U', $gmt = false ) {
  */
 function the_weekday() {
        global $wp_locale, $post;
  */
 function the_weekday() {
        global $wp_locale, $post;
-       $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date));
+       $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
        $the_weekday = apply_filters('the_weekday', $the_weekday);
        echo $the_weekday;
 }
        $the_weekday = apply_filters('the_weekday', $the_weekday);
        echo $the_weekday;
 }
@@ -1335,7 +1400,7 @@ function the_weekday_date($before='',$after='') {
        $the_weekday_date = '';
        if ( $day != $previousweekday ) {
                $the_weekday_date .= $before;
        $the_weekday_date = '';
        if ( $day != $previousweekday ) {
                $the_weekday_date .= $before;
-               $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date));
+               $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
                $the_weekday_date .= $after;
                $previousweekday = $day;
        }
                $the_weekday_date .= $after;
                $previousweekday = $day;
        }
@@ -1363,6 +1428,102 @@ function wp_footer() {
        do_action('wp_footer');
 }
 
        do_action('wp_footer');
 }
 
+/**
+ * Enable/disable automatic general feed link outputting.
+ *
+ * @since 2.8.0
+ *
+ * @param boolean $add Add or remove links. Defaults to true.
+ */
+function automatic_feed_links( $add = true ) {
+       if ( $add )
+               add_action( 'wp_head', 'feed_links', 2 );
+       else {
+               remove_action( 'wp_head', 'feed_links', 2 );
+               remove_action( 'wp_head', 'feed_links_extra', 3 );
+       }
+}
+
+/**
+ * Display the links to the general feeds.
+ *
+ * @since 2.8.0
+ *
+ * @param array $args Optional arguments.
+ */
+function feed_links( $args ) {
+       $defaults = array(
+               /* translators: Separator between blog name and feed type in feed links */
+               'separator'     => _x('&raquo;', 'feed link'),
+               /* translators: 1: blog title, 2: separator (raquo) */
+               'feedtitle'     => __('%1$s %2$s Feed'),
+               /* translators: %s: blog title, 2: separator (raquo) */
+               'comstitle'     => __('%1$s %2$s Comments Feed'),
+       );
+
+       $args = wp_parse_args( $args, $defaults );
+
+       echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf( $args['feedtitle'], get_bloginfo('name'), $args['separator'] )) . '" href="' . get_feed_link() . "\" />\n";
+       echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf( $args['comstitle'], get_bloginfo('name'), $args['separator'] )) . '" href="' . get_feed_link( 'comments_' . get_default_feed() ) . "\" />\n";
+}
+
+/**
+ * Display the links to the extra feeds such as category feeds.
+ *
+ * @since 2.8.0
+ *
+ * @param array $args Optional arguments.
+ */
+function feed_links_extra( $args ) {
+       $defaults = array(
+               /* translators: Separator between blog name and feed type in feed links */
+               'separator'   => _x('&raquo;', 'feed link'),
+               /* translators: 1: blog name, 2: separator(raquo), 3: post title */
+               'singletitle' => __('%1$s %2$s %3$s Comments Feed'),
+               /* translators: 1: blog name, 2: separator(raquo), 3: category name */
+               'cattitle'    => __('%1$s %2$s %3$s Category Feed'),
+               /* translators: 1: blog name, 2: separator(raquo), 3: tag name */
+               'tagtitle'    => __('%1$s %2$s %3$s Tag Feed'),
+               /* translators: 1: blog name, 2: separator(raquo), 3: author name  */
+               'authortitle' => __('%1$s %2$s Posts by %3$s Feed'),
+               /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */
+               'searchtitle' => __('%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed'),
+       );
+
+       $args = wp_parse_args( $args, $defaults );
+
+       if ( is_single() || is_page() ) {
+               $post = &get_post( $id = 0 );
+
+               if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
+                       $title = esc_attr(sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ));
+                       $href = get_post_comments_feed_link( $post->ID );
+               }
+       } elseif ( is_category() ) {
+               $cat_id = intval( get_query_var('cat') );
+
+               $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name( $cat_id ) ));
+               $href = get_category_feed_link( $cat_id );
+       } elseif ( is_tag() ) {
+               $tag_id = intval( get_query_var('tag_id') );
+               $tag = get_tag( $tag_id );
+
+               $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name ));
+               $href = get_tag_feed_link( $tag_id );
+       } elseif ( is_author() ) {
+               $author_id = intval( get_query_var('author') );
+
+               $title = esc_attr(sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ));
+               $href = get_author_feed_link( $author_id );
+       } elseif ( is_search() ) {
+               $title = esc_attr(sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query() ));
+               $href = get_search_feed_link();
+       }
+
+       if ( isset($title) && isset($href) )
+               echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . $title . '" href="' . $href . '" />' . "\n";
+}
+
 /**
  * Display the link to the Really Simple Discovery service endpoint.
  *
 /**
  * Display the link to the Really Simple Discovery service endpoint.
  *
@@ -1487,67 +1648,52 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
                $media_buttons = false;
 
        $richedit =  user_can_richedit();
                $media_buttons = false;
 
        $richedit =  user_can_richedit();
-       $rows = "rows='$rows'";
+       $class = '';
 
        if ( $richedit || $media_buttons ) { ?>
        <div id="editor-toolbar">
 
        if ( $richedit || $media_buttons ) { ?>
        <div id="editor-toolbar">
-       <?php if ( $richedit ) {
+<?php
+       if ( $richedit ) {
                $wp_default_editor = wp_default_editor(); ?>
                <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
                $wp_default_editor = wp_default_editor(); ?>
                <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
-               <?php if ( 'html' == $wp_default_editor ) {
+<?php  if ( 'html' == $wp_default_editor ) {
                        add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
                        add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
-                       <a id="edButtonHTML" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
-                       <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
-               <?php } else {
+                       <a id="edButtonHTML" class="active hide-if-no-js" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
+                       <a id="edButtonPreview" class="hide-if-no-js" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
+<?php  } else {
+                       $class = " class='theEditor'";
                        add_filter('the_editor_content', 'wp_richedit_pre'); ?>
                        add_filter('the_editor_content', 'wp_richedit_pre'); ?>
-                       <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
-                       <a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
-               <?php }
-               }
+                       <a id="edButtonHTML" class="hide-if-no-js" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
+                       <a id="edButtonPreview" class="active hide-if-no-js" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
+<?php  }
+       }
 
 
-               if ( $media_buttons ) { ?>
-                       <div id="media-buttons" class="hide-if-no-js">
-                       <?php do_action( 'media_buttons' ); ?>
-                       </div>
-               <?php } ?>
+       if ( $media_buttons ) { ?>
+               <div id="media-buttons" class="hide-if-no-js">
+<?php  do_action( 'media_buttons' ); ?>
+               </div>
+<?php
+       } ?>
        </div>
        </div>
-       <?php } ?>
-
-       <div id="quicktags">
-       <?php wp_print_scripts( 'quicktags' ); ?>
+<?php
+       }
+?>
+       <div id="quicktags"><?php
+       wp_print_scripts( 'quicktags' ); ?>
        <script type="text/javascript">edToolbar()</script>
        </div>
 
        <script type="text/javascript">edToolbar()</script>
        </div>
 
-       <?php $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea $rows cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
+<?php
+       $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea rows='$rows'$class cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
        $the_editor_content = apply_filters('the_editor_content', $content);
 
        printf($the_editor, $the_editor_content);
 
        $the_editor_content = apply_filters('the_editor_content', $content);
 
        printf($the_editor, $the_editor_content);
 
-       ?>
+?>
        <script type="text/javascript">
        <script type="text/javascript">
-       // <![CDATA[
        edCanvas = document.getElementById('<?php echo $id; ?>');
        edCanvas = document.getElementById('<?php echo $id; ?>');
-       <?php if ( user_can_richedit() && $prev_id ) { ?>
-       var dotabkey = true;
-       // If tinyMCE is defined.
-       if ( typeof tinyMCE != 'undefined' ) {
-               // This code is meant to allow tabbing from Title to Post (TinyMCE).
-               jQuery('#<?php echo $prev_id; ?>')[jQuery.browser.opera ? 'keypress' : 'keydown'](function (e) {
-                       if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
-                               if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
-                               if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
-                                       e.preventDefault();
-                                       dotabkey = false;
-                                       tinyMCE.activeEditor.focus();
-                                       return false;
-                               }
-                       }
-               });
-       }
-       <?php } ?>
-       // ]]>
        </script>
        </script>
-       <?php
+<?php
 }
 
 /**
 }
 
 /**
@@ -1564,14 +1710,14 @@ function get_search_query() {
 /**
  * Display the contents of the search query variable.
  *
 /**
  * Display the contents of the search query variable.
  *
- * The search query string is passed through {@link attribute_escape()}
+ * The search query string is passed through {@link esc_attr()}
  * to ensure that it is safe for placing in an html attribute.
  *
  * to ensure that it is safe for placing in an html attribute.
  *
- * @uses attribute_escape
+ * @uses attr
  * @since 2.1.0
  */
 function the_search_query() {
  * @since 2.1.0
  */
 function the_search_query() {
-       echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
+       echo esc_attr( apply_filters( 'the_search_query', get_search_query() ) );
 }
 
 /**
 }
 
 /**
@@ -1688,7 +1834,7 @@ function paginate_links( $args = '' ) {
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link .= $add_fragment;
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link .= $add_fragment;
-               $page_links[] = "<a class='prev page-numbers' href='" . clean_url($link) . "'>$prev_text</a>";
+               $page_links[] = "<a class='prev page-numbers' href='" . esc_url($link) . "'>$prev_text</a>";
        endif;
        for ( $n = 1; $n <= $total; $n++ ) :
                $n_display = number_format_i18n($n);
        endif;
        for ( $n = 1; $n <= $total; $n++ ) :
                $n_display = number_format_i18n($n);
@@ -1702,7 +1848,7 @@ function paginate_links( $args = '' ) {
                                if ( $add_args )
                                        $link = add_query_arg( $add_args, $link );
                                $link .= $add_fragment;
                                if ( $add_args )
                                        $link = add_query_arg( $add_args, $link );
                                $link .= $add_fragment;
-                               $page_links[] = "<a class='page-numbers' href='" . clean_url($link) . "'>$n_display</a>";
+                               $page_links[] = "<a class='page-numbers' href='" . esc_url($link) . "'>$n_display</a>";
                                $dots = true;
                        elseif ( $dots && !$show_all ) :
                                $page_links[] = "<span class='page-numbers dots'>...</span>";
                                $dots = true;
                        elseif ( $dots && !$show_all ) :
                                $page_links[] = "<span class='page-numbers dots'>...</span>";
@@ -1716,7 +1862,7 @@ function paginate_links( $args = '' ) {
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link .= $add_fragment;
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link .= $add_fragment;
-               $page_links[] = "<a class='next page-numbers' href='" . clean_url($link) . "'>$next_text</a>";
+               $page_links[] = "<a class='next page-numbers' href='" . esc_url($link) . "'>$next_text</a>";
        endif;
        switch ( $type ) :
                case 'array' :
        endif;
        switch ( $type ) :
                case 'array' :
@@ -1816,9 +1962,9 @@ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
                return;
        }
 
                return;
        }
 
-       echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
+       echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
        if ( 'rtl' == get_bloginfo( 'text_direction' ) )
        if ( 'rtl' == get_bloginfo( 'text_direction' ) )
-               echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
+               echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
 }
 
 /**
 }
 
 /**
@@ -1875,10 +2021,10 @@ function the_generator( $type ) {
 function get_the_generator( $type ) {
        switch ($type) {
                case 'html':
 function get_the_generator( $type ) {
        switch ($type) {
                case 'html':
-                       $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">' . "\n";
+                       $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
                        break;
                case 'xhtml':
                        break;
                case 'xhtml':
-                       $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />' . "\n";
+                       $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />';
                        break;
                case 'atom':
                        $gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
                        break;
                case 'atom':
                        $gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
index 08ec5801936a24d8e75f3c2c21f71b6be8bff9e8..af4c43b33dd2e25f93e2e3fb78531bfe436c8cd2 100644 (file)
@@ -8,38 +8,42 @@
  *
  * @package WordPress
  * @subpackage HTTP
  *
  * @package WordPress
  * @subpackage HTTP
- * @since 2.7
+ * @since 2.7.0
  * @author Jacob Santos <wordpress@santosj.name>
  */
 
 /**
  * WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
  *
  * @author Jacob Santos <wordpress@santosj.name>
  */
 
 /**
  * WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
  *
- * This class is called for the functionality of making HTTP requests and should
- * replace Snoopy functionality, eventually. There is no available functionality
- * to add HTTP transport implementations, since most of the HTTP transports are
- * added and available for use.
+ * This class is called for the functionality of making HTTP requests and should replace Snoopy
+ * functionality, eventually. There is no available functionality to add HTTP transport
+ * implementations, since most of the HTTP transports are added and available for use.
+ *
+ * The exception is that cURL is not available as a transport and lacking an implementation. It will
+ * be added later and should be a patch on the WordPress Trac.
+ *
+ * There are no properties, because none are needed and for performance reasons. Some of the
+ * functions are static and while they do have some overhead over functions in PHP4, the purpose is
+ * maintainability. When PHP5 is finally the requirement, it will be easy to add the static keyword
+ * to the code. It is not as easy to convert a function to a method after enough code uses the old
+ * way.
  *
  *
- * The exception is that cURL is not available as a transport and lacking an
- * implementation. It will be added later and should be a patch on the WordPress
- * Trac.
+ * Debugging includes several actions, which pass different variables for debugging the HTTP API.
  *
  *
- * There are no properties, because none are needed and for performance reasons.
- * Some of the functions are static and while they do have some overhead over
- * functions in PHP4, the purpose is maintainability. When PHP5 is finally the
- * requirement, it will be easy to add the static keyword to the code. It is not
- * as easy to convert a function to a method after enough code uses the old way.
+ * <strong>http_transport_get_debug</strong> - gives working, nonblocking, and blocking transports.
+ *
+ * <strong>http_transport_post_debug</strong> - gives working, nonblocking, and blocking transports.
  *
  * @package WordPress
  * @subpackage HTTP
  *
  * @package WordPress
  * @subpackage HTTP
- * @since 2.7
+ * @since 2.7.0
  */
 class WP_Http {
 
        /**
         * PHP4 style Constructor - Calls PHP5 Style Constructor
         *
  */
 class WP_Http {
 
        /**
         * PHP4 style Constructor - Calls PHP5 Style Constructor
         *
-        * @since 2.7
+        * @since 2.7.0
         * @return WP_Http
         */
        function WP_Http() {
         * @return WP_Http
         */
        function WP_Http() {
@@ -55,7 +59,7 @@ class WP_Http {
         * The transport are setup to save time. This should only be called once, so
         * the overhead should be fine.
         *
         * The transport are setup to save time. This should only be called once, so
         * the overhead should be fine.
         *
-        * @since 2.7
+        * @since 2.7.0
         * @return WP_Http
         */
        function __construct() {
         * @return WP_Http
         */
        function __construct() {
@@ -69,11 +73,11 @@ class WP_Http {
         * Tests all of the objects and returns the object that passes. Also caches
         * that object to be used later.
         *
         * Tests all of the objects and returns the object that passes. Also caches
         * that object to be used later.
         *
-        * The order for the GET/HEAD requests are Streams, HTTP Extension, Fopen,
-        * and finally Fsockopen. fsockopen() is used last, because it has the most
-        * overhead in its implementation. There isn't any real way around it, since
-        * redirects have to be supported, much the same way the other transports
-        * also handle redirects.
+        * The order for the GET/HEAD requests are HTTP Extension, FSockopen Streams, 
+        * Fopen, and finally cURL. Whilst Fsockopen has the highest overhead, Its
+        * used 2nd due to high compatibility with most hosts, The HTTP Extension is
+        * tested first due to hosts which have it enabled, are likely to work
+        * correctly with it.
         *
         * There are currently issues with "localhost" not resolving correctly with
         * DNS. This may cause an error "failed to open stream: A connection attempt
         *
         * There are currently issues with "localhost" not resolving correctly with
         * DNS. This may cause an error "failed to open stream: A connection attempt
@@ -81,7 +85,7 @@ class WP_Http {
         * period of time, or established connection failed because connected host
         * has failed to respond."
         *
         * period of time, or established connection failed because connected host
         * has failed to respond."
         *
-        * @since 2.7
+        * @since 2.7.0
         * @access private
         *
         * @param array $args Request args, default us an empty array
         * @access private
         *
         * @param array $args Request args, default us an empty array
@@ -91,21 +95,21 @@ class WP_Http {
                static $working_transport, $blocking_transport, $nonblocking_transport;
 
                if ( is_null($working_transport) ) {
                static $working_transport, $blocking_transport, $nonblocking_transport;
 
                if ( is_null($working_transport) ) {
-                       if ( true === WP_Http_ExtHttp::test() && apply_filters('use_http_extension_transport', true) ) {
+                       if ( true === WP_Http_ExtHttp::test($args) ) {
                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
                                $blocking_transport[] = &$working_transport['exthttp'];
                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
                                $blocking_transport[] = &$working_transport['exthttp'];
-                       } else if ( true === WP_Http_Curl::test() && apply_filters('use_curl_transport', true) ) {
-                               $working_transport['curl'] = new WP_Http_Curl();
-                               $blocking_transport[] = &$working_transport['curl'];
-                       } else if ( true === WP_Http_Streams::test() && apply_filters('use_streams_transport', true) ) {
+                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
+                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
+                               $blocking_transport[] = &$working_transport['fsockopen'];
+                       } else if ( true === WP_Http_Streams::test($args) ) {
                                $working_transport['streams'] = new WP_Http_Streams();
                                $blocking_transport[] = &$working_transport['streams'];
                                $working_transport['streams'] = new WP_Http_Streams();
                                $blocking_transport[] = &$working_transport['streams'];
-                       } else if ( true === WP_Http_Fopen::test() && apply_filters('use_fopen_transport', true) ) {
+                       } else if ( true === WP_Http_Fopen::test($args) ) {
                                $working_transport['fopen'] = new WP_Http_Fopen();
                                $blocking_transport[] = &$working_transport['fopen'];
                                $working_transport['fopen'] = new WP_Http_Fopen();
                                $blocking_transport[] = &$working_transport['fopen'];
-                       } else if ( true === WP_Http_Fsockopen::test() && apply_filters('use_fsockopen_transport', true) ) {
-                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
-                               $blocking_transport[] = &$working_transport['fsockopen'];
+                       } else if ( true === WP_Http_Curl::test($args) ) {
+                               $working_transport['curl'] = new WP_Http_Curl();
+                               $blocking_transport[] = &$working_transport['curl'];
                        }
 
                        foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) {
                        }
 
                        foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) {
@@ -114,6 +118,9 @@ class WP_Http {
                        }
                }
 
                        }
                }
 
+               if ( has_filter('http_transport_get_debug') )
+                       do_action('http_transport_get_debug', $working_transport, $blocking_transport, $nonblocking_transport);
+
                if ( isset($args['blocking']) && !$args['blocking'] )
                        return $nonblocking_transport;
                else
                if ( isset($args['blocking']) && !$args['blocking'] )
                        return $nonblocking_transport;
                else
@@ -129,7 +136,7 @@ class WP_Http {
         * to send content, but the streams transport can. This is a limitation that
         * is addressed here, by just not including that transport.
         *
         * to send content, but the streams transport can. This is a limitation that
         * is addressed here, by just not including that transport.
         *
-        * @since 2.7
+        * @since 2.7.0
         * @access private
         *
         * @param array $args Request args, default us an empty array
         * @access private
         *
         * @param array $args Request args, default us an empty array
@@ -139,23 +146,29 @@ class WP_Http {
                static $working_transport, $blocking_transport, $nonblocking_transport;
 
                if ( is_null($working_transport) ) {
                static $working_transport, $blocking_transport, $nonblocking_transport;
 
                if ( is_null($working_transport) ) {
-                       if ( true === WP_Http_ExtHttp::test() && apply_filters('use_http_extension_transport', true) ) {
+                       if ( true === WP_Http_ExtHttp::test($args) ) {
                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
                                $blocking_transport[] = &$working_transport['exthttp'];
                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
                                $blocking_transport[] = &$working_transport['exthttp'];
-                       } else if ( true === WP_Http_Streams::test() && apply_filters('use_streams_transport', true) ) {
-                               $working_transport['streams'] = new WP_Http_Streams();
-                               $blocking_transport[] = &$working_transport['streams'];
-                       } else if ( true === WP_Http_Fsockopen::test() && apply_filters('use_fsockopen_transport', true) ) {
+                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
                                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
                                $blocking_transport[] = &$working_transport['fsockopen'];
                                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
                                $blocking_transport[] = &$working_transport['fsockopen'];
+                       } else if ( true === WP_Http_Streams::test($args) ) {
+                               $working_transport['streams'] = new WP_Http_Streams();
+                               $blocking_transport[] = &$working_transport['streams'];
+                       } else if ( true === WP_Http_Curl::test($args) ) {
+                               $working_transport['curl'] = new WP_Http_Curl();
+                               $blocking_transport[] = &$working_transport['curl'];
                        }
 
                        }
 
-                       foreach ( array('streams', 'fsockopen', 'exthttp') as $transport ) {
+                       foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) {
                                if ( isset($working_transport[$transport]) )
                                        $nonblocking_transport[] = &$working_transport[$transport];
                        }
                }
 
                                if ( isset($working_transport[$transport]) )
                                        $nonblocking_transport[] = &$working_transport[$transport];
                        }
                }
 
+               if ( has_filter('http_transport_post_debug') )
+                       do_action('http_transport_post_debug', $working_transport, $blocking_transport, $nonblocking_transport);
+
                if ( isset($args['blocking']) && !$args['blocking'] )
                        return $nonblocking_transport;
                else
                if ( isset($args['blocking']) && !$args['blocking'] )
                        return $nonblocking_transport;
                else
@@ -165,47 +178,42 @@ class WP_Http {
        /**
         * Send a HTTP request to a URI.
         *
        /**
         * Send a HTTP request to a URI.
         *
-        * The body and headers are part of the arguments. The 'body' argument is
-        * for the body and will accept either a string or an array. The 'headers'
-        * argument should be an array, but a string is acceptable. If the 'body'
-        * argument is an array, then it will automatically be escaped using
-        * http_build_query().
-        *
-        * The only URI that are supported in the HTTP Transport implementation are
-        * the HTTP and HTTPS protocols. HTTP and HTTPS are assumed so the server
-        * might not know how to handle the send headers. Other protocols are
-        * unsupported and most likely will fail.
-        *
-        * The defaults are 'method', 'timeout', 'redirection', 'httpversion',
-        * 'blocking' and 'user-agent'.
-        *
-        * Accepted 'method' values are 'GET', 'POST', and 'HEAD', some transports
-        * technically allow others, but should not be assumed. The 'timeout' is
-        * used to sent how long the connection should stay open before failing when
-        * no response. 'redirection' is used to track how many redirects were taken
-        * and used to sent the amount for other transports, but not all transports
+        * The body and headers are part of the arguments. The 'body' argument is for the body and will
+        * accept either a string or an array. The 'headers' argument should be an array, but a string
+        * is acceptable. If the 'body' argument is an array, then it will automatically be escaped
+        * using http_build_query().
+        *
+        * The only URI that are supported in the HTTP Transport implementation are the HTTP and HTTPS
+        * protocols. HTTP and HTTPS are assumed so the server might not know how to handle the send
+        * headers. Other protocols are unsupported and most likely will fail.
+        *
+        * The defaults are 'method', 'timeout', 'redirection', 'httpversion', 'blocking' and
+        * 'user-agent'.
+        *
+        * Accepted 'method' values are 'GET', 'POST', and 'HEAD', some transports technically allow
+        * others, but should not be assumed. The 'timeout' is used to sent how long the connection
+        * should stay open before failing when no response. 'redirection' is used to track how many
+        * redirects were taken and used to sent the amount for other transports, but not all transports
         * accept setting that value.
         *
         * accept setting that value.
         *
-        * The 'httpversion' option is used to sent the HTTP version and accepted
-        * values are '1.0', and '1.1' and should be a string. Version 1.1 is not
-        * supported, because of chunk response. The 'user-agent' option is the
-        * user-agent and is used to replace the default user-agent, which is
+        * The 'httpversion' option is used to sent the HTTP version and accepted values are '1.0', and
+        * '1.1' and should be a string. Version 1.1 is not supported, because of chunk response. The
+        * 'user-agent' option is the user-agent and is used to replace the default user-agent, which is
         * 'WordPress/WP_Version', where WP_Version is the value from $wp_version.
         *
         * 'WordPress/WP_Version', where WP_Version is the value from $wp_version.
         *
-        * 'blocking' is the default, which is used to tell the transport, whether
-        * it should halt PHP while it performs the request or continue regardless.
-        * Actually, that isn't entirely correct. Blocking mode really just means
-        * whether the fread should just pull what it can whenever it gets bytes or
-        * if it should wait until it has enough in the buffer to read or finishes
-        * reading the entire content. It doesn't actually always mean that PHP will
-        * continue going after making the request.
+        * 'blocking' is the default, which is used to tell the transport, whether it should halt PHP
+        * while it performs the request or continue regardless. Actually, that isn't entirely correct.
+        * Blocking mode really just means whether the fread should just pull what it can whenever it
+        * gets bytes or if it should wait until it has enough in the buffer to read or finishes reading
+        * the entire content. It doesn't actually always mean that PHP will continue going after making
+        * the request.
         *
         * @access public
         *
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
-        * @return boolean
+        * @return array containing 'headers', 'body', 'response', 'cookies'
         */
        function request( $url, $args = array() ) {
                global $wp_version;
         */
        function request( $url, $args = array() ) {
                global $wp_version;
@@ -215,13 +223,32 @@ class WP_Http {
                        'timeout' => apply_filters( 'http_request_timeout', 5),
                        'redirection' => apply_filters( 'http_request_redirection_count', 5),
                        'httpversion' => apply_filters( 'http_request_version', '1.0'),
                        'timeout' => apply_filters( 'http_request_timeout', 5),
                        'redirection' => apply_filters( 'http_request_redirection_count', 5),
                        'httpversion' => apply_filters( 'http_request_version', '1.0'),
-                       'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version ),
+                       'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )  ),
                        'blocking' => true,
                        'blocking' => true,
-                       'headers' => array(), 'body' => null
+                       'headers' => array(),
+                       'cookies' => array(),
+                       'body' => null,
+                       'compress' => false,
+                       'decompress' => true,
+                       'sslverify' => true
                );
 
                $r = wp_parse_args( $args, $defaults );
                );
 
                $r = wp_parse_args( $args, $defaults );
-               $r = apply_filters( 'http_request_args', $r );
+               $r = apply_filters( 'http_request_args', $r, $url );
+
+               $arrURL = parse_url($url);
+
+               if ( $this->block_request( $url ) )
+                       return new WP_Error('http_request_failed', 'User has blocked requests through HTTP.');
+
+               // Determine if this is a https call and pass that on to the transport functions
+               // so that we can blacklist the transports that do not support ssl verification
+               $r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
+
+               // Determine if this request is to OUR install of WordPress
+               $homeURL = parse_url(get_bloginfo('url'));
+               $r['local'] = $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'];
+               unset($homeURL);
 
                if ( is_null( $r['headers'] ) )
                        $r['headers'] = array();
 
                if ( is_null( $r['headers'] ) )
                        $r['headers'] = array();
@@ -241,6 +268,12 @@ class WP_Http {
                        unset($r['headers']['user-agent']);
                }
 
                        unset($r['headers']['user-agent']);
                }
 
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
+               if ( WP_Http_Encoding::is_available() )
+                       $r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding();
+
                if ( is_null($r['body']) ) {
                        // Some servers fail when sending content without the content-length
                        // header being set.
                if ( is_null($r['body']) ) {
                        // Some servers fail when sending content without the content-length
                        // header being set.
@@ -248,7 +281,10 @@ class WP_Http {
                        $transports = WP_Http::_getTransport($r);
                } else {
                        if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
                        $transports = WP_Http::_getTransport($r);
                } else {
                        if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
-                               $r['body'] = http_build_query($r['body'], null, '&');
+                               if ( ! version_compare(phpversion(), '5.1.2', '>=') )
+                                       $r['body'] = _http_build_query($r['body'], null, '&');
+                               else
+                                       $r['body'] = http_build_query($r['body'], null, '&');
                                $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset');
                                $r['headers']['Content-Length'] = strlen($r['body']);
                        }
                                $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset');
                                $r['headers']['Content-Length'] = strlen($r['body']);
                        }
@@ -259,11 +295,17 @@ class WP_Http {
                        $transports = WP_Http::_postTransport($r);
                }
 
                        $transports = WP_Http::_postTransport($r);
                }
 
-               $response = array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
-               foreach( (array) $transports as $transport ) {
+               if ( has_action('http_api_debug') )
+                       do_action('http_api_debug', $transports, 'transports_list');
+
+               $response = array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+               foreach ( (array) $transports as $transport ) {
                        $response = $transport->request($url, $r);
 
                        $response = $transport->request($url, $r);
 
-                       if( !is_wp_error($response) )
+                       if ( has_action('http_api_debug') )
+                               do_action( 'http_api_debug', $response, 'response', get_class($transport) );
+
+                       if ( ! is_wp_error($response) )
                                return $response;
                }
 
                                return $response;
                }
 
@@ -276,7 +318,7 @@ class WP_Http {
         * Used for sending data that is expected to be in the body.
         *
         * @access public
         * Used for sending data that is expected to be in the body.
         *
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
@@ -294,7 +336,7 @@ class WP_Http {
         * Used for sending data that is expected to be in the body.
         *
         * @access public
         * Used for sending data that is expected to be in the body.
         *
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
@@ -312,7 +354,7 @@ class WP_Http {
         * Used for sending data that is expected to be in the body.
         *
         * @access public
         * Used for sending data that is expected to be in the body.
         *
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
@@ -329,7 +371,7 @@ class WP_Http {
         *
         * @access public
         * @static
         *
         * @access public
         * @static
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $strResponse The full response string
         * @return array Array with 'headers' and 'body' keys.
         *
         * @param string $strResponse The full response string
         * @return array Array with 'headers' and 'body' keys.
@@ -342,23 +384,31 @@ class WP_Http {
        /**
         * Transform header string into an array.
         *
        /**
         * Transform header string into an array.
         *
-        * If an array is given then it is assumed to be raw header data with
-        * numeric keys with the headers as the values. No headers must be passed
-        * that were already processed.
+        * If an array is given then it is assumed to be raw header data with numeric keys with the
+        * headers as the values. No headers must be passed that were already processed.
         *
         * @access public
         * @static
         *
         * @access public
         * @static
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string|array $headers
         *
         * @param string|array $headers
-        * @return array Processed string headers
+        * @return array Processed string headers. If duplicate headers are encountered,
+        *                                      Then a numbered array is returned as the value of that header-key.
         */
        function processHeaders($headers) {
         */
        function processHeaders($headers) {
-               if ( is_string($headers) )
-                       $headers = explode("\n", str_replace(array("\r\n", "\r"), "\n", $headers) );
+               // split headers, one per array element
+               if ( is_string($headers) ) {
+                       // tolerate line terminator: CRLF = LF (RFC 2616 19.3)
+                       $headers = str_replace("\r\n", "\n", $headers);
+                       // unfold folded header fields. LWS = [CRLF] 1*( SP | HT ) <US-ASCII SP, space (32)>, <US-ASCII HT, horizontal-tab (9)> (RFC 2616 2.2)
+                       $headers = preg_replace('/\n[ \t]/', ' ', $headers);
+                       // create the headers array
+                       $headers = explode("\n", $headers);
+               }
 
                $response = array('code' => 0, 'message' => '');
 
 
                $response = array('code' => 0, 'message' => '');
 
+               $cookies = array();
                $newheaders = array();
                foreach ( $headers as $tempheader ) {
                        if ( empty($tempheader) )
                $newheaders = array();
                foreach ( $headers as $tempheader ) {
                        if ( empty($tempheader) )
@@ -373,23 +423,54 @@ class WP_Http {
 
                        list($key, $value) = explode(':', $tempheader, 2);
 
 
                        list($key, $value) = explode(':', $tempheader, 2);
 
-                       if ( ! empty($value) )
-                               $newheaders[strtolower($key)] = trim($value);
+                       if ( !empty( $value ) ) {
+                               $key = strtolower( $key );
+                               if ( isset( $newheaders[$key] ) ) {
+                                       $newheaders[$key] = array( $newheaders[$key], trim( $value ) );
+                               } else {
+                                       $newheaders[$key] = trim( $value );
+                               }
+                               if ( 'set-cookie' == strtolower( $key ) )
+                                       $cookies[] = new WP_Http_Cookie( $value );
+                       }
                }
 
                }
 
-               return array('response' => $response, 'headers' => $newheaders);
+               return array('response' => $response, 'headers' => $newheaders, 'cookies' => $cookies);
+       }
+
+       /**
+        * Takes the arguments for a ::request() and checks for the cookie array.
+        *
+        * If it's found, then it's assumed to contain WP_Http_Cookie objects, which are each parsed
+        * into strings and added to the Cookie: header (within the arguments array). Edits the array by
+        * reference.
+        *
+        * @access public
+        * @version 2.8.0
+        * @static
+        *
+        * @param array $r Full array of args passed into ::request()
+        */
+       function buildCookieHeader( &$r ) {
+               if ( ! empty($r['cookies']) ) {
+                       $cookies_header = '';
+                       foreach ( (array) $r['cookies'] as $cookie ) {
+                               $cookies_header .= $cookie->getHeaderValue() . '; ';
+                       }
+                       $cookies_header = substr( $cookies_header, 0, -2 );
+                       $r['headers']['cookie'] = $cookies_header;
+               }
        }
 
        /**
         * Decodes chunk transfer-encoding, based off the HTTP 1.1 specification.
         *
        }
 
        /**
         * Decodes chunk transfer-encoding, based off the HTTP 1.1 specification.
         *
-        * Based off the HTTP http_encoding_dechunk function. Does not support
-        * UTF-8. Does not support returning footer headers. Shouldn't be too
-        * difficult to support it though.
+        * Based off the HTTP http_encoding_dechunk function. Does not support UTF-8. Does not support
+        * returning footer headers. Shouldn't be too difficult to support it though.
         *
         * @todo Add support for footer chunked headers.
         * @access public
         *
         * @todo Add support for footer chunked headers.
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         * @static
         *
         * @param string $body Body content
         * @static
         *
         * @param string $body Body content
@@ -408,7 +489,7 @@ class WP_Http {
                        $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match );
 
                        if ( $hasChunk ) {
                        $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match );
 
                        if ( $hasChunk ) {
-                               if ( empty($match[1]) )
+                               if ( empty( $match[1] ) )
                                        return $body;
 
                                $length = hexdec( $match[1] );
                                        return $body;
 
                                $length = hexdec( $match[1] );
@@ -419,24 +500,76 @@ class WP_Http {
 
                                $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
 
 
                                $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
 
-                               if( "0" == trim($body) )
+                               if ( "0" == trim($body) )
                                        return $parsedBody; // Ignore footer headers.
                        } else {
                                return $body;
                        }
                }
        }
                                        return $parsedBody; // Ignore footer headers.
                        } else {
                                return $body;
                        }
                }
        }
+
+       /**
+        * Block requests through the proxy.
+        *
+        * Those who are behind a proxy and want to prevent access to certain hosts may do so. This will
+        * prevent plugins from working and core functionality, if you don't include api.wordpress.org.
+        *
+        * You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL in your wp-config.php file
+        * and this will only allow localhost and your blog to make requests. The constant
+        * WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the
+        * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow.
+        *
+        * @since 2.8.0
+        * @link http://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
+        *
+        * @param string $uri URI of url.
+        * @return bool True to block, false to allow.
+        */
+       function block_request($uri) {
+               // We don't need to block requests, because nothing is blocked.
+               if ( ! defined('WP_HTTP_BLOCK_EXTERNAL') || ( defined('WP_HTTP_BLOCK_EXTERNAL') && WP_HTTP_BLOCK_EXTERNAL == false ) )
+                       return false;
+
+               // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
+               // This will be displayed on blogs, which is not reasonable.
+               $check = @parse_url($uri);
+
+               /* Malformed URL, can not process, but this could mean ssl, so let through anyway.
+                *
+                * This isn't very security sound. There are instances where a hacker might attempt
+                * to bypass the proxy and this check. However, the reason for this behavior is that
+                * WordPress does not do any checking currently for non-proxy requests, so it is keeps with
+                * the default unsecure nature of the HTTP request.
+                */
+               if ( $check === false )
+                       return false;
+
+               $home = parse_url( get_option('siteurl') );
+
+               // Don't block requests back to ourselves by default
+               if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
+                       return apply_filters('block_local_requests', false);
+
+               if ( !defined('WP_ACCESSIBLE_HOSTS') )
+                       return true;
+
+               static $accessible_hosts;
+               if ( null == $accessible_hosts )
+                       $accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
+
+               return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If its in the array, then we can't access it.
+       }
 }
 
 /**
  * HTTP request method uses fsockopen function to retrieve the url.
  *
 }
 
 /**
  * HTTP request method uses fsockopen function to retrieve the url.
  *
- * This would be the preferred method, but the fsockopen implementation has the
- * most overhead of all the HTTP transport implementations.
+ * This would be the preferred method, but the fsockopen implementation has the most overhead of all
+ * the HTTP transport implementations.
  *
  * @package WordPress
  * @subpackage HTTP
  *
  * @package WordPress
  * @subpackage HTTP
- * @since 2.7
+ * @since 2.7.0
  */
 class WP_Http_Fsockopen {
        /**
  */
 class WP_Http_Fsockopen {
        /**
@@ -450,14 +583,14 @@ class WP_Http_Fsockopen {
         * @access public
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
         * @access public
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', and 'response' keys.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
-                       'headers' => array(), 'body' => null
+                       'headers' => array(), 'body' => null, 'cookies' => array()
                );
 
                $r = wp_parse_args( $args, $defaults );
                );
 
                $r = wp_parse_args( $args, $defaults );
@@ -470,41 +603,53 @@ class WP_Http_Fsockopen {
                        unset($r['headers']['user-agent']);
                }
 
                        unset($r['headers']['user-agent']);
                }
 
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
                $iError = null; // Store error number
                $strError = null; // Store error string
 
                $arrURL = parse_url($url);
 
                $iError = null; // Store error number
                $strError = null; // Store error string
 
                $arrURL = parse_url($url);
 
+               $fsockopen_host = $arrURL['host'];
+
                $secure_transport = false;
 
                $secure_transport = false;
 
-               if ( ! isset($arrURL['port']) ) {
-                       if ( ($arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https') && extension_loaded('openssl') ) {
-                               $arrURL['host'] = 'ssl://' . $arrURL['host'];
-                               $arrURL['port'] = apply_filters('http_request_port', 443);
+               if ( ! isset( $arrURL['port'] ) ) {
+                       if ( ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) && extension_loaded('openssl') ) {
+                               $fsockopen_host = "ssl://$fsockopen_host";
+                               $arrURL['port'] = 443;
                                $secure_transport = true;
                        } else {
                                $secure_transport = true;
                        } else {
-                               $arrURL['port'] = apply_filters('http_request_default_port', 80);
+                               $arrURL['port'] = 80;
                        }
                        }
-               } else {
-                       $arrURL['port'] = apply_filters('http_request_port', $arrURL['port']);
                }
 
                }
 
-               // There are issues with the HTTPS and SSL protocols that cause errors
-               // that can be safely ignored and should be ignored.
+               // There are issues with the HTTPS and SSL protocols that cause errors that can be safely
+               // ignored and should be ignored.
                if ( true === $secure_transport )
                        $error_reporting = error_reporting(0);
 
                $startDelay = time();
 
                if ( true === $secure_transport )
                        $error_reporting = error_reporting(0);
 
                $startDelay = time();
 
-               if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
-                       $handle = @fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, $r['timeout'] );
-               else
-                       $handle = fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, $r['timeout'] );
+               $proxy = new WP_HTTP_Proxy();
+
+               if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) {
+                       if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+                               $handle = @fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
+                       else
+                               $handle = @fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
+               } else {
+                       if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+                               $handle = fsockopen( $proxy->host(), $proxy->port(), $iError, $strError, $r['timeout'] );
+                       else
+                               $handle = fsockopen( $fsockopen_host, $arrURL['port'], $iError, $strError, $r['timeout'] );
+               }
 
                $endDelay = time();
 
 
                $endDelay = time();
 
-               // If the delay is greater than the timeout then fsockopen should't be
-               // used, because it will cause a long delay.
+               // If the delay is greater than the timeout then fsockopen should't be used, because it will
+               // cause a long delay.
                $elapseDelay = ($endDelay-$startDelay) > $r['timeout'];
                if ( true === $elapseDelay )
                        add_option( 'disable_fsockopen', $endDelay, null, true );
                $elapseDelay = ($endDelay-$startDelay) > $r['timeout'];
                if ( true === $elapseDelay )
                        add_option( 'disable_fsockopen', $endDelay, null, true );
@@ -512,18 +657,24 @@ class WP_Http_Fsockopen {
                if ( false === $handle )
                        return new WP_Error('http_request_failed', $iError . ': ' . $strError);
 
                if ( false === $handle )
                        return new WP_Error('http_request_failed', $iError . ': ' . $strError);
 
-               // WordPress supports PHP 4.3, which has this function. Removed sanity
-               // checking for performance reasons.
                stream_set_timeout($handle, $r['timeout'] );
 
                stream_set_timeout($handle, $r['timeout'] );
 
-               $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' );
-               $requestPath = empty($requestPath) ? '/' : $requestPath;
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) //Some proxies require full URL in this field.
+                       $requestPath = $url;
+               else
+                       $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' );
 
 
-               $strHeaders = '';
-               $strHeaders .= strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
-               $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
+               if ( empty($requestPath) )
+                       $requestPath .= '/';
+
+               $strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
 
 
-               if( isset($r['user-agent']) )
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+                       $strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n";
+               else
+                       $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
+
+               if ( isset($r['user-agent']) )
                        $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
 
                if ( is_array($r['headers']) ) {
                        $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
 
                if ( is_array($r['headers']) ) {
@@ -533,6 +684,9 @@ class WP_Http_Fsockopen {
                        $strHeaders .= $r['headers'];
                }
 
                        $strHeaders .= $r['headers'];
                }
 
+               if ( $proxy->use_authentication() )
+                       $strHeaders .= $proxy->authentication_header() . "\r\n";
+
                $strHeaders .= "\r\n";
 
                if ( ! is_null($r['body']) )
                $strHeaders .= "\r\n";
 
                if ( ! is_null($r['body']) )
@@ -542,7 +696,7 @@ class WP_Http_Fsockopen {
 
                if ( ! $r['blocking'] ) {
                        fclose($handle);
 
                if ( ! $r['blocking'] ) {
                        fclose($handle);
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
                }
 
                $strResponse = '';
                }
 
                $strResponse = '';
@@ -574,64 +728,71 @@ class WP_Http_Fsockopen {
                if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] )
                        $process['body'] = WP_Http::chunkTransferDecode($process['body']);
 
                if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] )
                        $process['body'] = WP_Http::chunkTransferDecode($process['body']);
 
-               return array('headers' => $arrHeaders['headers'], 'body' => $process['body'], 'response' => $arrHeaders['response']);
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) )
+                       $process['body'] = WP_Http_Encoding::decompress( $process['body'] );
+
+               return array('headers' => $arrHeaders['headers'], 'body' => $process['body'], 'response' => $arrHeaders['response'], 'cookies' => $arrHeaders['cookies']);
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
-        * @since 2.7
+        * @since 2.7.0
         * @static
         * @return boolean False means this class can not be used, true means it can.
         */
         * @static
         * @return boolean False means this class can not be used, true means it can.
         */
-       function test() {
+       function test( $args = array() ) {
                if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
                        return false;
 
                if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
                        return false;
 
-               if ( function_exists( 'fsockopen' ) )
-                       return true;
+               $is_ssl = isset($args['ssl']) && $args['ssl'];
 
 
-               return false;
+               if ( ! $is_ssl && function_exists( 'fsockopen' ) )
+                       $use = true;
+               elseif ( $is_ssl && extension_loaded('openssl') && function_exists( 'fsockopen' ) )
+                       $use = true;
+               else
+                       $use = false;
+
+               return apply_filters('use_fsockopen_transport', $use, $args);
        }
 }
 
 /**
  * HTTP request method uses fopen function to retrieve the url.
  *
        }
 }
 
 /**
  * HTTP request method uses fopen function to retrieve the url.
  *
- * Requires PHP version greater than 4.3.0 for stream support. Does not allow
- * for $context support, but should still be okay, to write the headers, before
- * getting the response. Also requires that 'allow_url_fopen' to be enabled.
+ * Requires PHP version greater than 4.3.0 for stream support. Does not allow for $context support,
+ * but should still be okay, to write the headers, before getting the response. Also requires that
+ * 'allow_url_fopen' to be enabled.
  *
  * @package WordPress
  * @subpackage HTTP
  *
  * @package WordPress
  * @subpackage HTTP
- * @since 2.7
+ * @since 2.7.0
  */
 class WP_Http_Fopen {
        /**
         * Send a HTTP request to a URI using fopen().
         *
  */
 class WP_Http_Fopen {
        /**
         * Send a HTTP request to a URI using fopen().
         *
-        * This transport does not support sending of headers and body, therefore
-        * should not be used in the instances, where there is a body and headers.
+        * This transport does not support sending of headers and body, therefore should not be used in
+        * the instances, where there is a body and headers.
         *
         * Notes: Does not support non-blocking mode. Ignores 'redirection' option.
         *
         * @see WP_Http::retrieve For default options descriptions.
         *
         * @access public
         *
         * Notes: Does not support non-blocking mode. Ignores 'redirection' option.
         *
         * @see WP_Http::retrieve For default options descriptions.
         *
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url URI resource.
         * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', and 'response' keys.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
         */
        function request($url, $args = array()) {
         */
        function request($url, $args = array()) {
-               global $http_response_header;
-
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
-                       'headers' => array(), 'body' => null
+                       'headers' => array(), 'body' => null, 'cookies' => array()
                );
 
                $r = wp_parse_args( $args, $defaults );
                );
 
                $r = wp_parse_args( $args, $defaults );
@@ -652,28 +813,25 @@ class WP_Http_Fopen {
                if (! $handle)
                        return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url));
 
                if (! $handle)
                        return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url));
 
-               // WordPress supports PHP 4.3, which has this function. Removed sanity
-               // checking for performance reasons.
                stream_set_timeout($handle, $r['timeout'] );
 
                if ( ! $r['blocking'] ) {
                        fclose($handle);
                stream_set_timeout($handle, $r['timeout'] );
 
                if ( ! $r['blocking'] ) {
                        fclose($handle);
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
                }
 
                $strResponse = '';
                while ( ! feof($handle) )
                        $strResponse .= fread($handle, 4096);
 
                }
 
                $strResponse = '';
                while ( ! feof($handle) )
                        $strResponse .= fread($handle, 4096);
 
-               $theHeaders = '';
                if ( function_exists('stream_get_meta_data') ) {
                        $meta = stream_get_meta_data($handle);
                        $theHeaders = $meta['wrapper_data'];
                if ( function_exists('stream_get_meta_data') ) {
                        $meta = stream_get_meta_data($handle);
                        $theHeaders = $meta['wrapper_data'];
-                       if( isset( $meta['wrapper_data']['headers'] ) )
+                       if ( isset( $meta['wrapper_data']['headers'] ) )
                                $theHeaders = $meta['wrapper_data']['headers'];
                } else {
                                $theHeaders = $meta['wrapper_data']['headers'];
                } else {
-                       if( ! isset( $http_response_header ) )
-                               global $http_response_header;
+                       //$http_response_header is a PHP reserved variable which is set in the current-scope when using the HTTP Wrapper
+                       //see http://php.oregonstate.edu/manual/en/reserved.variables.httpresponseheader.php
                        $theHeaders = $http_response_header;
                }
 
                        $theHeaders = $http_response_header;
                }
 
@@ -684,52 +842,73 @@ class WP_Http_Fopen {
                if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
                        $strResponse = WP_Http::chunkTransferDecode($strResponse);
 
                if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
                        $strResponse = WP_Http::chunkTransferDecode($strResponse);
 
-               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response']);
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
+                       $strResponse = WP_Http_Encoding::decompress( $strResponse );
+
+               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
+        * @since 2.7.0
         * @static
         * @return boolean False means this class can not be used, true means it can.
         */
         * @static
         * @return boolean False means this class can not be used, true means it can.
         */
-       function test() {
+       function test($args = array()) {
                if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
                        return false;
 
                if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
                        return false;
 
-               return true;
+               $use = true;
+
+               //PHP does not verify SSL certs, We can only make a request via this transports if SSL Verification is turned off.
+               $is_ssl = isset($args['ssl']) && $args['ssl'];
+               if ( $is_ssl ) {
+                       $is_local = isset($args['local']) && $args['local'];
+                       $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+                       if ( $is_local && true != apply_filters('https_local_ssl_verify', true) )
+                               $use = true;
+                       elseif ( !$is_local && true != apply_filters('https_ssl_verify', true) )
+                               $use = true;
+                       elseif ( !$ssl_verify )
+                               $use = true;
+                       else
+                               $use = false;
+               }
+
+               return apply_filters('use_fopen_transport', $use, $args);
        }
 }
 
 /**
  * HTTP request method uses Streams to retrieve the url.
  *
        }
 }
 
 /**
  * HTTP request method uses Streams to retrieve the url.
  *
- * Requires PHP 5.0+ and uses fopen with stream context. Requires that
- * 'allow_url_fopen' PHP setting to be enabled.
+ * Requires PHP 5.0+ and uses fopen with stream context. Requires that 'allow_url_fopen' PHP setting
+ * to be enabled.
  *
  * Second preferred method for getting the URL, for PHP 5.
  *
  * @package WordPress
  * @subpackage HTTP
  *
  * Second preferred method for getting the URL, for PHP 5.
  *
  * @package WordPress
  * @subpackage HTTP
- * @since 2.7
+ * @since 2.7.0
  */
 class WP_Http_Streams {
        /**
         * Send a HTTP request to a URI using streams with fopen().
         *
         * @access public
  */
 class WP_Http_Streams {
        /**
         * Send a HTTP request to a URI using streams with fopen().
         *
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $url
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url
         * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', and 'response' keys.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
-                       'headers' => array(), 'body' => null
+                       'headers' => array(), 'body' => null, 'cookies' => array()
                );
 
                $r = wp_parse_args( $args, $defaults );
                );
 
                $r = wp_parse_args( $args, $defaults );
@@ -742,22 +921,32 @@ class WP_Http_Streams {
                        unset($r['headers']['user-agent']);
                }
 
                        unset($r['headers']['user-agent']);
                }
 
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
                $arrURL = parse_url($url);
 
                if ( false === $arrURL )
                        return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
 
                if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
                $arrURL = parse_url($url);
 
                if ( false === $arrURL )
                        return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
 
                if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] )
-                       $url = str_replace($arrURL['scheme'], 'http', $url);
+                       $url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url);
 
                // Convert Header array to string.
                $strHeaders = '';
                if ( is_array( $r['headers'] ) )
 
                // Convert Header array to string.
                $strHeaders = '';
                if ( is_array( $r['headers'] ) )
-                       foreach( $r['headers'] as $name => $value )
+                       foreach ( $r['headers'] as $name => $value )
                                $strHeaders .= "{$name}: $value\r\n";
                else if ( is_string( $r['headers'] ) )
                        $strHeaders = $r['headers'];
 
                                $strHeaders .= "{$name}: $value\r\n";
                else if ( is_string( $r['headers'] ) )
                        $strHeaders = $r['headers'];
 
+               $is_local = isset($args['local']) && $args['local'];
+               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+               if ( $is_local )
+                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+               elseif ( ! $is_local )
+                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
                $arrContext = array('http' =>
                        array(
                                'method' => strtoupper($r['method']),
                $arrContext = array('http' =>
                        array(
                                'method' => strtoupper($r['method']),
@@ -765,10 +954,25 @@ class WP_Http_Streams {
                                'max_redirects' => $r['redirection'],
                                'protocol_version' => (float) $r['httpversion'],
                                'header' => $strHeaders,
                                'max_redirects' => $r['redirection'],
                                'protocol_version' => (float) $r['httpversion'],
                                'header' => $strHeaders,
-                               'timeout' => $r['timeout']
+                               'timeout' => $r['timeout'],
+                               'ssl' => array(
+                                               'verify_peer' => $ssl_verify,
+                                               'verify_host' => $ssl_verify
+                               )
                        )
                );
 
                        )
                );
 
+               $proxy = new WP_HTTP_Proxy();
+
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+                       $arrContext['http']['proxy'] = 'tcp://' . $proxy->host() . ':' . $proxy->port();
+                       $arrContext['http']['request_fulluri'] = true;
+
+                       // We only support Basic authentication so this will only work if that is what your proxy supports.
+                       if ( $proxy->use_authentication() )
+                               $arrContext['http']['header'] .= $proxy->authentication_header() . "\r\n";
+               }
+
                if ( ! is_null($r['body']) && ! empty($r['body'] ) )
                        $arrContext['http']['content'] = $r['body'];
 
                if ( ! is_null($r['body']) && ! empty($r['body'] ) )
                        $arrContext['http']['content'] = $r['body'];
 
@@ -782,21 +986,23 @@ class WP_Http_Streams {
                if ( ! $handle)
                        return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url));
 
                if ( ! $handle)
                        return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url));
 
-               // WordPress supports PHP 4.3, which has this function. Removed sanity
-               // checking for performance reasons.
+               // WordPress supports PHP 4.3, which has this function. Removed sanity checking for
+               // performance reasons.
                stream_set_timeout($handle, $r['timeout'] );
 
                if ( ! $r['blocking'] ) {
                        stream_set_blocking($handle, 0);
                        fclose($handle);
                stream_set_timeout($handle, $r['timeout'] );
 
                if ( ! $r['blocking'] ) {
                        stream_set_blocking($handle, 0);
                        fclose($handle);
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
                }
 
                $strResponse = stream_get_contents($handle);
                $meta = stream_get_meta_data($handle);
 
                }
 
                $strResponse = stream_get_contents($handle);
                $meta = stream_get_meta_data($handle);
 
+               fclose($handle);
+
                $processedHeaders = array();
                $processedHeaders = array();
-               if( isset( $meta['wrapper_data']['headers'] ) )
+               if ( isset( $meta['wrapper_data']['headers'] ) )
                        $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']);
                else
                        $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);
                        $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']);
                else
                        $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);
@@ -804,9 +1010,10 @@ class WP_Http_Streams {
                if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
                        $strResponse = WP_Http::chunkTransferDecode($strResponse);
 
                if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
                        $strResponse = WP_Http::chunkTransferDecode($strResponse);
 
-               fclose($handle);
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($processedHeaders['headers']) )
+                       $strResponse = WP_Http_Encoding::decompress( $strResponse );
 
 
-               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response']);
+               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response'], 'cookies' => $processedHeaders['cookies']);
        }
 
        /**
        }
 
        /**
@@ -814,32 +1021,43 @@ class WP_Http_Streams {
         *
         * @static
         * @access public
         *
         * @static
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @return boolean False means this class can not be used, true means it can.
         */
         *
         * @return boolean False means this class can not be used, true means it can.
         */
-       function test() {
+       function test($args = array()) {
                if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
                        return false;
 
                if ( version_compare(PHP_VERSION, '5.0', '<') )
                        return false;
 
                if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
                        return false;
 
                if ( version_compare(PHP_VERSION, '5.0', '<') )
                        return false;
 
-               return true;
+               //HTTPS via Proxy was added in 5.1.0
+               $is_ssl = isset($args['ssl']) && $args['ssl'];
+               if ( $is_ssl && version_compare(PHP_VERSION, '5.1.0', '<') ) {
+                       $proxy = new WP_HTTP_Proxy();
+                       /**
+                        * No URL check, as its not currently passed to the ::test() function
+                        * In the case where a Proxy is in use, Just bypass this transport for HTTPS.
+                        */
+                       if ( $proxy->is_enabled() )
+                               return false;
+               }
+
+               return apply_filters('use_streams_transport', true, $args);
        }
 }
 
 /**
  * HTTP request method uses HTTP extension to retrieve the url.
  *
        }
 }
 
 /**
  * HTTP request method uses HTTP extension to retrieve the url.
  *
- * Requires the HTTP extension to be installed. This would be the preferred
- * transport since it can handle a lot of the problems that forces the others to
- * use the HTTP version 1.0. Even if PHP 5.2+ is being used, it doesn't mean
- * that the HTTP extension will be enabled.
+ * Requires the HTTP extension to be installed. This would be the preferred transport since it can
+ * handle a lot of the problems that forces the others to use the HTTP version 1.0. Even if PHP 5.2+
+ * is being used, it doesn't mean that the HTTP extension will be enabled.
  *
  * @package WordPress
  * @subpackage HTTP
  *
  * @package WordPress
  * @subpackage HTTP
- * @since 2.7
+ * @since 2.7.0
  */
 class WP_Http_ExtHTTP {
        /**
  */
 class WP_Http_ExtHTTP {
        /**
@@ -852,14 +1070,14 @@ class WP_Http_ExtHTTP {
         *
         * @param string $url
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url
         * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', and 'response' keys.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
-                       'headers' => array(), 'body' => null
+                       'headers' => array(), 'body' => null, 'cookies' => array()
                );
 
                $r = wp_parse_args( $args, $defaults );
                );
 
                $r = wp_parse_args( $args, $defaults );
@@ -872,6 +1090,9 @@ class WP_Http_ExtHTTP {
                        unset($r['headers']['user-agent']);
                }
 
                        unset($r['headers']['user-agent']);
                }
 
+               // Construct Cookie: header if any cookies are set
+               WP_Http::buildCookieHeader( $r );
+
                switch ( $r['method'] ) {
                        case 'POST':
                                $r['method'] = HTTP_METH_POST;
                switch ( $r['method'] ) {
                        case 'POST':
                                $r['method'] = HTTP_METH_POST;
@@ -887,7 +1108,14 @@ class WP_Http_ExtHTTP {
                $arrURL = parse_url($url);
 
                if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
                $arrURL = parse_url($url);
 
                if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
-                       $url = str_replace($arrURL['scheme'], 'http', $url);
+                       $url = preg_replace('|^' . preg_quote($arrURL['scheme'], '|') . '|', 'http', $url);
+
+               $is_local = isset($args['local']) && $args['local'];
+               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+               if ( $is_local )
+                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+               elseif ( ! $is_local )
+                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
 
                $options = array(
                        'timeout' => $r['timeout'],
 
                $options = array(
                        'timeout' => $r['timeout'],
@@ -895,18 +1123,38 @@ class WP_Http_ExtHTTP {
                        'redirect' => $r['redirection'],
                        'useragent' => $r['user-agent'],
                        'headers' => $r['headers'],
                        'redirect' => $r['redirection'],
                        'useragent' => $r['user-agent'],
                        'headers' => $r['headers'],
+                       'ssl' => array(
+                               'verifypeer' => $ssl_verify,
+                               'verifyhost' => $ssl_verify
+                       )
                );
 
                );
 
+               // The HTTP extensions offers really easy proxy support.
+               $proxy = new WP_HTTP_Proxy();
+
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+                       $options['proxyhost'] = $proxy->host();
+                       $options['proxyport'] = $proxy->port();
+                       $options['proxytype'] = HTTP_PROXY_HTTP;
+
+                       if ( $proxy->use_authentication() ) {
+                               $options['proxyauth'] = $proxy->authentication();
+                               $options['proxyauthtype'] = HTTP_AUTH_BASIC;
+                       }
+               }
+
                if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) //Emits warning level notices for max redirects and timeouts
                        $strResponse = @http_request($r['method'], $url, $r['body'], $options, $info);
                else
                        $strResponse = http_request($r['method'], $url, $r['body'], $options, $info); //Emits warning level notices for max redirects and timeouts
 
                if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) //Emits warning level notices for max redirects and timeouts
                        $strResponse = @http_request($r['method'], $url, $r['body'], $options, $info);
                else
                        $strResponse = http_request($r['method'], $url, $r['body'], $options, $info); //Emits warning level notices for max redirects and timeouts
 
-               if ( false === $strResponse || ! empty($info['error']) ) //Error may still be set, Response may return headers or partial document, and error contains a reason the request was aborted, eg, timeout expired or max-redirects reached
+               // Error may still be set, Response may return headers or partial document, and error
+               // contains a reason the request was aborted, eg, timeout expired or max-redirects reached.
+               if ( false === $strResponse || ! empty($info['error']) )
                        return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']);
 
                if ( ! $r['blocking'] )
                        return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']);
 
                if ( ! $r['blocking'] )
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
 
                list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
                $theHeaders = WP_Http::processHeaders($theHeaders);
 
                list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
                $theHeaders = WP_Http::processHeaders($theHeaders);
@@ -918,26 +1166,26 @@ class WP_Http_ExtHTTP {
                                $theBody = http_chunked_decode($theBody);
                }
 
                                $theBody = http_chunked_decode($theBody);
                }
 
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
+                       $theBody = http_inflate( $theBody );
+
                $theResponse = array();
                $theResponse['code'] = $info['response_code'];
                $theResponse['message'] = get_status_header_desc($info['response_code']);
 
                $theResponse = array();
                $theResponse['code'] = $info['response_code'];
                $theResponse['message'] = get_status_header_desc($info['response_code']);
 
-               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theResponse);
+               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theResponse, 'cookies' => $theHeaders['cookies']);
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
         * @static
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
         * @static
-        * @since 2.7
+        * @since 2.7.0
         *
         * @return boolean False means this class can not be used, true means it can.
         */
         *
         * @return boolean False means this class can not be used, true means it can.
         */
-       function test() {
-               if ( function_exists('http_request') )
-                       return true;
-
-               return false;
+       function test($args = array()) {
+               return apply_filters('use_http_extension_transport', function_exists('http_request'), $args );
        }
 }
 
        }
 }
 
@@ -951,22 +1199,23 @@ class WP_Http_ExtHTTP {
  * @since 2.7
  */
 class WP_Http_Curl {
  * @since 2.7
  */
 class WP_Http_Curl {
+
        /**
         * Send a HTTP request to a URI using cURL extension.
         *
         * @access public
        /**
         * Send a HTTP request to a URI using cURL extension.
         *
         * @access public
-        * @since 2.7
+        * @since 2.7.0
         *
         * @param string $url
         * @param str|array $args Optional. Override the defaults.
         *
         * @param string $url
         * @param str|array $args Optional. Override the defaults.
-        * @return array 'headers', 'body', and 'response' keys.
+        * @return array 'headers', 'body', 'cookies' and 'response' keys.
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
         */
        function request($url, $args = array()) {
                $defaults = array(
                        'method' => 'GET', 'timeout' => 5,
                        'redirection' => 5, 'httpversion' => '1.0',
                        'blocking' => true,
-                       'headers' => array(), 'body' => null
+                       'headers' => array(), 'body' => null, 'cookies' => array()
                );
 
                $r = wp_parse_args( $args, $defaults );
                );
 
                $r = wp_parse_args( $args, $defaults );
@@ -979,55 +1228,104 @@ class WP_Http_Curl {
                        unset($r['headers']['user-agent']);
                }
 
                        unset($r['headers']['user-agent']);
                }
 
-               // cURL extension will sometimes fail when the timeout is less than 1 as
-               // it may round down to 0, which gives it unlimited timeout.
+               // Construct Cookie: header if any cookies are set.
+               WP_Http::buildCookieHeader( $r );
+
+               // cURL extension will sometimes fail when the timeout is less than 1 as it may round down
+               // to 0, which gives it unlimited timeout.
                if ( $r['timeout'] > 0 && $r['timeout'] < 1 )
                        $r['timeout'] = 1;
 
                $handle = curl_init();
                if ( $r['timeout'] > 0 && $r['timeout'] < 1 )
                        $r['timeout'] = 1;
 
                $handle = curl_init();
-               curl_setopt( $handle, CURLOPT_URL, $url);
 
 
-               // The cURL extension requires that the option be set for the HEAD to
-               // work properly.
-               if ( 'HEAD' === $r['method'] ) {
-                       curl_setopt( $handle, CURLOPT_NOBODY, true );
-               }
+               // cURL offers really easy proxy support.
+               $proxy = new WP_HTTP_Proxy();
 
 
-               if ( true === $r['blocking'] ) {
-                       curl_setopt( $handle, CURLOPT_HEADER, true );
-                       curl_setopt( $handle, CURLOPT_RETURNTRANSFER, 1 );
-               } else {
-                       curl_setopt( $handle, CURLOPT_HEADER, false );
-                       curl_setopt( $handle, CURLOPT_NOBODY, true );
-                       curl_setopt( $handle, CURLOPT_RETURNTRANSFER, 0 );
+               if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) {
+
+                       $isPHP5 = version_compare(PHP_VERSION, '5.0.0', '>=');
+
+                       if ( $isPHP5 ) {
+                               curl_setopt( $handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
+                               curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() );
+                               curl_setopt( $handle, CURLOPT_PROXYPORT, $proxy->port() );
+                       } else {
+                               curl_setopt( $handle, CURLOPT_PROXY, $proxy->host() .':'. $proxy->port() );
+                       }
+
+                       if ( $proxy->use_authentication() ) {
+                               if ( $isPHP5 )
+                                       curl_setopt( $handle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC );
+
+                               curl_setopt( $handle, CURLOPT_PROXYUSERPWD, $proxy->authentication() );
+                       }
                }
 
                }
 
+               $is_local = isset($args['local']) && $args['local'];
+               $ssl_verify = isset($args['sslverify']) && $args['sslverify'];
+               if ( $is_local )
+                       $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify);
+               elseif ( ! $is_local )
+                       $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify);
+
+               curl_setopt( $handle, CURLOPT_URL, $url);
+               curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
+               curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, $ssl_verify );
+               curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
                curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
                curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
-               curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 1 );
+               curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $r['timeout'] );
                curl_setopt( $handle, CURLOPT_TIMEOUT, $r['timeout'] );
                curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
 
                curl_setopt( $handle, CURLOPT_TIMEOUT, $r['timeout'] );
                curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
 
+               switch ( $r['method'] ) {
+                       case 'HEAD':
+                               curl_setopt( $handle, CURLOPT_NOBODY, true );
+                               break;
+                       case 'POST':
+                               curl_setopt( $handle, CURLOPT_POST, true );
+                               curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
+                               break;
+               }
+
+               if ( true === $r['blocking'] )
+                       curl_setopt( $handle, CURLOPT_HEADER, true );
+               else
+                       curl_setopt( $handle, CURLOPT_HEADER, false );
+
                // The option doesn't work with safe mode or when open_basedir is set.
                if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
                        curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
 
                // The option doesn't work with safe mode or when open_basedir is set.
                if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
                        curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true );
 
-               if( ! is_null($r['headers']) )
-                       curl_setopt( $handle, CURLOPT_HTTPHEADER, $r['headers'] );
+               if ( !empty( $r['headers'] ) ) {
+                       // cURL expects full header strings in each element
+                       $headers = array();
+                       foreach ( $r['headers'] as $name => $value ) {
+                               $headers[] = "{$name}: $value";
+                       }
+                       curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers );
+               }
 
                if ( $r['httpversion'] == '1.0' )
                        curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
                else
                        curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
 
 
                if ( $r['httpversion'] == '1.0' )
                        curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
                else
                        curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
 
+               // Cookies are not handled by the HTTP API currently. Allow for plugin authors to handle it
+               // themselves... Although, it is somewhat pointless without some reference.
+               do_action_ref_array( 'http_api_curl', array(&$handle) );
+
+               // We don't need to return the body, so don't. Just execute request and return.
                if ( ! $r['blocking'] ) {
                        curl_exec( $handle );
                        curl_close( $handle );
                if ( ! $r['blocking'] ) {
                        curl_exec( $handle );
                        curl_close( $handle );
-                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
                }
 
                $theResponse = curl_exec( $handle );
 
                if ( !empty($theResponse) ) {
                }
 
                $theResponse = curl_exec( $handle );
 
                if ( !empty($theResponse) ) {
+                       $parts = explode("\r\n\r\n", $theResponse);
+
                        $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
                        $theHeaders = trim( substr($theResponse, 0, $headerLength) );
                        $theBody = substr( $theResponse, $headerLength );
                        $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
                        $theHeaders = trim( substr($theResponse, 0, $headerLength) );
                        $theBody = substr( $theResponse, $headerLength );
@@ -1042,38 +1340,541 @@ class WP_Http_Curl {
                        if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )
                                return new WP_Error('http_request_failed', __('Too many redirects.'));
 
                        if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array(301, 302) ) )
                                return new WP_Error('http_request_failed', __('Too many redirects.'));
 
-                       $theHeaders = array( 'headers' => array() );
+                       $theHeaders = array( 'headers' => array(), 'cookies' => array() );
                        $theBody = '';
                }
                        $theBody = '';
                }
+
                $response = array();
                $response['code'] = curl_getinfo( $handle, CURLINFO_HTTP_CODE );
                $response['message'] = get_status_header_desc($response['code']);
 
                curl_close( $handle );
 
                $response = array();
                $response['code'] = curl_getinfo( $handle, CURLINFO_HTTP_CODE );
                $response['message'] = get_status_header_desc($response['code']);
 
                curl_close( $handle );
 
-               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response);
+               if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
+                       $theBody = WP_Http_Encoding::decompress( $theBody );
+
+               return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $response, 'cookies' => $theHeaders['cookies']);
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
         * @static
        }
 
        /**
         * Whether this class can be used for retrieving an URL.
         *
         * @static
-        * @since 2.7
+        * @since 2.7.0
         *
         * @return boolean False means this class can not be used, true means it can.
         */
         *
         * @return boolean False means this class can not be used, true means it can.
         */
-       function test() {
+       function test($args = array()) {
                if ( function_exists('curl_init') && function_exists('curl_exec') )
                if ( function_exists('curl_init') && function_exists('curl_exec') )
+                       return apply_filters('use_curl_transport', true, $args);
+
+               return false;
+       }
+}
+
+/**
+ * Adds Proxy support to the WordPress HTTP API.
+ *
+ * There are caveats to proxy support. It requires that defines be made in the wp-config.php file to
+ * enable proxy support. There are also a few filters that plugins can hook into for some of the
+ * constants.
+ *
+ * The constants are as follows:
+ * <ol>
+ * <li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li>
+ * <li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li>
+ * <li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li>
+ * <li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li>
+ * <li>WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy.
+ * You do not need to have localhost and the blog host in this list, because they will not be passed
+ * through the proxy. The list should be presented in a comma separated list</li>
+ * </ol>
+ *
+ * An example can be as seen below.
+ * <code>
+ * define('WP_PROXY_HOST', '192.168.84.101');
+ * define('WP_PROXY_PORT', '8080');
+ * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');
+ * </code>
+ *
+ * @link http://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress.
+ * @since 2.8
+ */
+class WP_HTTP_Proxy {
+
+       /**
+        * Whether proxy connection should be used.
+        *
+        * @since 2.8
+        * @use WP_PROXY_HOST
+        * @use WP_PROXY_PORT
+        *
+        * @return bool
+        */
+       function is_enabled() {
+               return defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT');
+       }
+
+       /**
+        * Whether authentication should be used.
+        *
+        * @since 2.8
+        * @use WP_PROXY_USERNAME
+        * @use WP_PROXY_PASSWORD
+        *
+        * @return bool
+        */
+       function use_authentication() {
+               return defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD');
+       }
+
+       /**
+        * Retrieve the host for the proxy server.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function host() {
+               if ( defined('WP_PROXY_HOST') )
+                       return WP_PROXY_HOST;
+
+               return '';
+       }
+
+       /**
+        * Retrieve the port for the proxy server.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function port() {
+               if ( defined('WP_PROXY_PORT') )
+                       return WP_PROXY_PORT;
+
+               return '';
+       }
+
+       /**
+        * Retrieve the username for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function username() {
+               if ( defined('WP_PROXY_USERNAME') )
+                       return WP_PROXY_USERNAME;
+
+               return '';
+       }
+
+       /**
+        * Retrieve the password for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function password() {
+               if ( defined('WP_PROXY_PASSWORD') )
+                       return WP_PROXY_PASSWORD;
+
+               return '';
+       }
+
+       /**
+        * Retrieve authentication string for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function authentication() {
+               return $this->username() . ':' . $this->password();
+       }
+
+       /**
+        * Retrieve header string for proxy authentication.
+        *
+        * @since 2.8
+        *
+        * @return string
+        */
+       function authentication_header() {
+               return 'Proxy-Authentication: Basic ' . base64_encode( $this->authentication() );
+       }
+
+       /**
+        * Whether URL should be sent through the proxy server.
+        *
+        * We want to keep localhost and the blog URL from being sent through the proxy server, because
+        * some proxies can not handle this. We also have the constant available for defining other
+        * hosts that won't be sent through the proxy.
+        *
+        * @uses WP_PROXY_BYPASS_HOSTS
+        * @since unknown
+        *
+        * @param string $uri URI to check.
+        * @return bool True, to send through the proxy and false if, the proxy should not be used.
+        */
+       function send_through_proxy( $uri ) {
+               // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
+               // This will be displayed on blogs, which is not reasonable.
+               $check = @parse_url($uri);
+
+               // Malformed URL, can not process, but this could mean ssl, so let through anyway.
+               if ( $check === false )
                        return true;
 
                        return true;
 
+               $home = parse_url( get_option('siteurl') );
+
+               if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
+                       return false;
+
+               if ( !defined('WP_PROXY_BYPASS_HOSTS') )
+                       return true;
+
+               static $bypass_hosts;
+               if ( null == $bypass_hosts )
+                       $bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS);
+
+               return !in_array( $check['host'], $bypass_hosts );
+       }
+}
+/**
+ * Internal representation of a single cookie.
+ *
+ * Returned cookies are represented using this class, and when cookies are set, if they are not
+ * already a WP_Http_Cookie() object, then they are turned into one.
+ *
+ * @todo The WordPress convention is to use underscores instead of camelCase for function and method
+ * names. Need to switch to use underscores instead for the methods.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.8.0
+ * @author Beau Lebens
+ */
+class WP_Http_Cookie {
+
+       /**
+        * Cookie name.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $name;
+
+       /**
+        * Cookie value.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $value;
+
+       /**
+        * When the cookie expires.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $expires;
+
+       /**
+        * Cookie URL path.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $path;
+
+       /**
+        * Cookie Domain.
+        *
+        * @since 2.8.0
+        * @var string
+        */
+       var $domain;
+
+       /**
+        * PHP4 style Constructor - Calls PHP5 Style Constructor.
+        *
+        * @access public
+        * @since 2.8.0
+        * @param string|array $data Raw cookie data.
+        */
+       function WP_Http_Cookie( $data ) {
+               $this->__construct( $data );
+       }
+
+       /**
+        * Sets up this cookie object.
+        *
+        * The parameter $data should be either an associative array containing the indices names below
+        * or a header string detailing it.
+        *
+        * If it's an array, it should include the following elements:
+        * <ol>
+        * <li>Name</li>
+        * <li>Value - should NOT be urlencoded already.</li>
+        * <li>Expires - (optional) String or int (UNIX timestamp).</li>
+        * <li>Path (optional)</li>
+        * <li>Domain (optional)</li>
+        * </ol>
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @param string|array $data Raw cookie data.
+        */
+       function __construct( $data ) {
+               if ( is_string( $data ) ) {
+                       // Assume it's a header string direct from a previous request
+                       $pairs = explode( ';', $data );
+
+                       // Special handling for first pair; name=value. Also be careful of "=" in value
+                       $name  = trim( substr( $pairs[0], 0, strpos( $pairs[0], '=' ) ) );
+                       $value = substr( $pairs[0], strpos( $pairs[0], '=' ) + 1 );
+                       $this->name  = $name;
+                       $this->value = urldecode( $value );
+                       array_shift( $pairs ); //Removes name=value from items.
+
+                       // Set everything else as a property
+                       foreach ( $pairs as $pair ) {
+                               if ( empty($pair) ) //Handles the cookie ending in ; which results in a empty final pair
+                                       continue;
+
+                               list( $key, $val ) = explode( '=', $pair );
+                               $key = strtolower( trim( $key ) );
+                               if ( 'expires' == $key )
+                                       $val = strtotime( $val );
+                               $this->$key = $val;
+                       }
+               } else {
+                       if ( !isset( $data['name'] ) )
+                               return false;
+
+                       // Set properties based directly on parameters
+                       $this->name   = $data['name'];
+                       $this->value  = isset( $data['value'] ) ? $data['value'] : '';
+                       $this->path   = isset( $data['path'] ) ? $data['path'] : '';
+                       $this->domain = isset( $data['domain'] ) ? $data['domain'] : '';
+
+                       if ( isset( $data['expires'] ) )
+                               $this->expires = is_int( $data['expires'] ) ? $data['expires'] : strtotime( $data['expires'] );
+                       else
+                               $this->expires = null;
+               }
+       }
+
+       /**
+        * Confirms that it's OK to send this cookie to the URL checked against.
+        *
+        * Decision is based on RFC 2109/2965, so look there for details on validity.
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @param string $url URL you intend to send this cookie to
+        * @return boolean TRUE if allowed, FALSE otherwise.
+        */
+       function test( $url ) {
+               // Expires - if expired then nothing else matters
+               if ( time() > $this->expires )
+                       return false;
+
+               // Get details on the URL we're thinking about sending to
+               $url = parse_url( $url );
+               $url['port'] = isset( $url['port'] ) ? $url['port'] : 80;
+               $url['path'] = isset( $url['path'] ) ? $url['path'] : '/';
+
+               // Values to use for comparison against the URL
+               $path   = isset( $this->path )   ? $this->path   : '/';
+               $port   = isset( $this->port )   ? $this->port   : 80;
+               $domain = isset( $this->domain ) ? strtolower( $this->domain ) : strtolower( $url['host'] );
+               if ( false === stripos( $domain, '.' ) )
+                       $domain .= '.local';
+
+               // Host - very basic check that the request URL ends with the domain restriction (minus leading dot)
+               $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain;
+               if ( substr( $url['host'], -strlen( $domain ) ) != $domain )
+                       return false;
+
+               // Port - supports "port-lists" in the format: "80,8000,8080"
+               if ( !in_array( $url['port'], explode( ',', $port) ) )
+                       return false;
+
+               // Path - request path must start with path restriction
+               if ( substr( $url['path'], 0, strlen( $path ) ) != $path )
+                       return false;
+
+               return true;
+       }
+
+       /**
+        * Convert cookie name and value back to header string.
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @return string Header encoded cookie name and value.
+        */
+       function getHeaderValue() {
+               if ( empty( $this->name ) || empty( $this->value ) )
+                       return '';
+
+               return $this->name . '=' . urlencode( $this->value );
+       }
+
+       /**
+        * Retrieve cookie header for usage in the rest of the WordPress HTTP API.
+        *
+        * @access public
+        * @since 2.8.0
+        *
+        * @return string
+        */
+       function getFullHeader() {
+               return 'Cookie: ' . $this->getHeaderValue();
+       }
+}
+
+/**
+ * Implementation for deflate and gzip transfer encodings.
+ *
+ * Includes RFC 1950, RFC 1951, and RFC 1952.
+ *
+ * @since 2.8
+ * @package WordPress
+ * @subpackage HTTP
+ */
+class WP_Http_Encoding {
+
+       /**
+        * Compress raw string using the deflate format.
+        *
+        * Supports the RFC 1951 standard.
+        *
+        * @since 2.8
+        *
+        * @param string $raw String to compress.
+        * @param int $level Optional, default is 9. Compression level, 9 is highest.
+        * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
+        * @return string|bool False on failure.
+        */
+       function compress( $raw, $level = 9, $supports = null ) {
+               return gzdeflate( $raw, $level );
+       }
+
+       /**
+        * Decompression of deflated string.
+        *
+        * Will attempt to decompress using the RFC 1950 standard, and if that fails
+        * then the RFC 1951 standard deflate will be attempted. Finally, the RFC
+        * 1952 standard gzip decode will be attempted. If all fail, then the
+        * original compressed string will be returned.
+        *
+        * @since 2.8
+        *
+        * @param string $compressed String to decompress.
+        * @param int $length The optional length of the compressed data.
+        * @return string|bool False on failure.
+        */
+       function decompress( $compressed, $length = null ) {
+               $decompressed = gzinflate( $compressed );
+
+               if ( false !== $decompressed )
+                       return $decompressed;
+
+               $decompressed = gzuncompress( $compressed );
+
+               if ( false !== $decompressed )
+                       return $decompressed;
+
+               if ( function_exists('gzdecode') ) {
+                       $decompressed = gzdecode( $compressed );
+
+                       if ( false !== $decompressed )
+                               return $decompressed;
+               }
+
+               return $compressed;
+       }
+
+       /**
+        * What encoding types to accept and their priority values.
+        *
+        * @since 2.8
+        *
+        * @return string Types of encoding to accept.
+        */
+       function accept_encoding() {
+               $type = array();
+               if ( function_exists( 'gzinflate' ) )
+                       $type[] = 'deflate;q=1.0';
+
+               if ( function_exists( 'gzuncompress' ) )
+                       $type[] = 'compress;q=0.5';
+
+               if ( function_exists( 'gzdecode' ) )
+                       $type[] = 'gzip;q=0.5';
+
+               return implode(', ', $type);
+       }
+
+       /**
+        * What enconding the content used when it was compressed to send in the headers.
+        *
+        * @since 2.8
+        *
+        * @return string Content-Encoding string to send in the header.
+        */
+       function content_encoding() {
+               return 'deflate';
+       }
+
+       /**
+        * Whether the content be decoded based on the headers.
+        *
+        * @since 2.8
+        *
+        * @param array|string $headers All of the available headers.
+        * @return bool
+        */
+       function should_decode($headers) {
+               if ( is_array( $headers ) ) {
+                       if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
+                               return true;
+               } else if( is_string( $headers ) ) {
+                       return ( stripos($headers, 'content-encoding:') !== false );
+               }
+
                return false;
        }
                return false;
        }
+
+       /**
+        * Whether decompression and compression are supported by the PHP version.
+        *
+        * Each function is tested instead of checking for the zlib extension, to
+        * ensure that the functions all exist in the PHP version and aren't
+        * disabled.
+        *
+        * @since 2.8
+        *
+        * @return bool
+        */
+       function is_available() {
+               return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') );
+       }
 }
 
 /**
  * Returns the initialized WP_Http Object
  *
 }
 
 /**
  * Returns the initialized WP_Http Object
  *
- * @since 2.7
+ * @since 2.7.0
  * @access private
  *
  * @return WP_Http HTTP Transport object.
  * @access private
  *
  * @return WP_Http HTTP Transport object.
@@ -1093,7 +1894,7 @@ function &_wp_http_get_object() {
  * The array structure is a little complex.
  *
  * <code>
  * The array structure is a little complex.
  *
  * <code>
- * $res = array( 'headers' => array(), 'response' => array('code', 'message') );
+ * $res = array( 'headers' => array(), 'response' => array('code' => int, 'message' => string) );
  * </code>
  *
  * All of the headers in $res['headers'] are with the name as the key and the
  * </code>
  *
  * All of the headers in $res['headers'] are with the name as the key and the
@@ -1112,7 +1913,7 @@ function &_wp_http_get_object() {
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
- * @return string The body of the response
+ * @return WP_Error|array The response or WP_Error on failure.
  */
 function wp_remote_request($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
  */
 function wp_remote_request($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
@@ -1124,15 +1925,14 @@ function wp_remote_request($url, $args = array()) {
  *
  * @see wp_remote_request() For more information on the response array format.
  *
  *
  * @see wp_remote_request() For more information on the response array format.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
- * @return string The body of the response
+ * @return WP_Error|array The response or WP_Error on failure.
  */
 function wp_remote_get($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
  */
 function wp_remote_get($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
-
        return $objFetchSite->get($url, $args);
 }
 
        return $objFetchSite->get($url, $args);
 }
 
@@ -1141,11 +1941,11 @@ function wp_remote_get($url, $args = array()) {
  *
  * @see wp_remote_request() For more information on the response array format.
  *
  *
  * @see wp_remote_request() For more information on the response array format.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
- * @return string The body of the response
+ * @return WP_Error|array The response or WP_Error on failure.
  */
 function wp_remote_post($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
  */
 function wp_remote_post($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
@@ -1157,11 +1957,11 @@ function wp_remote_post($url, $args = array()) {
  *
  * @see wp_remote_request() For more information on the response array format.
  *
  *
  * @see wp_remote_request() For more information on the response array format.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
  *
  * @param string $url Site URL to retrieve.
  * @param array $args Optional. Override the defaults.
- * @return string The body of the response
+ * @return WP_Error|array The response or WP_Error on failure.
  */
 function wp_remote_head($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
  */
 function wp_remote_head($url, $args = array()) {
        $objFetchSite = _wp_http_get_object();
@@ -1171,13 +1971,13 @@ function wp_remote_head($url, $args = array()) {
 /**
  * Retrieve only the headers from the raw response.
  *
 /**
  * Retrieve only the headers from the raw response.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param array $response HTTP response.
  * @return array The headers of the response. Empty array if incorrect parameter given.
  */
 function wp_remote_retrieve_headers(&$response) {
  *
  * @param array $response HTTP response.
  * @return array The headers of the response. Empty array if incorrect parameter given.
  */
 function wp_remote_retrieve_headers(&$response) {
-       if ( ! isset($response['headers']) || ! is_array($response['headers']))
+       if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
                return array();
 
        return $response['headers'];
                return array();
 
        return $response['headers'];
@@ -1186,14 +1986,14 @@ function wp_remote_retrieve_headers(&$response) {
 /**
  * Retrieve a single header by name from the raw response.
  *
 /**
  * Retrieve a single header by name from the raw response.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param array $response
  * @param string $header Header name to retrieve value from.
  *
  * @param array $response
  * @param string $header Header name to retrieve value from.
- * @return array The header value. Empty string on if incorrect parameter given.
+ * @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist.
  */
 function wp_remote_retrieve_header(&$response, $header) {
  */
 function wp_remote_retrieve_header(&$response, $header) {
-       if ( ! isset($response['headers']) || ! is_array($response['headers']))
+       if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
                return '';
 
        if ( array_key_exists($header, $response['headers']) )
                return '';
 
        if ( array_key_exists($header, $response['headers']) )
@@ -1207,13 +2007,13 @@ function wp_remote_retrieve_header(&$response, $header) {
  *
  * Will return an empty array if incorrect parameter value is given.
  *
  *
  * Will return an empty array if incorrect parameter value is given.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param array $response HTTP response.
  *
  * @param array $response HTTP response.
- * @return array The keys 'code' and 'message' give information on the response.
+ * @return string the response code. Empty string on incorrect parameter given.
  */
 function wp_remote_retrieve_response_code(&$response) {
  */
 function wp_remote_retrieve_response_code(&$response) {
-       if ( ! isset($response['response']) || ! is_array($response['response']))
+       if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
                return '';
 
        return $response['response']['code'];
                return '';
 
        return $response['response']['code'];
@@ -1224,13 +2024,13 @@ function wp_remote_retrieve_response_code(&$response) {
  *
  * Will return an empty array if incorrect parameter value is given.
  *
  *
  * Will return an empty array if incorrect parameter value is given.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param array $response HTTP response.
  *
  * @param array $response HTTP response.
- * @return array The keys 'code' and 'message' give information on the response.
+ * @return string The response message. Empty string on incorrect parameter given.
  */
 function wp_remote_retrieve_response_message(&$response) {
  */
 function wp_remote_retrieve_response_message(&$response) {
-       if ( ! isset($response['response']) || ! is_array($response['response']))
+       if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
                return '';
 
        return $response['response']['message'];
                return '';
 
        return $response['response']['message'];
@@ -1239,13 +2039,13 @@ function wp_remote_retrieve_response_message(&$response) {
 /**
  * Retrieve only the body from the raw response.
  *
 /**
  * Retrieve only the body from the raw response.
  *
- * @since 2.7
+ * @since 2.7.0
  *
  * @param array $response HTTP response.
  * @return string The body of the response. Empty string if no body or incorrect parameter given.
  */
 function wp_remote_retrieve_body(&$response) {
  *
  * @param array $response HTTP response.
  * @return string The body of the response. Empty string if no body or incorrect parameter given.
  */
 function wp_remote_retrieve_body(&$response) {
-       if ( ! isset($response['body']) )
+       if ( is_wp_error($response) || ! isset($response['body']) )
                return '';
 
        return $response['body'];
                return '';
 
        return $response['body'];
diff --git a/wp-includes/js/autosave.dev.js b/wp-includes/js/autosave.dev.js
new file mode 100644 (file)
index 0000000..72a74a4
--- /dev/null
@@ -0,0 +1,261 @@
+var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true;
+
+jQuery(document).ready( function($) {
+       var dotabkey = true;
+       
+       autosaveLast = $('#post #title').val() + $('#post #content').val();
+       autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
+
+       //Disable autosave after the form has been submitted
+       $("#post").submit(function() { $.cancel(autosavePeriodical); });
+
+       $('.submitbox input[type="submit"], .submitbox a.submitdelete').click(function(){window.onbeforeunload = null;});
+
+       window.onbeforeunload = function(){
+               var mce = typeof(tinyMCE) != 'undefined' ? tinyMCE.activeEditor : false, title, content;
+
+               if ( mce && !mce.isHidden() ) {
+                       if ( mce.isDirty() )
+                               return autosaveL10n.saveAlert;
+               } else {
+                       title = $('#post #title').val(), content = $('#post #content').val();
+                       if ( ( title || content ) && title + content != autosaveLast )
+                               return autosaveL10n.saveAlert;
+               }
+       };
+
+       // preview
+       $('#post-preview').click(function(){
+               if ( 1 > $('#post_ID').val() && notSaved ) {
+                       autosaveDelayPreview = true;
+                       autosave();
+                       return false;
+               }
+               doPreview();
+               return false;
+       });
+
+       doPreview = function() {
+               $('input#wp-preview').val('dopreview');
+               $('form#post').attr('target', 'wp-preview').submit().attr('target', '');
+               $('input#wp-preview').val('');
+       }
+
+       //  This code is meant to allow tabbing from Title to Post if tinyMCE is defined.
+       if ( typeof tinyMCE != 'undefined' ) {
+               $('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) {
+                       if ( e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey ) {
+                               if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); }
+                               if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
+                                       e.preventDefault();
+                                       dotabkey = false;
+                                       tinyMCE.activeEditor.focus();
+                                       return false;
+                               }
+                       }
+               });
+       }
+});
+
+function autosave_parse_response(response) {
+       var res = wpAjax.parseAjaxResponse(response, 'autosave'), message = '', postID;
+
+       if ( res && res.responses && res.responses.length ) {
+               message = res.responses[0].data; // The saved message or error.
+               // someone else is editing: disable autosave, set errors
+               if ( res.responses[0].supplemental ) {
+                       if ( 'disable' == res.responses[0].supplemental['disable_autosave'] ) {
+                               autosave = function() {};
+                               res = { errors: true };
+                       }
+                       jQuery.each(res.responses[0].supplemental, function(selector, value) {
+                               if ( selector.match(/^replace-/) ) {
+                                       jQuery('#'+selector.replace('replace-', '')).val(value);
+                               }
+                       });
+               }
+
+               // if no errors: add slug UI
+               if ( !res.errors ) {
+                       postID = parseInt( res.responses[0].id, 10 );
+                       if ( !isNaN(postID) && postID > 0 ) {
+                               autosave_update_slug(postID);
+                       }
+               }
+       }
+       if ( message ) { jQuery('#autosave').html(message); } // update autosave message
+       else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); }
+       return res;
+}
+
+// called when autosaving pre-existing post
+function autosave_saved(response) {
+       autosave_parse_response(response); // parse the ajax response
+       autosave_enable_buttons(); // re-enable disabled form buttons
+}
+
+// called when autosaving new post
+function autosave_saved_new(response) {
+       var res = autosave_parse_response(response), tempID, postID;
+       // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID
+       if ( res && res.responses.length && !res.errors ) {
+               tempID = jQuery('#post_ID').val();
+               postID = parseInt( res.responses[0].id, 10 );
+               autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here
+               if ( tempID < 0 && postID > 0 ) { // update media buttons
+                       notSaved = false;
+                       jQuery('#media-buttons a').each(function(){
+                               this.href = this.href.replace(tempID, postID);
+                       });
+               }
+               if ( autosaveDelayPreview ) {
+                       autosaveDelayPreview = false;
+                       doPreview();
+               }
+       } else {
+               autosave_enable_buttons(); // re-enable disabled form buttons
+       }
+}
+
+function autosave_update_post_ID( postID ) {
+       if ( !isNaN(postID) && postID > 0 ) {
+               if ( postID == parseInt(jQuery('#post_ID').val(), 10) ) { return; } // no need to do this more than once
+               jQuery('#post_ID').attr({name: "post_ID"});
+               jQuery('#post_ID').val(postID);
+               // We need new nonces
+               jQuery.post(autosaveL10n.requestFile, {
+                       action: "autosave-generate-nonces",
+                       post_ID: postID,
+                       autosavenonce: jQuery('#autosavenonce').val(),
+                       post_type: jQuery('#post_type').val()
+               }, function(html) {
+                       jQuery('#_wpnonce').val(html);
+                       autosave_enable_buttons(); // re-enable disabled form buttons
+               });
+               jQuery('#hiddenaction').val('editpost');
+       }
+}
+
+function autosave_update_slug(post_id) {
+       // create slug area only if not already there
+       if ( jQuery.isFunction(make_slugedit_clickable) && !jQuery('#edit-slug-box > *').size() ) {
+               jQuery.post(
+                       slugL10n.requestFile,
+                       {
+                               action: 'sample-permalink',
+                               post_id: post_id,
+                               new_title: jQuery('#title').val(),
+                               samplepermalinknonce: jQuery('#samplepermalinknonce').val()
+                       },
+                       function(data) {
+                               jQuery('#edit-slug-box').html(data);
+                               make_slugedit_clickable();
+                       }
+               );
+       }
+}
+
+function autosave_loading() {
+       jQuery('#autosave').html(autosaveL10n.savingText);
+}
+
+function autosave_enable_buttons() {
+       jQuery(".submitbox :button:disabled, .submitbox :submit:disabled").attr('disabled', '');
+}
+
+function autosave_disable_buttons() {
+       jQuery(".submitbox :button:enabled, .submitbox :submit:enabled").attr('disabled', 'disabled');
+       // Re-enable 5 sec later.  Just gives autosave a head start to avoid collisions.
+       setTimeout(autosave_enable_buttons, 5000);
+}
+
+autosave = function() {
+       // (bool) is rich editor enabled and active
+       var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden(), post_data, doAutoSave, ed, origStatus, successCallback;
+
+       post_data = {
+               action: "autosave",
+               post_ID:  jQuery("#post_ID").val() || 0,
+               post_title: jQuery("#title").val() || "",
+               autosavenonce: jQuery('#autosavenonce').val(),
+               //tags_input: jQuery("#tags-input").val() || "",
+               post_type: jQuery('#post_type').val() || "",
+               autosave: 1
+       };
+
+       jQuery('.tags-input').each( function() {
+               post_data[this.name] = this.value;
+       } );
+
+       // We always send the ajax request in order to keep the post lock fresh.
+       // This (bool) tells whether or not to write the post to the DB during the ajax request.
+       doAutoSave = true;
+
+       // No autosave while thickbox is open (media buttons)
+       if ( jQuery("#TB_window").css('display') == 'block' )
+               doAutoSave = false;
+
+       /* Gotta do this up here so we can check the length when tinyMCE is in use */
+       if ( rich ) {
+               ed = tinyMCE.activeEditor;
+               if ( 'mce_fullscreen' == ed.id )
+                       tinyMCE.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
+               tinyMCE.get('content').save();
+       }
+
+       post_data["content"] = jQuery("#content").val();
+       if ( jQuery('#post_name').val() )
+               post_data["post_name"] = jQuery('#post_name').val();
+
+       // Nothing to save or no change.
+       if( ( post_data["post_title"].length == 0 && post_data["content"].length == 0 ) || post_data["post_title"] + post_data["content"] == autosaveLast) {
+               doAutoSave = false;
+       }
+
+       autosave_disable_buttons();
+
+       origStatus = jQuery('#original_post_status').val();
+
+       autosaveLast = jQuery("#title").val()+jQuery("#content").val();
+       goodcats = ([]);
+       jQuery("[name='post_category[]']:checked").each( function(i) {
+               goodcats.push(this.value);
+       } );
+       post_data["catslist"] = goodcats.join(",");
+
+       if ( jQuery("#comment_status").attr("checked") )
+               post_data["comment_status"] = 'open';
+       if ( jQuery("#ping_status").attr("checked") )
+               post_data["ping_status"] = 'open';
+       if ( jQuery("#excerpt").size() )
+               post_data["excerpt"] = jQuery("#excerpt").val();
+       if ( jQuery("#post_author").size() )
+               post_data["post_author"] = jQuery("#post_author").val();
+       post_data["user_ID"] = jQuery("#user-id").val();
+
+       // Don't run while the TinyMCE spellcheck is on. It resets all found words.
+       if ( rich && tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) {
+               doAutoSave = false;
+       }
+
+       if ( parseInt(post_data["post_ID"], 10) < 1 ) {
+               post_data["temp_ID"] = post_data["post_ID"];
+               successCallback = autosave_saved_new; // new post
+       } else {
+               successCallback = autosave_saved; // pre-existing post
+       }
+
+       if ( !doAutoSave ) {
+               post_data['autosave'] = 0;
+       }
+
+       autosaveOldMessage = jQuery('#autosave').html();
+
+       jQuery.ajax({
+               data: post_data,
+               beforeSend: doAutoSave ? autosave_loading : null,
+               type: "POST",
+               url: autosaveL10n.requestFile,
+               success: successCallback
+       });
+}
index 7e1d0aa871bfdec2ab342928fd9b6961b173657d..a18063ad16c3877b340a71eb42679263696103c1 100644 (file)
@@ -1,209 +1 @@
-var autosaveLast = '';
-var autosavePeriodical;
-var autosaveOldMessage = '';
-var autosaveDelayPreview = false;
-var autosaveFirst = true;
-
-jQuery(function($) {
-       autosaveLast = $('#post #title').val()+$('#post #content').val();
-       autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
-
-       //Disable autosave after the form has been submitted
-       $("#post").submit(function() { $.cancel(autosavePeriodical); });
-});
-
-function autosave_parse_response(response) {
-       var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response
-       var message = '';
-
-       if ( res && res.responses && res.responses.length ) {
-               message = res.responses[0].data; // The saved message or error.
-               // someone else is editing: disable autosave, set errors
-               if ( res.responses[0].supplemental ) {
-                       if ( 'disable' == res.responses[0].supplemental['disable_autosave'] ) {
-                               autosave = function() {};
-                               res = { errors: true };
-                       }
-                       jQuery.each(res.responses[0].supplemental, function(selector, value) {
-                               if ( selector.match(/^replace-/) ) {
-                                       jQuery('#'+selector.replace('replace-', '')).val(value);
-                               }
-                       });
-               }
-
-               // if no errors: add slug UI
-               if ( !res.errors ) {
-                       var postID = parseInt( res.responses[0].id );
-                       if ( !isNaN(postID) && postID > 0 ) {
-                               autosave_update_slug(postID);
-                       }
-               }
-       }
-       if ( message ) { jQuery('#autosave').html(message); } // update autosave message
-       else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); }
-       return res;
-}
-
-// called when autosaving pre-existing post
-function autosave_saved(response) {
-       autosave_parse_response(response); // parse the ajax response
-       autosave_enable_buttons(); // re-enable disabled form buttons
-}
-
-// called when autosaving new post
-function autosave_saved_new(response) {
-       var res = autosave_parse_response(response); // parse the ajax response
-       // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID
-       if ( res && res.responses.length && !res.errors ) {
-               var tempID = jQuery('#post_ID').val();
-               var postID = parseInt( res.responses[0].id );
-               autosave_update_post_ID( postID ); // disabled form buttons are re-enabled here
-               if ( tempID < 0 && postID > 0 ) // update media buttons
-                       jQuery('#media-buttons a').each(function(){
-                               this.href = this.href.replace(tempID, postID);
-                       });
-               // activate preview
-               autosaveFirst = false;
-               if ( autosaveDelayPreview )
-                       jQuery('#post-preview').click();
-       } else {
-               autosave_enable_buttons(); // re-enable disabled form buttons
-       }
-}
-
-function autosave_update_post_ID( postID ) {
-       if ( !isNaN(postID) && postID > 0 ) {
-               if ( postID == parseInt(jQuery('#post_ID').val()) ) { return; } // no need to do this more than once
-               jQuery('#post_ID').attr({name: "post_ID"});
-               jQuery('#post_ID').val(postID);
-               // We need new nonces
-               jQuery.post(autosaveL10n.requestFile, {
-                       action: "autosave-generate-nonces",
-                       post_ID: postID,
-                       autosavenonce: jQuery('#autosavenonce').val(),
-                       post_type: jQuery('#post_type').val()
-               }, function(html) {
-                       jQuery('#_wpnonce').val(html);
-                       autosave_enable_buttons(); // re-enable disabled form buttons
-               });
-               jQuery('#hiddenaction').val('editpost');
-       }
-}
-
-function autosave_update_slug(post_id) {
-       // create slug area only if not already there
-       if ( jQuery.isFunction(make_slugedit_clickable) && !jQuery('#edit-slug-box > *').size() ) {
-               jQuery.post(
-                       slugL10n.requestFile,
-                       {
-                               action: 'sample-permalink',
-                               post_id: post_id,
-                               new_title: jQuery('#title').val(),
-                               samplepermalinknonce: jQuery('#samplepermalinknonce').val()
-                       },
-                       function(data) {
-                               jQuery('#edit-slug-box').html(data);
-                               make_slugedit_clickable();
-                       }
-               );
-       }
-}
-
-function autosave_loading() {
-       jQuery('#autosave').html(autosaveL10n.savingText);
-}
-
-function autosave_enable_buttons() {
-       jQuery(".submitbox :button:disabled, .submitbox :submit:disabled").attr('disabled', '');
-}
-
-function autosave_disable_buttons() {
-       jQuery(".submitbox :button:enabled, .submitbox :submit:enabled").attr('disabled', 'disabled');
-       setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later.  Just gives autosave a head start to avoid collisions.
-}
-
-var autosave = function() {
-       // (bool) is rich editor enabled and active
-       var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden();
-       var post_data = {
-               action: "autosave",
-               post_ID:  jQuery("#post_ID").val() || 0,
-               post_title: jQuery("#title").val() || "",
-               autosavenonce: jQuery('#autosavenonce').val(),
-               tags_input: jQuery("#tags-input").val() || "",
-               post_type: jQuery('#post_type').val() || "",
-               autosave: 1
-       };
-
-       // We always send the ajax request in order to keep the post lock fresh.
-       // This (bool) tells whether or not to write the post to the DB during the ajax request.
-       var doAutoSave = true;
-
-       // No autosave while thickbox is open (media buttons)
-       if ( jQuery("#TB_window").css('display') == 'block' )
-               doAutoSave = false;
-
-       /* Gotta do this up here so we can check the length when tinyMCE is in use */
-       if ( rich ) {
-               var ed = tinyMCE.activeEditor;
-               if ( 'mce_fullscreen' == ed.id )
-                       tinyMCE.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
-               tinyMCE.get('content').save();
-       }
-
-       post_data["content"] = jQuery("#content").val();
-       if ( jQuery('#post_name').val() )
-               post_data["post_name"] = jQuery('#post_name').val();
-
-       // Nothing to save or no change.
-       if( (post_data["post_title"].length==0 && post_data["content"].length==0) || post_data["post_title"] + post_data["content"] == autosaveLast) {
-               doAutoSave = false
-       }
-
-       autosave_disable_buttons();
-
-       var origStatus = jQuery('#original_post_status').val();
-
-       autosaveLast = jQuery("#title").val()+jQuery("#content").val();
-       goodcats = ([]);
-       jQuery("[@name='post_category[]']:checked").each( function(i) {
-               goodcats.push(this.value);
-       } );
-       post_data["catslist"] = goodcats.join(",");
-
-       if ( jQuery("#comment_status").attr("checked") )
-               post_data["comment_status"] = 'open';
-       if ( jQuery("#ping_status").attr("checked") )
-               post_data["ping_status"] = 'open';
-       if ( jQuery("#excerpt").size() )
-               post_data["excerpt"] = jQuery("#excerpt").val();
-       if ( jQuery("#post_author").size() )
-               post_data["post_author"] = jQuery("#post_author").val();
-       post_data["user_ID"] = jQuery("#user-id").val();
-
-       // Don't run while the TinyMCE spellcheck is on.  Why?  Who knows.
-       if ( rich && tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) {
-               doAutoSave = false;
-       }
-
-       if(parseInt(post_data["post_ID"]) < 1) {
-               post_data["temp_ID"] = post_data["post_ID"];
-               var successCallback = autosave_saved_new; // new post
-       } else {
-               var successCallback = autosave_saved; // pre-existing post
-       }
-
-       if ( !doAutoSave ) {
-               post_data['autosave'] = 0;
-       }
-
-       autosaveOldMessage = jQuery('#autosave').html();
-
-       jQuery.ajax({
-               data: post_data,
-               beforeSend: doAutoSave ? autosave_loading : null,
-               type: "POST",
-               url: autosaveL10n.requestFile,
-               success: successCallback
-       });
-}
+var autosave,autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,notSaved=true;jQuery(document).ready(function(b){var a=true;autosaveLast=b("#post #title").val()+b("#post #content").val();autosavePeriodical=b.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});b("#post").submit(function(){b.cancel(autosavePeriodical)});b('.submitbox input[type="submit"], .submitbox a.submitdelete').click(function(){window.onbeforeunload=null});window.onbeforeunload=function(){var c=typeof(tinyMCE)!="undefined"?tinyMCE.activeEditor:false,e,d;if(c&&!c.isHidden()){if(c.isDirty()){return autosaveL10n.saveAlert}}else{e=b("#post #title").val(),d=b("#post #content").val();if((e||d)&&e+d!=autosaveLast){return autosaveL10n.saveAlert}}};b("#post-preview").click(function(){if(1>b("#post_ID").val()&&notSaved){autosaveDelayPreview=true;autosave();return false}doPreview();return false});doPreview=function(){b("input#wp-preview").val("dopreview");b("form#post").attr("target","wp-preview").submit().attr("target","");b("input#wp-preview").val("")};if(typeof tinyMCE!="undefined"){b("#title")[b.browser.opera?"keypress":"keydown"](function(c){if(c.which==9&&!c.shiftKey&&!c.controlKey&&!c.altKey){if((b("#post_ID").val()<1)&&(b("#title").val().length>0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&a){c.preventDefault();a=false;tinyMCE.activeEditor.focus();return false}}})}});function autosave_parse_response(b){var c=wpAjax.parseAjaxResponse(b,"autosave"),d="",a;if(c&&c.responses&&c.responses.length){d=c.responses[0].data;if(c.responses[0].supplemental){if("disable"==c.responses[0].supplemental.disable_autosave){autosave=function(){};c={errors:true}}jQuery.each(c.responses[0].supplemental,function(e,f){if(e.match(/^replace-/)){jQuery("#"+e.replace("replace-","")).val(f)}})}if(!c.errors){a=parseInt(c.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(d){jQuery("#autosave").html(d)}else{if(autosaveOldMessage&&c){jQuery("#autosave").html(autosaveOldMessage)}}return c}function autosave_saved(a){autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){var d=autosave_parse_response(b),c,a;if(d&&d.responses.length&&!d.errors){c=jQuery("#post_ID").val();a=parseInt(d.responses[0].id,10);autosave_update_post_ID(a);if(c<0&&a>0){notSaved=false;jQuery("#media-buttons a").each(function(){this.href=this.href.replace(c,a)})}if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_post_ID(a){if(!isNaN(a)&&a>0){if(a==parseInt(jQuery("#post_ID").val(),10)){return}jQuery("#post_ID").attr({name:"post_ID"});jQuery("#post_ID").val(a);jQuery.post(autosaveL10n.requestFile,{action:"autosave-generate-nonces",post_ID:a,autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()},function(b){jQuery("#_wpnonce").val(b);autosave_enable_buttons()});jQuery("#hiddenaction").val("editpost")}}function autosave_update_slug(a){if(jQuery.isFunction(make_slugedit_clickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(slugL10n.requestFile,{action:"sample-permalink",post_id:a,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){jQuery("#edit-slug-box").html(b);make_slugedit_clickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){jQuery(".submitbox :button:disabled, .submitbox :submit:disabled").attr("disabled","")}function autosave_disable_buttons(){jQuery(".submitbox :button:enabled, .submitbox :submit:enabled").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}autosave=function(){var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c){b=tinyMCE.activeEditor;if("mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}d.content=jQuery("#content").val();if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}autosave_disable_buttons();e=jQuery("#original_post_status").val();autosaveLast=jQuery("#title").val()+jQuery("#content").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){d.comment_status="open"}if(jQuery("#ping_status").attr("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}d.user_ID=jQuery("#user-id").val();if(c&&tinyMCE.activeEditor.plugins.spellchecker&&tinyMCE.activeEditor.plugins.spellchecker.active){f=false}if(parseInt(d.post_ID,10)<1){d.temp_ID=d.post_ID;a=autosave_saved_new}else{a=autosave_saved}if(!f){d.autosave=0}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:a})};
\ No newline at end of file
diff --git a/wp-includes/js/codepress/codepress.css b/wp-includes/js/codepress/codepress.css
new file mode 100644 (file)
index 0000000..3a4a00a
--- /dev/null
@@ -0,0 +1,21 @@
+body {
+       margin-top:13px;
+       _margin-top:14px;
+       background:white;
+       margin-left:32px;
+       font-family:monospace;
+       font-size:13px;
+       white-space:pre;
+       background-image:url("images/line-numbers.png");
+       background-repeat:repeat-y;
+       background-position:0 3px;
+       line-height:16px;
+       height:100%;
+}
+pre {margin:0;}
+html>body{background-position:0 2px;}
+P {margin:0;padding:0;border:0;outline:0;display:block;white-space:pre;}
+b, i, s, u, a, em, tt, ins, big, cite, strong, var, dfn {text-decoration:none;font-weight:normal;font-style:normal;font-size:13px;}
+
+body.hide-line-numbers {background:white;margin-left:16px;}
+body.show-line-numbers {background-image:url("images/line-numbers.png");margin-left:32px;}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/codepress.html b/wp-includes/js/codepress/codepress.html
new file mode 100644 (file)
index 0000000..d9711d6
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+       <title>CodePress - Real Time Syntax Highlighting Editor written in JavaScript</title>
+       <meta name="description" content="CodePress - source code editor window" />
+
+       <script type="text/javascript">
+       var language = 'generic';
+       var engine = 'older';
+       var ua = navigator.userAgent;
+       var ts = (new Date).getTime(); // timestamp to avoid cache
+       var lh = location.href;
+       
+       if(ua.match('MSIE')) engine = 'msie';
+       else if(ua.match('KHTML')) engine = 'khtml'; 
+       else if(ua.match('Opera')) engine = 'opera'; 
+       else if(ua.match('Gecko')) engine = 'gecko';
+
+       if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1');
+
+       document.write('<link type="text/css" href="codepress.css?ts='+ts+'" rel="stylesheet" />');
+       document.write('<link type="text/css" href="languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />');
+       document.write('<scr'+'ipt type="text/javascript" src="engines/'+engine+'.js?ts='+ts+'"></scr'+'ipt>');
+       document.write('<scr'+'ipt type="text/javascript" src="languages/'+language+'.js?ts='+ts+'"></scr'+'ipt>');
+       </script>
+
+</head>
+
+<script type="text/javascript">
+if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>');
+else if(engine == "opera") document.write('<body></body>');
+// else if(engine == "khtml") document.write('<body> </body>');
+</script>
+
+</html>
diff --git a/wp-includes/js/codepress/codepress.js b/wp-includes/js/codepress/codepress.js
new file mode 100644 (file)
index 0000000..804f29a
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2006 Fernando M.A.d.S. <fermads@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ */
+
+CodePress = function(obj) {
+       var self = document.createElement('iframe');
+       self.textarea = obj;
+       self.textarea.disabled = true;
+       self.textarea.style.overflow = 'hidden';
+       self.style.height = self.textarea.clientHeight +'px';
+       self.style.width = self.textarea.clientWidth +'px';
+       self.textarea.style.overflow = 'auto';
+       self.style.border = '1px solid gray';
+       self.frameBorder = 0; // remove IE internal iframe border
+       self.style.visibility = 'hidden';
+       self.style.position = 'absolute';
+       self.options = self.textarea.className;
+       
+       self.initialize = function() {
+               self.editor = self.contentWindow.CodePress;
+               self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
+               self.editor.setCode(self.textarea.value);
+               self.setOptions();
+               self.editor.syntaxHighlight('init');
+               self.textarea.style.display = 'none';
+               self.style.position = 'static';
+               self.style.visibility = 'visible';
+               self.style.display = 'inline';
+       }
+       
+       // obj can by a textarea id or a string (code)
+       self.edit = function(obj,language) {
+               if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj;
+               if(!self.textarea.disabled) return;
+               self.language = language ? language : self.getLanguage();
+               self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime();
+               if(self.attachEvent) self.attachEvent('onload',self.initialize);
+               else self.addEventListener('load',self.initialize,false);
+       }
+
+       self.getLanguage = function() {
+               for (language in CodePress.languages) 
+                       if(self.options.match('\\b'+language+'\\b')) 
+                               return CodePress.languages[language] ? language : 'generic';
+       }
+       
+       self.setOptions = function() {
+               if(self.options.match('autocomplete-off')) self.toggleAutoComplete();
+               if(self.options.match('readonly-on')) self.toggleReadOnly();
+               if(self.options.match('linenumbers-off')) self.toggleLineNumbers();
+       }
+       
+       self.getCode = function() {
+               return self.textarea.disabled ? self.editor.getCode() : self.textarea.value;
+       }
+
+       self.setCode = function(code) {
+               self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code;
+       }
+
+       self.toggleAutoComplete = function() {
+               self.editor.autocomplete = (self.editor.autocomplete) ? false : true;
+       }
+       
+       self.toggleReadOnly = function() {
+               self.textarea.readOnly = (self.textarea.readOnly) ? false : true;
+               if(self.style.display != 'none') // prevent exception on FF + iframe with display:none
+                       self.editor.readOnly(self.textarea.readOnly ? true : false);
+       }
+       
+       self.toggleLineNumbers = function() {
+               var cn = self.editor.body.className;
+               self.editor.body.className = (cn==''||cn=='show-line-numbers') ? 'hide-line-numbers' : 'show-line-numbers';
+       }
+       
+       self.toggleEditor = function() {
+               if(self.textarea.disabled) {
+                       self.textarea.value = self.getCode();
+                       self.textarea.disabled = false;
+                       self.style.display = 'none';
+                       self.textarea.style.display = 'inline';
+               }
+               else {
+                       self.textarea.disabled = true;
+                       self.setCode(self.textarea.value);
+                       self.editor.syntaxHighlight('init');
+                       self.style.display = 'inline';
+                       self.textarea.style.display = 'none';
+               }
+       }
+
+       self.edit();
+       return self;
+}
+
+CodePress.languages = {        
+       csharp : 'C#', 
+       css : 'CSS', 
+       generic : 'Generic',
+       html : 'HTML',
+       java : 'Java', 
+       javascript : 'JavaScript', 
+       perl : 'Perl', 
+       ruby : 'Ruby',  
+       php : 'PHP', 
+       text : 'Text', 
+       sql : 'SQL',
+       vbscript : 'VBScript'
+}
+
+
+CodePress.run = function() {
+       // Modified for WordPress compat to prevent loading on webkit and to
+       // reference a codepress_path which is specified externally.
+       if (navigator.userAgent.toLowerCase().indexOf('webkit') != -1)
+               return;
+       CodePress.path = codepress_path;
+       var t = document.getElementsByTagName('textarea'), i, id;
+       for(i=0,n=t.length;i<n;i++) {
+               if(t[i].className.match('codepress')) {
+                       id = t[i].id;
+                       t[i].id = id+'_cp';
+                       eval(id+' = new CodePress(t[i])');
+                       t[i].parentNode.insertBefore(eval(id), t[i]);
+               } 
+       }
+}
+
+if(window.attachEvent) window.attachEvent('onload',CodePress.run);
+else window.addEventListener('DOMContentLoaded',CodePress.run,false);
diff --git a/wp-includes/js/codepress/engines/gecko.js b/wp-includes/js/codepress/engines/gecko.js
new file mode 100644 (file)
index 0000000..cd239ee
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com>
+ *
+ * Developers:
+ *             Fernando M.A.d.S. <fermads@gmail.com>
+ *             Michael Hurni <michael.hurni@gmail.com>
+ * Contributors:       
+ *             Martin D. Kirk
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ */
+
+CodePress = {
+       scrolling : false,
+       autocomplete : true,
+
+       // set initial vars and start sh
+       initialize : function() {
+               if(typeof(editor)=='undefined' && !arguments[0]) return;
+               body = document.getElementsByTagName('body')[0];
+               body.innerHTML = body.innerHTML.replace(/\n/g,"");
+               chars = '|32|46|62|8|'; // charcodes that trigger syntax highlighting
+               cc = '\u2009'; // carret char
+               editor = document.getElementsByTagName('pre')[0];
+               document.designMode = 'on';
+               document.addEventListener('keypress', this.keyHandler, true);
+               window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false);
+               completeChars = this.getCompleteChars();
+               completeEndingChars =  this.getCompleteEndingChars();
+       },
+
+       // treat key bindings
+       keyHandler : function(evt) {
+       keyCode = evt.keyCode;  
+               charCode = evt.charCode;
+               fromChar = String.fromCharCode(charCode);
+
+               if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
+                       CodePress.shortcuts(charCode?charCode:keyCode);
+               }
+               else if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1) && CodePress.autocomplete) { // auto complete
+                       if(!CodePress.completeEnding(fromChar))
+                            CodePress.complete(fromChar);
+               }
+           else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting
+                       top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100);
+               }
+               else if(keyCode==9 || evt.tabKey) {  // snippets activation (tab)
+                       CodePress.snippets(evt);
+               }
+               else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
+                       CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
+               }
+               else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo
+                       (charCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
+                       evt.preventDefault();
+               }
+               else if(charCode==118 && evt.ctrlKey)  { // handle paste
+                       top.setTimeout(function(){CodePress.syntaxHighlight('generic');},100);
+               }
+               else if(charCode==99 && evt.ctrlKey)  { // handle cut
+                       //alert(window.getSelection().getRangeAt(0).toString().replace(/\t/g,'FFF'));
+               }
+
+       },
+
+       // put cursor back to its original position after every parsing
+       findString : function() {
+               if(self.find(cc))
+                       window.getSelection().getRangeAt(0).deleteContents();
+       },
+       
+       // split big files, highlighting parts of it
+       split : function(code,flag) {
+               if(flag=='scroll') {
+                       this.scrolling = true;
+                       return code;
+               }
+               else {
+                       this.scrolling = false;
+                       mid = code.indexOf(cc);
+                       if(mid-2000<0) {ini=0;end=4000;}
+                       else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
+                       else {ini=mid-2000;end=mid+2000;}
+                       code = code.substring(ini,end);
+                       return code;
+               }
+       },
+       
+       getEditor : function() {
+               if(!document.getElementsByTagName('pre')[0]) {
+                       body = document.getElementsByTagName('body')[0];
+                       if(!body.innerHTML) return body;
+                       if(body.innerHTML=="<br>") body.innerHTML = "<pre> </pre>";
+                       else body.innerHTML = "<pre>"+body.innerHTML+"</pre>";
+               }
+               return document.getElementsByTagName('pre')[0];
+       },
+       
+       // syntax highlighting parser
+       syntaxHighlight : function(flag) {
+               //if(document.designMode=='off') document.designMode='on'
+               if(flag != 'init') { window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));}
+               editor = CodePress.getEditor();
+               o = editor.innerHTML;
+               o = o.replace(/<br>/g,'\n');
+               o = o.replace(/<.*?>/g,'');
+               x = z = this.split(o,flag);
+               x = x.replace(/\n/g,'<br>');
+
+               if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
+       
+               for(i=0;i<Language.syntax.length;i++) 
+                       x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
+
+               editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x);
+               if(flag!='init') this.findString();
+       },
+       
+       getLastWord : function() {
+               var rangeAndCaret = CodePress.getRangeAndCaret();
+               words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
+               words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
+               return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
+       },
+       
+       snippets : function(evt) {
+               var snippets = Language.snippets;       
+               var trigger = this.getLastWord();
+               for (var i=0; i<snippets.length; i++) {
+                       if(snippets[i].input == trigger) {
+                               var content = snippets[i].output.replace(/</g,'&lt;');
+                               content = content.replace(/>/g,'&gt;');
+                               if(content.indexOf('$0')<0) content += cc;
+                               else content = content.replace(/\$0/,cc);
+                               content = content.replace(/\n/g,'<br>');
+                               var pattern = new RegExp(trigger+cc,'gi');
+                               evt.preventDefault(); // prevent the tab key from being added
+                               this.syntaxHighlight('snippets',pattern,content);
+                       }
+               }
+       },
+       
+       readOnly : function() {
+               document.designMode = (arguments[0]) ? 'off' : 'on';
+       },
+
+       complete : function(trigger) {
+               window.getSelection().getRangeAt(0).deleteContents();
+               var complete = Language.complete;
+               for (var i=0; i<complete.length; i++) {
+                       if(complete[i].input == trigger) {
+                               var pattern = new RegExp('\\'+trigger+cc);
+                               var content = complete[i].output.replace(/\$0/g,cc);
+                               parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
+                       }
+               }
+       },
+
+       getCompleteChars : function() {
+               var cChars = '';
+               for(var i=0;i<Language.complete.length;i++)
+                       cChars += '|'+Language.complete[i].input;
+               return cChars+'|';
+       },
+       
+       getCompleteEndingChars : function() {
+               var cChars = '';
+               for(var i=0;i<Language.complete.length;i++)
+                       cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1);
+               return cChars+'|';
+       },
+       
+       completeEnding : function(trigger) {
+               var range = window.getSelection().getRangeAt(0);
+               try {
+                       range.setEnd(range.endContainer, range.endOffset+1)
+               }
+               catch(e) {
+                       return false;
+               }
+               var next_character = range.toString()
+               range.setEnd(range.endContainer, range.endOffset-1)
+               if(next_character != trigger) return false;
+               else {
+                       range.setEnd(range.endContainer, range.endOffset+1)
+                       range.deleteContents();
+                       return true;
+               }
+       },
+       
+       shortcuts : function() {
+               var cCode = arguments[0];
+               if(cCode==13) cCode = '[enter]';
+               else if(cCode==32) cCode = '[space]';
+               else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']';
+               for(var i=0;i<Language.shortcuts.length;i++)
+                       if(Language.shortcuts[i].input == cCode)
+                               this.insertCode(Language.shortcuts[i].output,false);
+       },
+       
+       getRangeAndCaret : function() { 
+               var range = window.getSelection().getRangeAt(0);
+               var range2 = range.cloneRange();
+               var node = range.endContainer;                  
+               var caret = range.endOffset;
+               range2.selectNode(node);        
+               return [range2.toString(),caret];
+       },
+       
+       insertCode : function(code,replaceCursorBefore) {
+               var range = window.getSelection().getRangeAt(0);
+               var node = window.document.createTextNode(code);
+               var selct = window.getSelection();
+               var range2 = range.cloneRange();
+               // Insert text at cursor position
+               selct.removeAllRanges();
+               range.deleteContents();
+               range.insertNode(node);
+               // Move the cursor to the end of text
+               range2.selectNode(node);                
+               range2.collapse(replaceCursorBefore);
+               selct.removeAllRanges();
+               selct.addRange(range2);
+       },
+       
+       // get code from editor
+       getCode : function() {
+               if(!document.getElementsByTagName('pre')[0] || editor.innerHTML == '')
+                       editor = CodePress.getEditor();
+               var code = editor.innerHTML;
+               code = code.replace(/<br>/g,'\n');
+               code = code.replace(/\u2009/g,'');
+               code = code.replace(/<.*?>/g,'');
+               code = code.replace(/&lt;/g,'<');
+               code = code.replace(/&gt;/g,'>');
+               code = code.replace(/&amp;/gi,'&');
+               return code;
+       },
+
+       // put code inside editor
+       setCode : function() {
+               var code = arguments[0];
+               code = code.replace(/\u2009/gi,'');
+               code = code.replace(/&/gi,'&amp;');
+               code = code.replace(/</g,'&lt;');
+               code = code.replace(/>/g,'&gt;');
+               editor.innerHTML = code;
+               if (code == '')
+                       document.getElementsByTagName('body')[0].innerHTML = '';
+       },
+
+       // undo and redo methods
+       actions : {
+               pos : -1, // actual history position
+               history : [], // history vector
+               
+               undo : function() {
+                       editor = CodePress.getEditor();
+                       if(editor.innerHTML.indexOf(cc)==-1){
+                               if(editor.innerHTML != " ")
+                                       window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));
+                               this.history[this.pos] = editor.innerHTML;
+                       }
+                       this.pos --;
+                       if(typeof(this.history[this.pos])=='undefined') this.pos ++;
+                       editor.innerHTML = this.history[this.pos];
+                       if(editor.innerHTML.indexOf(cc)>-1) editor.innerHTML+=cc;
+                       CodePress.findString();
+               },
+               
+               redo : function() {
+                       // editor = CodePress.getEditor();
+                       this.pos++;
+                       if(typeof(this.history[this.pos])=='undefined') this.pos--;
+                       editor.innerHTML = this.history[this.pos];
+                       CodePress.findString();
+               },
+               
+               next : function() { // get next vector position and clean old ones
+                       if(this.pos>20) this.history[this.pos-21] = undefined;
+                       return ++this.pos;
+               }
+       }
+}
+
+Language={};
+window.addEventListener('load', function() { CodePress.initialize('new'); }, true);
\ No newline at end of file
diff --git a/wp-includes/js/codepress/engines/khtml.js b/wp-includes/js/codepress/engines/khtml.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/wp-includes/js/codepress/engines/msie.js b/wp-includes/js/codepress/engines/msie.js
new file mode 100644 (file)
index 0000000..2558c39
--- /dev/null
@@ -0,0 +1,304 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com>
+ *
+ * Developers:
+ *             Fernando M.A.d.S. <fermads@gmail.com>
+ *             Michael Hurni <michael.hurni@gmail.com>
+ * Contributors:       
+ *             Martin D. Kirk
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ */
+
+CodePress = {
+       scrolling : false,
+       autocomplete : true,
+       
+       // set initial vars and start sh
+       initialize : function() {
+               if(typeof(editor)=='undefined' && !arguments[0]) return;
+               chars = '|32|46|62|'; // charcodes that trigger syntax highlighting
+               cc = '\u2009'; // carret char
+               editor = document.getElementsByTagName('pre')[0];
+               editor.contentEditable = 'true';
+               document.getElementsByTagName('body')[0].onfocus = function() {editor.focus();}
+               document.attachEvent('onkeydown', this.metaHandler);
+               document.attachEvent('onkeypress', this.keyHandler);
+               window.attachEvent('onscroll', function() { if(!CodePress.scrolling) setTimeout(function(){CodePress.syntaxHighlight('scroll')},1)});
+               completeChars = this.getCompleteChars();
+               completeEndingChars =  this.getCompleteEndingChars();
+               setTimeout(function() { window.scroll(0,0) },50); // scroll IE to top
+       },
+       
+       // treat key bindings
+       keyHandler : function(evt) {
+               charCode = evt.keyCode;
+               fromChar = String.fromCharCode(charCode);
+               
+               if( (completeEndingChars.indexOf('|'+fromChar+'|')!= -1 || completeChars.indexOf('|'+fromChar+'|')!=-1  )&& CodePress.autocomplete) { // auto complete
+                       if(!CodePress.completeEnding(fromChar))
+                            CodePress.complete(fromChar);
+               }
+           else if(chars.indexOf('|'+charCode+'|')!=-1||charCode==13) { // syntax highlighting
+                       CodePress.syntaxHighlight('generic');
+               }
+       },
+
+       metaHandler : function(evt) {
+               keyCode = evt.keyCode;
+               
+               if(keyCode==9 || evt.tabKey) { 
+                       CodePress.snippets();
+               }
+               else if((keyCode==122||keyCode==121||keyCode==90) && evt.ctrlKey) { // undo and redo
+                       (keyCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
+                       evt.returnValue = false;
+               }
+               else if(keyCode==34||keyCode==33) { // handle page up/down for IE
+                       self.scrollBy(0, (keyCode==34) ? 200 : -200); 
+                       evt.returnValue = false;
+               }
+               else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
+                       CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
+               }
+               else if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && keyCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
+                       CodePress.shortcuts(keyCode);
+                       evt.returnValue = false;
+               }
+               else if(keyCode==86 && evt.ctrlKey)  { // handle paste
+                       window.clipboardData.setData('Text',window.clipboardData.getData('Text').replace(/\t/g,'\u2008'));
+                       top.setTimeout(function(){CodePress.syntaxHighlight('paste');},10);
+               }
+               else if(keyCode==67 && evt.ctrlKey)  { // handle cut
+                       // window.clipboardData.setData('Text',x[0]);
+                       // code = window.clipboardData.getData('Text');
+               }
+       },
+
+       // put cursor back to its original position after every parsing
+       
+       
+       findString : function() {
+               range = self.document.body.createTextRange();
+               if(range.findText(cc)){
+                       range.select();
+                       range.text = '';
+               }
+       },
+       
+       // split big files, highlighting parts of it
+       split : function(code,flag) {
+               if(flag=='scroll') {
+                       this.scrolling = true;
+                       return code;
+               }
+               else {
+                       this.scrolling = false;
+                       mid = code.indexOf(cc);
+                       if(mid-2000<0) {ini=0;end=4000;}
+                       else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
+                       else {ini=mid-2000;end=mid+2000;}
+                       code = code.substring(ini,end);
+                       return code.substring(code.indexOf('<P>'),code.lastIndexOf('</P>')+4);
+               }
+       },
+       
+       // syntax highlighting parser
+       syntaxHighlight : function(flag) {
+               if(flag!='init') document.selection.createRange().text = cc;
+               o = editor.innerHTML;
+               if(flag=='paste') { // fix pasted text
+                       o = o.replace(/<BR>/g,'\r\n'); 
+                       o = o.replace(/\u2008/g,'\t');
+               }
+               o = o.replace(/<P>/g,'\n');
+               o = o.replace(/<\/P>/g,'\r');
+               o = o.replace(/<.*?>/g,'');
+               o = o.replace(/&nbsp;/g,'');                    
+               o = '<PRE><P>'+o+'</P></PRE>';
+               o = o.replace(/\n\r/g,'<P></P>');
+               o = o.replace(/\n/g,'<P>');
+               o = o.replace(/\r/g,'<\/P>');
+               o = o.replace(/<P>(<P>)+/,'<P>');
+               o = o.replace(/<\/P>(<\/P>)+/,'</P>');
+               o = o.replace(/<P><\/P>/g,'<P><BR/></P>');
+               x = z = this.split(o,flag);
+
+               if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
+       
+               for(i=0;i<Language.syntax.length;i++) 
+                       x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
+                       
+               editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.replace(z,x);
+               if(flag!='init') this.findString();
+       },
+
+       snippets : function(evt) {
+               var snippets = Language.snippets;
+               var trigger = this.getLastWord();
+               for (var i=0; i<snippets.length; i++) {
+                       if(snippets[i].input == trigger) {
+                               var content = snippets[i].output.replace(/</g,'&lt;');
+                               content = content.replace(/>/g,'&gt;');
+                               if(content.indexOf('$0')<0) content += cc;
+                               else content = content.replace(/\$0/,cc);
+                               content = content.replace(/\n/g,'</P><P>');
+                               var pattern = new RegExp(trigger+cc,"gi");
+                               this.syntaxHighlight('snippets',pattern,content);
+                       }
+               }
+       },
+       
+       readOnly : function() {
+               editor.contentEditable = (arguments[0]) ? 'false' : 'true';
+       },
+       
+       complete : function(trigger) {
+               var complete = Language.complete;
+               for (var i=0; i<complete.length; i++) {
+                       if(complete[i].input == trigger) {
+                               var pattern = new RegExp('\\'+trigger+cc);
+                               var content = complete[i].output.replace(/\$0/g,cc);
+                               setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
+                       }
+               }
+       },
+       
+       getCompleteChars : function() {
+               var cChars = '';
+               for(var i=0;i<Language.complete.length;i++)
+                       cChars += '|'+Language.complete[i].input;
+               return cChars+'|';
+       },
+
+       getCompleteEndingChars : function() {
+               var cChars = '';
+               for(var i=0;i<Language.complete.length;i++)
+                       cChars += '|'+Language.complete[i].output.charAt(Language.complete[i].output.length-1);
+               return cChars+'|';
+       },
+
+       completeEnding : function(trigger) {
+               var range = document.selection.createRange();
+               try {
+                       range.moveEnd('character', 1)
+               }
+               catch(e) {
+                       return false;
+               }
+               var next_character = range.text
+               range.moveEnd('character', -1)
+               if(next_character != trigger )  return false;
+               else {
+                       range.moveEnd('character', 1)
+                       range.text=''
+                       return true;
+               }
+       },      
+
+       shortcuts : function() {
+               var cCode = arguments[0];
+               if(cCode==13) cCode = '[enter]';
+               else if(cCode==32) cCode = '[space]';
+               else cCode = '['+String.fromCharCode(keyCode).toLowerCase()+']';
+               for(var i=0;i<Language.shortcuts.length;i++)
+                       if(Language.shortcuts[i].input == cCode)
+                               this.insertCode(Language.shortcuts[i].output,false);
+       },
+       
+       getLastWord : function() {
+               var rangeAndCaret = CodePress.getRangeAndCaret();
+               words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
+               words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
+               return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
+       }, 
+
+       getRangeAndCaret : function() { 
+               var range = document.selection.createRange();
+               var caret = Math.abs(range.moveStart('character', -1000000)+1);
+               range = this.getCode();
+               range = range.replace(/\n\r/gi,'  ');
+               range = range.replace(/\n/gi,'');
+               return [range.toString(),caret];
+       },
+       
+       insertCode : function(code,replaceCursorBefore) {
+               var repdeb = '';
+               var repfin = '';
+               
+               if(replaceCursorBefore) { repfin = code; }
+               else { repdeb = code; }
+               
+               if(typeof document.selection != 'undefined') {
+                       var range = document.selection.createRange();
+                       range.text = repdeb + repfin;
+                       range = document.selection.createRange();
+                       range.move('character', -repfin.length);
+                       range.select(); 
+               }       
+       },
+
+       // get code from editor 
+       getCode : function() {
+               var code = editor.innerHTML;
+               code = code.replace(/<br>/g,'\n');
+               code = code.replace(/<\/p>/gi,'\r');
+               code = code.replace(/<p>/i,''); // IE first line fix
+               code = code.replace(/<p>/gi,'\n');
+               code = code.replace(/&nbsp;/gi,'');
+               code = code.replace(/\u2009/g,'');
+               code = code.replace(/<.*?>/g,'');
+               code = code.replace(/&lt;/g,'<');
+               code = code.replace(/&gt;/g,'>');
+               code = code.replace(/&amp;/gi,'&');
+               return code;
+       },
+
+       // put code inside editor
+       setCode : function() {
+               var code = arguments[0];
+               code = code.replace(/\u2009/gi,'');
+               code = code.replace(/&/gi,'&amp;');             
+               code = code.replace(/</g,'&lt;');
+        code = code.replace(/>/g,'&gt;');
+               editor.innerHTML = '<pre>'+code+'</pre>';
+       },
+
+       
+       // undo and redo methods
+       actions : {
+               pos : -1, // actual history position
+               history : [], // history vector
+               
+               undo : function() {
+                       if(editor.innerHTML.indexOf(cc)==-1){
+                               document.selection.createRange().text = cc;
+                               this.history[this.pos] = editor.innerHTML;
+                       }
+                       this.pos--;
+                       if(typeof(this.history[this.pos])=='undefined') this.pos++;
+                       editor.innerHTML = this.history[this.pos];
+                       CodePress.findString();
+               },
+               
+               redo : function() {
+                       this.pos++;
+                       if(typeof(this.history[this.pos])=='undefined') this.pos--;
+                       editor.innerHTML = this.history[this.pos];
+                       CodePress.findString();
+               },
+               
+               next : function() { // get next vector position and clean old ones
+                       if(this.pos>20) this.history[this.pos-21] = undefined;
+                       return ++this.pos;
+               }
+       }
+}
+
+Language={};
+window.attachEvent('onload', function() { CodePress.initialize('new');});
\ No newline at end of file
diff --git a/wp-includes/js/codepress/engines/older.js b/wp-includes/js/codepress/engines/older.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/wp-includes/js/codepress/engines/opera.js b/wp-includes/js/codepress/engines/opera.js
new file mode 100644 (file)
index 0000000..155bf09
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ * CodePress - Real Time Syntax Highlighting Editor written in JavaScript - http://codepress.org/
+ * 
+ * Copyright (C) 2007 Fernando M.A.d.S. <fermads@gmail.com>
+ *
+ * Contributors :
+ *
+ *     Michael Hurni <michael.hurni@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the 
+ * GNU Lesser General Public License as published by the Free Software Foundation.
+ * 
+ * Read the full licence: http://www.opensource.org/licenses/lgpl-license.php
+ */
+
+
+CodePress = {
+       scrolling : false,
+       autocomplete : true,
+
+       // set initial vars and start sh
+       initialize : function() {
+               if(typeof(editor)=='undefined' && !arguments[0]) return;
+               chars = '|32|46|62|'; // charcodes that trigger syntax highlighting
+               cc = '\u2009'; // control char
+               editor = document.getElementsByTagName('body')[0];
+               document.designMode = 'on';
+               document.addEventListener('keyup', this.keyHandler, true);
+               window.addEventListener('scroll', function() { if(!CodePress.scrolling) CodePress.syntaxHighlight('scroll') }, false);
+               completeChars = this.getCompleteChars();
+//             CodePress.syntaxHighlight('init');
+       },
+
+       // treat key bindings
+       keyHandler : function(evt) {
+       keyCode = evt.keyCode;  
+               charCode = evt.charCode;
+
+               if((evt.ctrlKey || evt.metaKey) && evt.shiftKey && charCode!=90)  { // shortcuts = ctrl||appleKey+shift+key!=z(undo) 
+                       CodePress.shortcuts(charCode?charCode:keyCode);
+               }
+               else if(completeChars.indexOf('|'+String.fromCharCode(charCode)+'|')!=-1 && CodePress.autocomplete) { // auto complete
+                       CodePress.complete(String.fromCharCode(charCode));
+               }
+           else if(chars.indexOf('|'+charCode+'|')!=-1||keyCode==13) { // syntax highlighting
+                       CodePress.syntaxHighlight('generic');
+               }
+               else if(keyCode==9 || evt.tabKey) {  // snippets activation (tab)
+                       CodePress.snippets(evt);
+               }
+               else if(keyCode==46||keyCode==8) { // save to history when delete or backspace pressed
+                       CodePress.actions.history[CodePress.actions.next()] = editor.innerHTML;
+               }
+               else if((charCode==122||charCode==121||charCode==90) && evt.ctrlKey) { // undo and redo
+                       (charCode==121||evt.shiftKey) ? CodePress.actions.redo() :  CodePress.actions.undo(); 
+                       evt.preventDefault();
+               }
+               else if(keyCode==86 && evt.ctrlKey)  { // paste
+                       // TODO: pasted text should be parsed and highlighted
+               }
+       },
+
+       // put cursor back to its original position after every parsing
+       findString : function() {
+               var sel = window.getSelection();
+               var range = window.document.createRange();
+               var span = window.document.getElementsByTagName('span')[0];
+                       
+               range.selectNode(span);
+               sel.removeAllRanges();
+               sel.addRange(range);
+               span.parentNode.removeChild(span);
+               //if(self.find(cc))
+               //window.getSelection().getRangeAt(0).deleteContents();
+       },
+       
+       // split big files, highlighting parts of it
+       split : function(code,flag) {
+               if(flag=='scroll') {
+                       this.scrolling = true;
+                       return code;
+               }
+               else {
+                       this.scrolling = false;
+                       mid = code.indexOf('<SPAN>');
+                       if(mid-2000<0) {ini=0;end=4000;}
+                       else if(mid+2000>code.length) {ini=code.length-4000;end=code.length;}
+                       else {ini=mid-2000;end=mid+2000;}
+                       code = code.substring(ini,end);
+                       return code;
+               }
+       },
+       
+       // syntax highlighting parser
+       syntaxHighlight : function(flag) {
+               //if(document.designMode=='off') document.designMode='on'
+               if(flag!='init') {
+                       var span = document.createElement('span');
+                       window.getSelection().getRangeAt(0).insertNode(span);
+               }
+
+               o = editor.innerHTML;
+//             o = o.replace(/<br>/g,'\r\n');
+//             o = o.replace(/<(b|i|s|u|a|em|tt|ins|big|cite|strong)?>/g,'');
+               //alert(o)
+               o = o.replace(/<(?!span|\/span|br).*?>/gi,'');
+//             alert(o)
+//             x = o;
+               x = z = this.split(o,flag);
+               //alert(z)
+//             x = x.replace(/\r\n/g,'<br>');
+               x = x.replace(/\t/g, '        ');
+
+
+               if(arguments[1]&&arguments[2]) x = x.replace(arguments[1],arguments[2]);
+       
+               for(i=0;i<Language.syntax.length;i++) 
+                       x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
+
+               editor.innerHTML = this.actions.history[this.actions.next()] = (flag=='scroll') ? x : o.split(z).join(x); 
+
+               if(flag!='init') this.findString();
+       },
+       
+       getLastWord : function() {
+               var rangeAndCaret = CodePress.getRangeAndCaret();
+               words = rangeAndCaret[0].substring(rangeAndCaret[1]-40,rangeAndCaret[1]);
+               words = words.replace(/[\s\n\r\);\W]/g,'\n').split('\n');
+               return words[words.length-1].replace(/[\W]/gi,'').toLowerCase();
+       }, 
+       
+       snippets : function(evt) {
+               var snippets = Language.snippets;       
+               var trigger = this.getLastWord();
+               for (var i=0; i<snippets.length; i++) {
+                       if(snippets[i].input == trigger) {
+                               var content = snippets[i].output.replace(/</g,'&lt;');
+                               content = content.replace(/>/g,'&gt;');
+                               if(content.indexOf('$0')<0) content += cc;
+                               else content = content.replace(/\$0/,cc);
+                               content = content.replace(/\n/g,'<br>');
+                               var pattern = new RegExp(trigger+cc,'gi');
+                               evt.preventDefault(); // prevent the tab key from being added
+                               this.syntaxHighlight('snippets',pattern,content);
+                       }
+               }
+       },
+       
+       readOnly : function() {
+               document.designMode = (arguments[0]) ? 'off' : 'on';
+       },
+
+       complete : function(trigger) {
+               window.getSelection().getRangeAt(0).deleteContents();
+               var complete = Language.complete;
+               for (var i=0; i<complete.length; i++) {
+                       if(complete[i].input == trigger) {
+                               var pattern = new RegExp('\\'+trigger+cc);
+                               var content = complete[i].output.replace(/\$0/g,cc);
+                               parent.setTimeout(function () { CodePress.syntaxHighlight('complete',pattern,content)},0); // wait for char to appear on screen
+                       }
+               }
+       },
+
+       getCompleteChars : function() {
+               var cChars = '';
+               for(var i=0;i<Language.complete.length;i++)
+                       cChars += '|'+Language.complete[i].input;
+               return cChars+'|';
+       },
+
+       shortcuts : function() {
+               var cCode = arguments[0];
+               if(cCode==13) cCode = '[enter]';
+               else if(cCode==32) cCode = '[space]';
+               else cCode = '['+String.fromCharCode(charCode).toLowerCase()+']';
+               for(var i=0;i<Language.shortcuts.length;i++)
+                       if(Language.shortcuts[i].input == cCode)
+                               this.insertCode(Language.shortcuts[i].output,false);
+       },
+       
+       getRangeAndCaret : function() { 
+               var range = window.getSelection().getRangeAt(0);
+               var range2 = range.cloneRange();
+               var node = range.endContainer;                  
+               var caret = range.endOffset;
+               range2.selectNode(node);        
+               return [range2.toString(),caret];
+       },
+       
+       insertCode : function(code,replaceCursorBefore) {
+               var range = window.getSelection().getRangeAt(0);
+               var node = window.document.createTextNode(code);
+               var selct = window.getSelection();
+               var range2 = range.cloneRange();
+               // Insert text at cursor position
+               selct.removeAllRanges();
+               range.deleteContents();
+               range.insertNode(node);
+               // Move the cursor to the end of text
+               range2.selectNode(node);                
+               range2.collapse(replaceCursorBefore);
+               selct.removeAllRanges();
+               selct.addRange(range2);
+       },
+       
+       // get code from editor
+       getCode : function() {
+               var code = editor.innerHTML;
+               code = code.replace(/<br>/g,'\n');
+               code = code.replace(/\u2009/g,'');
+               code = code.replace(/<.*?>/g,'');
+               code = code.replace(/&lt;/g,'<');
+               code = code.replace(/&gt;/g,'>');
+               code = code.replace(/&amp;/gi,'&');
+               return code;
+       },
+
+       // put code inside editor
+       setCode : function() {
+               var code = arguments[0];
+               code = code.replace(/\u2009/gi,'');
+               code = code.replace(/&/gi,'&amp;');
+               code = code.replace(/</g,'&lt;');
+        code = code.replace(/>/g,'&gt;');
+               editor.innerHTML = code;
+       },
+
+       // undo and redo methods
+       actions : {
+               pos : -1, // actual history position
+               history : [], // history vector
+               
+               undo : function() {
+                       if(editor.innerHTML.indexOf(cc)==-1){
+                               window.getSelection().getRangeAt(0).insertNode(document.createTextNode(cc));
+                               this.history[this.pos] = editor.innerHTML;
+                       }
+                       this.pos--;
+                       if(typeof(this.history[this.pos])=='undefined') this.pos++;
+                       editor.innerHTML = this.history[this.pos];
+                       CodePress.findString();
+               },
+               
+               redo : function() {
+                       this.pos++;
+                       if(typeof(this.history[this.pos])=='undefined') this.pos--;
+                       editor.innerHTML = this.history[this.pos];
+                       CodePress.findString();
+               },
+               
+               next : function() { // get next vector position and clean old ones
+                       if(this.pos>20) this.history[this.pos-21] = undefined;
+                       return ++this.pos;
+               }
+       }
+}
+
+Language={};
+window.addEventListener('load', function() { CodePress.initialize('new'); }, true);
diff --git a/wp-includes/js/codepress/images/line-numbers.png b/wp-includes/js/codepress/images/line-numbers.png
new file mode 100644 (file)
index 0000000..ffea4e6
Binary files /dev/null and b/wp-includes/js/codepress/images/line-numbers.png differ
diff --git a/wp-includes/js/codepress/languages/asp.css b/wp-includes/js/codepress/languages/asp.css
new file mode 100644 (file)
index 0000000..9a4c505
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * CodePress color styles for ASP-VB syntax highlighting
+ * By Martin D. Kirk
+ */
+/* tags */
+
+b {
+       color:#000080;
+} 
+/* comments */
+big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {
+       color:gray;
+       font-weight:normal;
+}
+/* ASP comments */
+strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{
+       color:gray;
+       font-weight:normal;
+}
+ /* attributes */ 
+s, s b, span s u, span s cite, strong span s {
+       color:#5656fa ;
+       font-weight:normal;
+}
+ /* strings */ 
+strong s,strong s b, strong s u, strong s cite {
+       color:#009900;
+       font-weight:normal;
+}
+strong ins{
+       color:#000000;
+       font-weight:bold;
+}
+ /* Syntax */
+strong a, strong a u {
+       color:#0000FF;
+       font-weight:;
+}
+ /* Native Keywords */
+strong u {
+       color:#990099;
+       font-weight:bold;
+}
+/* Numbers */
+strong var{
+       color:#FF0000;
+}
+/* ASP Language */
+span{
+       color:#990000;
+       font-weight:bold;
+}
+strong i,strong a i, strong u i {
+       color:#009999;
+}
+/* style */
+em {
+       color:#800080;
+       font-style:normal;
+}
+ /* script */ 
+ins {
+       color:#800000;
+       font-weight:bold;
+}
+
+/* <?php and ?> */
+cite, s cite {
+       color:red;
+       font-weight:bold;
+}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/asp.js b/wp-includes/js/codepress/languages/asp.js
new file mode 100644 (file)
index 0000000..21e78dd
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * CodePress regular expressions for ASP-vbscript syntax highlighting
+ */
+
+// ASP VBScript
+Language.syntax = [
+// all tags
+       { input : /(&lt;[^!%|!%@]*?&gt;)/g, output : '<b>$1</b>' }, 
+// style tags  
+       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, 
+// script tags 
+       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, 
+// strings "" and attributes
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, 
+// ASP Comment
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, 
+// <%.*
+       { input : /(&lt;%)/g, output : '<strong>$1' }, 
+// .*%>        
+       { input : /(%&gt;)/g, output : '$1</strong>' }, 
+// <%@...%>    
+       { input : /(&lt;%@)(.+?)(%&gt;)/gi, output : '$1<span>$2</span>$3' }, 
+//Numbers      
+       { input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, 
+// Reserved Words 1 (Blue)
+       { input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, 
+       { input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, 
+       { input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, 
+// Reserved Words 2 (Purple)   
+       { input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' },
+       { input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, 
+// Reserved Words 3 (Turquis)
+       { input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' },
+// html comments
+       { input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } 
+]
+
+Language.Functions = [ 
+       // Output at index 0, must be the desired tagname surrounding a $1
+       // Name is the index from the regex that marks the functionname
+       {input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'}
+]
+
+Language.snippets = [
+//Conditional
+       { input : 'if', output : 'If $0 Then\n\t\nEnd If' },
+       { input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' },
+       { input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'},
+//Response
+       { input : 'rw', output : 'Response.Write( $0 )' },
+       { input : 'resc', output : 'Response.Cookies( $0 )' },
+       { input : 'resb', output : 'Response.Buffer'},
+       { input : 'resflu', output : 'Response.Flush()'},
+       { input : 'resend', output : 'Response.End'},
+//Request
+       { input : 'reqc', output : 'Request.Cookies( $0 )' },
+       { input : 'rq', output : 'Request.Querystring("$0")' },
+       { input : 'rf', output : 'Request.Form("$0")' },
+//FSO
+       { input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' },
+       { input : 'setfo', output : 'Set fo = fso.getFolder($0)' },
+       { input : 'setfi', output : 'Set fi = fso.getFile($0)' },
+       { input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'},
+       { input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'},
+//Server
+       { input : 'mapp', output : 'Server.Mappath($0)' },
+//Loops
+       { input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' },
+       { input : 'for', output : 'For $0 to ? step ?\n\t\nNext' },
+       { input : 'do', output : 'Do While($0)\n\t\nLoop' },
+       { input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' },
+//ADO
+       { input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' },
+       { input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' },
+       { input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' },
+//Http Request
+       { input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' },
+       { input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'},
+//Functions
+       { input : 'func', output : 'Function $0()\n\t\n\nEnd Function'},
+       { input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'}
+
+]
+
+Language.complete = [
+       //{ input : '\'', output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = [
+       { input : '[space]', output : '&nbsp;' },
+       { input : '[enter]', output : '<br />' } ,
+       { input : '[j]', output : 'testing' },
+       { input : '[7]', output : '&amp;' }
+]
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/autoit.css b/wp-includes/js/codepress/languages/autoit.css
new file mode 100644 (file)
index 0000000..eb2b43b
--- /dev/null
@@ -0,0 +1,13 @@
+/**
+ * CodePress color styles for AutoIt syntax highlighting
+ */
+
+u {font-style:normal;color:#000090;font-weight:bold;font-family:Monospace;}
+var {color:#AA0000;font-weight:bold;font-style:normal;}
+em {color:#FF33FF;}
+ins {color:#AC00A9;}
+i {color:#F000FF;}
+b {color:#FF0000;}
+a {color:#0080FF;font-weight:bold;}
+s, s u, s b {color:#9999CC;font-weight:normal;}
+cite, cite *{color:#009933;font-weight:normal;}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/autoit.js b/wp-includes/js/codepress/languages/autoit.js
new file mode 100644 (file)
index 0000000..6f5c19d
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * CodePress regular expressions for AutoIt syntax highlighting
+ * @author: James Brooks, Michael HURNI
+ */ 
+// AutoIt 
+Language.syntax = [  
+    { input : /({|}|\(|\))/g, output : '<b>$1</b>' }, // Brackets
+       { input : /(\*|\+|-)/g, output : '<b>$1</b>' }, // Operator
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : "<s>\"$1$2</s>" }, // strings double 
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single  
+       { input : /\b([\d]+)\b/g, output : '<ins>$1</ins>' }, // Numbers 
+       { input : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' }, // Directives and Includes 
+       { input : /(\$[\w\.]*)/g, output : '<var>$1</var>' }, // vars
+       { input : /(_[\w\.]*)/g, output : '<a>$1</a>' }, // underscored word
+       { input : /(\@[\w\.]*)/g, output : '<em>$1</em>' }, // Macros
+       { input : /\b(Abs|ACos|AdlibDisable|AdlibEnable|Asc|AscW|ASin|Assign|ATan|AutoItSetOption|AutoItWinGetTitle|AutoItWinSetTitle|Beep|Binary|BinaryLen|BinaryMid|BinaryToString|BitAND|BitNOT|BitOR|BitSHIFT|BitXOR|BlockInput|Break|Call|CDTray|Ceiling|Chr|ChrW|ClipGet|ClipPut|ConsoleRead|ConsoleWrite|ConsoleWriteError|ControlClick|ControlCommand|ControlDisable|ControlEnable|ControlFocus|ControlGetFocus|ControlGetHandle|ControlGetPos|ControlGetText|ControlHide|ControlListView|ControlMove|ControlSend|ControlSetText|ControlShow|Cos|Dec|DirCopy|DirCreate|DirGetSize|DirMove|DirRemove|DllCall|DllCall|DllClose|DllOpen|DllStructCreate|DllStructGetData|DllStructGetPtr|DllStructGetSize|DllStructSetData|DriveGetDrive|DriveGetFileSystem|DriveGetLabel|DriveGetSerial|DriveGetType|DriveMapAdd|DriveMapDel|DriveMapGet|DriveSetLabel|DriveSpaceFree|DriveSpaceTotal|DriveStatus|EnvGet|EnvSet|EnvUpdate|Eval|Execute|Exp|FileChangeDir|FileClose|FileCopy|FileCreateNTFS|FileCreateShortcut|FileDelete|FileExists|FileFindFirstFile|FileFindNextFile|FileGetAttrib|FileGetLongName|FileGetShortcut|FileGetShortName|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileOpen|FileOpenDialog|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileSaveDialog|FileSelectFolder|FileSetAttrib|FileSetTime|FileWrite|FileWriteLine|Floor|FtpSetProxy|GuiCreate|GuiCtrlCreateAvi|GuiCtrlCreateButton|GuiCtrlCreateCheckbox|GuiCtrlCreateCombo|GuiCtrlCreateContextMenu|GuiCtrlCreateDate|GuiCtrlCreateDummy|GuiCtrlCreateEdit|GuiCtrlCreateGraphic|GuiCtrlCreateGroup|GuiCtrlCreateIcon|GuiCtrlCreateInput|GuiCtrlCreateLabel|GuiCtrlCreateList|GuiCtrlCreateListView|GuiCtrlCreateListViewItem|GuiCtrlCreateMenu|GuiCtrlCreateMenuItem|GuiCtrlCreateMonthCal|GuiCtrlCreateObj|GuiCtrlCreatePic|GuiCtrlCreateProgress|GuiCtrlCreateRadio|GuiCtrlCreateSlider|GuiCtrlCreateTab|GuiCtrlCreateTabItem|GuiCtrlCreateUpdown|GuiCtrlDelete|GuiCtrlGetHandle|GuiCtrlGetState|GuiCtrlRead|GuiCtrlRecvMsg|GuiCtrlSentMsg|GuiCtrlSendToDummy|GuiCtrlSetBkColor|GuiCtrlSetColor|GuiCtrlSetCursor|GuiCtrlSetData|GuiCtrlSetFont|GuiCtrlSetGraphic|GuiCtrlSetImage|GuiCtrlSetLimit|GuiCtrlSetOnEvent|GuiCtrlSetPos|GuiCtrlResizing|GuiCtrlSetState|GuiCtrlSetTip|GuiDelete|GuiGetCursorInfo|GuiGetMsg|GuiGetStyle|GuiRegisterMsg|GuiSetBkColor|GuiSetCoord|GuiSetCursor|GuiSetFont|GuiSetHelp|GuiSetIcon|GuiSetOnEvent|GuiSetStat|GuiSetStyle|GuiStartGroup|GuiSwitch|Hex|HotKeySet|HttpSetProxy|HWnd|InetGet|InetGetSize|IniDelete|IniRead|IniReadSection|IniReadSectionNames|IniRenameSection|IniWrite|IniWriteSection|InputBox|Int|IsAdmin|IsArray|IsBinary|IsBool|IsDeclared|IsDllStruct|IsFloat|IsHWnd|IsInt|IsKeyword|IsNumber|IsObj|IsString|Log|MemGetStats|Mod|MouseClick|MouseClickDrag|MouseDown|MouseGetCursor|MouseGetPos|MouseMove|MouseUp|MouseWheel|MsgBox|Number|ObjCreate|ObjEvent|ObjGet|ObjName|Ping|PixelCheckSum|PixelGetColor|PixelSearch|ProcessClose|ProcessExists|ProcessList|ProcessSetPriority|ProcessWait|ProcessWaitClose|ProgressOff|ProcessOn|ProgressSet|Random|RegDelete|RegEnumKey|RegEnumVal|RegRead|RegWrite|Round|Run|RunAsSet|RunWait|Send|SetError|SetExtended|ShellExecute|ShellExecuteWait|Shutdown|Sin|Sleep|SoundPlay|SoundSetWaveVolume|SplashImageOn|SplashOff|SplashTextOn|Sqrt|SRandom|StatusbarGetText|StderrRead|StdinWrite|StdoutRead|String|StringAddCR|StringCompare|StringFormat|StringInStr|StringIsAlNum|StringIsAlpha|StringIsASCII|StringIsDigit|StringIsFloat|StringIsInt|StringIsLower|StringIsSpace|StringIsUpper|StringIsXDigit|StringLeft|StringLen|StringLower|StringMid|StringRegExp|StringRegExpReplace|StringReplace|StringRight|StringSplit|StringStripCR|StringStripWS|StringToBinary|StringTrimLeft|StringTrimRight|StringUpper|Tan|TCPAccept|TCPCloseSocket|TCPConnect|TCPListen|TCPNameToIP|TCPrecv|TCPSend|TCPShutdown|TCPStartup|TimerDiff|TimerInit|ToolTip|TrayCreateItem|TrayCreateMenu|TrayGetMenu|TrayGetMsg|TrayItemDelete|TrayItemGetHandle|TrayItemGetState|TrayItemGetText|TrayItemSetOnEvent|TrayItemSetState|TrayItemSetText|TraySetClick|TraySetIcon|TraySetOnEvent|TraySetPauseIcon|TraySetState|TraySetToolTip|TrayTip|UBound|UDPBind|UDPCloseSocket|UDPOpen|UDPRecv|UDPSend|WinActivate|WinActive|WinClose|WinExists|WinFlash|WinGetCaretPos|WinGetClassList|WinGetClientSize|WinGetHandle|WinGetPos|WinGetProcess|WinGetState|WinGetText|WinGetTitle|WinKill|WinList|WinMenuSelectItem|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinSetOnTop|WinSetState|WinSetTitle|WinSetTrans|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/g, output : '<u>$1</u>' } ,// reserved words
+       { input : /\B;(.*?)(<br>|<\/P>)/g, output : '<cite>;$1</cite>$2' }, // comments 
+       { input : /#CS(.*?)#CE/g, output : '<cite>#CS$1#CE</cite>' } // Block Comments
+] 
+Language.snippets = [] 
+Language.complete = [ 
+{ input : '\'',output : '\'$0\'' }, 
+{ input : '"', output : '"$0"' }, 
+{ input : '(', output : '\($0\)' }, 
+{ input : '[', output : '\[$0\]' }, 
+{ input : '{', output : '{\n\t$0\n}' } 
+] 
+Language.shortcuts = [] 
diff --git a/wp-includes/js/codepress/languages/csharp.css b/wp-includes/js/codepress/languages/csharp.css
new file mode 100644 (file)
index 0000000..8464c5d
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * CodePress color styles for Java syntax highlighting
+ * By Edwin de Jonge
+ */
+
+b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */
+a {color:#2A0088;font-weight:bold;font-style:normal;} /* types */
+i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */
+s, s b {color:#2A00FF;font-weight:normal;} /* strings */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/csharp.js b/wp-includes/js/codepress/languages/csharp.js
new file mode 100644 (file)
index 0000000..0a61fd5
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * CodePress regular expressions for C# syntax highlighting
+ * By Edwin de Jonge
+ */
+Language.syntax = [ // C#
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+       { input : /\'(.?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote 
+       { input : /\b(abstract|as|base|break|case|catch|checked|continue|default|delegate|do|else|event|explicit|extern|false|finally|fixed|for|foreach|get|goto|if|implicit|in|interface|internal|is|lock|namespace|new|null|object|operator|out|override|params|partial|private|protected|public|readonly|ref|return|set|sealed|sizeof|static|stackalloc|switch|this|throw|true|try|typeof|unchecked|unsafe|using|value|virtual|while)\b/g, output : '<b>$1</b>' }, // reserved words
+       { input : /\b(bool|byte|char|class|double|float|int|interface|long|string|struct|void)\b/g, output : '<a>$1</a>' }, // types
+       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //  
+       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
+];
+
+Language.snippets = [];
+
+Language.complete = [ // Auto complete only for 1 character
+       {input : '\'',output : '\'$0\'' },
+       {input : '"', output : '"$0"' },
+       {input : '(', output : '\($0\)' },
+       {input : '[', output : '\[$0\]' },
+       {input : '{', output : '{\n\t$0\n}' }           
+];
+
+Language.shortcuts = [];
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/css.css b/wp-includes/js/codepress/languages/css.css
new file mode 100644 (file)
index 0000000..49ba584
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * CodePress color styles for CSS syntax highlighting
+ */
+
+b, b a, b u {color:#000080;} /* tags, ids, classes */
+i, i b, i s, i a, i u {color:gray;} /* comments */
+s, s b {color:#a0a0dd;} /* parameters */
+a {color:#0000ff;} /* keys */
+u {color:red;} /* values */
+
diff --git a/wp-includes/js/codepress/languages/css.js b/wp-includes/js/codepress/languages/css.js
new file mode 100644 (file)
index 0000000..c29059b
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * CodePress regular expressions for CSS syntax highlighting
+ */
+
+// CSS
+Language.syntax = [
+       { input : /(.*?){(.*?)}/g,output : '<b>$1</b>{<u>$2</u>}' }, // tags, ids, classes, values
+       { input : /([\w-]*?):([^\/])/g,output : '<a>$1</a>:$2' }, // keys
+       { input : /\((.*?)\)/g,output : '(<s>$1</s>)' }, // parameters
+       { input : /\/\*(.*?)\*\//g,output : '<i>/*$1*/</i>'} // comments
+]
+
+Language.snippets = []
+
+Language.complete = [
+       { input : '\'',output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/generic.css b/wp-includes/js/codepress/languages/generic.css
new file mode 100644 (file)
index 0000000..712942f
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * CodePress color styles for generic syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+u {color:darkblue;font-weight:bold;} /* special words */
+i, i b, i s, i u, i em {color:green;font-weight:normal;} /* comments */
+s, s b, s em {color:#2A00FF;font-weight:normal;} /* strings */
+em {font-weight:bold;} /* special chars */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/generic.js b/wp-includes/js/codepress/languages/generic.js
new file mode 100644 (file)
index 0000000..4c866de
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * CodePress regular expressions for generic syntax highlighting
+ */
+// generic languages
+Language.syntax = [
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+       { input : /\b(abstract|continue|for|new|switch|default|goto|boolean|do|if|private|this|break|double|protected|throw|byte|else|import|public|throws|case|return|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|const|float|while|function|label)\b/g, output : '<b>$1</b>' }, // reserved words
+       { input : /([\(\){}])/g, output : '<em>$1</em>' }, // special chars;
+       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
+       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
+]
+
+Language.snippets = []
+
+Language.complete = [
+       { input : '\'', output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/html.css b/wp-includes/js/codepress/languages/html.css
new file mode 100644 (file)
index 0000000..14882e5
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * CodePress color styles for HTML syntax highlighting
+ */
+
+b {color:#000080;} /* tags */
+ins, ins b, ins s, ins em {color:gray;} /* comments */
+s, s b {color:#7777e4;} /* attribute values */
+a {color:green;} /* links */
+u {color:#E67300;} /* forms */
+big {color:#db0000;} /* images */
+em, em b {color:#800080;} /* style */
+strong {color:#800000;} /* script */
+tt i {color:darkblue;font-weight:bold;} /* script reserved words */
diff --git a/wp-includes/js/codepress/languages/html.js b/wp-includes/js/codepress/languages/html.js
new file mode 100644 (file)
index 0000000..4ead0b0
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * CodePress regular expressions for HTML syntax highlighting
+ */
+
+// HTML
+Language.syntax = [
+       { input : /(&lt;[^!]*?&gt;)/g, output : '<b>$1</b>'     }, // all tags
+       { input : /(&lt;a .*?&gt;|&lt;\/a&gt;)/g, output : '<a>$1</a>' }, // links
+       { input : /(&lt;img .*?&gt;)/g, output : '<big>$1</big>' }, // images
+       { input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g, output : '<u>$1</u>' }, // forms
+       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags
+       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' }, // script tags
+       { input : /=(".*?")/g, output : '=<s>$1</s>' }, // atributes double quote
+       { input : /=('.*?')/g, output : '=<s>$1</s>' }, // atributes single quote
+       { input : /(&lt;!--.*?--&gt.)/g, output : '<ins>$1</ins>' }, // comments 
+       { input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<i>$1</i>' } // script reserved words 
+]
+
+Language.snippets = [
+       { input : 'aref', output : '<a href="$0"></a>' },
+       { input : 'h1', output : '<h1>$0</h1>' },
+       { input : 'h2', output : '<h2>$0</h2>' },
+       { input : 'h3', output : '<h3>$0</h3>' },
+       { input : 'h4', output : '<h4>$0</h4>' },
+       { input : 'h5', output : '<h5>$0</h5>' },
+       { input : 'h6', output : '<h6>$0</h6>' },
+       { input : 'html', output : '<html>\n\t$0\n</html>' },
+       { input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' },
+       { input : 'img', output : '<img src="$0" alt="" />' },
+       { input : 'input', output : '<input name="$0" id="" type="" value="" />' },
+       { input : 'label', output : '<label for="$0"></label>' },
+       { input : 'legend', output : '<legend>\n\t$0\n</legend>' },
+       { input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },              
+       { input : 'base', output : '<base href="$0" />' }, 
+       { input : 'body', output : '<body>\n\t$0\n</body>' }, 
+       { input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
+       { input : 'div', output : '<div>\n\t$0\n</div>' },
+       { input : 'divid', output : '<div id="$0">\n\t\n</div>' },
+       { input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },
+       { input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },
+       { input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },
+       { input : 'meta', output : '<meta name="$0" content="" />' },
+       { input : 'p', output : '<p>$0</p>' },
+       { input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },
+       { input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },
+       { input : 'span', output : '<span>$0</span>' },
+       { input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },
+       { input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' }
+]
+       
+Language.complete = [
+       { input : '\'',output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/java.css b/wp-includes/js/codepress/languages/java.css
new file mode 100644 (file)
index 0000000..b9c4441
--- /dev/null
@@ -0,0 +1,7 @@
+/*
+ * CodePress color styles for Java syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;font-style:normal;} /* reserved words */
+i, i b, i s {color:#3F7F5F;font-weight:bold;} /* comments */
+s, s b {color:#2A00FF;font-weight:normal;} /* strings */
diff --git a/wp-includes/js/codepress/languages/java.js b/wp-includes/js/codepress/languages/java.js
new file mode 100644 (file)
index 0000000..f0d620d
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * CodePress regular expressions for Java syntax highlighting
+ */
+// Java
+Language.syntax = [
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>'}, // strings double quote
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote
+       { input : /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g, output : '<b>$1</b>'}, // reserved words
+       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3'}, // comments //   
+       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }// comments /* */
+]
+
+Language.snippets = []
+
+Language.complete = [
+       { input : '\'',output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/javascript.css b/wp-includes/js/codepress/languages/javascript.css
new file mode 100644 (file)
index 0000000..acbf49a
--- /dev/null
@@ -0,0 +1,8 @@
+/*
+ * CodePress color styles for JavaScript syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+u {color:darkblue;font-weight:bold;} /* special words */
+i, i b, i s, i u {color:green;font-weight:normal;} /* comments */
+s, s b, s u {color:#2A00FF;font-weight:normal;} /* strings */
diff --git a/wp-includes/js/codepress/languages/javascript.js b/wp-includes/js/codepress/languages/javascript.js
new file mode 100644 (file)
index 0000000..66d0fc0
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * CodePress regular expressions for JavaScript syntax highlighting
+ */
+// JavaScript
+Language.syntax = [ 
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+       { input : /\b(break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<b>$1</b>' }, // reserved words
+       { input : /\b(alert|isNaN|parent|Array|parseFloat|parseInt|blur|clearTimeout|prompt|prototype|close|confirm|length|Date|location|Math|document|element|name|self|elements|setTimeout|navigator|status|String|escape|Number|submit|eval|Object|event|onblur|focus|onerror|onfocus|onclick|top|onload|toString|onunload|unescape|open|valueOf|window|onmouseover)\b/g, output : '<u>$1</u>' }, // special words
+       { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
+       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
+]
+
+Language.snippets = [
+       { input : 'dw', output : 'document.write(\'$0\');' },
+       { input : 'getid', output : 'document.getElementById(\'$0\')' },
+       { input : 'fun', output : 'function $0(){\n\t\n}' },
+       { input : 'func', output : 'function $0(){\n\t\n}' }
+]
+
+Language.complete = [
+       { input : '\'',output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/perl.css b/wp-includes/js/codepress/languages/perl.css
new file mode 100644 (file)
index 0000000..c2d6d56
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+ * CodePress color styles for Perl syntax highlighting
+ * By J. Nick Koston
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */
+s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */
+a {color:#006700;font-weight:bold;} /* variables */
+em {color:darkblue;font-weight:bold;} /* functions */
+u {font-weight:bold;} /* special chars */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/perl.js b/wp-includes/js/codepress/languages/perl.js
new file mode 100644 (file)
index 0000000..06c380d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * CodePress regular expressions for Perl syntax highlighting
+ * By J. Nick Koston
+ */
+
+// Perl
+Language.syntax = [ 
+       { input  : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+       { input  : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+       { input  : /([\$\@\%][\w\.]*)/g, output : '<a>$1</a>' }, // vars
+       { input  : /(sub\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
+       { input  : /\b(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|else|elsif|endgrent|endhostent|endnetent|endprotoent|endpwent|eof|eval|exec|exists|exit|fcntl|fileno|find|flock|for|foreach|fork|format|formlinegetc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyaddr|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|hostname|if|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|LoadExternals|local|localtime|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ordpack|package|pipe|pop|pos|print|printf|push|pwd|qq|quotemeta|qw|rand|read|readdir|readlink|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|stty|study|sub|substr|symlink|syscall|sysopen|sysread|system|syswritetell|telldir|tie|tied|time|times|tr|truncate|uc|ucfirst|umask|undef|unless|unlink|until|unpack|unshift|untie|use|utime|values|vec|waitpid|wantarray|warn|while|write)\b/g, output : '<b>$1</b>' }, // reserved words
+       { input  : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars
+       { input  : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments
+]
+
+Language.snippets = []
+
+Language.complete = [
+       { input : '\'',output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/php.css b/wp-includes/js/codepress/languages/php.css
new file mode 100644 (file)
index 0000000..23fca5c
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * CodePress color styles for PHP syntax highlighting
+ */
+
+b {color:#000080;} /* tags */
+big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {color:gray;font-weight:normal;} /* comments */
+s, s b, strong s u, strong s cite {color:#5656fa;font-weight:normal;} /* attributes and strings */
+strong a, strong a u {color:#006700;font-weight:bold;} /* variables */
+em {color:#800080;font-style:normal;} /* style */
+ins {color:#800000;} /* script */
+strong u {color:#7F0055;font-weight:bold;} /* reserved words */
+cite, s cite {color:red;font-weight:bold;} /* <?php and ?> */
diff --git a/wp-includes/js/codepress/languages/php.js b/wp-includes/js/codepress/languages/php.js
new file mode 100644 (file)
index 0000000..1689fba
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * CodePress regular expressions for PHP syntax highlighting
+ */
+
+// PHP
+Language.syntax = [
+       { input : /(&lt;[^!\?]*?&gt;)/g, output : '<b>$1</b>' }, // all tags
+       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, // style tags
+       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, // script tags
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>'}, // strings single quote
+       { input : /(&lt;\?)/g, output : '<strong>$1' }, // <?.*
+       { input : /(\?&gt;)/g, output : '$1</strong>' }, // .*?>
+       { input : /(&lt;\?php|&lt;\?=|&lt;\?|\?&gt;)/g, output : '<cite>$1</cite>' }, // php tags
+       { input : /(\$[\w\.]*)/g, output : '<a>$1</a>' }, // vars
+       { input : /\b(false|true|and|or|xor|__FILE__|exception|__LINE__|array|as|break|case|class|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|for|foreach|function|global|if|include|include_once|isset|list|new|print|require|require_once|return|static|switch|unset|use|while|__FUNCTION__|__CLASS__|__METHOD__|final|php_user_filter|interface|implements|extends|public|private|protected|abstract|clone|try|catch|throw|this)\b/g, output : '<u>$1</u>' }, // reserved words
+       { input : /([^:])\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // php comments //
+       { input : /([^:])#(.*?)(<br|<\/P)/g, output : '$1<i>#$2</i>$3' }, // php comments #
+       { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' }, // php comments /* */
+       { input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } // html comments
+]
+
+Language.snippets = [
+       { input : 'if', output : 'if($0){\n\t\n}' },
+       { input : 'ifelse', output : 'if($0){\n\t\n}\nelse{\n\t\n}' },
+       { input : 'else', output : '}\nelse {\n\t' },
+       { input : 'elseif', output : '}\nelseif($0) {\n\t' },
+       { input : 'do', output : 'do{\n\t$0\n}\nwhile();' },
+       { input : 'inc', output : 'include_once("$0");' },
+       { input : 'fun', output : 'function $0(){\n\t\n}' },    
+       { input : 'func', output : 'function $0(){\n\t\n}' },   
+       { input : 'while', output : 'while($0){\n\t\n}' },
+       { input : 'for', output : 'for($0,,){\n\t\n}' },
+       { input : 'fore', output : 'foreach($0 as ){\n\t\n}' },
+       { input : 'foreach', output : 'foreach($0 as ){\n\t\n}' },
+       { input : 'echo', output : 'echo \'$0\';' },
+       { input : 'switch', output : 'switch($0) {\n\tcase "": break;\n\tdefault: ;\n}' },
+       { input : 'case', output : 'case "$0" : break;' },
+       { input : 'ret0', output : 'return false;' },
+       { input : 'retf', output : 'return false;' },
+       { input : 'ret1', output : 'return true;' },
+       { input : 'rett', output : 'return true;' },
+       { input : 'ret', output : 'return $0;' },
+       { input : 'def', output : 'define(\'$0\',\'\');' },
+       { input : '<?', output : 'php\n$0\n?>' }
+]
+
+Language.complete = [
+       { input : '\'', output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = [
+       { input : '[space]', output : '&nbsp;' },
+       { input : '[enter]', output : '<br />' } ,
+       { input : '[j]', output : 'testing' },
+       { input : '[7]', output : '&amp;' }
+]
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/ruby.css b/wp-includes/js/codepress/languages/ruby.css
new file mode 100644 (file)
index 0000000..edb9028
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * CodePress color styles for Ruby syntax highlighting
+ */
+
+b {color:#7F0055;font-weight:bold;} /* reserved words */
+i, i b, i s, i em, i a, i u {color:gray;font-weight:normal;} /* comments */
+s, s b, s a, s em, s u {color:#2A00FF;font-weight:normal;} /* strings */
+a {color:#006700;font-weight:bold;} /* variables */
+em {color:darkblue;font-weight:bold;} /* functions */
+u {font-weight:bold;} /* special chars */
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/ruby.js b/wp-includes/js/codepress/languages/ruby.js
new file mode 100644 (file)
index 0000000..207f23b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * CodePress regular expressions for Perl syntax highlighting
+ */
+
+// Ruby
+Language.syntax = [
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote 
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
+       { input : /([\$\@\%]+)([\w\.]*)/g, output : '<a>$1$2</a>' }, // vars
+       { input : /(def\s+)([\w\.]*)/g, output : '$1<em>$2</em>' }, // functions
+       { input : /\b(alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b/g, output : '<b>$1</b>' }, // reserved words
+       { input  : /([\(\){}])/g, output : '<u>$1</u>' }, // special chars
+       { input  : /#(.*?)(<br>|<\/P>)/g, output : '<i>#$1</i>$2' } // comments
+];
+
+Language.snippets = []
+
+Language.complete = [
+       { input : '\'',output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/sql.css b/wp-includes/js/codepress/languages/sql.css
new file mode 100644 (file)
index 0000000..92c4b96
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * CodePress color styles for SQL syntax highlighting
+ * By Merlin Moncure
+ */
+b {color:#0000FF;font-style:normal;font-weight:bold;} /* reserved words */
+u {color:#FF0000;font-style:normal;} /* types */
+a {color:#CD6600;font-style:normal;font-weight:bold;} /* commands */
+i, i b, i u, i a, i s  {color:#A9A9A9;font-weight:normal;font-style:italic;} /* comments */
+s, s b, s u, s a, s i {color:#2A00FF;font-weight:normal;} /* strings */
diff --git a/wp-includes/js/codepress/languages/sql.js b/wp-includes/js/codepress/languages/sql.js
new file mode 100644 (file)
index 0000000..1d4a21f
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * CodePress regular expressions for SQL syntax highlighting
+ * By Merlin Moncure
+ */
+// SQL
+Language.syntax = [
+       { input : /\'(.*?)(\')/g, output : '<s>\'$1$2</s>' }, // strings single quote
+       { input : /\b(add|after|aggregate|alias|all|and|as|authorization|between|by|cascade|cache|cache|called|case|check|column|comment|constraint|createdb|createuser|cycle|database|default|deferrable|deferred|diagnostics|distinct|domain|each|else|elseif|elsif|encrypted|except|exception|for|foreign|from|from|full|function|get|group|having|if|immediate|immutable|in|increment|initially|increment|index|inherits|inner|input|intersect|into|invoker|is|join|key|language|left|like|limit|local|loop|match|maxvalue|minvalue|natural|nextval|no|nocreatedb|nocreateuser|not|null|of|offset|oids|on|only|operator|or|order|outer|owner|partial|password|perform|plpgsql|primary|record|references|replace|restrict|return|returns|right|row|rule|schema|security|sequence|session|sql|stable|statistics|table|temp|temporary|then|time|to|transaction|trigger|type|unencrypted|union|unique|user|using|valid|value|values|view|volatile|when|where|with|without|zone)\b/gi, output : '<b>$1</b>' }, // reserved words
+       { input : /\b(bigint|bigserial|bit|boolean|box|bytea|char|character|cidr|circle|date|decimal|double|float4|float8|inet|int2|int4|int8|integer|interval|line|lseg|macaddr|money|numeric|oid|path|point|polygon|precision|real|refcursor|serial|serial4|serial8|smallint|text|timestamp|varbit|varchar)\b/gi, output : '<u>$1</u>' }, // types
+       { input : /\b(abort|alter|analyze|begin|checkpoint|close|cluster|comment|commit|copy|create|deallocate|declare|delete|drop|end|execute|explain|fetch|grant|insert|listen|load|lock|move|notify|prepare|reindex|reset|restart|revoke|rollback|select|set|show|start|truncate|unlisten|update)\b/gi, output : '<a>$1</a>' }, // commands
+       { input : /([^:]|^)\-\-(.*?)(<br|<\/P)/g, output: '$1<i>--$2</i>$3' } // comments //    
+]
+
+Language.snippets = [
+       { input : 'select', output : 'select $0 from  where ' }
+]
+
+Language.complete = [
+       { input : '\'', output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = []
+
+
+
diff --git a/wp-includes/js/codepress/languages/text.css b/wp-includes/js/codepress/languages/text.css
new file mode 100644 (file)
index 0000000..474fe60
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+ * CodePress color styles for Text syntax highlighting
+ */
+
+/* do nothing as expected */
diff --git a/wp-includes/js/codepress/languages/text.js b/wp-includes/js/codepress/languages/text.js
new file mode 100644 (file)
index 0000000..6534aaf
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * CodePress regular expressions for Text syntax highlighting
+ */
+
+// plain text
+Language.syntax = []
+Language.snippets = []
+Language.complete = []
+Language.shortcuts = []
diff --git a/wp-includes/js/codepress/languages/vbscript.css b/wp-includes/js/codepress/languages/vbscript.css
new file mode 100644 (file)
index 0000000..e1465e9
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * CodePress color styles for ASP-VB syntax highlighting 
+ * By Martin D. Kirk
+ */
+
+/* tags */
+b {
+       color:#000080;
+} 
+/* comments */
+big, big b, big em, big ins, big s, strong i, strong i b, strong i s, strong i u, strong i a, strong i a u, strong i s u {
+       color:gray;
+       font-weight:normal;
+}
+/* ASP comments */
+strong dfn, strong dfn a,strong dfn var, strong dfn a u, strong dfn u{
+       color:gray;
+       font-weight:normal;
+}
+ /* attributes */ 
+s, s b, span s u, span s cite, strong span s {
+       color:#5656fa ;
+       font-weight:normal;
+}
+ /* strings */ 
+strong s,strong s b, strong s u, strong s cite {
+       color:#009900;
+       font-weight:normal;
+}
+strong ins{
+       color:#000000;
+       font-weight:bold;
+}
+ /* Syntax */
+strong a, strong a u {
+       color:#0000FF;
+       font-weight:;
+}
+ /* Native Keywords */
+strong u {
+       color:#990099;
+       font-weight:bold;
+}
+/* Numbers */
+strong var{
+       color:#FF0000;
+}
+/* ASP Language */
+span{
+       color:#990000;
+       font-weight:bold;
+}
+strong i,strong a i, strong u i {
+       color:#009999;
+}
+/* style */
+em {
+       color:#800080;
+       font-style:normal;
+}
+ /* script */ 
+ins {
+       color:#800000;
+       font-weight:bold;
+}
+
+/* <?php and ?> */
+cite, s cite {
+       color:red;
+       font-weight:bold;
+}
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/vbscript.js b/wp-includes/js/codepress/languages/vbscript.js
new file mode 100644 (file)
index 0000000..21e78dd
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * CodePress regular expressions for ASP-vbscript syntax highlighting
+ */
+
+// ASP VBScript
+Language.syntax = [
+// all tags
+       { input : /(&lt;[^!%|!%@]*?&gt;)/g, output : '<b>$1</b>' }, 
+// style tags  
+       { input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g, output : '<em>$1</em><em>$2</em><em>$3</em>' }, 
+// script tags 
+       { input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g, output : '<ins>$1</ins><ins>$2</ins><ins>$3</ins>' }, 
+// strings "" and attributes
+       { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, 
+// ASP Comment
+       { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<dfn>\'$1$2</dfn>'}, 
+// <%.*
+       { input : /(&lt;%)/g, output : '<strong>$1' }, 
+// .*%>        
+       { input : /(%&gt;)/g, output : '$1</strong>' }, 
+// <%@...%>    
+       { input : /(&lt;%@)(.+?)(%&gt;)/gi, output : '$1<span>$2</span>$3' }, 
+//Numbers      
+       { input : /\b([\d]+)\b/g, output : '<var>$1</var>' }, 
+// Reserved Words 1 (Blue)
+       { input : /\b(And|As|ByRef|ByVal|Call|Case|Class|Const|Dim|Do|Each|Else|ElseIf|Empty|End|Eqv|Exit|False|For|Function)\b/gi, output : '<a>$1</a>' }, 
+       { input : /\b(Get|GoTo|If|Imp|In|Is|Let|Loop|Me|Mod|Enum|New|Next|Not|Nothing|Null|On|Option|Or|Private|Public|ReDim|Rem)\b/gi, output : '<a>$1</a>' }, 
+       { input : /\b(Resume|Select|Set|Stop|Sub|Then|To|True|Until|Wend|While|With|Xor|Execute|Randomize|Erase|ExecuteGlobal|Explicit|step)\b/gi, output : '<a>$1</a>' }, 
+// Reserved Words 2 (Purple)   
+       { input : /\b(Abandon|Abs|AbsolutePage|AbsolutePosition|ActiveCommand|ActiveConnection|ActualSize|AddHeader|AddNew|AppendChunk)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(AppendToLog|Application|Array|Asc|Atn|Attributes|BeginTrans|BinaryRead|BinaryWrite|BOF|Bookmark|Boolean|Buffer|Byte)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(CacheControl|CacheSize|Cancel|CancelBatch|CancelUpdate|CBool|CByte|CCur|CDate|CDbl|Charset|Chr|CInt|Clear)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(ClientCertificate|CLng|Clone|Close|CodePage|CommandText|CommandType|CommandTimeout|CommitTrans|CompareBookmarks|ConnectionString|ConnectionTimeout)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Contents|ContentType|Cookies|Cos|CreateObject|CreateParameter|CSng|CStr|CursorLocation|CursorType|DataMember|DataSource|Date|DateAdd|DateDiff)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(DatePart|DateSerial|DateValue|Day|DefaultDatabase|DefinedSize|Delete|Description|Double|EditMode|Eof|EOF|err|Error)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Exp|Expires|ExpiresAbsolute|Filter|Find|Fix|Flush|Form|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(GetChunk|GetLastError|GetRows|GetString|Global|HelpContext|HelpFile|Hex|Hour|HTMLEncode|IgnoreCase|Index|InStr|InStrRev)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Int|Integer|IsArray|IsClientConnected|IsDate|IsolationLevel|Join|LBound|LCase|LCID|Left|Len|Lock|LockType|Log|Long|LTrim)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(MapPath|MarshalOptions|MaxRecords|Mid|Minute|Mode|Month|MonthName|Move|MoveFirst|MoveLast|MoveNext|MovePrevious|Name|NextRecordset)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Now|Number|NumericScale|ObjectContext|Oct|Open|OpenSchema|OriginalValue|PageCount|PageSize|Pattern|PICS|Precision|Prepared|Property)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Provider|QueryString|RecordCount|Redirect|RegExp|Remove|RemoveAll|Replace|Requery|Request|Response|Resync|Right|Rnd)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(RollbackTrans|RTrim|Save|ScriptTimeout|Second|Seek|Server|ServerVariables|Session|SessionID|SetAbort|SetComplete|Sgn)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(Sin|Size|Sort|Source|Space|Split|Sqr|State|StaticObjects|Status|StayInSync|StrComp|String|StrReverse|Supports|Tan|Time)\b/gi, output : '<u>$1</u>' },
+       { input : /\b(Timeout|Timer|TimeSerial|TimeValue|TotalBytes|Transfer|Trim|Type|Type|UBound|UCase|UnderlyingValue|UnLock|Update|UpdateBatch)\b/gi, output : '<u>$1</u>' }, 
+       { input : /\b(URLEncode|Value|Value|Version|Weekday|WeekdayName|Write|Year)\b/gi, output : '<u>$1</u>' }, 
+// Reserved Words 3 (Turquis)
+       { input : /\b(vbBlack|vbRed|vbGreen|vbYellow|vbBlue|vbMagenta|vbCyan|vbWhite|vbBinaryCompare|vbTextCompare)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbSunday|vbMonday|vbTuesday|vbWednesday|vbThursday|vbFriday|vbSaturday|vbUseSystemDayOfWeek)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbFirstJan1|vbFirstFourDays|vbFirstFullWeek|vbGeneralDate|vbLongDate|vbShortDate|vbLongTime|vbShortTime)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbObjectError|vbCr|VbCrLf|vbFormFeed|vbLf|vbNewLine|vbNullChar|vbNullString|vbTab|vbVerticalTab|vbUseDefault|vbTrue)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbFalse|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant)\b/gi, output : '<i>$1</i>' }, 
+       { input : /\b(vbDataObject|vbDecimal|vbByte|vbArray)\b/gi, output : '<i>$1</i>' },
+// html comments
+       { input : /(&lt;!--.*?--&gt.)/g, output : '<big>$1</big>' } 
+]
+
+Language.Functions = [ 
+       // Output at index 0, must be the desired tagname surrounding a $1
+       // Name is the index from the regex that marks the functionname
+       {input : /(function|sub)([ ]*?)(\w+)([ ]*?\()/gi , output : '<ins>$1</ins>', name : '$3'}
+]
+
+Language.snippets = [
+//Conditional
+       { input : 'if', output : 'If $0 Then\n\t\nEnd If' },
+       { input : 'ifelse', output : 'If $0 Then\n\t\n\nElse\n\t\nEnd If' },
+       { input : 'case', output : 'Select Case $0\n\tCase ?\n\tCase Else\nEnd Select'},
+//Response
+       { input : 'rw', output : 'Response.Write( $0 )' },
+       { input : 'resc', output : 'Response.Cookies( $0 )' },
+       { input : 'resb', output : 'Response.Buffer'},
+       { input : 'resflu', output : 'Response.Flush()'},
+       { input : 'resend', output : 'Response.End'},
+//Request
+       { input : 'reqc', output : 'Request.Cookies( $0 )' },
+       { input : 'rq', output : 'Request.Querystring("$0")' },
+       { input : 'rf', output : 'Request.Form("$0")' },
+//FSO
+       { input : 'fso', output : 'Set fso = Server.CreateObject("Scripting.FileSystemObject")\n$0' },
+       { input : 'setfo', output : 'Set fo = fso.getFolder($0)' },
+       { input : 'setfi', output : 'Set fi = fso.getFile($0)' },
+       { input : 'twr', output : 'Set f = fso.CreateTextFile($0,true)\'overwrite\nf.WriteLine()\nf.Close'},
+       { input : 'tre', output : 'Set f = fso.OpenTextFile($0, 1)\nf.ReadAll\nf.Close'},
+//Server
+       { input : 'mapp', output : 'Server.Mappath($0)' },
+//Loops
+       { input : 'foreach', output : 'For Each $0 in ?\n\t\nNext' },
+       { input : 'for', output : 'For $0 to ? step ?\n\t\nNext' },
+       { input : 'do', output : 'Do While($0)\n\t\nLoop' },
+       { input : 'untilrs', output : 'do until rs.eof\n\t\nrs.movenext\nloop' },
+//ADO
+       { input : 'adorec', output : 'Set rs = Server.CreateObject("ADODB.Recordset")' },
+       { input : 'adocon', output : 'Set Conn = Server.CreateObject("ADODB.Connection")' },
+       { input : 'adostr', output : 'Set oStr = Server.CreateObject("ADODB.Stream")' },
+//Http Request
+       { input : 'xmlhttp', output : 'Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")\nxmlHttp.open("GET", $0, false)\nxmlHttp.send()\n?=xmlHttp.responseText' },
+       { input : 'xmldoc', output : 'Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")\nxmldoc.async=false\nxmldoc.load(request)'},
+//Functions
+       { input : 'func', output : 'Function $0()\n\t\n\nEnd Function'},
+       { input : 'sub', output : 'Sub $0()\n\t\nEnd Sub'}
+
+]
+
+Language.complete = [
+       //{ input : '\'', output : '\'$0\'' },
+       { input : '"', output : '"$0"' },
+       { input : '(', output : '\($0\)' },
+       { input : '[', output : '\[$0\]' },
+       { input : '{', output : '{\n\t$0\n}' }          
+]
+
+Language.shortcuts = [
+       { input : '[space]', output : '&nbsp;' },
+       { input : '[enter]', output : '<br />' } ,
+       { input : '[j]', output : 'testing' },
+       { input : '[7]', output : '&amp;' }
+]
\ No newline at end of file
diff --git a/wp-includes/js/codepress/languages/xsl.css b/wp-includes/js/codepress/languages/xsl.css
new file mode 100644 (file)
index 0000000..385eaab
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * CodePress color styles for HTML syntax highlighting
+ * By RJ Bruneel
+ */
+b {color:#000080;} /* tags */
+ins, ins b, ins s, ins em {color:gray;} /* comments */
+s, s b {color:#7777e4;} /* attribute values */
+a {color:#E67300;} /* links */
+u {color:#CC66CC;} /* forms */
+big {color:#db0000;} /* images */
+em, em b {color:#800080;} /* style */
+strong {color:#800000;} /* script */
+tt i {color:darkblue;font-weight:bold;} /* script reserved words */
+xsl {color:green;} /* xsl */
diff --git a/wp-includes/js/codepress/languages/xsl.js b/wp-includes/js/codepress/languages/xsl.js
new file mode 100644 (file)
index 0000000..e93932a
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * CodePress regular expressions for XSL syntax highlighting
+ * By RJ Bruneel
+ */
+
+Language.syntax = [ // XSL
+       {
+       input : /(&lt;[^!]*?&gt;)/g,
+       output : '<b>$1</b>' // all tags
+       },{
+       input : /(&lt;a.*?&gt;|&lt;\/a&gt;)/g,
+       output : '<a>$1</a>' // links
+       },{
+       input : /(&lt;img .*?&gt;)/g,
+       output : '<big>$1</big>' // images
+       },{
+       input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g,
+       output : '<u>$1</u>' // forms
+       },{
+       input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g,
+       output : '<em>$1</em><em>$2</em><em>$3</em>' // style tags
+       },{
+       input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g,
+       output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' // script tags
+       },{     
+       input : /(&lt;xsl.*?&gt;|&lt;\/xsl.*?&gt;)/g,
+       output : '<xsl>$1</xsl>' // xsl
+       },{
+       input : /=(".*?")/g,
+       output : '=<s>$1</s>' // atributes double quote
+       },{
+       input : /=('.*?')/g,
+       output : '=<s>$1</s>' // atributes single quote
+       },{
+       input : /(&lt;!--.*?--&gt.)/g,
+       output : '<ins>$1</ins>' // comments 
+       },{
+       input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g,
+       output : '<i>$1</i>' // script reserved words
+       }
+];
+
+Language.snippets = [
+       {input : 'aref', output : '<a href="$0"></a>' },
+       {input : 'h1', output : '<h1>$0</h1>' },
+       {input : 'h2', output : '<h2>$0</h2>' },
+       {input : 'h3', output : '<h3>$0</h3>' },
+       {input : 'h4', output : '<h4>$0</h4>' },
+       {input : 'h5', output : '<h5>$0</h5>' },
+       {input : 'h6', output : '<h6>$0</h6>' },
+       {input : 'html', output : '<html>\n\t$0\n</html>' },
+       {input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' },
+       {input : 'img', output : '<img src="$0" width="" height="" alt="" border="0" />' },
+       {input : 'input', output : '<input name="$0" id="" type="" value="" />' },
+       {input : 'label', output : '<label for="$0"></label>' },
+       {input : 'legend', output : '<legend>\n\t$0\n</legend>' },
+       {input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },               
+       {input : 'base', output : '<base href="$0" />' }, 
+       {input : 'body', output : '<body>\n\t$0\n</body>' }, 
+       {input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
+       {input : 'div', output : '<div>\n\t$0\n</div>' },
+       {input : 'divid', output : '<div id="$0">\n\t\n</div>' },
+       {input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },
+       {input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },
+       {input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },
+       {input : 'meta', output : '<meta name="$0" content="" />' },
+       {input : 'p', output : '<p>$0</p>' },
+       {input : 'b', output : '<b>$0</b>' },
+       {input : 'li', output : '<li>$0</li>' },
+       {input : 'ul', output : '<ul>$0</ul>' },
+       {input : 'ol', output : '<ol>$0</ol>' },
+       {input : 'strong', output : '<strong>$0</strong>' },
+       {input : 'br', output : '<br />' },
+       {input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },
+       {input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },
+       {input : 'span', output : '<span>$0</span>' },
+       {input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },
+       {input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' },
+       {input : 'xsl:stylesheet', output : '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' },
+       {input : 'xsl:template', output : '<xsl:template>$0</xsl:template>' },
+       {input : 'xsl:for-each', output : '<xsl:for-each select="$0"></xsl:for-each>' },
+       {input : 'xsl:choose', output : '<xsl:choose>$0<\xsl:choose>' },
+       {input : 'xsl:param', output : '<xsl:param name="$0" />' },
+       {input : 'xsl:variable', output : '<xsl:variable name="$0"></xsl:variable>' },
+       {input : 'xsl:if', output : '<xsl:if test="$0"></xsl:if>' },
+       {input : 'xsl:when', output : '<xsl:when test="$0"></xsl:when>' },
+       {input : 'xsl:otherwise', output : '<xsl:otherwise>$0</xsl:otherwise>' },
+       {input : 'xsl:attribute', output : '<xsl:attribute name="$0"></xsl:attribute>' },
+       {input : 'xsl:value-of', output : '<xsl:value-of select="$0"/>' },
+       {input : 'xsl:with-param', output : '<xsl:with-param name="$0" select="" />' },
+       {input : 'xsl:call-template', output : '<xsl:call-template name="$0">' }
+
+];
+       
+Language.complete = [ // Auto complete only for 1 character
+       {input : '\'',output : '\'$0\'' },
+       {input : '"', output : '"$0"' },
+       {input : '(', output : '\($0\)' },
+       {input : '[', output : '\[$0\]' },
+       {input : '{', output : '{\n\t$0\n}' }           
+];
+
+Language.shortcuts = [];
\ No newline at end of file
diff --git a/wp-includes/js/codepress/license.txt b/wp-includes/js/codepress/license.txt
new file mode 100644 (file)
index 0000000..e80ac68
--- /dev/null
@@ -0,0 +1,458 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE
+                      Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                 GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
diff --git a/wp-includes/js/colorpicker.dev.js b/wp-includes/js/colorpicker.dev.js
new file mode 100644 (file)
index 0000000..1fc32cf
--- /dev/null
@@ -0,0 +1,707 @@
+// ===================================================================
+// Author: Matt Kruse <matt@mattkruse.com>
+// WWW: http://www.mattkruse.com/
+//
+// NOTICE: You may use this code for any purpose, commercial or
+// private, without any further permission from the author. You may
+// remove this notice from your final code if you wish, however it is
+// appreciated by the author if at least my web site address is kept.
+//
+// You may *NOT* re-distribute this code in any way except through its
+// use. That means, you can include it in your product, or your web
+// site, or any other form where the code is actually being used. You
+// may not put the plain javascript up on your site for download or
+// include it in your javascript libraries for download. 
+// If you wish to share this code with others, please just point them
+// to the URL instead.
+// Please DO NOT link directly to my .js files from your site. Copy
+// the files to your server and use them there. Thank you.
+// ===================================================================
+
+
+/* SOURCE FILE: AnchorPosition.js */
+
+/* 
+AnchorPosition.js
+Author: Matt Kruse
+Last modified: 10/11/02
+
+DESCRIPTION: These functions find the position of an <A> tag in a document,
+so other elements can be positioned relative to it.
+
+COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
+positioning errors - usually with Window positioning - occur on the 
+Macintosh platform.
+
+FUNCTIONS:
+getAnchorPosition(anchorname)
+  Returns an Object() having .x and .y properties of the pixel coordinates
+  of the upper-left corner of the anchor. Position is relative to the PAGE.
+
+getAnchorWindowPosition(anchorname)
+  Returns an Object() having .x and .y properties of the pixel coordinates
+  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.
+
+NOTES:
+
+1) For popping up separate browser windows, use getAnchorWindowPosition. 
+   Otherwise, use getAnchorPosition
+
+2) Your anchor tag MUST contain both NAME and ID attributes which are the 
+   same. For example:
+   <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the 
+   anchor tag correctly. Do not do <A></A> with no space.
+*/ 
+
+// getAnchorPosition(anchorname)
+//   This function returns an object having .x and .y properties which are the coordinates
+//   of the named anchor, relative to the page.
+function getAnchorPosition(anchorname) {
+       // This function will return an Object with x and y properties
+       var useWindow=false;
+       var coordinates=new Object();
+       var x=0,y=0;
+       // Browser capability sniffing
+       var use_gebi=false, use_css=false, use_layers=false;
+       if (document.getElementById) { use_gebi=true; }
+       else if (document.all) { use_css=true; }
+       else if (document.layers) { use_layers=true; }
+       // Logic to find position
+       if (use_gebi && document.all) {
+               x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
+               y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
+               }
+       else if (use_gebi) {
+               var o=document.getElementById(anchorname);
+               x=AnchorPosition_getPageOffsetLeft(o);
+               y=AnchorPosition_getPageOffsetTop(o);
+               }
+       else if (use_css) {
+               x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
+               y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
+               }
+       else if (use_layers) {
+               var found=0;
+               for (var i=0; i<document.anchors.length; i++) {
+                       if (document.anchors[i].name==anchorname) { found=1; break; }
+                       }
+               if (found==0) {
+                       coordinates.x=0; coordinates.y=0; return coordinates;
+                       }
+               x=document.anchors[i].x;
+               y=document.anchors[i].y;
+               }
+       else {
+               coordinates.x=0; coordinates.y=0; return coordinates;
+               }
+       coordinates.x=x;
+       coordinates.y=y;
+       return coordinates;
+       }
+
+// getAnchorWindowPosition(anchorname)
+//   This function returns an object having .x and .y properties which are the coordinates
+//   of the named anchor, relative to the window
+function getAnchorWindowPosition(anchorname) {
+       var coordinates=getAnchorPosition(anchorname);
+       var x=0;
+       var y=0;
+       if (document.getElementById) {
+               if (isNaN(window.screenX)) {
+                       x=coordinates.x-document.body.scrollLeft+window.screenLeft;
+                       y=coordinates.y-document.body.scrollTop+window.screenTop;
+                       }
+               else {
+                       x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
+                       y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
+                       }
+               }
+       else if (document.all) {
+               x=coordinates.x-document.body.scrollLeft+window.screenLeft;
+               y=coordinates.y-document.body.scrollTop+window.screenTop;
+               }
+       else if (document.layers) {
+               x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
+               y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
+               }
+       coordinates.x=x;
+       coordinates.y=y;
+       return coordinates;
+       }
+
+// Functions for IE to get position of an object
+function AnchorPosition_getPageOffsetLeft (el) {
+       var ol=el.offsetLeft;
+       while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
+       return ol;
+       }
+function AnchorPosition_getWindowOffsetLeft (el) {
+       return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
+       }
+function AnchorPosition_getPageOffsetTop (el) {
+       var ot=el.offsetTop;
+       while((el=el.offsetParent) != null) { ot += el.offsetTop; }
+       return ot;
+       }
+function AnchorPosition_getWindowOffsetTop (el) {
+       return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
+       }
+
+/* SOURCE FILE: PopupWindow.js */
+
+/* 
+PopupWindow.js
+Author: Matt Kruse
+Last modified: 02/16/04
+
+DESCRIPTION: This object allows you to easily and quickly popup a window
+in a certain place. The window can either be a DIV or a separate browser
+window.
+
+COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
+positioning errors - usually with Window positioning - occur on the 
+Macintosh platform. Due to bugs in Netscape 4.x, populating the popup 
+window with <STYLE> tags may cause errors.
+
+USAGE:
+// Create an object for a WINDOW popup
+var win = new PopupWindow(); 
+
+// Create an object for a DIV window using the DIV named 'mydiv'
+var win = new PopupWindow('mydiv'); 
+
+// Set the window to automatically hide itself when the user clicks 
+// anywhere else on the page except the popup
+win.autoHide(); 
+
+// Show the window relative to the anchor name passed in
+win.showPopup(anchorname);
+
+// Hide the popup
+win.hidePopup();
+
+// Set the size of the popup window (only applies to WINDOW popups
+win.setSize(width,height);
+
+// Populate the contents of the popup window that will be shown. If you 
+// change the contents while it is displayed, you will need to refresh()
+win.populate(string);
+
+// set the URL of the window, rather than populating its contents
+// manually
+win.setUrl("http://www.site.com/");
+
+// Refresh the contents of the popup
+win.refresh();
+
+// Specify how many pixels to the right of the anchor the popup will appear
+win.offsetX = 50;
+
+// Specify how many pixels below the anchor the popup will appear
+win.offsetY = 100;
+
+NOTES:
+1) Requires the functions in AnchorPosition.js
+
+2) Your anchor tag MUST contain both NAME and ID attributes which are the 
+   same. For example:
+   <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the 
+   anchor tag correctly. Do not do <A></A> with no space.
+
+4) When a PopupWindow object is created, a handler for 'onmouseup' is
+   attached to any event handler you may have already defined. Do NOT define
+   an event handler for 'onmouseup' after you define a PopupWindow object or
+   the autoHide() will not work correctly.
+*/ 
+
+// Set the position of the popup window based on the anchor
+function PopupWindow_getXYPosition(anchorname) {
+       var coordinates;
+       if (this.type == "WINDOW") {
+               coordinates = getAnchorWindowPosition(anchorname);
+               }
+       else {
+               coordinates = getAnchorPosition(anchorname);
+               }
+       this.x = coordinates.x;
+       this.y = coordinates.y;
+       }
+// Set width/height of DIV/popup window
+function PopupWindow_setSize(width,height) {
+       this.width = width;
+       this.height = height;
+       }
+// Fill the window with contents
+function PopupWindow_populate(contents) {
+       this.contents = contents;
+       this.populated = false;
+       }
+// Set the URL to go to
+function PopupWindow_setUrl(url) {
+       this.url = url;
+       }
+// Set the window popup properties
+function PopupWindow_setWindowProperties(props) {
+       this.windowProperties = props;
+       }
+// Refresh the displayed contents of the popup
+function PopupWindow_refresh() {
+       if (this.divName != null) {
+               // refresh the DIV object
+               if (this.use_gebi) {
+                       document.getElementById(this.divName).innerHTML = this.contents;
+                       }
+               else if (this.use_css) { 
+                       document.all[this.divName].innerHTML = this.contents;
+                       }
+               else if (this.use_layers) { 
+                       var d = document.layers[this.divName]; 
+                       d.document.open();
+                       d.document.writeln(this.contents);
+                       d.document.close();
+                       }
+               }
+       else {
+               if (this.popupWindow != null && !this.popupWindow.closed) {
+                       if (this.url!="") {
+                               this.popupWindow.location.href=this.url;
+                               }
+                       else {
+                               this.popupWindow.document.open();
+                               this.popupWindow.document.writeln(this.contents);
+                               this.popupWindow.document.close();
+                       }
+                       this.popupWindow.focus();
+                       }
+               }
+       }
+// Position and show the popup, relative to an anchor object
+function PopupWindow_showPopup(anchorname) {
+       this.getXYPosition(anchorname);
+       this.x += this.offsetX;
+       this.y += this.offsetY;
+       if (!this.populated && (this.contents != "")) {
+               this.populated = true;
+               this.refresh();
+               }
+       if (this.divName != null) {
+               // Show the DIV object
+               if (this.use_gebi) {
+                       document.getElementById(this.divName).style.left = this.x + "px";
+                       document.getElementById(this.divName).style.top = this.y;
+                       document.getElementById(this.divName).style.visibility = "visible";
+                       }
+               else if (this.use_css) {
+                       document.all[this.divName].style.left = this.x;
+                       document.all[this.divName].style.top = this.y;
+                       document.all[this.divName].style.visibility = "visible";
+                       }
+               else if (this.use_layers) {
+                       document.layers[this.divName].left = this.x;
+                       document.layers[this.divName].top = this.y;
+                       document.layers[this.divName].visibility = "visible";
+                       }
+               }
+       else {
+               if (this.popupWindow == null || this.popupWindow.closed) {
+                       // If the popup window will go off-screen, move it so it doesn't
+                       if (this.x<0) { this.x=0; }
+                       if (this.y<0) { this.y=0; }
+                       if (screen && screen.availHeight) {
+                               if ((this.y + this.height) > screen.availHeight) {
+                                       this.y = screen.availHeight - this.height;
+                                       }
+                               }
+                       if (screen && screen.availWidth) {
+                               if ((this.x + this.width) > screen.availWidth) {
+                                       this.x = screen.availWidth - this.width;
+                                       }
+                               }
+                       var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
+                       this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
+                       }
+               this.refresh();
+               }
+       }
+// Hide the popup
+function PopupWindow_hidePopup() {
+       if (this.divName != null) {
+               if (this.use_gebi) {
+                       document.getElementById(this.divName).style.visibility = "hidden";
+                       }
+               else if (this.use_css) {
+                       document.all[this.divName].style.visibility = "hidden";
+                       }
+               else if (this.use_layers) {
+                       document.layers[this.divName].visibility = "hidden";
+                       }
+               }
+       else {
+               if (this.popupWindow && !this.popupWindow.closed) {
+                       this.popupWindow.close();
+                       this.popupWindow = null;
+                       }
+               }
+       }
+// Pass an event and return whether or not it was the popup DIV that was clicked
+function PopupWindow_isClicked(e) {
+       if (this.divName != null) {
+               if (this.use_layers) {
+                       var clickX = e.pageX;
+                       var clickY = e.pageY;
+                       var t = document.layers[this.divName];
+                       if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
+                               return true;
+                               }
+                       else { return false; }
+                       }
+               else if (document.all) { // Need to hard-code this to trap IE for error-handling
+                       var t = window.event.srcElement;
+                       while (t.parentElement != null) {
+                               if (t.id==this.divName) {
+                                       return true;
+                                       }
+                               t = t.parentElement;
+                               }
+                       return false;
+                       }
+               else if (this.use_gebi && e) {
+                       var t = e.originalTarget;
+                       while (t.parentNode != null) {
+                               if (t.id==this.divName) {
+                                       return true;
+                                       }
+                               t = t.parentNode;
+                               }
+                       return false;
+                       }
+               return false;
+               }
+       return false;
+       }
+
+// Check an onMouseDown event to see if we should hide
+function PopupWindow_hideIfNotClicked(e) {
+       if (this.autoHideEnabled && !this.isClicked(e)) {
+               this.hidePopup();
+               }
+       }
+// Call this to make the DIV disable automatically when mouse is clicked outside it
+function PopupWindow_autoHide() {
+       this.autoHideEnabled = true;
+       }
+// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
+function PopupWindow_hidePopupWindows(e) {
+       for (var i=0; i<popupWindowObjects.length; i++) {
+               if (popupWindowObjects[i] != null) {
+                       var p = popupWindowObjects[i];
+                       p.hideIfNotClicked(e);
+                       }
+               }
+       }
+// Run this immediately to attach the event listener
+function PopupWindow_attachListener() {
+       if (document.layers) {
+               document.captureEvents(Event.MOUSEUP);
+               }
+       window.popupWindowOldEventListener = document.onmouseup;
+       if (window.popupWindowOldEventListener != null) {
+               document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
+               }
+       else {
+               document.onmouseup = PopupWindow_hidePopupWindows;
+               }
+       }
+// CONSTRUCTOR for the PopupWindow object
+// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
+function PopupWindow() {
+       if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
+       if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
+       if (!window.listenerAttached) {
+               window.listenerAttached = true;
+               PopupWindow_attachListener();
+               }
+       this.index = popupWindowIndex++;
+       popupWindowObjects[this.index] = this;
+       this.divName = null;
+       this.popupWindow = null;
+       this.width=0;
+       this.height=0;
+       this.populated = false;
+       this.visible = false;
+       this.autoHideEnabled = false;
+
+       this.contents = "";
+       this.url="";
+       this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
+       if (arguments.length>0) {
+               this.type="DIV";
+               this.divName = arguments[0];
+               }
+       else {
+               this.type="WINDOW";
+               }
+       this.use_gebi = false;
+       this.use_css = false;
+       this.use_layers = false;
+       if (document.getElementById) { this.use_gebi = true; }
+       else if (document.all) { this.use_css = true; }
+       else if (document.layers) { this.use_layers = true; }
+       else { this.type = "WINDOW"; }
+       this.offsetX = 0;
+       this.offsetY = 0;
+       // Method mappings
+       this.getXYPosition = PopupWindow_getXYPosition;
+       this.populate = PopupWindow_populate;
+       this.setUrl = PopupWindow_setUrl;
+       this.setWindowProperties = PopupWindow_setWindowProperties;
+       this.refresh = PopupWindow_refresh;
+       this.showPopup = PopupWindow_showPopup;
+       this.hidePopup = PopupWindow_hidePopup;
+       this.setSize = PopupWindow_setSize;
+       this.isClicked = PopupWindow_isClicked;
+       this.autoHide = PopupWindow_autoHide;
+       this.hideIfNotClicked = PopupWindow_hideIfNotClicked;
+       }
+
+/* SOURCE FILE: ColorPicker2.js */
+
+/* 
+Last modified: 02/24/2003
+
+DESCRIPTION: This widget is used to select a color, in hexadecimal #RRGGBB 
+form. It uses a color "swatch" to display the standard 216-color web-safe 
+palette. The user can then click on a color to select it.
+
+COMPATABILITY: See notes in AnchorPosition.js and PopupWindow.js.
+Only the latest DHTML-capable browsers will show the color and hex values
+at the bottom as your mouse goes over them.
+
+USAGE:
+// Create a new ColorPicker object using DHTML popup
+var cp = new ColorPicker();
+
+// Create a new ColorPicker object using Window Popup
+var cp = new ColorPicker('window');
+
+// Add a link in your page to trigger the popup. For example:
+<A HREF="#" onClick="cp.show('pick');return false;" NAME="pick" ID="pick">Pick</A>
+
+// Or use the built-in "select" function to do the dirty work for you:
+<A HREF="#" onClick="cp.select(document.forms[0].color,'pick');return false;" NAME="pick" ID="pick">Pick</A>
+
+// If using DHTML popup, write out the required DIV tag near the bottom
+// of your page.
+<SCRIPT LANGUAGE="JavaScript">cp.writeDiv()</SCRIPT>
+
+// Write the 'pickColor' function that will be called when the user clicks
+// a color and do something with the value. This is only required if you
+// want to do something other than simply populate a form field, which is 
+// what the 'select' function will give you.
+function pickColor(color) {
+       field.value = color;
+       }
+
+NOTES:
+1) Requires the functions in AnchorPosition.js and PopupWindow.js
+
+2) Your anchor tag MUST contain both NAME and ID attributes which are the 
+   same. For example:
+   <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the 
+   anchor tag correctly. Do not do <A></A> with no space.
+
+4) When a ColorPicker object is created, a handler for 'onmouseup' is
+   attached to any event handler you may have already defined. Do NOT define
+   an event handler for 'onmouseup' after you define a ColorPicker object or
+   the color picker will not hide itself correctly.
+*/ 
+ColorPicker_targetInput = null;
+function ColorPicker_writeDiv() {
+       document.writeln("<DIV ID=\"colorPickerDiv\" STYLE=\"position:absolute;visibility:hidden;\"> </DIV>");
+       }
+
+function ColorPicker_show(anchorname) {
+       this.showPopup(anchorname);
+       }
+
+function ColorPicker_pickColor(color,obj) {
+       obj.hidePopup();
+       pickColor(color);
+       }
+
+// A Default "pickColor" function to accept the color passed back from popup.
+// User can over-ride this with their own function.
+function pickColor(color) {
+       if (ColorPicker_targetInput==null) {
+               alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!");
+               return;
+               }
+       ColorPicker_targetInput.value = color;
+       }
+
+// This function is the easiest way to popup the window, select a color, and
+// have the value populate a form field, which is what most people want to do.
+function ColorPicker_select(inputobj,linkname) {
+       if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") { 
+               alert("colorpicker.select: Input object passed is not a valid form input object"); 
+               window.ColorPicker_targetInput=null;
+               return;
+               }
+       window.ColorPicker_targetInput = inputobj;
+       this.show(linkname);
+       }
+
+// This function runs when you move your mouse over a color block, if you have a newer browser
+function ColorPicker_highlightColor(c) {
+       var thedoc = (arguments.length>1)?arguments[1]:window.document;
+       var d = thedoc.getElementById("colorPickerSelectedColor");
+       d.style.backgroundColor = c;
+       d = thedoc.getElementById("colorPickerSelectedColorValue");
+       d.innerHTML = c;
+       }
+
+function ColorPicker() {
+       var windowMode = false;
+       // Create a new PopupWindow object
+       if (arguments.length==0) {
+               var divname = "colorPickerDiv";
+               }
+       else if (arguments[0] == "window") {
+               var divname = '';
+               windowMode = true;
+               }
+       else {
+               var divname = arguments[0];
+               }
+
+       if (divname != "") {
+               var cp = new PopupWindow(divname);
+               }
+       else {
+               var cp = new PopupWindow();
+               cp.setSize(225,250);
+               }
+
+       // Object variables
+       cp.currentValue = "#FFFFFF";
+
+       // Method Mappings
+       cp.writeDiv = ColorPicker_writeDiv;
+       cp.highlightColor = ColorPicker_highlightColor;
+       cp.show = ColorPicker_show;
+       cp.select = ColorPicker_select;
+
+       // Code to populate color picker window
+       var colors = new Array( "#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099",
+                                                       "#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099",
+                                                       "#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099",
+                                                       "#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF",
+                                                       "#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F",
+                                                       "#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000",
+
+                                                       "#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399",
+                                                       "#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399",
+                                                       "#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399",
+                                                       "#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF",
+                                                       "#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F",
+                                                       "#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00",
+
+                                                       "#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699",
+                                                       "#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699",
+                                                       "#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699",
+                                                       "#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F",
+                                                       "#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F",
+                                                       "#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F",
+
+                                                       "#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999",
+                                                       "#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999",
+                                                       "#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999",
+                                                       "#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF",
+                                                       "#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F",
+                                                       "#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000",
+
+                                                       "#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99",
+                                                       "#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99",
+                                                       "#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99",
+                                                       "#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF",
+                                                       "#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F",
+                                                       "#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00",
+
+                                                       "#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99",
+                                                       "#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99",
+                                                       "#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99",
+                                                       "#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F",
+                                                       "#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F",
+                                                       "#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F",
+
+                                                       "#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666",
+                                                       "#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000",
+                                                       "#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000",
+                                                       "#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999",
+                                                       "#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF",
+                                                       "#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF",
+
+                                                       "#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66",
+                                                       "#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00",
+                                                       "#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000",
+                                                       "#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099",
+                                                       "#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF",
+                                                       "#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF",
+
+                                                       "#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF",
+                                                       "#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC",
+                                                       "#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000",
+                                                       "#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900",
+                                                       "#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33",
+                                                       "#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF",
+
+                                                       "#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF",
+                                                       "#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF",
+                                                       "#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F",
+                                                       "#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F",
+                                                       "#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F",
+                                                       "#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000");
+       var total = colors.length;
+       var width = 72;
+       var cp_contents = "";
+       var windowRef = (windowMode)?"window.opener.":"";
+       if (windowMode) {
+               cp_contents += "<html><head><title>Select Color</title></head>";
+               cp_contents += "<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>";
+               }
+       cp_contents += "<table style='border: none;' cellspacing=0 cellpadding=0>";
+       var use_highlight = (document.getElementById || document.all)?true:false;
+       for (var i=0; i<total; i++) {
+               if ((i % width) == 0) { cp_contents += "<tr>"; }
+               if (use_highlight) { var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"'; }
+               else { mo = ""; }
+               cp_contents += '<td style="background-color: '+colors[i]+';"><a href="javascript:void()" onclick="'+windowRef+'ColorPicker_pickColor(\''+colors[i]+'\','+windowRef+'window.popupWindowObjects['+cp.index+']);return false;" '+mo+'>&nbsp;</a></td>';
+               if ( ((i+1)>=total) || (((i+1) % width) == 0)) { 
+                       cp_contents += "</tr>";
+                       }
+               }
+       // If the browser supports dynamically changing TD cells, add the fancy stuff
+       if (document.getElementById) {
+               var width1 = Math.floor(width/2);
+               var width2 = width = width1;
+               cp_contents += "<tr><td colspan='"+width1+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'>&nbsp;</td><td colspan='"+width2+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>";
+               }
+       cp_contents += "</table>";
+       if (windowMode) {
+               cp_contents += "</span></body></html>";
+               }
+       // end populate code
+
+       // Write the contents to the popup object
+       cp.populate(cp_contents+"\n");
+       // Move the table down a bit so you can see it
+       cp.offsetY = 25;
+       cp.autoHide();
+       return cp;
+       }
index 1fc32cf243d3687e4ef43fa26523d9d8fcf9280a..acd88a3397649fe013b2db9c75799019c2a86bb5 100644 (file)
@@ -1,707 +1 @@
-// ===================================================================
-// Author: Matt Kruse <matt@mattkruse.com>
-// WWW: http://www.mattkruse.com/
-//
-// NOTICE: You may use this code for any purpose, commercial or
-// private, without any further permission from the author. You may
-// remove this notice from your final code if you wish, however it is
-// appreciated by the author if at least my web site address is kept.
-//
-// You may *NOT* re-distribute this code in any way except through its
-// use. That means, you can include it in your product, or your web
-// site, or any other form where the code is actually being used. You
-// may not put the plain javascript up on your site for download or
-// include it in your javascript libraries for download. 
-// If you wish to share this code with others, please just point them
-// to the URL instead.
-// Please DO NOT link directly to my .js files from your site. Copy
-// the files to your server and use them there. Thank you.
-// ===================================================================
-
-
-/* SOURCE FILE: AnchorPosition.js */
-
-/* 
-AnchorPosition.js
-Author: Matt Kruse
-Last modified: 10/11/02
-
-DESCRIPTION: These functions find the position of an <A> tag in a document,
-so other elements can be positioned relative to it.
-
-COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
-positioning errors - usually with Window positioning - occur on the 
-Macintosh platform.
-
-FUNCTIONS:
-getAnchorPosition(anchorname)
-  Returns an Object() having .x and .y properties of the pixel coordinates
-  of the upper-left corner of the anchor. Position is relative to the PAGE.
-
-getAnchorWindowPosition(anchorname)
-  Returns an Object() having .x and .y properties of the pixel coordinates
-  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.
-
-NOTES:
-
-1) For popping up separate browser windows, use getAnchorWindowPosition. 
-   Otherwise, use getAnchorPosition
-
-2) Your anchor tag MUST contain both NAME and ID attributes which are the 
-   same. For example:
-   <A NAME="test" ID="test"> </A>
-
-3) There must be at least a space between <A> </A> for IE5.5 to see the 
-   anchor tag correctly. Do not do <A></A> with no space.
-*/ 
-
-// getAnchorPosition(anchorname)
-//   This function returns an object having .x and .y properties which are the coordinates
-//   of the named anchor, relative to the page.
-function getAnchorPosition(anchorname) {
-       // This function will return an Object with x and y properties
-       var useWindow=false;
-       var coordinates=new Object();
-       var x=0,y=0;
-       // Browser capability sniffing
-       var use_gebi=false, use_css=false, use_layers=false;
-       if (document.getElementById) { use_gebi=true; }
-       else if (document.all) { use_css=true; }
-       else if (document.layers) { use_layers=true; }
-       // Logic to find position
-       if (use_gebi && document.all) {
-               x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
-               y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
-               }
-       else if (use_gebi) {
-               var o=document.getElementById(anchorname);
-               x=AnchorPosition_getPageOffsetLeft(o);
-               y=AnchorPosition_getPageOffsetTop(o);
-               }
-       else if (use_css) {
-               x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
-               y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
-               }
-       else if (use_layers) {
-               var found=0;
-               for (var i=0; i<document.anchors.length; i++) {
-                       if (document.anchors[i].name==anchorname) { found=1; break; }
-                       }
-               if (found==0) {
-                       coordinates.x=0; coordinates.y=0; return coordinates;
-                       }
-               x=document.anchors[i].x;
-               y=document.anchors[i].y;
-               }
-       else {
-               coordinates.x=0; coordinates.y=0; return coordinates;
-               }
-       coordinates.x=x;
-       coordinates.y=y;
-       return coordinates;
-       }
-
-// getAnchorWindowPosition(anchorname)
-//   This function returns an object having .x and .y properties which are the coordinates
-//   of the named anchor, relative to the window
-function getAnchorWindowPosition(anchorname) {
-       var coordinates=getAnchorPosition(anchorname);
-       var x=0;
-       var y=0;
-       if (document.getElementById) {
-               if (isNaN(window.screenX)) {
-                       x=coordinates.x-document.body.scrollLeft+window.screenLeft;
-                       y=coordinates.y-document.body.scrollTop+window.screenTop;
-                       }
-               else {
-                       x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
-                       y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
-                       }
-               }
-       else if (document.all) {
-               x=coordinates.x-document.body.scrollLeft+window.screenLeft;
-               y=coordinates.y-document.body.scrollTop+window.screenTop;
-               }
-       else if (document.layers) {
-               x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
-               y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
-               }
-       coordinates.x=x;
-       coordinates.y=y;
-       return coordinates;
-       }
-
-// Functions for IE to get position of an object
-function AnchorPosition_getPageOffsetLeft (el) {
-       var ol=el.offsetLeft;
-       while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
-       return ol;
-       }
-function AnchorPosition_getWindowOffsetLeft (el) {
-       return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
-       }
-function AnchorPosition_getPageOffsetTop (el) {
-       var ot=el.offsetTop;
-       while((el=el.offsetParent) != null) { ot += el.offsetTop; }
-       return ot;
-       }
-function AnchorPosition_getWindowOffsetTop (el) {
-       return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
-       }
-
-/* SOURCE FILE: PopupWindow.js */
-
-/* 
-PopupWindow.js
-Author: Matt Kruse
-Last modified: 02/16/04
-
-DESCRIPTION: This object allows you to easily and quickly popup a window
-in a certain place. The window can either be a DIV or a separate browser
-window.
-
-COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
-positioning errors - usually with Window positioning - occur on the 
-Macintosh platform. Due to bugs in Netscape 4.x, populating the popup 
-window with <STYLE> tags may cause errors.
-
-USAGE:
-// Create an object for a WINDOW popup
-var win = new PopupWindow(); 
-
-// Create an object for a DIV window using the DIV named 'mydiv'
-var win = new PopupWindow('mydiv'); 
-
-// Set the window to automatically hide itself when the user clicks 
-// anywhere else on the page except the popup
-win.autoHide(); 
-
-// Show the window relative to the anchor name passed in
-win.showPopup(anchorname);
-
-// Hide the popup
-win.hidePopup();
-
-// Set the size of the popup window (only applies to WINDOW popups
-win.setSize(width,height);
-
-// Populate the contents of the popup window that will be shown. If you 
-// change the contents while it is displayed, you will need to refresh()
-win.populate(string);
-
-// set the URL of the window, rather than populating its contents
-// manually
-win.setUrl("http://www.site.com/");
-
-// Refresh the contents of the popup
-win.refresh();
-
-// Specify how many pixels to the right of the anchor the popup will appear
-win.offsetX = 50;
-
-// Specify how many pixels below the anchor the popup will appear
-win.offsetY = 100;
-
-NOTES:
-1) Requires the functions in AnchorPosition.js
-
-2) Your anchor tag MUST contain both NAME and ID attributes which are the 
-   same. For example:
-   <A NAME="test" ID="test"> </A>
-
-3) There must be at least a space between <A> </A> for IE5.5 to see the 
-   anchor tag correctly. Do not do <A></A> with no space.
-
-4) When a PopupWindow object is created, a handler for 'onmouseup' is
-   attached to any event handler you may have already defined. Do NOT define
-   an event handler for 'onmouseup' after you define a PopupWindow object or
-   the autoHide() will not work correctly.
-*/ 
-
-// Set the position of the popup window based on the anchor
-function PopupWindow_getXYPosition(anchorname) {
-       var coordinates;
-       if (this.type == "WINDOW") {
-               coordinates = getAnchorWindowPosition(anchorname);
-               }
-       else {
-               coordinates = getAnchorPosition(anchorname);
-               }
-       this.x = coordinates.x;
-       this.y = coordinates.y;
-       }
-// Set width/height of DIV/popup window
-function PopupWindow_setSize(width,height) {
-       this.width = width;
-       this.height = height;
-       }
-// Fill the window with contents
-function PopupWindow_populate(contents) {
-       this.contents = contents;
-       this.populated = false;
-       }
-// Set the URL to go to
-function PopupWindow_setUrl(url) {
-       this.url = url;
-       }
-// Set the window popup properties
-function PopupWindow_setWindowProperties(props) {
-       this.windowProperties = props;
-       }
-// Refresh the displayed contents of the popup
-function PopupWindow_refresh() {
-       if (this.divName != null) {
-               // refresh the DIV object
-               if (this.use_gebi) {
-                       document.getElementById(this.divName).innerHTML = this.contents;
-                       }
-               else if (this.use_css) { 
-                       document.all[this.divName].innerHTML = this.contents;
-                       }
-               else if (this.use_layers) { 
-                       var d = document.layers[this.divName]; 
-                       d.document.open();
-                       d.document.writeln(this.contents);
-                       d.document.close();
-                       }
-               }
-       else {
-               if (this.popupWindow != null && !this.popupWindow.closed) {
-                       if (this.url!="") {
-                               this.popupWindow.location.href=this.url;
-                               }
-                       else {
-                               this.popupWindow.document.open();
-                               this.popupWindow.document.writeln(this.contents);
-                               this.popupWindow.document.close();
-                       }
-                       this.popupWindow.focus();
-                       }
-               }
-       }
-// Position and show the popup, relative to an anchor object
-function PopupWindow_showPopup(anchorname) {
-       this.getXYPosition(anchorname);
-       this.x += this.offsetX;
-       this.y += this.offsetY;
-       if (!this.populated && (this.contents != "")) {
-               this.populated = true;
-               this.refresh();
-               }
-       if (this.divName != null) {
-               // Show the DIV object
-               if (this.use_gebi) {
-                       document.getElementById(this.divName).style.left = this.x + "px";
-                       document.getElementById(this.divName).style.top = this.y;
-                       document.getElementById(this.divName).style.visibility = "visible";
-                       }
-               else if (this.use_css) {
-                       document.all[this.divName].style.left = this.x;
-                       document.all[this.divName].style.top = this.y;
-                       document.all[this.divName].style.visibility = "visible";
-                       }
-               else if (this.use_layers) {
-                       document.layers[this.divName].left = this.x;
-                       document.layers[this.divName].top = this.y;
-                       document.layers[this.divName].visibility = "visible";
-                       }
-               }
-       else {
-               if (this.popupWindow == null || this.popupWindow.closed) {
-                       // If the popup window will go off-screen, move it so it doesn't
-                       if (this.x<0) { this.x=0; }
-                       if (this.y<0) { this.y=0; }
-                       if (screen && screen.availHeight) {
-                               if ((this.y + this.height) > screen.availHeight) {
-                                       this.y = screen.availHeight - this.height;
-                                       }
-                               }
-                       if (screen && screen.availWidth) {
-                               if ((this.x + this.width) > screen.availWidth) {
-                                       this.x = screen.availWidth - this.width;
-                                       }
-                               }
-                       var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
-                       this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
-                       }
-               this.refresh();
-               }
-       }
-// Hide the popup
-function PopupWindow_hidePopup() {
-       if (this.divName != null) {
-               if (this.use_gebi) {
-                       document.getElementById(this.divName).style.visibility = "hidden";
-                       }
-               else if (this.use_css) {
-                       document.all[this.divName].style.visibility = "hidden";
-                       }
-               else if (this.use_layers) {
-                       document.layers[this.divName].visibility = "hidden";
-                       }
-               }
-       else {
-               if (this.popupWindow && !this.popupWindow.closed) {
-                       this.popupWindow.close();
-                       this.popupWindow = null;
-                       }
-               }
-       }
-// Pass an event and return whether or not it was the popup DIV that was clicked
-function PopupWindow_isClicked(e) {
-       if (this.divName != null) {
-               if (this.use_layers) {
-                       var clickX = e.pageX;
-                       var clickY = e.pageY;
-                       var t = document.layers[this.divName];
-                       if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
-                               return true;
-                               }
-                       else { return false; }
-                       }
-               else if (document.all) { // Need to hard-code this to trap IE for error-handling
-                       var t = window.event.srcElement;
-                       while (t.parentElement != null) {
-                               if (t.id==this.divName) {
-                                       return true;
-                                       }
-                               t = t.parentElement;
-                               }
-                       return false;
-                       }
-               else if (this.use_gebi && e) {
-                       var t = e.originalTarget;
-                       while (t.parentNode != null) {
-                               if (t.id==this.divName) {
-                                       return true;
-                                       }
-                               t = t.parentNode;
-                               }
-                       return false;
-                       }
-               return false;
-               }
-       return false;
-       }
-
-// Check an onMouseDown event to see if we should hide
-function PopupWindow_hideIfNotClicked(e) {
-       if (this.autoHideEnabled && !this.isClicked(e)) {
-               this.hidePopup();
-               }
-       }
-// Call this to make the DIV disable automatically when mouse is clicked outside it
-function PopupWindow_autoHide() {
-       this.autoHideEnabled = true;
-       }
-// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
-function PopupWindow_hidePopupWindows(e) {
-       for (var i=0; i<popupWindowObjects.length; i++) {
-               if (popupWindowObjects[i] != null) {
-                       var p = popupWindowObjects[i];
-                       p.hideIfNotClicked(e);
-                       }
-               }
-       }
-// Run this immediately to attach the event listener
-function PopupWindow_attachListener() {
-       if (document.layers) {
-               document.captureEvents(Event.MOUSEUP);
-               }
-       window.popupWindowOldEventListener = document.onmouseup;
-       if (window.popupWindowOldEventListener != null) {
-               document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
-               }
-       else {
-               document.onmouseup = PopupWindow_hidePopupWindows;
-               }
-       }
-// CONSTRUCTOR for the PopupWindow object
-// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
-function PopupWindow() {
-       if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
-       if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
-       if (!window.listenerAttached) {
-               window.listenerAttached = true;
-               PopupWindow_attachListener();
-               }
-       this.index = popupWindowIndex++;
-       popupWindowObjects[this.index] = this;
-       this.divName = null;
-       this.popupWindow = null;
-       this.width=0;
-       this.height=0;
-       this.populated = false;
-       this.visible = false;
-       this.autoHideEnabled = false;
-
-       this.contents = "";
-       this.url="";
-       this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
-       if (arguments.length>0) {
-               this.type="DIV";
-               this.divName = arguments[0];
-               }
-       else {
-               this.type="WINDOW";
-               }
-       this.use_gebi = false;
-       this.use_css = false;
-       this.use_layers = false;
-       if (document.getElementById) { this.use_gebi = true; }
-       else if (document.all) { this.use_css = true; }
-       else if (document.layers) { this.use_layers = true; }
-       else { this.type = "WINDOW"; }
-       this.offsetX = 0;
-       this.offsetY = 0;
-       // Method mappings
-       this.getXYPosition = PopupWindow_getXYPosition;
-       this.populate = PopupWindow_populate;
-       this.setUrl = PopupWindow_setUrl;
-       this.setWindowProperties = PopupWindow_setWindowProperties;
-       this.refresh = PopupWindow_refresh;
-       this.showPopup = PopupWindow_showPopup;
-       this.hidePopup = PopupWindow_hidePopup;
-       this.setSize = PopupWindow_setSize;
-       this.isClicked = PopupWindow_isClicked;
-       this.autoHide = PopupWindow_autoHide;
-       this.hideIfNotClicked = PopupWindow_hideIfNotClicked;
-       }
-
-/* SOURCE FILE: ColorPicker2.js */
-
-/* 
-Last modified: 02/24/2003
-
-DESCRIPTION: This widget is used to select a color, in hexadecimal #RRGGBB 
-form. It uses a color "swatch" to display the standard 216-color web-safe 
-palette. The user can then click on a color to select it.
-
-COMPATABILITY: See notes in AnchorPosition.js and PopupWindow.js.
-Only the latest DHTML-capable browsers will show the color and hex values
-at the bottom as your mouse goes over them.
-
-USAGE:
-// Create a new ColorPicker object using DHTML popup
-var cp = new ColorPicker();
-
-// Create a new ColorPicker object using Window Popup
-var cp = new ColorPicker('window');
-
-// Add a link in your page to trigger the popup. For example:
-<A HREF="#" onClick="cp.show('pick');return false;" NAME="pick" ID="pick">Pick</A>
-
-// Or use the built-in "select" function to do the dirty work for you:
-<A HREF="#" onClick="cp.select(document.forms[0].color,'pick');return false;" NAME="pick" ID="pick">Pick</A>
-
-// If using DHTML popup, write out the required DIV tag near the bottom
-// of your page.
-<SCRIPT LANGUAGE="JavaScript">cp.writeDiv()</SCRIPT>
-
-// Write the 'pickColor' function that will be called when the user clicks
-// a color and do something with the value. This is only required if you
-// want to do something other than simply populate a form field, which is 
-// what the 'select' function will give you.
-function pickColor(color) {
-       field.value = color;
-       }
-
-NOTES:
-1) Requires the functions in AnchorPosition.js and PopupWindow.js
-
-2) Your anchor tag MUST contain both NAME and ID attributes which are the 
-   same. For example:
-   <A NAME="test" ID="test"> </A>
-
-3) There must be at least a space between <A> </A> for IE5.5 to see the 
-   anchor tag correctly. Do not do <A></A> with no space.
-
-4) When a ColorPicker object is created, a handler for 'onmouseup' is
-   attached to any event handler you may have already defined. Do NOT define
-   an event handler for 'onmouseup' after you define a ColorPicker object or
-   the color picker will not hide itself correctly.
-*/ 
-ColorPicker_targetInput = null;
-function ColorPicker_writeDiv() {
-       document.writeln("<DIV ID=\"colorPickerDiv\" STYLE=\"position:absolute;visibility:hidden;\"> </DIV>");
-       }
-
-function ColorPicker_show(anchorname) {
-       this.showPopup(anchorname);
-       }
-
-function ColorPicker_pickColor(color,obj) {
-       obj.hidePopup();
-       pickColor(color);
-       }
-
-// A Default "pickColor" function to accept the color passed back from popup.
-// User can over-ride this with their own function.
-function pickColor(color) {
-       if (ColorPicker_targetInput==null) {
-               alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!");
-               return;
-               }
-       ColorPicker_targetInput.value = color;
-       }
-
-// This function is the easiest way to popup the window, select a color, and
-// have the value populate a form field, which is what most people want to do.
-function ColorPicker_select(inputobj,linkname) {
-       if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") { 
-               alert("colorpicker.select: Input object passed is not a valid form input object"); 
-               window.ColorPicker_targetInput=null;
-               return;
-               }
-       window.ColorPicker_targetInput = inputobj;
-       this.show(linkname);
-       }
-
-// This function runs when you move your mouse over a color block, if you have a newer browser
-function ColorPicker_highlightColor(c) {
-       var thedoc = (arguments.length>1)?arguments[1]:window.document;
-       var d = thedoc.getElementById("colorPickerSelectedColor");
-       d.style.backgroundColor = c;
-       d = thedoc.getElementById("colorPickerSelectedColorValue");
-       d.innerHTML = c;
-       }
-
-function ColorPicker() {
-       var windowMode = false;
-       // Create a new PopupWindow object
-       if (arguments.length==0) {
-               var divname = "colorPickerDiv";
-               }
-       else if (arguments[0] == "window") {
-               var divname = '';
-               windowMode = true;
-               }
-       else {
-               var divname = arguments[0];
-               }
-
-       if (divname != "") {
-               var cp = new PopupWindow(divname);
-               }
-       else {
-               var cp = new PopupWindow();
-               cp.setSize(225,250);
-               }
-
-       // Object variables
-       cp.currentValue = "#FFFFFF";
-
-       // Method Mappings
-       cp.writeDiv = ColorPicker_writeDiv;
-       cp.highlightColor = ColorPicker_highlightColor;
-       cp.show = ColorPicker_show;
-       cp.select = ColorPicker_select;
-
-       // Code to populate color picker window
-       var colors = new Array( "#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099",
-                                                       "#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099",
-                                                       "#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099",
-                                                       "#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF",
-                                                       "#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F",
-                                                       "#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000",
-
-                                                       "#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399",
-                                                       "#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399",
-                                                       "#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399",
-                                                       "#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF",
-                                                       "#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F",
-                                                       "#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00",
-
-                                                       "#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699",
-                                                       "#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699",
-                                                       "#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699",
-                                                       "#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F",
-                                                       "#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F",
-                                                       "#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F",
-
-                                                       "#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999",
-                                                       "#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999",
-                                                       "#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999",
-                                                       "#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF",
-                                                       "#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F",
-                                                       "#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000",
-
-                                                       "#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99",
-                                                       "#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99",
-                                                       "#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99",
-                                                       "#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF",
-                                                       "#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F",
-                                                       "#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00",
-
-                                                       "#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99",
-                                                       "#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99",
-                                                       "#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99",
-                                                       "#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F",
-                                                       "#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F",
-                                                       "#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F",
-
-                                                       "#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666",
-                                                       "#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000",
-                                                       "#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000",
-                                                       "#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999",
-                                                       "#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF",
-                                                       "#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF",
-
-                                                       "#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66",
-                                                       "#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00",
-                                                       "#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000",
-                                                       "#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099",
-                                                       "#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF",
-                                                       "#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF",
-
-                                                       "#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF",
-                                                       "#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC",
-                                                       "#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000",
-                                                       "#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900",
-                                                       "#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33",
-                                                       "#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF",
-
-                                                       "#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF",
-                                                       "#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF",
-                                                       "#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F",
-                                                       "#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F",
-                                                       "#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F",
-                                                       "#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000");
-       var total = colors.length;
-       var width = 72;
-       var cp_contents = "";
-       var windowRef = (windowMode)?"window.opener.":"";
-       if (windowMode) {
-               cp_contents += "<html><head><title>Select Color</title></head>";
-               cp_contents += "<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>";
-               }
-       cp_contents += "<table style='border: none;' cellspacing=0 cellpadding=0>";
-       var use_highlight = (document.getElementById || document.all)?true:false;
-       for (var i=0; i<total; i++) {
-               if ((i % width) == 0) { cp_contents += "<tr>"; }
-               if (use_highlight) { var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"'; }
-               else { mo = ""; }
-               cp_contents += '<td style="background-color: '+colors[i]+';"><a href="javascript:void()" onclick="'+windowRef+'ColorPicker_pickColor(\''+colors[i]+'\','+windowRef+'window.popupWindowObjects['+cp.index+']);return false;" '+mo+'>&nbsp;</a></td>';
-               if ( ((i+1)>=total) || (((i+1) % width) == 0)) { 
-                       cp_contents += "</tr>";
-                       }
-               }
-       // If the browser supports dynamically changing TD cells, add the fancy stuff
-       if (document.getElementById) {
-               var width1 = Math.floor(width/2);
-               var width2 = width = width1;
-               cp_contents += "<tr><td colspan='"+width1+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'>&nbsp;</td><td colspan='"+width2+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>";
-               }
-       cp_contents += "</table>";
-       if (windowMode) {
-               cp_contents += "</span></body></html>";
-               }
-       // end populate code
-
-       // Write the contents to the popup object
-       cp.populate(cp_contents+"\n");
-       // Move the table down a bit so you can see it
-       cp.offsetY = 25;
-       cp.autoHide();
-       return cp;
-       }
+function getAnchorPosition(b){var e=false;var k=new Object();var j=0,g=0;var d=false,f=false,h=false;if(document.getElementById){d=true}else{if(document.all){f=true}else{if(document.layers){h=true}}}if(d&&document.all){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(d){var a=document.getElementById(b);j=AnchorPosition_getPageOffsetLeft(a);g=AnchorPosition_getPageOffsetTop(a)}else{if(f){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(h){var l=0;for(var c=0;c<document.anchors.length;c++){if(document.anchors[c].name==b){l=1;break}}if(l==0){k.x=0;k.y=0;return k}j=document.anchors[c].x;g=document.anchors[c].y}else{k.x=0;k.y=0;return k}}}}k.x=j;k.y=g;return k}function getAnchorWindowPosition(b){var c=getAnchorPosition(b);var a=0;var d=0;if(document.getElementById){if(isNaN(window.screenX)){a=c.x-document.body.scrollLeft+window.screenLeft;d=c.y-document.body.scrollTop+window.screenTop}else{a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;d=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}else{if(document.all){a=c.x-document.body.scrollLeft+window.screenLeft;d=c.y-document.body.scrollTop+window.screenTop}else{if(document.layers){a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;d=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}}c.x=a;c.y=d;return c}function AnchorPosition_getPageOffsetLeft(b){var a=b.offsetLeft;while((b=b.offsetParent)!=null){a+=b.offsetLeft}return a}function AnchorPosition_getWindowOffsetLeft(a){return AnchorPosition_getPageOffsetLeft(a)-document.body.scrollLeft}function AnchorPosition_getPageOffsetTop(a){var b=a.offsetTop;while((a=a.offsetParent)!=null){b+=a.offsetTop}return b}function AnchorPosition_getWindowOffsetTop(a){return AnchorPosition_getPageOffsetTop(a)-document.body.scrollTop}function PopupWindow_getXYPosition(a){var b;if(this.type=="WINDOW"){b=getAnchorWindowPosition(a)}else{b=getAnchorPosition(a)}this.x=b.x;this.y=b.y}function PopupWindow_setSize(b,a){this.width=b;this.height=a}function PopupWindow_populate(a){this.contents=a;this.populated=false}function PopupWindow_setUrl(a){this.url=a}function PopupWindow_setWindowProperties(a){this.windowProperties=a}function PopupWindow_refresh(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).innerHTML=this.contents}else{if(this.use_css){document.all[this.divName].innerHTML=this.contents}else{if(this.use_layers){var a=document.layers[this.divName];a.document.open();a.document.writeln(this.contents);a.document.close()}}}}else{if(this.popupWindow!=null&&!this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close()}this.popupWindow.focus()}}}function PopupWindow_showPopup(a){this.getXYPosition(a);this.x+=this.offsetX;this.y+=this.offsetY;if(!this.populated&&(this.contents!="")){this.populated=true;this.refresh()}if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.left=this.x+"px";document.getElementById(this.divName).style.top=this.y;document.getElementById(this.divName).style.visibility="visible"}else{if(this.use_css){document.all[this.divName].style.left=this.x;document.all[this.divName].style.top=this.y;document.all[this.divName].style.visibility="visible"}else{if(this.use_layers){document.layers[this.divName].left=this.x;document.layers[this.divName].top=this.y;document.layers[this.divName].visibility="visible"}}}}else{if(this.popupWindow==null||this.popupWindow.closed){if(this.x<0){this.x=0}if(this.y<0){this.y=0}if(screen&&screen.availHeight){if((this.y+this.height)>screen.availHeight){this.y=screen.availHeight-this.height}}if(screen&&screen.availWidth){if((this.x+this.width)>screen.availWidth){this.x=screen.availWidth-this.width}}var b=window.opera||(document.layers&&!navigator.mimeTypes["*"])||navigator.vendor=="KDE"||(document.childNodes&&!document.all&&!navigator.taintEnabled);this.popupWindow=window.open(b?"":"about:blank","window_"+a,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"")}this.refresh()}}function PopupWindow_hidePopup(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.visibility="hidden"}else{if(this.use_css){document.all[this.divName].style.visibility="hidden"}else{if(this.use_layers){document.layers[this.divName].visibility="hidden"}}}}else{if(this.popupWindow&&!this.popupWindow.closed){this.popupWindow.close();this.popupWindow=null}}}function PopupWindow_isClicked(c){if(this.divName!=null){if(this.use_layers){var d=c.pageX;var b=c.pageY;var a=document.layers[this.divName];if((d>a.left)&&(d<a.left+a.clip.width)&&(b>a.top)&&(b<a.top+a.clip.height)){return true}else{return false}}else{if(document.all){var a=window.event.srcElement;while(a.parentElement!=null){if(a.id==this.divName){return true}a=a.parentElement}return false}else{if(this.use_gebi&&c){var a=c.originalTarget;while(a.parentNode!=null){if(a.id==this.divName){return true}a=a.parentNode}return false}}}return false}return false}function PopupWindow_hideIfNotClicked(a){if(this.autoHideEnabled&&!this.isClicked(a)){this.hidePopup()}}function PopupWindow_autoHide(){this.autoHideEnabled=true}function PopupWindow_hidePopupWindows(c){for(var a=0;a<popupWindowObjects.length;a++){if(popupWindowObjects[a]!=null){var b=popupWindowObjects[a];b.hideIfNotClicked(c)}}}function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP)}window.popupWindowOldEventListener=document.onmouseup;if(window.popupWindowOldEventListener!=null){document.onmouseup=new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();")}else{document.onmouseup=PopupWindow_hidePopupWindows}}function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex=0}if(!window.popupWindowObjects){window.popupWindowObjects=new Array()}if(!window.listenerAttached){window.listenerAttached=true;PopupWindow_attachListener()}this.index=popupWindowIndex++;popupWindowObjects[this.index]=this;this.divName=null;this.popupWindow=null;this.width=0;this.height=0;this.populated=false;this.visible=false;this.autoHideEnabled=false;this.contents="";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName=arguments[0]}else{this.type="WINDOW"}this.use_gebi=false;this.use_css=false;this.use_layers=false;if(document.getElementById){this.use_gebi=true}else{if(document.all){this.use_css=true}else{if(document.layers){this.use_layers=true}else{this.type="WINDOW"}}}this.offsetX=0;this.offsetY=0;this.getXYPosition=PopupWindow_getXYPosition;this.populate=PopupWindow_populate;this.setUrl=PopupWindow_setUrl;this.setWindowProperties=PopupWindow_setWindowProperties;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.setSize=PopupWindow_setSize;this.isClicked=PopupWindow_isClicked;this.autoHide=PopupWindow_autoHide;this.hideIfNotClicked=PopupWindow_hideIfNotClicked}ColorPicker_targetInput=null;function ColorPicker_writeDiv(){document.writeln('<DIV ID="colorPickerDiv" STYLE="position:absolute;visibility:hidden;"> </DIV>')}function ColorPicker_show(a){this.showPopup(a)}function ColorPicker_pickColor(a,b){b.hidePopup();pickColor(a)}function pickColor(a){if(ColorPicker_targetInput==null){alert("Target Input is null, which means you either didn't use the 'select' function or you have no defined your own 'pickColor' function to handle the picked color!");return}ColorPicker_targetInput.value=a}function ColorPicker_select(b,a){if(b.type!="text"&&b.type!="hidden"&&b.type!="textarea"){alert("colorpicker.select: Input object passed is not a valid form input object");window.ColorPicker_targetInput=null;return}window.ColorPicker_targetInput=b;this.show(a)}function ColorPicker_highlightColor(e){var a=(arguments.length>1)?arguments[1]:window.document;var b=a.getElementById("colorPickerSelectedColor");b.style.backgroundColor=e;b=a.getElementById("colorPickerSelectedColorValue");b.innerHTML=e}function ColorPicker(){var g=false;if(arguments.length==0){var e="colorPickerDiv"}else{if(arguments[0]=="window"){var e="";g=true}else{var e=arguments[0]}}if(e!=""){var m=new PopupWindow(e)}else{var m=new PopupWindow();m.setSize(225,250)}m.currentValue="#FFFFFF";m.writeDiv=ColorPicker_writeDiv;m.highlightColor=ColorPicker_highlightColor;m.show=ColorPicker_show;m.select=ColorPicker_select;var a=new Array("#4180B6","#69AEE7","#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099","#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#7FFFFF","#7FFFFF","#7FF7F7","#7FEFEF","#7FE7E7","#7FDFDF","#7FD7D7","#7FCFCF","#7FC7C7","#7FBFBF","#7FB7B7","#7FAFAF","#7FA7A7","#7F9F9F","#7F9797","#7F8F8F","#7F8787","#7F7F7F","#7F7777","#7F6F6F","#7F6767","#7F5F5F","#7F5757","#7F4F4F","#7F4747","#7F3F3F","#7F3737","#7F2F2F","#7F2727","#7F1F1F","#7F1717","#7F0F0F","#7F0707","#7F0000","#4180B6","#69AEE7","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF7FFF","#FF7FFF","#F77FF7","#EF7FEF","#E77FE7","#DF7FDF","#D77FD7","#CF7FCF","#C77FC7","#BF7FBF","#B77FB7","#AF7FAF","#A77FA7","#9F7F9F","#977F97","#8F7F8F","#877F87","#7F7F7F","#777F77","#6F7F6F","#677F67","#5F7F5F","#577F57","#4F7F4F","#477F47","#3F7F3F","#377F37","#2F7F2F","#277F27","#1F7F1F","#177F17","#0F7F0F","#077F07","#007F00","#4180B6","#69AEE7","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#FFFF7F","#FFFF7F","#F7F77F","#EFEF7F","#E7E77F","#DFDF7F","#D7D77F","#CFCF7F","#C7C77F","#BFBF7F","#B7B77F","#AFAF7F","#A7A77F","#9F9F7F","#97977F","#8F8F7F","#87877F","#7F7F7F","#77777F","#6F6F7F","#67677F","#5F5F7F","#57577F","#4F4F7F","#47477F","#3F3F7F","#37377F","#2F2F7F","#27277F","#1F1F7F","#17177F","#0F0F7F","#07077F","#00007F","#4180B6","#69AEE7","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC","#FF99FF","#3FFFFF","#3FFFFF","#3FF7F7","#3FEFEF","#3FE7E7","#3FDFDF","#3FD7D7","#3FCFCF","#3FC7C7","#3FBFBF","#3FB7B7","#3FAFAF","#3FA7A7","#3F9F9F","#3F9797","#3F8F8F","#3F8787","#3F7F7F","#3F7777","#3F6F6F","#3F6767","#3F5F5F","#3F5757","#3F4F4F","#3F4747","#3F3F3F","#3F3737","#3F2F2F","#3F2727","#3F1F1F","#3F1717","#3F0F0F","#3F0707","#3F0000","#4180B6","#69AEE7","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#FF3FFF","#FF3FFF","#F73FF7","#EF3FEF","#E73FE7","#DF3FDF","#D73FD7","#CF3FCF","#C73FC7","#BF3FBF","#B73FB7","#AF3FAF","#A73FA7","#9F3F9F","#973F97","#8F3F8F","#873F87","#7F3F7F","#773F77","#6F3F6F","#673F67","#5F3F5F","#573F57","#4F3F4F","#473F47","#3F3F3F","#373F37","#2F3F2F","#273F27","#1F3F1F","#173F17","#0F3F0F","#073F07","#003F00","#4180B6","#69AEE7","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#FFFFFF","#FFFF3F","#FFFF3F","#F7F73F","#EFEF3F","#E7E73F","#DFDF3F","#D7D73F","#CFCF3F","#C7C73F","#BFBF3F","#B7B73F","#AFAF3F","#A7A73F","#9F9F3F","#97973F","#8F8F3F","#87873F","#7F7F3F","#77773F","#6F6F3F","#67673F","#5F5F3F","#57573F","#4F4F3F","#47473F","#3F3F3F","#37373F","#2F2F3F","#27273F","#1F1F3F","#17173F","#0F0F3F","#07073F","#00003F","#4180B6","#69AEE7","#FFFFFF","#FFEEEE","#FFDDDD","#FFCCCC","#FFBBBB","#FFAAAA","#FF9999","#FF8888","#FF7777","#FF6666","#FF5555","#FF4444","#FF3333","#FF2222","#FF1111","#FF0000","#FF0000","#FF0000","#FF0000","#EE0000","#DD0000","#CC0000","#BB0000","#AA0000","#990000","#880000","#770000","#660000","#550000","#440000","#330000","#220000","#110000","#000000","#000000","#000000","#000000","#001111","#002222","#003333","#004444","#005555","#006666","#007777","#008888","#009999","#00AAAA","#00BBBB","#00CCCC","#00DDDD","#00EEEE","#00FFFF","#00FFFF","#00FFFF","#00FFFF","#11FFFF","#22FFFF","#33FFFF","#44FFFF","#55FFFF","#66FFFF","#77FFFF","#88FFFF","#99FFFF","#AAFFFF","#BBFFFF","#CCFFFF","#DDFFFF","#EEFFFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEFFEE","#DDFFDD","#CCFFCC","#BBFFBB","#AAFFAA","#99FF99","#88FF88","#77FF77","#66FF66","#55FF55","#44FF44","#33FF33","#22FF22","#11FF11","#00FF00","#00FF00","#00FF00","#00FF00","#00EE00","#00DD00","#00CC00","#00BB00","#00AA00","#009900","#008800","#007700","#006600","#005500","#004400","#003300","#002200","#001100","#000000","#000000","#000000","#000000","#110011","#220022","#330033","#440044","#550055","#660066","#770077","#880088","#990099","#AA00AA","#BB00BB","#CC00CC","#DD00DD","#EE00EE","#FF00FF","#FF00FF","#FF00FF","#FF00FF","#FF11FF","#FF22FF","#FF33FF","#FF44FF","#FF55FF","#FF66FF","#FF77FF","#FF88FF","#FF99FF","#FFAAFF","#FFBBFF","#FFCCFF","#FFDDFF","#FFEEFF","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF","#7777FF","#6666FF","#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF","#0000FF","#0000FF","#0000FF","#0000EE","#0000DD","#0000CC","#0000BB","#0000AA","#000099","#000088","#000077","#000066","#000055","#000044","#000033","#000022","#000011","#000000","#000000","#000000","#000000","#111100","#222200","#333300","#444400","#555500","#666600","#777700","#888800","#999900","#AAAA00","#BBBB00","#CCCC00","#DDDD00","#EEEE00","#FFFF00","#FFFF00","#FFFF00","#FFFF00","#FFFF11","#FFFF22","#FFFF33","#FFFF44","#FFFF55","#FFFF66","#FFFF77","#FFFF88","#FFFF99","#FFFFAA","#FFFFBB","#FFFFCC","#FFFFDD","#FFFFEE","#FFFFFF","#4180B6","#69AEE7","#FFFFFF","#FFFFFF","#FBFBFB","#F7F7F7","#F3F3F3","#EFEFEF","#EBEBEB","#E7E7E7","#E3E3E3","#DFDFDF","#DBDBDB","#D7D7D7","#D3D3D3","#CFCFCF","#CBCBCB","#C7C7C7","#C3C3C3","#BFBFBF","#BBBBBB","#B7B7B7","#B3B3B3","#AFAFAF","#ABABAB","#A7A7A7","#A3A3A3","#9F9F9F","#9B9B9B","#979797","#939393","#8F8F8F","#8B8B8B","#878787","#838383","#7F7F7F","#7B7B7B","#777777","#737373","#6F6F6F","#6B6B6B","#676767","#636363","#5F5F5F","#5B5B5B","#575757","#535353","#4F4F4F","#4B4B4B","#474747","#434343","#3F3F3F","#3B3B3B","#373737","#333333","#2F2F2F","#2B2B2B","#272727","#232323","#1F1F1F","#1B1B1B","#171717","#131313","#0F0F0F","#0B0B0B","#070707","#030303","#000000","#000000","#000000","#000000","#000000");var n=a.length;var c=72;var k="";var j=(g)?"window.opener.":"";if(g){k+="<html><head><title>Select Color</title></head>";k+="<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>"}k+="<table style='border: none;' cellspacing=0 cellpadding=0>";var l=(document.getElementById||document.all)?true:false;for(var h=0;h<n;h++){if((h%c)==0){k+="<tr>"}if(l){var f='onMouseOver="'+j+"ColorPicker_highlightColor('"+a[h]+"',window.document)\""}else{f=""}k+='<td style="background-color: '+a[h]+';"><a href="javascript:void()" onclick="'+j+"ColorPicker_pickColor('"+a[h]+"',"+j+"window.popupWindowObjects["+m.index+']);return false;" '+f+">&nbsp;</a></td>";if(((h+1)>=n)||(((h+1)%c)==0)){k+="</tr>"}}if(document.getElementById){var d=Math.floor(c/2);var b=c=d;k+="<tr><td colspan='"+d+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'>&nbsp;</td><td colspan='"+b+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>"}k+="</table>";if(g){k+="</span></body></html>"}m.populate(k+"\n");m.offsetY=25;m.autoHide();return m};
\ No newline at end of file
diff --git a/wp-includes/js/comment-reply.dev.js b/wp-includes/js/comment-reply.dev.js
new file mode 100644 (file)
index 0000000..2015425
--- /dev/null
@@ -0,0 +1,48 @@
+
+addComment = {
+       moveForm : function(commId, parentId, respondId, postId) {
+               var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID');
+
+               if ( ! comm || ! respond || ! cancel || ! parent )
+                       return;
+
+               t.respondId = respondId;
+               postId = postId || false;
+
+               if ( ! t.I('wp-temp-form-div') ) {
+                       div = document.createElement('div');
+                       div.id = 'wp-temp-form-div';
+                       div.style.display = 'none';
+                       respond.parentNode.insertBefore(div, respond);
+               }
+
+               comm.parentNode.insertBefore(respond, comm.nextSibling);
+               if ( post && postId )
+                       post.value = postId;
+               parent.value = parentId;
+               cancel.style.display = '';
+
+               cancel.onclick = function() {
+                       var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId);
+
+                       if ( ! temp || ! respond )
+                               return;
+
+                       t.I('comment_parent').value = '0';
+                       temp.parentNode.insertBefore(respond, temp);
+                       temp.parentNode.removeChild(temp);
+                       this.style.display = 'none';
+                       this.onclick = null;
+                       return false;
+               }
+
+               try { t.I('comment').focus(); }
+               catch(e) {}
+
+               return false;
+       },
+
+       I : function(e) {
+               return document.getElementById(e);
+       }
+}
index 20154253a4f3fed7ff7fd3ec90f64bc3a001116e..524f2ede923ac814d65ea9641dee4c334a5379d6 100644 (file)
@@ -1,48 +1 @@
-
-addComment = {
-       moveForm : function(commId, parentId, respondId, postId) {
-               var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID');
-
-               if ( ! comm || ! respond || ! cancel || ! parent )
-                       return;
-
-               t.respondId = respondId;
-               postId = postId || false;
-
-               if ( ! t.I('wp-temp-form-div') ) {
-                       div = document.createElement('div');
-                       div.id = 'wp-temp-form-div';
-                       div.style.display = 'none';
-                       respond.parentNode.insertBefore(div, respond);
-               }
-
-               comm.parentNode.insertBefore(respond, comm.nextSibling);
-               if ( post && postId )
-                       post.value = postId;
-               parent.value = parentId;
-               cancel.style.display = '';
-
-               cancel.onclick = function() {
-                       var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId);
-
-                       if ( ! temp || ! respond )
-                               return;
-
-                       t.I('comment_parent').value = '0';
-                       temp.parentNode.insertBefore(respond, temp);
-                       temp.parentNode.removeChild(temp);
-                       this.style.display = 'none';
-                       this.onclick = null;
-                       return false;
-               }
-
-               try { t.I('comment').focus(); }
-               catch(e) {}
-
-               return false;
-       },
-
-       I : function(e) {
-               return document.getElementById(e);
-       }
-}
+addComment={moveForm:function(d,f,i,c){var m=this,a,h=m.I(d),b=m.I(i),l=m.I("cancel-comment-reply-link"),j=m.I("comment_parent"),k=m.I("comment_post_ID");if(!h||!b||!l||!j){return}m.respondId=i;c=c||false;if(!m.I("wp-temp-form-div")){a=document.createElement("div");a.id="wp-temp-form-div";a.style.display="none";b.parentNode.insertBefore(a,b)}h.parentNode.insertBefore(b,h.nextSibling);if(k&&c){k.value=c}j.value=f;l.style.display="";l.onclick=function(){var n=addComment,e=n.I("wp-temp-form-div"),o=n.I(n.respondId);if(!e||!o){return}n.I("comment_parent").value="0";e.parentNode.insertBefore(o,e);e.parentNode.removeChild(e);this.style.display="none";this.onclick=null;return false};try{m.I("comment").focus()}catch(g){}return false},I:function(a){return document.getElementById(a)}};
\ No newline at end of file
diff --git a/wp-includes/js/hoverIntent.dev.js b/wp-includes/js/hoverIntent.dev.js
new file mode 100644 (file)
index 0000000..5cbf978
--- /dev/null
@@ -0,0 +1,128 @@
+/**
+* hoverIntent is similar to jQuery's built-in "hover" function except that
+* instead of firing the onMouseOver event immediately, hoverIntent checks
+* to see if the user's mouse has slowed down (beneath the sensitivity
+* threshold) before firing the onMouseOver event.
+* 
+* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
+* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
+* 
+* hoverIntent is currently available for use in all personal or commercial 
+* projects under both MIT and GPL licenses. This means that you can choose 
+* the license that best suits your project, and use it accordingly.
+* 
+* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
+* $("ul li").hoverIntent( showNav , hideNav );
+* 
+* // advanced usage receives configuration object only
+* $("ul li").hoverIntent({
+*      sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
+*      interval: 100,   // number = milliseconds of polling interval
+*      over: showNav,  // function = onMouseOver callback (required)
+*      timeout: 0,   // number = milliseconds delay before onMouseOut function call
+*      out: hideNav    // function = onMouseOut callback (required)
+* });
+* 
+* @param  f  onMouseOver function || An object with configuration options
+* @param  g  onMouseOut function  || Nothing (use configuration options object)
+* @author    Brian Cherne <brian@cherne.net>
+*/
+(function($) {
+       $.fn.hoverIntent = function(f,g) {
+               // default configuration options
+               var cfg = {
+                       sensitivity: 7,
+                       interval: 100,
+                       timeout: 0
+               };
+               // override configuration options with user supplied object
+               cfg = $.extend(cfg, g ? { over: f, out: g } : f );
+
+               // instantiate variables
+               // cX, cY = current X and Y position of mouse, updated by mousemove event
+               // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
+               var cX, cY, pX, pY;
+
+               // A private function for getting mouse position
+               var track = function(ev) {
+                       cX = ev.pageX;
+                       cY = ev.pageY;
+               };
+
+               // A private function for comparing current and previous mouse position
+               var compare = function(ev,ob) {
+                       ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
+                       // compare mouse positions to see if they've crossed the threshold
+                       if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
+                               $(ob).unbind("mousemove",track);
+                               // set hoverIntent state to true (so mouseOut can be called)
+                               ob.hoverIntent_s = 1;
+                               return cfg.over.apply(ob,[ev]);
+                       } else {
+                               // set previous coordinates for next time
+                               pX = cX; pY = cY;
+                               // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
+                               ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
+                       }
+               };
+
+               // A private function for delaying the mouseOut function
+               var delay = function(ev,ob) {
+                       ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
+                       ob.hoverIntent_s = 0;
+                       return cfg.out.apply(ob,[ev]);
+               };
+               
+               // workaround for Mozilla bug: not firing mouseout/mouseleave on absolute positioned elements over textareas and input type="text"
+               var handleHover = function(e) {
+                       var t = this;
+                       
+                       // next two lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
+                       var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
+                       while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
+                       if ( p == this ) {
+                               if ( $.browser.mozilla ) {
+                                       if ( e.type == "mouseout" ) {
+                                               t.mtout = setTimeout( function(){doHover(e,t);}, 30 );
+                                       } else {
+                                               if (t.mtout) { t.mtout = clearTimeout(t.mtout); }
+                                       }
+                               }
+                               return;
+                       } else {
+                               if (t.mtout) { t.mtout = clearTimeout(t.mtout); }
+                               doHover(e,t);
+                       }
+               };
+
+               // A private function for handling mouse 'hovering'
+               var doHover = function(e,ob) {
+
+                       // copy objects to be passed into t (required for event object to be passed in IE)
+                       var ev = jQuery.extend({},e);
+
+                       // cancel hoverIntent timer if it exists
+                       if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
+
+                       // else e.type == "onmouseover"
+                       if (e.type == "mouseover") {
+                               // set "previous" X and Y position based on initial entry point
+                               pX = ev.pageX; pY = ev.pageY;
+                               // update "current" X and Y position based on mousemove
+                               $(ob).bind("mousemove",track);
+                               // start polling interval (self-calling timeout) to compare mouse coordinates over time
+                               if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
+
+                       // else e.type == "onmouseout"
+                       } else {
+                               // unbind expensive mousemove event
+                               $(ob).unbind("mousemove",track);
+                               // if hoverIntent state is true, then call the mouseOut function after the specified delay
+                               if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
+                       }
+               };
+
+               // bind the function to the two event listeners
+               return this.mouseover(handleHover).mouseout(handleHover);
+       };
+})(jQuery);
\ No newline at end of file
index 5cbf9782b2002983645e4eed2e432fd589ee6ae9..bed4129c9be8a711b9023635ca84c81add6cb0a5 100644 (file)
@@ -1,128 +1 @@
-/**
-* hoverIntent is similar to jQuery's built-in "hover" function except that
-* instead of firing the onMouseOver event immediately, hoverIntent checks
-* to see if the user's mouse has slowed down (beneath the sensitivity
-* threshold) before firing the onMouseOver event.
-* 
-* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
-* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
-* 
-* hoverIntent is currently available for use in all personal or commercial 
-* projects under both MIT and GPL licenses. This means that you can choose 
-* the license that best suits your project, and use it accordingly.
-* 
-* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
-* $("ul li").hoverIntent( showNav , hideNav );
-* 
-* // advanced usage receives configuration object only
-* $("ul li").hoverIntent({
-*      sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
-*      interval: 100,   // number = milliseconds of polling interval
-*      over: showNav,  // function = onMouseOver callback (required)
-*      timeout: 0,   // number = milliseconds delay before onMouseOut function call
-*      out: hideNav    // function = onMouseOut callback (required)
-* });
-* 
-* @param  f  onMouseOver function || An object with configuration options
-* @param  g  onMouseOut function  || Nothing (use configuration options object)
-* @author    Brian Cherne <brian@cherne.net>
-*/
-(function($) {
-       $.fn.hoverIntent = function(f,g) {
-               // default configuration options
-               var cfg = {
-                       sensitivity: 7,
-                       interval: 100,
-                       timeout: 0
-               };
-               // override configuration options with user supplied object
-               cfg = $.extend(cfg, g ? { over: f, out: g } : f );
-
-               // instantiate variables
-               // cX, cY = current X and Y position of mouse, updated by mousemove event
-               // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
-               var cX, cY, pX, pY;
-
-               // A private function for getting mouse position
-               var track = function(ev) {
-                       cX = ev.pageX;
-                       cY = ev.pageY;
-               };
-
-               // A private function for comparing current and previous mouse position
-               var compare = function(ev,ob) {
-                       ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
-                       // compare mouse positions to see if they've crossed the threshold
-                       if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
-                               $(ob).unbind("mousemove",track);
-                               // set hoverIntent state to true (so mouseOut can be called)
-                               ob.hoverIntent_s = 1;
-                               return cfg.over.apply(ob,[ev]);
-                       } else {
-                               // set previous coordinates for next time
-                               pX = cX; pY = cY;
-                               // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
-                               ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
-                       }
-               };
-
-               // A private function for delaying the mouseOut function
-               var delay = function(ev,ob) {
-                       ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
-                       ob.hoverIntent_s = 0;
-                       return cfg.out.apply(ob,[ev]);
-               };
-               
-               // workaround for Mozilla bug: not firing mouseout/mouseleave on absolute positioned elements over textareas and input type="text"
-               var handleHover = function(e) {
-                       var t = this;
-                       
-                       // next two lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
-                       var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
-                       while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
-                       if ( p == this ) {
-                               if ( $.browser.mozilla ) {
-                                       if ( e.type == "mouseout" ) {
-                                               t.mtout = setTimeout( function(){doHover(e,t);}, 30 );
-                                       } else {
-                                               if (t.mtout) { t.mtout = clearTimeout(t.mtout); }
-                                       }
-                               }
-                               return;
-                       } else {
-                               if (t.mtout) { t.mtout = clearTimeout(t.mtout); }
-                               doHover(e,t);
-                       }
-               };
-
-               // A private function for handling mouse 'hovering'
-               var doHover = function(e,ob) {
-
-                       // copy objects to be passed into t (required for event object to be passed in IE)
-                       var ev = jQuery.extend({},e);
-
-                       // cancel hoverIntent timer if it exists
-                       if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
-
-                       // else e.type == "onmouseover"
-                       if (e.type == "mouseover") {
-                               // set "previous" X and Y position based on initial entry point
-                               pX = ev.pageX; pY = ev.pageY;
-                               // update "current" X and Y position based on mousemove
-                               $(ob).bind("mousemove",track);
-                               // start polling interval (self-calling timeout) to compare mouse coordinates over time
-                               if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
-
-                       // else e.type == "onmouseout"
-                       } else {
-                               // unbind expensive mousemove event
-                               $(ob).unbind("mousemove",track);
-                               // if hoverIntent state is true, then call the mouseOut function after the specified delay
-                               if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
-                       }
-               };
-
-               // bind the function to the two event listeners
-               return this.mouseover(handleHover).mouseout(handleHover);
-       };
-})(jQuery);
\ No newline at end of file
+(function(a){a.fn.hoverIntent=function(l,j){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,j?{over:l,out:j}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))<m.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{h=o;d=n;f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(q){var f=this;var g=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(g&&g!=this){try{g=g.parentNode}catch(q){g=this}}if(g==this){if(a.browser.mozilla){if(q.type=="mouseout"){f.mtout=setTimeout(function(){k(q,f)},30)}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}}}return}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}k(q,f)}};var k=function(p,f){var g=jQuery.extend({},p);if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(p.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jcrop/Jcrop.gif b/wp-includes/js/jcrop/Jcrop.gif
new file mode 100644 (file)
index 0000000..72ea7cc
Binary files /dev/null and b/wp-includes/js/jcrop/Jcrop.gif differ
diff --git a/wp-includes/js/jcrop/jquery.Jcrop.css b/wp-includes/js/jcrop/jquery.Jcrop.css
new file mode 100644 (file)
index 0000000..24925dc
--- /dev/null
@@ -0,0 +1,35 @@
+/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
+.jcrop-holder { text-align: left; }
+
+.jcrop-vline, .jcrop-hline
+{
+       font-size: 0;
+       position: absolute;
+       background: white url('Jcrop.gif') top left repeat;
+}
+.jcrop-vline { height: 100%; width: 1px !important; }
+.jcrop-hline { width: 100%; height: 1px !important; }
+.jcrop-handle {
+       font-size: 1px;
+       width: 7px !important;
+       height: 7px !important;
+       border: 1px #eee solid;
+       background-color: #333;
+       *width: 9px;
+       *height: 9px;
+}
+
+.jcrop-tracker { width: 100%; height: 100%; }
+
+.custom .jcrop-vline,
+.custom .jcrop-hline
+{
+       background: yellow;
+}
+.custom .jcrop-handle
+{
+       border-color: black;
+       background-color: #C7BB00;
+       -moz-border-radius: 3px;
+       -webkit-border-radius: 3px;
+}
diff --git a/wp-includes/js/jcrop/jquery.Jcrop.dev.js b/wp-includes/js/jcrop/jquery.Jcrop.dev.js
new file mode 100644 (file)
index 0000000..ad261f9
--- /dev/null
@@ -0,0 +1,1197 @@
+/**
+ * jquery.Jcrop.js v0.9.8
+ * jQuery Image Cropping Plugin
+ * @author Kelly Hallman <khallman@gmail.com>
+ * Copyright (c) 2008-2009 Kelly Hallman - released under MIT License {{{
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+
+ * }}}
+ */
+
+(function($) {
+
+$.Jcrop = function(obj,opt)
+{
+       // Initialization {{{
+
+       // Sanitize some options {{{
+       var obj = obj, opt = opt;
+
+       if (typeof(obj) !== 'object') obj = $(obj)[0];
+       if (typeof(opt) !== 'object') opt = { };
+
+       // Some on-the-fly fixes for MSIE...sigh
+       if (!('trackDocument' in opt))
+       {
+               opt.trackDocument = $.browser.msie ? false : true;
+               if ($.browser.msie && $.browser.version.split('.')[0] == '8')
+                       opt.trackDocument = true;
+       }
+
+       if (!('keySupport' in opt))
+                       opt.keySupport = $.browser.msie ? false : true;
+               
+       // }}}
+       // Extend the default options {{{
+       var defaults = {
+
+               // Basic Settings
+               trackDocument:          false,
+               baseClass:                      'jcrop',
+               addClass:                       null,
+
+               // Styling Options
+               bgColor:                        'black',
+               bgOpacity:                      .6,
+               borderOpacity:          .4,
+               handleOpacity:          .5,
+
+               handlePad:                      5,
+               handleSize:                     9,
+               handleOffset:           5,
+               edgeMargin:                     14,
+
+               aspectRatio:            0,
+               keySupport:                     true,
+               cornerHandles:          true,
+               sideHandles:            true,
+               drawBorders:            true,
+               dragEdges:                      true,
+
+               boxWidth:                       0,
+               boxHeight:                      0,
+
+               boundary:                       8,
+               animationDelay:         20,
+               swingSpeed:                     3,
+
+               allowSelect:            true,
+               allowMove:                      true,
+               allowResize:            true,
+
+               minSelect:                      [ 0, 0 ],
+               maxSize:                        [ 0, 0 ],
+               minSize:                        [ 0, 0 ],
+
+               // Callbacks / Event Handlers
+               onChange: function() { },
+               onSelect: function() { }
+
+       };
+       var options = defaults;
+       setOptions(opt);
+
+       // }}}
+       // Initialize some jQuery objects {{{
+
+       var $origimg = $(obj);
+       var $img = $origimg.clone().removeAttr('id').css({ position: 'absolute' });
+
+       $img.width($origimg.width());
+       $img.height($origimg.height());
+       $origimg.after($img).hide();
+
+       presize($img,options.boxWidth,options.boxHeight);
+
+       var boundx = $img.width(),
+               boundy = $img.height(),
+
+               $div = $('<div />')
+                       .width(boundx).height(boundy)
+                       .addClass(cssClass('holder'))
+                       .css({
+                               position: 'relative',
+                               backgroundColor: options.bgColor
+                       }).insertAfter($origimg).append($img);
+       ;
+       
+       if (options.addClass) $div.addClass(options.addClass);
+       //$img.wrap($div);
+
+       var $img2 = $('<img />')/*{{{*/
+                       .attr('src',$img.attr('src'))
+                       .css('position','absolute')
+                       .width(boundx).height(boundy)
+       ;/*}}}*/
+       var $img_holder = $('<div />')/*{{{*/
+               .width(pct(100)).height(pct(100))
+               .css({
+                       zIndex: 310,
+                       position: 'absolute',
+                       overflow: 'hidden'
+               })
+               .append($img2)
+       ;/*}}}*/
+       var $hdl_holder = $('<div />')/*{{{*/
+               .width(pct(100)).height(pct(100))
+               .css('zIndex',320);
+       /*}}}*/
+       var $sel = $('<div />')/*{{{*/
+               .css({
+                       position: 'absolute',
+                       zIndex: 300
+               })
+               .insertBefore($img)
+               .append($img_holder,$hdl_holder)
+       ;/*}}}*/
+
+       var bound = options.boundary;
+       var $trk = newTracker().width(boundx+(bound*2)).height(boundy+(bound*2))
+               .css({ position: 'absolute', top: px(-bound), left: px(-bound), zIndex: 290 })
+               .mousedown(newSelection);       
+       
+       /* }}} */
+       // Set more variables {{{
+
+       var xlimit, ylimit, xmin, ymin;
+       var xscale, yscale, enabled = true;
+       var docOffset = getPos($img),
+               // Internal states
+               btndown, lastcurs, dimmed, animating,
+               shift_down;
+
+       // }}}
+               
+
+               // }}}
+       // Internal Modules {{{
+
+       var Coords = function()/*{{{*/
+       {
+               var x1 = 0, y1 = 0, x2 = 0, y2 = 0, ox, oy;
+
+               function setPressed(pos)/*{{{*/
+               {
+                       var pos = rebound(pos);
+                       x2 = x1 = pos[0];
+                       y2 = y1 = pos[1];
+               };
+               /*}}}*/
+               function setCurrent(pos)/*{{{*/
+               {
+                       var pos = rebound(pos);
+                       ox = pos[0] - x2;
+                       oy = pos[1] - y2;
+                       x2 = pos[0];
+                       y2 = pos[1];
+               };
+               /*}}}*/
+               function getOffset()/*{{{*/
+               {
+                       return [ ox, oy ];
+               };
+               /*}}}*/
+               function moveOffset(offset)/*{{{*/
+               {
+                       var ox = offset[0], oy = offset[1];
+
+                       if (0 > x1 + ox) ox -= ox + x1;
+                       if (0 > y1 + oy) oy -= oy + y1;
+
+                       if (boundy < y2 + oy) oy += boundy - (y2 + oy);
+                       if (boundx < x2 + ox) ox += boundx - (x2 + ox);
+
+                       x1 += ox;
+                       x2 += ox;
+                       y1 += oy;
+                       y2 += oy;
+               };
+               /*}}}*/
+               function getCorner(ord)/*{{{*/
+               {
+                       var c = getFixed();
+                       switch(ord)
+                       {
+                               case 'ne': return [ c.x2, c.y ];
+                               case 'nw': return [ c.x, c.y ];
+                               case 'se': return [ c.x2, c.y2 ];
+                               case 'sw': return [ c.x, c.y2 ];
+                       }
+               };
+               /*}}}*/
+               function getFixed()/*{{{*/
+               {
+                       if (!options.aspectRatio) return getRect();
+                       // This function could use some optimization I think...
+                       var aspect = options.aspectRatio,
+                               min_x = options.minSize[0]/xscale, 
+                               min_y = options.minSize[1]/yscale,
+                               max_x = options.maxSize[0]/xscale, 
+                               max_y = options.maxSize[1]/yscale,
+                               rw = x2 - x1,
+                               rh = y2 - y1,
+                               rwa = Math.abs(rw),
+                               rha = Math.abs(rh),
+                               real_ratio = rwa / rha,
+                               xx, yy
+                       ;
+                       if (max_x == 0) { max_x = boundx * 10 }
+                       if (max_y == 0) { max_y = boundy * 10 }
+                       if (real_ratio < aspect)
+                       {
+                               yy = y2;
+                               w = rha * aspect;
+                               xx = rw < 0 ? x1 - w : w + x1;
+
+                               if (xx < 0)
+                               {
+                                       xx = 0;
+                                       h = Math.abs((xx - x1) / aspect);
+                                       yy = rh < 0 ? y1 - h: h + y1;
+                               }
+                               else if (xx > boundx)
+                               {
+                                       xx = boundx;
+                                       h = Math.abs((xx - x1) / aspect);
+                                       yy = rh < 0 ? y1 - h : h + y1;
+                               }
+                       }
+                       else
+                       {
+                               xx = x2;
+                               h = rwa / aspect;
+                               yy = rh < 0 ? y1 - h : y1 + h;
+                               if (yy < 0)
+                               {
+                                       yy = 0;
+                                       w = Math.abs((yy - y1) * aspect);
+                                       xx = rw < 0 ? x1 - w : w + x1;
+                               }
+                               else if (yy > boundy)
+                               {
+                                       yy = boundy;
+                                       w = Math.abs(yy - y1) * aspect;
+                                       xx = rw < 0 ? x1 - w : w + x1;
+                               }
+                       }
+
+                       // Magic %-)
+                       if(xx > x1) { // right side
+                         if(xx - x1 < min_x) {
+                               xx = x1 + min_x;
+                         } else if (xx - x1 > max_x) {
+                               xx = x1 + max_x;
+                         }
+                         if(yy > y1) {
+                               yy = y1 + (xx - x1)/aspect;
+                         } else {
+                               yy = y1 - (xx - x1)/aspect;
+                         }
+                       } else if (xx < x1) { // left side
+                         if(x1 - xx < min_x) {
+                               xx = x1 - min_x
+                         } else if (x1 - xx > max_x) {
+                               xx = x1 - max_x;
+                         }
+                         if(yy > y1) {
+                               yy = y1 + (x1 - xx)/aspect;
+                         } else {
+                               yy = y1 - (x1 - xx)/aspect;
+                         }
+                       }
+
+                       if(xx < 0) {
+                               x1 -= xx;
+                               xx = 0;
+                       } else  if (xx > boundx) {
+                               x1 -= xx - boundx;
+                               xx = boundx;
+                       }
+
+                       if(yy < 0) {
+                               y1 -= yy;
+                               yy = 0;
+                       } else  if (yy > boundy) {
+                               y1 -= yy - boundy;
+                               yy = boundy;
+                       }
+
+                       return last = makeObj(flipCoords(x1,y1,xx,yy));
+               };
+               /*}}}*/
+               function rebound(p)/*{{{*/
+               {
+                       if (p[0] < 0) p[0] = 0;
+                       if (p[1] < 0) p[1] = 0;
+
+                       if (p[0] > boundx) p[0] = boundx;
+                       if (p[1] > boundy) p[1] = boundy;
+
+                       return [ p[0], p[1] ];
+               };
+               /*}}}*/
+               function flipCoords(x1,y1,x2,y2)/*{{{*/
+               {
+                       var xa = x1, xb = x2, ya = y1, yb = y2;
+                       if (x2 < x1)
+                       {
+                               xa = x2;
+                               xb = x1;
+                       }
+                       if (y2 < y1)
+                       {
+                               ya = y2;
+                               yb = y1;
+                       }
+                       return [ Math.round(xa), Math.round(ya), Math.round(xb), Math.round(yb) ];
+               };
+               /*}}}*/
+               function getRect()/*{{{*/
+               {
+                       var xsize = x2 - x1;
+                       var ysize = y2 - y1;
+
+                       if (xlimit && (Math.abs(xsize) > xlimit))
+                               x2 = (xsize > 0) ? (x1 + xlimit) : (x1 - xlimit);
+                       if (ylimit && (Math.abs(ysize) > ylimit))
+                               y2 = (ysize > 0) ? (y1 + ylimit) : (y1 - ylimit);
+
+                       if (ymin && (Math.abs(ysize) < ymin))
+                               y2 = (ysize > 0) ? (y1 + ymin) : (y1 - ymin);
+                       if (xmin && (Math.abs(xsize) < xmin))
+                               x2 = (xsize > 0) ? (x1 + xmin) : (x1 - xmin);
+
+                       if (x1 < 0) { x2 -= x1; x1 -= x1; }
+                       if (y1 < 0) { y2 -= y1; y1 -= y1; }
+                       if (x2 < 0) { x1 -= x2; x2 -= x2; }
+                       if (y2 < 0) { y1 -= y2; y2 -= y2; }
+                       if (x2 > boundx) { var delta = x2 - boundx; x1 -= delta; x2 -= delta; }
+                       if (y2 > boundy) { var delta = y2 - boundy; y1 -= delta; y2 -= delta; }
+                       if (x1 > boundx) { var delta = x1 - boundy; y2 -= delta; y1 -= delta; }
+                       if (y1 > boundy) { var delta = y1 - boundy; y2 -= delta; y1 -= delta; }
+
+                       return makeObj(flipCoords(x1,y1,x2,y2));
+               };
+               /*}}}*/
+               function makeObj(a)/*{{{*/
+               {
+                       return { x: a[0], y: a[1], x2: a[2], y2: a[3],
+                               w: a[2] - a[0], h: a[3] - a[1] };
+               };
+               /*}}}*/
+
+               return {
+                       flipCoords: flipCoords,
+                       setPressed: setPressed,
+                       setCurrent: setCurrent,
+                       getOffset: getOffset,
+                       moveOffset: moveOffset,
+                       getCorner: getCorner,
+                       getFixed: getFixed
+               };
+       }();
+
+       /*}}}*/
+       var Selection = function()/*{{{*/
+       {
+               var start, end, dragmode, awake, hdep = 370;
+               var borders = { };
+               var handle = { };
+               var seehandles = false;
+               var hhs = options.handleOffset;
+
+               /* Insert draggable elements {{{*/
+
+               // Insert border divs for outline
+               if (options.drawBorders) {
+                       borders = {
+                                       top: insertBorder('hline')
+                                               .css('top',$.browser.msie?px(-1):px(0)),
+                                       bottom: insertBorder('hline'),
+                                       left: insertBorder('vline'),
+                                       right: insertBorder('vline')
+                       };
+               }
+
+               // Insert handles on edges
+               if (options.dragEdges) {
+                       handle.t = insertDragbar('n');
+                       handle.b = insertDragbar('s');
+                       handle.r = insertDragbar('e');
+                       handle.l = insertDragbar('w');
+               }
+
+               // Insert side handles
+               options.sideHandles &&
+                       createHandles(['n','s','e','w']);
+
+               // Insert corner handles
+               options.cornerHandles &&
+                       createHandles(['sw','nw','ne','se']);
+
+               /*}}}*/
+               // Private Methods
+               function insertBorder(type)/*{{{*/
+               {
+                       var jq = $('<div />')
+                               .css({position: 'absolute', opacity: options.borderOpacity })
+                               .addClass(cssClass(type));
+                       $img_holder.append(jq);
+                       return jq;
+               };
+               /*}}}*/
+               function dragDiv(ord,zi)/*{{{*/
+               {
+                       var jq = $('<div />')
+                               .mousedown(createDragger(ord))
+                               .css({
+                                       cursor: ord+'-resize',
+                                       position: 'absolute',
+                                       zIndex: zi 
+                               })
+                       ;
+                       $hdl_holder.append(jq);
+                       return jq;
+               };
+               /*}}}*/
+               function insertHandle(ord)/*{{{*/
+               {
+                       return dragDiv(ord,hdep++)
+                               .css({ top: px(-hhs+1), left: px(-hhs+1), opacity: options.handleOpacity })
+                               .addClass(cssClass('handle'));
+               };
+               /*}}}*/
+               function insertDragbar(ord)/*{{{*/
+               {
+                       var s = options.handleSize,
+                               o = hhs,
+                               h = s, w = s,
+                               t = o, l = o;
+
+                       switch(ord)
+                       {
+                               case 'n': case 's': w = pct(100); break;
+                               case 'e': case 'w': h = pct(100); break;
+                       }
+
+                       return dragDiv(ord,hdep++).width(w).height(h)
+                               .css({ top: px(-t+1), left: px(-l+1)});
+               };
+               /*}}}*/
+               function createHandles(li)/*{{{*/
+               {
+                       for(i in li) handle[li[i]] = insertHandle(li[i]);
+               };
+               /*}}}*/
+               function moveHandles(c)/*{{{*/
+               {
+                       var midvert  = Math.round((c.h / 2) - hhs),
+                               midhoriz = Math.round((c.w / 2) - hhs),
+                               north = west = -hhs+1,
+                               east = c.w - hhs,
+                               south = c.h - hhs,
+                               x, y;
+
+                       'e' in handle &&
+                               handle.e.css({ top: px(midvert), left: px(east) }) &&
+                               handle.w.css({ top: px(midvert) }) &&
+                               handle.s.css({ top: px(south), left: px(midhoriz) }) &&
+                               handle.n.css({ left: px(midhoriz) });
+
+                       'ne' in handle &&
+                               handle.ne.css({ left: px(east) }) &&
+                               handle.se.css({ top: px(south), left: px(east) }) &&
+                               handle.sw.css({ top: px(south) });
+
+                       'b' in handle &&
+                               handle.b.css({ top: px(south) }) &&
+                               handle.r.css({ left: px(east) });
+               };
+               /*}}}*/
+               function moveto(x,y)/*{{{*/
+               {
+                       $img2.css({ top: px(-y), left: px(-x) });
+                       $sel.css({ top: px(y), left: px(x) });
+               };
+               /*}}}*/
+               function resize(w,h)/*{{{*/
+               {
+                       $sel.width(w).height(h);
+               };
+               /*}}}*/
+               function refresh()/*{{{*/
+               {
+                       var c = Coords.getFixed();
+
+                       Coords.setPressed([c.x,c.y]);
+                       Coords.setCurrent([c.x2,c.y2]);
+
+                       updateVisible();
+               };
+               /*}}}*/
+
+               // Internal Methods
+               function updateVisible()/*{{{*/
+                       { if (awake) return update(); };
+               /*}}}*/
+               function update()/*{{{*/
+               {
+                       var c = Coords.getFixed();
+
+                       resize(c.w,c.h);
+                       moveto(c.x,c.y);
+
+                       options.drawBorders &&
+                               borders['right'].css({ left: px(c.w-1) }) &&
+                                       borders['bottom'].css({ top: px(c.h-1) });
+
+                       seehandles && moveHandles(c);
+                       awake || show();
+
+                       options.onChange(unscale(c));
+               };
+               /*}}}*/
+               function show()/*{{{*/
+               {
+                       $sel.show();
+                       $img.css('opacity',options.bgOpacity);
+                       awake = true;
+               };
+               /*}}}*/
+               function release()/*{{{*/
+               {
+                       disableHandles();
+                       $sel.hide();
+                       $img.css('opacity',1);
+                       awake = false;
+               };
+               /*}}}*/
+               function showHandles()//{{{
+               {
+                       if (seehandles)
+                       {
+                               moveHandles(Coords.getFixed());
+                               $hdl_holder.show();
+                       }
+               };
+               //}}}
+               function enableHandles()/*{{{*/
+               { 
+                       seehandles = true;
+                       if (options.allowResize)
+                       {
+                               moveHandles(Coords.getFixed());
+                               $hdl_holder.show();
+                               return true;
+                       }
+               };
+               /*}}}*/
+               function disableHandles()/*{{{*/
+               {
+                       seehandles = false;
+                       $hdl_holder.hide();
+               };
+               /*}}}*/
+               function animMode(v)/*{{{*/
+               {
+                       (animating = v) ? disableHandles(): enableHandles();
+               };
+               /*}}}*/
+               function done()/*{{{*/
+               {
+                       animMode(false);
+                       refresh();
+               };
+               /*}}}*/
+
+               var $track = newTracker().mousedown(createDragger('move'))
+                               .css({ cursor: 'move', position: 'absolute', zIndex: 360 })
+
+               $img_holder.append($track);
+               disableHandles();
+
+               return {
+                       updateVisible: updateVisible,
+                       update: update,
+                       release: release,
+                       refresh: refresh,
+                       setCursor: function (cursor) { $track.css('cursor',cursor); },
+                       enableHandles: enableHandles,
+                       enableOnly: function() { seehandles = true; },
+                       showHandles: showHandles,
+                       disableHandles: disableHandles,
+                       animMode: animMode,
+                       done: done
+               };
+       }();
+       /*}}}*/
+       var Tracker = function()/*{{{*/
+       {
+               var onMove              = function() { },
+                       onDone          = function() { },
+                       trackDoc        = options.trackDocument;
+
+               if (!trackDoc)
+               {
+                       $trk
+                               .mousemove(trackMove)
+                               .mouseup(trackUp)
+                               .mouseout(trackUp)
+                       ;
+               }
+
+               function toFront()/*{{{*/
+               {
+                       $trk.css({zIndex:450});
+                       if (trackDoc)
+                       {
+                               $(document)
+                                       .mousemove(trackMove)
+                                       .mouseup(trackUp)
+                               ;
+                       }
+               }
+               /*}}}*/
+               function toBack()/*{{{*/
+               {
+                       $trk.css({zIndex:290});
+                       if (trackDoc)
+                       {
+                               $(document)
+                                       .unbind('mousemove',trackMove)
+                                       .unbind('mouseup',trackUp)
+                               ;
+                       }
+               }
+               /*}}}*/
+               function trackMove(e)/*{{{*/
+               {
+                       onMove(mouseAbs(e));
+               };
+               /*}}}*/
+               function trackUp(e)/*{{{*/
+               {
+                       e.preventDefault();
+                       e.stopPropagation();
+
+                       if (btndown)
+                       {
+                               btndown = false;
+
+                               onDone(mouseAbs(e));
+                               options.onSelect(unscale(Coords.getFixed()));
+                               toBack();
+                               onMove = function() { };
+                               onDone = function() { };
+                       }
+
+                       return false;
+               };
+               /*}}}*/
+
+               function activateHandlers(move,done)/* {{{ */
+               {
+                       btndown = true;
+                       onMove = move;
+                       onDone = done;
+                       toFront();
+                       return false;
+               };
+               /* }}} */
+
+               function setCursor(t) { $trk.css('cursor',t); };
+
+               $img.before($trk);
+               return {
+                       activateHandlers: activateHandlers,
+                       setCursor: setCursor
+               };
+       }();
+       /*}}}*/
+       var KeyManager = function()/*{{{*/
+       {
+               var $keymgr = $('<input type="radio" />')
+                               .css({ position: 'absolute', left: '-30px' })
+                               .keypress(parseKey)
+                               .blur(onBlur),
+
+                       $keywrap = $('<div />')
+                               .css({
+                                       position: 'absolute',
+                                       overflow: 'hidden'
+                               })
+                               .append($keymgr)
+               ;
+
+               function watchKeys()/*{{{*/
+               {
+                       if (options.keySupport)
+                       {
+                               $keymgr.show();
+                               $keymgr.focus();
+                       }
+               };
+               /*}}}*/
+               function onBlur(e)/*{{{*/
+               {
+                       $keymgr.hide();
+               };
+               /*}}}*/
+               function doNudge(e,x,y)/*{{{*/
+               {
+                       if (options.allowMove) {
+                               Coords.moveOffset([x,y]);
+                               Selection.updateVisible();
+                       };
+                       e.preventDefault();
+                       e.stopPropagation();
+               };
+               /*}}}*/
+               function parseKey(e)/*{{{*/
+               {
+                       if (e.ctrlKey) return true;
+                       shift_down = e.shiftKey ? true : false;
+                       var nudge = shift_down ? 10 : 1;
+                       switch(e.keyCode)
+                       {
+                               case 37: doNudge(e,-nudge,0); break;
+                               case 39: doNudge(e,nudge,0); break;
+                               case 38: doNudge(e,0,-nudge); break;
+                               case 40: doNudge(e,0,nudge); break;
+
+                               case 27: Selection.release(); break;
+
+                               case 9: return true;
+                       }
+
+                       return nothing(e);
+               };
+               /*}}}*/
+               
+               if (options.keySupport) $keywrap.insertBefore($img);
+               return {
+                       watchKeys: watchKeys
+               };
+       }();
+       /*}}}*/
+
+       // }}}
+       // Internal Methods {{{
+
+       function px(n) { return '' + parseInt(n) + 'px'; };
+       function pct(n) { return '' + parseInt(n) + '%'; };
+       function cssClass(cl) { return options.baseClass + '-' + cl; };
+       function getPos(obj)/*{{{*/
+       {
+               // Updated in v0.9.4 to use built-in dimensions plugin
+               var pos = $(obj).offset();
+               return [ pos.left, pos.top ];
+       };
+       /*}}}*/
+       function mouseAbs(e)/*{{{*/
+       {
+               return [ (e.pageX - docOffset[0]), (e.pageY - docOffset[1]) ];
+       };
+       /*}}}*/
+       function myCursor(type)/*{{{*/
+       {
+               if (type != lastcurs)
+               {
+                       Tracker.setCursor(type);
+                       //Handles.xsetCursor(type);
+                       lastcurs = type;
+               }
+       };
+       /*}}}*/
+       function startDragMode(mode,pos)/*{{{*/
+       {
+               docOffset = getPos($img);
+               Tracker.setCursor(mode=='move'?mode:mode+'-resize');
+
+               if (mode == 'move')
+                       return Tracker.activateHandlers(createMover(pos), doneSelect);
+
+               var fc = Coords.getFixed();
+               var opp = oppLockCorner(mode);
+               var opc = Coords.getCorner(oppLockCorner(opp));
+
+               Coords.setPressed(Coords.getCorner(opp));
+               Coords.setCurrent(opc);
+
+               Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect);
+       };
+       /*}}}*/
+       function dragmodeHandler(mode,f)/*{{{*/
+       {
+               return function(pos) {
+                       if (!options.aspectRatio) switch(mode)
+                       {
+                               case 'e': pos[1] = f.y2; break;
+                               case 'w': pos[1] = f.y2; break;
+                               case 'n': pos[0] = f.x2; break;
+                               case 's': pos[0] = f.x2; break;
+                       }
+                       else switch(mode)
+                       {
+                               case 'e': pos[1] = f.y+1; break;
+                               case 'w': pos[1] = f.y+1; break;
+                               case 'n': pos[0] = f.x+1; break;
+                               case 's': pos[0] = f.x+1; break;
+                       }
+                       Coords.setCurrent(pos);
+                       Selection.update();
+               };
+       };
+       /*}}}*/
+       function createMover(pos)/*{{{*/
+       {
+               var lloc = pos;
+               KeyManager.watchKeys();
+
+               return function(pos)
+               {
+                       Coords.moveOffset([pos[0] - lloc[0], pos[1] - lloc[1]]);
+                       lloc = pos;
+                       
+                       Selection.update();
+               };
+       };
+       /*}}}*/
+       function oppLockCorner(ord)/*{{{*/
+       {
+               switch(ord)
+               {
+                       case 'n': return 'sw';
+                       case 's': return 'nw';
+                       case 'e': return 'nw';
+                       case 'w': return 'ne';
+                       case 'ne': return 'sw';
+                       case 'nw': return 'se';
+                       case 'se': return 'nw';
+                       case 'sw': return 'ne';
+               };
+       };
+       /*}}}*/
+       function createDragger(ord)/*{{{*/
+       {
+               return function(e) {
+                       if (options.disabled) return false;
+                       if ((ord == 'move') && !options.allowMove) return false;
+                       btndown = true;
+                       startDragMode(ord,mouseAbs(e));
+                       e.stopPropagation();
+                       e.preventDefault();
+                       return false;
+               };
+       };
+       /*}}}*/
+       function presize($obj,w,h)/*{{{*/
+       {
+               var nw = $obj.width(), nh = $obj.height();
+               if ((nw > w) && w > 0)
+               {
+                       nw = w;
+                       nh = (w/$obj.width()) * $obj.height();
+               }
+               if ((nh > h) && h > 0)
+               {
+                       nh = h;
+                       nw = (h/$obj.height()) * $obj.width();
+               }
+               xscale = $obj.width() / nw;
+               yscale = $obj.height() / nh;
+               $obj.width(nw).height(nh);
+       };
+       /*}}}*/
+       function unscale(c)/*{{{*/
+       {
+               return {
+                       x: parseInt(c.x * xscale), y: parseInt(c.y * yscale), 
+                       x2: parseInt(c.x2 * xscale), y2: parseInt(c.y2 * yscale), 
+                       w: parseInt(c.w * xscale), h: parseInt(c.h * yscale)
+               };
+       };
+       /*}}}*/
+       function doneSelect(pos)/*{{{*/
+       {
+               var c = Coords.getFixed();
+               if (c.w > options.minSelect[0] && c.h > options.minSelect[1])
+               {
+                       Selection.enableHandles();
+                       Selection.done();
+               }
+               else
+               {
+                       Selection.release();
+               }
+               Tracker.setCursor( options.allowSelect?'crosshair':'default' );
+       };
+       /*}}}*/
+       function newSelection(e)/*{{{*/
+       {
+               if (options.disabled) return false;
+               if (!options.allowSelect) return false;
+               btndown = true;
+               docOffset = getPos($img);
+               Selection.disableHandles();
+               myCursor('crosshair');
+               var pos = mouseAbs(e);
+               Coords.setPressed(pos);
+               Tracker.activateHandlers(selectDrag,doneSelect);
+               KeyManager.watchKeys();
+               Selection.update();
+
+               e.stopPropagation();
+               e.preventDefault();
+               return false;
+       };
+       /*}}}*/
+       function selectDrag(pos)/*{{{*/
+       {
+               Coords.setCurrent(pos);
+               Selection.update();
+       };
+       /*}}}*/
+       function newTracker()
+       {
+               var trk = $('<div></div>').addClass(cssClass('tracker'));
+               $.browser.msie && trk.css({ opacity: 0, backgroundColor: 'white' });
+               return trk;
+       };
+
+       // }}}
+       // API methods {{{
+               
+       function animateTo(a)/*{{{*/
+       {
+               var x1 = a[0] / xscale,
+                       y1 = a[1] / yscale,
+                       x2 = a[2] / xscale,
+                       y2 = a[3] / yscale;
+
+               if (animating) return;
+
+               var animto = Coords.flipCoords(x1,y1,x2,y2);
+               var c = Coords.getFixed();
+               var animat = initcr = [ c.x, c.y, c.x2, c.y2 ];
+               var interv = options.animationDelay;
+
+               var x = animat[0];
+               var y = animat[1];
+               var x2 = animat[2];
+               var y2 = animat[3];
+               var ix1 = animto[0] - initcr[0];
+               var iy1 = animto[1] - initcr[1];
+               var ix2 = animto[2] - initcr[2];
+               var iy2 = animto[3] - initcr[3];
+               var pcent = 0;
+               var velocity = options.swingSpeed;
+
+               Selection.animMode(true);
+
+               var animator = function()
+               {
+                       return function()
+                       {
+                               pcent += (100 - pcent) / velocity;
+
+                               animat[0] = x + ((pcent / 100) * ix1);
+                               animat[1] = y + ((pcent / 100) * iy1);
+                               animat[2] = x2 + ((pcent / 100) * ix2);
+                               animat[3] = y2 + ((pcent / 100) * iy2);
+
+                               if (pcent < 100) animateStart();
+                                       else Selection.done();
+
+                               if (pcent >= 99.8) pcent = 100;
+
+                               setSelectRaw(animat);
+                       };
+               }();
+
+               function animateStart()
+                       { window.setTimeout(animator,interv); };
+
+               animateStart();
+       };
+       /*}}}*/
+       function setSelect(rect)//{{{
+       {
+               setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);
+       };
+       //}}}
+       function setSelectRaw(l) /*{{{*/
+       {
+               Coords.setPressed([l[0],l[1]]);
+               Coords.setCurrent([l[2],l[3]]);
+               Selection.update();
+       };
+       /*}}}*/
+       function setOptions(opt)/*{{{*/
+       {
+               if (typeof(opt) != 'object') opt = { };
+               options = $.extend(options,opt);
+
+               if (typeof(options.onChange)!=='function')
+                       options.onChange = function() { };
+
+               if (typeof(options.onSelect)!=='function')
+                       options.onSelect = function() { };
+
+       };
+       /*}}}*/
+       function tellSelect()/*{{{*/
+       {
+               return unscale(Coords.getFixed());
+       };
+       /*}}}*/
+       function tellScaled()/*{{{*/
+       {
+               return Coords.getFixed();
+       };
+       /*}}}*/
+       function setOptionsNew(opt)/*{{{*/
+       {
+               setOptions(opt);
+               interfaceUpdate();
+       };
+       /*}}}*/
+       function disableCrop()//{{{
+       {
+               options.disabled = true;
+               Selection.disableHandles();
+               Selection.setCursor('default');
+               Tracker.setCursor('default');
+       };
+       //}}}
+       function enableCrop()//{{{
+       {
+               options.disabled = false;
+               interfaceUpdate();
+       };
+       //}}}
+       function cancelCrop()//{{{
+       {
+               Selection.done();
+               Tracker.activateHandlers(null,null);
+       };
+       //}}}
+       function destroy()//{{{
+       {
+               $div.remove();
+               $origimg.show();
+       };
+       //}}}
+
+       function interfaceUpdate(alt)//{{{
+       // This method tweaks the interface based on options object.
+       // Called when options are changed and at end of initialization.
+       {
+               options.allowResize ?
+                       alt?Selection.enableOnly():Selection.enableHandles():
+                       Selection.disableHandles();
+
+               Tracker.setCursor( options.allowSelect? 'crosshair': 'default' );
+               Selection.setCursor( options.allowMove? 'move': 'default' );
+
+               $div.css('backgroundColor',options.bgColor);
+
+               if ('setSelect' in options) {
+                       setSelect(opt.setSelect);
+                       Selection.done();
+                       delete(options.setSelect);
+               }
+
+               if ('trueSize' in options) {
+                       xscale = options.trueSize[0] / boundx;
+                       yscale = options.trueSize[1] / boundy;
+               }
+
+               xlimit = options.maxSize[0] || 0;
+               ylimit = options.maxSize[1] || 0;
+               xmin = options.minSize[0] || 0;
+               ymin = options.minSize[1] || 0;
+
+               if ('outerImage' in options)
+               {
+                       $img.attr('src',options.outerImage);
+                       delete(options.outerImage);
+               }
+
+               Selection.refresh();
+       };
+       //}}}
+
+       // }}}
+
+       $hdl_holder.hide();
+       interfaceUpdate(true);
+       
+       var api = {
+               animateTo: animateTo,
+               setSelect: setSelect,
+               setOptions: setOptionsNew,
+               tellSelect: tellSelect,
+               tellScaled: tellScaled,
+
+               disable: disableCrop,
+               enable: enableCrop,
+               cancel: cancelCrop,
+
+               focus: KeyManager.watchKeys,
+
+               getBounds: function() { return [ boundx * xscale, boundy * yscale ]; },
+               getWidgetSize: function() { return [ boundx, boundy ]; },
+
+               release: Selection.release,
+               destroy: destroy
+
+       };
+
+       $origimg.data('Jcrop',api);
+       return api;
+};
+
+$.fn.Jcrop = function(options)/*{{{*/
+{
+       function attachWhenDone(from)/*{{{*/
+       {
+               var loadsrc = options.useImg || from.src;
+               var img = new Image();
+               img.onload = function() { $.Jcrop(from,options); };
+               img.src = loadsrc;
+       };
+       /*}}}*/
+       if (typeof(options) !== 'object') options = { };
+
+       // Iterate over each object, attach Jcrop
+       this.each(function()
+       {
+               // If we've already attached to this object
+               if ($(this).data('Jcrop'))
+               {
+                       // The API can be requested this way (undocumented)
+                       if (options == 'api') return $(this).data('Jcrop');
+                       // Otherwise, we just reset the options...
+                       else $(this).data('Jcrop').setOptions(options);
+               }
+               // If we haven't been attached, preload and attach
+               else attachWhenDone(this);
+       });
+
+       // Return "this" so we're chainable a la jQuery plugin-style!
+       return this;
+};
+/*}}}*/
+
+})(jQuery);
diff --git a/wp-includes/js/jcrop/jquery.Jcrop.js b/wp-includes/js/jcrop/jquery.Jcrop.js
new file mode 100644 (file)
index 0000000..9002b97
--- /dev/null
@@ -0,0 +1,163 @@
+/**
+ * Jcrop v.0.9.8 (minimized)
+ * (c) 2008 Kelly Hallman and DeepLiquid.com
+ * More information: http://deepliquid.com/content/Jcrop.html
+ * Released under MIT License - this header must remain with code
+ */
+
+
+(function($){$.Jcrop=function(obj,opt)
+{var obj=obj,opt=opt;if(typeof(obj)!=='object')obj=$(obj)[0];if(typeof(opt)!=='object')opt={};if(!('trackDocument'in opt))
+{opt.trackDocument=$.browser.msie?false:true;if($.browser.msie&&$.browser.version.split('.')[0]=='8')
+opt.trackDocument=true;}
+if(!('keySupport'in opt))
+opt.keySupport=$.browser.msie?false:true;var defaults={trackDocument:false,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:.6,borderOpacity:.4,handleOpacity:.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var options=defaults;setOptions(opt);var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css({position:'absolute'});$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);;if(options.addClass)$div.addClass(options.addClass);var $img2=$('<img />').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('<div />').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('<div />').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('<div />').css({position:'absolute',zIndex:300}).insertBefore($img).append($img_holder,$hdl_holder);var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var xlimit,ylimit,xmin,ymin;var xscale,yscale,enabled=true;var docOffset=getPos($img),btndown,lastcurs,dimmed,animating,shift_down;var Coords=function()
+{var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos)
+{var pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];};function setCurrent(pos)
+{var pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];};function getOffset()
+{return[ox,oy];};function moveOffset(offset)
+{var ox=offset[0],oy=offset[1];if(0>x1+ox)ox-=ox+x1;if(0>y1+oy)oy-=oy+y1;if(boundy<y2+oy)oy+=boundy-(y2+oy);if(boundx<x2+ox)ox+=boundx-(x2+ox);x1+=ox;x2+=ox;y1+=oy;y2+=oy;};function getCorner(ord)
+{var c=getFixed();switch(ord)
+{case'ne':return[c.x2,c.y];case'nw':return[c.x,c.y];case'se':return[c.x2,c.y2];case'sw':return[c.x,c.y2];}};function getFixed()
+{if(!options.aspectRatio)return getRect();var aspect=options.aspectRatio,min_x=options.minSize[0]/xscale,min_y=options.minSize[1]/yscale,max_x=options.maxSize[0]/xscale,max_y=options.maxSize[1]/yscale,rw=x2-x1,rh=y2-y1,rwa=Math.abs(rw),rha=Math.abs(rh),real_ratio=rwa/rha,xx,yy;if(max_x==0){max_x=boundx*10}
+if(max_y==0){max_y=boundy*10}
+if(real_ratio<aspect)
+{yy=y2;w=rha*aspect;xx=rw<0?x1-w:w+x1;if(xx<0)
+{xx=0;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}
+else if(xx>boundx)
+{xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}
+else
+{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0)
+{yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1;}
+else if(yy>boundy)
+{yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}
+if(xx>x1){if(xx-x1<min_x){xx=x1+min_x;}else if(xx-x1>max_x){xx=x1+max_x;}
+if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xx<x1){if(x1-xx<min_x){xx=x1-min_x}else if(x1-xx>max_x){xx=x1-max_x;}
+if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}
+if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}
+if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}
+return last=makeObj(flipCoords(x1,y1,xx,yy));};function rebound(p)
+{if(p[0]<0)p[0]=0;if(p[1]<0)p[1]=0;if(p[0]>boundx)p[0]=boundx;if(p[1]>boundy)p[1]=boundy;return[p[0],p[1]];};function flipCoords(x1,y1,x2,y2)
+{var xa=x1,xb=x2,ya=y1,yb=y2;if(x2<x1)
+{xa=x2;xb=x1;}
+if(y2<y1)
+{ya=y2;yb=y1;}
+return[Math.round(xa),Math.round(ya),Math.round(xb),Math.round(yb)];};function getRect()
+{var xsize=x2-x1;var ysize=y2-y1;if(xlimit&&(Math.abs(xsize)>xlimit))
+x2=(xsize>0)?(x1+xlimit):(x1-xlimit);if(ylimit&&(Math.abs(ysize)>ylimit))
+y2=(ysize>0)?(y1+ylimit):(y1-ylimit);if(ymin&&(Math.abs(ysize)<ymin))
+y2=(ysize>0)?(y1+ymin):(y1-ymin);if(xmin&&(Math.abs(xsize)<xmin))
+x2=(xsize>0)?(x1+xmin):(x1-xmin);if(x1<0){x2-=x1;x1-=x1;}
+if(y1<0){y2-=y1;y1-=y1;}
+if(x2<0){x1-=x2;x2-=x2;}
+if(y2<0){y1-=y2;y2-=y2;}
+if(x2>boundx){var delta=x2-boundx;x1-=delta;x2-=delta;}
+if(y2>boundy){var delta=y2-boundy;y1-=delta;y2-=delta;}
+if(x1>boundx){var delta=x1-boundy;y2-=delta;y1-=delta;}
+if(y1>boundy){var delta=y1-boundy;y2-=delta;y1-=delta;}
+return makeObj(flipCoords(x1,y1,x2,y2));};function makeObj(a)
+{return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};};return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}();var Selection=function()
+{var start,end,dragmode,awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;if(options.drawBorders){borders={top:insertBorder('hline').css('top',$.browser.msie?px(-1):px(0)),bottom:insertBorder('hline'),left:insertBorder('vline'),right:insertBorder('vline')};}
+if(options.dragEdges){handle.t=insertDragbar('n');handle.b=insertDragbar('s');handle.r=insertDragbar('e');handle.l=insertDragbar('w');}
+options.sideHandles&&createHandles(['n','s','e','w']);options.cornerHandles&&createHandles(['sw','nw','ne','se']);function insertBorder(type)
+{var jq=$('<div />').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;};function dragDiv(ord,zi)
+{var jq=$('<div />').mousedown(createDragger(ord)).css({cursor:ord+'-resize',position:'absolute',zIndex:zi});$hdl_holder.append(jq);return jq;};function insertHandle(ord)
+{return dragDiv(ord,hdep++).css({top:px(-hhs+1),left:px(-hhs+1),opacity:options.handleOpacity}).addClass(cssClass('handle'));};function insertDragbar(ord)
+{var s=options.handleSize,o=hhs,h=s,w=s,t=o,l=o;switch(ord)
+{case'n':case's':w=pct(100);break;case'e':case'w':h=pct(100);break;}
+return dragDiv(ord,hdep++).width(w).height(h).css({top:px(-t+1),left:px(-l+1)});};function createHandles(li)
+{for(i in li)handle[li[i]]=insertHandle(li[i]);};function moveHandles(c)
+{var midvert=Math.round((c.h/2)-hhs),midhoriz=Math.round((c.w/2)-hhs),north=west=-hhs+1,east=c.w-hhs,south=c.h-hhs,x,y;'e'in handle&&handle.e.css({top:px(midvert),left:px(east)})&&handle.w.css({top:px(midvert)})&&handle.s.css({top:px(south),left:px(midhoriz)})&&handle.n.css({left:px(midhoriz)});'ne'in handle&&handle.ne.css({left:px(east)})&&handle.se.css({top:px(south),left:px(east)})&&handle.sw.css({top:px(south)});'b'in handle&&handle.b.css({top:px(south)})&&handle.r.css({left:px(east)});};function moveto(x,y)
+{$img2.css({top:px(-y),left:px(-x)});$sel.css({top:px(y),left:px(x)});};function resize(w,h)
+{$sel.width(w).height(h);};function refresh()
+{var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible();};function updateVisible()
+{if(awake)return update();};function update()
+{var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);options.drawBorders&&borders['right'].css({left:px(c.w-1)})&&borders['bottom'].css({top:px(c.h-1)});seehandles&&moveHandles(c);awake||show();options.onChange(unscale(c));};function show()
+{$sel.show();$img.css('opacity',options.bgOpacity);awake=true;};function release()
+{disableHandles();$sel.hide();$img.css('opacity',1);awake=false;};function showHandles()
+{if(seehandles)
+{moveHandles(Coords.getFixed());$hdl_holder.show();}};function enableHandles()
+{seehandles=true;if(options.allowResize)
+{moveHandles(Coords.getFixed());$hdl_holder.show();return true;}};function disableHandles()
+{seehandles=false;$hdl_holder.hide();};function animMode(v)
+{(animating=v)?disableHandles():enableHandles();};function done()
+{animMode(false);refresh();};var $track=newTracker().mousedown(createDragger('move')).css({cursor:'move',position:'absolute',zIndex:360})
+$img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,setCursor:function(cursor){$track.css('cursor',cursor);},enableHandles:enableHandles,enableOnly:function(){seehandles=true;},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,done:done};}();var Tracker=function()
+{var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;if(!trackDoc)
+{$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp);}
+function toFront()
+{$trk.css({zIndex:450});if(trackDoc)
+{$(document).mousemove(trackMove).mouseup(trackUp);}}
+function toBack()
+{$trk.css({zIndex:290});if(trackDoc)
+{$(document).unbind('mousemove',trackMove).unbind('mouseup',trackUp);}}
+function trackMove(e)
+{onMove(mouseAbs(e));};function trackUp(e)
+{e.preventDefault();e.stopPropagation();if(btndown)
+{btndown=false;onDone(mouseAbs(e));options.onSelect(unscale(Coords.getFixed()));toBack();onMove=function(){};onDone=function(){};}
+return false;};function activateHandlers(move,done)
+{btndown=true;onMove=move;onDone=done;toFront();return false;};function setCursor(t){$trk.css('cursor',t);};$img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor};}();var KeyManager=function()
+{var $keymgr=$('<input type="radio" />').css({position:'absolute',left:'-30px'}).keypress(parseKey).blur(onBlur),$keywrap=$('<div />').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys()
+{if(options.keySupport)
+{$keymgr.show();$keymgr.focus();}};function onBlur(e)
+{$keymgr.hide();};function doNudge(e,x,y)
+{if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible();};e.preventDefault();e.stopPropagation();};function parseKey(e)
+{if(e.ctrlKey)return true;shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode)
+{case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:Selection.release();break;case 9:return true;}
+return nothing(e);};if(options.keySupport)$keywrap.insertBefore($img);return{watchKeys:watchKeys};}();function px(n){return''+parseInt(n)+'px';};function pct(n){return''+parseInt(n)+'%';};function cssClass(cl){return options.baseClass+'-'+cl;};function getPos(obj)
+{var pos=$(obj).offset();return[pos.left,pos.top];};function mouseAbs(e)
+{return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])];};function myCursor(type)
+{if(type!=lastcurs)
+{Tracker.setCursor(type);lastcurs=type;}};function startDragMode(mode,pos)
+{docOffset=getPos($img);Tracker.setCursor(mode=='move'?mode:mode+'-resize');if(mode=='move')
+return Tracker.activateHandlers(createMover(pos),doneSelect);var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect);};function dragmodeHandler(mode,f)
+{return function(pos){if(!options.aspectRatio)switch(mode)
+{case'e':pos[1]=f.y2;break;case'w':pos[1]=f.y2;break;case'n':pos[0]=f.x2;break;case's':pos[0]=f.x2;break;}
+else switch(mode)
+{case'e':pos[1]=f.y+1;break;case'w':pos[1]=f.y+1;break;case'n':pos[0]=f.x+1;break;case's':pos[0]=f.x+1;break;}
+Coords.setCurrent(pos);Selection.update();};};function createMover(pos)
+{var lloc=pos;KeyManager.watchKeys();return function(pos)
+{Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update();};};function oppLockCorner(ord)
+{switch(ord)
+{case'n':return'sw';case's':return'nw';case'e':return'nw';case'w':return'ne';case'ne':return'sw';case'nw':return'se';case'se':return'nw';case'sw':return'ne';};};function createDragger(ord)
+{return function(e){if(options.disabled)return false;if((ord=='move')&&!options.allowMove)return false;btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};};function presize($obj,w,h)
+{var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0)
+{nw=w;nh=(w/$obj.width())*$obj.height();}
+if((nh>h)&&h>0)
+{nh=h;nw=(h/$obj.height())*$obj.width();}
+xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);};function unscale(c)
+{return{x:parseInt(c.x*xscale),y:parseInt(c.y*yscale),x2:parseInt(c.x2*xscale),y2:parseInt(c.y2*yscale),w:parseInt(c.w*xscale),h:parseInt(c.h*yscale)};};function doneSelect(pos)
+{var c=Coords.getFixed();if(c.w>options.minSelect[0]&&c.h>options.minSelect[1])
+{Selection.enableHandles();Selection.done();}
+else
+{Selection.release();}
+Tracker.setCursor(options.allowSelect?'crosshair':'default');};function newSelection(e)
+{if(options.disabled)return false;if(!options.allowSelect)return false;btndown=true;docOffset=getPos($img);Selection.disableHandles();myCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();Selection.update();e.stopPropagation();e.preventDefault();return false;};function selectDrag(pos)
+{Coords.setCurrent(pos);Selection.update();};function newTracker()
+{var trk=$('<div></div>').addClass(cssClass('tracker'));$.browser.msie&&trk.css({opacity:0,backgroundColor:'white'});return trk;};function animateTo(a)
+{var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating)return;var animto=Coords.flipCoords(x1,y1,x2,y2);var c=Coords.getFixed();var animat=initcr=[c.x,c.y,c.x2,c.y2];var interv=options.animationDelay;var x=animat[0];var y=animat[1];var x2=animat[2];var y2=animat[3];var ix1=animto[0]-initcr[0];var iy1=animto[1]-initcr[1];var ix2=animto[2]-initcr[2];var iy2=animto[3]-initcr[3];var pcent=0;var velocity=options.swingSpeed;Selection.animMode(true);var animator=function()
+{return function()
+{pcent+=(100-pcent)/velocity;animat[0]=x+((pcent/100)*ix1);animat[1]=y+((pcent/100)*iy1);animat[2]=x2+((pcent/100)*ix2);animat[3]=y2+((pcent/100)*iy2);if(pcent<100)animateStart();else Selection.done();if(pcent>=99.8)pcent=100;setSelectRaw(animat);};}();function animateStart()
+{window.setTimeout(animator,interv);};animateStart();};function setSelect(rect)
+{setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);};function setSelectRaw(l)
+{Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();};function setOptions(opt)
+{if(typeof(opt)!='object')opt={};options=$.extend(options,opt);if(typeof(options.onChange)!=='function')
+options.onChange=function(){};if(typeof(options.onSelect)!=='function')
+options.onSelect=function(){};};function tellSelect()
+{return unscale(Coords.getFixed());};function tellScaled()
+{return Coords.getFixed();};function setOptionsNew(opt)
+{setOptions(opt);interfaceUpdate();};function disableCrop()
+{options.disabled=true;Selection.disableHandles();Selection.setCursor('default');Tracker.setCursor('default');};function enableCrop()
+{options.disabled=false;interfaceUpdate();};function cancelCrop()
+{Selection.done();Tracker.activateHandlers(null,null);};function destroy()
+{$div.remove();$origimg.show();};function interfaceUpdate(alt)
+{options.allowResize?alt?Selection.enableOnly():Selection.enableHandles():Selection.disableHandles();Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');$div.css('backgroundColor',options.bgColor);if('setSelect'in options){setSelect(opt.setSelect);Selection.done();delete(options.setSelect);}
+if('trueSize'in options){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}
+xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if('outerImage'in options)
+{$img.attr('src',options.outerImage);delete(options.outerImage);}
+Selection.refresh();};$hdl_holder.hide();interfaceUpdate(true);var api={animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},release:Selection.release,destroy:destroy};$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options)
+{function attachWhenDone(from)
+{var loadsrc=options.useImg||from.src;var img=new Image();img.onload=function(){$.Jcrop(from,options);};img.src=loadsrc;};if(typeof(options)!=='object')options={};this.each(function()
+{if($(this).data('Jcrop'))
+{if(options=='api')return $(this).data('Jcrop');else $(this).data('Jcrop').setOptions(options);}
+else attachWhenDone(this);});return this;};})(jQuery);
\ No newline at end of file
index c48d365d3a85d3ad517e277b60eeacad59daafbf..6d00f2e63b7f2d670d6f4b0d27f41c09fbc57e78 100644 (file)
@@ -1,12 +1,12 @@
-/**\r
- * Interface Elements for jQuery\r
- * \r
- * http://interface.eyecon.ro\r
- * \r
- * Copyright (c) 2006 Stefan Petre\r
- * Dual licensed under the MIT (MIT-LICENSE.txt) \r
- * and GPL (GPL-LICENSE.txt) licenses.\r
- *   \r
- *\r
- */\r
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('A.cP={2l:C(c){G B.1y(C(){if(!c.8Y||!c.8P)G;F b=B;b.2a={9M:c.9M||bz,8Y:c.8Y,8P:c.8P,7R:c.7R||\'du\',9c:c.9c||\'du\',2K:c.2K&&28 c.2K==\'C\'?c.2K:H,2V:c.2K&&28 c.2V==\'C\'?c.2V:H,6D:c.6D&&28 c.6D==\'C\'?c.6D:H,8A:A(c.8Y,B),8a:A(c.8P,B),1l:c.1l||7n,5w:c.5w||0};b.2a.8a.2x().E(\'S\',\'9e\').eq(0).E({S:b.2a.9M+\'Q\',11:\'2v\'}).3m();b.2a.8A.1y(C(a){B.6L=a}).ht(C(){A(B).2H(b.2a.9c)},C(){A(B).3S(b.2a.9c)}).1C(\'4U\',C(e){if(b.2a.5w==B.6L)G;b.2a.8A.eq(b.2a.5w).3S(b.2a.7R).3m().eq(B.6L).2H(b.2a.7R).3m();b.2a.8a.eq(b.2a.5w).4S({S:0},b.2a.1l,C(){B.Y.11=\'1k\';if(b.2a.2V){b.2a.2V.1x(b,[B])}}).3m().eq(B.6L).1S().4S({S:b.2a.9M},b.2a.1l,C(){B.Y.11=\'2v\';if(b.2a.2K){b.2a.2K.1x(b,[B])}}).3m();if(b.2a.6D){b.2a.6D.1x(b,[B,b.2a.8a.I(B.6L),b.2a.8A.I(b.2a.5w),b.2a.8a.I(b.2a.5w)])}b.2a.5w=B.6L}).eq(0).2H(b.2a.7R).3m();A(B).E(\'S\',A(B).E(\'S\')).E(\'2N\',\'2B\')})}};A.fn.fe=A.cP.2l;A.8p={2l:C(h){G B.1y(C(){F c=B;F d=2*Z.2F/eD;F f=2*Z.2F;if(A(c).E(\'T\')!=\'2i\'&&A(c).E(\'T\')!=\'1J\'){A(c).E(\'T\',\'2i\')}c.1i={1M:A(h.1M,B),2y:h.2y,61:h.61,9l:h.9l,iu:f,1N:A.12.2f(B),T:A.12.3a(B),2b:Z.2F/2,b4:h.b4,7K:h.5U,5U:[],93:H,7G:2*Z.2F/eD};c.1i.d8=(c.1i.1N.w-c.1i.2y)/2;c.1i.6Y=(c.1i.1N.h-c.1i.61-c.1i.61*c.1i.7K)/2;c.1i.3f=2*Z.2F/c.1i.1M.1N();c.1i.aS=c.1i.1N.w/2;c.1i.aR=c.1i.1N.h/2-c.1i.61*c.1i.7K;F g=1c.3x(\'1W\');A(g).E({T:\'1J\',3j:1,O:0,M:0});A(c).1L(g);c.1i.1M.1y(C(a){8G=A(\'3O\',B).I(0);S=R(c.1i.61*c.1i.7K);if(A.2R.46){3u=1c.3x(\'3O\');A(3u).E(\'T\',\'1J\');3u.2E=8G.2E;3u.Y.4X=\'fu 9x:9C.9E.a6(1E=60, Y=1, fc=0, f9=0, f5=0, f3=0)\'}L{3u=1c.3x(\'3u\');if(3u.bZ){4j=3u.bZ("2d");3u.Y.T=\'1J\';3u.Y.S=S+\'Q\';3u.Y.V=c.1i.2y+\'Q\';3u.S=S;3u.V=c.1i.2y;4j.eR();4j.eM(0,S);4j.eJ(1,-1);4j.jm(8G,0,0,c.1i.2y,S);4j.bL();4j.jl="jh-3U";F b=4j.jf(0,0,0,S);b.es(1,"eg(1O, 1O, 1O, 1)");b.es(0,"eg(1O, 1O, 1O, 0.6)");4j.j9=b;if(j7.j5.3o(\'iX\')!=-1){4j.iV()}L{4j.iS(0,0,c.1i.2y,S)}}}c.1i.5U[a]=3u;A(g).1L(3u)}).1C(\'9r\',C(e){c.1i.93=14;c.1i.1l=c.1i.7G*0.1*c.1i.1l/Z.3B(c.1i.1l);G H}).1C(\'86\',C(e){c.1i.93=H;G H});A.8p.6z(c);c.1i.1l=c.1i.7G*0.2;c.1i.it=1P.5Y(C(){c.1i.2b+=c.1i.1l;if(c.1i.2b>f)c.1i.2b=0;A.8p.6z(c)},20);A(c).1C(\'86\',C(){c.1i.1l=c.1i.7G*0.2*c.1i.1l/Z.3B(c.1i.1l)}).1C(\'3t\',C(e){if(c.1i.93==H){1A=A.12.3W(e);dr=c.1i.1N.w-1A.x+c.1i.T.x;c.1i.1l=c.1i.b4*c.1i.7G*(c.1i.1N.w/2-dr)/(c.1i.1N.w/2)}})})},6z:C(b){b.1i.1M.1y(C(a){b8=b.1i.2b+a*b.1i.3f;x=b.1i.d8*Z.51(b8);y=b.1i.6Y*Z.7L(b8);do=R(1Y*(b.1i.6Y+y)/(2*b.1i.6Y));dm=(b.1i.6Y+y)/(2*b.1i.6Y);V=R((b.1i.2y-b.1i.9l)*dm+b.1i.9l);S=R(V*b.1i.61/b.1i.2y);B.Y.O=b.1i.aR+y-S/2+"Q";B.Y.M=b.1i.aS+x-V/2+"Q";B.Y.V=V+"Q";B.Y.S=S+"Q";B.Y.3j=do;b.1i.5U[a].Y.O=R(b.1i.aR+y+S-1-S/2)+"Q";b.1i.5U[a].Y.M=R(b.1i.aS+x-V/2)+"Q";b.1i.5U[a].Y.V=V+"Q";b.1i.5U[a].Y.S=R(S*b.1i.7K)+"Q"})}};A.fn.hL=A.8p.2l;A.1U({1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a},ho:C(p,n,a,b,c){G b*(n/=c)*n*n+a},d2:C(p,n,a,b,c){G-b*((n=n/c-1)*n*n*n-1)+a},hh:C(p,n,a,b,c){if((n/=c/2)<1)G b/2*n*n*n*n+a;G-b/2*((n-=2)*n*n*n-2)+a},7D:C(p,n,a,b,c){if((n/=c)<(1/2.75)){G b*(7.8W*n*n)+a}L if(n<(2/2.75)){G b*(7.8W*(n-=(1.5/2.75))*n+.75)+a}L if(n<(2.5/2.75)){G b*(7.8W*(n-=(2.25/2.75))*n+.gV)+a}L{G b*(7.8W*(n-=(2.gR/2.75))*n+.gN)+a}},aQ:C(p,n,a,b,c){if(A.1e.7D)G b-A.1e.7D(p,c-n,0,b,c)+a;G a+b},gE:C(p,n,a,b,c){if(A.1e.aQ&&A.1e.7D)if(n<c/2)G A.1e.aQ(p,n*2,0,b,c)*.5+a;G A.1e.7D(p,n*2-c,0,b,c)*.5+b*.5+a;G a+b},gz:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d)==1)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}G-(a*Z.5j(2,10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p))+b},gg:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d/2)==2)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}G a*Z.5j(2,-10*n)*Z.7L((n*d-s)*(2*Z.2F)/p)+c+b},gd:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d/2)==2)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}if(n<1){G-.5*(a*Z.5j(2,10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p))+b}G a*Z.5j(2,-10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p)*.5+c+b}}});A.5K={2l:C(h){G B.1y(C(){F g=B;g.1z={1M:A(h.1M,B),2q:A(h.2q,B),1I:A.12.3a(B),2y:h.2y,8K:h.8K,6q:h.6q,cG:h.cG,4I:h.4I,5R:h.5R};A.5K.8F(g,0);A(1P).1C(\'fR\',C(){g.1z.1I=A.12.3a(g);A.5K.8F(g,0);A.5K.6z(g)});A.5K.6z(g);g.1z.1M.1C(\'9r\',C(){A(g.1z.8K,B).I(0).Y.11=\'2v\'}).1C(\'86\',C(){A(g.1z.8K,B).I(0).Y.11=\'1k\'});A(1c).1C(\'3t\',C(e){F b=A.12.3W(e);F c=0;if(g.1z.4I&&g.1z.4I==\'az\')F d=b.x-g.1z.1I.x-(g.3P-g.1z.2y*g.1z.1M.1N())/2-g.1z.2y/2;L if(g.1z.4I&&g.1z.4I==\'2D\')F d=b.x-g.1z.1I.x-g.3P+g.1z.2y*g.1z.1M.1N();L F d=b.x-g.1z.1I.x;F f=Z.5j(b.y-g.1z.1I.y-g.5r/2,2);g.1z.1M.1y(C(a){3J=Z.cB(Z.5j(d-a*g.1z.2y,2)+f);3J-=g.1z.2y/2;3J=3J<0?0:3J;3J=3J>g.1z.6q?g.1z.6q:3J;3J=g.1z.6q-3J;bc=g.1z.5R*3J/g.1z.6q;B.Y.V=g.1z.2y+bc+\'Q\';B.Y.M=g.1z.2y*a+c+\'Q\';c+=bc});A.5K.8F(g,c)})})},8F:C(a,b){if(a.1z.4I)if(a.1z.4I==\'az\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())/2-b/2+\'Q\';L if(a.1z.4I==\'M\')a.1z.2q.I(0).Y.M=-b/a.1z.1M.1N()+\'Q\';L if(a.1z.4I==\'2D\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())-b/2+\'Q\';a.1z.2q.I(0).Y.V=a.1z.2y*a.1z.1M.1N()+b+\'Q\'},6z:C(b){b.1z.1M.1y(C(a){B.Y.V=b.1z.2y+\'Q\';B.Y.M=b.1z.2y*a+\'Q\'})}};A.fn.fz=A.5K.2l;A.K={18:P,7W:P,3q:P,2A:P,4b:P,af:P,2r:P,2h:P,1M:P,58:C(){A.K.7W.58();if(A.K.3q){A.K.3q.2x()}},4i:C(){A.K.1M=P;A.K.2h=P;A.K.4b=A.K.2r.2m;if(A.K.18.E(\'11\')==\'2v\'){if(A.K.2r.1a.fx){2X(A.K.2r.1a.fx.1K){19\'a4\':A.K.18.6d(A.K.2r.1a.fx.1H,A.K.58);1n;19\'1u\':A.K.18.c6(A.K.2r.1a.fx.1H,A.K.58);1n;19\'8o\':A.K.18.c3(A.K.2r.1a.fx.1H,A.K.58);1n}}L{A.K.18.2x()}if(A.K.2r.1a.2V)A.K.2r.1a.2V.1x(A.K.2r,[A.K.18,A.K.3q])}L{A.K.58()}1P.a2(A.K.2A)},c1:C(){F e=A.K.2r;F f=A.K.8C(e);if(e&&f.3w!=A.K.4b&&f.3w.1b>=e.1a.8N){A.K.4b=f.3w;A.K.af=f.3w;9V={bR:A(e).1m(\'eS\')||\'bR\',2m:f.3w};A.eQ({1K:\'eN\',9V:A.eL(9V),eK:C(b){e.1a.3X=A(\'3w\',b);1N=e.1a.3X.1N();if(1N>0){F c=\'\';e.1a.3X.1y(C(a){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'</7b>\'});if(e.1a.9K){F d=A(\'2m\',e.1a.3X.I(0)).3D();e.2m=f.30+d+e.1a.3y+f.5m;A.K.64(e,f.3w.1b!=d.1b?(f.30.1b+f.3w.1b):d.1b,f.3w.1b!=d.1b?(f.30.1b+d.1b):d.1b)}if(1N>0){A.K.aU(e,c)}L{A.K.4i()}}L{A.K.4i()}},5v:e.1a.96})}},aU:C(a,b){A.K.7W.3i(b);A.K.1M=A(\'7b\',A.K.7W.I(0));A.K.1M.9r(A.K.en).1C(\'4U\',A.K.ed);F c=A.12.3a(a);F d=A.12.2f(a);A.K.18.E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').2H(a.1a.9D);if(A.K.3q){A.K.3q.E(\'11\',\'2v\').E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').E(\'V\',A.K.18.E(\'V\')).E(\'S\',A.K.18.E(\'S\'))}A.K.2h=0;A.K.1M.I(0).2Z=a.1a.72;A.K.7I(a,a.1a.3X.I(0),\'6H\');if(A.K.18.E(\'11\')==\'1k\'){if(a.1a.bv){F e=A.12.9y(a,14);F f=A.12.6b(a,14);A.K.18.E(\'V\',a.3P-(A.e0?(e.l+e.r+f.l+f.r):0)+\'Q\')}if(a.1a.fx){2X(a.1a.fx.1K){19\'a4\':A.K.18.6U(a.1a.fx.1H);1n;19\'1u\':A.K.18.dR(a.1a.fx.1H);1n;19\'8o\':A.K.18.dP(a.1a.fx.1H);1n}}L{A.K.18.1S()}if(A.K.2r.1a.2K)A.K.2r.1a.2K.1x(A.K.2r,[A.K.18,A.K.3q])}},dM:C(){F b=B;if(b.1a.3X){A.K.4b=b.2m;A.K.af=b.2m;F c=\'\';b.1a.3X.1y(C(a){2m=A(\'2m\',B).3D().5u();dH=b.2m.5u();if(2m.3o(dH)==0){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'</7b>\'}});if(c!=\'\'){A.K.aU(b,c);B.1a.9s=14;G}}b.1a.3X=P;B.1a.9s=H},64:C(a,b,c){if(a.9q){F d=a.9q();d.iJ(14);d.dC("bh",b);d.iE("bh",-c+b);d.7Q()}L if(a.9m){a.9m(b,c)}L{if(a.88){a.88=b;a.dA=c}}a.6a()},dw:C(a){if(a.88)G a.88;L if(a.9q){F b=1c.64.dv();F c=b.il();G 0-c.dC(\'bh\',-ij)}},8C:C(a){F b={2m:a.2m,30:\'\',5m:\'\',3w:\'\'};if(a.1a.9k){F c=H;F d=A.K.dw(a)||0;F e=b.2m.6W(a.1a.3y);1V(F i=0;i<e.1b;i++){if((b.30.1b+e[i].1b>=d||d==0)&&!c){if(b.30.1b<=d)b.3w=e[i];L b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\');c=14}L if(c){b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\')}if(!c){b.30+=e[i]+(e.1b>1?a.1a.3y:\'\')}}}L{b.3w=b.2m}G b},b9:C(e){1P.a2(A.K.2A);F a=A.K.8C(B);F b=e.6S||e.6R||-1;if(/13|27|35|36|38|40|9/.3M(b)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';L A.K.2h=-1;2X(b){19 9:19 13:if(A.K.2h==-1)A.K.2h=0;F c=A.K.1M.I(A.K.2h||0);F d=c.4Z(\'4o\');B.2m=a.30+d+B.1a.3y+a.5m;A.K.4b=a.3w;A.K.64(B,a.30.1b+d.1b+B.1a.3y.1b,a.30.1b+d.1b+B.1a.3y.1b);A.K.4i();if(B.1a.5p){4E=R(c.4Z(\'8h\'))||0;A.K.7I(B,B.1a.3X.I(4E),\'5p\')}if(B.6O)B.6O(H);G b!=13;1n;19 27:B.2m=a.30+A.K.4b+B.1a.3y+a.5m;B.1a.3X=P;A.K.4i();if(B.6O)B.6O(H);G H;1n;19 35:A.K.2h=A.K.1M.1N()-1;1n;19 36:A.K.2h=0;1n;19 38:A.K.2h--;if(A.K.2h<0)A.K.2h=A.K.1M.1N()-1;1n;19 40:A.K.2h++;if(A.K.2h==A.K.1M.1N())A.K.2h=0;1n}A.K.7I(B,B.1a.3X.I(A.K.2h||0),\'6H\');A.K.1M.I(A.K.2h||0).2Z=B.1a.72;if(A.K.1M.I(A.K.2h||0).6O)A.K.1M.I(A.K.2h||0).6O(H);if(B.1a.9K){F f=A.K.1M.I(A.K.2h||0).4Z(\'4o\');B.2m=a.30+f+B.1a.3y+a.5m;if(A.K.4b.1b!=f.1b)A.K.64(B,a.30.1b+A.K.4b.1b,a.30.1b+f.1b)}G H}A.K.dM.1x(B);if(B.1a.9s==H){if(a.3w!=A.K.4b&&a.3w.1b>=B.1a.8N)A.K.2A=1P.97(A.K.c1,B.1a.4w);if(A.K.1M){A.K.4i()}}G 14},7I:C(a,b,c){if(a.1a[c]){F d={};94=b.dj(\'*\');1V(i=0;i<94.1b;i++){d[94[i].4D]=94[i].6M.hG}a.1a[c].1x(a,[d])}},en:C(e){if(A.K.1M){if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.2h=R(B.4Z(\'8h\'))||0;A.K.1M.I(A.K.2h||0).2Z=A.K.2r.1a.72}},ed:C(a){1P.a2(A.K.2A);a=a||A.3N.hD(1P.3N);a.9b();a.99();F b=A.K.8C(A.K.2r);F c=B.4Z(\'4o\');A.K.2r.2m=b.30+c+A.K.2r.1a.3y+b.5m;A.K.4b=B.4Z(\'4o\');A.K.64(A.K.2r,b.30.1b+c.1b+A.K.2r.1a.3y.1b,b.30.1b+c.1b+A.K.2r.1a.3y.1b);A.K.4i();if(A.K.2r.1a.5p){4E=R(B.4Z(\'8h\'))||0;A.K.7I(A.K.2r,A.K.2r.1a.3X.I(4E),\'5p\')}G H},dh:C(e){6K=e.6S||e.6R||-1;if(/13|27|35|36|38|40/.3M(6K)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}G H}},2l:C(a){if(!a.96||!A.12){G}if(!A.K.18){if(A.2R.46){A(\'23\',1c).1L(\'<3q Y="11:1k;T:1J;4X:9x:9C.9E.a6(1E=0);" id="df" 2E="dc:H;" da="0" d7="b0"></3q>\');A.K.3q=A(\'#df\')}A(\'23\',1c).1L(\'<1W id="d4" Y="T: 1J; O: 0; M: 0; z-aY: hj; 11: 1k;"><90 Y="5X: 0;7E: 0; h9-Y: 1k; z-aY: h8;">&6G;</90></1W>\');A.K.18=A(\'#d4\');A.K.7W=A(\'90\',A.K.18)}G B.1y(C(){if(B.4D!=\'aV\'&&B.4Z(\'1K\')!=\'3D\')G;B.1a={};B.1a.96=a.96;B.1a.8N=Z.3B(R(a.8N)||1);B.1a.9D=a.9D?a.9D:\'\';B.1a.72=a.72?a.72:\'\';B.1a.5p=a.5p&&a.5p.1F==2w?a.5p:P;B.1a.2K=a.2K&&a.2K.1F==2w?a.2K:P;B.1a.2V=a.2V&&a.2V.1F==2w?a.2V:P;B.1a.6H=a.6H&&a.6H.1F==2w?a.6H:P;B.1a.bv=a.bv||H;B.1a.9k=a.9k||H;B.1a.3y=B.1a.9k?(a.3y||\', \'):\'\';B.1a.9K=a.9K?14:H;B.1a.4w=Z.3B(R(a.4w)||8V);if(a.fx&&a.fx.1F==6E){if(!a.fx.1K||!/a4|1u|8o/.3M(a.fx.1K)){a.fx.1K=\'1u\'}if(a.fx.1K==\'1u\'&&!A.fx.1u)G;if(a.fx.1K==\'8o\'&&!A.fx.5l)G;a.fx.1H=Z.3B(R(a.fx.1H)||7n);if(a.fx.1H>B.1a.4w){a.fx.1H=B.1a.4w-1Y}B.1a.fx=a.fx}B.1a.3X=P;B.1a.9s=H;A(B).1m(\'b9\',\'cW\').6a(C(){A.K.2r=B;A.K.4b=B.2m}).cV(A.K.dh).5Q(A.K.b9).4W(C(){A.K.2A=1P.97(A.K.4i,gM)})})}};A.fn.gJ=A.K.2l;A.1t={2A:P,4k:P,1X:P,3f:10,2b:C(a,b,c,d){A.1t.4k=a;A.1t.1X=b;A.1t.3f=R(c)||10;A.1t.2A=1P.5Y(A.1t.cR,R(d)||40)},cR:C(){1V(i=0;i<A.1t.1X.1b;i++){if(!A.1t.1X[i].2J){A.1t.1X[i].2J=A.1U(A.12.6x(A.1t.1X[i]),A.12.6w(A.1t.1X[i]),A.12.5O(A.1t.1X[i]))}L{A.1t.1X[i].2J.t=A.1t.1X[i].2T;A.1t.1X[i].2J.l=A.1t.1X[i].2P}if(A.1t.4k.D&&A.1t.4k.D.6g==14){5a={x:A.1t.4k.D.2n,y:A.1t.4k.D.2j,1D:A.1t.4k.D.1w.1D,hb:A.1t.4k.D.1w.hb}}L{5a=A.1U(A.12.6x(A.1t.4k),A.12.6w(A.1t.4k))}if(A.1t.1X[i].2J.t>0&&A.1t.1X[i].2J.y+A.1t.1X[i].2J.t>5a.y){A.1t.1X[i].2T-=A.1t.3f}L if(A.1t.1X[i].2J.t<=A.1t.1X[i].2J.h&&A.1t.1X[i].2J.t+A.1t.1X[i].2J.hb<5a.y+5a.hb){A.1t.1X[i].2T+=A.1t.3f}if(A.1t.1X[i].2J.l>0&&A.1t.1X[i].2J.x+A.1t.1X[i].2J.l>5a.x){A.1t.1X[i].2P-=A.1t.3f}L if(A.1t.1X[i].2J.l<=A.1t.1X[i].2J.gf&&A.1t.1X[i].2J.l+A.1t.1X[i].2J.1D<5a.x+5a.1D){A.1t.1X[i].2P+=A.1t.3f}}},7w:C(){1P.5h(A.1t.2A);A.1t.4k=P;A.1t.1X=P;1V(i in A.1t.1X){A.1t.1X[i].2J=P}}};A.X={18:P,1g:P,4v:C(){G B.1y(C(){if(B.8L){B.D.cM.3h(\'4R\',A.X.aM);B.D=P;B.8L=H;if(A.2R.46){B.aI="cW"}L{B.Y.g0=\'\';B.Y.cJ=\'\';B.Y.cH=\'\'}}})},aM:C(e){if(A.X.1g!=P){A.X.8I(e);G H}F a=B.3H;A(1c).1C(\'3t\',A.X.aE).1C(\'5n\',A.X.8I);a.D.1A=A.12.3W(e);a.D.4d=a.D.1A;a.D.6g=H;a.D.fY=B!=B.3H;A.X.1g=a;if(a.D.4P&&B!=B.3H){aC=A.12.3a(a.2S);aZ=A.12.2f(a);ay={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};dx=a.D.4d.x-aC.x-aZ.1D/2-ay.x;dy=a.D.4d.y-aC.y-aZ.hb/2-ay.y;A.2Q.4s(a,[dx,dy])}G A.6J||H},cD:C(e){F a=A.X.1g;a.D.6g=14;F b=a.Y;a.D.6o=A.E(a,\'11\');a.D.49=A.E(a,\'T\');if(!a.D.av)a.D.av=a.D.49;a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.8z=0;a.D.8y=0;if(A.2R.46){F c=A.12.6b(a,14);a.D.8z=c.l||0;a.D.8y=c.t||0}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){b.T=\'2i\'}A.X.18.58();F d=A(a).cA(14).I(0);A(d).E({11:\'2v\',M:\'2G\',O:\'2G\'});d.Y.4M=\'0\';d.Y.53=\'0\';d.Y.4L=\'0\';d.Y.4K=\'0\';A.X.18.1L(d);F f=A.X.18.I(0).Y;if(a.D.ar){f.V=\'8x\';f.S=\'8x\'}L{f.S=a.D.1w.hb+\'Q\';f.V=a.D.1w.1D+\'Q\'}f.11=\'2v\';f.4M=\'2G\';f.53=\'2G\';f.4L=\'2G\';f.4K=\'2G\';A.1U(a.D.1w,A.12.2f(d));if(a.D.2M){if(a.D.2M.M){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.2M.M;a.D.1w.x=a.D.1A.x-a.D.2M.M}if(a.D.2M.O){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.2M.O;a.D.1w.y=a.D.1A.y-a.D.2M.O}if(a.D.2M.2D){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.1w.hb+a.D.2M.2D;a.D.1w.x=a.D.1A.x-a.D.1w.1D+a.D.2M.2D}if(a.D.2M.4e){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.1w.hb+a.D.2M.4e;a.D.1w.y=a.D.1A.y-a.D.1w.hb+a.D.2M.4e}}a.D.2n=a.D.22.x;a.D.2j=a.D.22.y;if(a.D.7V||a.D.2e==\'7X\'){7Z=A.12.6b(a.2S,14);a.D.1w.x=a.7Y+(A.2R.46?0:A.2R.6l?-7Z.l:7Z.l);a.D.1w.y=a.7t+(A.2R.46?0:A.2R.6l?-7Z.t:7Z.t);A(a.2S).1L(A.X.18.I(0))}if(a.D.2e){A.X.ah(a);a.D.4V.2e=A.X.ae}if(a.D.4P){A.2Q.ad(a)}f.M=a.D.1w.x-a.D.8z+\'Q\';f.O=a.D.1w.y-a.D.8y+\'Q\';f.V=a.D.1w.1D+\'Q\';f.S=a.D.1w.hb+\'Q\';A.X.1g.D.8w=H;if(a.D.gx){a.D.4V.5y=A.X.a9}if(a.D.3j!=H){A.X.18.E(\'3j\',a.D.3j)}if(a.D.1E){A.X.18.E(\'1E\',a.D.1E);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=\'+a.D.1E*1Y+\')\')}}if(a.D.6i){A.X.18.2H(a.D.6i);A.X.18.I(0).6M.Y.11=\'1k\'}if(a.D.4c)a.D.4c.1x(a,[d,a.D.22.x,a.D.22.y]);if(A.1s&&A.1s.7p>0){A.1s.ck(a)}if(a.D.3L==H){b.11=\'1k\'}G H},ah:C(a){if(a.D.2e.1F==8t){if(a.D.2e==\'7X\'){a.D.1Z=A.1U({x:0,y:0},A.12.2f(a.2S));F b=A.12.6b(a.2S,14);a.D.1Z.w=a.D.1Z.1D-b.l-b.r;a.D.1Z.h=a.D.1Z.hb-b.t-b.b}L if(a.D.2e==\'1c\'){F c=A.12.a5();a.D.1Z={x:0,y:0,w:c.w,h:c.h}}}L if(a.D.2e.1F==6h){a.D.1Z={x:R(a.D.2e[0])||0,y:R(a.D.2e[1])||0,w:R(a.D.2e[2])||0,h:R(a.D.2e[3])||0}}a.D.1Z.dx=a.D.1Z.x-a.D.1w.x;a.D.1Z.dy=a.D.1Z.y-a.D.1w.y},8r:C(a){if(a.D.7V||a.D.2e==\'7X\'){A(\'23\',1c).1L(A.X.18.I(0))}A.X.18.58().2x().E(\'1E\',1);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=1Y)\')}},8I:C(e){A(1c).3h(\'3t\',A.X.aE).3h(\'5n\',A.X.8I);if(A.X.1g==P){G}F a=A.X.1g;A.X.1g=P;if(a.D.6g==H){G H}if(a.D.3I==14){A(a).E(\'T\',a.D.49)}F b=a.Y;if(a.4P){A.X.18.E(\'7z\',\'7g\')}if(a.D.6i){A.X.18.3S(a.D.6i)}if(a.D.5B==H){if(a.D.fx>0){if(!a.D.2g||a.D.2g==\'3Z\'){F x=W A.fx(a,{1H:a.D.fx},\'M\');x.1G(a.D.22.x,a.D.7i)}if(!a.D.2g||a.D.2g==\'3K\'){F y=W A.fx(a,{1H:a.D.fx},\'O\');y.1G(a.D.22.y,a.D.7k)}}L{if(!a.D.2g||a.D.2g==\'3Z\')a.Y.M=a.D.7i+\'Q\';if(!a.D.2g||a.D.2g==\'3K\')a.Y.O=a.D.7k+\'Q\'}A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}L if(a.D.fx>0){a.D.8w=14;F c=H;if(A.1s&&A.1p&&a.D.3I){c=A.12.3a(A.1p.18.I(0))}A.X.18.4S({M:c?c.x:a.D.1w.x,O:c?c.y:a.D.1w.y},a.D.fx,C(){a.D.8w=H;if(a.D.3L==H){a.Y.11=a.D.6o}A.X.8r(a)})}L{A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}if(A.1s&&A.1s.7p>0){A.1s.c8(a)}if(A.1p&&a.D.3I){A.1p.c7(a)}if(a.D.2I&&(a.D.7i!=a.D.22.x||a.D.7k!=a.D.22.y)){a.D.2I.1x(a,a.D.aa||[0,0,a.D.7i,a.D.7k])}if(a.D.3C)a.D.3C.1x(a);G H},a9:C(x,y,a,b){if(a!=0)a=R((a+(B.D.gx*a/Z.3B(a))/2)/B.D.gx)*B.D.gx;if(b!=0)b=R((b+(B.D.gy*b/Z.3B(b))/2)/B.D.gy)*B.D.gy;G{dx:a,dy:b,x:0,y:0}},ae:C(x,y,a,b){a=Z.3k(Z.3g(a,B.D.1Z.dx),B.D.1Z.w+B.D.1Z.dx-B.D.1w.1D);b=Z.3k(Z.3g(b,B.D.1Z.dy),B.D.1Z.h+B.D.1Z.dy-B.D.1w.hb);G{dx:a,dy:b,x:0,y:0}},aE:C(e){if(A.X.1g==P||A.X.1g.D.8w==14){G}F a=A.X.1g;a.D.4d=A.12.3W(e);if(a.D.6g==H){3J=Z.cB(Z.5j(a.D.1A.x-a.D.4d.x,2)+Z.5j(a.D.1A.y-a.D.4d.y,2));if(3J<a.D.5D){G}L{A.X.cD(e)}}F b=a.D.4d.x-a.D.1A.x;F c=a.D.4d.y-a.D.1A.y;1V(F i in a.D.4V){F d=a.D.4V[i].1x(a,[a.D.22.x+b,a.D.22.y+c,b,c]);if(d&&d.1F==6E){b=i!=\'6f\'?d.dx:(d.x-a.D.22.x);c=i!=\'6f\'?d.dy:(d.y-a.D.22.y)}}a.D.2n=a.D.1w.x+b-a.D.8z;a.D.2j=a.D.1w.y+c-a.D.8y;if(a.D.4P&&(a.D.3n||a.D.2I)){A.2Q.3n(a,a.D.2n,a.D.2j)}if(a.D.4h)a.D.4h.1x(a,[a.D.22.x+b,a.D.22.y+c]);if(!a.D.2g||a.D.2g==\'3Z\'){a.D.7i=a.D.22.x+b;A.X.18.I(0).Y.M=a.D.2n+\'Q\'}if(!a.D.2g||a.D.2g==\'3K\'){a.D.7k=a.D.22.y+c;A.X.18.I(0).Y.O=a.D.2j+\'Q\'}if(A.1s&&A.1s.7p>0){A.1s.8n(a)}G H},2l:C(o){if(!A.X.18){A(\'23\',1c).1L(\'<1W id="bX"></1W>\');A.X.18=A(\'#bX\');F c=A.X.18.I(0);F d=c.Y;d.T=\'1J\';d.11=\'1k\';d.7z=\'7g\';d.bV=\'1k\';d.2N=\'2B\';if(1P.6j){c.aI="bU"}L{d.eZ=\'1k\';d.cH=\'1k\';d.cJ=\'1k\'}}if(!o){o={}}G B.1y(C(){if(B.8L||!A.12)G;if(1P.6j){B.eX=C(){G H};B.eW=C(){G H}}F a=B;F b=o.3c?A(B).eV(o.3c):A(B);if(A.2R.46){b.1y(C(){B.aI="bU"})}L{b.E(\'-eU-6f-7Q\',\'1k\');b.E(\'6f-7Q\',\'1k\');b.E(\'-eT-6f-7Q\',\'1k\')}B.D={cM:b,5B:o.5B?14:H,3L:o.3L?14:H,3I:o.3I?o.3I:H,4P:o.4P?o.4P:H,7V:o.7V?o.7V:H,3j:o.3j?R(o.3j)||0:H,1E:o.1E?2c(o.1E):H,fx:R(o.fx)||P,5z:o.5z?o.5z:H,4V:{},1A:{},4c:o.4c&&o.4c.1F==2w?o.4c:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2I:o.2I&&o.2I.1F==2w?o.2I:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:0,2M:o.2M?o.2M:H,ar:o.ar?14:H,6i:o.6i||H};if(o.4V&&o.4V.1F==2w)B.D.4V.6f=o.4V;if(o.4h&&o.4h.1F==2w)B.D.4h=o.4h;if(o.2e&&((o.2e.1F==8t&&(o.2e==\'7X\'||o.2e==\'1c\'))||(o.2e.1F==6h&&o.2e.1b==4))){B.D.2e=o.2e}if(o.2C){B.D.2C=o.2C}if(o.5y){if(28 o.5y==\'eO\'){B.D.gx=R(o.5y)||1;B.D.gy=R(o.5y)||1}L if(o.5y.1b==2){B.D.gx=R(o.5y[0])||1;B.D.gy=R(o.5y[1])||1}}if(o.3n&&o.3n.1F==2w){B.D.3n=o.3n}B.8L=14;b.1y(C(){B.3H=a});b.1C(\'4R\',A.X.aM)})}};A.fn.1U({8j:A.X.4v,6r:A.X.2l});A.1s={bP:C(a,b,c,d){G a<=A.X.1g.D.2n&&(a+c)>=(A.X.1g.D.2n+A.X.1g.D.1w.w)&&b<=A.X.1g.D.2j&&(b+d)>=(A.X.1g.D.2j+A.X.1g.D.1w.h)?14:H},9S:C(a,b,c,d){G!(a>(A.X.1g.D.2n+A.X.1g.D.1w.w)||(a+c)<A.X.1g.D.2n||b>(A.X.1g.D.2j+A.X.1g.D.1w.h)||(b+d)<A.X.1g.D.2j)?14:H},1A:C(a,b,c,d){G a<A.X.1g.D.4d.x&&(a+c)>A.X.1g.D.4d.x&&b<A.X.1g.D.4d.y&&(b+d)>A.X.1g.D.4d.y?14:H},4T:H,3z:{},7p:0,3p:{},ck:C(a){if(A.X.1g==P){G}F i;A.1s.3z={};F b=H;1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F c=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+c.1f.a)){if(c.1f.m==H){c.1f.p=A.1U(A.12.6x(c),A.12.6w(c));c.1f.m=14}if(c.1f.ac){A.1s.3p[i].2H(c.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&c.1f.s&&A.X.1g.D.3I){c.1f.el=A(\'.\'+c.1f.a,c);a.Y.11=\'1k\';A.1p.bM(c);c.1f.9P=A.1p.8g(A.1m(c,\'id\')).6A;a.Y.11=a.D.6o;b=14}if(c.1f.9O){c.1f.9O.1x(A.1s.3p[i].I(0),[A.X.1g])}}}}if(b){A.1p.2b()}},eF:C(){A.1s.3z={};1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F a=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+a.1f.a)){a.1f.p=A.1U(A.12.6x(a),A.12.6w(a));if(a.1f.ac){A.1s.3p[i].2H(a.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&a.1f.s&&A.X.1g.D.3I){a.1f.el=A(\'.\'+a.1f.a,a);bJ.Y.11=\'1k\';A.1p.bM(a);bJ.Y.11=bJ.D.6o}}}}},8n:C(e){if(A.X.1g==P){G}A.1s.4T=H;F i;F a=H;F b=0;1V(i in A.1s.3z){F c=A.1s.3z[i].I(0);if(A.1s.4T==H&&A.1s[c.1f.t](c.1f.p.x,c.1f.p.y,c.1f.p.1D,c.1f.p.hb)){if(c.1f.hc&&c.1f.h==H){A.1s.3z[i].2H(c.1f.hc)}if(c.1f.h==H&&c.1f.76){a=14}c.1f.h=14;A.1s.4T=c;if(A.1p&&c.1f.s&&A.X.1g.D.3I){A.1p.18.I(0).2Z=c.1f.eC;A.1p.8n(c)}b++}L if(c.1f.h==14){if(c.1f.6C){c.1f.6C.1x(c,[e,A.X.18.I(0).6M,c.1f.fx])}if(c.1f.hc){A.1s.3z[i].3S(c.1f.hc)}c.1f.h=H}}if(A.1p&&!A.1s.4T&&A.X.1g.3I){A.1p.18.I(0).Y.11=\'1k\'}if(a){A.1s.4T.1f.76.1x(A.1s.4T,[e,A.X.18.I(0).6M])}},c8:C(e){F i;1V(i in A.1s.3z){F a=A.1s.3z[i].I(0);if(a.1f.ac){A.1s.3z[i].3S(a.1f.ac)}if(a.1f.hc){A.1s.3z[i].3S(a.1f.hc)}if(a.1f.s){A.1p.73[A.1p.73.1b]=i}if(a.1f.9I&&a.1f.h==14){a.1f.h=H;a.1f.9I.1x(a,[e,a.1f.fx])}a.1f.m=H;a.1f.h=H}A.1s.3z={}},4v:C(){G B.1y(C(){if(B.8S){if(B.1f.s){id=A.1m(B,\'id\');A.1p.54[id]=P;A(\'.\'+B.1f.a,B).8j()}A.1s.3p[\'d\'+B.bG]=P;B.8S=H;B.f=P}})},2l:C(o){G B.1y(C(){if(B.8S==14||!o.3r||!A.12||!A.X){G}B.1f={a:o.3r,ac:o.9F||H,hc:o.8X||H,eC:o.4G||H,9I:o.je||o.9I||H,76:o.76||o.ev||H,6C:o.6C||o.er||H,9O:o.9O||H,t:o.5T&&(o.5T==\'bP\'||o.5T==\'9S\')?o.5T:\'1A\',fx:o.fx?o.fx:H,m:H,h:H};if(o.bC==14&&A.1p){id=A.1m(B,\'id\');A.1p.54[id]=B.1f.a;B.1f.s=14;if(o.2I){B.1f.2I=o.2I;B.1f.9P=A.1p.8g(id).6A}}B.8S=14;B.bG=R(Z.63()*aW);A.1s.3p[\'d\'+B.bG]=A(B);A.1s.7p++})}};A.fn.1U({ei:A.1s.4v,ee:A.1s.2l});A.jd=A.1s.eF;A.3l={18:P,89:C(){3D=B.2m;if(!3D)G;Y={eb:A(B).E(\'eb\')||\'\',4a:A(B).E(\'4a\')||\'\',87:A(B).E(\'87\')||\'\',e9:A(B).E(\'e9\')||\'\',e8:A(B).E(\'e8\')||\'\',e7:A(B).E(\'e7\')||\'\',bx:A(B).E(\'bx\')||\'\',e6:A(B).E(\'e6\')||\'\'};A.3l.18.E(Y);3i=A.3l.e5(3D);3i=3i.48(W bw("\\\\n","g"),"<br />");A.3l.18.3i(\'j6\');b3=A.3l.18.I(0).3P;A.3l.18.3i(3i);V=A.3l.18.I(0).3P+b3;if(B.66.65&&V>B.66.65[0]){V=B.66.65[0]}B.Y.V=V+\'Q\';if(B.4D==\'bs\'){S=A.3l.18.I(0).5r+b3;if(B.66.65&&S>B.66.65[1]){S=B.66.65[1]}B.Y.S=S+\'Q\'}},e5:C(a){bq={\'&\':\'&j1;\',\'<\':\'&j0;\',\'>\':\'&gt;\',\'"\':\'&iZ;\'};1V(i in bq){a=a.48(W bw(i,\'g\'),bq[i])}G a},2l:C(a){if(A.3l.18==P){A(\'23\',1c).1L(\'<1W id="dX" Y="T: 1J; O: 0; M: 0; 2W: 2B;"></1W>\');A.3l.18=A(\'#dX\')}G B.1y(C(){if(/bs|aV/.3M(B.4D)){if(B.4D==\'aV\'){dT=B.4Z(\'1K\');if(!/3D|iW/.3M(dT)){G}}if(a&&(a.1F==bm||(a.1F==6h&&a.1b==2))){if(a.1F==bm)a=[a,a];L{a[0]=R(a[0])||7n;a[1]=R(a[1])||7n}B.66={65:a}}A(B).4W(A.3l.89).5Q(A.3l.89).cV(A.3l.89);A.3l.89.1x(B)}})}};A.fn.iU=A.3l.2l;A.fn.1U({c3:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'4l\',c)})},dP:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'41\',c)})},iQ:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dG\',c)})},iM:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'M\',c)})},iL:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'2D\',c)})},iK:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dF\',c)})}});A.fx.5l=C(e,a,b,c,d){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1N=A.12.2f(e);z.1e=28 b==\'4B\'?b:d||P;if(!e.4f)e.4f=z.el.E(\'11\');if(c==\'dG\'){c=z.el.E(\'11\')==\'1k\'?\'41\':\'4l\'}L if(c==\'dF\'){c=z.el.E(\'11\')==\'1k\'?\'2D\':\'M\'}z.el.1S();z.1l=a;z.29=28 b==\'C\'?b:P;z.fx=A.fx.9u(e);z.6T=c;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.6T==\'41\'||z.6T==\'2D\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(z.fx.U.1o.hb,0);1n;19\'41\':z.fx.2Y.E(\'S\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(0,z.fx.U.1o.hb);1n;19\'M\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(z.fx.U.1o.1D,0);1n;19\'2D\':z.fx.2Y.E(\'V\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(0,z.fx.U.1o.1D);1n}};A.fn.iA=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.eu(B,a,b);e.bE()})};A.fx.eu=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.29=b;z.8e=R(a)||40;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.74=5;z.52=1;z.bE=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:io,1T:C(){z.e=W A.fx(z.el.I(0),{1H:80,1T:C(){z.8e=R(z.8e/2);if(z.52<=z.74)z.bE();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'O\');z.e.1G(z.U.O-z.8e,z.U.O)}},\'O\');z.e.1G(z.U.O,z.U.O-z.8e)}};A.fn.1U({im:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3U\',c)})},ik:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'in\',c)})},ii:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3E\',c)})},ig:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3U\',c)})},ie:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'in\',c)})},ic:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3E\',c)})},ib:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3U\',c)})},ia:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'in\',c)})},i9:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3E\',c)})},i8:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3U\',c)})},i7:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'in\',c)})},i6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3E\',c)})}});A.fx.3Y=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.U={};z.U.T=z.el.E(\'T\');z.U.O=z.el.E(\'O\');z.U.M=z.el.E(\'M\');if(!e.4f)e.4f=z.el.E(\'11\');if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}z.el.1S();if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.1K=d;b=28 b==\'C\'?b:P;7N=1;2X(c){19\'4l\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;7N=-1;1n;19\'41\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;1n;19\'2D\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;1n;19\'M\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;7N=-1;1n}z.e2=W A.fx(z.el.I(0),A.1l(a,z.1e,C(){z.el.E(z.U);if(z.1K==\'3U\'){z.el.E(\'11\',\'1k\')}L z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f);A.2z(z.el.I(0),\'1j\')}),\'1E\');if(d==\'in\'){z.e.1G(z.5x+1Y*7N,z.5x);z.e2.1G(0,1)}L{z.e.1G(z.5x,z.5x+1Y*7N);z.e2.1G(1,0)}};A.fn.1U({i5:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'dq\',d)})},i4:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'9g\',d)})},i3:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'3E\',d)})}});A.fx.9h=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 c==\'4B\'?c:f||P;z.29=28 c==\'C\'?c:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'9g\':\'dq\'}z.1l=a;z.S=b&&b.1F==bm?b:20;z.fx=A.fx.9u(e);z.1K=d;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.1K==\'9g\'){z.el.1S()}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};if(z.1K==\'9g\'){z.el.1S();z.fx.2Y.E(\'S\',z.S+\'Q\').E(\'V\',\'9e\');z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');z.ef.1G(z.S,z.fx.U.1o.hb)}),\'V\');z.ef.1G(0,z.fx.U.1o.1D)}L{z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');z.ef.1G(z.fx.U.1o.1D,0)}),\'S\');z.ef.1G(z.fx.U.1o.hb,z.S)}};A.fn.i2=C(c,d,e,f){G B.1r(\'dp\',C(){B.6Q=A(B).1m("Y")||\'\';f=28 e==\'4B\'?e:f||P;e=28 e==\'C\'?e:P;F a=A(B).E(\'6P\');F b=B.2S;6k(a==\'b7\'&&b){a=A(b).E(\'6P\');b=b.2S}A(B).E(\'6P\',d);if(28 B.6Q==\'7M\')B.6Q=B.6Q["9d"];A(B).4S({\'6P\':a},c,f,C(){A.2z(B,\'dp\');if(28 A(B).1m("Y")==\'7M\'){A(B).1m("Y")["9d"]="";A(B).1m("Y")["9d"]=B.6Q}L{A(B).1m("Y",B.6Q)}if(e)e.1x(B)})})};A.4n=C(e){if(/^i1$|^i0$|^hZ$|^5W$|^hY$|^hX$|^hW$|^hV$|^hU$|^23$|^hT$|^hS$|^hR$|^hQ$|^hP$|^hO$|^hN$/i.3M(e.98))G H;L G 14};A.fx.9n=C(e,a){F c=e.6M;F b=c.Y;b.T=a.T;b.4M=a.3s.t;b.4K=a.3s.l;b.4L=a.3s.b;b.53=a.3s.r;b.O=a.O+\'Q\';b.M=a.M+\'Q\';e.2S.dn(c,e);e.2S.hM(e)};A.fx.9u=C(e){if(!A.4n(e))G H;F t=A(e);F a=e.Y;F b=H;if(t.E(\'11\')==\'1k\'){95=t.E(\'2W\');t.E(\'2W\',\'2B\').1S();b=14}F c={};c.T=t.E(\'T\');c.1o=A.12.2f(e);c.3s=A.12.b2(e);F d=e.4u?e.4u.dk:t.E(\'hK\');c.O=R(t.E(\'O\'))||0;c.M=R(t.E(\'M\'))||0;F f=\'hJ\'+R(Z.63()*aW);F g=1c.3x(/^3O$|^br$|^hI$|^hr$|^7Q$|^hH$|^7M$|^3q$|^hF$|^hE$|^hC$|^90$|^dl$|^hB$/i.3M(e.98)?\'1W\':e.98);A.1m(g,\'id\',f);F h=A(g).2H(\'hA\');F i=g.Y;F j=0;F k=0;if(c.T==\'2i\'||c.T==\'1J\'){j=c.O;k=c.M}i.O=j+\'Q\';i.M=k+\'Q\';i.T=c.T!=\'2i\'&&c.T!=\'1J\'?\'2i\':c.T;i.S=c.1o.hb+\'Q\';i.V=c.1o.1D+\'Q\';i.4M=c.3s.t;i.53=c.3s.r;i.4L=c.3s.b;i.4K=c.3s.l;i.2N=\'2B\';if(A.2R.46){i.dk=d}L{i.hz=d}if(A.2R=="46"){a.4X="7s(1E="+0.dg*1Y+")"}a.1E=0.dg;e.2S.dn(g,e);g.hy(e);a.4M=\'2G\';a.53=\'2G\';a.4L=\'2G\';a.4K=\'2G\';a.T=\'1J\';a.bV=\'1k\';a.O=\'2G\';a.M=\'2G\';if(b){t.2x();a.2W=95}G{U:c,2Y:A(g)}};A.fx.7H={hx:[0,1O,1O],hw:[dd,1O,1O],hv:[db,db,hu],hs:[0,0,0],hq:[0,0,1O],hp:[d6,42,42],hn:[0,1O,1O],hm:[0,0,6N],hl:[0,6N,6N],hk:[aX,aX,aX],hi:[0,1Y,0],hg:[hf,he,cZ],hd:[6N,0,6N],ha:[85,cZ,47],h7:[1O,cY,0],h6:[h5,50,h4],h3:[6N,0,0],h2:[h1,cX,h0],gZ:[gY,0,8U],gX:[1O,0,1O],gW:[1O,gU,0],gT:[0,67,0],gS:[75,0,gQ],gP:[dd,cU,cY],gO:[gL,gK,cU],gI:[cT,1O,1O],gH:[cS,gG,cS],gF:[8U,8U,8U],gD:[1O,gC,gB],gA:[1O,1O,cT],gw:[0,1O,0],gv:[1O,0,1O],gu:[67,0,0],gs:[0,0,67],gr:[67,67,0],gq:[1O,d6,0],gp:[1O,8R,gn],gm:[67,0,67],gl:[1O,0,0],gk:[8R,8R,8R],gj:[1O,1O,1O],gi:[1O,1O,0]};A.fx.5L=C(a,b){if(A.fx.7H[a])G{r:A.fx.7H[a][0],g:A.fx.7H[a][1],b:A.fx.7H[a][2]};L if(2L=/^6v\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$/.8Q(a))G{r:R(2L[1]),g:R(2L[2]),b:R(2L[3])};L if(2L=/6v\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)$/.8Q(a))G{r:2c(2L[1])*2.55,g:2c(2L[2])*2.55,b:2c(2L[3])*2.55};L if(2L=/^#([a-fA-6t-9])([a-fA-6t-9])([a-fA-6t-9])$/.8Q(a))G{r:R("6s"+2L[1]+2L[1]),g:R("6s"+2L[2]+2L[2]),b:R("6s"+2L[3]+2L[3])};L if(2L=/^#([a-fA-6t-9]{2})([a-fA-6t-9]{2})([a-fA-6t-9]{2})$/.8Q(a))G{r:R("6s"+2L[1]),g:R("6s"+2L[2]),b:R("6s"+2L[3])};L G b==14?H:{r:1O,g:1O,b:1O}};A.fx.cQ={5d:1,4y:1,5i:1,4x:1,4e:1,4a:1,S:1,M:1,bx:1,gh:1,4L:1,4K:1,53:1,4M:1,7y:1,5R:1,7x:1,8O:1,1E:1,ge:1,gc:1,4Q:1,4F:1,5g:1,5b:1,2D:1,gb:1,O:1,V:1,3j:1};A.fx.cN={6P:1,ga:1,g9:1,g8:1,g7:1,g6:1,g5:1};A.fx.7v=[\'g4\',\'g3\',\'g2\',\'g1\'];A.fx.aL={\'aK\':[\'2u\',\'cK\'],\'8E\':[\'2u\',\'aH\'],\'5X\':[\'5X\',\'\'],\'7E\':[\'7E\',\'\']};A.fn.1U({4S:C(b,c,d,f){G B.1r(C(){F a=A.1l(c,d,f);F e=W A.cI(B,a,b)})},aG:C(b,c){G B.1r(C(){F a=A.1l(b,c);F e=W A.aG(B,a)})},7w:C(a){G B.1y(C(){if(B.5e)A.aF(B,a)})},fZ:C(a){G B.1y(C(){if(B.5e)A.aF(B,a);if(B.1r&&B.1r[\'fx\'])B.1r.fx=[]})}});A.1U({aG:C(a,b){F z=B,5f;z.3f=C(){if(A.cF(b.1T))b.1T.1x(a)};z.2A=5Y(C(){z.3f()},b.1H);a.5e=z},1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a}},cI:C(f,g,h){F z=B,5f;F y=f.Y;F k=A.E(f,"2N");F l=A.E(f,"11");F o={};z.9a=(W 6p()).6y();g.1e=g.1e&&A.1e[g.1e]?g.1e:\'b1\';z.8H=C(a,b){if(A.fx.cQ[a]){if(b==\'1S\'||b==\'2x\'||b==\'3E\'){if(!f.5I)f.5I={};F r=2c(A.5S(f,a));f.5I[a]=r&&r>-aW?r:(2c(A.E(f,a))||0);b=b==\'3E\'?(l==\'1k\'?\'1S\':\'2x\'):b;g[b]=14;o[a]=b==\'1S\'?[0,f.5I[a]]:[f.5I[a],0];if(a!=\'1E\')y[a]=o[a][0]+(a!=\'3j\'&&a!=\'87\'?\'Q\':\'\');L A.1m(y,"1E",o[a][0])}L{o[a]=[2c(A.5S(f,a)),2c(b)||0]}}L if(A.fx.cN[a])o[a]=[A.fx.5L(A.5S(f,a)),A.fx.5L(b)];L if(/^5X$|7E$|2u$|8E$|aK$/i.3M(a)){F m=b.48(/\\s+/g,\' \').48(/6v\\s*\\(\\s*/g,\'6v(\').48(/\\s*,\\s*/g,\',\').48(/\\s*\\)/g,\')\').aD(/([^\\s]+)/g);2X(a){19\'5X\':19\'7E\':19\'aK\':19\'8E\':m[3]=m[3]||m[1]||m[0];m[2]=m[2]||m[0];m[1]=m[1]||m[0];1V(F i=0;i<A.fx.7v.1b;i++){F c=A.fx.aL[a][0]+A.fx.7v[i]+A.fx.aL[a][1];o[c]=a==\'8E\'?[A.fx.5L(A.5S(f,c)),A.fx.5L(m[i])]:[2c(A.5S(f,c)),2c(m[i])]}1n;19\'2u\':1V(F i=0;i<m.1b;i++){F d=2c(m[i]);F e=!fX(d)?\'cK\':(!/b7|1k|2B|fW|fV|fU|fT|fS|fQ|fP|fO/i.3M(m[i])?\'aH\':H);if(e){1V(F j=0;j<A.fx.7v.1b;j++){c=\'2u\'+A.fx.7v[j]+e;o[c]=e==\'aH\'?[A.fx.5L(A.5S(f,c)),A.fx.5L(m[i])]:[2c(A.5S(f,c)),d]}}L{y[\'fN\']=m[i]}}1n}}L{y[a]=b}G H};1V(p in h){if(p==\'Y\'){F q=A.ax(h[p]);1V(6I in q){B.8H(6I,q[6I])}}L if(p==\'2Z\'){if(1c.8D)1V(F i=0;i<1c.8D.1b;i++){F s=1c.8D[i].fM||1c.8D[i].fL||P;if(s){1V(F j=0;j<s.1b;j++){if(s[j].fK==\'.\'+h[p]){F u=W bw(\'\\.\'+h[p]+\' {\');F v=s[j].Y.9d;F q=A.ax(v.48(u,\'\').48(/}/g,\'\'));1V(6I in q){B.8H(6I,q[6I])}}}}}}L{B.8H(p,h[p])}}y.11=l==\'1k\'?\'2v\':l;y.2N=\'2B\';z.3f=C(){F t=(W 6p()).6y();if(t>g.1H+z.9a){5h(z.2A);z.2A=P;1V(p in o){if(p=="1E")A.1m(y,"1E",o[p][1]);L if(28 o[p][1]==\'7M\')y[p]=\'6v(\'+o[p][1].r+\',\'+o[p][1].g+\',\'+o[p][1].b+\')\';L y[p]=o[p][1]+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}if(g.2x||g.1S)1V(F p in f.5I)if(p=="1E")A.1m(y,p,f.5I[p]);L y[p]="";y.11=g.2x?\'1k\':(l!=\'1k\'?l:\'2v\');y.2N=k;f.5e=P;if(A.cF(g.1T))g.1T.1x(f)}L{F n=t-B.9a;F a=n/g.1H;1V(p in o){if(28 o[p][1]==\'7M\'){y[p]=\'6v(\'+R(A.1e[g.1e](a,n,o[p][0].r,(o[p][1].r-o[p][0].r),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].g,(o[p][1].g-o[p][0].g),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].b,(o[p][1].b-o[p][0].b),g.1H))+\')\'}L{F b=A.1e[g.1e](a,n,o[p][0],(o[p][1]-o[p][0]),g.1H);if(p=="1E")A.1m(y,"1E",b);L y[p]=b+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}}}};z.2A=5Y(C(){z.3f()},13);f.5e=z},aF:C(a,b){if(b)a.5e.9a-=fJ;L{1P.5h(a.5e.2A);a.5e=P;A.2z(a,"fx")}}});A.ax=C(a){F b={};if(28 a==\'4B\'){a=a.5u().6W(\';\');1V(F i=0;i<a.1b;i++){8B=a[i].6W(\':\');if(8B.1b==2){b[A.cE(8B[0].48(/\\-(\\w)/g,C(m,c){G c.fI()}))]=A.cE(8B[1])}}}G b};A.fn.1U({fH:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3K\',\'5o\',c)})},fG:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3Z\',\'5o\',c)})},fF:C(a,b,c){G B.1r(\'1j\',C(){if(A.E(B,\'11\')==\'1k\'){W A.fx.4N(B,a,b,\'3Z\',\'6n\',c)}L{W A.fx.4N(B,a,b,\'3Z\',\'5o\',c)}})},fE:C(a,b,c){G B.1r(\'1j\',C(){if(A.E(B,\'11\')==\'1k\'){W A.fx.4N(B,a,b,\'3K\',\'6n\',c)}L{W A.fx.4N(B,a,b,\'3K\',\'5o\',c)}})},fD:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3K\',\'6n\',c)})},fC:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3Z\',\'6n\',c)})}});A.fx.4N=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;F g=H;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.29=28 b==\'C\'?b:P;z.1K=d;z.1l=a;z.26=A.12.2f(e);z.U={};z.U.T=z.el.E(\'T\');z.U.11=z.el.E(\'11\');if(z.U.11==\'1k\'){95=z.el.E(\'2W\');z.el.1S();g=14}z.U.O=z.el.E(\'O\');z.U.M=z.el.E(\'M\');if(g){z.el.2x();z.el.E(\'2W\',95)}z.U.V=z.26.w+\'Q\';z.U.S=z.26.h+\'Q\';z.U.2N=z.el.E(\'2N\');z.26.O=R(z.U.O)||0;z.26.M=R(z.U.M)||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.el.E(\'2N\',\'2B\').E(\'S\',d==\'6n\'&&c==\'3K\'?1:z.26.h+\'Q\').E(\'V\',d==\'6n\'&&c==\'3Z\'?1:z.26.w+\'Q\');z.1T=C(){z.el.E(z.U);if(z.1K==\'5o\')z.el.2x();L z.el.1S();A.2z(z.el.I(0),\'1j\')};2X(c){19\'3K\':z.eh=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'S\');z.et=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');if(z.1K==\'5o\'){z.eh.1G(z.26.h,0);z.et.1G(z.26.O,z.26.O+z.26.h/2)}L{z.eh.1G(0,z.26.h);z.et.1G(z.26.O+z.26.h/2,z.26.O)}1n;19\'3Z\':z.eh=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'V\');z.et=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');if(z.1K==\'5o\'){z.eh.1G(z.26.w,0);z.et.1G(z.26.M,z.26.M+z.26.w/2)}L{z.eh.1G(0,z.26.w);z.et.1G(z.26.M+z.26.w/2,z.26.M)}1n}};A.fn.au=C(b,c,d){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F a=W A.fx.au(B,b,c,d);a.at()})};A.fx.au=C(a,b,c,d){F z=B;z.74=c;z.52=1;z.el=a;z.1l=b;z.29=d;A(z.el).1S();z.at=C(){z.52++;z.e=W A.fx(z.el,A.1l(z.1l,C(){z.ef=W A.fx(z.el,A.1l(z.1l,C(){if(z.52<=z.74)z.at();L{A.2z(z.el,\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el)}}}),\'1E\');z.ef.1G(0,1)}),\'1E\');z.e.1G(1,0)}};A.fn.1U({fB:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5E(B,a,1,1Y,14,b,\'cz\',c)})},fy:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5E(B,a,1Y,1,14,b,\'as\',c)})},fw:C(b,c,d){G B.1r(\'1j\',C(){F a=a||\'d2\';W A.fx.5E(B,b,1Y,cX,14,c,\'5c\',a)})},5E:C(a,b,c,d,e,f){G B.1r(\'1j\',C(){W A.fx.5E(B,a,b,c,d,e,\'5E\',f)})}});A.fx.5E=C(e,f,g,h,j,k,m,q){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.6m=R(g)||1Y;z.3v=R(h)||1Y;z.1e=28 k==\'4B\'?k:q||P;z.29=28 k==\'C\'?k:P;z.1H=A.1l(f).1H;z.bL=j||P;z.26=A.12.2f(e);z.U={V:z.el.E(\'V\'),S:z.el.E(\'S\'),4a:z.el.E(\'4a\')||\'1Y%\',T:z.el.E(\'T\'),11:z.el.E(\'11\'),O:z.el.E(\'O\'),M:z.el.E(\'M\'),2N:z.el.E(\'2N\'),4x:z.el.E(\'4x\'),5i:z.el.E(\'5i\'),5d:z.el.E(\'5d\'),4y:z.el.E(\'4y\'),5b:z.el.E(\'5b\'),5g:z.el.E(\'5g\'),4Q:z.el.E(\'4Q\'),4F:z.el.E(\'4F\')};z.V=R(z.U.V)||e.3P||0;z.S=R(z.U.S)||e.5r||0;z.O=R(z.U.O)||0;z.M=R(z.U.M)||0;1o=[\'em\',\'Q\',\'fv\',\'%\'];1V(i in 1o){if(z.U.4a.3o(1o[i])>0){z.cy=1o[i];z.4a=2c(z.U.4a)}if(z.U.4x.3o(1o[i])>0){z.cx=1o[i];z.aq=2c(z.U.4x)||0}if(z.U.5i.3o(1o[i])>0){z.cw=1o[i];z.ap=2c(z.U.5i)||0}if(z.U.5d.3o(1o[i])>0){z.cv=1o[i];z.ao=2c(z.U.5d)||0}if(z.U.4y.3o(1o[i])>0){z.cu=1o[i];z.an=2c(z.U.4y)||0}if(z.U.5b.3o(1o[i])>0){z.ct=1o[i];z.am=2c(z.U.5b)||0}if(z.U.5g.3o(1o[i])>0){z.cr=1o[i];z.al=2c(z.U.5g)||0}if(z.U.4Q.3o(1o[i])>0){z.cq=1o[i];z.ak=2c(z.U.4Q)||0}if(z.U.4F.3o(1o[i])>0){z.cp=1o[i];z.aj=2c(z.U.4F)||0}}if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.el.E(\'2N\',\'2B\');z.1K=m;2X(z.1K){19\'cz\':z.3V=z.O+z.26.h/2;z.4H=z.O;z.3Q=z.M+z.26.w/2;z.4r=z.M;1n;19\'as\':z.4H=z.O+z.26.h/2;z.3V=z.O;z.4r=z.M+z.26.w/2;z.3Q=z.M;1n;19\'5c\':z.4H=z.O-z.26.h/4;z.3V=z.O;z.4r=z.M-z.26.w/4;z.3Q=z.M;1n}z.ai=H;z.t=(W 6p).6y();z.4i=C(){5h(z.2A);z.2A=P};z.3f=C(){if(z.ai==H){z.el.1S();z.ai=14}F t=(W 6p).6y();F n=t-z.t;F p=n/z.1H;if(t>=z.1H+z.t){97(C(){o=1;if(z.1K){t=z.4H;l=z.4r;if(z.1K==\'5c\')o=0}z.ag(z.3v,l,t,14,o)},13);z.4i()}L{o=1;if(!A.1e||!A.1e[z.1e]){s=((-Z.51(p*Z.2F)/2)+0.5)*(z.3v-z.6m)+z.6m}L{s=A.1e[z.1e](p,n,z.6m,(z.3v-z.6m),z.1H)}if(z.1K){if(!A.1e||!A.1e[z.1e]){t=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V;l=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q;if(z.1K==\'5c\')o=((-Z.51(p*Z.2F)/2)+0.5)*(-0.9B)+0.9B}L{t=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.1H);l=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.1H);if(z.1K==\'5c\')o=A.1e[z.1e](p,n,0.9B,-0.9B,z.1H)}}z.ag(s,l,t,H,o)}};z.2A=5Y(C(){z.3f()},13);z.ag=C(a,b,c,d,e){z.el.E(\'S\',z.S*a/1Y+\'Q\').E(\'V\',z.V*a/1Y+\'Q\').E(\'M\',b+\'Q\').E(\'O\',c+\'Q\').E(\'4a\',z.4a*a/1Y+z.cy);if(z.aq)z.el.E(\'4x\',z.aq*a/1Y+z.cx);if(z.ap)z.el.E(\'5i\',z.ap*a/1Y+z.cw);if(z.ao)z.el.E(\'5d\',z.ao*a/1Y+z.cv);if(z.an)z.el.E(\'4y\',z.an*a/1Y+z.cu);if(z.am)z.el.E(\'5b\',z.am*a/1Y+z.ct);if(z.al)z.el.E(\'5g\',z.al*a/1Y+z.cr);if(z.ak)z.el.E(\'4Q\',z.ak*a/1Y+z.cq);if(z.aj)z.el.E(\'4F\',z.aj*a/1Y+z.cp);if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+e*1Y+")";z.el.I(0).Y.1E=e}if(d){if(z.bL){z.el.E(z.U)}if(z.1K==\'as\'||z.1K==\'5c\'){z.el.E(\'11\',\'1k\');if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+1Y+")";z.el.I(0).Y.1E=1}}L z.el.E(\'11\',\'2v\');if(z.29)z.29.1x(z.el.I(0));A.2z(z.el.I(0),\'1j\')}}};A.fn.1U({9A:C(a,b,c){o=A.1l(a);G B.1r(\'1j\',C(){W A.fx.9A(B,o,b,c)})},ft:C(a,b,c){G B.1y(C(){A(\'a[@2U*="#"]\',B).4U(C(e){co=B.2U.6W(\'#\');A(\'#\'+co[1]).9A(a,b,c);G H})})}});A.fx.9A=C(e,o,a,b){F z=B;z.o=o;z.e=e;z.2g=/cn|cm/.3M(a)?a:H;z.1e=b;p=A.12.3a(e);s=A.12.5O();z.4i=C(){5h(z.2A);z.2A=P;A.2z(z.e,\'1j\')};z.t=(W 6p).6y();s.h=s.h>s.ih?(s.h-s.ih):s.h;s.w=s.w>s.iw?(s.w-s.iw):s.w;z.4H=p.y>s.h?s.h:p.y;z.4r=p.x>s.w?s.w:p.x;z.3V=s.t;z.3Q=s.l;z.3f=C(){F t=(W 6p).6y();F n=t-z.t;F p=n/z.o.1H;if(t>=z.o.1H+z.t){z.4i();97(C(){z.ab(z.4H,z.4r)},13)}L{if(!z.2g||z.2g==\'cn\'){if(!A.1e||!A.1e[z.1e]){8v=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V}L{8v=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.o.1H)}}L{8v=z.3V}if(!z.2g||z.2g==\'cm\'){if(!A.1e||!A.1e[z.1e]){8u=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q}L{8u=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.o.1H)}}L{8u=z.3Q}z.ab(8v,8u)}};z.ab=C(t,l){1P.fs(l,t)};z.2A=5Y(C(){z.3f()},13)};A.fn.a8=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.a8(B,a,b);e.a7()})};A.fx.a8=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.74=R(a)||3;z.29=b;z.52=1;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.a7=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(e,{1H:60,1T:C(){if(z.52<=z.74)z.a7();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'M\');z.e.1G(z.U.M-20,z.U.M)}},\'M\');z.e.1G(z.U.M+20,z.U.M-20)}},\'M\');z.e.1G(z.U.M,z.U.M+20)}};A.fn.1U({dR:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'in\',c)})},c6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3U\',c)})},fr:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3E\',c)})},fq:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'in\',c)})},fp:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3U\',c)})},fo:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3E\',c)})},fm:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'in\',c)})},fl:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3U\',c)})},fk:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3E\',c)})},fj:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'in\',c)})},fi:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3U\',c)})},fh:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3E\',c)})}});A.fx.1u=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.29=28 b==\'C\'?b:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}if(!e.4f)e.4f=z.el.E(\'11\');z.el.1S();z.1l=a;z.fx=A.fx.9u(e);z.1K=d;z.6T=c;z.1T=C(){if(z.1K==\'3U\')z.el.E(\'2W\',\'2B\');A.fx.9n(z.fx.2Y.I(0),z.fx.U);if(z.1K==\'in\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.E(\'11\',\'1k\');z.el.E(\'2W\',\'cl\')}if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'S\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.hb,0);z.79.1G(0,z.fx.U.1o.hb)}L{z.ef.1G(0,-z.fx.U.1o.hb);z.79.1G(z.fx.U.1o.hb,0)}1n;19\'41\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.hb,0)}L{z.ef.1G(0,z.fx.U.1o.hb)}1n;19\'M\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'V\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.1D,0);z.79.1G(0,z.fx.U.1o.1D)}L{z.ef.1G(0,-z.fx.U.1o.1D);z.79.1G(z.fx.U.1o.1D,0)}1n;19\'2D\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.1D,0)}L{z.ef.1G(0,z.fx.U.1o.1D)}1n}};A.2O=P;A.fn.fg=C(o){G B.1r(\'1j\',C(){W A.fx.cj(B,o)})};A.fx.cj=C(e,o){if(A.2O==P){A(\'23\',1c).1L(\'<1W id="2O"></1W>\');A.2O=A(\'#2O\')}A.2O.E(\'11\',\'2v\').E(\'T\',\'1J\');F z=B;z.el=A(e);if(!o||!o.3v){G}if(o.3v.1F==8t&&1c.7o(o.3v)){o.3v=1c.7o(o.3v)}L if(!o.3v.ci){G}if(!o.1H){o.1H=ch}z.1H=o.1H;z.3v=o.3v;z.7e=o.2Z;z.1T=o.1T;if(z.7e){A.2O.2H(z.7e)}z.8s=0;z.8i=0;if(A.e0){z.8s=(R(A.2O.E(\'4y\'))||0)+(R(A.2O.E(\'5i\'))||0)+(R(A.2O.E(\'4F\'))||0)+(R(A.2O.E(\'5g\'))||0);z.8i=(R(A.2O.E(\'4x\'))||0)+(R(A.2O.E(\'5d\'))||0)+(R(A.2O.E(\'5b\'))||0)+(R(A.2O.E(\'4Q\'))||0)}z.2b=A.1U(A.12.3a(z.el.I(0)),A.12.2f(z.el.I(0)));z.3m=A.1U(A.12.3a(z.3v),A.12.2f(z.3v));z.2b.1D-=z.8s;z.2b.hb-=z.8i;z.3m.1D-=z.8s;z.3m.hb-=z.8i;z.29=o.1T;A.2O.E(\'V\',z.2b.1D+\'Q\').E(\'S\',z.2b.hb+\'Q\').E(\'O\',z.2b.y+\'Q\').E(\'M\',z.2b.x+\'Q\').4S({O:z.3m.y,M:z.3m.x,V:z.3m.1D,S:z.3m.hb},z.1H,C(){if(z.7e)A.2O.3S(z.7e);A.2O.E(\'11\',\'1k\');if(z.1T&&z.1T.1F==2w){z.1T.1x(z.el.I(0),[z.3v])}A.2z(z.el.I(0),\'1j\')})};A.1q={24:{2u:10,cf:\'1R/ff.ce\',cd:\'<3O 2E="1R/5o.cc" />\',cb:0.8,ca:\'fb 8G\',c9:\'6m\',3F:7n},fa:H,f8:H,5A:P,7m:H,7l:H,a3:C(a){if(!A.1q.7l||A.1q.7m)G;F b=a.6S||a.6R||-1;2X(b){19 35:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f7\').I(0));1n;19 36:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f6\').I(0));1n;19 37:19 8:19 33:19 80:19 f4:F c=A(\'#7j\');if(c.I(0).4q!=P){c.I(0).4q.1x(c.I(0))}1n;19 38:1n;19 39:19 34:19 32:19 fd:19 78:F d=A(\'#7h\');if(d.I(0).4q!=P){d.I(0).4q.1x(d.I(0))}1n;19 40:1n;19 27:A.1q.8q();1n}},6g:C(a){if(a)A.1U(A.1q.24,a);if(1P.3N){A(\'23\',1c).1C(\'5Q\',A.1q.a3)}L{A(1c).1C(\'5Q\',A.1q.a3)}A(\'a\').1y(C(){el=A(B);c5=el.1m(\'4o\')||\'\';c4=el.1m(\'2U\')||\'\';cg=/\\.cc|\\.f2|\\.7q|\\.ce|\\.f1/g;if(c4.5u().aD(cg)!=P&&c5.5u().3o(\'c2\')==0){el.1C(\'4U\',A.1q.2b)}});if(A.2R.46){3q=1c.3x(\'3q\');A(3q).1m({id:\'a1\',2E:\'dc:H;\',da:\'b0\',d7:\'b0\'}).E({11:\'1k\',T:\'1J\',O:\'0\',M:\'0\',4X:\'9x:9C.9E.a6(1E=0)\'});A(\'23\').1L(3q)}7r=1c.3x(\'1W\');A(7r).1m(\'id\',\'a0\').E({T:\'1J\',11:\'1k\',O:\'0\',M:\'0\',1E:0}).1L(1c.8b(\' \')).1C(\'4U\',A.1q.8q);5C=1c.3x(\'1W\');A(5C).1m(\'id\',\'c0\').E({4F:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Z=1c.3x(\'1W\');A(9Z).1m(\'id\',\'bY\').E({4F:A.1q.24.2u+\'Q\',4Q:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Y=1c.3x(\'a\');A(9Y).1m({id:\'f0\',2U:\'#\'}).E({T:\'1J\',2D:A.1q.24.2u+\'Q\',O:\'0\'}).1L(A.1q.24.cd).1C(\'4U\',A.1q.8q);6Z=1c.3x(\'1W\');A(6Z).1m(\'id\',\'9X\').E({T:\'2i\',9W:\'M\',5X:\'0 8x\',3j:1}).1L(5C).1L(9Z).1L(9Y);21=1c.3x(\'3O\');21.2E=A.1q.24.cf;A(21).1m(\'id\',\'bW\').E({T:\'1J\'});5G=1c.3x(\'a\');A(5G).1m({id:\'7j\',2U:\'#\'}).E({T:\'1J\',11:\'1k\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));5F=1c.3x(\'a\');A(5F).1m({id:\'7h\',2U:\'#\'}).E({T:\'1J\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));2q=1c.3x(\'1W\');A(2q).1m(\'id\',\'bT\').E({11:\'1k\',T:\'2i\',2N:\'2B\',9W:\'M\',5X:\'0 8x\',O:\'0\',M:\'0\',3j:2}).1L([21,5G,5F]);5Z=1c.3x(\'1W\');A(5Z).1m(\'id\',\'8m\').E({11:\'1k\',T:\'1J\',2N:\'2B\',O:\'0\',M:\'0\',9W:\'az\',6P:\'b7\',eY:\'0\'}).1L([2q,6Z]);A(\'23\').1L(7r).1L(5Z)},2b:C(e,a){el=a?A(a):A(B);8J=el.1m(\'4o\');F b,4E,5G,5F;if(8J!=\'c2\'){A.1q.5A=8J;7F=A(\'a[@4o=\'+8J+\']\');b=7F.1N();4E=7F.aY(a?a:B);5G=7F.I(4E-1);5F=7F.I(4E+1)}aw=el.1m(\'2U\');5C=el.1m(\'3T\');3R=A.12.5O();7r=A(\'#a0\');if(!A.1q.7l){A.1q.7l=14;if(A.2R.46){A(\'#a1\').E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S()}7r.E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S().bS(bz,A.1q.24.cb,C(){A.1q.aB(aw,5C,3R,b,4E,5G,5F)});A(\'#8m\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\')}L{A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.aB(aw,5C,3R,b,4E,5G,5F)}G H},aB:C(a,b,c,d,e,f,g){A(\'#aA\').9U();8l=A(\'#7j\');8l.2x();8k=A(\'#7h\');8k.2x();21=A(\'#bW\');2q=A(\'#bT\');5Z=A(\'#8m\');6Z=A(\'#9X\').E(\'2W\',\'2B\');A(\'#c0\').3i(5C);A.1q.7m=14;if(d)A(\'#bY\').3i(A.1q.24.ca+\' \'+(e+1)+\' \'+A.1q.24.c9+\' \'+d);if(f){8l.I(0).4q=C(){B.4W();A.1q.2b(P,f);G H}}if(g){8k.I(0).4q=C(){B.4W();A.1q.2b(P,g);G H}}21.1S();7u=A.12.2f(2q.I(0));4C=Z.3g(7u.1D,21.I(0).V+A.1q.24.2u*2);59=Z.3g(7u.hb,21.I(0).S+A.1q.24.2u*2);21.E({M:(4C-21.I(0).V)/2+\'Q\',O:(59-21.I(0).S)/2+\'Q\'});2q.E({V:4C+\'Q\',S:59+\'Q\'}).1S();bQ=A.12.a5();5Z.E(\'O\',c.t+(bQ.h/15)+\'Q\');if(5Z.E(\'11\')==\'1k\'){5Z.1S().6U(A.1q.24.3F)}5H=W 8M;A(5H).1m(\'id\',\'aA\').1C(\'eP\',C(){4C=5H.V+A.1q.24.2u*2;59=5H.S+A.1q.24.2u*2;21.2x();2q.4S({S:59},7u.hb!=59?A.1q.24.3F:1,C(){2q.4S({V:4C},7u.1D!=4C?A.1q.24.3F:1,C(){2q.aJ(5H);A(5H).E({T:\'1J\',M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\'}).6U(A.1q.24.3F,C(){cL=A.12.2f(6Z.I(0));if(f){8l.E({M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}if(g){8k.E({M:4C/2+A.1q.24.2u*2+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}6Z.E({V:4C+\'Q\',O:-cL.hb+\'Q\',2W:\'cl\'}).4S({O:-1},A.1q.24.3F,C(){A.1q.7m=H})})})})});5H.2E=a},8q:C(){A(\'#aA\').9U();A(\'#8m\').2x();A(\'#9X\').E(\'2W\',\'2B\');A(\'#a0\').bS(bz,0,C(){A(B).2x();if(A.2R.46){A(\'#a1\').2x()}});A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.5A=P;A.1q.7l=H;A.1q.7m=H;G H}};A.N={1v:P,3A:P,1g:P,1A:P,1o:P,T:P,7f:C(e){A.N.1g=(B.9T)?B.9T:B;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(A.N.1g).E(\'V\'))||0,S:R(A(A.N.1g).E(\'S\'))||0};A.N.T={O:R(A(A.N.1g).E(\'O\'))||0,M:R(A(A.N.1g).E(\'M\'))||0};A(1c).1C(\'3t\',A.N.aO).1C(\'5n\',A.N.aN);if(28 A.N.1g.1h.bO===\'C\'){A.N.1g.1h.bO.1x(A.N.1g)}G H},aN:C(e){A(1c).3h(\'3t\',A.N.aO).3h(\'5n\',A.N.aN);if(28 A.N.1g.1h.cO===\'C\'){A.N.1g.1h.cO.1x(A.N.1g)}A.N.1g=P},aO:C(e){if(!A.N.1g){G}1A=A.12.3W(e);6c=A.N.T.O-A.N.1A.y+1A.y;77=A.N.T.M-A.N.1A.x+1A.x;6c=Z.3g(Z.3k(6c,A.N.1g.1h.7d-A.N.1o.S),A.N.1g.1h.6F);77=Z.3g(Z.3k(77,A.N.1g.1h.7c-A.N.1o.V),A.N.1g.1h.6u);if(28 A.N.1g.1h.4h===\'C\'){F a=A.N.1g.1h.4h.1x(A.N.1g,[77,6c]);if(28 a==\'eI\'&&a.1b==2){77=a[0];6c=a[1]}}A.N.1g.Y.O=6c+\'Q\';A.N.1g.Y.M=77+\'Q\';G H},2b:C(e){A(1c).1C(\'3t\',A.N.7g).1C(\'5n\',A.N.7w);A.N.1v=B.1v;A.N.3A=B.3A;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(B.1v).E(\'V\'))||0,S:R(A(B.1v).E(\'S\'))||0};A.N.T={O:R(A(B.1v).E(\'O\'))||0,M:R(A(B.1v).E(\'M\'))||0};if(A.N.1v.1h.4c){A.N.1v.1h.4c.1x(A.N.1v,[B])}G H},7w:C(){A(1c).3h(\'3t\',A.N.7g).3h(\'5n\',A.N.7w);if(A.N.1v.1h.3C){A.N.1v.1h.3C.1x(A.N.1v,[A.N.3A])}A.N.1v=P;A.N.3A=P},5N:C(a,b){G Z.3k(Z.3g(A.N.1o.V+a*b,A.N.1v.1h.8O),A.N.1v.1h.5R)},5M:C(a,b){G Z.3k(Z.3g(A.N.1o.S+a*b,A.N.1v.1h.7x),A.N.1v.1h.7y)},bN:C(a){G Z.3k(Z.3g(a,A.N.1v.1h.7x),A.N.1v.1h.7y)},7g:C(e){if(A.N.1v==P){G}1A=A.12.3W(e);dx=1A.x-A.N.1A.x;dy=1A.y-A.N.1A.y;1B={V:A.N.1o.V,S:A.N.1o.S};2s={O:A.N.T.O,M:A.N.T.M};2X(A.N.3A){19\'e\':1B.V=A.N.5N(dx,1);1n;19\'eH\':1B.V=A.N.5N(dx,1);1B.S=A.N.5M(dy,1);1n;19\'w\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'9R\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1B.S=A.N.5M(dy,1);1n;19\'7a\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'n\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1n;19\'9Q\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,1);1n;19\'s\':1B.S=A.N.5M(dy,1);1n}if(A.N.1v.1h.44){if(A.N.3A==\'n\'||A.N.3A==\'s\')43=1B.S*A.N.1v.1h.44;L 43=1B.V;4z=A.N.bN(43*A.N.1v.1h.44);43=4z/A.N.1v.1h.44;2X(A.N.3A){19\'n\':19\'7a\':19\'9Q\':2s.O+=1B.S-4z;1n}2X(A.N.3A){19\'7a\':19\'w\':19\'9R\':2s.M+=1B.V-43;1n}1B.S=4z;1B.V=43}if(2s.O<A.N.1v.1h.6F){4z=1B.S+2s.O-A.N.1v.1h.6F;2s.O=A.N.1v.1h.6F;if(A.N.1v.1h.44){43=4z/A.N.1v.1h.44;2X(A.N.3A){19\'7a\':19\'w\':19\'9R\':2s.M+=1B.V-43;1n}1B.V=43}1B.S=4z}if(2s.M<A.N.1v.1h.6u){43=1B.V+2s.M-A.N.1v.1h.6u;2s.M=A.N.1v.1h.6u;if(A.N.1v.1h.44){4z=43*A.N.1v.1h.44;2X(A.N.3A){19\'n\':19\'7a\':19\'9Q\':2s.O+=1B.S-4z;1n}1B.S=4z}1B.V=43}if(2s.O+1B.S>A.N.1v.1h.7d){1B.S=A.N.1v.1h.7d-2s.O;if(A.N.1v.1h.44){1B.V=1B.S/A.N.1v.1h.44}}if(2s.M+1B.V>A.N.1v.1h.7c){1B.V=A.N.1v.1h.7c-2s.M;if(A.N.1v.1h.44){1B.S=1B.V*A.N.1v.1h.44}}F a=H;if(A.N.1v.1h.eG){a=A.N.1v.1h.eG.1x(A.N.1v,[1B,2s]);if(a){if(a.1o){A.1U(1B,a.1o)}if(a.T){A.1U(2s,a.T)}}}8f=A.N.1v.Y;8f.M=2s.M+\'Q\';8f.O=2s.O+\'Q\';8f.V=1B.V+\'Q\';8f.S=1B.S+\'Q\';G H},2l:C(b){if(!b||!b.3G||b.3G.1F!=6E){G}G B.1y(C(){F a=B;a.1h=b;a.1h.8O=b.8O||10;a.1h.7x=b.7x||10;a.1h.5R=b.5R||5P;a.1h.7y=b.7y||5P;a.1h.6F=b.6F||-8V;a.1h.6u=b.6u||-8V;a.1h.7c=b.7c||5P;a.1h.7d=b.7d||5P;bK=A(a).E(\'T\');if(!(bK==\'2i\'||bK==\'1J\')){a.Y.T=\'2i\'}eE=/n|9Q|e|eH|s|9R|w|7a/g;1V(i in a.1h.3G){if(i.5u().aD(eE)!=P){if(a.1h.3G[i].1F==8t){3c=A(a.1h.3G[i]);if(3c.1N()>0){a.1h.3G[i]=3c.I(0)}}if(a.1h.3G[i].4D){a.1h.3G[i].1v=a;a.1h.3G[i].3A=i;A(a.1h.3G[i]).1C(\'4R\',A.N.2b)}}}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){9N=A(a.1h.5k);if(9N.1N()>0){9N.1y(C(){B.9T=a});9N.1C(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).1C(\'4R\',A.N.7f)}}})},4v:C(){G B.1y(C(){F a=B;1V(i in a.1h.3G){a.1h.3G[i].1v=P;a.1h.3G[i].3A=P;A(a.1h.3G[i]).3h(\'4R\',A.N.2b)}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){3c=A(a.1h.5k);if(3c.1N()>0){3c.3h(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).3h(\'4R\',A.N.7f)}}a.1h=P})}};A.fn.1U({jk:A.N.2l,jj:A.N.4v});A.2t=P;A.6J=H;A.31=P;A.6B=[];A.9L=C(e){F a=e.6S||e.6R||-1;if(a==17||a==16){A.6J=14}};A.9J=C(e){A.6J=H};A.eB=C(e){B.f.1A=A.12.3W(e);B.f.1I=A.1U(A.12.3a(B),A.12.2f(B));B.f.4p=A.12.5O(B);B.f.1A.x-=B.f.1I.x;B.f.1A.y-=B.f.1I.y;A(B).1L(A.2t.I(0));if(B.f.hc)A.2t.2H(B.f.hc).E(\'11\',\'2v\');A.2t.E({11:\'2v\',V:\'2G\',S:\'2G\'});if(B.f.o){A.2t.E(\'1E\',B.f.o)}A.31=B;A.7A=H;A.6B=[];B.f.el.1y(C(){B.1I={x:B.7Y+(B.4u&&!A.2R.6l?R(B.4u.4y)||0:0)+(A.31.2P||0),y:B.7t+(B.4u&&!A.2R.6l?R(B.4u.4x)||0:0)+(A.31.2T||0),1D:B.3P,hb:B.5r};if(B.s==14){if(A.6J==H){B.s=H;A(B).3S(A.31.f.71)}L{A.7A=14;A.6B[A.6B.1b]=A.1m(B,\'id\')}}});A.9H.1x(B,[e]);A(1c).1C(\'3t\',A.9H).1C(\'5n\',A.bI);G H};A.9H=C(e){if(!A.31)G;A.eA.1x(A.31,[e])};A.eA=C(e){if(!A.31)G;F a=A.12.3W(e);F b=A.12.5O(A.31);a.x+=b.l-B.f.4p.l-B.f.1I.x;a.y+=b.t-B.f.4p.t-B.f.1I.y;F c=Z.3k(a.x,B.f.1A.x);F d=Z.3k(Z.3B(a.x-B.f.1A.x),Z.3B(B.f.4p.w-c));F f=Z.3k(a.y,B.f.1A.y);F g=Z.3k(Z.3B(a.y-B.f.1A.y),Z.3B(B.f.4p.h-f));if(B.2T>0&&a.y-20<B.2T){F h=Z.3k(b.t,10);f-=h;g+=h;B.2T-=h}L if(B.2T+B.f.1I.h<B.f.4p.h&&a.y+20>B.2T+B.f.1I.h){F h=Z.3k(B.f.4p.h-B.2T,10);B.2T+=h;if(B.2T!=b.t)g+=h}if(B.2P>0&&a.x-20<B.2P){F h=Z.3k(b.l,10);c-=h;d+=h;B.2P-=h}L if(B.2P+B.f.1I.w<B.f.4p.w&&a.x+20>B.2P+B.f.1I.w){F h=Z.3k(B.f.4p.w-B.2P,10);B.2P+=h;if(B.2P!=b.l)d+=h}A.2t.E({M:c+\'Q\',O:f+\'Q\',V:d+\'Q\',S:g+\'Q\'});A.2t.l=c+B.f.4p.l;A.2t.t=f+B.f.4p.t;A.2t.r=A.2t.l+d;A.2t.b=A.2t.t+g;A.7A=H;B.f.el.1y(C(){9G=A.6B.3o(A.1m(B,\'id\'));if(!(B.1I.x>A.2t.r||(B.1I.x+B.1I.1D)<A.2t.l||B.1I.y>A.2t.b||(B.1I.y+B.1I.hb)<A.2t.t)){A.7A=14;if(B.s!=14){B.s=14;A(B).2H(A.31.f.71)}if(9G!=-1){B.s=H;A(B).3S(A.31.f.71)}}L if((B.s==14)&&(9G==-1)){B.s=H;A(B).3S(A.31.f.71)}L if((!B.s)&&(A.6J==14)&&(9G!=-1)){B.s=14;A(B).2H(A.31.f.71)}});G H};A.bI=C(e){if(!A.31)G;A.ez.1x(A.31,[e])};A.ez=C(e){A(1c).3h(\'3t\',A.9H).3h(\'5n\',A.bI);if(!A.31)G;A.2t.E(\'11\',\'1k\');if(B.f.hc)A.2t.3S(B.f.hc);A.31=H;A(\'23\').1L(A.2t.I(0));if(A.7A==14){if(B.f.8d)B.f.8d(A.bF(A.1m(B,\'id\')))}L{if(B.f.8c)B.f.8c(A.bF(A.1m(B,\'id\')))}A.6B=[]};A.bF=C(s){F h=\'\';F o=[];if(a=A(\'#\'+s)){a.I(0).f.el.1y(C(){if(B.s==14){if(h.1b>0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[o.1b]=A.1m(B,\'id\')}})}G{6A:h,o:o}};A.fn.jg=C(o){if(!A.2t){A(\'23\',1c).1L(\'<1W id="2t"></1W>\').1C(\'70\',A.9L).1C(\'5Q\',A.9J);A.2t=A(\'#2t\');A.2t.E({T:\'1J\',11:\'1k\'});if(1P.3N){A(\'23\',1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}L{A(1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}}if(!o){o={}}G B.1y(C(){if(B.ey)G;B.ey=14;B.f={a:o.3r,o:o.1E?2c(o.1E):H,71:o.ex?o.ex:H,hc:o.4G?o.4G:H,8d:o.8d?o.8d:H,8c:o.8c?o.8c:H};B.f.el=A(\'.\'+o.3r);A(B).1C(\'4R\',A.eB).E(\'T\',\'2i\')})};A.2Q={aT:1,ew:C(b){F b=b;G B.1y(C(){B.4g.69.1y(C(a){A.2Q.4s(B,b[a])})})},I:C(){F e=[];B.1y(C(b){if(B.bD){e[b]=[];F c=B;F d=A.12.2f(B);B.4g.69.1y(C(a){F x=B.7Y;F y=B.7t;7B=R(x*1Y/(d.w-B.3P));7C=R(y*1Y/(d.h-B.5r));e[b][a]=[7B||0,7C||0,x||0,y||0]})}});G e},ad:C(a){a.D.ep=a.D.1Z.w-a.D.1w.1D;a.D.eo=a.D.1Z.h-a.D.1w.hb;if(a.92.4g.bB){8Z=a.92.4g.69.I(a.bA+1);if(8Z){a.D.1Z.w=(R(A(8Z).E(\'M\'))||0)+a.D.1w.1D;a.D.1Z.h=(R(A(8Z).E(\'O\'))||0)+a.D.1w.hb}9f=a.92.4g.69.I(a.bA-1);if(9f){F b=R(A(9f).E(\'M\'))||0;F c=R(A(9f).E(\'M\'))||0;a.D.1Z.x+=b;a.D.1Z.y+=c;a.D.1Z.w-=b;a.D.1Z.h-=c}}a.D.ek=a.D.1Z.w-a.D.1w.1D;a.D.ej=a.D.1Z.h-a.D.1w.hb;if(a.D.2C){a.D.gx=((a.D.1Z.w-a.D.1w.1D)/a.D.2C)||1;a.D.gy=((a.D.1Z.h-a.D.1w.hb)/a.D.2C)||1;a.D.d1=a.D.ek/a.D.2C;a.D.d0=a.D.ej/a.D.2C}a.D.1Z.dx=a.D.1Z.x-a.D.22.x;a.D.1Z.dy=a.D.1Z.y-a.D.22.y;A.X.18.E(\'7z\',\'8T\')},3n:C(a,x,y){if(a.D.2C){d9=R(x/a.D.d1);7B=d9*1Y/a.D.2C;d5=R(y/a.D.d0);7C=d5*1Y/a.D.2C}L{7B=R(x*1Y/a.D.ep);7C=R(y*1Y/a.D.eo)}a.D.aa=[7B||0,7C||0,x||0,y||0];if(a.D.3n)a.D.3n.1x(a,a.D.aa)},d3:C(a){6K=a.6S||a.6R||-1;2X(6K){19 35:A.2Q.4s(B.3H,[91,91]);1n;19 36:A.2Q.4s(B.3H,[-91,-91]);1n;19 37:A.2Q.4s(B.3H,[-B.3H.D.gx||-1,0]);1n;19 38:A.2Q.4s(B.3H,[0,-B.3H.D.gy||-1]);1n;19 39:A.2Q.4s(B.3H,[B.3H.D.gx||1,0]);1n;19 40:A.X.4s(B.3H,[0,B.3H.D.gy||1]);1n}},4s:C(a,b){if(!a.D){G}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.49=A.E(a,\'T\');if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){a.Y.T=\'2i\'}A.X.ah(a);A.2Q.ad(a);dx=R(b[0])||0;dy=R(b[1])||0;2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.2C){57=A.X.a9.1x(a,[2n,2j,dx,dy]);if(57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy}57=A.X.ae.1x(a,[2n,2j,dx,dy]);if(57&&57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.4P&&(a.D.3n||a.D.2I)){A.2Q.3n(a,2n,2j)}2n=!a.D.2g||a.D.2g==\'3Z\'?2n:a.D.22.x||0;2j=!a.D.2g||a.D.2g==\'3K\'?2j:a.D.22.y||0;a.Y.M=2n+\'Q\';a.Y.O=2j+\'Q\'},2l:C(o){G B.1y(C(){if(B.bD==14||!o.3r||!A.12||!A.X||!A.1s){G}4Y=A(o.3r,B);if(4Y.1N()==0){G}F b={2e:\'7X\',4P:14,3n:o.3n&&o.3n.1F==2w?o.3n:P,2I:o.2I&&o.2I.1F==2w?o.2I:P,3c:B,1E:o.1E||H};if(o.2C&&R(o.2C)){b.2C=R(o.2C)||1;b.2C=b.2C>0?b.2C:1}if(4Y.1N()==1)4Y.6r(b);L{A(4Y.I(0)).6r(b);b.3c=P;4Y.6r(b)}4Y.70(A.2Q.d3);4Y.1m(\'aT\',A.2Q.aT++);B.bD=14;B.4g={};B.4g.ec=b.ec;B.4g.2C=b.2C;B.4g.69=4Y;B.4g.bB=o.bB?14:H;by=B;by.4g.69.1y(C(a){B.bA=a;B.92=by});if(o.5f&&o.5f.1F==6h){1V(i=o.5f.1b-1;i>=0;i--){if(o.5f[i].1F==6h&&o.5f[i].1b==2){el=B.4g.69.I(i);if(el.4D){A.2Q.4s(el,o.5f[i])}}}}})}};A.fn.1U({jc:A.2Q.2l,jb:A.2Q.ew,ja:A.2Q.I});A.2p={56:[],ea:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},di:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d-1;1R=A(\'3O\',1d.J.4O);if(1u<1){1u=1d.J.1R.1b}1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},2A:C(c){1d=1c.7o(c);if(1d.J.63){1u=1d.J.3d;6k(1u==1d.J.3d){1u=1+R(Z.63()*1d.J.1R.1b)}}L{1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},go:C(o){F a;if(o&&o.1F==6E){if(o.21){a=1c.7o(o.21.1d);5v=1P.j8.2U.6W("#");o.21.5J=P;if(5v.1b==2){1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}L{1u=1}}if(o.84){o.84.4W();a=o.84.2S.2S;id=A.1m(a,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}5v=o.84.2U.6W("#");1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}if(a.J.1R.1b<1u||1u<1){1u=1}a.J.3d=1u;4t=A.12.2f(a);e4=A.12.9y(a);e3=A.12.6b(a);if(a.J.3e){a.J.3e.o.E(\'11\',\'1k\')}if(a.J.3b){a.J.3b.o.E(\'11\',\'1k\')}if(a.J.21){y=R(e4.t)+R(e3.t);if(a.J.1Q){if(a.J.1Q.4J==\'O\'){y+=a.J.1Q.45.hb}L{4t.h-=a.J.1Q.45.hb}}if(a.J.2o){if(a.J.2o&&a.J.2o.5V==\'O\'){y+=a.J.2o.45.hb}L{4t.h-=a.J.2o.45.hb}}if(!a.J.bu){a.J.e1=o.21?o.21.S:(R(a.J.21.E(\'S\'))||0);a.J.bu=o.21?o.21.V:(R(a.J.21.E(\'V\'))||0)}a.J.21.E(\'O\',y+(4t.h-a.J.e1)/2+\'Q\');a.J.21.E(\'M\',(4t.1D-a.J.bu)/2+\'Q\');a.J.21.E(\'11\',\'2v\')}1R=A(\'3O\',a.J.4O);if(1R.1N()>0){1R.6d(a.J.3F,A.2p.7J)}L{9w=A(\'a\',a.J.1Q.o).I(1u-1);A(9w).2H(a.J.1Q.5s);F b=W 8M();b.1d=A.1m(a,\'id\');b.1u=1u-1;b.2E=a.J.1R[a.J.3d-1].2E;if(b.1T){b.5J=P;A.2p.11.1x(b)}L{b.5J=A.2p.11}if(a.J.2o){a.J.2o.o.3i(a.J.1R[1u-1].5W)}}}},7J:C(){1d=B.2S.2S;1d.J.4O.E(\'11\',\'1k\');if(1d.J.1Q.5s){9w=A(\'a\',1d.J.1Q.o).3S(1d.J.1Q.5s).I(1d.J.3d-1);A(9w).2H(1d.J.1Q.5s)}F a=W 8M();a.1d=A.1m(1d,\'id\');a.1u=1d.J.3d-1;a.2E=1d.J.1R[1d.J.3d-1].2E;if(a.1T){a.5J=P;A.2p.11.1x(a)}L{a.5J=A.2p.11}if(1d.J.2o){1d.J.2o.o.3i(1d.J.1R[1d.J.3d-1].5W)}},11:C(){1d=1c.7o(B.1d);if(1d.J.3e){1d.J.3e.o.E(\'11\',\'1k\')}if(1d.J.3b){1d.J.3b.o.E(\'11\',\'1k\')}4t=A.12.2f(1d);y=0;if(1d.J.1Q){if(1d.J.1Q.4J==\'O\'){y+=1d.J.1Q.45.hb}L{4t.h-=1d.J.1Q.45.hb}}if(1d.J.2o){if(1d.J.2o&&1d.J.2o.5V==\'O\'){y+=1d.J.2o.45.hb}L{4t.h-=1d.J.2o.45.hb}}j4=A(\'.bt\',1d);y=y+(4t.h-B.S)/2;x=(4t.1D-B.V)/2;1d.J.4O.E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').3i(\'<3O 2E="\'+B.2E+\'" />\');1d.J.4O.6U(1d.J.3F);3b=1d.J.3d+1;if(3b>1d.J.1R.1b){3b=1}3e=1d.J.3d-1;if(3e<1){3e=1d.J.1R.1b}1d.J.3b.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+2*B.V/3+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3b-1].5W);1d.J.3b.o.I(0).2U=\'#\'+3b+A.1m(1d,\'id\');1d.J.3e.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3e-1].5W);1d.J.3e.o.I(0).2U=\'#\'+3e+A.1m(1d,\'id\')},2l:C(o){if(!o||!o.2q||A.2p.56[o.2q])G;F a=A(\'#\'+o.2q);F c=a.I(0);if(c.Y.T!=\'1J\'&&c.Y.T!=\'2i\'){c.Y.T=\'2i\'}c.Y.2N=\'2B\';if(a.1N()==0)G;c.J={};c.J.1R=o.1R?o.1R:[];c.J.63=o.63&&o.63==14||H;7T=c.dj(\'j3\');1V(i=0;i<7T.1b;i++){6e=c.J.1R.1b;c.J.1R[6e]={2E:7T[i].2E,5W:7T[i].3T||7T[i].j2||\'\'}}if(c.J.1R.1b==0){G}c.J.49=A.1U(A.12.3a(c),A.12.2f(c));c.J.bp=A.12.9y(c);c.J.bo=A.12.6b(c);t=R(c.J.bp.t)+R(c.J.bo.t);b=R(c.J.bp.b)+R(c.J.bo.b);A(\'3O\',c).9U();c.J.3F=o.3F?o.3F:ch;if(o.4J||o.82||o.5s){c.J.1Q={};a.1L(\'<1W 68="dZ"></1W>\');c.J.1Q.o=A(\'.dZ\',c);if(o.82){c.J.1Q.82=o.82;c.J.1Q.o.2H(o.82)}if(o.5s){c.J.1Q.5s=o.5s}c.J.1Q.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.4J&&o.4J==\'O\'){c.J.1Q.4J=\'O\';c.J.1Q.o.E(\'O\',t+\'Q\')}L{c.J.1Q.4J=\'4e\';c.J.1Q.o.E(\'4e\',b+\'Q\')}c.J.1Q.9v=o.9v?o.9v:\' \';1V(F i=0;i<c.J.1R.1b;i++){6e=R(i)+1;c.J.1Q.o.1L(\'<a 2U="#\'+6e+o.2q+\'" 68="iY" 3T="\'+c.J.1R[i].5W+\'">\'+6e+\'</a>\'+(6e!=c.J.1R.1b?c.J.1Q.9v:\'\'))}A(\'a\',c.J.1Q.o).1C(\'4U\',C(){A.2p.go({84:B})});c.J.1Q.45=A.12.2f(c.J.1Q.o.I(0))}if(o.5V||o.81){c.J.2o={};a.1L(\'<1W 68="dW">&6G;</1W>\');c.J.2o.o=A(\'.dW\',c);if(o.81){c.J.2o.81=o.81;c.J.2o.o.2H(o.81)}c.J.2o.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.5V&&o.5V==\'O\'){c.J.2o.5V=\'O\';c.J.2o.o.E(\'O\',(c.J.1Q&&c.J.1Q.4J==\'O\'?c.J.1Q.45.hb+t:t)+\'Q\')}L{c.J.2o.5V=\'4e\';c.J.2o.o.E(\'4e\',(c.J.1Q&&c.J.1Q.4J==\'4e\'?c.J.1Q.45.hb+b:b)+\'Q\')}c.J.2o.45=A.12.2f(c.J.2o.o.I(0))}if(o.9j){c.J.3b={9j:o.9j};a.1L(\'<a 2U="#2\'+o.2q+\'" 68="dV">&6G;</a>\');c.J.3b.o=A(\'.dV\',c);c.J.3b.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3b.9j);c.J.3b.o.1C(\'4U\',A.2p.ea)}if(o.9t){c.J.3e={9t:o.9t};a.1L(\'<a 2U="#0\'+o.2q+\'" 68="dS">&6G;</a>\');c.J.3e.o=A(\'.dS\',c);c.J.3e.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3e.9t);c.J.3e.o.1C(\'4U\',A.2p.di)}a.aJ(\'<1W 68="bt"></1W>\');c.J.4O=A(\'.bt\',c);c.J.4O.E(\'T\',\'1J\').E(\'O\',\'2G\').E(\'M\',\'2G\').E(\'11\',\'1k\');if(o.21){a.aJ(\'<1W 68="dz" Y="11: 1k;"><3O 2E="\'+o.21+\'" /></1W>\');c.J.21=A(\'.dz\',c);c.J.21.E(\'T\',\'1J\');F d=W 8M();d.1d=o.2q;d.2E=o.21;if(d.1T){d.5J=P;A.2p.go({21:d})}L{d.5J=C(){A.2p.go({21:B})}}}L{A.2p.go({2q:c})}if(o.ba){dQ=R(o.ba)*8V}A.2p.56[o.2q]=o.ba?1P.5Y(\'A.2p.2A(\\\'\'+o.2q+\'\\\')\',dQ):P}};A.1d=A.2p.2l;A.1p={73:[],54:{},18:H,6X:P,2b:C(){if(A.X.1g==P){G}F a,3s,c,cs;A.1p.18.I(0).2Z=A.X.1g.D.5z;a=A.1p.18.I(0).Y;a.11=\'2v\';A.1p.18.1w=A.1U(A.12.3a(A.1p.18.I(0)),A.12.2f(A.1p.18.I(0)));a.V=A.X.1g.D.1w.1D+\'Q\';a.S=A.X.1g.D.1w.hb+\'Q\';3s=A.12.b2(A.X.1g);a.4M=3s.t;a.53=3s.r;a.4L=3s.b;a.4K=3s.l;if(A.X.1g.D.3L==14){c=A(A.X.1g).cA(14).I(0);cs=c.Y;cs.4M=\'2G\';cs.53=\'2G\';cs.4L=\'2G\';cs.4K=\'2G\';cs.11=\'2v\';A.1p.18.58().1L(c)}A(A.X.1g).dO(A.1p.18.I(0));A.X.1g.Y.11=\'1k\'},c7:C(e){if(!e.D.3I&&A.1s.4T.bC){if(e.D.3C)e.D.3C.1x(1g);A(e).E(\'T\',e.D.av||e.D.49);A(e).8j();A(A.1s.4T).dN(e)}A.1p.18.3S(e.D.5z).3i(\'&6G;\');A.1p.6X=P;F a=A.1p.18.I(0).Y;a.11=\'1k\';A.1p.18.dO(e);if(e.D.fx>0){A(e).6U(e.D.fx)}A(\'23\').1L(A.1p.18.I(0));F b=[];F c=H;1V(F i=0;i<A.1p.73.1b;i++){F d=A.1s.3p[A.1p.73[i]].I(0);F f=A.1m(d,\'id\');F g=A.1p.8g(f);if(d.1f.9P!=g.6A){d.1f.9P=g.6A;if(c==H&&d.1f.2I){c=d.1f.2I}g.id=f;b[b.1b]=g}}A.1p.73=[];if(c!=H&&b.1b>0){c(b)}},8n:C(e,o){if(!A.X.1g)G;F a=H;F i=0;if(e.1f.el.1N()>0){1V(i=e.1f.el.1N();i>0;i--){if(e.1f.el.I(i-1)!=A.X.1g){if(!e.5t.bb){if((e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}L{1n}}L{if((e.1f.el.I(i-1).1I.x+e.1f.el.I(i-1).1I.1D/2)>A.X.1g.D.2n&&(e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}}}}}if(a&&A.1p.6X!=a){A.1p.6X=a;A(a).iT(A.1p.18.I(0))}L if(!a&&(A.1p.6X!=P||A.1p.18.I(0).2S!=e)){A.1p.6X=P;A(e).1L(A.1p.18.I(0))}A.1p.18.I(0).Y.11=\'2v\'},bM:C(e){if(A.X.1g==P){G}e.1f.el.1y(C(){B.1I=A.1U(A.12.6w(B),A.12.6x(B))})},8g:C(s){F i;F h=\'\';F o={};if(s){if(A.1p.54[s]){o[s]=[];A(\'#\'+s+\' .\'+A.1p.54[s]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[s][o[s].1b]=A.1m(B,\'id\')})}L{1V(a in s){if(A.1p.54[s[a]]){o[s[a]]=[];A(\'#\'+s[a]+\' .\'+A.1p.54[s[a]]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s[a]+\'[]=\'+A.1m(B,\'id\');o[s[a]][o[s[a]].1b]=A.1m(B,\'id\')})}}}}L{1V(i in A.1p.54){o[i]=[];A(\'#\'+i+\' .\'+A.1p.54[i]).1y(C(){if(h.1b>0){h+=\'&\'}h+=i+\'[]=\'+A.1m(B,\'id\');o[i][o[i].1b]=A.1m(B,\'id\')})}}G{6A:h,o:o}},dL:C(e){if(!e.ci){G}G B.1y(C(){if(!B.5t||!A(e).is(\'.\'+B.5t.3r))A(e).2H(B.5t.3r);A(e).6r(B.5t.D)})},4v:C(){G B.1y(C(){A(\'.\'+B.5t.3r).8j();A(B).ei();B.5t=P;B.dK=P})},2l:C(o){if(o.3r&&A.12&&A.X&&A.1s){if(!A.1p.18){A(\'23\',1c).1L(\'<1W id="dJ">&6G;</1W>\');A.1p.18=A(\'#dJ\');A.1p.18.I(0).Y.11=\'1k\'}B.ee({3r:o.3r,9F:o.9F?o.9F:H,8X:o.8X?o.8X:H,4G:o.4G?o.4G:H,76:o.76||o.ev,6C:o.6C||o.er,bC:14,2I:o.2I||o.iR,fx:o.fx?o.fx:H,3L:o.3L?14:H,5T:o.5T?o.5T:\'9S\'});G B.1y(C(){F a={5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,4c:o.4c&&o.4c.1F==2w?o.4c:H,4h:o.4h&&o.4h.1F==2w?o.4h:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:H,2M:o.2M?o.2M:H};A(\'.\'+o.3r,B).6r(a);B.dK=14;B.5t={3r:o.3r,5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,bb:o.bb?14:H,D:a}})}}};A.fn.1U({iP:A.1p.2l,dN:A.1p.dL,iO:A.1p.4v});A.iN=A.1p.8g;A.2k={62:P,9o:H,9p:P,6a:C(e){A.2k.9o=14;A.2k.1S(e,B,14)},bk:C(e){if(A.2k.62!=B)G;A.2k.9o=H;A.2k.2x(e,B)},1S:C(e,a,b){if(A.2k.62!=P)G;if(!a){a=B}A.2k.62=a;1I=A.1U(A.12.3a(a),A.12.2f(a));7U=A(a);3T=7U.1m(\'3T\');2U=7U.1m(\'2U\');if(3T){A.2k.9p=3T;7U.1m(\'3T\',\'\');A(\'#dE\').3i(3T);if(2U)A(\'#bj\').3i(2U.48(\'iI://\',\'\'));L A(\'#bj\').3i(\'\');18=A(\'#7S\');if(a.4m.2Z){18.I(0).2Z=a.4m.2Z}L{18.I(0).2Z=\'\'}bi=A.12.2f(18.I(0));dD=b&&a.4m.T==\'bn\'?\'4e\':a.4m.T;2X(dD){19\'O\':2j=1I.y-bi.hb;2n=1I.x;1n;19\'M\':2j=1I.y;2n=1I.x-bi.1D;1n;19\'2D\':2j=1I.y;2n=1I.x+1I.1D;1n;19\'bn\':A(\'23\').1C(\'3t\',A.2k.3t);1A=A.12.3W(e);2j=1A.y+15;2n=1A.x+15;1n;8T:2j=1I.y+1I.hb;2n=1I.x;1n}18.E({O:2j+\'Q\',M:2n+\'Q\'});if(a.4m.4w==H){18.1S()}L{18.6U(a.4m.4w)}if(a.4m.2K)a.4m.2K.1x(a);7U.1C(\'86\',A.2k.2x).1C(\'4W\',A.2k.bk)}},3t:C(e){if(A.2k.62==P){A(\'23\').3h(\'3t\',A.2k.3t);G}1A=A.12.3W(e);A(\'#7S\').E({O:1A.y+15+\'Q\',M:1A.x+15+\'Q\'})},2x:C(e,a){if(!a){a=B}if(A.2k.9o!=14&&A.2k.62==a){A.2k.62=P;A(\'#7S\').6d(1);A(a).1m(\'3T\',A.2k.9p).3h(\'86\',A.2k.2x).3h(\'4W\',A.2k.bk);if(a.4m.2V)a.4m.2V.1x(a);A.2k.9p=P}},2l:C(b){if(!A.2k.18){A(\'23\').1L(\'<1W id="7S"><1W id="dE"></1W><1W id="bj"></1W></1W>\');A(\'#7S\').E({T:\'1J\',3j:5P,11:\'1k\'});A.2k.18=14}G B.1y(C(){if(A.1m(B,\'3T\')){B.4m={T:/O|4e|M|2D|bn/.3M(b.T)?b.T:\'4e\',2Z:b.2Z?b.2Z:H,4w:b.4w?b.4w:H,2K:b.2K&&b.2K.1F==2w?b.2K:H,2V:b.2V&&b.2V.1F==2w?b.2V:H};F a=A(B);a.1C(\'9r\',A.2k.1S);a.1C(\'6a\',A.2k.6a)}})}};A.fn.iH=A.2k.2l;A.7O={bl:C(e){6K=e.6S||e.6R||-1;if(6K==9){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(B.9q){1c.64.dv().3D="\\t";B.dB=C(){B.6a();B.dB=P}}L if(B.9m){2b=B.88;3m=B.dA;B.2m=B.2m.iG(0,2b)+"\\t"+B.2m.iF(3m);B.9m(2b+1,2b+1);B.6a()}G H}},4v:C(){G B.1y(C(){if(B.6V&&B.6V==14){A(B).3h(\'70\',A.7O.bl);B.6V=H}})},2l:C(){G B.1y(C(){if(B.4D==\'bs\'&&(!B.6V||B.6V==H)){A(B).1C(\'70\',A.7O.bl);B.6V=14}})}};A.fn.1U({iD:A.7O.2l,iC:A.7O.4v});A.12={3a:C(e){F x=0;F y=0;F a=e.Y;F b=H;if(A(e).E(\'11\')==\'1k\'){F c=a.2W;F d=a.T;b=14;a.2W=\'2B\';a.11=\'2v\';a.T=\'1J\'}F f=e;6k(f){x+=f.7Y+(f.4u&&!A.2R.6l?R(f.4u.4y)||0:0);y+=f.7t+(f.4u&&!A.2R.6l?R(f.4u.4x)||0:0);f=f.dY}f=e;6k(f&&f.4D&&f.4D.5u()!=\'23\'){x-=f.2P||0;y-=f.2T||0;f=f.2S}if(b==14){a.11=\'1k\';a.T=d;a.2W=c}G{x:x,y:y}},6x:C(a){F x=0,y=0;6k(a){x+=a.7Y||0;y+=a.7t||0;a=a.dY}G{x:x,y:y}},2f:C(e){F w=A.E(e,\'V\');F h=A.E(e,\'S\');F a=0;F b=0;F c=e.Y;if(A(e).E(\'11\')!=\'1k\'){a=e.3P;b=e.5r}L{F d=c.2W;F f=c.T;c.2W=\'2B\';c.11=\'2v\';c.T=\'1J\';a=e.3P;b=e.5r;c.11=\'1k\';c.T=f;c.2W=d}G{w:w,h:h,1D:a,hb:b}},6w:C(a){G{1D:a.3P||0,hb:a.5r||0}},a5:C(e){F h,w,de;if(e){w=e.83;h=e.7P}L{de=1c.4A;w=1P.bg||9z.bg||(de&&de.83)||1c.23.83;h=1P.bf||9z.bf||(de&&de.7P)||1c.23.7P}G{w:w,h:h}},5O:C(e){F t=0,l=0,w=0,h=0,iw=0,ih=0;if(e&&e.98.5u()!=\'23\'){t=e.2T;l=e.2P;w=e.be;h=e.bd;iw=0;ih=0}L{if(1c.4A){t=1c.4A.2T;l=1c.4A.2P;w=1c.4A.be;h=1c.4A.bd}L if(1c.23){t=1c.23.2T;l=1c.23.2P;w=1c.23.be;h=1c.23.bd}iw=9z.bg||1c.4A.83||1c.23.83||0;ih=9z.bf||1c.4A.7P||1c.23.7P||0}G{t:t,l:l,w:w,h:h,iw:iw,ih:ih}},b2:C(e,a){F c=A(e);F t=c.E(\'4M\')||\'\';F r=c.E(\'53\')||\'\';F b=c.E(\'4L\')||\'\';F l=c.E(\'4K\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},9y:C(e,a){F c=A(e);F t=c.E(\'5b\')||\'\';F r=c.E(\'5g\')||\'\';F b=c.E(\'4Q\')||\'\';F l=c.E(\'4F\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},6b:C(e,a){F c=A(e);F t=c.E(\'4x\')||\'\';F r=c.E(\'5i\')||\'\';F b=c.E(\'5d\')||\'\';F l=c.E(\'4y\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)||0};L G{t:t,r:r,b:b,l:l}},3W:C(a){F x=a.iB||(a.iz+(1c.4A.2P||1c.23.2P))||0;F y=a.iy||(a.ix+(1c.4A.2T||1c.23.2T))||0;G{x:x,y:y}},bH:C(a,b){b(a);a=a.6M;6k(a){A.12.bH(a,b);a=a.iv}},ji:C(c){A.12.bH(c,C(a){1V(F b in a){if(28 a[b]===\'C\'){a[b]=P}}})},ir:C(a,b){F c=A.12.5O();F d=A.12.2f(a);if(!b||b==\'3K\')A(a).E({O:c.t+((Z.3g(c.h,c.ih)-c.t-d.hb)/2)+\'Q\'});if(!b||b==\'3Z\')A(a).E({M:c.l+((Z.3g(c.w,c.iw)-c.l-d.1D)/2)+\'Q\'})},iq:C(a,b){F c=A(\'3O[@2E*="7q"]\',a||1c),7q;c.1y(C(){7q=B.2E;B.2E=b;B.Y.4X="9x:9C.9E.ip(2E=\'"+7q+"\')"})}};[].3o||(6h.jn.3o=C(v,n){n=(n==P)?0:n;F m=B.1b;1V(F i=n;i<m;i++)if(B[i]==v)G i;G-1});',62,1202,'||||||||||||||||||||||||||||||||||||jQuery|this|function|dragCfg|css|var|return|false|get|ss|iAuto|else|left|iResize|top|null|px|parseInt|height|position|oldStyle|width|new|iDrag|style|Math||display|iUtil||true||||helper|case|autoCFG|length|document|slideshow|easing|dropCfg|dragged|resizeOptions|carouselCfg|interfaceFX|none|speed|attr|break|sizes|iSort|ImageBox|queue|iDrop|iAutoscroller|slide|resizeElement|oC|apply|each|fisheyeCfg|pointer|newSizes|bind|wb|opacity|constructor|custom|duration|pos|absolute|type|append|items|size|255|window|slideslinks|images|show|complete|extend|for|div|elsToScroll|100|cont||loader|oR|body|options||oldP||typeof|callback|accordionCfg|start|parseFloat||containment|getSize|axis|selectedItem|relative|ny|iTooltip|build|value|nx|slideCaption|islideshow|container|subject|newPosition|selectHelper|border|block|Function|hide|itemWidth|dequeue|timer|hidden|fractions|right|src|PI|0px|addClass|onChange|parentData|onShow|result|cursorAt|overflow|transferHelper|scrollLeft|iSlider|browser|parentNode|scrollTop|href|onHide|visibility|switch|wrapper|className|pre|selectdrug|||||||||getPosition|nextslide|handle|currentslide|prevslide|step|max|unbind|html|zIndex|min|iExpander|end|onSlide|indexOf|zones|iframe|accept|margins|mousemove|canvas|to|item|createElement|multipleSeparator|highlighted|resizeDirection|abs|onStop|text|toggle|fadeDuration|handlers|dragElem|so|distance|vertically|ghosting|test|event|img|offsetWidth|startLeft|pageSize|removeClass|title|out|startTop|getPointer|lastSuggestion|DropOutDirectiont|horizontally||down||nWidth|ratio|dimm|msie||replace|oP|fontSize|lastValue|onStart|currentPointer|bottom|ifxFirstDisplay|slideCfg|onDrag|clear|context|elToScroll|up|tooltipCFG|fxCheckTag|rel|scr|onclick|endLeft|dragmoveBy|slidePos|currentStyle|destroy|delay|borderTopWidth|borderLeftWidth|nHeight|documentElement|string|containerW|tagName|iteration|paddingLeft|helperclass|endTop|halign|linksPosition|marginLeft|marginBottom|marginTop|OpenClose|holder|si|paddingBottom|mousedown|animate|overzone|click|onDragModifier|blur|filter|toDrag|getAttribute||cos|cnt|marginRight|collected||slideshows|newCoords|empty|containerH|elementData|paddingTop|puff|borderBottomWidth|animationHandler|values|paddingRight|clearInterval|borderRightWidth|pow|dragHandle|BlindDirection|post|mouseup|close|onSelect|fxh|offsetHeight|activeLinkClass|sortCfg|toLowerCase|url|currentPanel|point|grid|hpc|currentRel|revert|captionText|snapDistance|Scale|nextImage|prevImage|imageEl|orig|onload|iFisheye|parseColor|getHeight|getWidth|getScroll|3000|keyup|maxWidth|curCSS|tolerance|reflections|captionPosition|caption|margin|setInterval|outerContainer||itemHeight|current|random|selection|limit|Expander|128|class|sliders|focus|getBorder|newTop|fadeOut|indic|user|init|Array|frameClass|ActiveXObject|while|opera|from|open|oD|Date|proximity|Draggable|0x|F0|minLeft|rgb|getSizeLite|getPositionLite|getTime|positionItems|hash|selectCurrent|onOut|onClick|Object|minTop|nbsp|onHighlight|np|selectKeyHelper|pressedKey|accordionPos|firstChild|139|scrollIntoView|backgroundColor|oldStyleAttr|keyCode|charCode|direction|fadeIn|hasTabsEnabled|split|inFrontOf|radiusY|captionEl|keydown|sc|selectClass|changed|times||onHover|newLeft||efx|nw|li|maxRight|maxBottom|classname|startDrag|move|ImageBoxNextImage|nRx|ImageBoxPrevImage|nRy|opened|animationInProgress|400|getElementById|count|png|overlay|alpha|offsetTop|containerSize|cssSides|stop|minHeight|maxHeight|cursor|selectedone|xproc|yproc|bounceout|padding|gallery|increment|namedColors|applyOn|showImage|reflectionSize|sin|object|directionIncrement|iTTabs|clientHeight|select|activeClass|tooltipHelper|imgs|jEl|insideParent|content|parent|offsetLeft|parentBorders||captionClass|linksClass|clientWidth|link||mouseout|fontWeight|selectionStart|expand|panels|createTextNode|onselectstop|onselect|hight|elS|serialize|dir|diffHeight|DraggableDestroy|nextImageEl|prevImageEl|ImageBoxOuterContainer|checkhover|blind|iCarousel|hideImage|hidehelper|diffWidth|String|sl|st|prot|auto|diffY|diffX|headers|rule|getFieldValues|styleSheets|borderColor|positionContainer|image|getValues|dragstop|linkRel|itemsText|isDraggable|Image|minchars|minWidth|panelSelector|exec|192|isDroppable|default|211|1000|5625|hoverclass|headerSelector|next|ul|2000|SliderContainer|protectRotation|childs|oldVisibility|source|setTimeout|nodeName|stopPropagation|startTime|preventDefault|hoverClass|cssText|1px|prev|unfold|DoFold|unit|nextslideClass|multiple|itemMinWidth|setSelectionRange|destroyWrapper|focused|oldTitle|createTextRange|mouseover|inCache|prevslideClass|buildWrapper|linksSeparator|lnk|progid|getPadding|self|ScrollTo|9999|DXImageTransform|helperClass|Microsoft|activeclass|iIndex|selectcheck|onDrop|selectKeyUp|autofill|selectKeyDown|panelHeight|handleEl|onActivate|os|ne|sw|intersect|dragEl|remove|data|textAlign|ImageBoxCaption|closeEl|captionImages|ImageBoxOverlay|ImageBoxIframe|clearTimeout|keyPressed|fade|getClient|Alpha|shake|Shake|snapToGrid|lastSi|scroll||modifyContainer|fitToContainer|currentValue|zoom|getContainment|firstStep|paddingLeftSize|paddingBottomSize|paddingRightSize|paddingTopSize|borderLeftSize|borderBottomSize|borderRightSize|borderTopSize|autoSize|shrink|pulse|Pulsate|initialPosition|imageSrc|parseStyle|sliderPos|center|ImageBoxCurrentImage|loadImage|parentPos|match|dragmove|stopAnim|pause|Color|unselectable|prepend|borderWidth|cssSidesEnd|draginit|stopDrag|moveDrag|asin|bouncein|paddingY|paddingX|tabindex|writeItems|INPUT|10000|169|index|sliderSize|no|linear|getMargins|spacer|rotationSpeed|returnValue|cancelBubble|transparent|angle|autocomplete|autoplay|floats|extraWidth|scrollHeight|scrollWidth|innerHeight|innerWidth|character|helperSize|tooltipURL|hidefocused|doTab|Number|mouse|oBor|oPad|entities||TEXTAREA|slideshowHolder|loaderWidth|inputWidth|RegExp|letterSpacing|sliderEl|300|SliderIteration|restricted|sortable|isSlider|bounce|Selectserialize|idsa|traverseDOM|selectstop|elm|elPosition|restore|measure|getHeightMinMax|onDragStart|fit|clientSize|field|fadeTo|ImageBoxContainer|on|listStyle|ImageBoxLoader|dragHelper|ImageBoxCaptionImages|getContext|ImageBoxCaptionText|update|imagebox|BlindUp|hrefAttr|relAttr|SlideOutUp|check|checkdrop|textImageFrom|textImage|overlayOpacity|jpg|closeHTML|gif|loaderSRC|imageTypes|500|childNodes|itransferTo|highlight|visible|horizontal|vertical|parts|paddingLeftUnit|paddingBottomUnit|paddingRightUnit||paddingTopUnit|borderLeftUnit|borderBottomUnit|borderRightUnit|borderTopUnit|fontUnit|grow|clone|sqrt|textDecoration|dragstart|trim|isFunction|valign|userSelect|fxe|KhtmlUserSelect|Width|captionSize|dhe|colorCssProps|onDragStop|iAccordion|cssProps|doScroll|144|224|230|keypress|off|150|140|107|fracH|fracW|easeout|dragmoveByKey|autocompleteHelper|yfrac|165|scrolling|radiusX|xfrac|frameborder|245|javascript|240||autocompleteIframe|999|protect|goprev|getElementsByTagName|styleFloat||parte|insertBefore|itemZIndex|interfaceColorFX|fold|mousex|leftUnit|topUnit|fakeAccordionClass|createRange|getSelectionStart|||slideshowLoader|selectionEnd|onblur|moveStart|filteredPosition|tooltipTitle|togglehor|togglever|inputValue|zindex|sortHelper|isSortable|addItem|checkCache|SortableAddItem|after|BlindDown|time|SlideInUp|slideshowPrevslide|elType|30px|slideshowNextSlide|slideshowCaption|expanderHelper|offsetParent|slideshowLinks|boxModel|loaderHeight||slideBor|slidePad|htmlEntities|wordSpacing|fontVariant|fontStretch|fontStyle|gonext|fontFamily|onslide|clickItem|Droppable||rgba||DroppableDestroy|maxy|maxx|||hoverItem|containerMaxy|containerMaxx||onout|addColorStop||iBounce|onhover|set|selectedclass|isSelectable|selectstopApply|selectcheckApply|selectstart|shc|360|directions|remeasure|onResize|se|array|scale|success|param|translate|POST|number|load|ajax|save|name|khtml|moz|find|ondragstart|onselectstart|lineHeigt|mozUserSelect|ImageBoxClose|bmp|jpeg|finishx|112|starty|first|last|firstResize|startx|imageLoaded|Showing|finishOpacity|110|Accordion|loading|TransferTo|SlideToggleRight|SlideOutRight|SlideInRight|SlideToggleLeft|SlideOutLeft|SlideInLeft||SlideToggleDown|SlideOutDown|SlideInDown|SlideToggleUp|scrollTo|ScrollToAnchors|flipv|pt|Puff||Shrink|Fisheye||Grow|OpenHorizontally|OpenVertically|SwitchVertically|SwitchHorizontally|CloseHorizontally|CloseVertically|toUpperCase|100000000|selectorText|rules|cssRules|borderStyle|outset|inset|ridge|resize|groove|double|solid|dashed|dotted|isNaN|fromHandler|stopAll|MozUserSelect|Left|Bottom|Right|Top|outlineColor|color|borderTopColor|borderRightColor|borderLeftColor|borderBottomColor|textIndent|outlineWidth|elasticboth|outlineOffset|wh|elasticout|lineHeight|yellow|white|silver|red|purple|203||pink|orange|olive|navy||maroon|magenta|lime|||elasticin|lightyellow|193|182|lightpink|bounceboth|lightgrey|238|lightgreen|lightcyan|Autocomplete|216|173|200|984375|lightblue|khaki|130|625|indigo|green|215|9375|gold|fuchsia|148|darkviolet|122|233|darksalmon|darkred|204|153|darkorchid|darkorange|30002|list|darkolivegreen|||darkmagenta|183|189|darkkhaki|easeboth|darkgreen|30001|darkgrey|darkcyan|darkblue|cyan|easein|brown|blue||black|hover|220|beige|azure|aqua|appendChild|cssFloat|fxWrapper|ol|table|fix|form|button|nodeValue|textarea|input|w_|float|Carousel|removeChild|meta|optgroup|option|frameset|frame|script|header|th|colgroup|col|tfoot|thead|tbody|td|tr|Highlight|FoldToggle|UnFold|Fold|DropToggleRight|DropInRight|DropOutRight|DropToggleLeft|DropInLeft|DropOutLeft|DropToggleUp||DropInUp||DropOutUp||DropToggleDown|100000|DropInDown|duplicate|DropOutDown||120|AlphaImageLoader|fixPNG|centerEl||rotationTimer|maxRotation|nextSibling||clientY|pageY|clientX|Bounce|pageX|DisableTabs|EnableTabs|moveEnd|substr|substring|ToolTip|http|collapse|BlindToggleHorizontally|BlindRight|BlindLeft|SortSerialize|SortableDestroy|Sortable|BlindToggleVertically|onchange|fillRect|before|Autoexpand|fill|password|WebKit|slideshowLink|quot|lt|amp|alt|IMG|par|appVersion|pW|navigator|location|fillStyle|SliderGetValues|SliderSetValues|Slider|recallDroppables|ondrop|createLinearGradient|Selectable|destination|purgeEvents|ResizableDestroy|Resizable|globalCompositeOperation|drawImage|prototype'.split('|'),0,{}))
+/**
+ * Interface Elements for jQuery
+ * 
+ * http://interface.eyecon.ro
+ * 
+ * Copyright (c) 2006 Stefan Petre
+ * Dual licensed under the MIT (MIT-LICENSE.txt) 
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *   
+ *
+ */
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('A.cP={2l:C(c){G B.1y(C(){if(!c.8Y||!c.8P)G;F b=B;b.2a={9M:c.9M||bz,8Y:c.8Y,8P:c.8P,7R:c.7R||\'du\',9c:c.9c||\'du\',2K:c.2K&&28 c.2K==\'C\'?c.2K:H,2V:c.2K&&28 c.2V==\'C\'?c.2V:H,6D:c.6D&&28 c.6D==\'C\'?c.6D:H,8A:A(c.8Y,B),8a:A(c.8P,B),1l:c.1l||7n,5w:c.5w||0};b.2a.8a.2x().E(\'S\',\'9e\').eq(0).E({S:b.2a.9M+\'Q\',11:\'2v\'}).3m();b.2a.8A.1y(C(a){B.6L=a}).ht(C(){A(B).2H(b.2a.9c)},C(){A(B).3S(b.2a.9c)}).1C(\'4U\',C(e){if(b.2a.5w==B.6L)G;b.2a.8A.eq(b.2a.5w).3S(b.2a.7R).3m().eq(B.6L).2H(b.2a.7R).3m();b.2a.8a.eq(b.2a.5w).4S({S:0},b.2a.1l,C(){B.Y.11=\'1k\';if(b.2a.2V){b.2a.2V.1x(b,[B])}}).3m().eq(B.6L).1S().4S({S:b.2a.9M},b.2a.1l,C(){B.Y.11=\'2v\';if(b.2a.2K){b.2a.2K.1x(b,[B])}}).3m();if(b.2a.6D){b.2a.6D.1x(b,[B,b.2a.8a.I(B.6L),b.2a.8A.I(b.2a.5w),b.2a.8a.I(b.2a.5w)])}b.2a.5w=B.6L}).eq(0).2H(b.2a.7R).3m();A(B).E(\'S\',A(B).E(\'S\')).E(\'2N\',\'2B\')})}};A.fn.fe=A.cP.2l;A.8p={2l:C(h){G B.1y(C(){F c=B;F d=2*Z.2F/eD;F f=2*Z.2F;if(A(c).E(\'T\')!=\'2i\'&&A(c).E(\'T\')!=\'1J\'){A(c).E(\'T\',\'2i\')}c.1i={1M:A(h.1M,B),2y:h.2y,61:h.61,9l:h.9l,iu:f,1N:A.12.2f(B),T:A.12.3a(B),2b:Z.2F/2,b4:h.b4,7K:h.5U,5U:[],93:H,7G:2*Z.2F/eD};c.1i.d8=(c.1i.1N.w-c.1i.2y)/2;c.1i.6Y=(c.1i.1N.h-c.1i.61-c.1i.61*c.1i.7K)/2;c.1i.3f=2*Z.2F/c.1i.1M.1N();c.1i.aS=c.1i.1N.w/2;c.1i.aR=c.1i.1N.h/2-c.1i.61*c.1i.7K;F g=1c.3x(\'1W\');A(g).E({T:\'1J\',3j:1,O:0,M:0});A(c).1L(g);c.1i.1M.1y(C(a){8G=A(\'3O\',B).I(0);S=R(c.1i.61*c.1i.7K);if(A.2R.46){3u=1c.3x(\'3O\');A(3u).E(\'T\',\'1J\');3u.2E=8G.2E;3u.Y.4X=\'fu 9x:9C.9E.a6(1E=60, Y=1, fc=0, f9=0, f5=0, f3=0)\'}L{3u=1c.3x(\'3u\');if(3u.bZ){4j=3u.bZ("2d");3u.Y.T=\'1J\';3u.Y.S=S+\'Q\';3u.Y.V=c.1i.2y+\'Q\';3u.S=S;3u.V=c.1i.2y;4j.eR();4j.eM(0,S);4j.eJ(1,-1);4j.jm(8G,0,0,c.1i.2y,S);4j.bL();4j.jl="jh-3U";F b=4j.jf(0,0,0,S);b.es(1,"eg(1O, 1O, 1O, 1)");b.es(0,"eg(1O, 1O, 1O, 0.6)");4j.j9=b;if(j7.j5.3o(\'iX\')!=-1){4j.iV()}L{4j.iS(0,0,c.1i.2y,S)}}}c.1i.5U[a]=3u;A(g).1L(3u)}).1C(\'9r\',C(e){c.1i.93=14;c.1i.1l=c.1i.7G*0.1*c.1i.1l/Z.3B(c.1i.1l);G H}).1C(\'86\',C(e){c.1i.93=H;G H});A.8p.6z(c);c.1i.1l=c.1i.7G*0.2;c.1i.it=1P.5Y(C(){c.1i.2b+=c.1i.1l;if(c.1i.2b>f)c.1i.2b=0;A.8p.6z(c)},20);A(c).1C(\'86\',C(){c.1i.1l=c.1i.7G*0.2*c.1i.1l/Z.3B(c.1i.1l)}).1C(\'3t\',C(e){if(c.1i.93==H){1A=A.12.3W(e);dr=c.1i.1N.w-1A.x+c.1i.T.x;c.1i.1l=c.1i.b4*c.1i.7G*(c.1i.1N.w/2-dr)/(c.1i.1N.w/2)}})})},6z:C(b){b.1i.1M.1y(C(a){b8=b.1i.2b+a*b.1i.3f;x=b.1i.d8*Z.51(b8);y=b.1i.6Y*Z.7L(b8);do=R(1Y*(b.1i.6Y+y)/(2*b.1i.6Y));dm=(b.1i.6Y+y)/(2*b.1i.6Y);V=R((b.1i.2y-b.1i.9l)*dm+b.1i.9l);S=R(V*b.1i.61/b.1i.2y);B.Y.O=b.1i.aR+y-S/2+"Q";B.Y.M=b.1i.aS+x-V/2+"Q";B.Y.V=V+"Q";B.Y.S=S+"Q";B.Y.3j=do;b.1i.5U[a].Y.O=R(b.1i.aR+y+S-1-S/2)+"Q";b.1i.5U[a].Y.M=R(b.1i.aS+x-V/2)+"Q";b.1i.5U[a].Y.V=V+"Q";b.1i.5U[a].Y.S=R(S*b.1i.7K)+"Q"})}};A.fn.hL=A.8p.2l;A.1U({1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a},ho:C(p,n,a,b,c){G b*(n/=c)*n*n+a},d2:C(p,n,a,b,c){G-b*((n=n/c-1)*n*n*n-1)+a},hh:C(p,n,a,b,c){if((n/=c/2)<1)G b/2*n*n*n*n+a;G-b/2*((n-=2)*n*n*n-2)+a},7D:C(p,n,a,b,c){if((n/=c)<(1/2.75)){G b*(7.8W*n*n)+a}L if(n<(2/2.75)){G b*(7.8W*(n-=(1.5/2.75))*n+.75)+a}L if(n<(2.5/2.75)){G b*(7.8W*(n-=(2.25/2.75))*n+.gV)+a}L{G b*(7.8W*(n-=(2.gR/2.75))*n+.gN)+a}},aQ:C(p,n,a,b,c){if(A.1e.7D)G b-A.1e.7D(p,c-n,0,b,c)+a;G a+b},gE:C(p,n,a,b,c){if(A.1e.aQ&&A.1e.7D)if(n<c/2)G A.1e.aQ(p,n*2,0,b,c)*.5+a;G A.1e.7D(p,n*2-c,0,b,c)*.5+b*.5+a;G a+b},gz:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d)==1)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}G-(a*Z.5j(2,10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p))+b},gg:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d/2)==2)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}G a*Z.5j(2,-10*n)*Z.7L((n*d-s)*(2*Z.2F)/p)+c+b},gd:C(p,n,b,c,d){F a,s;if(n==0)G b;if((n/=d/2)==2)G b+c;a=c*0.3;p=d*.3;if(a<Z.3B(c)){a=c;s=p/4}L{s=p/(2*Z.2F)*Z.aP(c/a)}if(n<1){G-.5*(a*Z.5j(2,10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p))+b}G a*Z.5j(2,-10*(n-=1))*Z.7L((n*d-s)*(2*Z.2F)/p)*.5+c+b}}});A.5K={2l:C(h){G B.1y(C(){F g=B;g.1z={1M:A(h.1M,B),2q:A(h.2q,B),1I:A.12.3a(B),2y:h.2y,8K:h.8K,6q:h.6q,cG:h.cG,4I:h.4I,5R:h.5R};A.5K.8F(g,0);A(1P).1C(\'fR\',C(){g.1z.1I=A.12.3a(g);A.5K.8F(g,0);A.5K.6z(g)});A.5K.6z(g);g.1z.1M.1C(\'9r\',C(){A(g.1z.8K,B).I(0).Y.11=\'2v\'}).1C(\'86\',C(){A(g.1z.8K,B).I(0).Y.11=\'1k\'});A(1c).1C(\'3t\',C(e){F b=A.12.3W(e);F c=0;if(g.1z.4I&&g.1z.4I==\'az\')F d=b.x-g.1z.1I.x-(g.3P-g.1z.2y*g.1z.1M.1N())/2-g.1z.2y/2;L if(g.1z.4I&&g.1z.4I==\'2D\')F d=b.x-g.1z.1I.x-g.3P+g.1z.2y*g.1z.1M.1N();L F d=b.x-g.1z.1I.x;F f=Z.5j(b.y-g.1z.1I.y-g.5r/2,2);g.1z.1M.1y(C(a){3J=Z.cB(Z.5j(d-a*g.1z.2y,2)+f);3J-=g.1z.2y/2;3J=3J<0?0:3J;3J=3J>g.1z.6q?g.1z.6q:3J;3J=g.1z.6q-3J;bc=g.1z.5R*3J/g.1z.6q;B.Y.V=g.1z.2y+bc+\'Q\';B.Y.M=g.1z.2y*a+c+\'Q\';c+=bc});A.5K.8F(g,c)})})},8F:C(a,b){if(a.1z.4I)if(a.1z.4I==\'az\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())/2-b/2+\'Q\';L if(a.1z.4I==\'M\')a.1z.2q.I(0).Y.M=-b/a.1z.1M.1N()+\'Q\';L if(a.1z.4I==\'2D\')a.1z.2q.I(0).Y.M=(a.3P-a.1z.2y*a.1z.1M.1N())-b/2+\'Q\';a.1z.2q.I(0).Y.V=a.1z.2y*a.1z.1M.1N()+b+\'Q\'},6z:C(b){b.1z.1M.1y(C(a){B.Y.V=b.1z.2y+\'Q\';B.Y.M=b.1z.2y*a+\'Q\'})}};A.fn.fz=A.5K.2l;A.K={18:P,7W:P,3q:P,2A:P,4b:P,af:P,2r:P,2h:P,1M:P,58:C(){A.K.7W.58();if(A.K.3q){A.K.3q.2x()}},4i:C(){A.K.1M=P;A.K.2h=P;A.K.4b=A.K.2r.2m;if(A.K.18.E(\'11\')==\'2v\'){if(A.K.2r.1a.fx){2X(A.K.2r.1a.fx.1K){19\'a4\':A.K.18.6d(A.K.2r.1a.fx.1H,A.K.58);1n;19\'1u\':A.K.18.c6(A.K.2r.1a.fx.1H,A.K.58);1n;19\'8o\':A.K.18.c3(A.K.2r.1a.fx.1H,A.K.58);1n}}L{A.K.18.2x()}if(A.K.2r.1a.2V)A.K.2r.1a.2V.1x(A.K.2r,[A.K.18,A.K.3q])}L{A.K.58()}1P.a2(A.K.2A)},c1:C(){F e=A.K.2r;F f=A.K.8C(e);if(e&&f.3w!=A.K.4b&&f.3w.1b>=e.1a.8N){A.K.4b=f.3w;A.K.af=f.3w;9V={bR:A(e).1m(\'eS\')||\'bR\',2m:f.3w};A.eQ({1K:\'eN\',9V:A.eL(9V),eK:C(b){e.1a.3X=A(\'3w\',b);1N=e.1a.3X.1N();if(1N>0){F c=\'\';e.1a.3X.1y(C(a){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'</7b>\'});if(e.1a.9K){F d=A(\'2m\',e.1a.3X.I(0)).3D();e.2m=f.30+d+e.1a.3y+f.5m;A.K.64(e,f.3w.1b!=d.1b?(f.30.1b+f.3w.1b):d.1b,f.3w.1b!=d.1b?(f.30.1b+d.1b):d.1b)}if(1N>0){A.K.aU(e,c)}L{A.K.4i()}}L{A.K.4i()}},5v:e.1a.96})}},aU:C(a,b){A.K.7W.3i(b);A.K.1M=A(\'7b\',A.K.7W.I(0));A.K.1M.9r(A.K.en).1C(\'4U\',A.K.ed);F c=A.12.3a(a);F d=A.12.2f(a);A.K.18.E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').2H(a.1a.9D);if(A.K.3q){A.K.3q.E(\'11\',\'2v\').E(\'O\',c.y+d.hb+\'Q\').E(\'M\',c.x+\'Q\').E(\'V\',A.K.18.E(\'V\')).E(\'S\',A.K.18.E(\'S\'))}A.K.2h=0;A.K.1M.I(0).2Z=a.1a.72;A.K.7I(a,a.1a.3X.I(0),\'6H\');if(A.K.18.E(\'11\')==\'1k\'){if(a.1a.bv){F e=A.12.9y(a,14);F f=A.12.6b(a,14);A.K.18.E(\'V\',a.3P-(A.e0?(e.l+e.r+f.l+f.r):0)+\'Q\')}if(a.1a.fx){2X(a.1a.fx.1K){19\'a4\':A.K.18.6U(a.1a.fx.1H);1n;19\'1u\':A.K.18.dR(a.1a.fx.1H);1n;19\'8o\':A.K.18.dP(a.1a.fx.1H);1n}}L{A.K.18.1S()}if(A.K.2r.1a.2K)A.K.2r.1a.2K.1x(A.K.2r,[A.K.18,A.K.3q])}},dM:C(){F b=B;if(b.1a.3X){A.K.4b=b.2m;A.K.af=b.2m;F c=\'\';b.1a.3X.1y(C(a){2m=A(\'2m\',B).3D().5u();dH=b.2m.5u();if(2m.3o(dH)==0){c+=\'<7b 4o="\'+A(\'2m\',B).3D()+\'" 8h="\'+a+\'" Y="7z: 8T;">\'+A(\'3D\',B).3D()+\'</7b>\'}});if(c!=\'\'){A.K.aU(b,c);B.1a.9s=14;G}}b.1a.3X=P;B.1a.9s=H},64:C(a,b,c){if(a.9q){F d=a.9q();d.iJ(14);d.dC("bh",b);d.iE("bh",-c+b);d.7Q()}L if(a.9m){a.9m(b,c)}L{if(a.88){a.88=b;a.dA=c}}a.6a()},dw:C(a){if(a.88)G a.88;L if(a.9q){F b=1c.64.dv();F c=b.il();G 0-c.dC(\'bh\',-ij)}},8C:C(a){F b={2m:a.2m,30:\'\',5m:\'\',3w:\'\'};if(a.1a.9k){F c=H;F d=A.K.dw(a)||0;F e=b.2m.6W(a.1a.3y);1V(F i=0;i<e.1b;i++){if((b.30.1b+e[i].1b>=d||d==0)&&!c){if(b.30.1b<=d)b.3w=e[i];L b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\');c=14}L if(c){b.5m+=e[i]+(e[i]!=\'\'?a.1a.3y:\'\')}if(!c){b.30+=e[i]+(e.1b>1?a.1a.3y:\'\')}}}L{b.3w=b.2m}G b},b9:C(e){1P.a2(A.K.2A);F a=A.K.8C(B);F b=e.6S||e.6R||-1;if(/13|27|35|36|38|40|9/.3M(b)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';L A.K.2h=-1;2X(b){19 9:19 13:if(A.K.2h==-1)A.K.2h=0;F c=A.K.1M.I(A.K.2h||0);F d=c.4Z(\'4o\');B.2m=a.30+d+B.1a.3y+a.5m;A.K.4b=a.3w;A.K.64(B,a.30.1b+d.1b+B.1a.3y.1b,a.30.1b+d.1b+B.1a.3y.1b);A.K.4i();if(B.1a.5p){4E=R(c.4Z(\'8h\'))||0;A.K.7I(B,B.1a.3X.I(4E),\'5p\')}if(B.6O)B.6O(H);G b!=13;1n;19 27:B.2m=a.30+A.K.4b+B.1a.3y+a.5m;B.1a.3X=P;A.K.4i();if(B.6O)B.6O(H);G H;1n;19 35:A.K.2h=A.K.1M.1N()-1;1n;19 36:A.K.2h=0;1n;19 38:A.K.2h--;if(A.K.2h<0)A.K.2h=A.K.1M.1N()-1;1n;19 40:A.K.2h++;if(A.K.2h==A.K.1M.1N())A.K.2h=0;1n}A.K.7I(B,B.1a.3X.I(A.K.2h||0),\'6H\');A.K.1M.I(A.K.2h||0).2Z=B.1a.72;if(A.K.1M.I(A.K.2h||0).6O)A.K.1M.I(A.K.2h||0).6O(H);if(B.1a.9K){F f=A.K.1M.I(A.K.2h||0).4Z(\'4o\');B.2m=a.30+f+B.1a.3y+a.5m;if(A.K.4b.1b!=f.1b)A.K.64(B,a.30.1b+A.K.4b.1b,a.30.1b+f.1b)}G H}A.K.dM.1x(B);if(B.1a.9s==H){if(a.3w!=A.K.4b&&a.3w.1b>=B.1a.8N)A.K.2A=1P.97(A.K.c1,B.1a.4w);if(A.K.1M){A.K.4i()}}G 14},7I:C(a,b,c){if(a.1a[c]){F d={};94=b.dj(\'*\');1V(i=0;i<94.1b;i++){d[94[i].4D]=94[i].6M.hG}a.1a[c].1x(a,[d])}},en:C(e){if(A.K.1M){if(A.K.2h!=P)A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.1M.I(A.K.2h||0).2Z=\'\';A.K.2h=R(B.4Z(\'8h\'))||0;A.K.1M.I(A.K.2h||0).2Z=A.K.2r.1a.72}},ed:C(a){1P.a2(A.K.2A);a=a||A.3N.hD(1P.3N);a.9b();a.99();F b=A.K.8C(A.K.2r);F c=B.4Z(\'4o\');A.K.2r.2m=b.30+c+A.K.2r.1a.3y+b.5m;A.K.4b=B.4Z(\'4o\');A.K.64(A.K.2r,b.30.1b+c.1b+A.K.2r.1a.3y.1b,b.30.1b+c.1b+A.K.2r.1a.3y.1b);A.K.4i();if(A.K.2r.1a.5p){4E=R(B.4Z(\'8h\'))||0;A.K.7I(A.K.2r,A.K.2r.1a.3X.I(4E),\'5p\')}G H},dh:C(e){6K=e.6S||e.6R||-1;if(/13|27|35|36|38|40/.3M(6K)&&A.K.1M){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}G H}},2l:C(a){if(!a.96||!A.12){G}if(!A.K.18){if(A.2R.46){A(\'23\',1c).1L(\'<3q Y="11:1k;T:1J;4X:9x:9C.9E.a6(1E=0);" id="df" 2E="dc:H;" da="0" d7="b0"></3q>\');A.K.3q=A(\'#df\')}A(\'23\',1c).1L(\'<1W id="d4" Y="T: 1J; O: 0; M: 0; z-aY: hj; 11: 1k;"><90 Y="5X: 0;7E: 0; h9-Y: 1k; z-aY: h8;">&6G;</90></1W>\');A.K.18=A(\'#d4\');A.K.7W=A(\'90\',A.K.18)}G B.1y(C(){if(B.4D!=\'aV\'&&B.4Z(\'1K\')!=\'3D\')G;B.1a={};B.1a.96=a.96;B.1a.8N=Z.3B(R(a.8N)||1);B.1a.9D=a.9D?a.9D:\'\';B.1a.72=a.72?a.72:\'\';B.1a.5p=a.5p&&a.5p.1F==2w?a.5p:P;B.1a.2K=a.2K&&a.2K.1F==2w?a.2K:P;B.1a.2V=a.2V&&a.2V.1F==2w?a.2V:P;B.1a.6H=a.6H&&a.6H.1F==2w?a.6H:P;B.1a.bv=a.bv||H;B.1a.9k=a.9k||H;B.1a.3y=B.1a.9k?(a.3y||\', \'):\'\';B.1a.9K=a.9K?14:H;B.1a.4w=Z.3B(R(a.4w)||8V);if(a.fx&&a.fx.1F==6E){if(!a.fx.1K||!/a4|1u|8o/.3M(a.fx.1K)){a.fx.1K=\'1u\'}if(a.fx.1K==\'1u\'&&!A.fx.1u)G;if(a.fx.1K==\'8o\'&&!A.fx.5l)G;a.fx.1H=Z.3B(R(a.fx.1H)||7n);if(a.fx.1H>B.1a.4w){a.fx.1H=B.1a.4w-1Y}B.1a.fx=a.fx}B.1a.3X=P;B.1a.9s=H;A(B).1m(\'b9\',\'cW\').6a(C(){A.K.2r=B;A.K.4b=B.2m}).cV(A.K.dh).5Q(A.K.b9).4W(C(){A.K.2A=1P.97(A.K.4i,gM)})})}};A.fn.gJ=A.K.2l;A.1t={2A:P,4k:P,1X:P,3f:10,2b:C(a,b,c,d){A.1t.4k=a;A.1t.1X=b;A.1t.3f=R(c)||10;A.1t.2A=1P.5Y(A.1t.cR,R(d)||40)},cR:C(){1V(i=0;i<A.1t.1X.1b;i++){if(!A.1t.1X[i].2J){A.1t.1X[i].2J=A.1U(A.12.6x(A.1t.1X[i]),A.12.6w(A.1t.1X[i]),A.12.5O(A.1t.1X[i]))}L{A.1t.1X[i].2J.t=A.1t.1X[i].2T;A.1t.1X[i].2J.l=A.1t.1X[i].2P}if(A.1t.4k.D&&A.1t.4k.D.6g==14){5a={x:A.1t.4k.D.2n,y:A.1t.4k.D.2j,1D:A.1t.4k.D.1w.1D,hb:A.1t.4k.D.1w.hb}}L{5a=A.1U(A.12.6x(A.1t.4k),A.12.6w(A.1t.4k))}if(A.1t.1X[i].2J.t>0&&A.1t.1X[i].2J.y+A.1t.1X[i].2J.t>5a.y){A.1t.1X[i].2T-=A.1t.3f}L if(A.1t.1X[i].2J.t<=A.1t.1X[i].2J.h&&A.1t.1X[i].2J.t+A.1t.1X[i].2J.hb<5a.y+5a.hb){A.1t.1X[i].2T+=A.1t.3f}if(A.1t.1X[i].2J.l>0&&A.1t.1X[i].2J.x+A.1t.1X[i].2J.l>5a.x){A.1t.1X[i].2P-=A.1t.3f}L if(A.1t.1X[i].2J.l<=A.1t.1X[i].2J.gf&&A.1t.1X[i].2J.l+A.1t.1X[i].2J.1D<5a.x+5a.1D){A.1t.1X[i].2P+=A.1t.3f}}},7w:C(){1P.5h(A.1t.2A);A.1t.4k=P;A.1t.1X=P;1V(i in A.1t.1X){A.1t.1X[i].2J=P}}};A.X={18:P,1g:P,4v:C(){G B.1y(C(){if(B.8L){B.D.cM.3h(\'4R\',A.X.aM);B.D=P;B.8L=H;if(A.2R.46){B.aI="cW"}L{B.Y.g0=\'\';B.Y.cJ=\'\';B.Y.cH=\'\'}}})},aM:C(e){if(A.X.1g!=P){A.X.8I(e);G H}F a=B.3H;A(1c).1C(\'3t\',A.X.aE).1C(\'5n\',A.X.8I);a.D.1A=A.12.3W(e);a.D.4d=a.D.1A;a.D.6g=H;a.D.fY=B!=B.3H;A.X.1g=a;if(a.D.4P&&B!=B.3H){aC=A.12.3a(a.2S);aZ=A.12.2f(a);ay={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};dx=a.D.4d.x-aC.x-aZ.1D/2-ay.x;dy=a.D.4d.y-aC.y-aZ.hb/2-ay.y;A.2Q.4s(a,[dx,dy])}G A.6J||H},cD:C(e){F a=A.X.1g;a.D.6g=14;F b=a.Y;a.D.6o=A.E(a,\'11\');a.D.49=A.E(a,\'T\');if(!a.D.av)a.D.av=a.D.49;a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.8z=0;a.D.8y=0;if(A.2R.46){F c=A.12.6b(a,14);a.D.8z=c.l||0;a.D.8y=c.t||0}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){b.T=\'2i\'}A.X.18.58();F d=A(a).cA(14).I(0);A(d).E({11:\'2v\',M:\'2G\',O:\'2G\'});d.Y.4M=\'0\';d.Y.53=\'0\';d.Y.4L=\'0\';d.Y.4K=\'0\';A.X.18.1L(d);F f=A.X.18.I(0).Y;if(a.D.ar){f.V=\'8x\';f.S=\'8x\'}L{f.S=a.D.1w.hb+\'Q\';f.V=a.D.1w.1D+\'Q\'}f.11=\'2v\';f.4M=\'2G\';f.53=\'2G\';f.4L=\'2G\';f.4K=\'2G\';A.1U(a.D.1w,A.12.2f(d));if(a.D.2M){if(a.D.2M.M){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.2M.M;a.D.1w.x=a.D.1A.x-a.D.2M.M}if(a.D.2M.O){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.2M.O;a.D.1w.y=a.D.1A.y-a.D.2M.O}if(a.D.2M.2D){a.D.22.x+=a.D.1A.x-a.D.1w.x-a.D.1w.hb+a.D.2M.2D;a.D.1w.x=a.D.1A.x-a.D.1w.1D+a.D.2M.2D}if(a.D.2M.4e){a.D.22.y+=a.D.1A.y-a.D.1w.y-a.D.1w.hb+a.D.2M.4e;a.D.1w.y=a.D.1A.y-a.D.1w.hb+a.D.2M.4e}}a.D.2n=a.D.22.x;a.D.2j=a.D.22.y;if(a.D.7V||a.D.2e==\'7X\'){7Z=A.12.6b(a.2S,14);a.D.1w.x=a.7Y+(A.2R.46?0:A.2R.6l?-7Z.l:7Z.l);a.D.1w.y=a.7t+(A.2R.46?0:A.2R.6l?-7Z.t:7Z.t);A(a.2S).1L(A.X.18.I(0))}if(a.D.2e){A.X.ah(a);a.D.4V.2e=A.X.ae}if(a.D.4P){A.2Q.ad(a)}f.M=a.D.1w.x-a.D.8z+\'Q\';f.O=a.D.1w.y-a.D.8y+\'Q\';f.V=a.D.1w.1D+\'Q\';f.S=a.D.1w.hb+\'Q\';A.X.1g.D.8w=H;if(a.D.gx){a.D.4V.5y=A.X.a9}if(a.D.3j!=H){A.X.18.E(\'3j\',a.D.3j)}if(a.D.1E){A.X.18.E(\'1E\',a.D.1E);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=\'+a.D.1E*1Y+\')\')}}if(a.D.6i){A.X.18.2H(a.D.6i);A.X.18.I(0).6M.Y.11=\'1k\'}if(a.D.4c)a.D.4c.1x(a,[d,a.D.22.x,a.D.22.y]);if(A.1s&&A.1s.7p>0){A.1s.ck(a)}if(a.D.3L==H){b.11=\'1k\'}G H},ah:C(a){if(a.D.2e.1F==8t){if(a.D.2e==\'7X\'){a.D.1Z=A.1U({x:0,y:0},A.12.2f(a.2S));F b=A.12.6b(a.2S,14);a.D.1Z.w=a.D.1Z.1D-b.l-b.r;a.D.1Z.h=a.D.1Z.hb-b.t-b.b}L if(a.D.2e==\'1c\'){F c=A.12.a5();a.D.1Z={x:0,y:0,w:c.w,h:c.h}}}L if(a.D.2e.1F==6h){a.D.1Z={x:R(a.D.2e[0])||0,y:R(a.D.2e[1])||0,w:R(a.D.2e[2])||0,h:R(a.D.2e[3])||0}}a.D.1Z.dx=a.D.1Z.x-a.D.1w.x;a.D.1Z.dy=a.D.1Z.y-a.D.1w.y},8r:C(a){if(a.D.7V||a.D.2e==\'7X\'){A(\'23\',1c).1L(A.X.18.I(0))}A.X.18.58().2x().E(\'1E\',1);if(1P.6j){A.X.18.E(\'4X\',\'7s(1E=1Y)\')}},8I:C(e){A(1c).3h(\'3t\',A.X.aE).3h(\'5n\',A.X.8I);if(A.X.1g==P){G}F a=A.X.1g;A.X.1g=P;if(a.D.6g==H){G H}if(a.D.3I==14){A(a).E(\'T\',a.D.49)}F b=a.Y;if(a.4P){A.X.18.E(\'7z\',\'7g\')}if(a.D.6i){A.X.18.3S(a.D.6i)}if(a.D.5B==H){if(a.D.fx>0){if(!a.D.2g||a.D.2g==\'3Z\'){F x=W A.fx(a,{1H:a.D.fx},\'M\');x.1G(a.D.22.x,a.D.7i)}if(!a.D.2g||a.D.2g==\'3K\'){F y=W A.fx(a,{1H:a.D.fx},\'O\');y.1G(a.D.22.y,a.D.7k)}}L{if(!a.D.2g||a.D.2g==\'3Z\')a.Y.M=a.D.7i+\'Q\';if(!a.D.2g||a.D.2g==\'3K\')a.Y.O=a.D.7k+\'Q\'}A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}L if(a.D.fx>0){a.D.8w=14;F c=H;if(A.1s&&A.1p&&a.D.3I){c=A.12.3a(A.1p.18.I(0))}A.X.18.4S({M:c?c.x:a.D.1w.x,O:c?c.y:a.D.1w.y},a.D.fx,C(){a.D.8w=H;if(a.D.3L==H){a.Y.11=a.D.6o}A.X.8r(a)})}L{A.X.8r(a);if(a.D.3L==H){A(a).E(\'11\',a.D.6o)}}if(A.1s&&A.1s.7p>0){A.1s.c8(a)}if(A.1p&&a.D.3I){A.1p.c7(a)}if(a.D.2I&&(a.D.7i!=a.D.22.x||a.D.7k!=a.D.22.y)){a.D.2I.1x(a,a.D.aa||[0,0,a.D.7i,a.D.7k])}if(a.D.3C)a.D.3C.1x(a);G H},a9:C(x,y,a,b){if(a!=0)a=R((a+(B.D.gx*a/Z.3B(a))/2)/B.D.gx)*B.D.gx;if(b!=0)b=R((b+(B.D.gy*b/Z.3B(b))/2)/B.D.gy)*B.D.gy;G{dx:a,dy:b,x:0,y:0}},ae:C(x,y,a,b){a=Z.3k(Z.3g(a,B.D.1Z.dx),B.D.1Z.w+B.D.1Z.dx-B.D.1w.1D);b=Z.3k(Z.3g(b,B.D.1Z.dy),B.D.1Z.h+B.D.1Z.dy-B.D.1w.hb);G{dx:a,dy:b,x:0,y:0}},aE:C(e){if(A.X.1g==P||A.X.1g.D.8w==14){G}F a=A.X.1g;a.D.4d=A.12.3W(e);if(a.D.6g==H){3J=Z.cB(Z.5j(a.D.1A.x-a.D.4d.x,2)+Z.5j(a.D.1A.y-a.D.4d.y,2));if(3J<a.D.5D){G}L{A.X.cD(e)}}F b=a.D.4d.x-a.D.1A.x;F c=a.D.4d.y-a.D.1A.y;1V(F i in a.D.4V){F d=a.D.4V[i].1x(a,[a.D.22.x+b,a.D.22.y+c,b,c]);if(d&&d.1F==6E){b=i!=\'6f\'?d.dx:(d.x-a.D.22.x);c=i!=\'6f\'?d.dy:(d.y-a.D.22.y)}}a.D.2n=a.D.1w.x+b-a.D.8z;a.D.2j=a.D.1w.y+c-a.D.8y;if(a.D.4P&&(a.D.3n||a.D.2I)){A.2Q.3n(a,a.D.2n,a.D.2j)}if(a.D.4h)a.D.4h.1x(a,[a.D.22.x+b,a.D.22.y+c]);if(!a.D.2g||a.D.2g==\'3Z\'){a.D.7i=a.D.22.x+b;A.X.18.I(0).Y.M=a.D.2n+\'Q\'}if(!a.D.2g||a.D.2g==\'3K\'){a.D.7k=a.D.22.y+c;A.X.18.I(0).Y.O=a.D.2j+\'Q\'}if(A.1s&&A.1s.7p>0){A.1s.8n(a)}G H},2l:C(o){if(!A.X.18){A(\'23\',1c).1L(\'<1W id="bX"></1W>\');A.X.18=A(\'#bX\');F c=A.X.18.I(0);F d=c.Y;d.T=\'1J\';d.11=\'1k\';d.7z=\'7g\';d.bV=\'1k\';d.2N=\'2B\';if(1P.6j){c.aI="bU"}L{d.eZ=\'1k\';d.cH=\'1k\';d.cJ=\'1k\'}}if(!o){o={}}G B.1y(C(){if(B.8L||!A.12)G;if(1P.6j){B.eX=C(){G H};B.eW=C(){G H}}F a=B;F b=o.3c?A(B).eV(o.3c):A(B);if(A.2R.46){b.1y(C(){B.aI="bU"})}L{b.E(\'-eU-6f-7Q\',\'1k\');b.E(\'6f-7Q\',\'1k\');b.E(\'-eT-6f-7Q\',\'1k\')}B.D={cM:b,5B:o.5B?14:H,3L:o.3L?14:H,3I:o.3I?o.3I:H,4P:o.4P?o.4P:H,7V:o.7V?o.7V:H,3j:o.3j?R(o.3j)||0:H,1E:o.1E?2c(o.1E):H,fx:R(o.fx)||P,5z:o.5z?o.5z:H,4V:{},1A:{},4c:o.4c&&o.4c.1F==2w?o.4c:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2I:o.2I&&o.2I.1F==2w?o.2I:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:0,2M:o.2M?o.2M:H,ar:o.ar?14:H,6i:o.6i||H};if(o.4V&&o.4V.1F==2w)B.D.4V.6f=o.4V;if(o.4h&&o.4h.1F==2w)B.D.4h=o.4h;if(o.2e&&((o.2e.1F==8t&&(o.2e==\'7X\'||o.2e==\'1c\'))||(o.2e.1F==6h&&o.2e.1b==4))){B.D.2e=o.2e}if(o.2C){B.D.2C=o.2C}if(o.5y){if(28 o.5y==\'eO\'){B.D.gx=R(o.5y)||1;B.D.gy=R(o.5y)||1}L if(o.5y.1b==2){B.D.gx=R(o.5y[0])||1;B.D.gy=R(o.5y[1])||1}}if(o.3n&&o.3n.1F==2w){B.D.3n=o.3n}B.8L=14;b.1y(C(){B.3H=a});b.1C(\'4R\',A.X.aM)})}};A.fn.1U({8j:A.X.4v,6r:A.X.2l});A.1s={bP:C(a,b,c,d){G a<=A.X.1g.D.2n&&(a+c)>=(A.X.1g.D.2n+A.X.1g.D.1w.w)&&b<=A.X.1g.D.2j&&(b+d)>=(A.X.1g.D.2j+A.X.1g.D.1w.h)?14:H},9S:C(a,b,c,d){G!(a>(A.X.1g.D.2n+A.X.1g.D.1w.w)||(a+c)<A.X.1g.D.2n||b>(A.X.1g.D.2j+A.X.1g.D.1w.h)||(b+d)<A.X.1g.D.2j)?14:H},1A:C(a,b,c,d){G a<A.X.1g.D.4d.x&&(a+c)>A.X.1g.D.4d.x&&b<A.X.1g.D.4d.y&&(b+d)>A.X.1g.D.4d.y?14:H},4T:H,3z:{},7p:0,3p:{},ck:C(a){if(A.X.1g==P){G}F i;A.1s.3z={};F b=H;1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F c=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+c.1f.a)){if(c.1f.m==H){c.1f.p=A.1U(A.12.6x(c),A.12.6w(c));c.1f.m=14}if(c.1f.ac){A.1s.3p[i].2H(c.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&c.1f.s&&A.X.1g.D.3I){c.1f.el=A(\'.\'+c.1f.a,c);a.Y.11=\'1k\';A.1p.bM(c);c.1f.9P=A.1p.8g(A.1m(c,\'id\')).6A;a.Y.11=a.D.6o;b=14}if(c.1f.9O){c.1f.9O.1x(A.1s.3p[i].I(0),[A.X.1g])}}}}if(b){A.1p.2b()}},eF:C(){A.1s.3z={};1V(i in A.1s.3p){if(A.1s.3p[i]!=P){F a=A.1s.3p[i].I(0);if(A(A.X.1g).is(\'.\'+a.1f.a)){a.1f.p=A.1U(A.12.6x(a),A.12.6w(a));if(a.1f.ac){A.1s.3p[i].2H(a.1f.ac)}A.1s.3z[i]=A.1s.3p[i];if(A.1p&&a.1f.s&&A.X.1g.D.3I){a.1f.el=A(\'.\'+a.1f.a,a);bJ.Y.11=\'1k\';A.1p.bM(a);bJ.Y.11=bJ.D.6o}}}}},8n:C(e){if(A.X.1g==P){G}A.1s.4T=H;F i;F a=H;F b=0;1V(i in A.1s.3z){F c=A.1s.3z[i].I(0);if(A.1s.4T==H&&A.1s[c.1f.t](c.1f.p.x,c.1f.p.y,c.1f.p.1D,c.1f.p.hb)){if(c.1f.hc&&c.1f.h==H){A.1s.3z[i].2H(c.1f.hc)}if(c.1f.h==H&&c.1f.76){a=14}c.1f.h=14;A.1s.4T=c;if(A.1p&&c.1f.s&&A.X.1g.D.3I){A.1p.18.I(0).2Z=c.1f.eC;A.1p.8n(c)}b++}L if(c.1f.h==14){if(c.1f.6C){c.1f.6C.1x(c,[e,A.X.18.I(0).6M,c.1f.fx])}if(c.1f.hc){A.1s.3z[i].3S(c.1f.hc)}c.1f.h=H}}if(A.1p&&!A.1s.4T&&A.X.1g.3I){A.1p.18.I(0).Y.11=\'1k\'}if(a){A.1s.4T.1f.76.1x(A.1s.4T,[e,A.X.18.I(0).6M])}},c8:C(e){F i;1V(i in A.1s.3z){F a=A.1s.3z[i].I(0);if(a.1f.ac){A.1s.3z[i].3S(a.1f.ac)}if(a.1f.hc){A.1s.3z[i].3S(a.1f.hc)}if(a.1f.s){A.1p.73[A.1p.73.1b]=i}if(a.1f.9I&&a.1f.h==14){a.1f.h=H;a.1f.9I.1x(a,[e,a.1f.fx])}a.1f.m=H;a.1f.h=H}A.1s.3z={}},4v:C(){G B.1y(C(){if(B.8S){if(B.1f.s){id=A.1m(B,\'id\');A.1p.54[id]=P;A(\'.\'+B.1f.a,B).8j()}A.1s.3p[\'d\'+B.bG]=P;B.8S=H;B.f=P}})},2l:C(o){G B.1y(C(){if(B.8S==14||!o.3r||!A.12||!A.X){G}B.1f={a:o.3r,ac:o.9F||H,hc:o.8X||H,eC:o.4G||H,9I:o.je||o.9I||H,76:o.76||o.ev||H,6C:o.6C||o.er||H,9O:o.9O||H,t:o.5T&&(o.5T==\'bP\'||o.5T==\'9S\')?o.5T:\'1A\',fx:o.fx?o.fx:H,m:H,h:H};if(o.bC==14&&A.1p){id=A.1m(B,\'id\');A.1p.54[id]=B.1f.a;B.1f.s=14;if(o.2I){B.1f.2I=o.2I;B.1f.9P=A.1p.8g(id).6A}}B.8S=14;B.bG=R(Z.63()*aW);A.1s.3p[\'d\'+B.bG]=A(B);A.1s.7p++})}};A.fn.1U({ei:A.1s.4v,ee:A.1s.2l});A.jd=A.1s.eF;A.3l={18:P,89:C(){3D=B.2m;if(!3D)G;Y={eb:A(B).E(\'eb\')||\'\',4a:A(B).E(\'4a\')||\'\',87:A(B).E(\'87\')||\'\',e9:A(B).E(\'e9\')||\'\',e8:A(B).E(\'e8\')||\'\',e7:A(B).E(\'e7\')||\'\',bx:A(B).E(\'bx\')||\'\',e6:A(B).E(\'e6\')||\'\'};A.3l.18.E(Y);3i=A.3l.e5(3D);3i=3i.48(W bw("\\\\n","g"),"<br />");A.3l.18.3i(\'j6\');b3=A.3l.18.I(0).3P;A.3l.18.3i(3i);V=A.3l.18.I(0).3P+b3;if(B.66.65&&V>B.66.65[0]){V=B.66.65[0]}B.Y.V=V+\'Q\';if(B.4D==\'bs\'){S=A.3l.18.I(0).5r+b3;if(B.66.65&&S>B.66.65[1]){S=B.66.65[1]}B.Y.S=S+\'Q\'}},e5:C(a){bq={\'&\':\'&j1;\',\'<\':\'&j0;\',\'>\':\'&gt;\',\'"\':\'&iZ;\'};1V(i in bq){a=a.48(W bw(i,\'g\'),bq[i])}G a},2l:C(a){if(A.3l.18==P){A(\'23\',1c).1L(\'<1W id="dX" Y="T: 1J; O: 0; M: 0; 2W: 2B;"></1W>\');A.3l.18=A(\'#dX\')}G B.1y(C(){if(/bs|aV/.3M(B.4D)){if(B.4D==\'aV\'){dT=B.4Z(\'1K\');if(!/3D|iW/.3M(dT)){G}}if(a&&(a.1F==bm||(a.1F==6h&&a.1b==2))){if(a.1F==bm)a=[a,a];L{a[0]=R(a[0])||7n;a[1]=R(a[1])||7n}B.66={65:a}}A(B).4W(A.3l.89).5Q(A.3l.89).cV(A.3l.89);A.3l.89.1x(B)}})}};A.fn.iU=A.3l.2l;A.fn.1U({c3:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'4l\',c)})},dP:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'41\',c)})},iQ:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dG\',c)})},iM:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'M\',c)})},iL:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'2D\',c)})},iK:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5l(B,a,b,\'dF\',c)})}});A.fx.5l=C(e,a,b,c,d){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1N=A.12.2f(e);z.1e=28 b==\'4B\'?b:d||P;if(!e.4f)e.4f=z.el.E(\'11\');if(c==\'dG\'){c=z.el.E(\'11\')==\'1k\'?\'41\':\'4l\'}L if(c==\'dF\'){c=z.el.E(\'11\')==\'1k\'?\'2D\':\'M\'}z.el.1S();z.1l=a;z.29=28 b==\'C\'?b:P;z.fx=A.fx.9u(e);z.6T=c;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.6T==\'41\'||z.6T==\'2D\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(z.fx.U.1o.hb,0);1n;19\'41\':z.fx.2Y.E(\'S\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');5q.1G(0,z.fx.U.1o.hb);1n;19\'M\':5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(z.fx.U.1o.1D,0);1n;19\'2D\':z.fx.2Y.E(\'V\',\'9e\');z.el.1S();5q=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');5q.1G(0,z.fx.U.1o.1D);1n}};A.fn.iA=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.eu(B,a,b);e.bE()})};A.fx.eu=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.29=b;z.8e=R(a)||40;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.74=5;z.52=1;z.bE=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:io,1T:C(){z.e=W A.fx(z.el.I(0),{1H:80,1T:C(){z.8e=R(z.8e/2);if(z.52<=z.74)z.bE();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'O\');z.e.1G(z.U.O-z.8e,z.U.O)}},\'O\');z.e.1G(z.U.O,z.U.O-z.8e)}};A.fn.1U({im:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3U\',c)})},ik:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'in\',c)})},ii:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'41\',\'3E\',c)})},ig:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3U\',c)})},ie:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'in\',c)})},ic:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'4l\',\'3E\',c)})},ib:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3U\',c)})},ia:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'in\',c)})},i9:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'M\',\'3E\',c)})},i8:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3U\',c)})},i7:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'in\',c)})},i6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.3Y(B,a,b,\'2D\',\'3E\',c)})}});A.fx.3Y=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.U={};z.U.T=z.el.E(\'T\');z.U.O=z.el.E(\'O\');z.U.M=z.el.E(\'M\');if(!e.4f)e.4f=z.el.E(\'11\');if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}z.el.1S();if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.1K=d;b=28 b==\'C\'?b:P;7N=1;2X(c){19\'4l\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;7N=-1;1n;19\'41\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'O\');z.5x=2c(z.U.O)||0;z.9i=z.dt;1n;19\'2D\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;1n;19\'M\':z.e=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'M\');z.5x=2c(z.U.M)||0;z.9i=z.ds;7N=-1;1n}z.e2=W A.fx(z.el.I(0),A.1l(a,z.1e,C(){z.el.E(z.U);if(z.1K==\'3U\'){z.el.E(\'11\',\'1k\')}L z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f);A.2z(z.el.I(0),\'1j\')}),\'1E\');if(d==\'in\'){z.e.1G(z.5x+1Y*7N,z.5x);z.e2.1G(0,1)}L{z.e.1G(z.5x,z.5x+1Y*7N);z.e2.1G(1,0)}};A.fn.1U({i5:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'dq\',d)})},i4:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'9g\',d)})},i3:C(a,b,c,d){G B.1r(\'1j\',C(){W A.fx.9h(B,a,b,c,\'3E\',d)})}});A.fx.9h=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 c==\'4B\'?c:f||P;z.29=28 c==\'C\'?c:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'9g\':\'dq\'}z.1l=a;z.S=b&&b.1F==bm?b:20;z.fx=A.fx.9u(e);z.1K=d;z.1T=C(){if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}if(z.1K==\'9g\'){z.el.1S()}L{z.el.2x()}A.fx.9n(z.fx.2Y.I(0),z.fx.U);A.2z(z.el.I(0),\'1j\')};if(z.1K==\'9g\'){z.el.1S();z.fx.2Y.E(\'S\',z.S+\'Q\').E(\'V\',\'9e\');z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'S\');z.ef.1G(z.S,z.fx.U.1o.hb)}),\'V\');z.ef.1G(0,z.fx.U.1o.1D)}L{z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,C(){z.ef=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e,z.1T),\'V\');z.ef.1G(z.fx.U.1o.1D,0)}),\'S\');z.ef.1G(z.fx.U.1o.hb,z.S)}};A.fn.i2=C(c,d,e,f){G B.1r(\'dp\',C(){B.6Q=A(B).1m("Y")||\'\';f=28 e==\'4B\'?e:f||P;e=28 e==\'C\'?e:P;F a=A(B).E(\'6P\');F b=B.2S;6k(a==\'b7\'&&b){a=A(b).E(\'6P\');b=b.2S}A(B).E(\'6P\',d);if(28 B.6Q==\'7M\')B.6Q=B.6Q["9d"];A(B).4S({\'6P\':a},c,f,C(){A.2z(B,\'dp\');if(28 A(B).1m("Y")==\'7M\'){A(B).1m("Y")["9d"]="";A(B).1m("Y")["9d"]=B.6Q}L{A(B).1m("Y",B.6Q)}if(e)e.1x(B)})})};A.4n=C(e){if(/^i1$|^i0$|^hZ$|^5W$|^hY$|^hX$|^hW$|^hV$|^hU$|^23$|^hT$|^hS$|^hR$|^hQ$|^hP$|^hO$|^hN$/i.3M(e.98))G H;L G 14};A.fx.9n=C(e,a){F c=e.6M;F b=c.Y;b.T=a.T;b.4M=a.3s.t;b.4K=a.3s.l;b.4L=a.3s.b;b.53=a.3s.r;b.O=a.O+\'Q\';b.M=a.M+\'Q\';e.2S.dn(c,e);e.2S.hM(e)};A.fx.9u=C(e){if(!A.4n(e))G H;F t=A(e);F a=e.Y;F b=H;if(t.E(\'11\')==\'1k\'){95=t.E(\'2W\');t.E(\'2W\',\'2B\').1S();b=14}F c={};c.T=t.E(\'T\');c.1o=A.12.2f(e);c.3s=A.12.b2(e);F d=e.4u?e.4u.dk:t.E(\'hK\');c.O=R(t.E(\'O\'))||0;c.M=R(t.E(\'M\'))||0;F f=\'hJ\'+R(Z.63()*aW);F g=1c.3x(/^3O$|^br$|^hI$|^hr$|^7Q$|^hH$|^7M$|^3q$|^hF$|^hE$|^hC$|^90$|^dl$|^hB$/i.3M(e.98)?\'1W\':e.98);A.1m(g,\'id\',f);F h=A(g).2H(\'hA\');F i=g.Y;F j=0;F k=0;if(c.T==\'2i\'||c.T==\'1J\'){j=c.O;k=c.M}i.O=j+\'Q\';i.M=k+\'Q\';i.T=c.T!=\'2i\'&&c.T!=\'1J\'?\'2i\':c.T;i.S=c.1o.hb+\'Q\';i.V=c.1o.1D+\'Q\';i.4M=c.3s.t;i.53=c.3s.r;i.4L=c.3s.b;i.4K=c.3s.l;i.2N=\'2B\';if(A.2R.46){i.dk=d}L{i.hz=d}if(A.2R=="46"){a.4X="7s(1E="+0.dg*1Y+")"}a.1E=0.dg;e.2S.dn(g,e);g.hy(e);a.4M=\'2G\';a.53=\'2G\';a.4L=\'2G\';a.4K=\'2G\';a.T=\'1J\';a.bV=\'1k\';a.O=\'2G\';a.M=\'2G\';if(b){t.2x();a.2W=95}G{U:c,2Y:A(g)}};A.fx.7H={hx:[0,1O,1O],hw:[dd,1O,1O],hv:[db,db,hu],hs:[0,0,0],hq:[0,0,1O],hp:[d6,42,42],hn:[0,1O,1O],hm:[0,0,6N],hl:[0,6N,6N],hk:[aX,aX,aX],hi:[0,1Y,0],hg:[hf,he,cZ],hd:[6N,0,6N],ha:[85,cZ,47],h7:[1O,cY,0],h6:[h5,50,h4],h3:[6N,0,0],h2:[h1,cX,h0],gZ:[gY,0,8U],gX:[1O,0,1O],gW:[1O,gU,0],gT:[0,67,0],gS:[75,0,gQ],gP:[dd,cU,cY],gO:[gL,gK,cU],gI:[cT,1O,1O],gH:[cS,gG,cS],gF:[8U,8U,8U],gD:[1O,gC,gB],gA:[1O,1O,cT],gw:[0,1O,0],gv:[1O,0,1O],gu:[67,0,0],gs:[0,0,67],gr:[67,67,0],gq:[1O,d6,0],gp:[1O,8R,gn],gm:[67,0,67],gl:[1O,0,0],gk:[8R,8R,8R],gj:[1O,1O,1O],gi:[1O,1O,0]};A.fx.5L=C(a,b){if(A.fx.7H[a])G{r:A.fx.7H[a][0],g:A.fx.7H[a][1],b:A.fx.7H[a][2]};L if(2L=/^6v\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$/.8Q(a))G{r:R(2L[1]),g:R(2L[2]),b:R(2L[3])};L if(2L=/6v\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)$/.8Q(a))G{r:2c(2L[1])*2.55,g:2c(2L[2])*2.55,b:2c(2L[3])*2.55};L if(2L=/^#([a-fA-6t-9])([a-fA-6t-9])([a-fA-6t-9])$/.8Q(a))G{r:R("6s"+2L[1]+2L[1]),g:R("6s"+2L[2]+2L[2]),b:R("6s"+2L[3]+2L[3])};L if(2L=/^#([a-fA-6t-9]{2})([a-fA-6t-9]{2})([a-fA-6t-9]{2})$/.8Q(a))G{r:R("6s"+2L[1]),g:R("6s"+2L[2]),b:R("6s"+2L[3])};L G b==14?H:{r:1O,g:1O,b:1O}};A.fx.cQ={5d:1,4y:1,5i:1,4x:1,4e:1,4a:1,S:1,M:1,bx:1,gh:1,4L:1,4K:1,53:1,4M:1,7y:1,5R:1,7x:1,8O:1,1E:1,ge:1,gc:1,4Q:1,4F:1,5g:1,5b:1,2D:1,gb:1,O:1,V:1,3j:1};A.fx.cN={6P:1,ga:1,g9:1,g8:1,g7:1,g6:1,g5:1};A.fx.7v=[\'g4\',\'g3\',\'g2\',\'g1\'];A.fx.aL={\'aK\':[\'2u\',\'cK\'],\'8E\':[\'2u\',\'aH\'],\'5X\':[\'5X\',\'\'],\'7E\':[\'7E\',\'\']};A.fn.1U({4S:C(b,c,d,f){G B.1r(C(){F a=A.1l(c,d,f);F e=W A.cI(B,a,b)})},aG:C(b,c){G B.1r(C(){F a=A.1l(b,c);F e=W A.aG(B,a)})},7w:C(a){G B.1y(C(){if(B.5e)A.aF(B,a)})},fZ:C(a){G B.1y(C(){if(B.5e)A.aF(B,a);if(B.1r&&B.1r[\'fx\'])B.1r.fx=[]})}});A.1U({aG:C(a,b){F z=B,5f;z.3f=C(){if(A.cF(b.1T))b.1T.1x(a)};z.2A=5Y(C(){z.3f()},b.1H);a.5e=z},1e:{b1:C(p,n,a,b,c){G((-Z.51(p*Z.2F)/2)+0.5)*b+a}},cI:C(f,g,h){F z=B,5f;F y=f.Y;F k=A.E(f,"2N");F l=A.E(f,"11");F o={};z.9a=(W 6p()).6y();g.1e=g.1e&&A.1e[g.1e]?g.1e:\'b1\';z.8H=C(a,b){if(A.fx.cQ[a]){if(b==\'1S\'||b==\'2x\'||b==\'3E\'){if(!f.5I)f.5I={};F r=2c(A.5S(f,a));f.5I[a]=r&&r>-aW?r:(2c(A.E(f,a))||0);b=b==\'3E\'?(l==\'1k\'?\'1S\':\'2x\'):b;g[b]=14;o[a]=b==\'1S\'?[0,f.5I[a]]:[f.5I[a],0];if(a!=\'1E\')y[a]=o[a][0]+(a!=\'3j\'&&a!=\'87\'?\'Q\':\'\');L A.1m(y,"1E",o[a][0])}L{o[a]=[2c(A.5S(f,a)),2c(b)||0]}}L if(A.fx.cN[a])o[a]=[A.fx.5L(A.5S(f,a)),A.fx.5L(b)];L if(/^5X$|7E$|2u$|8E$|aK$/i.3M(a)){F m=b.48(/\\s+/g,\' \').48(/6v\\s*\\(\\s*/g,\'6v(\').48(/\\s*,\\s*/g,\',\').48(/\\s*\\)/g,\')\').aD(/([^\\s]+)/g);2X(a){19\'5X\':19\'7E\':19\'aK\':19\'8E\':m[3]=m[3]||m[1]||m[0];m[2]=m[2]||m[0];m[1]=m[1]||m[0];1V(F i=0;i<A.fx.7v.1b;i++){F c=A.fx.aL[a][0]+A.fx.7v[i]+A.fx.aL[a][1];o[c]=a==\'8E\'?[A.fx.5L(A.5S(f,c)),A.fx.5L(m[i])]:[2c(A.5S(f,c)),2c(m[i])]}1n;19\'2u\':1V(F i=0;i<m.1b;i++){F d=2c(m[i]);F e=!fX(d)?\'cK\':(!/b7|1k|2B|fW|fV|fU|fT|fS|fQ|fP|fO/i.3M(m[i])?\'aH\':H);if(e){1V(F j=0;j<A.fx.7v.1b;j++){c=\'2u\'+A.fx.7v[j]+e;o[c]=e==\'aH\'?[A.fx.5L(A.5S(f,c)),A.fx.5L(m[i])]:[2c(A.5S(f,c)),d]}}L{y[\'fN\']=m[i]}}1n}}L{y[a]=b}G H};1V(p in h){if(p==\'Y\'){F q=A.ax(h[p]);1V(6I in q){B.8H(6I,q[6I])}}L if(p==\'2Z\'){if(1c.8D)1V(F i=0;i<1c.8D.1b;i++){F s=1c.8D[i].fM||1c.8D[i].fL||P;if(s){1V(F j=0;j<s.1b;j++){if(s[j].fK==\'.\'+h[p]){F u=W bw(\'\\.\'+h[p]+\' {\');F v=s[j].Y.9d;F q=A.ax(v.48(u,\'\').48(/}/g,\'\'));1V(6I in q){B.8H(6I,q[6I])}}}}}}L{B.8H(p,h[p])}}y.11=l==\'1k\'?\'2v\':l;y.2N=\'2B\';z.3f=C(){F t=(W 6p()).6y();if(t>g.1H+z.9a){5h(z.2A);z.2A=P;1V(p in o){if(p=="1E")A.1m(y,"1E",o[p][1]);L if(28 o[p][1]==\'7M\')y[p]=\'6v(\'+o[p][1].r+\',\'+o[p][1].g+\',\'+o[p][1].b+\')\';L y[p]=o[p][1]+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}if(g.2x||g.1S)1V(F p in f.5I)if(p=="1E")A.1m(y,p,f.5I[p]);L y[p]="";y.11=g.2x?\'1k\':(l!=\'1k\'?l:\'2v\');y.2N=k;f.5e=P;if(A.cF(g.1T))g.1T.1x(f)}L{F n=t-B.9a;F a=n/g.1H;1V(p in o){if(28 o[p][1]==\'7M\'){y[p]=\'6v(\'+R(A.1e[g.1e](a,n,o[p][0].r,(o[p][1].r-o[p][0].r),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].g,(o[p][1].g-o[p][0].g),g.1H))+\',\'+R(A.1e[g.1e](a,n,o[p][0].b,(o[p][1].b-o[p][0].b),g.1H))+\')\'}L{F b=A.1e[g.1e](a,n,o[p][0],(o[p][1]-o[p][0]),g.1H);if(p=="1E")A.1m(y,"1E",b);L y[p]=b+(p!=\'3j\'&&p!=\'87\'?\'Q\':\'\')}}}};z.2A=5Y(C(){z.3f()},13);f.5e=z},aF:C(a,b){if(b)a.5e.9a-=fJ;L{1P.5h(a.5e.2A);a.5e=P;A.2z(a,"fx")}}});A.ax=C(a){F b={};if(28 a==\'4B\'){a=a.5u().6W(\';\');1V(F i=0;i<a.1b;i++){8B=a[i].6W(\':\');if(8B.1b==2){b[A.cE(8B[0].48(/\\-(\\w)/g,C(m,c){G c.fI()}))]=A.cE(8B[1])}}}G b};A.fn.1U({fH:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3K\',\'5o\',c)})},fG:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3Z\',\'5o\',c)})},fF:C(a,b,c){G B.1r(\'1j\',C(){if(A.E(B,\'11\')==\'1k\'){W A.fx.4N(B,a,b,\'3Z\',\'6n\',c)}L{W A.fx.4N(B,a,b,\'3Z\',\'5o\',c)}})},fE:C(a,b,c){G B.1r(\'1j\',C(){if(A.E(B,\'11\')==\'1k\'){W A.fx.4N(B,a,b,\'3K\',\'6n\',c)}L{W A.fx.4N(B,a,b,\'3K\',\'5o\',c)}})},fD:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3K\',\'6n\',c)})},fC:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.4N(B,a,b,\'3Z\',\'6n\',c)})}});A.fx.4N=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;F g=H;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.29=28 b==\'C\'?b:P;z.1K=d;z.1l=a;z.26=A.12.2f(e);z.U={};z.U.T=z.el.E(\'T\');z.U.11=z.el.E(\'11\');if(z.U.11==\'1k\'){95=z.el.E(\'2W\');z.el.1S();g=14}z.U.O=z.el.E(\'O\');z.U.M=z.el.E(\'M\');if(g){z.el.2x();z.el.E(\'2W\',95)}z.U.V=z.26.w+\'Q\';z.U.S=z.26.h+\'Q\';z.U.2N=z.el.E(\'2N\');z.26.O=R(z.U.O)||0;z.26.M=R(z.U.M)||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.el.E(\'2N\',\'2B\').E(\'S\',d==\'6n\'&&c==\'3K\'?1:z.26.h+\'Q\').E(\'V\',d==\'6n\'&&c==\'3Z\'?1:z.26.w+\'Q\');z.1T=C(){z.el.E(z.U);if(z.1K==\'5o\')z.el.2x();L z.el.1S();A.2z(z.el.I(0),\'1j\')};2X(c){19\'3K\':z.eh=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'S\');z.et=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');if(z.1K==\'5o\'){z.eh.1G(z.26.h,0);z.et.1G(z.26.O,z.26.O+z.26.h/2)}L{z.eh.1G(0,z.26.h);z.et.1G(z.26.O+z.26.h/2,z.26.O)}1n;19\'3Z\':z.eh=W A.fx(z.el.I(0),A.1l(a-15,z.1e,b),\'V\');z.et=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');if(z.1K==\'5o\'){z.eh.1G(z.26.w,0);z.et.1G(z.26.M,z.26.M+z.26.w/2)}L{z.eh.1G(0,z.26.w);z.et.1G(z.26.M+z.26.w/2,z.26.M)}1n}};A.fn.au=C(b,c,d){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F a=W A.fx.au(B,b,c,d);a.at()})};A.fx.au=C(a,b,c,d){F z=B;z.74=c;z.52=1;z.el=a;z.1l=b;z.29=d;A(z.el).1S();z.at=C(){z.52++;z.e=W A.fx(z.el,A.1l(z.1l,C(){z.ef=W A.fx(z.el,A.1l(z.1l,C(){if(z.52<=z.74)z.at();L{A.2z(z.el,\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el)}}}),\'1E\');z.ef.1G(0,1)}),\'1E\');z.e.1G(1,0)}};A.fn.1U({fB:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5E(B,a,1,1Y,14,b,\'cz\',c)})},fy:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.5E(B,a,1Y,1,14,b,\'as\',c)})},fw:C(b,c,d){G B.1r(\'1j\',C(){F a=a||\'d2\';W A.fx.5E(B,b,1Y,cX,14,c,\'5c\',a)})},5E:C(a,b,c,d,e,f){G B.1r(\'1j\',C(){W A.fx.5E(B,a,b,c,d,e,\'5E\',f)})}});A.fx.5E=C(e,f,g,h,j,k,m,q){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.6m=R(g)||1Y;z.3v=R(h)||1Y;z.1e=28 k==\'4B\'?k:q||P;z.29=28 k==\'C\'?k:P;z.1H=A.1l(f).1H;z.bL=j||P;z.26=A.12.2f(e);z.U={V:z.el.E(\'V\'),S:z.el.E(\'S\'),4a:z.el.E(\'4a\')||\'1Y%\',T:z.el.E(\'T\'),11:z.el.E(\'11\'),O:z.el.E(\'O\'),M:z.el.E(\'M\'),2N:z.el.E(\'2N\'),4x:z.el.E(\'4x\'),5i:z.el.E(\'5i\'),5d:z.el.E(\'5d\'),4y:z.el.E(\'4y\'),5b:z.el.E(\'5b\'),5g:z.el.E(\'5g\'),4Q:z.el.E(\'4Q\'),4F:z.el.E(\'4F\')};z.V=R(z.U.V)||e.3P||0;z.S=R(z.U.S)||e.5r||0;z.O=R(z.U.O)||0;z.M=R(z.U.M)||0;1o=[\'em\',\'Q\',\'fv\',\'%\'];1V(i in 1o){if(z.U.4a.3o(1o[i])>0){z.cy=1o[i];z.4a=2c(z.U.4a)}if(z.U.4x.3o(1o[i])>0){z.cx=1o[i];z.aq=2c(z.U.4x)||0}if(z.U.5i.3o(1o[i])>0){z.cw=1o[i];z.ap=2c(z.U.5i)||0}if(z.U.5d.3o(1o[i])>0){z.cv=1o[i];z.ao=2c(z.U.5d)||0}if(z.U.4y.3o(1o[i])>0){z.cu=1o[i];z.an=2c(z.U.4y)||0}if(z.U.5b.3o(1o[i])>0){z.ct=1o[i];z.am=2c(z.U.5b)||0}if(z.U.5g.3o(1o[i])>0){z.cr=1o[i];z.al=2c(z.U.5g)||0}if(z.U.4Q.3o(1o[i])>0){z.cq=1o[i];z.ak=2c(z.U.4Q)||0}if(z.U.4F.3o(1o[i])>0){z.cp=1o[i];z.aj=2c(z.U.4F)||0}}if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.el.E(\'2N\',\'2B\');z.1K=m;2X(z.1K){19\'cz\':z.3V=z.O+z.26.h/2;z.4H=z.O;z.3Q=z.M+z.26.w/2;z.4r=z.M;1n;19\'as\':z.4H=z.O+z.26.h/2;z.3V=z.O;z.4r=z.M+z.26.w/2;z.3Q=z.M;1n;19\'5c\':z.4H=z.O-z.26.h/4;z.3V=z.O;z.4r=z.M-z.26.w/4;z.3Q=z.M;1n}z.ai=H;z.t=(W 6p).6y();z.4i=C(){5h(z.2A);z.2A=P};z.3f=C(){if(z.ai==H){z.el.1S();z.ai=14}F t=(W 6p).6y();F n=t-z.t;F p=n/z.1H;if(t>=z.1H+z.t){97(C(){o=1;if(z.1K){t=z.4H;l=z.4r;if(z.1K==\'5c\')o=0}z.ag(z.3v,l,t,14,o)},13);z.4i()}L{o=1;if(!A.1e||!A.1e[z.1e]){s=((-Z.51(p*Z.2F)/2)+0.5)*(z.3v-z.6m)+z.6m}L{s=A.1e[z.1e](p,n,z.6m,(z.3v-z.6m),z.1H)}if(z.1K){if(!A.1e||!A.1e[z.1e]){t=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V;l=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q;if(z.1K==\'5c\')o=((-Z.51(p*Z.2F)/2)+0.5)*(-0.9B)+0.9B}L{t=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.1H);l=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.1H);if(z.1K==\'5c\')o=A.1e[z.1e](p,n,0.9B,-0.9B,z.1H)}}z.ag(s,l,t,H,o)}};z.2A=5Y(C(){z.3f()},13);z.ag=C(a,b,c,d,e){z.el.E(\'S\',z.S*a/1Y+\'Q\').E(\'V\',z.V*a/1Y+\'Q\').E(\'M\',b+\'Q\').E(\'O\',c+\'Q\').E(\'4a\',z.4a*a/1Y+z.cy);if(z.aq)z.el.E(\'4x\',z.aq*a/1Y+z.cx);if(z.ap)z.el.E(\'5i\',z.ap*a/1Y+z.cw);if(z.ao)z.el.E(\'5d\',z.ao*a/1Y+z.cv);if(z.an)z.el.E(\'4y\',z.an*a/1Y+z.cu);if(z.am)z.el.E(\'5b\',z.am*a/1Y+z.ct);if(z.al)z.el.E(\'5g\',z.al*a/1Y+z.cr);if(z.ak)z.el.E(\'4Q\',z.ak*a/1Y+z.cq);if(z.aj)z.el.E(\'4F\',z.aj*a/1Y+z.cp);if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+e*1Y+")";z.el.I(0).Y.1E=e}if(d){if(z.bL){z.el.E(z.U)}if(z.1K==\'as\'||z.1K==\'5c\'){z.el.E(\'11\',\'1k\');if(z.1K==\'5c\'){if(1P.6j)z.el.I(0).Y.4X="7s(1E="+1Y+")";z.el.I(0).Y.1E=1}}L z.el.E(\'11\',\'2v\');if(z.29)z.29.1x(z.el.I(0));A.2z(z.el.I(0),\'1j\')}}};A.fn.1U({9A:C(a,b,c){o=A.1l(a);G B.1r(\'1j\',C(){W A.fx.9A(B,o,b,c)})},ft:C(a,b,c){G B.1y(C(){A(\'a[@2U*="#"]\',B).4U(C(e){co=B.2U.6W(\'#\');A(\'#\'+co[1]).9A(a,b,c);G H})})}});A.fx.9A=C(e,o,a,b){F z=B;z.o=o;z.e=e;z.2g=/cn|cm/.3M(a)?a:H;z.1e=b;p=A.12.3a(e);s=A.12.5O();z.4i=C(){5h(z.2A);z.2A=P;A.2z(z.e,\'1j\')};z.t=(W 6p).6y();s.h=s.h>s.ih?(s.h-s.ih):s.h;s.w=s.w>s.iw?(s.w-s.iw):s.w;z.4H=p.y>s.h?s.h:p.y;z.4r=p.x>s.w?s.w:p.x;z.3V=s.t;z.3Q=s.l;z.3f=C(){F t=(W 6p).6y();F n=t-z.t;F p=n/z.o.1H;if(t>=z.o.1H+z.t){z.4i();97(C(){z.ab(z.4H,z.4r)},13)}L{if(!z.2g||z.2g==\'cn\'){if(!A.1e||!A.1e[z.1e]){8v=((-Z.51(p*Z.2F)/2)+0.5)*(z.4H-z.3V)+z.3V}L{8v=A.1e[z.1e](p,n,z.3V,(z.4H-z.3V),z.o.1H)}}L{8v=z.3V}if(!z.2g||z.2g==\'cm\'){if(!A.1e||!A.1e[z.1e]){8u=((-Z.51(p*Z.2F)/2)+0.5)*(z.4r-z.3Q)+z.3Q}L{8u=A.1e[z.1e](p,n,z.3Q,(z.4r-z.3Q),z.o.1H)}}L{8u=z.3Q}z.ab(8v,8u)}};z.ab=C(t,l){1P.fs(l,t)};z.2A=5Y(C(){z.3f()},13)};A.fn.a8=C(a,b){G B.1r(\'1j\',C(){if(!A.4n(B)){A.2z(B,\'1j\');G H}F e=W A.fx.a8(B,a,b);e.a7()})};A.fx.a8=C(e,a,b){F z=B;z.el=A(e);z.el.1S();z.74=R(a)||3;z.29=b;z.52=1;z.U={};z.U.T=z.el.E(\'T\');z.U.O=R(z.el.E(\'O\'))||0;z.U.M=R(z.el.E(\'M\'))||0;if(z.U.T!=\'2i\'&&z.U.T!=\'1J\'){z.el.E(\'T\',\'2i\')}z.a7=C(){z.52++;z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(z.el.I(0),{1H:60,1T:C(){z.e=W A.fx(e,{1H:60,1T:C(){if(z.52<=z.74)z.a7();L{z.el.E(\'T\',z.U.T).E(\'O\',z.U.O+\'Q\').E(\'M\',z.U.M+\'Q\');A.2z(z.el.I(0),\'1j\');if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}}}},\'M\');z.e.1G(z.U.M-20,z.U.M)}},\'M\');z.e.1G(z.U.M+20,z.U.M-20)}},\'M\');z.e.1G(z.U.M,z.U.M+20)}};A.fn.1U({dR:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'in\',c)})},c6:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3U\',c)})},fr:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'4l\',\'3E\',c)})},fq:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'in\',c)})},fp:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3U\',c)})},fo:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'41\',\'3E\',c)})},fm:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'in\',c)})},fl:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3U\',c)})},fk:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'M\',\'3E\',c)})},fj:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'in\',c)})},fi:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3U\',c)})},fh:C(a,b,c){G B.1r(\'1j\',C(){W A.fx.1u(B,a,b,\'2D\',\'3E\',c)})}});A.fx.1u=C(e,a,b,c,d,f){if(!A.4n(e)){A.2z(e,\'1j\');G H}F z=B;z.el=A(e);z.1e=28 b==\'4B\'?b:f||P;z.29=28 b==\'C\'?b:P;if(d==\'3E\'){d=z.el.E(\'11\')==\'1k\'?\'in\':\'3U\'}if(!e.4f)e.4f=z.el.E(\'11\');z.el.1S();z.1l=a;z.fx=A.fx.9u(e);z.1K=d;z.6T=c;z.1T=C(){if(z.1K==\'3U\')z.el.E(\'2W\',\'2B\');A.fx.9n(z.fx.2Y.I(0),z.fx.U);if(z.1K==\'in\'){z.el.E(\'11\',z.el.I(0).4f==\'1k\'?\'2v\':z.el.I(0).4f)}L{z.el.E(\'11\',\'1k\');z.el.E(\'2W\',\'cl\')}if(z.29&&z.29.1F==2w){z.29.1x(z.el.I(0))}A.2z(z.el.I(0),\'1j\')};2X(z.6T){19\'4l\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'S\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.hb,0);z.79.1G(0,z.fx.U.1o.hb)}L{z.ef.1G(0,-z.fx.U.1o.hb);z.79.1G(z.fx.U.1o.hb,0)}1n;19\'41\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'O\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.hb,0)}L{z.ef.1G(0,z.fx.U.1o.hb)}1n;19\'M\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');z.79=W A.fx(z.fx.2Y.I(0),A.1l(z.1l,z.1e),\'V\');if(z.1K==\'in\'){z.ef.1G(-z.fx.U.1o.1D,0);z.79.1G(0,z.fx.U.1o.1D)}L{z.ef.1G(0,-z.fx.U.1o.1D);z.79.1G(z.fx.U.1o.1D,0)}1n;19\'2D\':z.ef=W A.fx(z.el.I(0),A.1l(z.1l,z.1e,z.1T),\'M\');if(z.1K==\'in\'){z.ef.1G(z.fx.U.1o.1D,0)}L{z.ef.1G(0,z.fx.U.1o.1D)}1n}};A.2O=P;A.fn.fg=C(o){G B.1r(\'1j\',C(){W A.fx.cj(B,o)})};A.fx.cj=C(e,o){if(A.2O==P){A(\'23\',1c).1L(\'<1W id="2O"></1W>\');A.2O=A(\'#2O\')}A.2O.E(\'11\',\'2v\').E(\'T\',\'1J\');F z=B;z.el=A(e);if(!o||!o.3v){G}if(o.3v.1F==8t&&1c.7o(o.3v)){o.3v=1c.7o(o.3v)}L if(!o.3v.ci){G}if(!o.1H){o.1H=ch}z.1H=o.1H;z.3v=o.3v;z.7e=o.2Z;z.1T=o.1T;if(z.7e){A.2O.2H(z.7e)}z.8s=0;z.8i=0;if(A.e0){z.8s=(R(A.2O.E(\'4y\'))||0)+(R(A.2O.E(\'5i\'))||0)+(R(A.2O.E(\'4F\'))||0)+(R(A.2O.E(\'5g\'))||0);z.8i=(R(A.2O.E(\'4x\'))||0)+(R(A.2O.E(\'5d\'))||0)+(R(A.2O.E(\'5b\'))||0)+(R(A.2O.E(\'4Q\'))||0)}z.2b=A.1U(A.12.3a(z.el.I(0)),A.12.2f(z.el.I(0)));z.3m=A.1U(A.12.3a(z.3v),A.12.2f(z.3v));z.2b.1D-=z.8s;z.2b.hb-=z.8i;z.3m.1D-=z.8s;z.3m.hb-=z.8i;z.29=o.1T;A.2O.E(\'V\',z.2b.1D+\'Q\').E(\'S\',z.2b.hb+\'Q\').E(\'O\',z.2b.y+\'Q\').E(\'M\',z.2b.x+\'Q\').4S({O:z.3m.y,M:z.3m.x,V:z.3m.1D,S:z.3m.hb},z.1H,C(){if(z.7e)A.2O.3S(z.7e);A.2O.E(\'11\',\'1k\');if(z.1T&&z.1T.1F==2w){z.1T.1x(z.el.I(0),[z.3v])}A.2z(z.el.I(0),\'1j\')})};A.1q={24:{2u:10,cf:\'1R/ff.ce\',cd:\'<3O 2E="1R/5o.cc" />\',cb:0.8,ca:\'fb 8G\',c9:\'6m\',3F:7n},fa:H,f8:H,5A:P,7m:H,7l:H,a3:C(a){if(!A.1q.7l||A.1q.7m)G;F b=a.6S||a.6R||-1;2X(b){19 35:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f7\').I(0));1n;19 36:if(A.1q.5A)A.1q.2b(P,A(\'a[@4o=\'+A.1q.5A+\']:f6\').I(0));1n;19 37:19 8:19 33:19 80:19 f4:F c=A(\'#7j\');if(c.I(0).4q!=P){c.I(0).4q.1x(c.I(0))}1n;19 38:1n;19 39:19 34:19 32:19 fd:19 78:F d=A(\'#7h\');if(d.I(0).4q!=P){d.I(0).4q.1x(d.I(0))}1n;19 40:1n;19 27:A.1q.8q();1n}},6g:C(a){if(a)A.1U(A.1q.24,a);if(1P.3N){A(\'23\',1c).1C(\'5Q\',A.1q.a3)}L{A(1c).1C(\'5Q\',A.1q.a3)}A(\'a\').1y(C(){el=A(B);c5=el.1m(\'4o\')||\'\';c4=el.1m(\'2U\')||\'\';cg=/\\.cc|\\.f2|\\.7q|\\.ce|\\.f1/g;if(c4.5u().aD(cg)!=P&&c5.5u().3o(\'c2\')==0){el.1C(\'4U\',A.1q.2b)}});if(A.2R.46){3q=1c.3x(\'3q\');A(3q).1m({id:\'a1\',2E:\'dc:H;\',da:\'b0\',d7:\'b0\'}).E({11:\'1k\',T:\'1J\',O:\'0\',M:\'0\',4X:\'9x:9C.9E.a6(1E=0)\'});A(\'23\').1L(3q)}7r=1c.3x(\'1W\');A(7r).1m(\'id\',\'a0\').E({T:\'1J\',11:\'1k\',O:\'0\',M:\'0\',1E:0}).1L(1c.8b(\' \')).1C(\'4U\',A.1q.8q);5C=1c.3x(\'1W\');A(5C).1m(\'id\',\'c0\').E({4F:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Z=1c.3x(\'1W\');A(9Z).1m(\'id\',\'bY\').E({4F:A.1q.24.2u+\'Q\',4Q:A.1q.24.2u+\'Q\'}).1L(1c.8b(\' \'));9Y=1c.3x(\'a\');A(9Y).1m({id:\'f0\',2U:\'#\'}).E({T:\'1J\',2D:A.1q.24.2u+\'Q\',O:\'0\'}).1L(A.1q.24.cd).1C(\'4U\',A.1q.8q);6Z=1c.3x(\'1W\');A(6Z).1m(\'id\',\'9X\').E({T:\'2i\',9W:\'M\',5X:\'0 8x\',3j:1}).1L(5C).1L(9Z).1L(9Y);21=1c.3x(\'3O\');21.2E=A.1q.24.cf;A(21).1m(\'id\',\'bW\').E({T:\'1J\'});5G=1c.3x(\'a\');A(5G).1m({id:\'7j\',2U:\'#\'}).E({T:\'1J\',11:\'1k\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));5F=1c.3x(\'a\');A(5F).1m({id:\'7h\',2U:\'#\'}).E({T:\'1J\',2N:\'2B\',cC:\'1k\'}).1L(1c.8b(\' \'));2q=1c.3x(\'1W\');A(2q).1m(\'id\',\'bT\').E({11:\'1k\',T:\'2i\',2N:\'2B\',9W:\'M\',5X:\'0 8x\',O:\'0\',M:\'0\',3j:2}).1L([21,5G,5F]);5Z=1c.3x(\'1W\');A(5Z).1m(\'id\',\'8m\').E({11:\'1k\',T:\'1J\',2N:\'2B\',O:\'0\',M:\'0\',9W:\'az\',6P:\'b7\',eY:\'0\'}).1L([2q,6Z]);A(\'23\').1L(7r).1L(5Z)},2b:C(e,a){el=a?A(a):A(B);8J=el.1m(\'4o\');F b,4E,5G,5F;if(8J!=\'c2\'){A.1q.5A=8J;7F=A(\'a[@4o=\'+8J+\']\');b=7F.1N();4E=7F.aY(a?a:B);5G=7F.I(4E-1);5F=7F.I(4E+1)}aw=el.1m(\'2U\');5C=el.1m(\'3T\');3R=A.12.5O();7r=A(\'#a0\');if(!A.1q.7l){A.1q.7l=14;if(A.2R.46){A(\'#a1\').E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S()}7r.E(\'S\',Z.3g(3R.ih,3R.h)+\'Q\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\').1S().bS(bz,A.1q.24.cb,C(){A.1q.aB(aw,5C,3R,b,4E,5G,5F)});A(\'#8m\').E(\'V\',Z.3g(3R.iw,3R.w)+\'Q\')}L{A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.aB(aw,5C,3R,b,4E,5G,5F)}G H},aB:C(a,b,c,d,e,f,g){A(\'#aA\').9U();8l=A(\'#7j\');8l.2x();8k=A(\'#7h\');8k.2x();21=A(\'#bW\');2q=A(\'#bT\');5Z=A(\'#8m\');6Z=A(\'#9X\').E(\'2W\',\'2B\');A(\'#c0\').3i(5C);A.1q.7m=14;if(d)A(\'#bY\').3i(A.1q.24.ca+\' \'+(e+1)+\' \'+A.1q.24.c9+\' \'+d);if(f){8l.I(0).4q=C(){B.4W();A.1q.2b(P,f);G H}}if(g){8k.I(0).4q=C(){B.4W();A.1q.2b(P,g);G H}}21.1S();7u=A.12.2f(2q.I(0));4C=Z.3g(7u.1D,21.I(0).V+A.1q.24.2u*2);59=Z.3g(7u.hb,21.I(0).S+A.1q.24.2u*2);21.E({M:(4C-21.I(0).V)/2+\'Q\',O:(59-21.I(0).S)/2+\'Q\'});2q.E({V:4C+\'Q\',S:59+\'Q\'}).1S();bQ=A.12.a5();5Z.E(\'O\',c.t+(bQ.h/15)+\'Q\');if(5Z.E(\'11\')==\'1k\'){5Z.1S().6U(A.1q.24.3F)}5H=W 8M;A(5H).1m(\'id\',\'aA\').1C(\'eP\',C(){4C=5H.V+A.1q.24.2u*2;59=5H.S+A.1q.24.2u*2;21.2x();2q.4S({S:59},7u.hb!=59?A.1q.24.3F:1,C(){2q.4S({V:4C},7u.1D!=4C?A.1q.24.3F:1,C(){2q.aJ(5H);A(5H).E({T:\'1J\',M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\'}).6U(A.1q.24.3F,C(){cL=A.12.2f(6Z.I(0));if(f){8l.E({M:A.1q.24.2u+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}if(g){8k.E({M:4C/2+A.1q.24.2u*2+\'Q\',O:A.1q.24.2u+\'Q\',V:4C/2-A.1q.24.2u*3+\'Q\',S:59-A.1q.24.2u*2+\'Q\'}).1S()}6Z.E({V:4C+\'Q\',O:-cL.hb+\'Q\',2W:\'cl\'}).4S({O:-1},A.1q.24.3F,C(){A.1q.7m=H})})})})});5H.2E=a},8q:C(){A(\'#aA\').9U();A(\'#8m\').2x();A(\'#9X\').E(\'2W\',\'2B\');A(\'#a0\').bS(bz,0,C(){A(B).2x();if(A.2R.46){A(\'#a1\').2x()}});A(\'#7j\').I(0).4q=P;A(\'#7h\').I(0).4q=P;A.1q.5A=P;A.1q.7l=H;A.1q.7m=H;G H}};A.N={1v:P,3A:P,1g:P,1A:P,1o:P,T:P,7f:C(e){A.N.1g=(B.9T)?B.9T:B;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(A.N.1g).E(\'V\'))||0,S:R(A(A.N.1g).E(\'S\'))||0};A.N.T={O:R(A(A.N.1g).E(\'O\'))||0,M:R(A(A.N.1g).E(\'M\'))||0};A(1c).1C(\'3t\',A.N.aO).1C(\'5n\',A.N.aN);if(28 A.N.1g.1h.bO===\'C\'){A.N.1g.1h.bO.1x(A.N.1g)}G H},aN:C(e){A(1c).3h(\'3t\',A.N.aO).3h(\'5n\',A.N.aN);if(28 A.N.1g.1h.cO===\'C\'){A.N.1g.1h.cO.1x(A.N.1g)}A.N.1g=P},aO:C(e){if(!A.N.1g){G}1A=A.12.3W(e);6c=A.N.T.O-A.N.1A.y+1A.y;77=A.N.T.M-A.N.1A.x+1A.x;6c=Z.3g(Z.3k(6c,A.N.1g.1h.7d-A.N.1o.S),A.N.1g.1h.6F);77=Z.3g(Z.3k(77,A.N.1g.1h.7c-A.N.1o.V),A.N.1g.1h.6u);if(28 A.N.1g.1h.4h===\'C\'){F a=A.N.1g.1h.4h.1x(A.N.1g,[77,6c]);if(28 a==\'eI\'&&a.1b==2){77=a[0];6c=a[1]}}A.N.1g.Y.O=6c+\'Q\';A.N.1g.Y.M=77+\'Q\';G H},2b:C(e){A(1c).1C(\'3t\',A.N.7g).1C(\'5n\',A.N.7w);A.N.1v=B.1v;A.N.3A=B.3A;A.N.1A=A.12.3W(e);A.N.1o={V:R(A(B.1v).E(\'V\'))||0,S:R(A(B.1v).E(\'S\'))||0};A.N.T={O:R(A(B.1v).E(\'O\'))||0,M:R(A(B.1v).E(\'M\'))||0};if(A.N.1v.1h.4c){A.N.1v.1h.4c.1x(A.N.1v,[B])}G H},7w:C(){A(1c).3h(\'3t\',A.N.7g).3h(\'5n\',A.N.7w);if(A.N.1v.1h.3C){A.N.1v.1h.3C.1x(A.N.1v,[A.N.3A])}A.N.1v=P;A.N.3A=P},5N:C(a,b){G Z.3k(Z.3g(A.N.1o.V+a*b,A.N.1v.1h.8O),A.N.1v.1h.5R)},5M:C(a,b){G Z.3k(Z.3g(A.N.1o.S+a*b,A.N.1v.1h.7x),A.N.1v.1h.7y)},bN:C(a){G Z.3k(Z.3g(a,A.N.1v.1h.7x),A.N.1v.1h.7y)},7g:C(e){if(A.N.1v==P){G}1A=A.12.3W(e);dx=1A.x-A.N.1A.x;dy=1A.y-A.N.1A.y;1B={V:A.N.1o.V,S:A.N.1o.S};2s={O:A.N.T.O,M:A.N.T.M};2X(A.N.3A){19\'e\':1B.V=A.N.5N(dx,1);1n;19\'eH\':1B.V=A.N.5N(dx,1);1B.S=A.N.5M(dy,1);1n;19\'w\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'9R\':1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1B.S=A.N.5M(dy,1);1n;19\'7a\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,-1);2s.M=A.N.T.M-1B.V+A.N.1o.V;1n;19\'n\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1n;19\'9Q\':1B.S=A.N.5M(dy,-1);2s.O=A.N.T.O-1B.S+A.N.1o.S;1B.V=A.N.5N(dx,1);1n;19\'s\':1B.S=A.N.5M(dy,1);1n}if(A.N.1v.1h.44){if(A.N.3A==\'n\'||A.N.3A==\'s\')43=1B.S*A.N.1v.1h.44;L 43=1B.V;4z=A.N.bN(43*A.N.1v.1h.44);43=4z/A.N.1v.1h.44;2X(A.N.3A){19\'n\':19\'7a\':19\'9Q\':2s.O+=1B.S-4z;1n}2X(A.N.3A){19\'7a\':19\'w\':19\'9R\':2s.M+=1B.V-43;1n}1B.S=4z;1B.V=43}if(2s.O<A.N.1v.1h.6F){4z=1B.S+2s.O-A.N.1v.1h.6F;2s.O=A.N.1v.1h.6F;if(A.N.1v.1h.44){43=4z/A.N.1v.1h.44;2X(A.N.3A){19\'7a\':19\'w\':19\'9R\':2s.M+=1B.V-43;1n}1B.V=43}1B.S=4z}if(2s.M<A.N.1v.1h.6u){43=1B.V+2s.M-A.N.1v.1h.6u;2s.M=A.N.1v.1h.6u;if(A.N.1v.1h.44){4z=43*A.N.1v.1h.44;2X(A.N.3A){19\'n\':19\'7a\':19\'9Q\':2s.O+=1B.S-4z;1n}1B.S=4z}1B.V=43}if(2s.O+1B.S>A.N.1v.1h.7d){1B.S=A.N.1v.1h.7d-2s.O;if(A.N.1v.1h.44){1B.V=1B.S/A.N.1v.1h.44}}if(2s.M+1B.V>A.N.1v.1h.7c){1B.V=A.N.1v.1h.7c-2s.M;if(A.N.1v.1h.44){1B.S=1B.V*A.N.1v.1h.44}}F a=H;if(A.N.1v.1h.eG){a=A.N.1v.1h.eG.1x(A.N.1v,[1B,2s]);if(a){if(a.1o){A.1U(1B,a.1o)}if(a.T){A.1U(2s,a.T)}}}8f=A.N.1v.Y;8f.M=2s.M+\'Q\';8f.O=2s.O+\'Q\';8f.V=1B.V+\'Q\';8f.S=1B.S+\'Q\';G H},2l:C(b){if(!b||!b.3G||b.3G.1F!=6E){G}G B.1y(C(){F a=B;a.1h=b;a.1h.8O=b.8O||10;a.1h.7x=b.7x||10;a.1h.5R=b.5R||5P;a.1h.7y=b.7y||5P;a.1h.6F=b.6F||-8V;a.1h.6u=b.6u||-8V;a.1h.7c=b.7c||5P;a.1h.7d=b.7d||5P;bK=A(a).E(\'T\');if(!(bK==\'2i\'||bK==\'1J\')){a.Y.T=\'2i\'}eE=/n|9Q|e|eH|s|9R|w|7a/g;1V(i in a.1h.3G){if(i.5u().aD(eE)!=P){if(a.1h.3G[i].1F==8t){3c=A(a.1h.3G[i]);if(3c.1N()>0){a.1h.3G[i]=3c.I(0)}}if(a.1h.3G[i].4D){a.1h.3G[i].1v=a;a.1h.3G[i].3A=i;A(a.1h.3G[i]).1C(\'4R\',A.N.2b)}}}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){9N=A(a.1h.5k);if(9N.1N()>0){9N.1y(C(){B.9T=a});9N.1C(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).1C(\'4R\',A.N.7f)}}})},4v:C(){G B.1y(C(){F a=B;1V(i in a.1h.3G){a.1h.3G[i].1v=P;a.1h.3G[i].3A=P;A(a.1h.3G[i]).3h(\'4R\',A.N.2b)}if(a.1h.5k){if(28 a.1h.5k===\'4B\'){3c=A(a.1h.5k);if(3c.1N()>0){3c.3h(\'4R\',A.N.7f)}}L if(a.1h.5k==14){A(B).3h(\'4R\',A.N.7f)}}a.1h=P})}};A.fn.1U({jk:A.N.2l,jj:A.N.4v});A.2t=P;A.6J=H;A.31=P;A.6B=[];A.9L=C(e){F a=e.6S||e.6R||-1;if(a==17||a==16){A.6J=14}};A.9J=C(e){A.6J=H};A.eB=C(e){B.f.1A=A.12.3W(e);B.f.1I=A.1U(A.12.3a(B),A.12.2f(B));B.f.4p=A.12.5O(B);B.f.1A.x-=B.f.1I.x;B.f.1A.y-=B.f.1I.y;A(B).1L(A.2t.I(0));if(B.f.hc)A.2t.2H(B.f.hc).E(\'11\',\'2v\');A.2t.E({11:\'2v\',V:\'2G\',S:\'2G\'});if(B.f.o){A.2t.E(\'1E\',B.f.o)}A.31=B;A.7A=H;A.6B=[];B.f.el.1y(C(){B.1I={x:B.7Y+(B.4u&&!A.2R.6l?R(B.4u.4y)||0:0)+(A.31.2P||0),y:B.7t+(B.4u&&!A.2R.6l?R(B.4u.4x)||0:0)+(A.31.2T||0),1D:B.3P,hb:B.5r};if(B.s==14){if(A.6J==H){B.s=H;A(B).3S(A.31.f.71)}L{A.7A=14;A.6B[A.6B.1b]=A.1m(B,\'id\')}}});A.9H.1x(B,[e]);A(1c).1C(\'3t\',A.9H).1C(\'5n\',A.bI);G H};A.9H=C(e){if(!A.31)G;A.eA.1x(A.31,[e])};A.eA=C(e){if(!A.31)G;F a=A.12.3W(e);F b=A.12.5O(A.31);a.x+=b.l-B.f.4p.l-B.f.1I.x;a.y+=b.t-B.f.4p.t-B.f.1I.y;F c=Z.3k(a.x,B.f.1A.x);F d=Z.3k(Z.3B(a.x-B.f.1A.x),Z.3B(B.f.4p.w-c));F f=Z.3k(a.y,B.f.1A.y);F g=Z.3k(Z.3B(a.y-B.f.1A.y),Z.3B(B.f.4p.h-f));if(B.2T>0&&a.y-20<B.2T){F h=Z.3k(b.t,10);f-=h;g+=h;B.2T-=h}L if(B.2T+B.f.1I.h<B.f.4p.h&&a.y+20>B.2T+B.f.1I.h){F h=Z.3k(B.f.4p.h-B.2T,10);B.2T+=h;if(B.2T!=b.t)g+=h}if(B.2P>0&&a.x-20<B.2P){F h=Z.3k(b.l,10);c-=h;d+=h;B.2P-=h}L if(B.2P+B.f.1I.w<B.f.4p.w&&a.x+20>B.2P+B.f.1I.w){F h=Z.3k(B.f.4p.w-B.2P,10);B.2P+=h;if(B.2P!=b.l)d+=h}A.2t.E({M:c+\'Q\',O:f+\'Q\',V:d+\'Q\',S:g+\'Q\'});A.2t.l=c+B.f.4p.l;A.2t.t=f+B.f.4p.t;A.2t.r=A.2t.l+d;A.2t.b=A.2t.t+g;A.7A=H;B.f.el.1y(C(){9G=A.6B.3o(A.1m(B,\'id\'));if(!(B.1I.x>A.2t.r||(B.1I.x+B.1I.1D)<A.2t.l||B.1I.y>A.2t.b||(B.1I.y+B.1I.hb)<A.2t.t)){A.7A=14;if(B.s!=14){B.s=14;A(B).2H(A.31.f.71)}if(9G!=-1){B.s=H;A(B).3S(A.31.f.71)}}L if((B.s==14)&&(9G==-1)){B.s=H;A(B).3S(A.31.f.71)}L if((!B.s)&&(A.6J==14)&&(9G!=-1)){B.s=14;A(B).2H(A.31.f.71)}});G H};A.bI=C(e){if(!A.31)G;A.ez.1x(A.31,[e])};A.ez=C(e){A(1c).3h(\'3t\',A.9H).3h(\'5n\',A.bI);if(!A.31)G;A.2t.E(\'11\',\'1k\');if(B.f.hc)A.2t.3S(B.f.hc);A.31=H;A(\'23\').1L(A.2t.I(0));if(A.7A==14){if(B.f.8d)B.f.8d(A.bF(A.1m(B,\'id\')))}L{if(B.f.8c)B.f.8c(A.bF(A.1m(B,\'id\')))}A.6B=[]};A.bF=C(s){F h=\'\';F o=[];if(a=A(\'#\'+s)){a.I(0).f.el.1y(C(){if(B.s==14){if(h.1b>0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[o.1b]=A.1m(B,\'id\')}})}G{6A:h,o:o}};A.fn.jg=C(o){if(!A.2t){A(\'23\',1c).1L(\'<1W id="2t"></1W>\').1C(\'70\',A.9L).1C(\'5Q\',A.9J);A.2t=A(\'#2t\');A.2t.E({T:\'1J\',11:\'1k\'});if(1P.3N){A(\'23\',1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}L{A(1c).1C(\'70\',A.9L).1C(\'5Q\',A.9J)}}if(!o){o={}}G B.1y(C(){if(B.ey)G;B.ey=14;B.f={a:o.3r,o:o.1E?2c(o.1E):H,71:o.ex?o.ex:H,hc:o.4G?o.4G:H,8d:o.8d?o.8d:H,8c:o.8c?o.8c:H};B.f.el=A(\'.\'+o.3r);A(B).1C(\'4R\',A.eB).E(\'T\',\'2i\')})};A.2Q={aT:1,ew:C(b){F b=b;G B.1y(C(){B.4g.69.1y(C(a){A.2Q.4s(B,b[a])})})},I:C(){F e=[];B.1y(C(b){if(B.bD){e[b]=[];F c=B;F d=A.12.2f(B);B.4g.69.1y(C(a){F x=B.7Y;F y=B.7t;7B=R(x*1Y/(d.w-B.3P));7C=R(y*1Y/(d.h-B.5r));e[b][a]=[7B||0,7C||0,x||0,y||0]})}});G e},ad:C(a){a.D.ep=a.D.1Z.w-a.D.1w.1D;a.D.eo=a.D.1Z.h-a.D.1w.hb;if(a.92.4g.bB){8Z=a.92.4g.69.I(a.bA+1);if(8Z){a.D.1Z.w=(R(A(8Z).E(\'M\'))||0)+a.D.1w.1D;a.D.1Z.h=(R(A(8Z).E(\'O\'))||0)+a.D.1w.hb}9f=a.92.4g.69.I(a.bA-1);if(9f){F b=R(A(9f).E(\'M\'))||0;F c=R(A(9f).E(\'M\'))||0;a.D.1Z.x+=b;a.D.1Z.y+=c;a.D.1Z.w-=b;a.D.1Z.h-=c}}a.D.ek=a.D.1Z.w-a.D.1w.1D;a.D.ej=a.D.1Z.h-a.D.1w.hb;if(a.D.2C){a.D.gx=((a.D.1Z.w-a.D.1w.1D)/a.D.2C)||1;a.D.gy=((a.D.1Z.h-a.D.1w.hb)/a.D.2C)||1;a.D.d1=a.D.ek/a.D.2C;a.D.d0=a.D.ej/a.D.2C}a.D.1Z.dx=a.D.1Z.x-a.D.22.x;a.D.1Z.dy=a.D.1Z.y-a.D.22.y;A.X.18.E(\'7z\',\'8T\')},3n:C(a,x,y){if(a.D.2C){d9=R(x/a.D.d1);7B=d9*1Y/a.D.2C;d5=R(y/a.D.d0);7C=d5*1Y/a.D.2C}L{7B=R(x*1Y/a.D.ep);7C=R(y*1Y/a.D.eo)}a.D.aa=[7B||0,7C||0,x||0,y||0];if(a.D.3n)a.D.3n.1x(a,a.D.aa)},d3:C(a){6K=a.6S||a.6R||-1;2X(6K){19 35:A.2Q.4s(B.3H,[91,91]);1n;19 36:A.2Q.4s(B.3H,[-91,-91]);1n;19 37:A.2Q.4s(B.3H,[-B.3H.D.gx||-1,0]);1n;19 38:A.2Q.4s(B.3H,[0,-B.3H.D.gy||-1]);1n;19 39:A.2Q.4s(B.3H,[B.3H.D.gx||1,0]);1n;19 40:A.X.4s(B.3H,[0,B.3H.D.gy||1]);1n}},4s:C(a,b){if(!a.D){G}a.D.1w=A.1U(A.12.3a(a),A.12.2f(a));a.D.22={x:R(A.E(a,\'M\'))||0,y:R(A.E(a,\'O\'))||0};a.D.49=A.E(a,\'T\');if(a.D.49!=\'2i\'&&a.D.49!=\'1J\'){a.Y.T=\'2i\'}A.X.ah(a);A.2Q.ad(a);dx=R(b[0])||0;dy=R(b[1])||0;2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.2C){57=A.X.a9.1x(a,[2n,2j,dx,dy]);if(57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy}57=A.X.ae.1x(a,[2n,2j,dx,dy]);if(57&&57.1F==6E){dx=57.dx;dy=57.dy}2n=a.D.22.x+dx;2j=a.D.22.y+dy;if(a.D.4P&&(a.D.3n||a.D.2I)){A.2Q.3n(a,2n,2j)}2n=!a.D.2g||a.D.2g==\'3Z\'?2n:a.D.22.x||0;2j=!a.D.2g||a.D.2g==\'3K\'?2j:a.D.22.y||0;a.Y.M=2n+\'Q\';a.Y.O=2j+\'Q\'},2l:C(o){G B.1y(C(){if(B.bD==14||!o.3r||!A.12||!A.X||!A.1s){G}4Y=A(o.3r,B);if(4Y.1N()==0){G}F b={2e:\'7X\',4P:14,3n:o.3n&&o.3n.1F==2w?o.3n:P,2I:o.2I&&o.2I.1F==2w?o.2I:P,3c:B,1E:o.1E||H};if(o.2C&&R(o.2C)){b.2C=R(o.2C)||1;b.2C=b.2C>0?b.2C:1}if(4Y.1N()==1)4Y.6r(b);L{A(4Y.I(0)).6r(b);b.3c=P;4Y.6r(b)}4Y.70(A.2Q.d3);4Y.1m(\'aT\',A.2Q.aT++);B.bD=14;B.4g={};B.4g.ec=b.ec;B.4g.2C=b.2C;B.4g.69=4Y;B.4g.bB=o.bB?14:H;by=B;by.4g.69.1y(C(a){B.bA=a;B.92=by});if(o.5f&&o.5f.1F==6h){1V(i=o.5f.1b-1;i>=0;i--){if(o.5f[i].1F==6h&&o.5f[i].1b==2){el=B.4g.69.I(i);if(el.4D){A.2Q.4s(el,o.5f[i])}}}}})}};A.fn.1U({jc:A.2Q.2l,jb:A.2Q.ew,ja:A.2Q.I});A.2p={56:[],ea:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},di:C(){B.4W();1d=B.2S;id=A.1m(1d,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}1u=1d.J.3d-1;1R=A(\'3O\',1d.J.4O);if(1u<1){1u=1d.J.1R.1b}1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},2A:C(c){1d=1c.7o(c);if(1d.J.63){1u=1d.J.3d;6k(1u==1d.J.3d){1u=1+R(Z.63()*1d.J.1R.1b)}}L{1u=1d.J.3d+1;if(1d.J.1R.1b<1u){1u=1}}1R=A(\'3O\',1d.J.4O);1d.J.3d=1u;if(1R.1N()>0){1R.6d(1d.J.3F,A.2p.7J)}},go:C(o){F a;if(o&&o.1F==6E){if(o.21){a=1c.7o(o.21.1d);5v=1P.j8.2U.6W("#");o.21.5J=P;if(5v.1b==2){1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}L{1u=1}}if(o.84){o.84.4W();a=o.84.2S.2S;id=A.1m(a,\'id\');if(A.2p.56[id]!=P){1P.5h(A.2p.56[id])}5v=o.84.2U.6W("#");1u=R(5v[1]);1S=5v[1].48(1u,\'\');if(A.1m(a,\'id\')!=1S){1u=1}}if(a.J.1R.1b<1u||1u<1){1u=1}a.J.3d=1u;4t=A.12.2f(a);e4=A.12.9y(a);e3=A.12.6b(a);if(a.J.3e){a.J.3e.o.E(\'11\',\'1k\')}if(a.J.3b){a.J.3b.o.E(\'11\',\'1k\')}if(a.J.21){y=R(e4.t)+R(e3.t);if(a.J.1Q){if(a.J.1Q.4J==\'O\'){y+=a.J.1Q.45.hb}L{4t.h-=a.J.1Q.45.hb}}if(a.J.2o){if(a.J.2o&&a.J.2o.5V==\'O\'){y+=a.J.2o.45.hb}L{4t.h-=a.J.2o.45.hb}}if(!a.J.bu){a.J.e1=o.21?o.21.S:(R(a.J.21.E(\'S\'))||0);a.J.bu=o.21?o.21.V:(R(a.J.21.E(\'V\'))||0)}a.J.21.E(\'O\',y+(4t.h-a.J.e1)/2+\'Q\');a.J.21.E(\'M\',(4t.1D-a.J.bu)/2+\'Q\');a.J.21.E(\'11\',\'2v\')}1R=A(\'3O\',a.J.4O);if(1R.1N()>0){1R.6d(a.J.3F,A.2p.7J)}L{9w=A(\'a\',a.J.1Q.o).I(1u-1);A(9w).2H(a.J.1Q.5s);F b=W 8M();b.1d=A.1m(a,\'id\');b.1u=1u-1;b.2E=a.J.1R[a.J.3d-1].2E;if(b.1T){b.5J=P;A.2p.11.1x(b)}L{b.5J=A.2p.11}if(a.J.2o){a.J.2o.o.3i(a.J.1R[1u-1].5W)}}}},7J:C(){1d=B.2S.2S;1d.J.4O.E(\'11\',\'1k\');if(1d.J.1Q.5s){9w=A(\'a\',1d.J.1Q.o).3S(1d.J.1Q.5s).I(1d.J.3d-1);A(9w).2H(1d.J.1Q.5s)}F a=W 8M();a.1d=A.1m(1d,\'id\');a.1u=1d.J.3d-1;a.2E=1d.J.1R[1d.J.3d-1].2E;if(a.1T){a.5J=P;A.2p.11.1x(a)}L{a.5J=A.2p.11}if(1d.J.2o){1d.J.2o.o.3i(1d.J.1R[1d.J.3d-1].5W)}},11:C(){1d=1c.7o(B.1d);if(1d.J.3e){1d.J.3e.o.E(\'11\',\'1k\')}if(1d.J.3b){1d.J.3b.o.E(\'11\',\'1k\')}4t=A.12.2f(1d);y=0;if(1d.J.1Q){if(1d.J.1Q.4J==\'O\'){y+=1d.J.1Q.45.hb}L{4t.h-=1d.J.1Q.45.hb}}if(1d.J.2o){if(1d.J.2o&&1d.J.2o.5V==\'O\'){y+=1d.J.2o.45.hb}L{4t.h-=1d.J.2o.45.hb}}j4=A(\'.bt\',1d);y=y+(4t.h-B.S)/2;x=(4t.1D-B.V)/2;1d.J.4O.E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').3i(\'<3O 2E="\'+B.2E+\'" />\');1d.J.4O.6U(1d.J.3F);3b=1d.J.3d+1;if(3b>1d.J.1R.1b){3b=1}3e=1d.J.3d-1;if(3e<1){3e=1d.J.1R.1b}1d.J.3b.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+2*B.V/3+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3b-1].5W);1d.J.3b.o.I(0).2U=\'#\'+3b+A.1m(1d,\'id\');1d.J.3e.o.E(\'11\',\'2v\').E(\'O\',y+\'Q\').E(\'M\',x+\'Q\').E(\'V\',B.V/3+\'Q\').E(\'S\',B.S+\'Q\').1m(\'3T\',1d.J.1R[3e-1].5W);1d.J.3e.o.I(0).2U=\'#\'+3e+A.1m(1d,\'id\')},2l:C(o){if(!o||!o.2q||A.2p.56[o.2q])G;F a=A(\'#\'+o.2q);F c=a.I(0);if(c.Y.T!=\'1J\'&&c.Y.T!=\'2i\'){c.Y.T=\'2i\'}c.Y.2N=\'2B\';if(a.1N()==0)G;c.J={};c.J.1R=o.1R?o.1R:[];c.J.63=o.63&&o.63==14||H;7T=c.dj(\'j3\');1V(i=0;i<7T.1b;i++){6e=c.J.1R.1b;c.J.1R[6e]={2E:7T[i].2E,5W:7T[i].3T||7T[i].j2||\'\'}}if(c.J.1R.1b==0){G}c.J.49=A.1U(A.12.3a(c),A.12.2f(c));c.J.bp=A.12.9y(c);c.J.bo=A.12.6b(c);t=R(c.J.bp.t)+R(c.J.bo.t);b=R(c.J.bp.b)+R(c.J.bo.b);A(\'3O\',c).9U();c.J.3F=o.3F?o.3F:ch;if(o.4J||o.82||o.5s){c.J.1Q={};a.1L(\'<1W 68="dZ"></1W>\');c.J.1Q.o=A(\'.dZ\',c);if(o.82){c.J.1Q.82=o.82;c.J.1Q.o.2H(o.82)}if(o.5s){c.J.1Q.5s=o.5s}c.J.1Q.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.4J&&o.4J==\'O\'){c.J.1Q.4J=\'O\';c.J.1Q.o.E(\'O\',t+\'Q\')}L{c.J.1Q.4J=\'4e\';c.J.1Q.o.E(\'4e\',b+\'Q\')}c.J.1Q.9v=o.9v?o.9v:\' \';1V(F i=0;i<c.J.1R.1b;i++){6e=R(i)+1;c.J.1Q.o.1L(\'<a 2U="#\'+6e+o.2q+\'" 68="iY" 3T="\'+c.J.1R[i].5W+\'">\'+6e+\'</a>\'+(6e!=c.J.1R.1b?c.J.1Q.9v:\'\'))}A(\'a\',c.J.1Q.o).1C(\'4U\',C(){A.2p.go({84:B})});c.J.1Q.45=A.12.2f(c.J.1Q.o.I(0))}if(o.5V||o.81){c.J.2o={};a.1L(\'<1W 68="dW">&6G;</1W>\');c.J.2o.o=A(\'.dW\',c);if(o.81){c.J.2o.81=o.81;c.J.2o.o.2H(o.81)}c.J.2o.o.E(\'T\',\'1J\').E(\'V\',c.J.49.w+\'Q\');if(o.5V&&o.5V==\'O\'){c.J.2o.5V=\'O\';c.J.2o.o.E(\'O\',(c.J.1Q&&c.J.1Q.4J==\'O\'?c.J.1Q.45.hb+t:t)+\'Q\')}L{c.J.2o.5V=\'4e\';c.J.2o.o.E(\'4e\',(c.J.1Q&&c.J.1Q.4J==\'4e\'?c.J.1Q.45.hb+b:b)+\'Q\')}c.J.2o.45=A.12.2f(c.J.2o.o.I(0))}if(o.9j){c.J.3b={9j:o.9j};a.1L(\'<a 2U="#2\'+o.2q+\'" 68="dV">&6G;</a>\');c.J.3b.o=A(\'.dV\',c);c.J.3b.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3b.9j);c.J.3b.o.1C(\'4U\',A.2p.ea)}if(o.9t){c.J.3e={9t:o.9t};a.1L(\'<a 2U="#0\'+o.2q+\'" 68="dS">&6G;</a>\');c.J.3e.o=A(\'.dS\',c);c.J.3e.o.E(\'T\',\'1J\').E(\'11\',\'1k\').E(\'2N\',\'2B\').E(\'4a\',\'dU\').2H(c.J.3e.9t);c.J.3e.o.1C(\'4U\',A.2p.di)}a.aJ(\'<1W 68="bt"></1W>\');c.J.4O=A(\'.bt\',c);c.J.4O.E(\'T\',\'1J\').E(\'O\',\'2G\').E(\'M\',\'2G\').E(\'11\',\'1k\');if(o.21){a.aJ(\'<1W 68="dz" Y="11: 1k;"><3O 2E="\'+o.21+\'" /></1W>\');c.J.21=A(\'.dz\',c);c.J.21.E(\'T\',\'1J\');F d=W 8M();d.1d=o.2q;d.2E=o.21;if(d.1T){d.5J=P;A.2p.go({21:d})}L{d.5J=C(){A.2p.go({21:B})}}}L{A.2p.go({2q:c})}if(o.ba){dQ=R(o.ba)*8V}A.2p.56[o.2q]=o.ba?1P.5Y(\'A.2p.2A(\\\'\'+o.2q+\'\\\')\',dQ):P}};A.1d=A.2p.2l;A.1p={73:[],54:{},18:H,6X:P,2b:C(){if(A.X.1g==P){G}F a,3s,c,cs;A.1p.18.I(0).2Z=A.X.1g.D.5z;a=A.1p.18.I(0).Y;a.11=\'2v\';A.1p.18.1w=A.1U(A.12.3a(A.1p.18.I(0)),A.12.2f(A.1p.18.I(0)));a.V=A.X.1g.D.1w.1D+\'Q\';a.S=A.X.1g.D.1w.hb+\'Q\';3s=A.12.b2(A.X.1g);a.4M=3s.t;a.53=3s.r;a.4L=3s.b;a.4K=3s.l;if(A.X.1g.D.3L==14){c=A(A.X.1g).cA(14).I(0);cs=c.Y;cs.4M=\'2G\';cs.53=\'2G\';cs.4L=\'2G\';cs.4K=\'2G\';cs.11=\'2v\';A.1p.18.58().1L(c)}A(A.X.1g).dO(A.1p.18.I(0));A.X.1g.Y.11=\'1k\'},c7:C(e){if(!e.D.3I&&A.1s.4T.bC){if(e.D.3C)e.D.3C.1x(1g);A(e).E(\'T\',e.D.av||e.D.49);A(e).8j();A(A.1s.4T).dN(e)}A.1p.18.3S(e.D.5z).3i(\'&6G;\');A.1p.6X=P;F a=A.1p.18.I(0).Y;a.11=\'1k\';A.1p.18.dO(e);if(e.D.fx>0){A(e).6U(e.D.fx)}A(\'23\').1L(A.1p.18.I(0));F b=[];F c=H;1V(F i=0;i<A.1p.73.1b;i++){F d=A.1s.3p[A.1p.73[i]].I(0);F f=A.1m(d,\'id\');F g=A.1p.8g(f);if(d.1f.9P!=g.6A){d.1f.9P=g.6A;if(c==H&&d.1f.2I){c=d.1f.2I}g.id=f;b[b.1b]=g}}A.1p.73=[];if(c!=H&&b.1b>0){c(b)}},8n:C(e,o){if(!A.X.1g)G;F a=H;F i=0;if(e.1f.el.1N()>0){1V(i=e.1f.el.1N();i>0;i--){if(e.1f.el.I(i-1)!=A.X.1g){if(!e.5t.bb){if((e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}L{1n}}L{if((e.1f.el.I(i-1).1I.x+e.1f.el.I(i-1).1I.1D/2)>A.X.1g.D.2n&&(e.1f.el.I(i-1).1I.y+e.1f.el.I(i-1).1I.hb/2)>A.X.1g.D.2j){a=e.1f.el.I(i-1)}}}}}if(a&&A.1p.6X!=a){A.1p.6X=a;A(a).iT(A.1p.18.I(0))}L if(!a&&(A.1p.6X!=P||A.1p.18.I(0).2S!=e)){A.1p.6X=P;A(e).1L(A.1p.18.I(0))}A.1p.18.I(0).Y.11=\'2v\'},bM:C(e){if(A.X.1g==P){G}e.1f.el.1y(C(){B.1I=A.1U(A.12.6w(B),A.12.6x(B))})},8g:C(s){F i;F h=\'\';F o={};if(s){if(A.1p.54[s]){o[s]=[];A(\'#\'+s+\' .\'+A.1p.54[s]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s+\'[]=\'+A.1m(B,\'id\');o[s][o[s].1b]=A.1m(B,\'id\')})}L{1V(a in s){if(A.1p.54[s[a]]){o[s[a]]=[];A(\'#\'+s[a]+\' .\'+A.1p.54[s[a]]).1y(C(){if(h.1b>0){h+=\'&\'}h+=s[a]+\'[]=\'+A.1m(B,\'id\');o[s[a]][o[s[a]].1b]=A.1m(B,\'id\')})}}}}L{1V(i in A.1p.54){o[i]=[];A(\'#\'+i+\' .\'+A.1p.54[i]).1y(C(){if(h.1b>0){h+=\'&\'}h+=i+\'[]=\'+A.1m(B,\'id\');o[i][o[i].1b]=A.1m(B,\'id\')})}}G{6A:h,o:o}},dL:C(e){if(!e.ci){G}G B.1y(C(){if(!B.5t||!A(e).is(\'.\'+B.5t.3r))A(e).2H(B.5t.3r);A(e).6r(B.5t.D)})},4v:C(){G B.1y(C(){A(\'.\'+B.5t.3r).8j();A(B).ei();B.5t=P;B.dK=P})},2l:C(o){if(o.3r&&A.12&&A.X&&A.1s){if(!A.1p.18){A(\'23\',1c).1L(\'<1W id="dJ">&6G;</1W>\');A.1p.18=A(\'#dJ\');A.1p.18.I(0).Y.11=\'1k\'}B.ee({3r:o.3r,9F:o.9F?o.9F:H,8X:o.8X?o.8X:H,4G:o.4G?o.4G:H,76:o.76||o.ev,6C:o.6C||o.er,bC:14,2I:o.2I||o.iR,fx:o.fx?o.fx:H,3L:o.3L?14:H,5T:o.5T?o.5T:\'9S\'});G B.1y(C(){F a={5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,4c:o.4c&&o.4c.1F==2w?o.4c:H,4h:o.4h&&o.4h.1F==2w?o.4h:H,3C:o.3C&&o.3C.1F==2w?o.3C:H,2g:/3K|3Z/.3M(o.2g)?o.2g:H,5D:o.5D?R(o.5D)||0:H,2M:o.2M?o.2M:H};A(\'.\'+o.3r,B).6r(a);B.dK=14;B.5t={3r:o.3r,5B:o.5B?14:H,dI:5P,1E:o.1E?2c(o.1E):H,5z:o.4G?o.4G:H,fx:o.fx?o.fx:H,3I:14,3L:o.3L?14:H,3c:o.3c?o.3c:P,2e:o.2e?o.2e:P,bb:o.bb?14:H,D:a}})}}};A.fn.1U({iP:A.1p.2l,dN:A.1p.dL,iO:A.1p.4v});A.iN=A.1p.8g;A.2k={62:P,9o:H,9p:P,6a:C(e){A.2k.9o=14;A.2k.1S(e,B,14)},bk:C(e){if(A.2k.62!=B)G;A.2k.9o=H;A.2k.2x(e,B)},1S:C(e,a,b){if(A.2k.62!=P)G;if(!a){a=B}A.2k.62=a;1I=A.1U(A.12.3a(a),A.12.2f(a));7U=A(a);3T=7U.1m(\'3T\');2U=7U.1m(\'2U\');if(3T){A.2k.9p=3T;7U.1m(\'3T\',\'\');A(\'#dE\').3i(3T);if(2U)A(\'#bj\').3i(2U.48(\'iI://\',\'\'));L A(\'#bj\').3i(\'\');18=A(\'#7S\');if(a.4m.2Z){18.I(0).2Z=a.4m.2Z}L{18.I(0).2Z=\'\'}bi=A.12.2f(18.I(0));dD=b&&a.4m.T==\'bn\'?\'4e\':a.4m.T;2X(dD){19\'O\':2j=1I.y-bi.hb;2n=1I.x;1n;19\'M\':2j=1I.y;2n=1I.x-bi.1D;1n;19\'2D\':2j=1I.y;2n=1I.x+1I.1D;1n;19\'bn\':A(\'23\').1C(\'3t\',A.2k.3t);1A=A.12.3W(e);2j=1A.y+15;2n=1A.x+15;1n;8T:2j=1I.y+1I.hb;2n=1I.x;1n}18.E({O:2j+\'Q\',M:2n+\'Q\'});if(a.4m.4w==H){18.1S()}L{18.6U(a.4m.4w)}if(a.4m.2K)a.4m.2K.1x(a);7U.1C(\'86\',A.2k.2x).1C(\'4W\',A.2k.bk)}},3t:C(e){if(A.2k.62==P){A(\'23\').3h(\'3t\',A.2k.3t);G}1A=A.12.3W(e);A(\'#7S\').E({O:1A.y+15+\'Q\',M:1A.x+15+\'Q\'})},2x:C(e,a){if(!a){a=B}if(A.2k.9o!=14&&A.2k.62==a){A.2k.62=P;A(\'#7S\').6d(1);A(a).1m(\'3T\',A.2k.9p).3h(\'86\',A.2k.2x).3h(\'4W\',A.2k.bk);if(a.4m.2V)a.4m.2V.1x(a);A.2k.9p=P}},2l:C(b){if(!A.2k.18){A(\'23\').1L(\'<1W id="7S"><1W id="dE"></1W><1W id="bj"></1W></1W>\');A(\'#7S\').E({T:\'1J\',3j:5P,11:\'1k\'});A.2k.18=14}G B.1y(C(){if(A.1m(B,\'3T\')){B.4m={T:/O|4e|M|2D|bn/.3M(b.T)?b.T:\'4e\',2Z:b.2Z?b.2Z:H,4w:b.4w?b.4w:H,2K:b.2K&&b.2K.1F==2w?b.2K:H,2V:b.2V&&b.2V.1F==2w?b.2V:H};F a=A(B);a.1C(\'9r\',A.2k.1S);a.1C(\'6a\',A.2k.6a)}})}};A.fn.iH=A.2k.2l;A.7O={bl:C(e){6K=e.6S||e.6R||-1;if(6K==9){if(1P.3N){1P.3N.b6=14;1P.3N.b5=H}L{e.9b();e.99()}if(B.9q){1c.64.dv().3D="\\t";B.dB=C(){B.6a();B.dB=P}}L if(B.9m){2b=B.88;3m=B.dA;B.2m=B.2m.iG(0,2b)+"\\t"+B.2m.iF(3m);B.9m(2b+1,2b+1);B.6a()}G H}},4v:C(){G B.1y(C(){if(B.6V&&B.6V==14){A(B).3h(\'70\',A.7O.bl);B.6V=H}})},2l:C(){G B.1y(C(){if(B.4D==\'bs\'&&(!B.6V||B.6V==H)){A(B).1C(\'70\',A.7O.bl);B.6V=14}})}};A.fn.1U({iD:A.7O.2l,iC:A.7O.4v});A.12={3a:C(e){F x=0;F y=0;F a=e.Y;F b=H;if(A(e).E(\'11\')==\'1k\'){F c=a.2W;F d=a.T;b=14;a.2W=\'2B\';a.11=\'2v\';a.T=\'1J\'}F f=e;6k(f){x+=f.7Y+(f.4u&&!A.2R.6l?R(f.4u.4y)||0:0);y+=f.7t+(f.4u&&!A.2R.6l?R(f.4u.4x)||0:0);f=f.dY}f=e;6k(f&&f.4D&&f.4D.5u()!=\'23\'){x-=f.2P||0;y-=f.2T||0;f=f.2S}if(b==14){a.11=\'1k\';a.T=d;a.2W=c}G{x:x,y:y}},6x:C(a){F x=0,y=0;6k(a){x+=a.7Y||0;y+=a.7t||0;a=a.dY}G{x:x,y:y}},2f:C(e){F w=A.E(e,\'V\');F h=A.E(e,\'S\');F a=0;F b=0;F c=e.Y;if(A(e).E(\'11\')!=\'1k\'){a=e.3P;b=e.5r}L{F d=c.2W;F f=c.T;c.2W=\'2B\';c.11=\'2v\';c.T=\'1J\';a=e.3P;b=e.5r;c.11=\'1k\';c.T=f;c.2W=d}G{w:w,h:h,1D:a,hb:b}},6w:C(a){G{1D:a.3P||0,hb:a.5r||0}},a5:C(e){F h,w,de;if(e){w=e.83;h=e.7P}L{de=1c.4A;w=1P.bg||9z.bg||(de&&de.83)||1c.23.83;h=1P.bf||9z.bf||(de&&de.7P)||1c.23.7P}G{w:w,h:h}},5O:C(e){F t=0,l=0,w=0,h=0,iw=0,ih=0;if(e&&e.98.5u()!=\'23\'){t=e.2T;l=e.2P;w=e.be;h=e.bd;iw=0;ih=0}L{if(1c.4A){t=1c.4A.2T;l=1c.4A.2P;w=1c.4A.be;h=1c.4A.bd}L if(1c.23){t=1c.23.2T;l=1c.23.2P;w=1c.23.be;h=1c.23.bd}iw=9z.bg||1c.4A.83||1c.23.83||0;ih=9z.bf||1c.4A.7P||1c.23.7P||0}G{t:t,l:l,w:w,h:h,iw:iw,ih:ih}},b2:C(e,a){F c=A(e);F t=c.E(\'4M\')||\'\';F r=c.E(\'53\')||\'\';F b=c.E(\'4L\')||\'\';F l=c.E(\'4K\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},9y:C(e,a){F c=A(e);F t=c.E(\'5b\')||\'\';F r=c.E(\'5g\')||\'\';F b=c.E(\'4Q\')||\'\';F l=c.E(\'4F\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)};L G{t:t,r:r,b:b,l:l}},6b:C(e,a){F c=A(e);F t=c.E(\'4x\')||\'\';F r=c.E(\'5i\')||\'\';F b=c.E(\'5d\')||\'\';F l=c.E(\'4y\')||\'\';if(a)G{t:R(t)||0,r:R(r)||0,b:R(b)||0,l:R(l)||0};L G{t:t,r:r,b:b,l:l}},3W:C(a){F x=a.iB||(a.iz+(1c.4A.2P||1c.23.2P))||0;F y=a.iy||(a.ix+(1c.4A.2T||1c.23.2T))||0;G{x:x,y:y}},bH:C(a,b){b(a);a=a.6M;6k(a){A.12.bH(a,b);a=a.iv}},ji:C(c){A.12.bH(c,C(a){1V(F b in a){if(28 a[b]===\'C\'){a[b]=P}}})},ir:C(a,b){F c=A.12.5O();F d=A.12.2f(a);if(!b||b==\'3K\')A(a).E({O:c.t+((Z.3g(c.h,c.ih)-c.t-d.hb)/2)+\'Q\'});if(!b||b==\'3Z\')A(a).E({M:c.l+((Z.3g(c.w,c.iw)-c.l-d.1D)/2)+\'Q\'})},iq:C(a,b){F c=A(\'3O[@2E*="7q"]\',a||1c),7q;c.1y(C(){7q=B.2E;B.2E=b;B.Y.4X="9x:9C.9E.ip(2E=\'"+7q+"\')"})}};[].3o||(6h.jn.3o=C(v,n){n=(n==P)?0:n;F m=B.1b;1V(F i=n;i<m;i++)if(B[i]==v)G i;G-1});',62,1202,'||||||||||||||||||||||||||||||||||||jQuery|this|function|dragCfg|css|var|return|false|get|ss|iAuto|else|left|iResize|top|null|px|parseInt|height|position|oldStyle|width|new|iDrag|style|Math||display|iUtil||true||||helper|case|autoCFG|length|document|slideshow|easing|dropCfg|dragged|resizeOptions|carouselCfg|interfaceFX|none|speed|attr|break|sizes|iSort|ImageBox|queue|iDrop|iAutoscroller|slide|resizeElement|oC|apply|each|fisheyeCfg|pointer|newSizes|bind|wb|opacity|constructor|custom|duration|pos|absolute|type|append|items|size|255|window|slideslinks|images|show|complete|extend|for|div|elsToScroll|100|cont||loader|oR|body|options||oldP||typeof|callback|accordionCfg|start|parseFloat||containment|getSize|axis|selectedItem|relative|ny|iTooltip|build|value|nx|slideCaption|islideshow|container|subject|newPosition|selectHelper|border|block|Function|hide|itemWidth|dequeue|timer|hidden|fractions|right|src|PI|0px|addClass|onChange|parentData|onShow|result|cursorAt|overflow|transferHelper|scrollLeft|iSlider|browser|parentNode|scrollTop|href|onHide|visibility|switch|wrapper|className|pre|selectdrug|||||||||getPosition|nextslide|handle|currentslide|prevslide|step|max|unbind|html|zIndex|min|iExpander|end|onSlide|indexOf|zones|iframe|accept|margins|mousemove|canvas|to|item|createElement|multipleSeparator|highlighted|resizeDirection|abs|onStop|text|toggle|fadeDuration|handlers|dragElem|so|distance|vertically|ghosting|test|event|img|offsetWidth|startLeft|pageSize|removeClass|title|out|startTop|getPointer|lastSuggestion|DropOutDirectiont|horizontally||down||nWidth|ratio|dimm|msie||replace|oP|fontSize|lastValue|onStart|currentPointer|bottom|ifxFirstDisplay|slideCfg|onDrag|clear|context|elToScroll|up|tooltipCFG|fxCheckTag|rel|scr|onclick|endLeft|dragmoveBy|slidePos|currentStyle|destroy|delay|borderTopWidth|borderLeftWidth|nHeight|documentElement|string|containerW|tagName|iteration|paddingLeft|helperclass|endTop|halign|linksPosition|marginLeft|marginBottom|marginTop|OpenClose|holder|si|paddingBottom|mousedown|animate|overzone|click|onDragModifier|blur|filter|toDrag|getAttribute||cos|cnt|marginRight|collected||slideshows|newCoords|empty|containerH|elementData|paddingTop|puff|borderBottomWidth|animationHandler|values|paddingRight|clearInterval|borderRightWidth|pow|dragHandle|BlindDirection|post|mouseup|close|onSelect|fxh|offsetHeight|activeLinkClass|sortCfg|toLowerCase|url|currentPanel|point|grid|hpc|currentRel|revert|captionText|snapDistance|Scale|nextImage|prevImage|imageEl|orig|onload|iFisheye|parseColor|getHeight|getWidth|getScroll|3000|keyup|maxWidth|curCSS|tolerance|reflections|captionPosition|caption|margin|setInterval|outerContainer||itemHeight|current|random|selection|limit|Expander|128|class|sliders|focus|getBorder|newTop|fadeOut|indic|user|init|Array|frameClass|ActiveXObject|while|opera|from|open|oD|Date|proximity|Draggable|0x|F0|minLeft|rgb|getSizeLite|getPositionLite|getTime|positionItems|hash|selectCurrent|onOut|onClick|Object|minTop|nbsp|onHighlight|np|selectKeyHelper|pressedKey|accordionPos|firstChild|139|scrollIntoView|backgroundColor|oldStyleAttr|keyCode|charCode|direction|fadeIn|hasTabsEnabled|split|inFrontOf|radiusY|captionEl|keydown|sc|selectClass|changed|times||onHover|newLeft||efx|nw|li|maxRight|maxBottom|classname|startDrag|move|ImageBoxNextImage|nRx|ImageBoxPrevImage|nRy|opened|animationInProgress|400|getElementById|count|png|overlay|alpha|offsetTop|containerSize|cssSides|stop|minHeight|maxHeight|cursor|selectedone|xproc|yproc|bounceout|padding|gallery|increment|namedColors|applyOn|showImage|reflectionSize|sin|object|directionIncrement|iTTabs|clientHeight|select|activeClass|tooltipHelper|imgs|jEl|insideParent|content|parent|offsetLeft|parentBorders||captionClass|linksClass|clientWidth|link||mouseout|fontWeight|selectionStart|expand|panels|createTextNode|onselectstop|onselect|hight|elS|serialize|dir|diffHeight|DraggableDestroy|nextImageEl|prevImageEl|ImageBoxOuterContainer|checkhover|blind|iCarousel|hideImage|hidehelper|diffWidth|String|sl|st|prot|auto|diffY|diffX|headers|rule|getFieldValues|styleSheets|borderColor|positionContainer|image|getValues|dragstop|linkRel|itemsText|isDraggable|Image|minchars|minWidth|panelSelector|exec|192|isDroppable|default|211|1000|5625|hoverclass|headerSelector|next|ul|2000|SliderContainer|protectRotation|childs|oldVisibility|source|setTimeout|nodeName|stopPropagation|startTime|preventDefault|hoverClass|cssText|1px|prev|unfold|DoFold|unit|nextslideClass|multiple|itemMinWidth|setSelectionRange|destroyWrapper|focused|oldTitle|createTextRange|mouseover|inCache|prevslideClass|buildWrapper|linksSeparator|lnk|progid|getPadding|self|ScrollTo|9999|DXImageTransform|helperClass|Microsoft|activeclass|iIndex|selectcheck|onDrop|selectKeyUp|autofill|selectKeyDown|panelHeight|handleEl|onActivate|os|ne|sw|intersect|dragEl|remove|data|textAlign|ImageBoxCaption|closeEl|captionImages|ImageBoxOverlay|ImageBoxIframe|clearTimeout|keyPressed|fade|getClient|Alpha|shake|Shake|snapToGrid|lastSi|scroll||modifyContainer|fitToContainer|currentValue|zoom|getContainment|firstStep|paddingLeftSize|paddingBottomSize|paddingRightSize|paddingTopSize|borderLeftSize|borderBottomSize|borderRightSize|borderTopSize|autoSize|shrink|pulse|Pulsate|initialPosition|imageSrc|parseStyle|sliderPos|center|ImageBoxCurrentImage|loadImage|parentPos|match|dragmove|stopAnim|pause|Color|unselectable|prepend|borderWidth|cssSidesEnd|draginit|stopDrag|moveDrag|asin|bouncein|paddingY|paddingX|tabindex|writeItems|INPUT|10000|169|index|sliderSize|no|linear|getMargins|spacer|rotationSpeed|returnValue|cancelBubble|transparent|angle|autocomplete|autoplay|floats|extraWidth|scrollHeight|scrollWidth|innerHeight|innerWidth|character|helperSize|tooltipURL|hidefocused|doTab|Number|mouse|oBor|oPad|entities||TEXTAREA|slideshowHolder|loaderWidth|inputWidth|RegExp|letterSpacing|sliderEl|300|SliderIteration|restricted|sortable|isSlider|bounce|Selectserialize|idsa|traverseDOM|selectstop|elm|elPosition|restore|measure|getHeightMinMax|onDragStart|fit|clientSize|field|fadeTo|ImageBoxContainer|on|listStyle|ImageBoxLoader|dragHelper|ImageBoxCaptionImages|getContext|ImageBoxCaptionText|update|imagebox|BlindUp|hrefAttr|relAttr|SlideOutUp|check|checkdrop|textImageFrom|textImage|overlayOpacity|jpg|closeHTML|gif|loaderSRC|imageTypes|500|childNodes|itransferTo|highlight|visible|horizontal|vertical|parts|paddingLeftUnit|paddingBottomUnit|paddingRightUnit||paddingTopUnit|borderLeftUnit|borderBottomUnit|borderRightUnit|borderTopUnit|fontUnit|grow|clone|sqrt|textDecoration|dragstart|trim|isFunction|valign|userSelect|fxe|KhtmlUserSelect|Width|captionSize|dhe|colorCssProps|onDragStop|iAccordion|cssProps|doScroll|144|224|230|keypress|off|150|140|107|fracH|fracW|easeout|dragmoveByKey|autocompleteHelper|yfrac|165|scrolling|radiusX|xfrac|frameborder|245|javascript|240||autocompleteIframe|999|protect|goprev|getElementsByTagName|styleFloat||parte|insertBefore|itemZIndex|interfaceColorFX|fold|mousex|leftUnit|topUnit|fakeAccordionClass|createRange|getSelectionStart|||slideshowLoader|selectionEnd|onblur|moveStart|filteredPosition|tooltipTitle|togglehor|togglever|inputValue|zindex|sortHelper|isSortable|addItem|checkCache|SortableAddItem|after|BlindDown|time|SlideInUp|slideshowPrevslide|elType|30px|slideshowNextSlide|slideshowCaption|expanderHelper|offsetParent|slideshowLinks|boxModel|loaderHeight||slideBor|slidePad|htmlEntities|wordSpacing|fontVariant|fontStretch|fontStyle|gonext|fontFamily|onslide|clickItem|Droppable||rgba||DroppableDestroy|maxy|maxx|||hoverItem|containerMaxy|containerMaxx||onout|addColorStop||iBounce|onhover|set|selectedclass|isSelectable|selectstopApply|selectcheckApply|selectstart|shc|360|directions|remeasure|onResize|se|array|scale|success|param|translate|POST|number|load|ajax|save|name|khtml|moz|find|ondragstart|onselectstart|lineHeigt|mozUserSelect|ImageBoxClose|bmp|jpeg|finishx|112|starty|first|last|firstResize|startx|imageLoaded|Showing|finishOpacity|110|Accordion|loading|TransferTo|SlideToggleRight|SlideOutRight|SlideInRight|SlideToggleLeft|SlideOutLeft|SlideInLeft||SlideToggleDown|SlideOutDown|SlideInDown|SlideToggleUp|scrollTo|ScrollToAnchors|flipv|pt|Puff||Shrink|Fisheye||Grow|OpenHorizontally|OpenVertically|SwitchVertically|SwitchHorizontally|CloseHorizontally|CloseVertically|toUpperCase|100000000|selectorText|rules|cssRules|borderStyle|outset|inset|ridge|resize|groove|double|solid|dashed|dotted|isNaN|fromHandler|stopAll|MozUserSelect|Left|Bottom|Right|Top|outlineColor|color|borderTopColor|borderRightColor|borderLeftColor|borderBottomColor|textIndent|outlineWidth|elasticboth|outlineOffset|wh|elasticout|lineHeight|yellow|white|silver|red|purple|203||pink|orange|olive|navy||maroon|magenta|lime|||elasticin|lightyellow|193|182|lightpink|bounceboth|lightgrey|238|lightgreen|lightcyan|Autocomplete|216|173|200|984375|lightblue|khaki|130|625|indigo|green|215|9375|gold|fuchsia|148|darkviolet|122|233|darksalmon|darkred|204|153|darkorchid|darkorange|30002|list|darkolivegreen|||darkmagenta|183|189|darkkhaki|easeboth|darkgreen|30001|darkgrey|darkcyan|darkblue|cyan|easein|brown|blue||black|hover|220|beige|azure|aqua|appendChild|cssFloat|fxWrapper|ol|table|fix|form|button|nodeValue|textarea|input|w_|float|Carousel|removeChild|meta|optgroup|option|frameset|frame|script|header|th|colgroup|col|tfoot|thead|tbody|td|tr|Highlight|FoldToggle|UnFold|Fold|DropToggleRight|DropInRight|DropOutRight|DropToggleLeft|DropInLeft|DropOutLeft|DropToggleUp||DropInUp||DropOutUp||DropToggleDown|100000|DropInDown|duplicate|DropOutDown||120|AlphaImageLoader|fixPNG|centerEl||rotationTimer|maxRotation|nextSibling||clientY|pageY|clientX|Bounce|pageX|DisableTabs|EnableTabs|moveEnd|substr|substring|ToolTip|http|collapse|BlindToggleHorizontally|BlindRight|BlindLeft|SortSerialize|SortableDestroy|Sortable|BlindToggleVertically|onchange|fillRect|before|Autoexpand|fill|password|WebKit|slideshowLink|quot|lt|amp|alt|IMG|par|appVersion|pW|navigator|location|fillStyle|SliderGetValues|SliderSetValues|Slider|recallDroppables|ondrop|createLinearGradient|Selectable|destination|purgeEvents|ResizableDestroy|Resizable|globalCompositeOperation|drawImage|prototype'.split('|'),0,{}));
diff --git a/wp-includes/js/jquery/jquery.color.dev.js b/wp-includes/js/jquery/jquery.color.dev.js
new file mode 100644 (file)
index 0000000..1dffbd5
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * jQuery Color Animations
+ * Copyright 2007 John Resig
+ * Released under the MIT and GPL licenses.
+ */
+
+(function(jQuery){
+
+    // We override the animation for all of these color styles
+    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
+        jQuery.fx.step[attr] = function(fx){
+            if ( fx.state == 0 ) {
+                fx.start = getColor( fx.elem, attr );
+                fx.end = getRGB( fx.end );
+            }
+
+            fx.elem.style[attr] = "rgb(" + [
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
+                Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
+            ].join(",") + ")";
+        }
+    });
+
+    // Color Conversion functions from highlightFade
+    // By Blair Mitchelmore
+    // http://jquery.offput.ca/highlightFade/
+
+    // Parse strings looking for color tuples [255,255,255]
+    function getRGB(color) {
+        var result;
+
+        // Check if we're already dealing with an array of colors
+        if ( color && color.constructor == Array && color.length == 3 )
+            return color;
+
+        // Look for rgb(num,num,num)
+        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
+            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
+
+        // Look for rgb(num%,num%,num%)
+        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
+            return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
+
+        // Look for #a0b1c2
+        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
+            return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+
+        // Look for #fff
+        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
+            return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+
+        // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+        if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
+            return colors['transparent']
+
+        // Otherwise, we're most likely dealing with a named color
+        return colors[jQuery.trim(color).toLowerCase()];
+    }
+
+    function getColor(elem, attr) {
+        var color;
+
+        do {
+            color = jQuery.curCSS(elem, attr);
+
+            // Keep going until we find an element that has color, or we hit the body
+            if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
+                break;
+
+            attr = "backgroundColor";
+        } while ( elem = elem.parentNode );
+
+        return getRGB(color);
+    };
+
+    // Some named colors to work with
+    // From Interface by Stefan Petre
+    // http://interface.eyecon.ro/
+
+    var colors = {
+        aqua:[0,255,255],
+        azure:[240,255,255],
+        beige:[245,245,220],
+        black:[0,0,0],
+        blue:[0,0,255],
+        brown:[165,42,42],
+        cyan:[0,255,255],
+        darkblue:[0,0,139],
+        darkcyan:[0,139,139],
+        darkgrey:[169,169,169],
+        darkgreen:[0,100,0],
+        darkkhaki:[189,183,107],
+        darkmagenta:[139,0,139],
+        darkolivegreen:[85,107,47],
+        darkorange:[255,140,0],
+        darkorchid:[153,50,204],
+        darkred:[139,0,0],
+        darksalmon:[233,150,122],
+        darkviolet:[148,0,211],
+        fuchsia:[255,0,255],
+        gold:[255,215,0],
+        green:[0,128,0],
+        indigo:[75,0,130],
+        khaki:[240,230,140],
+        lightblue:[173,216,230],
+        lightcyan:[224,255,255],
+        lightgreen:[144,238,144],
+        lightgrey:[211,211,211],
+        lightpink:[255,182,193],
+        lightyellow:[255,255,224],
+        lime:[0,255,0],
+        magenta:[255,0,255],
+        maroon:[128,0,0],
+        navy:[0,0,128],
+        olive:[128,128,0],
+        orange:[255,165,0],
+        pink:[255,192,203],
+        purple:[128,0,128],
+        violet:[128,0,128],
+        red:[255,0,0],
+        silver:[192,192,192],
+        white:[255,255,255],
+        yellow:[255,255,0],
+        transparent: [255,255,255]
+    };
+
+})(jQuery);
index 1dffbd5c7b3c6064c0eacc65fc7e0bdf4f90d128..03c13f644817e5d174b67fd312054932c1ff0e83 100644 (file)
@@ -1,128 +1 @@
-/*
- * jQuery Color Animations
- * Copyright 2007 John Resig
- * Released under the MIT and GPL licenses.
- */
-
-(function(jQuery){
-
-    // We override the animation for all of these color styles
-    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
-        jQuery.fx.step[attr] = function(fx){
-            if ( fx.state == 0 ) {
-                fx.start = getColor( fx.elem, attr );
-                fx.end = getRGB( fx.end );
-            }
-
-            fx.elem.style[attr] = "rgb(" + [
-                Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
-                Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
-                Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
-            ].join(",") + ")";
-        }
-    });
-
-    // Color Conversion functions from highlightFade
-    // By Blair Mitchelmore
-    // http://jquery.offput.ca/highlightFade/
-
-    // Parse strings looking for color tuples [255,255,255]
-    function getRGB(color) {
-        var result;
-
-        // Check if we're already dealing with an array of colors
-        if ( color && color.constructor == Array && color.length == 3 )
-            return color;
-
-        // Look for rgb(num,num,num)
-        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
-            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
-
-        // Look for rgb(num%,num%,num%)
-        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
-            return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
-
-        // Look for #a0b1c2
-        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
-            return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
-
-        // Look for #fff
-        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
-            return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
-
-        // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
-        if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
-            return colors['transparent']
-
-        // Otherwise, we're most likely dealing with a named color
-        return colors[jQuery.trim(color).toLowerCase()];
-    }
-
-    function getColor(elem, attr) {
-        var color;
-
-        do {
-            color = jQuery.curCSS(elem, attr);
-
-            // Keep going until we find an element that has color, or we hit the body
-            if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
-                break;
-
-            attr = "backgroundColor";
-        } while ( elem = elem.parentNode );
-
-        return getRGB(color);
-    };
-
-    // Some named colors to work with
-    // From Interface by Stefan Petre
-    // http://interface.eyecon.ro/
-
-    var colors = {
-        aqua:[0,255,255],
-        azure:[240,255,255],
-        beige:[245,245,220],
-        black:[0,0,0],
-        blue:[0,0,255],
-        brown:[165,42,42],
-        cyan:[0,255,255],
-        darkblue:[0,0,139],
-        darkcyan:[0,139,139],
-        darkgrey:[169,169,169],
-        darkgreen:[0,100,0],
-        darkkhaki:[189,183,107],
-        darkmagenta:[139,0,139],
-        darkolivegreen:[85,107,47],
-        darkorange:[255,140,0],
-        darkorchid:[153,50,204],
-        darkred:[139,0,0],
-        darksalmon:[233,150,122],
-        darkviolet:[148,0,211],
-        fuchsia:[255,0,255],
-        gold:[255,215,0],
-        green:[0,128,0],
-        indigo:[75,0,130],
-        khaki:[240,230,140],
-        lightblue:[173,216,230],
-        lightcyan:[224,255,255],
-        lightgreen:[144,238,144],
-        lightgrey:[211,211,211],
-        lightpink:[255,182,193],
-        lightyellow:[255,255,224],
-        lime:[0,255,0],
-        magenta:[255,0,255],
-        maroon:[128,0,0],
-        navy:[0,0,128],
-        olive:[128,128,0],
-        orange:[255,165,0],
-        pink:[255,192,203],
-        purple:[128,0,128],
-        violet:[128,0,128],
-        red:[255,0,0],
-        silver:[192,192,192],
-        white:[255,255,255],
-        yellow:[255,255,0],
-        transparent: [255,255,255]
-    };
-
-})(jQuery);
+(function(d){d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(f,e){d.fx.step[e]=function(g){if(g.state==0){g.start=c(g.elem,e);g.end=b(g.end)}g.elem.style[e]="rgb("+[Math.max(Math.min(parseInt((g.pos*(g.end[0]-g.start[0]))+g.start[0]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[1]-g.start[1]))+g.start[1]),255),0),Math.max(Math.min(parseInt((g.pos*(g.end[2]-g.start[2]))+g.start[2]),255),0)].join(",")+")"}});function b(f){var e;if(f&&f.constructor==Array&&f.length==3){return f}if(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}if(e=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return[parseFloat(e[1])*2.55,parseFloat(e[2])*2.55,parseFloat(e[3])*2.55]}if(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}if(e=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}if(e=/rgba\(0, 0, 0, 0\)/.exec(f)){return a.transparent}return a[d.trim(f).toLowerCase()]}function c(g,e){var f;do{f=d.curCSS(g,e);if(f!=""&&f!="transparent"||d.nodeName(g,"body")){break}e="backgroundColor"}while(g=g.parentNode);return b(f)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jquery/jquery.form.dev.js b/wp-includes/js/jquery/jquery.form.dev.js
new file mode 100644 (file)
index 0000000..2ee5c96
--- /dev/null
@@ -0,0 +1,872 @@
+/*
+ * jQuery Form Plugin
+ * version: 2.02 (12/16/2007)
+ * @requires jQuery v1.1 or later
+ *
+ * Examples at: http://malsup.com/jquery/form/
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id$
+ */
+ (function($) {
+/**
+ * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
+ *
+ * ajaxSubmit accepts a single argument which can be either a success callback function
+ * or an options Object.  If a function is provided it will be invoked upon successful
+ * completion of the submit and will be passed the response from the server.
+ * If an options Object is provided, the following attributes are supported:
+ *
+ *  target:   Identifies the element(s) in the page to be updated with the server response.
+ *            This value may be specified as a jQuery selection string, a jQuery object,
+ *            or a DOM element.
+ *            default value: null
+ *
+ *  url:      URL to which the form data will be submitted.
+ *            default value: value of form's 'action' attribute
+ *
+ *  type:     The method in which the form data should be submitted, 'GET' or 'POST'.
+ *            default value: value of form's 'method' attribute (or 'GET' if none found)
+ *
+ *  data:     Additional data to add to the request, specified as key/value pairs (see $.ajax).
+ *
+ *  beforeSubmit:  Callback method to be invoked before the form is submitted.
+ *            default value: null
+ *
+ *  success:  Callback method to be invoked after the form has been successfully submitted
+ *            and the response has been returned from the server
+ *            default value: null
+ *
+ *  dataType: Expected dataType of the response.  One of: null, 'xml', 'script', or 'json'
+ *            default value: null
+ *
+ *  semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
+ *            default value: false
+ *
+ *  resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
+ *
+ *  clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
+ *
+ *
+ * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
+ * validating the form data.  If the 'beforeSubmit' callback returns false then the form will
+ * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
+ * in array format, the jQuery object, and the options object passed into ajaxSubmit.
+ * The form data array takes the following form:
+ *
+ *     [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * If a 'success' callback method is provided it is invoked after the response has been returned
+ * from the server.  It is passed the responseText or responseXML value (depending on dataType).
+ * See jQuery.ajax for further details.
+ *
+ *
+ * The dataType option provides a means for specifying how the server response should be handled.
+ * This maps directly to the jQuery.httpData method.  The following values are supported:
+ *
+ *      'xml':    if dataType == 'xml' the server response is treated as XML and the 'success'
+ *                   callback method, if specified, will be passed the responseXML value
+ *      'json':   if dataType == 'json' the server response will be evaluted and passed to
+ *                   the 'success' callback, if specified
+ *      'script': if dataType == 'script' the server response is evaluated in the global context
+ *
+ *
+ * Note that it does not make sense to use both the 'target' and 'dataType' options.  If both
+ * are provided the target will be ignored.
+ *
+ * The semantic argument can be used to force form serialization in semantic order.
+ * This is normally true anyway, unless the form contains input elements of type='image'.
+ * If your form must be submitted with name/value pairs in semantic order and your form
+ * contains an input of type='image" then pass true for this arg, otherwise pass false
+ * (or nothing) to avoid the overhead for this logic.
+ *
+ *
+ * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
+ *
+ * $("#form-id").submit(function() {
+ *     $(this).ajaxSubmit(options);
+ *     return false; // cancel conventional submit
+ * });
+ *
+ * When using ajaxForm(), however, this is done for you.
+ *
+ * @example
+ * $('#myForm').ajaxSubmit(function(data) {
+ *     alert('Form submit succeeded! Server returned: ' + data);
+ * });
+ * @desc Submit form and alert server response
+ *
+ *
+ * @example
+ * var options = {
+ *     target: '#myTargetDiv'
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Submit form and update page element with server response
+ *
+ *
+ * @example
+ * var options = {
+ *     success: function(responseText) {
+ *         alert(responseText);
+ *     }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Submit form and alert the server response
+ *
+ *
+ * @example
+ * var options = {
+ *     beforeSubmit: function(formArray, jqForm) {
+ *         if (formArray.length == 0) {
+ *             alert('Please enter data.');
+ *             return false;
+ *         }
+ *     }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Pre-submit validation which aborts the submit operation if form data is empty
+ *
+ *
+ * @example
+ * var options = {
+ *     url: myJsonUrl.php,
+ *     dataType: 'json',
+ *     success: function(data) {
+ *        // 'data' is an object representing the the evaluated json data
+ *     }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc json data returned and evaluated
+ *
+ *
+ * @example
+ * var options = {
+ *     url: myXmlUrl.php,
+ *     dataType: 'xml',
+ *     success: function(responseXML) {
+ *        // responseXML is XML document object
+ *        var data = $('myElement', responseXML).text();
+ *     }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc XML data returned from server
+ *
+ *
+ * @example
+ * var options = {
+ *     resetForm: true
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc submit form and reset it if successful
+ *
+ * @example
+ * $('#myForm).submit(function() {
+ *    $(this).ajaxSubmit();
+ *    return false;
+ * });
+ * @desc Bind form's submit event to use ajaxSubmit
+ *
+ *
+ * @name ajaxSubmit
+ * @type jQuery
+ * @param options  object literal containing options which control the form submission process
+ * @cat Plugins/Form
+ * @return jQuery
+ */
+$.fn.ajaxSubmit = function(options) {
+    if (typeof options == 'function')
+        options = { success: options };
+
+    options = $.extend({
+        url:  this.attr('action') || window.location.toString(),
+        type: this.attr('method') || 'GET'
+    }, options || {});
+
+    // hook for manipulating the form data before it is extracted;
+    // convenient for use with rich editors like tinyMCE or FCKEditor
+    var veto = {};
+    $.event.trigger('form.pre.serialize', [this, options, veto]);
+    if (veto.veto) return this;
+
+    var a = this.formToArray(options.semantic);
+       if (options.data) {
+           for (var n in options.data)
+               a.push( { name: n, value: options.data[n] } );
+       }
+
+    // give pre-submit callback an opportunity to abort the submit
+    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
+
+    // fire vetoable 'validate' event
+    $.event.trigger('form.submit.validate', [a, this, options, veto]);
+    if (veto.veto) return this;
+
+    var q = $.param(a);//.replace(/%20/g,'+');
+
+    if (options.type.toUpperCase() == 'GET') {
+        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
+        options.data = null;  // data is null for 'get'
+    }
+    else
+        options.data = q; // data is the query string for 'post'
+
+    var $form = this, callbacks = [];
+    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
+    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
+
+    // perform a load on the target only if dataType is not provided
+    if (!options.dataType && options.target) {
+        var oldSuccess = options.success || function(){};
+        callbacks.push(function(data) {
+            if (this.evalScripts)
+                $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments);
+            else // jQuery v1.1.4
+                $(options.target).html(data).each(oldSuccess, arguments);
+        });
+    }
+    else if (options.success)
+        callbacks.push(options.success);
+
+    options.success = function(data, status) {
+        for (var i=0, max=callbacks.length; i < max; i++)
+            callbacks[i](data, status, $form);
+    };
+
+    // are there files to upload?
+    var files = $('input:file', this).fieldValue();
+    var found = false;
+    for (var j=0; j < files.length; j++)
+        if (files[j])
+            found = true;
+
+    // options.iframe allows user to force iframe mode
+   if (options.iframe || found) { 
+       // hack to fix Safari hang (thanks to Tim Molendijk for this)
+       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
+       if ($.browser.safari && options.closeKeepAlive)
+           $.get(options.closeKeepAlive, fileUpload);
+       else
+           fileUpload();
+       }
+   else
+       $.ajax(options);
+
+    // fire 'notify' event
+    $.event.trigger('form.submit.notify', [this, options]);
+    return this;
+
+
+    // private function for handling file uploads (hat tip to YAHOO!)
+    function fileUpload() {
+        var form = $form[0];
+        var opts = $.extend({}, $.ajaxSettings, options);
+
+        var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
+        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
+        var io = $io[0];
+        var op8 = $.browser.opera && window.opera.version() < 9;
+        if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
+        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
+
+        var xhr = { // mock object
+            responseText: null,
+            responseXML: null,
+            status: 0,
+            statusText: 'n/a',
+            getAllResponseHeaders: function() {},
+            getResponseHeader: function() {},
+            setRequestHeader: function() {}
+        };
+
+        var g = opts.global;
+        // trigger ajax global events so that activity/block indicators work like normal
+        if (g && ! $.active++) $.event.trigger("ajaxStart");
+        if (g) $.event.trigger("ajaxSend", [xhr, opts]);
+
+        var cbInvoked = 0;
+        var timedOut = 0;
+
+        // take a breath so that pending repaints get some cpu time before the upload starts
+        setTimeout(function() {
+            // make sure form attrs are set
+            var encAttr = form.encoding ? 'encoding' : 'enctype';
+            var t = $form.attr('target');
+            $form.attr({
+                target:   id,
+                method:  'POST',
+                action:   opts.url
+            });
+            form[encAttr] = 'multipart/form-data';
+
+            // support timout
+            if (opts.timeout)
+                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
+
+            // add iframe to doc and submit the form
+            $io.appendTo('body');
+            io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
+            form.submit();
+            $form.attr('target', t); // reset target
+        }, 10);
+
+        function cb() {
+            if (cbInvoked++) return;
+
+            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
+
+            var ok = true;
+            try {
+                if (timedOut) throw 'timeout';
+                // extract the server response from the iframe
+                var data, doc;
+                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
+                xhr.responseText = doc.body ? doc.body.innerHTML : null;
+                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
+
+                if (opts.dataType == 'json' || opts.dataType == 'script') {
+                    var ta = doc.getElementsByTagName('textarea')[0];
+                    data = ta ? ta.value : xhr.responseText;
+                    if (opts.dataType == 'json')
+                        eval("data = " + data);
+                    else
+                        $.globalEval(data);
+                }
+                else if (opts.dataType == 'xml') {
+                    data = xhr.responseXML;
+                    if (!data && xhr.responseText != null)
+                        data = toXml(xhr.responseText);
+                }
+                else {
+                    data = xhr.responseText;
+                }
+            }
+            catch(e){
+                ok = false;
+                $.handleError(opts, xhr, 'error', e);
+            }
+
+            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
+            if (ok) {
+                opts.success(data, 'success');
+                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
+            }
+            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
+            if (g && ! --$.active) $.event.trigger("ajaxStop");
+            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
+
+            // clean up
+            setTimeout(function() {
+                $io.remove();
+                xhr.responseXML = null;
+            }, 100);
+        };
+
+        function toXml(s, doc) {
+            if (window.ActiveXObject) {
+                doc = new ActiveXObject('Microsoft.XMLDOM');
+                doc.async = 'false';
+                doc.loadXML(s);
+            }
+            else
+                doc = (new DOMParser()).parseFromString(s, 'text/xml');
+            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
+        };
+    };
+};
+$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids
+
+/**
+ * ajaxForm() provides a mechanism for fully automating form submission.
+ *
+ * The advantages of using this method instead of ajaxSubmit() are:
+ *
+ * 1: This method will include coordinates for <input type="image" /> elements (if the element
+ *    is used to submit the form).
+ * 2. This method will include the submit element's name/value data (for the element that was
+ *    used to submit the form).
+ * 3. This method binds the submit() method to the form for you.
+ *
+ * Note that for accurate x/y coordinates of image submit elements in all browsers
+ * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
+ *
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
+ * passes the options argument along after properly binding events for submit elements and
+ * the form itself.  See ajaxSubmit for a full description of the options argument.
+ *
+ *
+ * @example
+ * var options = {
+ *     target: '#myTargetDiv'
+ * };
+ * $('#myForm').ajaxSForm(options);
+ * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
+ *       when the form is submitted.
+ *
+ *
+ * @example
+ * var options = {
+ *     success: function(responseText) {
+ *         alert(responseText);
+ *     }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Bind form's submit event so that server response is alerted after the form is submitted.
+ *
+ *
+ * @example
+ * var options = {
+ *     beforeSubmit: function(formArray, jqForm) {
+ *         if (formArray.length == 0) {
+ *             alert('Please enter data.');
+ *             return false;
+ *         }
+ *     }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Bind form's submit event so that pre-submit callback is invoked before the form
+ *       is submitted.
+ *
+ *
+ * @name   ajaxForm
+ * @param  options  object literal containing options which control the form submission process
+ * @return jQuery
+ * @cat    Plugins/Form
+ * @type   jQuery
+ */
+$.fn.ajaxForm = function(options) {
+    return this.ajaxFormUnbind().submit(submitHandler).each(function() {
+        // store options in hash
+        this.formPluginId = $.fn.ajaxForm.counter++;
+        $.fn.ajaxForm.optionHash[this.formPluginId] = options;
+        $(":submit,input:image", this).click(clickHandler);
+    });
+};
+
+$.fn.ajaxForm.counter = 1;
+$.fn.ajaxForm.optionHash = {};
+
+function clickHandler(e) {
+    var $form = this.form;
+    $form.clk = this;
+    if (this.type == 'image') {
+        if (e.offsetX != undefined) {
+            $form.clk_x = e.offsetX;
+            $form.clk_y = e.offsetY;
+        } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
+            var offset = $(this).offset();
+            $form.clk_x = e.pageX - offset.left;
+            $form.clk_y = e.pageY - offset.top;
+        } else {
+            $form.clk_x = e.pageX - this.offsetLeft;
+            $form.clk_y = e.pageY - this.offsetTop;
+        }
+    }
+    // clear form vars
+    setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
+};
+
+function submitHandler() {
+    // retrieve options from hash
+    var id = this.formPluginId;
+    var options = $.fn.ajaxForm.optionHash[id];
+    $(this).ajaxSubmit(options);
+    return false;
+};
+
+/**
+ * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
+ *
+ * @name   ajaxFormUnbind
+ * @return jQuery
+ * @cat    Plugins/Form
+ * @type   jQuery
+ */
+$.fn.ajaxFormUnbind = function() {
+    this.unbind('submit', submitHandler);
+    return this.each(function() {
+        $(":submit,input:image", this).unbind('click', clickHandler);
+    });
+
+};
+
+/**
+ * formToArray() gathers form element data into an array of objects that can
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
+ * Each object in the array has both a 'name' and 'value' property.  An example of
+ * an array for a simple login form might be:
+ *
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * It is this array that is passed to pre-submit callback functions provided to the
+ * ajaxSubmit() and ajaxForm() methods.
+ *
+ * The semantic argument can be used to force form serialization in semantic order.
+ * This is normally true anyway, unless the form contains input elements of type='image'.
+ * If your form must be submitted with name/value pairs in semantic order and your form
+ * contains an input of type='image" then pass true for this arg, otherwise pass false
+ * (or nothing) to avoid the overhead for this logic.
+ *
+ * @example var data = $("#myForm").formToArray();
+ * $.post( "myscript.cgi", data );
+ * @desc Collect all the data from a form and submit it to the server.
+ *
+ * @name formToArray
+ * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
+ * @type Array<Object>
+ * @cat Plugins/Form
+ */
+$.fn.formToArray = function(semantic) {
+    var a = [];
+    if (this.length == 0) return a;
+
+    var form = this[0];
+    var els = semantic ? form.getElementsByTagName('*') : form.elements;
+    if (!els) return a;
+    for(var i=0, max=els.length; i < max; i++) {
+        var el = els[i];
+        var n = el.name;
+        if (!n) continue;
+
+        if (semantic && form.clk && el.type == "image") {
+            // handle image inputs on the fly when semantic == true
+            if(!el.disabled && form.clk == el)
+                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+            continue;
+        }
+
+        var v = $.fieldValue(el, true);
+        if (v && v.constructor == Array) {
+            for(var j=0, jmax=v.length; j < jmax; j++)
+                a.push({name: n, value: v[j]});
+        }
+        else if (v !== null && typeof v != 'undefined')
+            a.push({name: n, value: v});
+    }
+
+    if (!semantic && form.clk) {
+        // input type=='image' are not found in elements array! handle them here
+        var inputs = form.getElementsByTagName("input");
+        for(var i=0, max=inputs.length; i < max; i++) {
+            var input = inputs[i];
+            var n = input.name;
+            if(n && !input.disabled && input.type == "image" && form.clk == input)
+                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+        }
+    }
+    return a;
+};
+
+
+/**
+ * Serializes form data into a 'submittable' string. This method will return a string
+ * in the format: name1=value1&amp;name2=value2
+ *
+ * The semantic argument can be used to force form serialization in semantic order.
+ * If your form must be submitted with name/value pairs in semantic order then pass
+ * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
+ * this logic (which can be significant for very large forms).
+ *
+ * @example var data = $("#myForm").formSerialize();
+ * $.ajax('POST', "myscript.cgi", data);
+ * @desc Collect all the data from a form into a single string
+ *
+ * @name formSerialize
+ * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
+ * @type String
+ * @cat Plugins/Form
+ */
+$.fn.formSerialize = function(semantic) {
+    //hand off to jQuery.param for proper encoding
+    return $.param(this.formToArray(semantic));
+};
+
+
+/**
+ * Serializes all field elements in the jQuery object into a query string.
+ * This method will return a string in the format: name1=value1&amp;name2=value2
+ *
+ * The successful argument controls whether or not serialization is limited to
+ * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true.
+ *
+ * @example var data = $("input").formSerialize();
+ * @desc Collect the data from all successful input elements into a query string
+ *
+ * @example var data = $(":radio").formSerialize();
+ * @desc Collect the data from all successful radio input elements into a query string
+ *
+ * @example var data = $("#myForm :checkbox").formSerialize();
+ * @desc Collect the data from all successful checkbox input elements in myForm into a query string
+ *
+ * @example var data = $("#myForm :checkbox").formSerialize(false);
+ * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
+ *
+ * @example var data = $(":input").formSerialize();
+ * @desc Collect the data from all successful input, select, textarea and button elements into a query string
+ *
+ * @name fieldSerialize
+ * @param successful true if only successful controls should be serialized (default is true)
+ * @type String
+ * @cat Plugins/Form
+ */
+$.fn.fieldSerialize = function(successful) {
+    var a = [];
+    this.each(function() {
+        var n = this.name;
+        if (!n) return;
+        var v = $.fieldValue(this, successful);
+        if (v && v.constructor == Array) {
+            for (var i=0,max=v.length; i < max; i++)
+                a.push({name: n, value: v[i]});
+        }
+        else if (v !== null && typeof v != 'undefined')
+            a.push({name: this.name, value: v});
+    });
+    //hand off to jQuery.param for proper encoding
+    return $.param(a);
+};
+
+
+/**
+ * Returns the value(s) of the element in the matched set.  For example, consider the following form:
+ *
+ *  <form><fieldset>
+ *      <input name="A" type="text" />
+ *      <input name="A" type="text" />
+ *      <input name="B" type="checkbox" value="B1" />
+ *      <input name="B" type="checkbox" value="B2"/>
+ *      <input name="C" type="radio" value="C1" />
+ *      <input name="C" type="radio" value="C2" />
+ *  </fieldset></form>
+ *
+ *  var v = $(':text').fieldValue();
+ *  // if no values are entered into the text inputs
+ *  v == ['','']
+ *  // if values entered into the text inputs are 'foo' and 'bar'
+ *  v == ['foo','bar']
+ *
+ *  var v = $(':checkbox').fieldValue();
+ *  // if neither checkbox is checked
+ *  v === undefined
+ *  // if both checkboxes are checked
+ *  v == ['B1', 'B2']
+ *
+ *  var v = $(':radio').fieldValue();
+ *  // if neither radio is checked
+ *  v === undefined
+ *  // if first radio is checked
+ *  v == ['C1']
+ *
+ * The successful argument controls whether or not the field element must be 'successful'
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true.  If this value is false the value(s)
+ * for each element is returned.
+ *
+ * Note: This method *always* returns an array.  If no valid value can be determined the
+ *       array will be empty, otherwise it will contain one or more values.
+ *
+ * @example var data = $("#myPasswordElement").fieldValue();
+ * alert(data[0]);
+ * @desc Alerts the current value of the myPasswordElement element
+ *
+ * @example var data = $("#myForm :input").fieldValue();
+ * @desc Get the value(s) of the form elements in myForm
+ *
+ * @example var data = $("#myForm :checkbox").fieldValue();
+ * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
+ *
+ * @example var data = $("#mySingleSelect").fieldValue();
+ * @desc Get the value(s) of the select control
+ *
+ * @example var data = $(':text').fieldValue();
+ * @desc Get the value(s) of the text input or textarea elements
+ *
+ * @example var data = $("#myMultiSelect").fieldValue();
+ * @desc Get the values for the select-multiple control
+ *
+ * @name fieldValue
+ * @param Boolean successful true if only the values for successful controls should be returned (default is true)
+ * @type Array<String>
+ * @cat Plugins/Form
+ */
+$.fn.fieldValue = function(successful) {
+    for (var val=[], i=0, max=this.length; i < max; i++) {
+        var el = this[i];
+        var v = $.fieldValue(el, successful);
+        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
+            continue;
+        v.constructor == Array ? $.merge(val, v) : val.push(v);
+    }
+    return val;
+};
+
+/**
+ * Returns the value of the field element.
+ *
+ * The successful argument controls whether or not the field element must be 'successful'
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true.  If the given element is not
+ * successful and the successful arg is not false then the returned value will be null.
+ *
+ * Note: If the successful flag is true (default) but the element is not successful, the return will be null
+ * Note: The value returned for a successful select-multiple element will always be an array.
+ * Note: If the element has no value the return value will be undefined.
+ *
+ * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
+ * @desc Gets the current value of the myPasswordElement element
+ *
+ * @name fieldValue
+ * @param Element el The DOM element for which the value will be returned
+ * @param Boolean successful true if value returned must be for a successful controls (default is true)
+ * @type String or Array<String> or null or undefined
+ * @cat Plugins/Form
+ */
+$.fieldValue = function(el, successful) {
+    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+    if (typeof successful == 'undefined') successful = true;
+
+    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
+        (t == 'checkbox' || t == 'radio') && !el.checked ||
+        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
+        tag == 'select' && el.selectedIndex == -1))
+            return null;
+
+    if (tag == 'select') {
+        var index = el.selectedIndex;
+        if (index < 0) return null;
+        var a = [], ops = el.options;
+        var one = (t == 'select-one');
+        var max = (one ? index+1 : ops.length);
+        for(var i=(one ? index : 0); i < max; i++) {
+            var op = ops[i];
+            if (op.selected) {
+                // extra pain for IE...
+                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
+                if (one) return v;
+                a.push(v);
+            }
+        }
+        return a;
+    }
+    return el.value;
+};
+
+
+/**
+ * Clears the form data.  Takes the following actions on the form's input fields:
+ *  - input text fields will have their 'value' property set to the empty string
+ *  - select elements will have their 'selectedIndex' property set to -1
+ *  - checkbox and radio inputs will have their 'checked' property set to false
+ *  - inputs of type submit, button, reset, and hidden will *not* be effected
+ *  - button elements will *not* be effected
+ *
+ * @example $('form').clearForm();
+ * @desc Clears all forms on the page.
+ *
+ * @name clearForm
+ * @type jQuery
+ * @cat Plugins/Form
+ */
+$.fn.clearForm = function() {
+    return this.each(function() {
+        $('input,select,textarea', this).clearFields();
+    });
+};
+
+/**
+ * Clears the selected form elements.  Takes the following actions on the matched elements:
+ *  - input text fields will have their 'value' property set to the empty string
+ *  - select elements will have their 'selectedIndex' property set to -1
+ *  - checkbox and radio inputs will have their 'checked' property set to false
+ *  - inputs of type submit, button, reset, and hidden will *not* be effected
+ *  - button elements will *not* be effected
+ *
+ * @example $('.myInputs').clearFields();
+ * @desc Clears all inputs with class myInputs
+ *
+ * @name clearFields
+ * @type jQuery
+ * @cat Plugins/Form
+ */
+$.fn.clearFields = $.fn.clearInputs = function() {
+    return this.each(function() {
+        var t = this.type, tag = this.tagName.toLowerCase();
+        if (t == 'text' || t == 'password' || tag == 'textarea')
+            this.value = '';
+        else if (t == 'checkbox' || t == 'radio')
+            this.checked = false;
+        else if (tag == 'select')
+            this.selectedIndex = -1;
+    });
+};
+
+
+/**
+ * Resets the form data.  Causes all form elements to be reset to their original value.
+ *
+ * @example $('form').resetForm();
+ * @desc Resets all forms on the page.
+ *
+ * @name resetForm
+ * @type jQuery
+ * @cat Plugins/Form
+ */
+$.fn.resetForm = function() {
+    return this.each(function() {
+        // guard against an input with the name of 'reset'
+        // note that IE reports the reset function as an 'object'
+        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
+            this.reset();
+    });
+};
+
+
+/**
+ * Enables or disables any matching elements.
+ *
+ * @example $(':radio').enabled(false);
+ * @desc Disables all radio buttons
+ *
+ * @name select
+ * @type jQuery
+ * @cat Plugins/Form
+ */
+$.fn.enable = function(b) { 
+    if (b == undefined) b = true;
+    return this.each(function() { 
+        this.disabled = !b 
+    });
+};
+
+/**
+ * Checks/unchecks any matching checkboxes or radio buttons and
+ * selects/deselects and matching option elements.
+ *
+ * @example $(':checkbox').selected();
+ * @desc Checks all checkboxes
+ *
+ * @name select
+ * @type jQuery
+ * @cat Plugins/Form
+ */
+$.fn.select = function(select) {
+    if (select == undefined) select = true;
+    return this.each(function() { 
+        var t = this.type;
+        if (t == 'checkbox' || t == 'radio')
+            this.checked = select;
+        else if (this.tagName.toLowerCase() == 'option') {
+            var $sel = $(this).parent('select');
+            if (select && $sel[0] && $sel[0].type == 'select-one') {
+                // deselect all other options
+                $sel.find('option').select(false);
+            }
+            this.selected = select;
+        }
+    });
+};
+
+})(jQuery);
index 2ee5c9626849f7758c42201af9f936daa403ed9f..6978c297d25506eccb91f3700b894a96ed18fca7 100644 (file)
@@ -1,872 +1 @@
-/*
- * jQuery Form Plugin
- * version: 2.02 (12/16/2007)
- * @requires jQuery v1.1 or later
- *
- * Examples at: http://malsup.com/jquery/form/
- * Dual licensed under the MIT and GPL licenses:
- *   http://www.opensource.org/licenses/mit-license.php
- *   http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id$
- */
- (function($) {
-/**
- * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
- *
- * ajaxSubmit accepts a single argument which can be either a success callback function
- * or an options Object.  If a function is provided it will be invoked upon successful
- * completion of the submit and will be passed the response from the server.
- * If an options Object is provided, the following attributes are supported:
- *
- *  target:   Identifies the element(s) in the page to be updated with the server response.
- *            This value may be specified as a jQuery selection string, a jQuery object,
- *            or a DOM element.
- *            default value: null
- *
- *  url:      URL to which the form data will be submitted.
- *            default value: value of form's 'action' attribute
- *
- *  type:     The method in which the form data should be submitted, 'GET' or 'POST'.
- *            default value: value of form's 'method' attribute (or 'GET' if none found)
- *
- *  data:     Additional data to add to the request, specified as key/value pairs (see $.ajax).
- *
- *  beforeSubmit:  Callback method to be invoked before the form is submitted.
- *            default value: null
- *
- *  success:  Callback method to be invoked after the form has been successfully submitted
- *            and the response has been returned from the server
- *            default value: null
- *
- *  dataType: Expected dataType of the response.  One of: null, 'xml', 'script', or 'json'
- *            default value: null
- *
- *  semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
- *            default value: false
- *
- *  resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
- *
- *  clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
- *
- *
- * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
- * validating the form data.  If the 'beforeSubmit' callback returns false then the form will
- * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
- * in array format, the jQuery object, and the options object passed into ajaxSubmit.
- * The form data array takes the following form:
- *
- *     [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * If a 'success' callback method is provided it is invoked after the response has been returned
- * from the server.  It is passed the responseText or responseXML value (depending on dataType).
- * See jQuery.ajax for further details.
- *
- *
- * The dataType option provides a means for specifying how the server response should be handled.
- * This maps directly to the jQuery.httpData method.  The following values are supported:
- *
- *      'xml':    if dataType == 'xml' the server response is treated as XML and the 'success'
- *                   callback method, if specified, will be passed the responseXML value
- *      'json':   if dataType == 'json' the server response will be evaluted and passed to
- *                   the 'success' callback, if specified
- *      'script': if dataType == 'script' the server response is evaluated in the global context
- *
- *
- * Note that it does not make sense to use both the 'target' and 'dataType' options.  If both
- * are provided the target will be ignored.
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image" then pass true for this arg, otherwise pass false
- * (or nothing) to avoid the overhead for this logic.
- *
- *
- * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
- *
- * $("#form-id").submit(function() {
- *     $(this).ajaxSubmit(options);
- *     return false; // cancel conventional submit
- * });
- *
- * When using ajaxForm(), however, this is done for you.
- *
- * @example
- * $('#myForm').ajaxSubmit(function(data) {
- *     alert('Form submit succeeded! Server returned: ' + data);
- * });
- * @desc Submit form and alert server response
- *
- *
- * @example
- * var options = {
- *     target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and update page element with server response
- *
- *
- * @example
- * var options = {
- *     success: function(responseText) {
- *         alert(responseText);
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and alert the server response
- *
- *
- * @example
- * var options = {
- *     beforeSubmit: function(formArray, jqForm) {
- *         if (formArray.length == 0) {
- *             alert('Please enter data.');
- *             return false;
- *         }
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Pre-submit validation which aborts the submit operation if form data is empty
- *
- *
- * @example
- * var options = {
- *     url: myJsonUrl.php,
- *     dataType: 'json',
- *     success: function(data) {
- *        // 'data' is an object representing the the evaluated json data
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc json data returned and evaluated
- *
- *
- * @example
- * var options = {
- *     url: myXmlUrl.php,
- *     dataType: 'xml',
- *     success: function(responseXML) {
- *        // responseXML is XML document object
- *        var data = $('myElement', responseXML).text();
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc XML data returned from server
- *
- *
- * @example
- * var options = {
- *     resetForm: true
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc submit form and reset it if successful
- *
- * @example
- * $('#myForm).submit(function() {
- *    $(this).ajaxSubmit();
- *    return false;
- * });
- * @desc Bind form's submit event to use ajaxSubmit
- *
- *
- * @name ajaxSubmit
- * @type jQuery
- * @param options  object literal containing options which control the form submission process
- * @cat Plugins/Form
- * @return jQuery
- */
-$.fn.ajaxSubmit = function(options) {
-    if (typeof options == 'function')
-        options = { success: options };
-
-    options = $.extend({
-        url:  this.attr('action') || window.location.toString(),
-        type: this.attr('method') || 'GET'
-    }, options || {});
-
-    // hook for manipulating the form data before it is extracted;
-    // convenient for use with rich editors like tinyMCE or FCKEditor
-    var veto = {};
-    $.event.trigger('form.pre.serialize', [this, options, veto]);
-    if (veto.veto) return this;
-
-    var a = this.formToArray(options.semantic);
-       if (options.data) {
-           for (var n in options.data)
-               a.push( { name: n, value: options.data[n] } );
-       }
-
-    // give pre-submit callback an opportunity to abort the submit
-    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
-
-    // fire vetoable 'validate' event
-    $.event.trigger('form.submit.validate', [a, this, options, veto]);
-    if (veto.veto) return this;
-
-    var q = $.param(a);//.replace(/%20/g,'+');
-
-    if (options.type.toUpperCase() == 'GET') {
-        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
-        options.data = null;  // data is null for 'get'
-    }
-    else
-        options.data = q; // data is the query string for 'post'
-
-    var $form = this, callbacks = [];
-    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
-    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
-
-    // perform a load on the target only if dataType is not provided
-    if (!options.dataType && options.target) {
-        var oldSuccess = options.success || function(){};
-        callbacks.push(function(data) {
-            if (this.evalScripts)
-                $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments);
-            else // jQuery v1.1.4
-                $(options.target).html(data).each(oldSuccess, arguments);
-        });
-    }
-    else if (options.success)
-        callbacks.push(options.success);
-
-    options.success = function(data, status) {
-        for (var i=0, max=callbacks.length; i < max; i++)
-            callbacks[i](data, status, $form);
-    };
-
-    // are there files to upload?
-    var files = $('input:file', this).fieldValue();
-    var found = false;
-    for (var j=0; j < files.length; j++)
-        if (files[j])
-            found = true;
-
-    // options.iframe allows user to force iframe mode
-   if (options.iframe || found) { 
-       // hack to fix Safari hang (thanks to Tim Molendijk for this)
-       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
-       if ($.browser.safari && options.closeKeepAlive)
-           $.get(options.closeKeepAlive, fileUpload);
-       else
-           fileUpload();
-       }
-   else
-       $.ajax(options);
-
-    // fire 'notify' event
-    $.event.trigger('form.submit.notify', [this, options]);
-    return this;
-
-
-    // private function for handling file uploads (hat tip to YAHOO!)
-    function fileUpload() {
-        var form = $form[0];
-        var opts = $.extend({}, $.ajaxSettings, options);
-
-        var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
-        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
-        var io = $io[0];
-        var op8 = $.browser.opera && window.opera.version() < 9;
-        if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
-        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
-
-        var xhr = { // mock object
-            responseText: null,
-            responseXML: null,
-            status: 0,
-            statusText: 'n/a',
-            getAllResponseHeaders: function() {},
-            getResponseHeader: function() {},
-            setRequestHeader: function() {}
-        };
-
-        var g = opts.global;
-        // trigger ajax global events so that activity/block indicators work like normal
-        if (g && ! $.active++) $.event.trigger("ajaxStart");
-        if (g) $.event.trigger("ajaxSend", [xhr, opts]);
-
-        var cbInvoked = 0;
-        var timedOut = 0;
-
-        // take a breath so that pending repaints get some cpu time before the upload starts
-        setTimeout(function() {
-            // make sure form attrs are set
-            var encAttr = form.encoding ? 'encoding' : 'enctype';
-            var t = $form.attr('target');
-            $form.attr({
-                target:   id,
-                method:  'POST',
-                action:   opts.url
-            });
-            form[encAttr] = 'multipart/form-data';
-
-            // support timout
-            if (opts.timeout)
-                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
-
-            // add iframe to doc and submit the form
-            $io.appendTo('body');
-            io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
-            form.submit();
-            $form.attr('target', t); // reset target
-        }, 10);
-
-        function cb() {
-            if (cbInvoked++) return;
-
-            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
-
-            var ok = true;
-            try {
-                if (timedOut) throw 'timeout';
-                // extract the server response from the iframe
-                var data, doc;
-                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
-                xhr.responseText = doc.body ? doc.body.innerHTML : null;
-                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
-
-                if (opts.dataType == 'json' || opts.dataType == 'script') {
-                    var ta = doc.getElementsByTagName('textarea')[0];
-                    data = ta ? ta.value : xhr.responseText;
-                    if (opts.dataType == 'json')
-                        eval("data = " + data);
-                    else
-                        $.globalEval(data);
-                }
-                else if (opts.dataType == 'xml') {
-                    data = xhr.responseXML;
-                    if (!data && xhr.responseText != null)
-                        data = toXml(xhr.responseText);
-                }
-                else {
-                    data = xhr.responseText;
-                }
-            }
-            catch(e){
-                ok = false;
-                $.handleError(opts, xhr, 'error', e);
-            }
-
-            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
-            if (ok) {
-                opts.success(data, 'success');
-                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
-            }
-            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
-            if (g && ! --$.active) $.event.trigger("ajaxStop");
-            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
-
-            // clean up
-            setTimeout(function() {
-                $io.remove();
-                xhr.responseXML = null;
-            }, 100);
-        };
-
-        function toXml(s, doc) {
-            if (window.ActiveXObject) {
-                doc = new ActiveXObject('Microsoft.XMLDOM');
-                doc.async = 'false';
-                doc.loadXML(s);
-            }
-            else
-                doc = (new DOMParser()).parseFromString(s, 'text/xml');
-            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
-        };
-    };
-};
-$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- *    is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- *    used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * Note that for accurate x/y coordinates of image submit elements in all browsers
- * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.  See ajaxSubmit for a full description of the options argument.
- *
- *
- * @example
- * var options = {
- *     target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSForm(options);
- * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
- *       when the form is submitted.
- *
- *
- * @example
- * var options = {
- *     success: function(responseText) {
- *         alert(responseText);
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that server response is alerted after the form is submitted.
- *
- *
- * @example
- * var options = {
- *     beforeSubmit: function(formArray, jqForm) {
- *         if (formArray.length == 0) {
- *             alert('Please enter data.');
- *             return false;
- *         }
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that pre-submit callback is invoked before the form
- *       is submitted.
- *
- *
- * @name   ajaxForm
- * @param  options  object literal containing options which control the form submission process
- * @return jQuery
- * @cat    Plugins/Form
- * @type   jQuery
- */
-$.fn.ajaxForm = function(options) {
-    return this.ajaxFormUnbind().submit(submitHandler).each(function() {
-        // store options in hash
-        this.formPluginId = $.fn.ajaxForm.counter++;
-        $.fn.ajaxForm.optionHash[this.formPluginId] = options;
-        $(":submit,input:image", this).click(clickHandler);
-    });
-};
-
-$.fn.ajaxForm.counter = 1;
-$.fn.ajaxForm.optionHash = {};
-
-function clickHandler(e) {
-    var $form = this.form;
-    $form.clk = this;
-    if (this.type == 'image') {
-        if (e.offsetX != undefined) {
-            $form.clk_x = e.offsetX;
-            $form.clk_y = e.offsetY;
-        } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
-            var offset = $(this).offset();
-            $form.clk_x = e.pageX - offset.left;
-            $form.clk_y = e.pageY - offset.top;
-        } else {
-            $form.clk_x = e.pageX - this.offsetLeft;
-            $form.clk_y = e.pageY - this.offsetTop;
-        }
-    }
-    // clear form vars
-    setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
-};
-
-function submitHandler() {
-    // retrieve options from hash
-    var id = this.formPluginId;
-    var options = $.fn.ajaxForm.optionHash[id];
-    $(this).ajaxSubmit(options);
-    return false;
-};
-
-/**
- * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
- *
- * @name   ajaxFormUnbind
- * @return jQuery
- * @cat    Plugins/Form
- * @type   jQuery
- */
-$.fn.ajaxFormUnbind = function() {
-    this.unbind('submit', submitHandler);
-    return this.each(function() {
-        $(":submit,input:image", this).unbind('click', clickHandler);
-    });
-
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property.  An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image" then pass true for this arg, otherwise pass false
- * (or nothing) to avoid the overhead for this logic.
- *
- * @example var data = $("#myForm").formToArray();
- * $.post( "myscript.cgi", data );
- * @desc Collect all the data from a form and submit it to the server.
- *
- * @name formToArray
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type Array<Object>
- * @cat Plugins/Form
- */
-$.fn.formToArray = function(semantic) {
-    var a = [];
-    if (this.length == 0) return a;
-
-    var form = this[0];
-    var els = semantic ? form.getElementsByTagName('*') : form.elements;
-    if (!els) return a;
-    for(var i=0, max=els.length; i < max; i++) {
-        var el = els[i];
-        var n = el.name;
-        if (!n) continue;
-
-        if (semantic && form.clk && el.type == "image") {
-            // handle image inputs on the fly when semantic == true
-            if(!el.disabled && form.clk == el)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-            continue;
-        }
-
-        var v = $.fieldValue(el, true);
-        if (v && v.constructor == Array) {
-            for(var j=0, jmax=v.length; j < jmax; j++)
-                a.push({name: n, value: v[j]});
-        }
-        else if (v !== null && typeof v != 'undefined')
-            a.push({name: n, value: v});
-    }
-
-    if (!semantic && form.clk) {
-        // input type=='image' are not found in elements array! handle them here
-        var inputs = form.getElementsByTagName("input");
-        for(var i=0, max=inputs.length; i < max; i++) {
-            var input = inputs[i];
-            var n = input.name;
-            if(n && !input.disabled && input.type == "image" && form.clk == input)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-        }
-    }
-    return a;
-};
-
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&amp;name2=value2
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * If your form must be submitted with name/value pairs in semantic order then pass
- * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
- * this logic (which can be significant for very large forms).
- *
- * @example var data = $("#myForm").formSerialize();
- * $.ajax('POST', "myscript.cgi", data);
- * @desc Collect all the data from a form into a single string
- *
- * @name formSerialize
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type String
- * @cat Plugins/Form
- */
-$.fn.formSerialize = function(semantic) {
-    //hand off to jQuery.param for proper encoding
-    return $.param(this.formToArray(semantic));
-};
-
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&amp;name2=value2
- *
- * The successful argument controls whether or not serialization is limited to
- * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.
- *
- * @example var data = $("input").formSerialize();
- * @desc Collect the data from all successful input elements into a query string
- *
- * @example var data = $(":radio").formSerialize();
- * @desc Collect the data from all successful radio input elements into a query string
- *
- * @example var data = $("#myForm :checkbox").formSerialize();
- * @desc Collect the data from all successful checkbox input elements in myForm into a query string
- *
- * @example var data = $("#myForm :checkbox").formSerialize(false);
- * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
- *
- * @example var data = $(":input").formSerialize();
- * @desc Collect the data from all successful input, select, textarea and button elements into a query string
- *
- * @name fieldSerialize
- * @param successful true if only successful controls should be serialized (default is true)
- * @type String
- * @cat Plugins/Form
- */
-$.fn.fieldSerialize = function(successful) {
-    var a = [];
-    this.each(function() {
-        var n = this.name;
-        if (!n) return;
-        var v = $.fieldValue(this, successful);
-        if (v && v.constructor == Array) {
-            for (var i=0,max=v.length; i < max; i++)
-                a.push({name: n, value: v[i]});
-        }
-        else if (v !== null && typeof v != 'undefined')
-            a.push({name: this.name, value: v});
-    });
-    //hand off to jQuery.param for proper encoding
-    return $.param(a);
-};
-
-
-/**
- * Returns the value(s) of the element in the matched set.  For example, consider the following form:
- *
- *  <form><fieldset>
- *      <input name="A" type="text" />
- *      <input name="A" type="text" />
- *      <input name="B" type="checkbox" value="B1" />
- *      <input name="B" type="checkbox" value="B2"/>
- *      <input name="C" type="radio" value="C1" />
- *      <input name="C" type="radio" value="C2" />
- *  </fieldset></form>
- *
- *  var v = $(':text').fieldValue();
- *  // if no values are entered into the text inputs
- *  v == ['','']
- *  // if values entered into the text inputs are 'foo' and 'bar'
- *  v == ['foo','bar']
- *
- *  var v = $(':checkbox').fieldValue();
- *  // if neither checkbox is checked
- *  v === undefined
- *  // if both checkboxes are checked
- *  v == ['B1', 'B2']
- *
- *  var v = $(':radio').fieldValue();
- *  // if neither radio is checked
- *  v === undefined
- *  // if first radio is checked
- *  v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.  If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array.  If no valid value can be determined the
- *       array will be empty, otherwise it will contain one or more values.
- *
- * @example var data = $("#myPasswordElement").fieldValue();
- * alert(data[0]);
- * @desc Alerts the current value of the myPasswordElement element
- *
- * @example var data = $("#myForm :input").fieldValue();
- * @desc Get the value(s) of the form elements in myForm
- *
- * @example var data = $("#myForm :checkbox").fieldValue();
- * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
- *
- * @example var data = $("#mySingleSelect").fieldValue();
- * @desc Get the value(s) of the select control
- *
- * @example var data = $(':text').fieldValue();
- * @desc Get the value(s) of the text input or textarea elements
- *
- * @example var data = $("#myMultiSelect").fieldValue();
- * @desc Get the values for the select-multiple control
- *
- * @name fieldValue
- * @param Boolean successful true if only the values for successful controls should be returned (default is true)
- * @type Array<String>
- * @cat Plugins/Form
- */
-$.fn.fieldValue = function(successful) {
-    for (var val=[], i=0, max=this.length; i < max; i++) {
-        var el = this[i];
-        var v = $.fieldValue(el, successful);
-        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
-            continue;
-        v.constructor == Array ? $.merge(val, v) : val.push(v);
-    }
-    return val;
-};
-
-/**
- * Returns the value of the field element.
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.  If the given element is not
- * successful and the successful arg is not false then the returned value will be null.
- *
- * Note: If the successful flag is true (default) but the element is not successful, the return will be null
- * Note: The value returned for a successful select-multiple element will always be an array.
- * Note: If the element has no value the return value will be undefined.
- *
- * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
- * @desc Gets the current value of the myPasswordElement element
- *
- * @name fieldValue
- * @param Element el The DOM element for which the value will be returned
- * @param Boolean successful true if value returned must be for a successful controls (default is true)
- * @type String or Array<String> or null or undefined
- * @cat Plugins/Form
- */
-$.fieldValue = function(el, successful) {
-    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
-    if (typeof successful == 'undefined') successful = true;
-
-    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
-        (t == 'checkbox' || t == 'radio') && !el.checked ||
-        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
-        tag == 'select' && el.selectedIndex == -1))
-            return null;
-
-    if (tag == 'select') {
-        var index = el.selectedIndex;
-        if (index < 0) return null;
-        var a = [], ops = el.options;
-        var one = (t == 'select-one');
-        var max = (one ? index+1 : ops.length);
-        for(var i=(one ? index : 0); i < max; i++) {
-            var op = ops[i];
-            if (op.selected) {
-                // extra pain for IE...
-                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
-                if (one) return v;
-                a.push(v);
-            }
-        }
-        return a;
-    }
-    return el.value;
-};
-
-
-/**
- * Clears the form data.  Takes the following actions on the form's input fields:
- *  - input text fields will have their 'value' property set to the empty string
- *  - select elements will have their 'selectedIndex' property set to -1
- *  - checkbox and radio inputs will have their 'checked' property set to false
- *  - inputs of type submit, button, reset, and hidden will *not* be effected
- *  - button elements will *not* be effected
- *
- * @example $('form').clearForm();
- * @desc Clears all forms on the page.
- *
- * @name clearForm
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.clearForm = function() {
-    return this.each(function() {
-        $('input,select,textarea', this).clearFields();
-    });
-};
-
-/**
- * Clears the selected form elements.  Takes the following actions on the matched elements:
- *  - input text fields will have their 'value' property set to the empty string
- *  - select elements will have their 'selectedIndex' property set to -1
- *  - checkbox and radio inputs will have their 'checked' property set to false
- *  - inputs of type submit, button, reset, and hidden will *not* be effected
- *  - button elements will *not* be effected
- *
- * @example $('.myInputs').clearFields();
- * @desc Clears all inputs with class myInputs
- *
- * @name clearFields
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.clearFields = $.fn.clearInputs = function() {
-    return this.each(function() {
-        var t = this.type, tag = this.tagName.toLowerCase();
-        if (t == 'text' || t == 'password' || tag == 'textarea')
-            this.value = '';
-        else if (t == 'checkbox' || t == 'radio')
-            this.checked = false;
-        else if (tag == 'select')
-            this.selectedIndex = -1;
-    });
-};
-
-
-/**
- * Resets the form data.  Causes all form elements to be reset to their original value.
- *
- * @example $('form').resetForm();
- * @desc Resets all forms on the page.
- *
- * @name resetForm
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.resetForm = function() {
-    return this.each(function() {
-        // guard against an input with the name of 'reset'
-        // note that IE reports the reset function as an 'object'
-        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
-            this.reset();
-    });
-};
-
-
-/**
- * Enables or disables any matching elements.
- *
- * @example $(':radio').enabled(false);
- * @desc Disables all radio buttons
- *
- * @name select
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.enable = function(b) { 
-    if (b == undefined) b = true;
-    return this.each(function() { 
-        this.disabled = !b 
-    });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- *
- * @example $(':checkbox').selected();
- * @desc Checks all checkboxes
- *
- * @name select
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.select = function(select) {
-    if (select == undefined) select = true;
-    return this.each(function() { 
-        var t = this.type;
-        if (t == 'checkbox' || t == 'radio')
-            this.checked = select;
-        else if (this.tagName.toLowerCase() == 'option') {
-            var $sel = $(this).parent('select');
-            if (select && $sel[0] && $sel[0].type == 'select-one') {
-                // deselect all other options
-                $sel.find('option').select(false);
-            }
-            this.selected = select;
-        }
-    });
-};
-
-})(jQuery);
+(function($){$.fn.ajaxSubmit=function(options){if(typeof options=="function"){options={success:options}}options=$.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},options||{});var veto={};$.event.trigger("form.pre.serialize",[this,options,veto]);if(veto.veto){return this}var a=this.formToArray(options.semantic);if(options.data){for(var n in options.data){a.push({name:n,value:options.data[n]})}}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){return this}$.event.trigger("form.submit.validate",[a,this,options,veto]);if(veto.veto){return this}var q=$.param(a);if(options.type.toUpperCase()=="GET"){options.url+=(options.url.indexOf("?")>=0?"&":"?")+q;options.data=null}else{options.data=q}var $form=this,callbacks=[];if(options.resetForm){callbacks.push(function(){$form.resetForm()})}if(options.clearForm){callbacks.push(function(){$form.clearForm()})}if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){if(this.evalScripts){$(options.target).attr("innerHTML",data).evalScripts().each(oldSuccess,arguments)}else{$(options.target).html(data).each(oldSuccess,arguments)}})}else{if(options.success){callbacks.push(options.success)}}options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++){callbacks[i](data,status,$form)}};var files=$("input:file",this).fieldValue();var found=false;for(var j=0;j<files.length;j++){if(files[j]){found=true}}if(options.iframe||found){if($.browser.safari&&options.closeKeepAlive){$.get(options.closeKeepAlive,fileUpload)}else{fileUpload()}}else{$.ajax(options)}$.event.trigger("form.submit.notify",[this,options]);return this;function fileUpload(){var form=$form[0];var opts=$.extend({},$.ajaxSettings,options);var id="jqFormIO"+$.fn.ajaxSubmit.counter++;var $io=$('<iframe id="'+id+'" name="'+id+'" />');var io=$io[0];var op8=$.browser.opera&&window.opera.version()<9;if($.browser.msie||op8){io.src='javascript:false;document.write("");'}$io.css({position:"absolute",top:"-1000px",left:"-1000px"});var xhr={responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){}};var g=opts.global;if(g&&!$.active++){$.event.trigger("ajaxStart")}if(g){$.event.trigger("ajaxSend",[xhr,opts])}var cbInvoked=0;var timedOut=0;setTimeout(function(){var encAttr=form.encoding?"encoding":"enctype";var t=$form.attr("target");$form.attr({target:id,method:"POST",action:opts.url});form[encAttr]="multipart/form-data";if(opts.timeout){setTimeout(function(){timedOut=true;cb()},opts.timeout)}$io.appendTo("body");io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,false);form.submit();$form.attr("target",t)},10);function cb(){if(cbInvoked++){return}io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,false);var ok=true;try{if(timedOut){throw"timeout"}var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;if(opts.dataType=="json"||opts.dataType=="script"){var ta=doc.getElementsByTagName("textarea")[0];data=ta?ta.value:xhr.responseText;if(opts.dataType=="json"){eval("data = "+data)}else{$.globalEval(data)}}else{if(opts.dataType=="xml"){data=xhr.responseXML;if(!data&&xhr.responseText!=null){data=toXml(xhr.responseText)}}else{data=xhr.responseText}}}catch(e){ok=false;$.handleError(opts,xhr,"error",e)}if(ok){opts.success(data,"success");if(g){$.event.trigger("ajaxSuccess",[xhr,opts])}}if(g){$.event.trigger("ajaxComplete",[xhr,opts])}if(g&&!--$.active){$.event.trigger("ajaxStop")}if(opts.complete){opts.complete(xhr,ok?"success":"error")}setTimeout(function(){$io.remove();xhr.responseXML=null},100)}function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(s)}else{doc=(new DOMParser()).parseFromString(s,"text/xml")}return(doc&&doc.documentElement&&doc.documentElement.tagName!="parsererror")?doc:null}}};$.fn.ajaxSubmit.counter=0;$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().submit(submitHandler).each(function(){this.formPluginId=$.fn.ajaxForm.counter++;$.fn.ajaxForm.optionHash[this.formPluginId]=options;$(":submit,input:image",this).click(clickHandler)})};$.fn.ajaxForm.counter=1;$.fn.ajaxForm.optionHash={};function clickHandler(e){var $form=this.form;$form.clk=this;if(this.type=="image"){if(e.offsetX!=undefined){$form.clk_x=e.offsetX;$form.clk_y=e.offsetY}else{if(typeof $.fn.offset=="function"){var offset=$(this).offset();$form.clk_x=e.pageX-offset.left;$form.clk_y=e.pageY-offset.top}else{$form.clk_x=e.pageX-this.offsetLeft;$form.clk_y=e.pageY-this.offsetTop}}}setTimeout(function(){$form.clk=$form.clk_x=$form.clk_y=null},10)}function submitHandler(){var id=this.formPluginId;var options=$.fn.ajaxForm.optionHash[id];$(this).ajaxSubmit(options);return false}$.fn.ajaxFormUnbind=function(){this.unbind("submit",submitHandler);return this.each(function(){$(":submit,input:image",this).unbind("click",clickHandler)})};$.fn.formToArray=function(semantic){var a=[];if(this.length==0){return a}var form=this[0];var els=semantic?form.getElementsByTagName("*"):form.elements;if(!els){return a}for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n){continue}if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}continue}var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++){a.push({name:n,value:v[j]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v})}}}if(!semantic&&form.clk){var inputs=form.getElementsByTagName("input");for(var i=0,max=inputs.length;i<max;i++){var input=inputs[i];var n=input.name;if(n&&!input.disabled&&input.type=="image"&&form.clk==input){a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y})}}}return a};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic))};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n){return}var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++){a.push({name:n,value:v[i]})}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v})}}});return $.param(a)};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue}v.constructor==Array?$.merge(val,v):val.push(v)}return val};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=="undefined"){successful=true}if(successful&&(!n||el.disabled||t=="reset"||t=="button"||(t=="checkbox"||t=="radio")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return null}if(tag=="select"){var index=el.selectedIndex;if(index<0){return null}var a=[],ops=el.options;var one=(t=="select-one");var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=$.browser.msie&&!(op.attributes.value.specified)?op.text:op.value;if(one){return v}a.push(v)}}return a}return el.value};$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields()})};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=="text"||t=="password"||tag=="textarea"){this.value=""}else{if(t=="checkbox"||t=="radio"){this.checked=false}else{if(tag=="select"){this.selectedIndex=-1}}}})};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(b){if(b==undefined){b=true}return this.each(function(){this.disabled=!b})};$.fn.select=function(select){if(select==undefined){select=true}return this.each(function(){var t=this.type;if(t=="checkbox"||t=="radio"){this.checked=select}else{if(this.tagName.toLowerCase()=="option"){var $sel=$(this).parent("select");if(select&&$sel[0]&&$sel[0].type=="select-one"){$sel.find("option").select(false)}this.selected=select}}})}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jquery/jquery.hotkeys.dev.js b/wp-includes/js/jquery/jquery.hotkeys.dev.js
new file mode 100644 (file)
index 0000000..7508630
--- /dev/null
@@ -0,0 +1,128 @@
+/******************************************************************************************************************************
+
+ * @ Original idea by by Binny V A, Original version: 2.00.A 
+ * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/
+ * @ Original License : BSD
+ * @ jQuery Plugin by Tzury Bar Yochay 
+        mail: tzury.by@gmail.com
+        blog: evalinux.wordpress.com
+        face: facebook.com/profile.php?id=513676303
+        
+        (c) Copyrights 2007
+        
+ * @ jQuery Plugin version Beta (0.0.2)
+ * @ License: jQuery-License.
+TODO:
+    add queue support (as in gmail) e.g. 'x' then 'y', etc.
+    add mouse + mouse wheel events.
+
+USAGE:
+    $.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');});
+    $.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});>
+    $.hotkeys.remove('Ctrl+c'); 
+    $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'}); 
+    
+******************************************************************************************************************************/
+(function (jQuery){
+    this.version = '(beta)(0.0.3)';
+       this.all = {};
+    this.special_keys = {
+        27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock', 
+        144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup', 
+        34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3', 
+        115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'};
+        
+    this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", 
+        "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", 
+        ".":">",  "/":"?",  "\\":"|" };
+        
+    this.add = function(combi, options, callback) {
+        if (jQuery.isFunction(options)){
+            callback = options;
+            options = {};
+        }
+        var opt = {},
+            defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0]},
+            that = this;
+        opt = jQuery.extend( opt , defaults, options || {} );
+        combi = combi.toLowerCase();        
+        
+        // inspect if keystroke matches
+        var inspector = function(event) {
+            event = jQuery.event.fix(event); // jQuery event normalization.
+            var element = event.target;
+            // @ TextNode -> nodeType == 3
+            element = (element.nodeType==3) ? element.parentNode : element;
+            
+            if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
+                var target = jQuery(element);
+                if( target.is("input") || target.is("textarea")){
+                    return;
+                }
+            }
+            var code = event.which,
+                type = event.type,
+                character = String.fromCharCode(code).toLowerCase(),
+                special = that.special_keys[code],
+                shift = event.shiftKey,
+                ctrl = event.ctrlKey,
+                alt= event.altKey,
+                meta = event.metaKey,
+                propagate = true, // default behaivour
+                mapPoint = null;
+            
+            // in opera + safari, the event.target is unpredictable.
+            // for example: 'keydown' might be associated with HtmlBodyElement 
+            // or the element where you last clicked with your mouse.
+            if (jQuery.browser.opera || jQuery.browser.safari){
+                while (!that.all[element] && element.parentNode){
+                    element = element.parentNode;
+                }
+            }
+            var cbMap = that.all[element].events[type].callbackMap;
+            if(!shift && !ctrl && !alt && !meta) { // No Modifiers
+                mapPoint = cbMap[special] ||  cbMap[character]
+                       }
+            // deals with combinaitons (alt|ctrl|shift+anything)
+            else{
+                var modif = '';
+                if(alt) modif +='alt+';
+                if(ctrl) modif+= 'ctrl+';
+                if(shift) modif += 'shift+';
+                if(meta) modif += 'meta+';
+                // modifiers + special keys or modifiers + characters or modifiers + shift characters
+                mapPoint = cbMap[modif+special] || cbMap[modif+character] || cbMap[modif+that.shift_nums[character]]
+            }
+            if (mapPoint){
+                mapPoint.cb(event);
+                if(!mapPoint.propagate) {
+                    event.stopPropagation();
+                    event.preventDefault();
+                    return false;
+                }
+            }
+               };        
+        // first hook for this element
+        if (!this.all[opt.target]){
+            this.all[opt.target] = {events:{}};
+        }
+        if (!this.all[opt.target].events[opt.type]){
+            this.all[opt.target].events[opt.type] = {callbackMap: {}}
+            jQuery.event.add(opt.target, opt.type, inspector);
+        }        
+        this.all[opt.target].events[opt.type].callbackMap[combi] =  {cb: callback, propagate:opt.propagate};                
+        return jQuery;
+       };    
+    this.remove = function(exp, opt) {
+        opt = opt || {};
+        target = opt.target || jQuery('html')[0];
+        type = opt.type || 'keydown';
+               exp = exp.toLowerCase();        
+        delete this.all[target].events[type].callbackMap[exp]        
+        return jQuery;
+       };
+    jQuery.hotkeys = this;
+    return jQuery;    
+})(jQuery);
\ No newline at end of file
index 7508630927fe3d249dd76989a2947eed30d3bd1c..f6a3281210d4ec5414d4c57389e0700539cbd90f 100644 (file)
@@ -1,128 +1 @@
-/******************************************************************************************************************************
-
- * @ Original idea by by Binny V A, Original version: 2.00.A 
- * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/
- * @ Original License : BSD
- * @ jQuery Plugin by Tzury Bar Yochay 
-        mail: tzury.by@gmail.com
-        blog: evalinux.wordpress.com
-        face: facebook.com/profile.php?id=513676303
-        
-        (c) Copyrights 2007
-        
- * @ jQuery Plugin version Beta (0.0.2)
- * @ License: jQuery-License.
-TODO:
-    add queue support (as in gmail) e.g. 'x' then 'y', etc.
-    add mouse + mouse wheel events.
-
-USAGE:
-    $.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');});
-    $.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});>
-    $.hotkeys.remove('Ctrl+c'); 
-    $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'}); 
-    
-******************************************************************************************************************************/
-(function (jQuery){
-    this.version = '(beta)(0.0.3)';
-       this.all = {};
-    this.special_keys = {
-        27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock', 
-        144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup', 
-        34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3', 
-        115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'};
-        
-    this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", 
-        "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", 
-        ".":">",  "/":"?",  "\\":"|" };
-        
-    this.add = function(combi, options, callback) {
-        if (jQuery.isFunction(options)){
-            callback = options;
-            options = {};
-        }
-        var opt = {},
-            defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0]},
-            that = this;
-        opt = jQuery.extend( opt , defaults, options || {} );
-        combi = combi.toLowerCase();        
-        
-        // inspect if keystroke matches
-        var inspector = function(event) {
-            event = jQuery.event.fix(event); // jQuery event normalization.
-            var element = event.target;
-            // @ TextNode -> nodeType == 3
-            element = (element.nodeType==3) ? element.parentNode : element;
-            
-            if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
-                var target = jQuery(element);
-                if( target.is("input") || target.is("textarea")){
-                    return;
-                }
-            }
-            var code = event.which,
-                type = event.type,
-                character = String.fromCharCode(code).toLowerCase(),
-                special = that.special_keys[code],
-                shift = event.shiftKey,
-                ctrl = event.ctrlKey,
-                alt= event.altKey,
-                meta = event.metaKey,
-                propagate = true, // default behaivour
-                mapPoint = null;
-            
-            // in opera + safari, the event.target is unpredictable.
-            // for example: 'keydown' might be associated with HtmlBodyElement 
-            // or the element where you last clicked with your mouse.
-            if (jQuery.browser.opera || jQuery.browser.safari){
-                while (!that.all[element] && element.parentNode){
-                    element = element.parentNode;
-                }
-            }
-            var cbMap = that.all[element].events[type].callbackMap;
-            if(!shift && !ctrl && !alt && !meta) { // No Modifiers
-                mapPoint = cbMap[special] ||  cbMap[character]
-                       }
-            // deals with combinaitons (alt|ctrl|shift+anything)
-            else{
-                var modif = '';
-                if(alt) modif +='alt+';
-                if(ctrl) modif+= 'ctrl+';
-                if(shift) modif += 'shift+';
-                if(meta) modif += 'meta+';
-                // modifiers + special keys or modifiers + characters or modifiers + shift characters
-                mapPoint = cbMap[modif+special] || cbMap[modif+character] || cbMap[modif+that.shift_nums[character]]
-            }
-            if (mapPoint){
-                mapPoint.cb(event);
-                if(!mapPoint.propagate) {
-                    event.stopPropagation();
-                    event.preventDefault();
-                    return false;
-                }
-            }
-               };        
-        // first hook for this element
-        if (!this.all[opt.target]){
-            this.all[opt.target] = {events:{}};
-        }
-        if (!this.all[opt.target].events[opt.type]){
-            this.all[opt.target].events[opt.type] = {callbackMap: {}}
-            jQuery.event.add(opt.target, opt.type, inspector);
-        }        
-        this.all[opt.target].events[opt.type].callbackMap[combi] =  {cb: callback, propagate:opt.propagate};                
-        return jQuery;
-       };    
-    this.remove = function(exp, opt) {
-        opt = opt || {};
-        target = opt.target || jQuery('html')[0];
-        type = opt.type || 'keydown';
-               exp = exp.toLowerCase();        
-        delete this.all[target].events[type].callbackMap[exp]        
-        return jQuery;
-       };
-    jQuery.hotkeys = this;
-    return jQuery;    
-})(jQuery);
\ No newline at end of file
+(function(a){this.version="(beta)(0.0.3)";this.all={};this.special_keys={27:"esc",9:"tab",32:"space",13:"return",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"};this.shift_nums={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"};this.add=function(c,b,h){if(a.isFunction(b)){h=b;b={}}var d={},f={type:"keydown",propagate:false,disableInInput:false,target:a("html")[0]},e=this;d=a.extend(d,f,b||{});c=c.toLowerCase();var g=function(j){j=a.event.fix(j);var o=j.target;o=(o.nodeType==3)?o.parentNode:o;if(d.disableInInput){var s=a(o);if(s.is("input")||s.is("textarea")){return}}var l=j.which,u=j.type,r=String.fromCharCode(l).toLowerCase(),t=e.special_keys[l],m=j.shiftKey,i=j.ctrlKey,p=j.altKey,w=j.metaKey,q=true,k=null;if(a.browser.opera||a.browser.safari){while(!e.all[o]&&o.parentNode){o=o.parentNode}}var v=e.all[o].events[u].callbackMap;if(!m&&!i&&!p&&!w){k=v[t]||v[r]}else{var n="";if(p){n+="alt+"}if(i){n+="ctrl+"}if(m){n+="shift+"}if(w){n+="meta+"}k=v[n+t]||v[n+r]||v[n+e.shift_nums[r]]}if(k){k.cb(j);if(!k.propagate){j.stopPropagation();j.preventDefault();return false}}};if(!this.all[d.target]){this.all[d.target]={events:{}}}if(!this.all[d.target].events[d.type]){this.all[d.target].events[d.type]={callbackMap:{}};a.event.add(d.target,d.type,g)}this.all[d.target].events[d.type].callbackMap[c]={cb:h,propagate:d.propagate};return a};this.remove=function(c,b){b=b||{};target=b.target||a("html")[0];type=b.type||"keydown";c=c.toLowerCase();delete this.all[target].events[type].callbackMap[c];return a};a.hotkeys=this;return a})(jQuery);
\ No newline at end of file
index c3dbc8c7df8fb6b8ae6873a60be13a4ac059543e..06c214b5af3358d5d03c10681d72f2348072932b 100644 (file)
@@ -1,11 +1,20 @@
 /*
 /*
- * jQuery 1.2.6 - New Wave Javascript
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
  *
  *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
  *
  *
- * $Date: 2008-05-27 12:17:26 -0700 (Tue, 27 May 2008) $
- * $Rev: 5700 $
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
  */
  */
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1c.4I,3n$=1c.$;J D=1c.4I=1c.$=H(a,b){I 2r D.18.5i(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,61=/^.[^:#\\[\\.]*$/,12;D.18=D.3V={5i:H(d,b){d=d||S;G(d.15){7[0]=d;7.K=1;I 7}G(1j d=="1W"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.60(c[3]);G(a){G(a.2t!=c[3])I D().2u(d);I D(a)}d=[]}}N I D(b).2u(d)}N G(D.1F(d))I D(S)[D.18.25?"25":"3Y"](d);I 7.6V(D.2h(d))},5w:"1.2.6",8H:H(){I 7.K},K:0,3p:H(a){I a==12?D.2h(7):7[a]},2F:H(b){J a=D(b);a.5n=7;I a},6V:H(a){7.K=0;2q.3V.1A.1t(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5h:H(b){J a=-1;I D.2E(b&&b.5w?b[0]:b,7)},1M:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1M"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1k d)D.1M(b?7.V:7,c,D.1e(7,d[c],b,i,c))})},1h:H(b,a){G((b==\'2d\'||b==\'1T\')&&3e(a)<0)a=12;I 7.1M(b,a,"24")},1r:H(b){G(1j b!="3y"&&b!=U)I 7.4F().3s((7[0]&&7[0].2z||S).5J(b));J a="";D.P(b||7,H(){D.P(7.3u,H(){G(7.15!=8)a+=7.15!=1?7.73:D.18.1r([7])})});I a},5W:H(b){G(7[0])D(b,7[0].2z).5y().38(7[0]).2i(H(){J a=7;1G(a.1s)a=a.1s;I a}).3s(7);I 7},8Z:H(a){I 7.P(H(){D(7).6P().5W(a)})},8S:H(a){I 7.P(H(){D(7).5W(a)})},3s:H(){I 7.3S(1a,M,Q,H(a){G(7.15==1)7.49(a)})},6E:H(){I 7.3S(1a,M,M,H(a){G(7.15==1)7.38(a,7.1s)})},6D:H(){I 7.3S(1a,Q,Q,H(a){7.1f.38(a,7)})},5p:H(){I 7.3S(1a,Q,M,H(a){7.1f.38(a,7.2J)})},3m:H(){I 7.5n||D([])},2u:H(b){J c=D.2i(7,H(a){I D.2u(b,a)});I 7.2F(/[^+>] [^+>]/.11(b)||b.1i("..")>-1?D.4u(c):c)},5y:H(e){J f=7.2i(H(){G(D.14.1g&&!D.4o(7)){J a=7.6n(M),5f=S.3t("1w");5f.49(a);I D.4h([5f.4l])[0]}N I 7.6n(M)});J d=f.2u("*").5M().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2u("*").5M().P(H(i){G(7.15==3)I;J c=D.L(7,"3x");R(J a 1k c)R(J b 1k c[a])D.W.17(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2F(D.1F(b)&&D.3G(7,H(a,i){I b.1l(a,i)})||D.3f(b,7))},4W:H(b){G(b.1q==56)G(61.11(b))I 7.2F(D.3f(b,7,M));N b=D.3f(b,7);J a=b.K&&b[b.K-1]!==12&&!b.15;I 7.1E(H(){I a?D.2E(7,b)<0:7!=b})},17:H(a){I 7.2F(D.4u(D.39(7.3p(),1j a==\'1W\'?D(a):D.2h(a))))},3C:H(a){I!!a&&D.3f(a,7).K>0},7V:H(a){I 7.3C("."+a)},6a:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2y")){J e=c.63,62=[],16=c.16,2Y=c.O=="2y-2Y";G(e<0)I U;R(J i=2Y?e:0,2e=2Y?e+1:16.K;i<2e;i++){J d=16[i];G(d.3a){b=D.14.1g&&!d.au.2s.aq?d.1r:d.2s;G(2Y)I b;62.1A(b)}}I 62}N I(7[0].2s||"").1o(/\\r/g,"")}I 12}G(b.1q==4N)b+=\'\';I 7.P(H(){G(7.15!=1)I;G(b.1q==2q&&/5R|5A/.11(7.O))7.4M=(D.2E(7.2s,b)>=0||D.2E(7.32,b)>=0);N G(D.Y(7,"2y")){J a=D.2h(b);D("9U",7).P(H(){7.3a=(D.2E(7.2s,a)>=0||D.2E(7.1r,a)>=0)});G(!a.K)7.63=-1}N 7.2s=b})},2I:H(a){I a==12?(7[0]?7[0].4l:U):7.4F().3s(a)},7b:H(a){I 7.5p(a).1Z()},77:H(i){I 7.3w(i,i+1)},3w:H(){I 7.2F(2q.3V.3w.1t(7,1a))},2i:H(b){I 7.2F(D.2i(7,H(a,i){I b.1l(a,i,a)}))},5M:H(){I 7.17(7.5n)},L:H(d,b){J a=d.1Q(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5G("9B"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1R("9v"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3S:H(g,f,h,d){J e=7.K>1,3z;I 7.P(H(){G(!3z){3z=D.4h(g,7.2z);G(h)3z.9o()}J b=7;G(f&&D.Y(7,"1X")&&D.Y(3z[0],"4H"))b=7.40("22")[0]||7.49(7.2z.3t("22"));J c=D([]);D.P(3z,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.17(a);N{G(a.15==1)c=c.17(D("1m",a).1Z());d.1l(b,a)}});c.P(6R)})}};D.18.5i.3V=D.18;H 6R(i,a){G(a.4e)D.3T({1b:a.4e,31:Q,1L:"1m"});N D.5u(a.1r||a.6N||a.4l||"");G(a.1f)a.1f.30(a)}H 1x(){I+2r 8K}D.1n=D.18.1n=H(){J b=1a[0]||{},i=1,K=1a.K,4B=Q,16;G(b.1q==8I){4B=b;b=1a[1]||{};i=2}G(1j b!="3y"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((16=1a[i])!=U)R(J c 1k 16){J a=b[c],2x=16[c];G(b===2x)6L;G(4B&&2x&&1j 2x=="3y"&&!2x.15)b[c]=D.1n(4B,a||(2x.K!=U?[]:{}),2x);N G(2x!==12)b[c]=2x}I b};J E="4I"+1x(),6K=0,5q={},6G=/z-?5h|8B-?8A|1y|6A|8w-?1T/i,3N=S.3N||{};D.1n({8u:H(a){1c.$=3n$;G(a)1c.4I=w;I D},1F:H(a){I!!a&&1j a!="1W"&&!a.Y&&a.1q!=2q&&/^[\\s[]?H/.11(a+"")},4o:H(a){I a.1B&&!a.1d||a.2g&&a.2z&&!a.2z.1d},5u:H(a){a=D.3l(a);G(a){J b=S.40("6v")[0]||S.1B,1m=S.3t("1m");1m.O="1r/4v";G(D.14.1g)1m.1r=a;N 1m.49(S.5J(a));b.38(1m,b.1s);b.30(1m)}},Y:H(b,a){I b.Y&&b.Y.2m()==a.2m()},1Y:{},L:H(c,d,b){c=c==1c?5q:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1c?5q:c;J a=c[E];G(b){G(D.1Y[a]){3d D.1Y[a][b];b="";R(b 1k D.1Y[a])1V;G(!b)D.3b(c)}}N{23{3d c[E]}21(e){G(c.5k)c.5k(E)}3d D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1k d)G(a.1t(d[e],c)===Q)1V}N R(;i<K;)G(a.1t(d[i++],c)===Q)1V}N{G(K==12){R(e 1k d)G(a.1l(d[e],e,d[e])===Q)1V}N R(J b=d[0];i<K&&a.1l(b,i,b)!==Q;b=d[++i]){}}I d},1e:H(b,a,c,i,d){G(D.1F(a))a=a.1l(b,i);I a&&a.1q==4N&&c=="24"&&!6G.11(d)?a+"2U":a},1D:{17:H(c,b){D.P((b||"").1Q(/\\s+/),H(i,a){G(c.15==1&&!D.1D.3Q(c.1D,a))c.1D+=(c.1D?" ":"")+a})},1Z:H(c,b){G(c.15==1)c.1D=b!=12?D.3G(c.1D.1Q(/\\s+/),H(a){I!D.1D.3Q(b,a)}).6r(" "):""},3Q:H(b,a){I D.2E(a,(b.1D||b).6p().1Q(/\\s+/))>-1}},6o:H(b,c,a){J e={};R(J d 1k c){e[d]=b.V[d];b.V[d]=c[d]}a.1l(b);R(J d 1k c)b.V[d]=e[d]},1h:H(d,e,c){G(e=="2d"||e=="1T"){J b,2L={3c:"5g",5D:"1C",19:"3H"},2S=e=="2d"?["5d","6i"]:["5b","6g"];H 5a(){b=e=="2d"?d.8g:d.8f;J a=0,2A=0;D.P(2S,H(){a+=3e(D.24(d,"55"+7,M))||0;2A+=3e(D.24(d,"2A"+7+"47",M))||0});b-=26.85(a+2A)}G(D(d).3C(":4i"))5a();N D.6o(d,2L,5a);I 26.2e(0,b)}I D.24(d,e,c)},24:H(f,l,k){J e,V=f.V;H 4d(b){G(!D.14.2f)I Q;J a=3N.53(b,U);I!a||a.52("4d")==""}G(l=="1y"&&D.14.1g){e=D.1M(V,"1y");I e==""?"1":e}G(D.14.2H&&l=="19"){J d=V.50;V.50="0 7Z 7Y";V.50=d}G(l.1I(/4g/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3N.53){G(l.1I(/4g/i))l="4g";l=l.1o(/([A-Z])/g,"-$1").3h();J c=3N.53(f,U);G(c&&!4d(f))e=c.52(l);N{J g=[],2G=[],a=f,i=0;R(;a&&4d(a);a=a.1f)2G.6b(a);R(;i<2G.K;i++)G(4d(2G[i])){g[i]=2G[i].V.19;2G[i].V.19="3H"}e=l=="19"&&g[2G.K-1]!=U?"2P":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2G[i].V.19=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4f){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2m()});e=f.4f[l]||f.4f[h];G(!/^\\d+(2U)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1z,65=f.64.1z;f.64.1z=f.4f.1z;V.1z=e||0;e=V.aO+"2U";V.1z=j;f.64.1z=65}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3t==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4N)d+=\'\';G(1j d=="1W"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aN|43|7E|aH|4t|7z|aE|3A|aB|aA|az)$/i)?b:a+"></"+c+">"});J f=D.3l(d).3h(),1w=h.3t("1w");J e=!f.1i("<av")&&[1,"<2y 7u=\'7u\'>","</2y>"]||!f.1i("<at")&&[1,"<7t>","</7t>"]||f.1I(/^<(ar|22|ap|al|aj)/)&&[1,"<1X>","</1X>"]||!f.1i("<4H")&&[2,"<1X><22>","</22></1X>"]||(!f.1i("<ah")||!f.1i("<ae"))&&[3,"<1X><22><4H>","</4H></22></1X>"]||!f.1i("<7E")&&[2,"<1X><22></22><7p>","</7p></1X>"]||D.14.1g&&[1,"1w<1w>","</1w>"]||[0,"",""];1w.4l=e[1]+d+e[2];1G(e[0]--)1w=1w.5U;G(D.14.1g){J g=!f.1i("<1X")&&f.1i("<22")<0?1w.1s&&1w.1s.3u:e[1]=="<1X>"&&f.1i("<22")<0?1w.3u:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3u.K)g[j].1f.30(g[j]);G(/^\\s/.11(d))1w.38(h.5J(d.1I(/^\\s*/)[0]),1w.1s)}d=D.2h(1w.3u)}G(d.K===0&&(!D.Y(d,"45")&&!D.Y(d,"2y")))I;G(d[0]==12||D.Y(d,"45")||d.16)k.1A(d);N k=D.39(k,d)});I k},1M:H(d,f,c){G(!d||d.15==3||d.15==8)I 12;J e=!D.4o(d),3W=c!==12,1g=D.14.1g;f=e&&D.2L[f]||f;G(d.2g){J g=/5x|4e|V/.11(f);G(f=="3a"&&D.14.2f)d.1f.63;G(f 1k d&&e&&!g){G(3W){G(f=="O"&&D.Y(d,"4t")&&d.1f)7m"O a5 a2\'t 9Z 9W";d[f]=c}G(D.Y(d,"45")&&d.7i(f))I d.7i(f).73;I d[f]}G(1g&&e&&f=="V")I D.1M(d.V,"9V",c);G(3W)d.9T(f,""+c);J h=1g&&e&&g?d.4K(f,2):d.4K(f);I h===U?12:h}G(1g&&f=="1y"){G(3W){d.6A=1;d.1E=(d.1E||"").1o(/7d\\([^)]*\\)/,"")+(3v(c)+\'\'=="9P"?"":"7d(1y="+c*79+")")}I d.1E&&d.1E.1i("1y=")>=0?(3e(d.1E.1I(/1y=([^)]*)/)[1])/79)+\'\':""}f=f.1o(/-([a-z])/9M,H(a,b){I b.2m()});G(3W)d[f]=c;I d[f]},3l:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2h:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1Q||b.4L||b.1l)a[0]=b;N 1G(i)a[--i]=b[i]}I a},2E:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},39:H(a,b){J i=0,T,36=a.K;G(D.14.1g){1G(T=b[i++])G(T.15!=8)a[36++]=T}N 1G(T=b[i++])a[36++]=T;I a},4u:H(a){J c=[],2w={};23{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2w[b]){2w[b]=M;c.1A(a[i])}}}21(e){c=a}I c},3G:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1A(c[i]);I b},2i:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.75.1t([],c)}});J v=9E.9C.3h();D.14={5F:(v.1I(/.+(?:9A|9z|9y|9w)[\\/: ]([\\d.]+)/)||[])[1],2f:/72/.11(v),2H:/2H/.11(v),1g:/1g/.11(v)&&!/2H/.11(v),3r:/3r/.11(v)&&!/(9s|72)/.11(v)};J y=D.14.1g?"70":"6Z";D.1n({6Y:!D.14.1g||S.6X=="6W",2L:{"R":"9n","9m":"1D","4g":y,6Z:y,70:y,9j:"9h",9g:"9e",9d:"9b",9a:"99"}});D.P({6S:H(a){I a.1f},96:H(a){I D.4T(a,"1f")},93:H(a){I D.2V(a,2,"2J")},90:H(a){I D.2V(a,2,"4D")},8Y:H(a){I D.4T(a,"2J")},8X:H(a){I D.4T(a,"4D")},8W:H(a){I D.5v(a.1f.1s,a)},8V:H(a){I D.5v(a.1s)},6P:H(a){I D.Y(a,"8U")?a.8T||a.8R.S:D.2h(a.3u)}},H(c,d){D.18[c]=H(b){J a=D.2i(7,d);G(b&&1j b=="1W")a=D.3f(b,a);I 7.2F(D.4u(a))}});D.P({6O:"3s",8Q:"6E",38:"6D",8P:"5p",8O:"7b"},H(c,b){D.18[c]=H(){J a=1a;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1M(7,a,"");G(7.15==1)7.5k(a)},8M:H(a){D.1D.17(7,a)},8L:H(a){D.1D.1Z(7,a)},8J:H(a){D.1D[D.1D.3Q(7,a)?"1Z":"17"](7,a)},1Z:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).17(7).P(H(){D.W.1Z(7);D.3b(7)});G(7.1f)7.1f.30(7)}},4F:H(){D(">*",7).1Z();1G(7.1s)7.30(7.1s)}},H(a,b){D.18[a]=H(){I 7.P(b,1a)}});D.P(["6M","47"],H(i,c){J b=c.3h();D.18[b]=H(a){I 7[0]==1c?D.14.2H&&S.1d["5t"+c]||D.14.2f&&1c["5s"+c]||S.6X=="6W"&&S.1B["5t"+c]||S.1d["5t"+c]:7[0]==S?26.2e(26.2e(S.1d["4A"+c],S.1B["4A"+c]),26.2e(S.1d["2k"+c],S.1B["2k"+c])):a==12?(7.K?D.1h(7[0],b):U):7.1h(b,a.1q==56?a:a+"2U")}});H 2a(a,b){I a[0]&&3v(D.24(a[0],b,M),10)||0}J C=D.14.2f&&3v(D.14.5F)<8G?"(?:[\\\\w*3n-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3n-]|\\\\\\\\.)",6J=2r 4y("^>\\\\s*("+C+"+)"),6I=2r 4y("^("+C+"+)(#)("+C+"+)"),6H=2r 4y("^([#.]?)("+C+"*)");D.1n({6F:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4K("2t")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},2V:H(a,i,m){I m[3]-0==i},77:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3P:H(a,i,m,r){I i==r.K-1},6C:H(a,i){I i%2==0},6B:H(a,i){I i%2},"3o-4w":H(a){I a.1f.40("*")[0]==a},"3P-4w":H(a){I D.2V(a.1f.5U,1,"4D")==a},"8z-4w":H(a){I!D.2V(a.1f.5U,2,"4D")},6S:H(a){I a.1s},4F:H(a){I!a.1s},8y:H(a,i,m){I(a.6N||a.8x||D(a).1r()||"").1i(m[3])>=0},4i:H(a){I"1C"!=a.O&&D.1h(a,"19")!="2P"&&D.1h(a,"5D")!="1C"},1C:H(a){I"1C"==a.O||D.1h(a,"19")=="2P"||D.1h(a,"5D")=="1C"},8v:H(a){I!a.3O},3O:H(a){I a.3O},4M:H(a){I a.4M},3a:H(a){I a.3a||D.1M(a,"3a")},1r:H(a){I"1r"==a.O},5R:H(a){I"5R"==a.O},5A:H(a){I"5A"==a.O},5o:H(a){I"5o"==a.O},3K:H(a){I"3K"==a.O},5m:H(a){I"5m"==a.O},6z:H(a){I"6z"==a.O},6y:H(a){I"6y"==a.O},2p:H(a){I"2p"==a.O||D.Y(a,"2p")},4t:H(a){I/4t|2y|6x|2p/i.11(a.Y)},3Q:H(a,i,m){I D.2u(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3G(D.3M,H(b){I a==b.T}).K}}},6w:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2r 4y("^([:.#]*)("+C+"+)")],3f:H(a,c,b){J d,1u=[];1G(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1u=b?c=f.r:D.39(1u,f.r)}I 1u},2u:H(t,o){G(1j t!="1W")I[t];G(o&&o.15!=1&&o.15!=9)I[];o=o||S;J d=[o],2w=[],3P,Y;1G(t&&3P!=t){J r=[];3P=t;t=D.3l(t);J l=Q,3k=6J,m=3k.2D(t);G(m){Y=m[1].2m();R(J i=0;d[i];i++)R(J c=d[i].1s;c;c=c.2J)G(c.15==1&&(Y=="*"||c.Y.2m()==Y))r.1A(c);d=r;t=t.1o(3k,"");G(t.1i(" ")==0)6L;l=M}N{3k=/^([>+~])\\s*(\\w*)/i;G((m=3k.2D(t))!=U){r=[];J k={};Y=m[2].2m();m=m[1];R(J j=0,3j=d.K;j<3j;j++){J n=m=="~"||m=="+"?d[j].2J:d[j].1s;R(;n;n=n.2J)G(n.15==1){J g=D.L(n);G(m=="~"&&k[g])1V;G(!Y||n.Y.2m()==Y){G(m=="~")k[g]=M;r.1A(n)}G(m=="+")1V}}d=r;t=D.3l(t.1o(3k,""));l=M}}G(t&&!l){G(!t.1i(",")){G(o==d[0])d.4s();2w=D.39(2w,d);r=d=[o];t=" "+t.6t(1,t.K)}N{J h=6I;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6H;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.60&&!D.4o(f)){J p=f.60(m[2]);G((D.14.1g||D.14.2H)&&p&&1j p.2t=="1W"&&p.2t!=m[2])p=D(\'[@2t="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3h()=="3y")a="3A";r=D.39(r,d[i].40(a))}G(m[1]==".")r=D.5l(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4K("2t")==m[2]){e=[r[i]];1V}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3l(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2w=D.39(2w,d);I 2w},5l:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1D+" ").1i(m)>=0;G(!a&&b||a&&!b)c.1A(r[i])}I c},1E:H(t,r,h){J d;1G(t&&t!=d){d=t;J p=D.6w,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1V}}G(!m)1V;G(m[1]==":"&&m[2]=="4W")r=61.11(m[3])?D.1E(m[3],r,M).r:D(r).4W(m[3]);N G(m[1]==".")r=D.5l(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3j=r.K;i<3j;i++){J a=r[i],z=a[D.2L[m[2]]||m[2]];G(z==U||/5x|4e|3a/.11(m[2]))z=D.1M(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1i(m[5])||O=="$="&&z.6t(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1i(m[5])>=0)^h)g.1A(a)}r=g}N G(m[1]==":"&&m[2]=="2V-4w"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6C"&&"2n"||m[3]=="6B"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3j=r.K;i<3j;i++){J j=r[i],1f=j.1f,2t=D.L(1f);G(!e[2t]){J c=1;R(J n=1f.1s;n;n=n.2J)G(n.15==1)n.4r=c++;e[2t]=M}J b=Q;G(3o==0){G(j.4r==d)b=M}N G((j.4r-d)%3o==0&&(j.4r-d)/3o>=0)b=M;G(b^h)g.1A(j)}r=g}N{J f=D.6F[m[1]];G(1j f=="3y")f=f[m[2]];G(1j f=="1W")f=6s("Q||H(a,i){I "+f+";}");r=D.3G(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4T:H(b,c){J a=[],1u=b[c];1G(1u&&1u!=S){G(1u.15==1)a.1A(1u);1u=1u[c]}I a},2V:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.15==1&&++d==e)1V;I a},5v:H(n,a){J r=[];R(;n;n=n.2J){G(n.15==1&&n!=a)r.1A(n)}I r}});D.W={17:H(f,i,g,e){G(f.15==3||f.15==8)I;G(D.14.1g&&f.4L)f=1c;G(!g.29)g.29=7.29++;G(e!=12){J h=g;g=7.3J(h,H(){I h.1t(7,1a)});g.L=e}J j=D.L(f,"3x")||D.L(f,"3x",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5j)I D.W.1H.1t(1a.3I.T,1a)});1H.T=f;D.P(i.1Q(/\\s+/),H(c,b){J a=b.1Q(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2C[b]||D.W.2C[b].4q.1l(f)===Q){G(f.4a)f.4a(b,1H,Q);N G(f.6q)f.6q("4p"+b,1H)}}d[g.29]=g;D.W.28[b]=M});f=U},29:1,28:{},1Z:H(e,h,f){G(e.15==3||e.15==8)I;J i=D.L(e,"3x"),1K,5h;G(i){G(h==12||(1j h=="1W"&&h.8p(0)=="."))R(J g 1k i)7.1Z(e,g+(h||""));N{G(h.O){f=h.2o;h=h.O}D.P(h.1Q(/\\s+/),H(b,a){J c=a.1Q(".");a=c[0];G(i[a]){G(f)3d i[a][f.29];N R(f 1k i[a])G(!c[1]||i[a][f].O==c[1])3d i[a][f];R(1K 1k i[a])1V;G(!1K){G(!D.W.2C[a]||D.W.2C[a].4G.1l(e)===Q){G(e.6m)e.6m(a,D.L(e,"1H"),Q);N G(e.6l)e.6l("4p"+a,D.L(e,"1H"))}1K=U;3d i[a]}}})}R(1K 1k i)1V;G(!1K){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3x");D.3b(e,"1H")}}},1R:H(h,c,f,g,i){c=D.2h(c);G(h.1i("!")>=0){h=h.3w(0,-1);J a=M}G(!f){G(7.28[h])D("*").17([1c,S]).1R(h,c)}N{G(f.15==3||f.15==8)I 12;J b,1K,18=D.1F(f[h]||U),W=!c[0]||!c[0].37;G(W){c.6b({O:h,2N:f,37:H(){},3X:H(){},4J:1x()});c[0][E]=M}c[0].O=h;G(a)c[0].6k=M;J d=D.L(f,"1H");G(d)b=d.1t(f,c);G((!18||(D.Y(f,\'a\')&&h=="4n"))&&f["4p"+h]&&f["4p"+h].1t(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1F(i)){1K=i.1t(f,b==U?c:c.75(b));G(1K!==12)b=1K}G(18&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4n")){7.5j=M;23{f[h]()}21(e){}}7.5j=Q}I b},1H:H(b){J a,1K,2T,5e,4m;b=1a[0]=D.W.6j(b||1c.W);2T=b.O.1Q(".");b.O=2T[0];2T=2T[1];5e=!2T&&!b.6k;4m=(D.L(7,"3x")||{})[b.O];R(J j 1k 4m){J c=4m[j];G(5e||c.O==2T){b.2o=c;b.L=c.L;1K=c.1t(7,1a);G(a!==Q)a=1K;G(1K===Q){b.37();b.3X()}}}I a},2L:"8o 8n 8m 8l 2p 8k 42 5c 6h 5I 8j L 8i 8h 4k 2o 59 58 8e 8c 57 6f 8b 8a 4j 88 87 86 6d 2N 4J 6c O 84 83 2S".1Q(" "),6j:H(b){G(b[E]==M)I b;J c=b;b={82:c};R(J i=7.2L.K,1e;i;){1e=7.2L[--i];b[1e]=c[1e]}b[E]=M;b.37=H(){G(c.37)c.37();c.81=Q};b.3X=H(){G(c.3X)c.3X();c.80=M};b.4J=b.4J||1x();G(!b.2N)b.2N=b.6d||S;G(b.2N.15==3)b.2N=b.2N.1f;G(!b.4j&&b.4k)b.4j=b.4k==b.2N?b.6c:b.4k;G(b.57==U&&b.5c!=U){J a=S.1B,1d=S.1d;b.57=b.5c+(a&&a.2c||1d&&1d.2c||0)-(a.69||0);b.6f=b.6h+(a&&a.2l||1d&&1d.2l||0)-(a.68||0)}G(!b.2S&&((b.42||b.42===0)?b.42:b.59))b.2S=b.42||b.59;G(!b.58&&b.5I)b.58=b.5I;G(!b.2S&&b.2p)b.2S=(b.2p&1?1:(b.2p&2?3:(b.2p&4?2:0)));I b},3J:H(a,b){b.29=a.29=a.29||b.29||7.29++;I b},2C:{25:{4q:H(){54();I},4G:H(){I}},4c:{4q:H(){G(D.14.1g)I Q;D(7).2O("51",D.W.2C.4c.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("51",D.W.2C.4c.2o);I M},2o:H(a){G(F(a,7))I M;a.O="4c";I D.W.1H.1t(7,1a)}},3F:{4q:H(){G(D.14.1g)I Q;D(7).2O("4Z",D.W.2C.3F.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("4Z",D.W.2C.3F.2o);I M},2o:H(a){G(F(a,7))I M;a.O="3F";I D.W.1H.1t(7,1a)}}}};D.18.1n({2O:H(c,a,b){I c=="4Y"?7.2Y(c,a,b):7.P(H(){D.W.17(7,c,b||a,b&&a)})},2Y:H(d,b,c){J e=D.W.3J(c||b,H(a){D(7).3L(a,e);I(c||b).1t(7,1a)});I 7.P(H(){D.W.17(7,d,e,c&&b)})},3L:H(a,b){I 7.P(H(){D.W.1Z(7,a,b)})},1R:H(c,a,b){I 7.P(H(){D.W.1R(c,a,7,M,b)})},5G:H(c,a,b){I 7[0]&&D.W.1R(c,a,7[0],Q,b)},2B:H(b){J c=1a,i=1;1G(i<c.K)D.W.3J(b,c[i++]);I 7.4n(D.W.3J(b,H(a){7.4X=(7.4X||0)%i;a.37();I c[7.4X++].1t(7,1a)||Q}))},7X:H(a,b){I 7.2O(\'4c\',a).2O(\'3F\',b)},25:H(a){54();G(D.2Q)a.1l(S,D);N D.3D.1A(H(){I a.1l(7,D)});I 7}});D.1n({2Q:Q,3D:[],25:H(){G(!D.2Q){D.2Q=M;G(D.3D){D.P(D.3D,H(){7.1l(S)});D.3D=U}D(S).5G("25")}}});J x=Q;H 54(){G(x)I;x=M;G(S.4a&&!D.14.2H)S.4a("67",D.25,Q);G(D.14.1g&&1c==1P)(H(){G(D.2Q)I;23{S.1B.7W("1z")}21(3g){3E(1a.3I,0);I}D.25()})();G(D.14.2H)S.4a("67",H(){G(D.2Q)I;R(J i=0;i<S.4V.K;i++)G(S.4V[i].3O){3E(1a.3I,0);I}D.25()},Q);G(D.14.2f){J a;(H(){G(D.2Q)I;G(S.3i!="66"&&S.3i!="1O"){3E(1a.3I,0);I}G(a===12)a=D("V, 7z[7U=7T]").K;G(S.4V.K!=a){3E(1a.3I,0);I}D.25()})()}D.W.17(1c,"3Y",D.25)}D.P(("7S,7R,3Y,7Q,4A,4Y,4n,7P,"+"89,7O,7N,51,4Z,7M,2y,"+"5m,8d,7L,7K,3g").1Q(","),H(i,b){D.18[b]=H(a){I a?7.2O(b,a):7.1R(b)}});J F=H(a,c){J b=a.4j;1G(b&&b!=c)23{b=b.1f}21(3g){b=c}I b==c};D(1c).2O("4Y",H(){D("*").17(S).3L()});D.18.1n({6e:D.18.3Y,3Y:H(g,d,c){G(1j g!=\'1W\')I 7.6e(g);J e=g.1i(" ");G(e>=0){J i=g.3w(e,g.K);g=g.3w(0,e)}c=c||H(){};J f="2R";G(d)G(D.1F(d)){c=d;d=U}N G(1j d==\'3y\'){d=D.3A(d);f="7J"}J h=7;D.3T({1b:g,O:f,1L:"2I",L:d,1O:H(a,b){G(b=="1U"||b=="7I")h.2I(i?D("<1w/>").3s(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2u(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3A(7.7H())},7H:H(){I 7.2i(H(){I D.Y(7,"45")?D.2h(7.aK):7}).1E(H(){I 7.32&&!7.3O&&(7.4M||/2y|6x/i.11(7.Y)||/1r|1C|3K/i.11(7.O))}).2i(H(i,c){J b=D(7).6a();I b==U?U:b.1q==2q?D.2i(b,H(a,i){I{32:c.32,2s:a}}):{32:c.32,2s:b}}).3p()}});D.P("7G,7D,7C,7B,6u,7A".1Q(","),H(i,o){D.18[o]=H(f){I 7.2O(o,f)}});J B=1x();D.1n({3p:H(d,b,a,c){G(D.1F(b)){a=b;b=U}I D.3T({O:"2R",1b:d,L:b,1U:a,1L:c})},aG:H(b,a){I D.3p(b,U,a,"1m")},aF:H(c,b,a){I D.3p(c,b,a,"3B")},aD:H(d,b,a,c){G(D.1F(b)){a=b;b={}}I D.3T({O:"7J",1b:d,L:b,1U:a,1L:c})},aC:H(a){D.1n(D.5Z,a)},5Z:{1b:5Y.5x,28:M,O:"2R",2W:0,7y:"4x/x-ay-45-ax",7v:M,31:M,L:U,5r:U,3K:U,4z:{2K:"4x/2K, 1r/2K",2I:"1r/2I",1m:"1r/4v, 4x/4v",3B:"4x/3B, 1r/4v",1r:"1r/as",4S:"*/*"}},4R:{},3T:H(s){s=D.1n(M,s,D.1n(M,{},D.5Z,s));J g,33=/=\\?(&|$)/g,1v,L,O=s.O.2m();G(s.L&&s.7v&&1j s.L!="1W")s.L=D.3A(s.L);G(s.1L=="4Q"){G(O=="2R"){G(!s.1b.1I(33))s.1b+=(s.1b.1I(/\\?/)?"&":"?")+(s.4Q||"7s")+"=?"}N G(!s.L||!s.L.1I(33))s.L=(s.L?s.L+"&":"")+(s.4Q||"7s")+"=?";s.1L="3B"}G(s.1L=="3B"&&(s.L&&s.L.1I(33)||s.1b.1I(33))){g="4Q"+B++;G(s.L)s.L=(s.L+"").1o(33,"="+g+"$1");s.1b=s.1b.1o(33,"="+g+"$1");s.1L="1m";1c[g]=H(a){L=a;1U();1O();1c[g]=12;23{3d 1c[g]}21(e){}G(i)i.30(h)}}G(s.1L=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2R"){J j=1x();J k=s.1b.1o(/(\\?|&)3n=.*?(&|$)/,"$am="+j+"$2");s.1b=k+((k==s.1b)?(s.1b.1I(/\\?/)?"&":"?")+"3n="+j:"")}G(s.L&&O=="2R"){s.1b+=(s.1b.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.28&&!D.4P++)D.W.1R("7G");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1L=="1m"&&O=="2R"&&n.11(s.1b)&&n.2D(s.1b)[1]!=5Y.ak){J i=S.40("6v")[0];J h=S.3t("1m");h.4e=s.1b;G(s.7r)h.ai=s.7r;G(!g){J l=Q;h.ag=h.af=H(){G(!l&&(!7.3i||7.3i=="66"||7.3i=="1O")){l=M;1U();1O();i.30(h)}}}i.49(h);I 12}J m=Q;J c=1c.7q?2r 7q("ad.ac"):2r 6Q();G(s.5r)c.7o(O,s.1b,s.31,s.5r,s.3K);N c.7o(O,s.1b,s.31);23{G(s.L)c.4O("ab-aa",s.7y);G(s.5T)c.4O("a9-5S-a8",D.4R[s.1b]||"a7, a6 a4 a3 5O:5O:5O a1");c.4O("X-a0-9Y","6Q");c.4O("9X",s.1L&&s.4z[s.1L]?s.4z[s.1L]+", */*":s.4z.4S)}21(e){}G(s.7k&&s.7k(c,s)===Q){s.28&&D.4P--;c.7j();I Q}G(s.28)D.W.1R("7A",[c,s]);J d=H(a){G(!m&&c&&(c.3i==4||a=="2W")){m=M;G(f){7h(f);f=U}1v=a=="2W"?"2W":!D.7g(c)?"3g":s.5T&&D.7f(c,s.1b)?"7I":"1U";G(1v=="1U"){23{L=D.6U(c,s.1L,s.9S)}21(e){1v="5L"}}G(1v=="1U"){J b;23{b=c.5K("7e-5S")}21(e){}G(s.5T&&b)D.4R[s.1b]=b;G(!g)1U()}N D.5E(s,c,1v);1O();G(s.31)c=U}};G(s.31){J f=4L(d,13);G(s.2W>0)3E(H(){G(c){c.7j();G(!m)d("2W")}},s.2W)}23{c.9R(s.L)}21(e){D.5E(s,c,U,e)}G(!s.31)d();H 1U(){G(s.1U)s.1U(L,1v);G(s.28)D.W.1R("6u",[c,s])}H 1O(){G(s.1O)s.1O(c,1v);G(s.28)D.W.1R("7C",[c,s]);G(s.28&&!--D.4P)D.W.1R("7D")}I c},5E:H(s,a,b,e){G(s.3g)s.3g(a,b,e);G(s.28)D.W.1R("7B",[a,s,e])},4P:0,7g:H(a){23{I!a.1v&&5Y.9Q=="5o:"||(a.1v>=7c&&a.1v<9O)||a.1v==7a||a.1v==9N||D.14.2f&&a.1v==12}21(e){}I Q},7f:H(a,c){23{J b=a.5K("7e-5S");I a.1v==7a||b==D.4R[c]||D.14.2f&&a.1v==12}21(e){}I Q},6U:H(a,c,b){J d=a.5K("9L-O"),2K=c=="2K"||!c&&d&&d.1i("2K")>=0,L=2K?a.9K:a.4U;G(2K&&L.1B.2g=="5L")7m"5L";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3B")L=6s("("+L+")");I L},3A:H(a){J s=[];H 17(b,a){s[s.K]=78(b)+\'=\'+78(a)};G(a.1q==2q||a.5w)D.P(a,H(){17(7.32,7.2s)});N R(J j 1k a)G(a[j]&&a[j].1q==2q)D.P(a[j],H(){17(j,7)});N 17(j,D.1F(a[j])?a[j]():a[j]);I s.6r("&").1o(/%20/g,"+")}});D.18.1n({1N:H(c,b){I c?7.2j({1T:"1N",2d:"1N",1y:"1N"},c,b):7.1E(":1C").P(H(){7.V.19=7.5H||"";G(D.1h(7,"19")=="2P"){J a=D("<"+7.2g+" />").6O("1d");7.V.19=a.1h("19");G(7.V.19=="2P")7.V.19="3H";a.1Z()}}).3m()},1J:H(b,a){I b?7.2j({1T:"1J",2d:"1J",1y:"1J"},b,a):7.1E(":4i").P(H(){7.5H=7.5H||D.1h(7,"19");7.V.19="2P"}).3m()},76:D.18.2B,2B:H(a,b){I D.1F(a)&&D.1F(b)?7.76.1t(7,1a):a?7.2j({1T:"2B",2d:"2B",1y:"2B"},a,b):7.P(H(){D(7)[D(7).3C(":1C")?"1N":"1J"]()})},9J:H(b,a){I 7.2j({1T:"1N"},b,a)},9I:H(b,a){I 7.2j({1T:"1J"},b,a)},9H:H(b,a){I 7.2j({1T:"2B"},b,a)},9G:H(b,a){I 7.2j({1y:"1N"},b,a)},9F:H(b,a){I 7.2j({1y:"1J"},b,a)},9D:H(c,a,b){I 7.2j({1y:a},c,b)},2j:H(k,j,i,g){J h=D.74(j,i,g);I 7[h.35===Q?"P":"35"](H(){G(7.15!=1)I Q;J f=D.1n({},h),p,1C=D(7).3C(":1C"),41=7;R(p 1k k){G(k[p]=="1J"&&1C||k[p]=="1N"&&!1C)I f.1O.1l(7);G(p=="1T"||p=="2d"){f.19=D.1h(7,"19");f.34=7.V.34}}G(f.34!=U)7.V.34="1C";f.44=D.1n({},k);D.P(k,H(c,a){J e=2r D.27(41,f,c);G(/2B|1N|1J/.11(a))e[a=="2B"?1C?"1N":"1J":a](k);N{J b=a.6p().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1u(M)||0;G(b){J d=3e(b[2]),2M=b[3]||"2U";G(2M!="2U"){41.V[c]=(d||1)+2M;2b=((d||1)/e.1u(M))*2b;41.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3Z(2b,d,2M)}N e.3Z(2b,a,"")}});I M})},35:H(a,b){G(D.1F(a)||(a&&a.1q==2q)){b=a;a="27"}G(!a||(1j a=="1W"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2q)A(7,a,b);N{A(7,a).1A(b);G(A(7,a).K==1)b.1l(7)}})},9x:H(b,c){J a=D.3M;G(b)7.35([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7l(i,1)}});G(!c)7.5C();I 7}});J A=H(b,c,a){G(b){c=c||"27";J q=D.L(b,c+"35");G(!q||a)q=D.L(b,c+"35",D.2h(a))}I q};D.18.5C=H(a){a=a||"27";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1l(7)})};D.1n({74:H(b,a,c){J d=b&&b.1q==9u?b:{1O:c||!c&&a||D.1F(b)&&b,2v:b,3U:c&&a||a&&a.1q!=9t&&a};d.2v=(d.2v&&d.2v.1q==4N?d.2v:D.27.5N[d.2v])||D.27.5N.71;d.5P=d.1O;d.1O=H(){G(d.35!==Q)D(7).5C();G(D.1F(d.5P))d.5P.1l(7)};I d},3U:{7n:H(p,n,b,a){I b+a*p},5Q:H(p,n,b,a){I((-26.9r(p*26.9q)/2)+0.5)*a+b}},3M:[],46:U,27:H(b,c,a){7.16=c;7.T=b;7.1e=a;G(!c.3R)c.3R={}}});D.27.3V={4E:H(){G(7.16.2Z)7.16.2Z.1l(7.T,7.1x,7);(D.27.2Z[7.1e]||D.27.2Z.4S)(7);G(7.1e=="1T"||7.1e=="2d")7.T.V.19="3H"},1u:H(a){G(7.T[7.1e]!=U&&7.T.V[7.1e]==U)I 7.T[7.1e];J r=3e(D.1h(7.T,7.1e,a));I r&&r>-9p?r:3e(D.24(7.T,7.1e))||0},3Z:H(c,b,d){7.5B=1x();7.2b=c;7.3m=b;7.2M=d||7.2M||"2U";7.1x=7.2b;7.36=7.4C=0;7.4E();J e=7;H t(a){I e.2Z(a)}t.T=7.T;D.3M.1A(t);G(D.46==U){D.46=4L(H(){J a=D.3M;R(J i=0;i<a.K;i++)G(!a[i]())a.7l(i--,1);G(!a.K){7h(D.46);D.46=U}},13)}},1N:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1N=M;7.3Z(0,7.1u());G(7.1e=="2d"||7.1e=="1T")7.T.V[7.1e]="9l";D(7.T).1N()},1J:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1J=M;7.3Z(7.1u(),0)},2Z:H(a){J t=1x();G(a||t>7.16.2v+7.5B){7.1x=7.3m;7.36=7.4C=1;7.4E();7.16.44[7.1e]=M;J b=M;R(J i 1k 7.16.44)G(7.16.44[i]!==M)b=Q;G(b){G(7.16.19!=U){7.T.V.34=7.16.34;7.T.V.19=7.16.19;G(D.1h(7.T,"19")=="2P")7.T.V.19="3H"}G(7.16.1J)7.T.V.19="2P";G(7.16.1J||7.16.1N)R(J p 1k 7.16.44)D.1M(7.T.V,p,7.16.3R[p])}G(b)7.16.1O.1l(7.T);I Q}N{J n=t-7.5B;7.4C=n/7.16.2v;7.36=D.3U[7.16.3U||(D.3U.5Q?"5Q":"7n")](7.4C,n,0,1,7.16.2v);7.1x=7.2b+((7.3m-7.2b)*7.36);7.4E()}I M}};D.1n(D.27,{5N:{9k:9i,an:7c,71:ao},2Z:{2c:H(a){a.T.2c=a.1x},2l:H(a){a.T.2l=a.1x},1y:H(a){D.1M(a.T.V,"1y",a.1x)},4S:H(a){a.T.V[a.1e]=a.1x+a.2M}}});D.18.2k=H(){J b=0,1P=0,T=7[0],3q;G(T)9f(D.14){J d=T.1f,48=T,1p=T.1p,1S=T.2z,5V=2f&&3v(5F)<9c&&!/aw/i.11(v),1h=D.24,2X=1h(T,"3c")=="2X";G(!(3r&&T==S.1d)&&T.6T){J c=T.6T();17(c.1z+26.2e(1S.1B.2c,1S.1d.2c),c.1P+26.2e(1S.1B.2l,1S.1d.2l));17(-1S.1B.69,-1S.1B.68)}N{17(T.5X,T.5z);1G(1p){17(1p.5X,1p.5z);G(3r&&!/^t(98|d|h)$/i.11(1p.2g)||2f&&!5V)2A(1p);G(!2X&&1h(1p,"3c")=="2X")2X=M;48=/^1d$/i.11(1p.2g)?48:1p;1p=1p.1p}1G(d&&d.2g&&!/^1d|2I$/i.11(d.2g)){G(!/^97|1X.*$/i.11(1h(d,"19")))17(-d.2c,-d.2l);G(3r&&1h(d,"34")!="4i")2A(d);d=d.1f}G((5V&&(2X||1h(48,"3c")=="5g"))||(3r&&1h(48,"3c")!="5g"))17(-1S.1d.5X,-1S.1d.5z);G(2X)17(26.2e(1S.1B.2c,1S.1d.2c),26.2e(1S.1B.2l,1S.1d.2l))}3q={1P:1P,1z:b}}H 2A(a){17(D.24(a,"7w",M),D.24(a,"7x",M))}H 17(l,t){b+=3v(l,10)||0;1P+=3v(t,10)||0}I 3q};D.18.1n({3c:H(){J a=0,1P=0,3q;G(7[0]){J b=7.1p(),2k=7.2k(),4b=/^1d|2I$/i.11(b[0].2g)?{1P:0,1z:0}:b.2k();2k.1P-=2a(7,\'95\');2k.1z-=2a(7,\'94\');4b.1P+=2a(b,\'7x\');4b.1z+=2a(b,\'7w\');3q={1P:2k.1P-4b.1P,1z:2k.1z-4b.1z}}I 3q},1p:H(){J a=7[0].1p;1G(a&&(!/^1d|2I$/i.11(a.2g)&&D.1h(a,\'3c\')==\'aI\'))a=a.1p;I D(a)}});D.P([\'5d\',\'5b\'],H(i,b){J c=\'4A\'+b;D.18[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1c||7==S?1c.aJ(!i?a:D(1c).2c(),i?a:D(1c).2l()):7[c]=a}):7[0]==1c||7[0]==S?41[i?\'92\':\'91\']||D.6Y&&S.1B[c]||S.1d[c]:7[0][c]}});D.P(["6M","47"],H(i,b){J c=i?"5d":"5b",43=i?"6i":"6g";D.18["5s"+b]=H(){I 7[b.3h()]()+2a(7,"55"+c)+2a(7,"55"+43)};D.18["aM"+b]=H(a){I 7["5s"+b]()+2a(7,"2A"+c+"47")+2a(7,"2A"+43+"47")+(a?2a(7,"7F"+c)+2a(7,"7F"+43):0)}})})();',62,671,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|nodeType|options|add|fn|display|arguments|url|window|body|prop|parentNode|msie|css|indexOf|typeof|in|call|script|extend|replace|offsetParent|constructor|text|firstChild|apply|cur|status|div|now|opacity|left|push|documentElement|hidden|className|filter|isFunction|while|handle|match|hide|ret|dataType|attr|show|complete|top|split|trigger|doc|height|success|break|string|table|cache|remove||catch|tbody|try|curCSS|ready|Math|fx|global|guid|num|start|scrollLeft|width|max|safari|tagName|makeArray|map|animate|offset|scrollTop|toUpperCase||handler|button|Array|new|value|id|find|duration|done|copy|select|ownerDocument|border|toggle|special|exec|inArray|pushStack|stack|opera|html|nextSibling|xml|props|unit|target|bind|none|isReady|GET|which|namespace|px|nth|timeout|fixed|one|step|removeChild|async|name|jsre|overflow|queue|pos|preventDefault|insertBefore|merge|selected|removeData|position|delete|parseFloat|multiFilter|error|toLowerCase|readyState|rl|re|trim|end|_|first|get|results|mozilla|append|createElement|childNodes|parseInt|slice|events|object|elems|param|json|is|readyList|setTimeout|mouseleave|grep|block|callee|proxy|password|unbind|timers|defaultView|disabled|last|has|orig|domManip|ajax|easing|prototype|set|stopPropagation|load|custom|getElementsByTagName|self|charCode|br|curAnim|form|timerId|Width|offsetChild|appendChild|addEventListener|parentOffset|mouseenter|color|src|currentStyle|float|clean|visible|relatedTarget|fromElement|innerHTML|handlers|click|isXMLDoc|on|setup|nodeIndex|shift|input|unique|javascript|child|application|RegExp|accepts|scroll|deep|state|previousSibling|update|empty|teardown|tr|jQuery|timeStamp|getAttribute|setInterval|checked|Number|setRequestHeader|active|jsonp|lastModified|_default|dir|responseText|styleSheets|not|lastToggle|unload|mouseout|outline|mouseover|getPropertyValue|getComputedStyle|bindReady|padding|String|pageX|metaKey|keyCode|getWH|Top|clientX|Left|all|container|absolute|index|init|triggered|removeAttribute|classFilter|submit|prevObject|file|after|windowData|username|inner|client|globalEval|sibling|jquery|href|clone|offsetTop|checkbox|startTime|dequeue|visibility|handleError|version|triggerHandler|oldblock|ctrlKey|createTextNode|getResponseHeader|parsererror|andSelf|speeds|00|old|swing|radio|Modified|ifModified|lastChild|safari2|wrapAll|offsetLeft|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|loaded|DOMContentLoaded|clientTop|clientLeft|val|unshift|toElement|srcElement|_load|pageY|Bottom|clientY|Right|fix|exclusive|detachEvent|removeEventListener|cloneNode|swap|toString|attachEvent|join|eval|substr|ajaxSuccess|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|expr|exclude|quickClass|quickID|quickChild|uuid|continue|Height|textContent|appendTo|contents|XMLHttpRequest|evalScript|parent|getBoundingClientRect|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|styleFloat|def|webkit|nodeValue|speed|concat|_toggle|eq|encodeURIComponent|100|304|replaceWith|200|alpha|Last|httpNotModified|httpSuccess|clearInterval|getAttributeNode|abort|beforeSend|splice|throw|linear|open|colgroup|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|borderLeftWidth|borderTopWidth|contentType|link|ajaxSend|ajaxError|ajaxComplete|ajaxStop|col|margin|ajaxStart|serializeArray|notmodified|POST|keyup|keypress|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|hasClass|doScroll|hover|black|solid|cancelBubble|returnValue|originalEvent|wheelDelta|view|round|shiftKey|screenY|screenX|mousedown|relatedNode|prevValue|originalTarget|keydown|newValue|offsetHeight|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|charAt|0n|substring|animated|header|noConflict|enabled|line|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|417|size|Boolean|toggleClass|Date|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|wrap|contentDocument|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|pageXOffset|pageYOffset|next|marginLeft|marginTop|parents|inline|able|rowSpan|rowspan|cellSpacing|522|cellspacing|maxLength|with|maxlength|readOnly|600|readonly|slow|1px|class|htmlFor|reverse|10000|PI|cos|compatible|Function|Object|setData|ie|stop|ra|it|rv|getData|userAgent|fadeTo|navigator|fadeOut|fadeIn|slideToggle|slideUp|slideDown|responseXML|content|ig|1223|300|NaN|protocol|send|dataFilter|setAttribute|option|cssText|changed|Accept|With|be|Requested|GMT|can|1970|Jan|property|01|Thu|Since|If|Type|Content|XMLHTTP|Microsoft|th|onreadystatechange|onload|td|charset|cap|host|colg|1_|fast|400|tfoot|specified|thead|plain|leg|attributes|opt|adobeair|urlencoded|www|embed|area|hr|ajaxSetup|post|meta|getJSON|getScript|img|static|scrollTo|elements|serialize|outer|abbr|pixelLeft'.split('|'),0,{}));jQuery.noConflict();
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ *  Copyright 2009, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
+jQuery.noConflict();
diff --git a/wp-includes/js/jquery/jquery.table-hotkeys.dev.js b/wp-includes/js/jquery/jquery.table-hotkeys.dev.js
new file mode 100644 (file)
index 0000000..f8b1760
--- /dev/null
@@ -0,0 +1,99 @@
+(function($){
+       $.fn.filter_visible = function(depth) {
+               depth = depth || 3;
+               var is_visible = function() {
+                       var p = $(this), i;
+                       for(i=0; i<depth-1; ++i) {
+                               if (!p.is(':visible')) return false;
+                               p = p.parent();
+                       }
+                       return true;
+               }
+               return this.filter(is_visible);
+       };
+       $.table_hotkeys = function(table, keys, opts) {
+               opts = $.extend($.table_hotkeys.defaults, opts);
+               var selected_class, destructive_class, set_current_row, adjacent_row_callback, get_adjacent_row, adjacent_row, prev_row, next_row, check, get_first_row, get_last_row, make_key_callback, first_row;
+               
+               selected_class = opts.class_prefix + opts.selected_suffix;
+               destructive_class = opts.class_prefix + opts.destructive_suffix
+               set_current_row = function (tr) {
+                       if ($.table_hotkeys.current_row) $.table_hotkeys.current_row.removeClass(selected_class);
+                       tr.addClass(selected_class);
+                       tr[0].scrollIntoView(false);
+                       $.table_hotkeys.current_row = tr;
+               };
+               adjacent_row_callback = function(which) {
+                       if (!adjacent_row(which) && $.isFunction(opts[which+'_page_link_cb'])) {
+                               opts[which+'_page_link_cb']();
+                       }
+               };
+               get_adjacent_row = function(which) {
+                       var first_row, method;
+                       
+                       if (!$.table_hotkeys.current_row) {
+                               first_row = get_first_row();
+                               $.table_hotkeys.current_row = first_row;
+                               return first_row[0];
+                       }
+                       method = 'prev' == which? $.fn.prevAll : $.fn.nextAll;
+                       return method.call($.table_hotkeys.current_row, opts.cycle_expr).filter_visible()[0];
+               };
+               adjacent_row = function(which) {
+                       var adj = get_adjacent_row(which);
+                       if (!adj) return false;
+                       set_current_row($(adj));
+                       return true;
+               };
+               prev_row = function() { return adjacent_row('prev'); };
+               next_row = function() { return adjacent_row('next'); };
+               check = function() {
+                       $(opts.checkbox_expr, $.table_hotkeys.current_row).each(function() {
+                               this.checked = !this.checked;
+                       });
+               };
+               get_first_row = function() {
+                       return $(opts.cycle_expr, table).filter_visible().eq(opts.start_row_index);
+               };
+               get_last_row = function() {
+                       var rows = $(opts.cycle_expr, table).filter_visible();
+                       return rows.eq(rows.length-1);
+               };
+               make_key_callback = function(expr) {
+                       return function() {
+                               if ( null == $.table_hotkeys.current_row ) return false;
+                               var clickable = $(expr, $.table_hotkeys.current_row);
+                               if (!clickable.length) return false;
+                               if (clickable.is('.'+destructive_class)) next_row() || prev_row();
+                               clickable.click();
+                       }
+               };
+               first_row = get_first_row();
+               if (!first_row.length) return;
+               if (opts.highlight_first)
+                       set_current_row(first_row);
+               else if (opts.highlight_last)
+                       set_current_row(get_last_row());
+               $.hotkeys.add(opts.prev_key, opts.hotkeys_opts, function() {return adjacent_row_callback('prev')});
+               $.hotkeys.add(opts.next_key, opts.hotkeys_opts, function() {return adjacent_row_callback('next')});
+               $.hotkeys.add(opts.mark_key, opts.hotkeys_opts, check);
+               $.each(keys, function() {
+                       var callback, key;
+                       
+                       if ($.isFunction(this[1])) {
+                               callback = this[1];
+                               key = this[0];
+                               $.hotkeys.add(key, opts.hotkeys_opts, function(event) { return callback(event, $.table_hotkeys.current_row); });
+                       } else {
+                               key = this;
+                               $.hotkeys.add(key, opts.hotkeys_opts, make_key_callback('.'+opts.class_prefix+key));
+                       }
+               });
+
+       };
+       $.table_hotkeys.current_row = null;
+       $.table_hotkeys.defaults = {cycle_expr: 'tr', class_prefix: 'vim-', selected_suffix: 'current',
+               destructive_suffix: 'destructive', hotkeys_opts: {disableInInput: true, type: 'keypress'},
+               checkbox_expr: ':checkbox', next_key: 'j', prev_key: 'k', mark_key: 'x',
+               start_row_index: 2, highlight_first: false, highlight_last: false, next_page_link_cb: false, prev_page_link_cb: false};
+})(jQuery);
index 515c8ace24c6b3f04c48d37deae2b9099be00a6b..b4aa238ebbe727672967af035b9ac2c4c176e0ce 100644 (file)
@@ -1,93 +1 @@
-(function($){
-       $.fn.filter_visible = function(depth) {
-               depth = depth || 3;
-               var is_visible = function() {
-                       var p = $(this);
-                       for(i=0; i<depth-1; ++i) {
-                               if (!p.is(':visible')) return false;
-                               p = p.parent();
-                       }
-                       return true;
-               }
-               return this.filter(is_visible);
-       };
-       $.table_hotkeys = function(table, keys, opts) {
-               opts = $.extend($.table_hotkeys.defaults, opts);
-               var selected_class = opts.class_prefix + opts.selected_suffix;
-               var destructive_class = opts.class_prefix + opts.destructive_suffix;
-               var set_current_row = function (tr) {
-                       if ($.table_hotkeys.current_row) $.table_hotkeys.current_row.removeClass(selected_class);
-                       tr.addClass(selected_class);
-                       tr[0].scrollIntoView(false);
-                       $.table_hotkeys.current_row = tr;
-               };
-               var adjacent_row_callback = function(which) {
-                       if (!adjacent_row(which) && $.isFunction(opts[which+'_page_link_cb'])) {
-                               opts[which+'_page_link_cb']();
-                       }
-               };
-               var get_adjacent_row = function(which) {
-                       if (!$.table_hotkeys.current_row) {
-                               var first_row = get_first_row();
-                               $.table_hotkeys.current_row = first_row;
-                               return first_row[0];
-                       }
-                       var method = 'prev' == which? $.fn.prevAll : $.fn.nextAll;
-                       return method.call($.table_hotkeys.current_row, opts.cycle_expr).filter_visible()[0];
-               };
-               var adjacent_row = function(which) {
-                       var adj = get_adjacent_row(which);
-                       if (!adj) return false;
-                       set_current_row($(adj));
-                       return true;
-               };
-               var prev_row = function() { return adjacent_row('prev'); };
-               var next_row = function() { return adjacent_row('next'); };
-               var check = function() {
-                       $(opts.checkbox_expr, $.table_hotkeys.current_row).each(function() {
-                               this.checked = !this.checked;
-                       });
-               };
-               var get_first_row = function() {
-                       return $(opts.cycle_expr, table).filter_visible().eq(opts.start_row_index);
-               };
-               var get_last_row = function() {
-                       var rows = $(opts.cycle_expr, table).filter_visible();
-                       return rows.eq(rows.length-1);
-               };
-               var make_key_callback = function(expr) {
-                       return function() {
-                               if ( null == $.table_hotkeys.current_row ) return false;
-                               var clickable = $(expr, $.table_hotkeys.current_row);
-                               if (!clickable.length) return false;
-                               if (clickable.is('.'+destructive_class)) next_row() || prev_row();
-                               clickable.click();
-                       }
-               };
-               var first_row = get_first_row();
-               if (!first_row.length) return;
-               if (opts.highlight_first)
-                       set_current_row(first_row);
-               else if (opts.highlight_last)
-                       set_current_row(get_last_row());
-               jQuery.hotkeys.add(opts.prev_key, opts.hotkeys_opts, function() {return adjacent_row_callback('prev')});
-               jQuery.hotkeys.add(opts.next_key, opts.hotkeys_opts, function() {return adjacent_row_callback('next')});
-               jQuery.hotkeys.add(opts.mark_key, opts.hotkeys_opts, check);
-               jQuery.each(keys, function() {
-                       if ($.isFunction(this[1])) {
-                               var callback = this[1];
-                               var key = this[0];
-                               jQuery.hotkeys.add(key, opts.hotkeys_opts, function(event) { return callback(event, $.table_hotkeys.current_row); });
-                       } else {
-                               var key = this;
-                               jQuery.hotkeys.add(key, opts.hotkeys_opts, make_key_callback('.'+opts.class_prefix+key));
-                       }
-               });
-
-       };
-       $.table_hotkeys.current_row = null;
-       $.table_hotkeys.defaults = {cycle_expr: 'tr', class_prefix: 'vim-', selected_suffix: 'current',
-               destructive_suffix: 'destructive', hotkeys_opts: {disableInInput: true, type: 'keypress'},
-               checkbox_expr: ':checkbox', next_key: 'j', prev_key: 'k', mark_key: 'x',
-               start_row_index: 2, highlight_first: false, highlight_last: false, next_page_link_cb: false, prev_page_link_cb: false};
-})(jQuery);
+(function(a){a.fn.filter_visible=function(c){c=c||3;var b=function(){var e=a(this),d;for(d=0;d<c-1;++d){if(!e.is(":visible")){return false}e=e.parent()}return true};return this.filter(b)};a.table_hotkeys=function(p,q,b){b=a.extend(a.table_hotkeys.defaults,b);var i,l,e,f,m,d,k,o,c,h,g,n,j;i=b.class_prefix+b.selected_suffix;l=b.class_prefix+b.destructive_suffix;e=function(r){if(a.table_hotkeys.current_row){a.table_hotkeys.current_row.removeClass(i)}r.addClass(i);r[0].scrollIntoView(false);a.table_hotkeys.current_row=r};f=function(r){if(!d(r)&&a.isFunction(b[r+"_page_link_cb"])){b[r+"_page_link_cb"]()}};m=function(s){var r,t;if(!a.table_hotkeys.current_row){r=h();a.table_hotkeys.current_row=r;return r[0]}t="prev"==s?a.fn.prevAll:a.fn.nextAll;return t.call(a.table_hotkeys.current_row,b.cycle_expr).filter_visible()[0]};d=function(s){var r=m(s);if(!r){return false}e(a(r));return true};k=function(){return d("prev")};o=function(){return d("next")};c=function(){a(b.checkbox_expr,a.table_hotkeys.current_row).each(function(){this.checked=!this.checked})};h=function(){return a(b.cycle_expr,p).filter_visible().eq(b.start_row_index)};g=function(){var r=a(b.cycle_expr,p).filter_visible();return r.eq(r.length-1)};n=function(r){return function(){if(null==a.table_hotkeys.current_row){return false}var s=a(r,a.table_hotkeys.current_row);if(!s.length){return false}if(s.is("."+l)){o()||k()}s.click()}};j=h();if(!j.length){return}if(b.highlight_first){e(j)}else{if(b.highlight_last){e(g())}}a.hotkeys.add(b.prev_key,b.hotkeys_opts,function(){return f("prev")});a.hotkeys.add(b.next_key,b.hotkeys_opts,function(){return f("next")});a.hotkeys.add(b.mark_key,b.hotkeys_opts,c);a.each(q,function(){var s,r;if(a.isFunction(this[1])){s=this[1];r=this[0];a.hotkeys.add(r,b.hotkeys_opts,function(t){return s(t,a.table_hotkeys.current_row)})}else{r=this;a.hotkeys.add(r,b.hotkeys_opts,n("."+b.class_prefix+r))}})};a.table_hotkeys.current_row=null;a.table_hotkeys.defaults={cycle_expr:"tr",class_prefix:"vim-",selected_suffix:"current",destructive_suffix:"destructive",hotkeys_opts:{disableInInput:true,type:"keypress"},checkbox_expr:":checkbox",next_key:"j",prev_key:"k",mark_key:"x",start_row_index:2,highlight_first:false,highlight_last:false,next_page_link_cb:false,prev_page_link_cb:false}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jquery/suggest.dev.js b/wp-includes/js/jquery/suggest.dev.js
new file mode 100644 (file)
index 0000000..e76c811
--- /dev/null
@@ -0,0 +1,330 @@
+/*
+ *     jquery.suggest 1.1b - 2007-08-06
+ * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting
+ * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228
+ *
+ *     Uses code and techniques from following libraries:
+ *     1. http://www.dyve.net/jquery/?autocomplete
+ *     2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js
+ *
+ *     All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)
+ *     Feel free to do whatever you want with this file
+ *
+ */
+
+(function($) {
+
+       $.suggest = function(input, options) {
+               var $input, $results, timeout, prevLength, cache, cacheSize;
+
+               $input = $(input).attr("autocomplete", "off");
+               $results = $(document.createElement("ul"));
+
+               timeout = false;                // hold timeout ID for suggestion results to appear
+               prevLength = 0;                 // last recorded length of $input.val()
+               cache = [];                             // cache MRU list
+               cacheSize = 0;                  // size of cache in chars (bytes?)
+
+               $results.addClass(options.resultsClass).appendTo('body');
+
+
+               resetPosition();
+               $(window)
+                       .load(resetPosition)            // just in case user is changing size of page while loading
+                       .resize(resetPosition);
+
+               $input.blur(function() {
+                       setTimeout(function() { $results.hide() }, 200);
+               });
+
+
+               // help IE users if possible
+               if ( $.browser.msie ) {
+                       try {
+                               $results.bgiframe();
+                       } catch(e) { }
+               }
+
+               // I really hate browser detection, but I don't see any other way
+               if ($.browser.mozilla)
+                       $input.keypress(processKey);    // onkeypress repeats arrow keys in Mozilla/Opera
+               else
+                       $input.keydown(processKey);             // onkeydown repeats arrow keys in IE/Safari
+
+
+
+
+               function resetPosition() {
+                       // requires jquery.dimension plugin
+                       var offset = $input.offset();
+                       $results.css({
+                               top: (offset.top + input.offsetHeight) + 'px',
+                               left: offset.left + 'px'
+                       });
+               }
+
+
+               function processKey(e) {
+
+                       // handling up/down/escape requires results to be visible
+                       // handling enter/tab requires that AND a result to be selected
+                       if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
+                               (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {
+
+                               if (e.preventDefault)
+                                       e.preventDefault();
+                               if (e.stopPropagation)
+                                       e.stopPropagation();
+
+                               e.cancelBubble = true;
+                               e.returnValue = false;
+
+                               switch(e.keyCode) {
+
+                                       case 38: // up
+                                               prevResult();
+                                               break;
+
+                                       case 40: // down
+                                               nextResult();
+                                               break;
+
+                                       case 9:  // tab
+                                       case 13: // return
+                                               selectCurrentResult();
+                                               break;
+
+                                       case 27: //     escape
+                                               $results.hide();
+                                               break;
+
+                               }
+
+                       } else if ($input.val().length != prevLength) {
+
+                               if (timeout)
+                                       clearTimeout(timeout);
+                               timeout = setTimeout(suggest, options.delay);
+                               prevLength = $input.val().length;
+
+                       }
+
+
+               }
+
+
+               function suggest() {
+
+                       var q = $.trim($input.val()), multipleSepPos, items;
+
+                       if ( options.multiple ) {
+                               multipleSepPos = q.lastIndexOf(options.multipleSep);
+                               if ( multipleSepPos != -1 ) {
+                                       q = q.substr(multipleSepPos + options.multipleSep.length);
+                               }
+                       }
+                       if (q.length >= options.minchars) {
+
+                               cached = checkCache(q);
+
+                               if (cached) {
+
+                                       displayItems(cached['items']);
+
+                               } else {
+
+                                       $.get(options.source, {q: q}, function(txt) {
+
+                                               $results.hide();
+
+                                               items = parseTxt(txt, q);
+
+                                               displayItems(items);
+                                               addToCache(q, items, txt.length);
+
+                                       });
+
+                               }
+
+                       } else {
+
+                               $results.hide();
+
+                       }
+
+               }
+
+
+               function checkCache(q) {
+                       var i;
+                       for (i = 0; i < cache.length; i++)
+                               if (cache[i]['q'] == q) {
+                                       cache.unshift(cache.splice(i, 1)[0]);
+                                       return cache[0];
+                               }
+
+                       return false;
+
+               }
+
+               function addToCache(q, items, size) {
+                       var cached;
+                       while (cache.length && (cacheSize + size > options.maxCacheSize)) {
+                               cached = cache.pop();
+                               cacheSize -= cached['size'];
+                       }
+
+                       cache.push({
+                               q: q,
+                               size: size,
+                               items: items
+                               });
+
+                       cacheSize += size;
+
+               }
+
+               function displayItems(items) {
+                       var html = '', i;
+                       if (!items)
+                               return;
+
+                       if (!items.length) {
+                               $results.hide();
+                               return;
+                       }
+
+                       resetPosition(); // when the form moves after the page has loaded
+
+                       for (i = 0; i < items.length; i++)
+                               html += '<li>' + items[i] + '</li>';
+
+                       $results.html(html).show();
+
+                       $results
+                               .children('li')
+                               .mouseover(function() {
+                                       $results.children('li').removeClass(options.selectClass);
+                                       $(this).addClass(options.selectClass);
+                               })
+                               .click(function(e) {
+                                       e.preventDefault();
+                                       e.stopPropagation();
+                                       selectCurrentResult();
+                               });
+
+               }
+
+               function parseTxt(txt, q) {
+
+                       var items = [], tokens = txt.split(options.delimiter), i, token;
+
+                       // parse returned data for non-empty items
+                       for (i = 0; i < tokens.length; i++) {
+                               token = $.trim(tokens[i]);
+                               if (token) {
+                                       token = token.replace(
+                                               new RegExp(q, 'ig'),
+                                               function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' }
+                                               );
+                                       items[items.length] = token;
+                               }
+                       }
+
+                       return items;
+               }
+
+               function getCurrentResult() {
+                       var $currentResult;
+                       if (!$results.is(':visible'))
+                               return false;
+
+                       $currentResult = $results.children('li.' + options.selectClass);
+
+                       if (!$currentResult.length)
+                               $currentResult = false;
+
+                       return $currentResult;
+
+               }
+
+               function selectCurrentResult() {
+
+                       $currentResult = getCurrentResult();
+
+                       if ($currentResult) {
+                               if ( options.multiple ) {
+                                       if ( $input.val().indexOf(options.multipleSep) != -1 ) {
+                                               $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) );
+                                       } else {
+                                               $currentVal = "";
+                                       }
+                                       $input.val( $currentVal + $currentResult.text() + options.multipleSep);
+                                       $input.focus();
+                               } else {
+                                       $input.val($currentResult.text());
+                               }
+                               $results.hide();
+
+                               if (options.onSelect)
+                                       options.onSelect.apply($input[0]);
+
+                       }
+
+               }
+
+               function nextResult() {
+
+                       $currentResult = getCurrentResult();
+
+                       if ($currentResult)
+                               $currentResult
+                                       .removeClass(options.selectClass)
+                                       .next()
+                                               .addClass(options.selectClass);
+                       else
+                               $results.children('li:first-child').addClass(options.selectClass);
+
+               }
+
+               function prevResult() {
+                       var $currentResult = getCurrentResult();
+
+                       if ($currentResult)
+                               $currentResult
+                                       .removeClass(options.selectClass)
+                                       .prev()
+                                               .addClass(options.selectClass);
+                       else
+                               $results.children('li:last-child').addClass(options.selectClass);
+
+               }
+       }
+
+       $.fn.suggest = function(source, options) {
+
+               if (!source)
+                       return;
+
+               options = options || {};
+               options.multiple = options.multiple || false;
+               options.multipleSep = options.multipleSep || ", ";
+               options.source = source;
+               options.delay = options.delay || 100;
+               options.resultsClass = options.resultsClass || 'ac_results';
+               options.selectClass = options.selectClass || 'ac_over';
+               options.matchClass = options.matchClass || 'ac_match';
+               options.minchars = options.minchars || 2;
+               options.delimiter = options.delimiter || '\n';
+               options.onSelect = options.onSelect || false;
+               options.maxCacheSize = options.maxCacheSize || 65536;
+
+               this.each(function() {
+                       new $.suggest(this, options);
+               });
+
+               return this;
+
+       };
+
+})(jQuery);
\ No newline at end of file
index 344008d7610340363adda7bae2ce571ef1fa0686..bc3c90688bf8c5b1c9865148acf33e1ad106c699 100644 (file)
@@ -1,332 +1 @@
-/*
- *     jquery.suggest 1.1b - 2007-08-06
- * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting
- * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228
- *     
- *     Uses code and techniques from following libraries:
- *     1. http://www.dyve.net/jquery/?autocomplete
- *     2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js      
- *
- *     All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)       
- *     Feel free to do whatever you want with this file
- *
- */
-
-(function($) {
-
-       $.suggest = function(input, options) {
-
-               var $input = $(input).attr("autocomplete", "off");
-               var $results = $(document.createElement("ul"));
-
-               var timeout = false;            // hold timeout ID for suggestion results to appear     
-               var prevLength = 0;                     // last recorded length of $input.val()
-               var cache = [];                         // cache MRU list
-               var cacheSize = 0;                      // size of cache in chars (bytes?)
-               
-               $results.addClass(options.resultsClass).appendTo('body');
-                       
-
-               resetPosition();
-               $(window)
-                       .load(resetPosition)            // just in case user is changing size of page while loading
-                       .resize(resetPosition);
-
-               $input.blur(function() {
-                       setTimeout(function() { $results.hide() }, 200);
-               });
-               
-               
-               // help IE users if possible
-               try {
-                       $results.bgiframe();
-               } catch(e) { }
-
-
-               // I really hate browser detection, but I don't see any other way
-               if ($.browser.mozilla)
-                       $input.keypress(processKey);    // onkeypress repeats arrow keys in Mozilla/Opera
-               else
-                       $input.keydown(processKey);             // onkeydown repeats arrow keys in IE/Safari
-               
-
-
-
-               function resetPosition() {
-                       // requires jquery.dimension plugin
-                       var offset = $input.offset();
-                       $results.css({
-                               top: (offset.top + input.offsetHeight) + 'px',
-                               left: offset.left + 'px'
-                       });
-               }
-               
-               
-               function processKey(e) {
-                       
-                       // handling up/down/escape requires results to be visible
-                       // handling enter/tab requires that AND a result to be selected
-                       if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
-                               (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {
-                               
-                               if (e.preventDefault)
-                                       e.preventDefault();
-                               if (e.stopPropagation)
-                                       e.stopPropagation();
-
-                               e.cancelBubble = true;
-                               e.returnValue = false;
-                       
-                               switch(e.keyCode) {
-
-                                       case 38: // up
-                                               prevResult();
-                                               break;
-                       
-                                       case 40: // down
-                                               nextResult();
-                                               break;
-
-                                       case 9:  // tab
-                                       case 13: // return
-                                               selectCurrentResult();
-                                               break;
-                                               
-                                       case 27: //     escape
-                                               $results.hide();
-                                               break;
-
-                               }
-                               
-                       } else if ($input.val().length != prevLength) {
-
-                               if (timeout) 
-                                       clearTimeout(timeout);
-                               timeout = setTimeout(suggest, options.delay);
-                               prevLength = $input.val().length;
-                               
-                       }                       
-                               
-                       
-               }
-               
-               
-               function suggest() {
-               
-                       var q = $.trim($input.val());
-
-                       if ( options.multiple ) {
-                               var multipleSepPos = q.lastIndexOf(options.multipleSep);
-                               if ( multipleSepPos != -1 ) {
-                                       q = q.substr(multipleSepPos + options.multipleSep.length);
-                               }
-                       }
-                       if (q.length >= options.minchars) {
-                               
-                               cached = checkCache(q);
-                               
-                               if (cached) {
-                               
-                                       displayItems(cached['items']);
-                                       
-                               } else {
-                               
-                                       $.get(options.source, {q: q}, function(txt) {
-
-                                               $results.hide();
-                                               
-                                               var items = parseTxt(txt, q);
-                                               
-                                               displayItems(items);
-                                               addToCache(q, items, txt.length);
-                                               
-                                       });
-                                       
-                               }
-                               
-                       } else {
-                       
-                               $results.hide();
-                               
-                       }
-                               
-               }
-               
-               
-               function checkCache(q) {
-
-                       for (var i = 0; i < cache.length; i++)
-                               if (cache[i]['q'] == q) {
-                                       cache.unshift(cache.splice(i, 1)[0]);
-                                       return cache[0];
-                               }
-                       
-                       return false;
-               
-               }
-               
-               function addToCache(q, items, size) {
-
-                       while (cache.length && (cacheSize + size > options.maxCacheSize)) {
-                               var cached = cache.pop();
-                               cacheSize -= cached['size'];
-                       }
-                       
-                       cache.push({
-                               q: q,
-                               size: size,
-                               items: items
-                               });
-                               
-                       cacheSize += size;
-               
-               }
-               
-               function displayItems(items) {
-                       
-                       if (!items)
-                               return;
-                               
-                       if (!items.length) {
-                               $results.hide();
-                               return;
-                       }
-
-                       resetPosition(); // when the form moves after the page has loaded
-
-                       var html = '';
-                       for (var i = 0; i < items.length; i++)
-                               html += '<li>' + items[i] + '</li>';
-
-                       $results.html(html).show();
-                       
-                       $results
-                               .children('li')
-                               .mouseover(function() {
-                                       $results.children('li').removeClass(options.selectClass);
-                                       $(this).addClass(options.selectClass);
-                               })
-                               .click(function(e) {
-                                       e.preventDefault(); 
-                                       e.stopPropagation();
-                                       selectCurrentResult();
-                               });
-                                               
-               }
-               
-               function parseTxt(txt, q) {
-                       
-                       var items = [];
-                       var tokens = txt.split(options.delimiter);
-                       
-                       // parse returned data for non-empty items
-                       for (var i = 0; i < tokens.length; i++) {
-                               var token = $.trim(tokens[i]);
-                               if (token) {
-                                       token = token.replace(
-                                               new RegExp(q, 'ig'), 
-                                               function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' }
-                                               );
-                                       items[items.length] = token;
-                               }
-                       }
-                       
-                       return items;
-               }
-               
-               function getCurrentResult() {
-               
-                       if (!$results.is(':visible'))
-                               return false;
-               
-                       var $currentResult = $results.children('li.' + options.selectClass);
-                       
-                       if (!$currentResult.length)
-                               $currentResult = false;
-                               
-                       return $currentResult;
-
-               }
-               
-               function selectCurrentResult() {
-               
-                       $currentResult = getCurrentResult();
-               
-                       if ($currentResult) {
-                               if ( options.multiple ) {
-                                       if ( $input.val().indexOf(options.multipleSep) != -1 ) {
-                                               $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) );
-                                       } else {
-                                               $currentVal = "";
-                                       }
-                                       $input.val( $currentVal + $currentResult.text() + options.multipleSep);
-                                       $input.focus();
-                               } else {
-                                       $input.val($currentResult.text());
-                               }
-                               $results.hide();
-                               
-                               if (options.onSelect)
-                                       options.onSelect.apply($input[0]);
-                                       
-                       }
-               
-               }
-               
-               function nextResult() {
-               
-                       $currentResult = getCurrentResult();
-               
-                       if ($currentResult)
-                               $currentResult
-                                       .removeClass(options.selectClass)
-                                       .next()
-                                               .addClass(options.selectClass);
-                       else
-                               $results.children('li:first-child').addClass(options.selectClass);
-               
-               }
-               
-               function prevResult() {
-               
-                       $currentResult = getCurrentResult();
-               
-                       if ($currentResult)
-                               $currentResult
-                                       .removeClass(options.selectClass)
-                                       .prev()
-                                               .addClass(options.selectClass);
-                       else
-                               $results.children('li:last-child').addClass(options.selectClass);
-               
-               }
-
-       }
-       
-       $.fn.suggest = function(source, options) {
-       
-               if (!source)
-                       return;
-       
-               options = options || {};
-               options.multiple = options.multiple || false;
-               options.multipleSep = options.multipleSep || ", ";
-               options.source = source;
-               options.delay = options.delay || 100;
-               options.resultsClass = options.resultsClass || 'ac_results';
-               options.selectClass = options.selectClass || 'ac_over';
-               options.matchClass = options.matchClass || 'ac_match';
-               options.minchars = options.minchars || 2;
-               options.delimiter = options.delimiter || '\n';
-               options.onSelect = options.onSelect || false;
-               options.maxCacheSize = options.maxCacheSize || 65536;
-
-               this.each(function() {
-                       new $.suggest(this, options);
-               });
-
-               return this;
-               
-       };
-       
-})(jQuery);
\ No newline at end of file
+(function(a){a.suggest=function(o,g){var c,f,n,d,q,p;c=a(o).attr("autocomplete","off");f=a(document.createElement("ul"));n=false;d=0;q=[];p=0;f.addClass(g.resultsClass).appendTo("body");j();a(window).load(j).resize(j);c.blur(function(){setTimeout(function(){f.hide()},200)});if(a.browser.msie){try{f.bgiframe()}catch(s){}}if(a.browser.mozilla){c.keypress(m)}else{c.keydown(m)}function j(){var e=c.offset();f.css({top:(e.top+o.offsetHeight)+"px",left:e.left+"px"})}function m(w){if((/27$|38$|40$/.test(w.keyCode)&&f.is(":visible"))||(/^13$|^9$/.test(w.keyCode)&&u())){if(w.preventDefault){w.preventDefault()}if(w.stopPropagation){w.stopPropagation()}w.cancelBubble=true;w.returnValue=false;switch(w.keyCode){case 38:k();break;case 40:t();break;case 9:case 13:r();break;case 27:f.hide();break}}else{if(c.val().length!=d){if(n){clearTimeout(n)}n=setTimeout(l,g.delay);d=c.val().length}}}function l(){var x=a.trim(c.val()),w,e;if(g.multiple){w=x.lastIndexOf(g.multipleSep);if(w!=-1){x=x.substr(w+g.multipleSep.length)}}if(x.length>=g.minchars){cached=v(x);if(cached){i(cached.items)}else{a.get(g.source,{q:x},function(y){f.hide();e=b(y,x);i(e);h(x,e,y.length)})}}else{f.hide()}}function v(w){var e;for(e=0;e<q.length;e++){if(q[e]["q"]==w){q.unshift(q.splice(e,1)[0]);return q[0]}}return false}function h(y,e,w){var x;while(q.length&&(p+w>g.maxCacheSize)){x=q.pop();p-=x.size}q.push({q:y,size:w,items:e});p+=w}function i(e){var x="",w;if(!e){return}if(!e.length){f.hide();return}j();for(w=0;w<e.length;w++){x+="<li>"+e[w]+"</li>"}f.html(x).show();f.children("li").mouseover(function(){f.children("li").removeClass(g.selectClass);a(this).addClass(g.selectClass)}).click(function(y){y.preventDefault();y.stopPropagation();r()})}function b(e,z){var w=[],A=e.split(g.delimiter),y,x;for(y=0;y<A.length;y++){x=a.trim(A[y]);if(x){x=x.replace(new RegExp(z,"ig"),function(B){return'<span class="'+g.matchClass+'">'+B+"</span>"});w[w.length]=x}}return w}function u(){var e;if(!f.is(":visible")){return false}e=f.children("li."+g.selectClass);if(!e.length){e=false}return e}function r(){$currentResult=u();if($currentResult){if(g.multiple){if(c.val().indexOf(g.multipleSep)!=-1){$currentVal=c.val().substr(0,(c.val().lastIndexOf(g.multipleSep)+g.multipleSep.length))}else{$currentVal=""}c.val($currentVal+$currentResult.text()+g.multipleSep);c.focus()}else{c.val($currentResult.text())}f.hide();if(g.onSelect){g.onSelect.apply(c[0])}}}function t(){$currentResult=u();if($currentResult){$currentResult.removeClass(g.selectClass).next().addClass(g.selectClass)}else{f.children("li:first-child").addClass(g.selectClass)}}function k(){var e=u();if(e){e.removeClass(g.selectClass).prev().addClass(g.selectClass)}else{f.children("li:last-child").addClass(g.selectClass)}}};a.fn.suggest=function(c,b){if(!c){return}b=b||{};b.multiple=b.multiple||false;b.multipleSep=b.multipleSep||", ";b.source=c;b.delay=b.delay||100;b.resultsClass=b.resultsClass||"ac_results";b.selectClass=b.selectClass||"ac_over";b.matchClass=b.matchClass||"ac_match";b.minchars=b.minchars||2;b.delimiter=b.delimiter||"\n";b.onSelect=b.onSelect||false;b.maxCacheSize=b.maxCacheSize||65536;this.each(function(){new a.suggest(this,b)});return this}})(jQuery);
\ No newline at end of file
index 2dbda4f5a08ce02f1e101fa7ae22b05964cf01d4..f510100ec94b15d70c7acbf9a985f5babaccfca6 100644 (file)
@@ -1,2 +1,10 @@
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3(C){C.8={2r:{V:3(E,F,H){6 G=C.8[E].o;1v(6 D 2q H){G.w[D]=G.w[D]||[];G.w[D].2p([F,H[D]])}},1p:3(D,F,E){6 H=D.w[F];5(!H){4}1v(6 G=0;G<H.1e;G++){5(D.a[H[G][0]]){H[G][1].v(D.c,E)}}}},p:{},d:3(D){5(C.8.p[D]){4 C.8.p[D]}6 E=C(\'<2o 2n="8-2m">\').1k(D).d({2l:"2k",12:"-1u",2j:"-1u",2i:"2h"}).2g("1t");C.8.p[D]=!!((!(/2f|2e/).h(E.d("2d"))||(/^[1-9]/).h(E.d("2c"))||(/^[1-9]/).h(E.d("2b"))||!(/1r/).h(E.d("2a"))||!(/29|28\\(0, 0, 0, 0\\)/).h(E.d("27"))));26{C("1t").1s(0).25(E.1s(0))}24(F){}4 C.8.p[D]},23:3(D){C(D).k("j","1i").d("1q","1r")},22:3(D){C(D).k("j","21").d("1q","")},20:3(G,E){6 D=/12/.h(E||"12")?"1Z":"1Y",F=7;5(G[D]>0){4 f}G[D]=1;F=G[D]>0?f:7;G[D]=0;4 F}};6 B=C.10.u;C.10.u=3(){C("*",2).V(2).1X("u");4 B.v(2,1o)};3 A(E,F,G){6 D=C[E][F].1W||[];D=(X D=="W"?D.11(/,?\\s+/):D);4(C.1V(G,D)!=-1)}C.m=3(E,D){6 F=E.11(".")[0];E=E.11(".")[1];C.10[E]=3(J){6 H=(X J=="W"),I=1U.o.1T.1p(1o,1);5(H&&A(F,E,J)){6 G=C.Z(2[0],E);4(G?G[J].v(G,I):1S)}4 2.1R(3(){6 K=C.Z(2,E);5(H&&K&&C.1Q(K[J])){K[J].v(K,I)}1P{5(!H){C.Z(2,E,1O C[F][E](2,J))}}})};C[F][E]=3(I,H){6 G=2;2.e=E;2.1j=F+"-"+E;2.a=C.1n({},C.m.q,C[F][E].q,H);2.c=C(I).g("n."+E,3(L,J,K){4 G.n(J,K)}).g("Y."+E,3(K,J){4 G.Y(J)}).g("u",3(){4 G.1l()});2.1m()};C[F][E].o=C.1n({},C.m.o,D)};C.m.o={1m:3(){},1l:3(){2.c.1N(2.e)},Y:3(D){4 2.a[D]},n:3(D,E){2.a[D]=E;5(D=="l"){2.c[E?"1k":"1M"](2.1j+"-l")}},1L:3(){2.n("l",7)},1K:3(){2.n("l",f)}};C.m.q={l:7};C.8.14={1J:3(){6 D=2;2.c.g("1I."+2.e,3(E){4 D.1g(E)});5(C.U.T){2.1h=2.c.k("j");2.c.k("j","1i")}2.1H=7},1G:3(){2.c.R("."+2.e);(C.U.T&&2.c.k("j",2.1h))},1g:3(F){(2.b&&2.i(F));2.t=F;6 E=2,G=(F.1F==1),D=(X 2.a.y=="W"?C(F.1f).1E().V(F.1f).1D(2.a.y).1e:7);5(!G||D||!2.15(F)){4 f}2.r=!2.a.x;5(!2.r){2.1C=1B(3(){E.r=f},2.a.x)}5(2.P(F)&&2.N(F)){2.b=(2.M(F)!==7);5(!2.b){F.1A();4 f}}2.S=3(H){4 E.1d(H)};2.Q=3(H){4 E.i(H)};C(1c).g("1b."+2.e,2.S).g("1a."+2.e,2.Q);4 7},1d:3(D){5(C.U.T&&!D.1z){4 2.i(D)}5(2.b){2.z(D);4 7}5(2.P(D)&&2.N(D)){2.b=(2.M(2.t,D)!==7);(2.b?2.z(D):2.i(D))}4!2.b},i:3(D){C(1c).R("1b."+2.e,2.S).R("1a."+2.e,2.Q);5(2.b){2.b=7;2.16(D)}4 7},P:3(D){4(O.1y(O.18(2.t.19-D.19),O.18(2.t.17-D.17))>=2.a.13)},N:3(D){4 2.r},M:3(D){},z:3(D){},16:3(D){},15:3(D){4 f}};C.8.14.q={y:1x,13:1,x:0}})(1w)',62,152,'||this|function|return|if|var|false|ui||options|_mouseStarted|element|css|widgetName|true|bind|test|mouseUp|unselectable|attr|disabled|widget|setData|prototype|cssCache|defaults|_mouseDelayMet||_mouseDownEvent|remove|apply|plugins|delay|cancel|mouseDrag|||||||||||||mouseStart|mouseDelayMet|Math|mouseDistanceMet|_mouseUpDelegate|unbind|_mouseMoveDelegate|msie|browser|add|string|typeof|getData|data|fn|split|top|distance|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|length|target|mouseDown|_mouseUnselectable|on|widgetBaseClass|addClass|destroy|init|extend|arguments|call|MozUserSelect|none|get|body|5000px|for|jQuery|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|filter|parents|which|mouseDestroy|started|mousedown|mouseInit|disable|enable|removeClass|removeData|new|else|isFunction|each|undefined|slice|Array|inArray|getter|triggerHandler|scrollLeft|scrollTop|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|left|absolute|position|gen|class|div|push|in|plugin'.split('|'),0,{}))
-
+/*
+ * jQuery UI 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI
+ */
+jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
\ No newline at end of file
index 35742f170f25022ffb03cd8e0391aef3d1432821..acf0960e4c713fe2aacbeb54a30594c67bbfa4e4 100644 (file)
@@ -1 +1,15 @@
-(function(B){var A={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};B.widget("ui.dialog",{init:function(){var J=this,K=this.options,D=typeof K.resizable=="string"?K.resizable:"n,e,s,w,se,sw,ne,nw",E=this.element.addClass("ui-dialog-content").wrap("<div/>").wrap("<div/>"),G=(this.uiDialogContainer=E.parent().addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%"})),H=K.title||E.attr("title")||"",C=(this.uiDialogTitlebar=B('<div class="ui-dialog-titlebar"/>')).append('<span class="ui-dialog-title">'+H+"</span>").append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>').prependTo(G),I=(this.uiDialog=G.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(K.dialogClass).addClass(E.attr("className")).removeClass("ui-dialog-content").css({position:"absolute",width:K.width,height:K.height,overflow:"hidden",zIndex:K.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(L){if(K.closeOnEscape){var M=27;(L.keyCode&&L.keyCode==M&&J.close())}}).mousedown(function(){J.moveToTop()}),F=(this.uiDialogButtonPane=B("<div/>")).addClass("ui-dialog-buttonpane").css({position:"absolute",bottom:0}).appendTo(I);this.uiDialogTitlebarClose=B(".ui-dialog-titlebar-close",C).hover(function(){B(this).addClass("ui-dialog-titlebar-close-hover")},function(){B(this).removeClass("ui-dialog-titlebar-close-hover")}).mousedown(function(L){L.stopPropagation()}).click(function(){J.close();return false});this.uiDialogTitlebar.find("*").add(this.uiDialogTitlebar).each(function(){B.ui.disableSelection(this)});if(B.fn.draggable){I.draggable({cancel:".ui-dialog-content",helper:K.dragHelper,handle:".ui-dialog-titlebar",start:function(M,L){J.moveToTop();(K.dragStart&&K.dragStart.apply(J.element[0],arguments))},drag:function(M,L){(K.drag&&K.drag.apply(J.element[0],arguments))},stop:function(M,L){(K.dragStop&&K.dragStop.apply(J.element[0],arguments));B.ui.dialog.overlay.resize()}});(K.draggable||I.draggable("disable"))}if(B.fn.resizable){I.resizable({cancel:".ui-dialog-content",helper:K.resizeHelper,maxWidth:K.maxWidth,maxHeight:K.maxHeight,minWidth:K.minWidth,minHeight:K.minHeight,start:function(){(K.resizeStart&&K.resizeStart.apply(J.element[0],arguments))},resize:function(M,L){(K.autoResize&&J.size.apply(J));(K.resize&&K.resize.apply(J.element[0],arguments))},handles:D,stop:function(M,L){(K.autoResize&&J.size.apply(J));(K.resizeStop&&K.resizeStop.apply(J.element[0],arguments));B.ui.dialog.overlay.resize()}});(K.resizable||I.resizable("disable"))}this.createButtons(K.buttons);this.isOpen=false;(K.bgiframe&&B.fn.bgiframe&&I.bgiframe());(K.autoOpen&&this.open())},setData:function(C,D){(A[C]&&this.uiDialog.data(A[C],D));switch(C){case"buttons":this.createButtons(D);break;case"draggable":this.uiDialog.draggable(D?"enable":"disable");break;case"height":this.uiDialog.height(D);break;case"position":this.position(D);break;case"resizable":(typeof D=="string"&&this.uiDialog.data("handles.resizable",D));this.uiDialog.resizable(D?"enable":"disable");break;case"title":B(".ui-dialog-title",this.uiDialogTitlebar).text(D);break;case"width":this.uiDialog.width(D);break}B.widget.prototype.setData.apply(this,arguments)},position:function(H){var D=B(window),E=B(document),F=E.scrollTop(),C=E.scrollLeft(),G=F;if(B.inArray(H,["center","top","right","bottom","left"])>=0){H=[H=="right"||H=="left"?H:"center",H=="top"||H=="bottom"?H:"middle"]}if(H.constructor!=Array){H=["center","middle"]}if(H[0].constructor==Number){C+=H[0]}else{switch(H[0]){case"left":C+=0;break;case"right":C+=D.width()-this.uiDialog.width();break;default:case"center":C+=(D.width()-this.uiDialog.width())/2}}if(H[1].constructor==Number){F+=H[1]}else{switch(H[1]){case"top":F+=0;break;case"bottom":F+=D.height()-this.uiDialog.height();break;default:case"middle":F+=(D.height()-this.uiDialog.height())/2}}F=Math.max(F,G);this.uiDialog.css({top:F,left:C})},size:function(){var D=this.uiDialogContainer,G=this.uiDialogTitlebar,E=this.element,F=parseInt(E.css("margin-top"),10)+parseInt(E.css("margin-bottom"),10),C=parseInt(E.css("margin-left"),10)+parseInt(E.css("margin-right"),10);E.height(D.height()-G.outerHeight()-F);E.width(D.width()-C)},open:function(){if(this.isOpen){return }this.overlay=this.options.modal?new B.ui.dialog.overlay(this):null;(this.uiDialog.next().length>0)&&this.uiDialog.appendTo("body");this.position(this.options.position);this.uiDialog.show(this.options.show);this.options.autoResize&&this.size();this.moveToTop(true);var C=null;var D={options:this.options};this.uiDialogTitlebarClose.focus();this.element.triggerHandler("dialogopen",[C,D],this.options.open);this.isOpen=true},moveToTop:function(E){if((this.options.modal&&!E)||(!this.options.stack&&!this.options.modal)){return this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus)}var D=this.options.zIndex,C=this.options;B(".ui-dialog:visible").each(function(){D=Math.max(D,parseInt(B(this).css("z-index"),10)||C.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++D));this.uiDialog.css("z-index",++D);this.element.triggerHandler("dialogfocus",[null,{options:this.options}],this.options.focus)},close:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide);var D=null;var C={options:this.options};this.element.triggerHandler("dialogclose",[D,C],this.options.close);B.ui.dialog.overlay.resize();this.isOpen=false},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");this.uiDialog.remove()},createButtons:function(F){var E=this,C=false,D=this.uiDialogButtonPane;D.empty().hide();B.each(F,function(){return !(C=true)});if(C){D.show();B.each(F,function(G,H){B("<button/>").text(G).click(function(){H.apply(E.element[0],arguments)}).appendTo(D)})}}});B.extend(B.ui.dialog,{defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},overlay:function(C){this.$el=B.ui.dialog.overlay.create(C)}});B.extend(B.ui.dialog.overlay,{instances:[],events:B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(C){return C+".dialog-overlay"}).join(" "),create:function(D){if(this.instances.length===0){setTimeout(function(){B("a, :input").bind(B.ui.dialog.overlay.events,function(){var F=false;var H=B(this).parents(".ui-dialog");if(H.length){var E=B(".ui-dialog-overlay");if(E.length){var G=parseInt(E.css("z-index"),10);E.each(function(){G=Math.max(G,parseInt(B(this).css("z-index"),10))});F=parseInt(H.css("z-index"),10)>G}else{F=true}}return F})},1);B(document).bind("keydown.dialog-overlay",function(E){var F=27;(E.keyCode&&E.keyCode==F&&D.close())});B(window).bind("resize.dialog-overlay",B.ui.dialog.overlay.resize)}var C=B("<div/>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},D.options.overlay));(D.options.bgiframe&&B.fn.bgiframe&&C.bgiframe());this.instances.push(C);return C},destroy:function(C){this.instances.splice(B.inArray(this.instances,C),1);if(this.instances.length===0){B("a, :input").add([document,window]).unbind(".dialog-overlay")}C.remove()},height:function(){if(B.browser.msie&&B.browser.version<7){var D=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var C=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(D<C){return B(window).height()+"px"}else{return D+"px"}}else{return B(document).height()+"px"}},width:function(){if(B.browser.msie&&B.browser.version<7){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var D=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(C<D){return B(window).width()+"px"}else{return C+"px"}}else{return B(document).width()+"px"}},resize:function(){var C=B([]);B.each(B.ui.dialog.overlay.instances,function(){C=C.add(this)});C.css({width:0,height:0}).css({width:B.ui.dialog.overlay.width(),height:B.ui.dialog.overlay.height()})}});B.extend(B.ui.dialog.overlay.prototype,{destroy:function(){B.ui.dialog.overlay.destroy(this.$el)}})})(jQuery)
\ No newline at end of file
+/*
+ * jQuery UI Dialog 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Dialog
+ *
+ * Depends:
+ *     ui.core.js
+ *     ui.draggable.js
+ *     ui.resizable.js
+ */
+(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||"&nbsp;",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(e){var d=this;if(false===d._trigger("beforeclose",e)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",e)}):d.uiDialog.hide()&&d._trigger("close",e));c.ui.dialog.overlay.resize();d._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||"&nbsp;");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.1",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove()},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e<d){return c(window).height()+"px"}else{return e+"px"}}else{return c(document).height()+"px"}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(d<e){return c(window).width()+"px"}else{return d+"px"}}else{return c(document).width()+"px"}},resize:function(){var d=c([]);c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)});d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
\ No newline at end of file
index 4ab9155646dff17139d4aa8f8ff27aed129c04d6..31ef4ef713e98d3d145bcb3c2bb2cc46dc2e6ec5 100644 (file)
@@ -1 +1,13 @@
-(function(A){A.widget("ui.draggable",A.extend({},A.ui.mouse,{init:function(){var B=this.options;if(B.helper=="original"&&!(/(relative|absolute|fixed)/).test(this.element.css("position"))){this.element.css("position","relative")}this.element.addClass("ui-draggable");(B.disabled&&this.element.addClass("ui-draggable-disabled"));this.mouseInit()},mouseStart:function(F){var H=this.options;if(this.helper||H.disabled||A(F.target).is(".ui-resizable-handle")){return false}var C=!this.options.handle||!A(this.options.handle,this.element).length?true:false;A(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==F.target){C=true}});if(!C){return false}if(A.ui.ddmanager){A.ui.ddmanager.current=this}this.helper=A.isFunction(H.helper)?A(H.helper.apply(this.element[0],[F])):(H.helper=="clone"?this.element.clone():this.element);if(!this.helper.parents("body").length){this.helper.appendTo((H.appendTo=="parent"?this.element[0].parentNode:H.appendTo))}if(this.helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(this.helper.css("position"))){this.helper.css("position","absolute")}this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};this.cssPosition=this.helper.css("position");this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:F.pageX-this.offset.left,top:F.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var B=this.offsetParent.offset();if(this.offsetParent[0]==document.body&&A.browser.mozilla){B={top:0,left:0}}this.offset.parent={top:B.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:B.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};var E=this.element.position();this.offset.relative=this.cssPosition=="relative"?{top:E.top-(parseInt(this.helper.css("top"),10)||0)+this.offsetParent[0].scrollTop,left:E.left-(parseInt(this.helper.css("left"),10)||0)+this.offsetParent[0].scrollLeft}:{top:0,left:0};this.originalPosition=this.generatePosition(F);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(H.cursorAt){if(H.cursorAt.left!=undefined){this.offset.click.left=H.cursorAt.left+this.margins.left}if(H.cursorAt.right!=undefined){this.offset.click.left=this.helperProportions.width-H.cursorAt.right+this.margins.left}if(H.cursorAt.top!=undefined){this.offset.click.top=H.cursorAt.top+this.margins.top}if(H.cursorAt.bottom!=undefined){this.offset.click.top=this.helperProportions.height-H.cursorAt.bottom+this.margins.top}}if(H.containment){if(H.containment=="parent"){H.containment=this.helper[0].parentNode}if(H.containment=="document"||H.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,A(H.containment=="document"?document:window).width()-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(A(H.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(H.containment)){var D=A(H.containment)[0];var G=A(H.containment).offset();this.containment=[G.left+(parseInt(A(D).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left,G.top+(parseInt(A(D).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top,G.left+Math.max(D.scrollWidth,D.offsetWidth)-(parseInt(A(D).css("borderLeftWidth"),10)||0)-this.offset.relative.left-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),G.top+Math.max(D.scrollHeight,D.offsetHeight)-(parseInt(A(D).css("borderTopWidth"),10)||0)-this.offset.relative.top-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}}this.propagate("start",F);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(A.ui.ddmanager&&!H.dropBehaviour){A.ui.ddmanager.prepareOffsets(this,F)}this.helper.addClass("ui-draggable-dragging");this.mouseDrag(F);return true},convertPositionTo:function(C,D){if(!D){D=this.position}var B=C=="absolute"?1:-1;return{top:(D.top+this.offset.relative.top*B+this.offset.parent.top*B-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)*B+(this.cssPosition=="fixed"?A(document).scrollTop():0)*B+this.margins.top*B),left:(D.left+this.offset.relative.left*B+this.offset.parent.left*B-(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)*B+(this.cssPosition=="fixed"?A(document).scrollLeft():0)*B+this.margins.left*B)}},generatePosition:function(E){var F=this.options;var B={top:(E.pageY-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollTop)-(this.cssPosition=="fixed"?A(document).scrollTop():0)),left:(E.pageX-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"||(this.cssPosition=="absolute"&&this.offsetParent[0]==document.body)?0:this.offsetParent[0].scrollLeft)-(this.cssPosition=="fixed"?A(document).scrollLeft():0))};if(!this.originalPosition){return B}if(this.containment){if(B.left<this.containment[0]){B.left=this.containment[0]}if(B.top<this.containment[1]){B.top=this.containment[1]}if(B.left>this.containment[2]){B.left=this.containment[2]}if(B.top>this.containment[3]){B.top=this.containment[3]}}if(F.grid){var D=this.originalPosition.top+Math.round((B.top-this.originalPosition.top)/F.grid[1])*F.grid[1];B.top=this.containment?(!(D<this.containment[1]||D>this.containment[3])?D:(!(D<this.containment[1])?D-F.grid[1]:D+F.grid[1])):D;var C=this.originalPosition.left+Math.round((B.left-this.originalPosition.left)/F.grid[0])*F.grid[0];B.left=this.containment?(!(C<this.containment[0]||C>this.containment[2])?C:(!(C<this.containment[0])?C-F.grid[0]:C+F.grid[0])):C}return B},mouseDrag:function(B){this.position=this.generatePosition(B);this.positionAbs=this.convertPositionTo("absolute");this.position=this.propagate("drag",B)||this.position;if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(A.ui.ddmanager){A.ui.ddmanager.drag(this,B)}return false},mouseStop:function(C){var D=false;if(A.ui.ddmanager&&!this.options.dropBehaviour){var D=A.ui.ddmanager.drop(this,C)}if((this.options.revert=="invalid"&&!D)||(this.options.revert=="valid"&&D)||this.options.revert===true){var B=this;A(this.helper).animate(this.originalPosition,parseInt(this.options.revert,10)||500,function(){B.propagate("stop",C);B.clear()})}else{this.propagate("stop",C);this.clear()}return false},clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.options.helper!="original"&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},plugins:{},uiHash:function(B){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,options:this.options}},propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.uiHash()]);if(C=="drag"){this.positionAbs=this.convertPositionTo("absolute")}return this.element.triggerHandler(C=="drag"?C:"drag"+C,[B,this.uiHash()],this.options[C])},destroy:function(){if(!this.element.data("draggable")){return }this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable");this.mouseDestroy()}}));A.extend(A.ui.draggable,{defaults:{appendTo:"parent",axis:false,cancel:":input",delay:0,distance:1,helper:"original"}});A.ui.plugin.add("draggable","cursor",{start:function(D,C){var B=A("body");if(B.css("cursor")){C.options._cursor=B.css("cursor")}B.css("cursor",C.options.cursor)},stop:function(C,B){if(B.options._cursor){A("body").css("cursor",B.options._cursor)}}});A.ui.plugin.add("draggable","zIndex",{start:function(D,C){var B=A(C.helper);if(B.css("zIndex")){C.options._zIndex=B.css("zIndex")}B.css("zIndex",C.options.zIndex)},stop:function(C,B){if(B.options._zIndex){A(B.helper).css("zIndex",B.options._zIndex)}}});A.ui.plugin.add("draggable","opacity",{start:function(D,C){var B=A(C.helper);if(B.css("opacity")){C.options._opacity=B.css("opacity")}B.css("opacity",C.options.opacity)},stop:function(C,B){if(B.options._opacity){A(B.helper).css("opacity",B.options._opacity)}}});A.ui.plugin.add("draggable","iframeFix",{start:function(C,B){A(B.options.iframeFix===true?"iframe":B.options.iframeFix).each(function(){A('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(A(this).offset()).appendTo("body")})},stop:function(C,B){A("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this)})}});A.ui.plugin.add("draggable","scroll",{start:function(D,C){var E=C.options;var B=A(this).data("draggable");E.scrollSensitivity=E.scrollSensitivity||20;E.scrollSpeed=E.scrollSpeed||20;B.overflowY=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-y"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);B.overflowX=function(F){do{if(/auto|scroll/.test(F.css("overflow"))||(/auto|scroll/).test(F.css("overflow-x"))){return F}F=F.parent()}while(F[0].parentNode);return A(document)}(this);if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){B.overflowYOffset=B.overflowY.offset()}if(B.overflowX[0]!=document&&B.overflowX[0].tagName!="HTML"){B.overflowXOffset=B.overflowX.offset()}},drag:function(D,C){var E=C.options;var B=A(this).data("draggable");if(B.overflowY[0]!=document&&B.overflowY[0].tagName!="HTML"){if((B.overflowYOffset.top+B.overflowY[0].offsetHeight)-D.pageY<E.scrollSensitivity){B.overflowY[0].scrollTop=B.overflowY[0].scrollTop+E.scrollSpeed}if(D.pageY-B.overflowYOffset.top<E.scrollSensitivity){B.overflowY[0].scrollTop=B.overflowY[0].scrollTop-E.scrollSpeed}}else{if(D.pageY-A(document).scrollTop()<E.scrollSensitivity){A(document).scrollTop(A(document).scrollTop()-E.scrollSpeed)}if(A(window).height()-(D.pageY-A(document).scrollTop())<E.scrollSensitivity){A(document).scrollTop(A(document).scrollTop()+E.scrollSpeed)}}if(B.overflowX[0]!=document&&B.overflowX[0].tagName!="HTML"){if((B.overflowXOffset.left+B.overflowX[0].offsetWidth)-D.pageX<E.scrollSensitivity){B.overflowX[0].scrollLeft=B.overflowX[0].scrollLeft+E.scrollSpeed}if(D.pageX-B.overflowXOffset.left<E.scrollSensitivity){B.overflowX[0].scrollLeft=B.overflowX[0].scrollLeft-E.scrollSpeed}}else{if(D.pageX-A(document).scrollLeft()<E.scrollSensitivity){A(document).scrollLeft(A(document).scrollLeft()-E.scrollSpeed)}if(A(window).width()-(D.pageX-A(document).scrollLeft())<E.scrollSensitivity){A(document).scrollLeft(A(document).scrollLeft()+E.scrollSpeed)}}}});A.ui.plugin.add("draggable","snap",{start:function(D,C){var B=A(this).data("draggable");B.snapElements=[];A(C.options.snap===true?".ui-draggable":C.options.snap).each(function(){var F=A(this);var E=F.offset();if(this!=B.element[0]){B.snapElements.push({item:this,width:F.outerWidth(),height:F.outerHeight(),top:E.top,left:E.left})}})},drag:function(J,N){var I=A(this).data("draggable");var L=N.options.snapTolerance||20;var D=N.absolutePosition.left,C=D+I.helperProportions.width,P=N.absolutePosition.top,O=P+I.helperProportions.height;for(var H=I.snapElements.length-1;H>=0;H--){var E=I.snapElements[H].left,B=E+I.snapElements[H].width,R=I.snapElements[H].top,M=R+I.snapElements[H].height;if(!((E-L<D&&D<B+L&&R-L<P&&P<M+L)||(E-L<D&&D<B+L&&R-L<O&&O<M+L)||(E-L<C&&C<B+L&&R-L<P&&P<M+L)||(E-L<C&&C<B+L&&R-L<O&&O<M+L))){continue}if(N.options.snapMode!="inner"){var K=Math.abs(R-O)<=20;var Q=Math.abs(M-P)<=20;var G=Math.abs(E-C)<=20;var F=Math.abs(B-D)<=20;if(K){N.position.top=I.convertPositionTo("relative",{top:R-I.helperProportions.height,left:0}).top}if(Q){N.position.top=I.convertPositionTo("relative",{top:M,left:0}).top}if(G){N.position.left=I.convertPositionTo("relative",{top:0,left:E-I.helperProportions.width}).left}if(F){N.position.left=I.convertPositionTo("relative",{top:0,left:B}).left}}if(N.options.snapMode!="outer"){var K=Math.abs(R-P)<=20;var Q=Math.abs(M-O)<=20;var G=Math.abs(E-D)<=20;var F=Math.abs(B-C)<=20;if(K){N.position.top=I.convertPositionTo("relative",{top:R,left:0}).top}if(Q){N.position.top=I.convertPositionTo("relative",{top:M-I.helperProportions.height,left:0}).top}if(G){N.position.left=I.convertPositionTo("relative",{top:0,left:E}).left}if(F){N.position.left=I.convertPositionTo("relative",{top:0,left:B-I.helperProportions.width}).left}}}}});A.ui.plugin.add("draggable","connectToSortable",{start:function(D,C){var B=A(this).data("draggable");B.sortables=[];A(C.options.connectToSortable).each(function(){if(A.data(this,"sortable")){var E=A.data(this,"sortable");B.sortables.push({instance:E,shouldRevert:E.options.revert});E.refreshItems();E.propagate("activate",D,B)}})},stop:function(D,C){var B=A(this).data("draggable");A.each(B.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;B.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance.mouseStop(D);this.instance.element.triggerHandler("sortreceive",[D,A.extend(this.instance.ui(),{sender:B.element})],this.instance.options["receive"]);this.instance.options.helper=this.instance.options._helper}else{this.instance.propagate("deactivate",D,B)}})},drag:function(F,E){var D=A(this).data("draggable"),B=this;var C=function(K){var H=K.left,J=H+K.width,I=K.top,G=I+K.height;return(H<(this.positionAbs.left+this.offset.click.left)&&(this.positionAbs.left+this.offset.click.left)<J&&I<(this.positionAbs.top+this.offset.click.top)&&(this.positionAbs.top+this.offset.click.top)<G)};A.each(D.sortables,function(G){if(C.call(D,this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=A(B).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return E.helper[0]};F.target=this.instance.currentItem[0];this.instance.mouseCapture(F,true);this.instance.mouseStart(F,true,true);this.instance.offset.click.top=D.offset.click.top;this.instance.offset.click.left=D.offset.click.left;this.instance.offset.parent.left-=D.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=D.offset.parent.top-this.instance.offset.parent.top;D.propagate("toSortable",F)}if(this.instance.currentItem){this.instance.mouseDrag(F)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance.mouseStop(F,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}D.propagate("fromSortable",F)}}})}});A.ui.plugin.add("draggable","stack",{start:function(D,B){var C=A.makeArray(A(B.options.stack.group)).sort(function(F,E){return(parseInt(A(F).css("zIndex"),10)||B.options.stack.min)-(parseInt(A(E).css("zIndex"),10)||B.options.stack.min)});A(C).each(function(E){this.style.zIndex=B.options.stack.min+E});this[0].style.zIndex=B.options.stack.min+C.length}})})(jQuery)
\ No newline at end of file
+/*
+ * jQuery UI Draggable 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Draggables
+ *
+ * Depends:
+ *     ui.core.js
+ */
+(function(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.position}if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}if(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false},_trigger:function(b,c,d){d=d||this._uiHash();a.ui.plugin.call(this,b,[c,d]);if(b=="drag"){this.positionAbs=this._convertPositionTo("absolute")}return a.widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(b){return{helper:this.helper,position:this.position,absolutePosition:this.positionAbs,offset:this.positionAbs}}}));a.extend(a.ui.draggable,{version:"1.7.1",eventPrefix:"drag",defaults:{addClasses:true,appendTo:"parent",axis:false,cancel:":input,option",connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false}});a.ui.plugin.add("draggable","connectToSortable",{start:function(c,e){var d=a(this).data("draggable"),f=d.options,b=a.extend({},e,{item:d.element});d.sortables=[];a(f.connectToSortable).each(function(){var g=a.data(this,"sortable");if(g&&!g.options.disabled){d.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",c,b)}})},stop:function(c,e){var d=a(this).data("draggable"),b=a.extend({},e,{item:d.element});a.each(d.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;d.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=true}this.instance._mouseStop(c);this.instance.options.helper=this.instance.options._helper;if(d.options.helper=="original"){this.instance.currentItem.css({top:"auto",left:"auto"})}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",c,b)}})},drag:function(c,f){var e=a(this).data("draggable"),b=this;var d=function(i){var n=this.offset.click.top,m=this.offset.click.left;var g=this.positionAbs.top,k=this.positionAbs.left;var j=i.height,l=i.width;var p=i.top,h=i.left;return a.ui.isOver(g+n,k+m,p,h,j,l)};a.each(e.sortables,function(g){this.instance.positionAbs=e.positionAbs;this.instance.helperProportions=e.helperProportions;this.instance.offset.click=e.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=a(b).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return f.helper[0]};c.target=this.instance.currentItem[0];this.instance._mouseCapture(c,true);this.instance._mouseStart(c,true,true);this.instance.offset.click.top=e.offset.click.top;this.instance.offset.click.left=e.offset.click.left;this.instance.offset.parent.left-=e.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=e.offset.parent.top-this.instance.offset.parent.top;e._trigger("toSortable",c);e.dropped=this.instance.element;e.currentItem=e.element;this.instance.fromOutside=e}if(this.instance.currentItem){this.instance._mouseDrag(c)}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",c,this.instance._uiHash(this.instance));this.instance._mouseStop(c,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove()}e._trigger("fromSortable",c);e.dropped=false}}})}});a.ui.plugin.add("draggable","cursor",{start:function(c,d){var b=a("body"),e=a(this).data("draggable").options;if(b.css("cursor")){e._cursor=b.css("cursor")}b.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._cursor){a("body").css("cursor",d._cursor)}}});a.ui.plugin.add("draggable","iframeFix",{start:function(b,c){var d=a(this).data("draggable").options;a(d.iframeFix===true?"iframe":d.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop+f.scrollSpeed}else{if(d.pageY-c.overflowOffset.top<f.scrollSensitivity){c.scrollParent[0].scrollTop=b=c.scrollParent[0].scrollTop-f.scrollSpeed}}}if(!f.axis||f.axis!="y"){if((c.overflowOffset.left+c.scrollParent[0].offsetWidth)-d.pageX<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft+f.scrollSpeed}else{if(d.pageX-c.overflowOffset.left<f.scrollSensitivity){c.scrollParent[0].scrollLeft=b=c.scrollParent[0].scrollLeft-f.scrollSpeed}}}}else{if(!f.axis||f.axis!="x"){if(d.pageY-a(document).scrollTop()<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-f.scrollSpeed)}else{if(a(window).height()-(d.pageY-a(document).scrollTop())<f.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+f.scrollSpeed)}}}if(!f.axis||f.axis!="y"){if(d.pageX-a(document).scrollLeft()<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-f.scrollSpeed)}else{if(a(window).width()-(d.pageX-a(document).scrollLeft())<f.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+f.scrollSpeed)}}}}if(b!==false&&a.ui.ddmanager&&!f.dropBehaviour){a.ui.ddmanager.prepareOffsets(c,d)}}});a.ui.plugin.add("draggable","snap",{start:function(c,d){var b=a(this).data("draggable"),e=b.options;b.snapElements=[];a(e.snap.constructor!=String?(e.snap.items||":data(draggable)"):e.snap).each(function(){var g=a(this);var f=g.offset();if(this!=b.element[0]){b.snapElements.push({item:this,width:g.outerWidth(),height:g.outerHeight(),top:f.top,left:f.left})}})},drag:function(u,p){var g=a(this).data("draggable"),q=g.options;var y=q.snapTolerance;var x=p.offset.left,w=x+g.helperProportions.width,f=p.offset.top,e=f+g.helperProportions.height;for(var v=g.snapElements.length-1;v>=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y<x&&x<n+y&&m-y<f&&f<A+y)||(s-y<x&&x<n+y&&m-y<e&&e<A+y)||(s-y<w&&w<n+y&&m-y<f&&f<A+y)||(s-y<w&&w<n+y&&m-y<e&&e<A+y))){if(g.snapElements[v].snapping){(g.options.snap.release&&g.options.snap.release.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=false;continue}if(q.snapMode!="inner"){var c=Math.abs(m-e)<=y;var z=Math.abs(A-f)<=y;var j=Math.abs(s-w)<=y;var k=Math.abs(n-x)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m-g.helperProportions.height,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s-g.helperProportions.width}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n}).left-g.margins.left}}var h=(c||z||j||k);if(q.snapMode!="outer"){var c=Math.abs(m-f)<=y;var z=Math.abs(A-e)<=y;var j=Math.abs(s-x)<=y;var k=Math.abs(n-w)<=y;if(c){p.position.top=g._convertPositionTo("relative",{top:m,left:0}).top-g.margins.top}if(z){p.position.top=g._convertPositionTo("relative",{top:A-g.helperProportions.height,left:0}).top-g.margins.top}if(j){p.position.left=g._convertPositionTo("relative",{top:0,left:s}).left-g.margins.left}if(k){p.position.left=g._convertPositionTo("relative",{top:0,left:n-g.helperProportions.width}).left-g.margins.left}}if(!g.snapElements[v].snapping&&(c||z||j||k||h)){(g.options.snap.snap&&g.options.snap.snap.call(g.element,u,a.extend(g._uiHash(),{snapItem:g.snapElements[v].item})))}g.snapElements[v].snapping=(c||z||j||k||h)}}});a.ui.plugin.add("draggable","stack",{start:function(b,c){var e=a(this).data("draggable").options;var d=a.makeArray(a(e.stack.group)).sort(function(g,f){return(parseInt(a(g).css("zIndex"),10)||e.stack.min)-(parseInt(a(f).css("zIndex"),10)||e.stack.min)});a(d).each(function(f){this.style.zIndex=e.stack.min+f});this[0].style.zIndex=e.stack.min+d.length}});a.ui.plugin.add("draggable","zIndex",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("zIndex")){e._zIndex=b.css("zIndex")}b.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._zIndex){a(c.helper).css("zIndex",d._zIndex)}}})})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jquery/ui.droppable.js b/wp-includes/js/jquery/ui.droppable.js
new file mode 100644 (file)
index 0000000..5845961
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * jQuery UI Droppable 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Droppables
+ *
+ * Depends:
+ *     ui.core.js
+ *     ui.draggable.js
+ */
+(function(a){a.widget("ui.droppable",{_init:function(){var c=this.options,b=c.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&a.isFunction(this.options.accept)?this.options.accept:function(e){return e.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};a.ui.ddmanager.droppables[this.options.scope]=a.ui.ddmanager.droppables[this.options.scope]||[];a.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"))},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++){if(b[c]==this){b.splice(c,1)}}this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable")},_setData:function(b,c){if(b=="accept"){this.options.accept=c&&a.isFunction(c)?c:function(e){return e.is(c)}}else{a.widget.prototype._setData.apply(this,arguments)}},_activate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass)}(b&&this._trigger("activate",c,this.ui(b)))},_deactivate:function(c){var b=a.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}(b&&this._trigger("deactivate",c,this.ui(b)))},_over:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass)}this._trigger("over",c,this.ui(b))}},_out:function(c){var b=a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("out",c,this.ui(b))}},_drop:function(c,d){var b=d||a.ui.ddmanager.current;if(!b||(b.currentItem||b.element)[0]==this.element[0]){return false}var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var f=a.data(this,"droppable");if(f.options.greedy&&a.ui.intersect(b,a.extend(f,{offset:f.element.offset()}),f.options.tolerance)){e=true;return false}});if(e){return false}if(this.options.accept.call(this.element[0],(b.currentItem||b.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass)}if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass)}this._trigger("drop",c,this.ui(b));return this.element}return false},ui:function(b){return{draggable:(b.currentItem||b.element),helper:b.helper,position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs}}});a.extend(a.ui.droppable,{version:"1.7.1",eventPrefix:"drop",defaults:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"}});a.ui.intersect=function(q,j,o){if(!j.offset){return false}var e=(q.positionAbs||q.position.absolute).left,d=e+q.helperProportions.width,n=(q.positionAbs||q.position.absolute).top,m=n+q.helperProportions.height;var g=j.offset.left,c=g+j.proportions.width,p=j.offset.top,k=p+j.proportions.height;switch(o){case"fit":return(g<e&&d<c&&p<n&&m<k);break;case"intersect":return(g<e+(q.helperProportions.width/2)&&d-(q.helperProportions.width/2)<c&&p<n+(q.helperProportions.height/2)&&m-(q.helperProportions.height/2)<k);break;case"pointer":var h=((q.positionAbs||q.position.absolute).left+(q.clickOffset||q.offset.click).left),i=((q.positionAbs||q.position.absolute).top+(q.clickOffset||q.offset.click).top),f=a.ui.isOver(i,h,p,g,j.proportions.height,j.proportions.width);return f;break;case"touch":return((n>=p&&n<=k)||(m>=p&&m<=k)||(n<p&&m>k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e<g&&d>c));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d<b.length;d++){if(b[d].options.disabled||(e&&!b[d].options.accept.call(b[d].element[0],(e.currentItem||e.element)))){continue}for(var c=0;c<h.length;c++){if(h[c]==b[d].element[0]){b[d].proportions.height=0;continue droppablesLoop}}b[d].visible=b[d].element.css("display")!="none";if(!b[d].visible){continue}b[d].offset=b[d].element.offset();b[d].proportions={width:b[d].element[0].offsetWidth,height:b[d].element[0].offsetHeight};if(f=="mousedown"){b[d]._activate.call(b[d],g)}}},drop:function(b,c){var d=false;a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(!this.options){return}if(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)){d=this._drop.call(this,c)}if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(b.currentItem||b.element))){this.isout=1;this.isover=0;this._deactivate.call(this,c)}});return d},drag:function(b,c){if(b.options.refreshPositions){a.ui.ddmanager.prepareOffsets(b,c)}a.each(a.ui.ddmanager.droppables[b.options.scope],function(){if(this.options.disabled||this.greedyChild||!this.visible){return}var e=a.ui.intersect(b,this,this.options.tolerance);var g=!e&&this.isover==1?"isout":(e&&this.isover==0?"isover":null);if(!g){return}var f;if(this.options.greedy){var d=this.element.parents(":data(droppable):eq(0)");if(d.length){f=a.data(d[0],"droppable");f.greedyChild=(g=="isover"?1:0)}}if(f&&g=="isover"){f.isover=0;f.isout=1;f._out.call(f,c)}this[g]=1;this[g=="isout"?"isover":"isout"]=0;this[g=="isover"?"_over":"_out"].call(this,c);if(f&&g=="isout"){f.isout=0;f.isover=1;f._over.call(f,c)}})}}})(jQuery);
\ No newline at end of file
index 423328ee32bbcfb74c5b078c23fb0f256e1a9af8..aa2f487753acfab004f258470633d54b00773c2e 100644 (file)
@@ -1 +1,13 @@
-(function(A){A.widget("ui.resizable",A.extend({},A.ui.mouse,{init:function(){var M=this,N=this.options;var Q=this.element.css("position");this.originalElement=this.element;this.element.addClass("ui-resizable").css({position:/static/.test(Q)?"relative":Q});A.extend(N,{_aspectRatio:!!(N.aspectRatio),helper:N.helper||N.ghost||N.animate?N.helper||"proxy":null,knobHandles:N.knobHandles===true?"ui-resizable-knob-handle":N.knobHandles});var H="1px solid #DEDEDE";N.defaultTheme={"ui-resizable":{display:"block"},"ui-resizable-handle":{position:"absolute",background:"#F2F2F2",fontSize:"0.1px"},"ui-resizable-n":{cursor:"n-resize",height:"4px",left:"0px",right:"0px",borderTop:H},"ui-resizable-s":{cursor:"s-resize",height:"4px",left:"0px",right:"0px",borderBottom:H},"ui-resizable-e":{cursor:"e-resize",width:"4px",top:"0px",bottom:"0px",borderRight:H},"ui-resizable-w":{cursor:"w-resize",width:"4px",top:"0px",bottom:"0px",borderLeft:H},"ui-resizable-se":{cursor:"se-resize",width:"4px",height:"4px",borderRight:H,borderBottom:H},"ui-resizable-sw":{cursor:"sw-resize",width:"4px",height:"4px",borderBottom:H,borderLeft:H},"ui-resizable-ne":{cursor:"ne-resize",width:"4px",height:"4px",borderRight:H,borderTop:H},"ui-resizable-nw":{cursor:"nw-resize",width:"4px",height:"4px",borderLeft:H,borderTop:H}};N.knobTheme={"ui-resizable-handle":{background:"#F2F2F2",border:"1px solid #808080",height:"8px",width:"8px"},"ui-resizable-n":{cursor:"n-resize",top:"0px",left:"45%"},"ui-resizable-s":{cursor:"s-resize",bottom:"0px",left:"45%"},"ui-resizable-e":{cursor:"e-resize",right:"0px",top:"45%"},"ui-resizable-w":{cursor:"w-resize",left:"0px",top:"45%"},"ui-resizable-se":{cursor:"se-resize",right:"0px",bottom:"0px"},"ui-resizable-sw":{cursor:"sw-resize",left:"0px",bottom:"0px"},"ui-resizable-nw":{cursor:"nw-resize",left:"0px",top:"0px"},"ui-resizable-ne":{cursor:"ne-resize",right:"0px",top:"0px"}};N._nodeName=this.element[0].nodeName;if(N._nodeName.match(/canvas|textarea|input|select|button|img/i)){var B=this.element;if(/relative/.test(B.css("position"))&&A.browser.opera){B.css({position:"relative",top:"auto",left:"auto"})}B.wrap(A('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:B.css("position"),width:B.outerWidth(),height:B.outerHeight(),top:B.css("top"),left:B.css("left")}));var J=this.element;this.element=this.element.parent();this.element.data("resizable",this);this.element.css({marginLeft:J.css("marginLeft"),marginTop:J.css("marginTop"),marginRight:J.css("marginRight"),marginBottom:J.css("marginBottom")});J.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});if(A.browser.safari&&N.preventDefault){J.css("resize","none")}N.proportionallyResize=J.css({position:"static",zoom:1,display:"block"});this.element.css({margin:J.css("margin")});this._proportionallyResize()}if(!N.handles){N.handles=!A(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}}if(N.handles.constructor==String){N.zIndex=N.zIndex||1000;if(N.handles=="all"){N.handles="n,e,s,w,se,sw,ne,nw"}var O=N.handles.split(",");N.handles={};var G={handle:"position: absolute; display: none; overflow:hidden;",n:"top: 0pt; width:100%;",e:"right: 0pt; height:100%;",s:"bottom: 0pt; width:100%;",w:"left: 0pt; height:100%;",se:"bottom: 0pt; right: 0px;",sw:"bottom: 0pt; left: 0px;",ne:"top: 0pt; right: 0px;",nw:"top: 0pt; left: 0px;"};for(var R=0;R<O.length;R++){var S=A.trim(O[R]),L=N.defaultTheme,F="ui-resizable-"+S,C=!A.ui.css(F)&&!N.knobHandles,P=A.ui.css("ui-resizable-knob-handle"),T=A.extend(L[F],L["ui-resizable-handle"]),D=A.extend(N.knobTheme[F],!P?N.knobTheme["ui-resizable-handle"]:{});var K=/sw|se|ne|nw/.test(S)?{zIndex:++N.zIndex}:{};var I=(C?G[S]:""),E=A(['<div class="ui-resizable-handle ',F,'" style="',I,G.handle,'"></div>'].join("")).css(K);N.handles[S]=".ui-resizable-"+S;this.element.append(E.css(C?T:{}).css(N.knobHandles?D:{}).addClass(N.knobHandles?"ui-resizable-knob-handle":"").addClass(N.knobHandles))}if(N.knobHandles){this.element.addClass("ui-resizable-knob").css(!A.ui.css("ui-resizable-knob")?{}:{})}}this._renderAxis=function(Y){Y=Y||this.element;for(var V in N.handles){if(N.handles[V].constructor==String){N.handles[V]=A(N.handles[V],this.element).show()}if(N.transparent){N.handles[V].css({opacity:0})}if(this.element.is(".ui-wrapper")&&N._nodeName.match(/textarea|input|select|button/i)){var W=A(N.handles[V],this.element),X=0;X=/sw|ne|nw|se|n|s/.test(V)?W.outerHeight():W.outerWidth();var U=["padding",/ne|nw|n/.test(V)?"Top":/se|sw|s/.test(V)?"Bottom":/^e$/.test(V)?"Right":"Left"].join("");if(!N.transparent){Y.css(U,X)}this._proportionallyResize()}if(!A(N.handles[V]).length){continue}}};this._renderAxis(this.element);N._handles=A(".ui-resizable-handle",M.element);if(N.disableSelection){N._handles.each(function(U,V){A.ui.disableSelection(V)})}N._handles.mouseover(function(){if(!N.resizing){if(this.className){var U=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}M.axis=N.axis=U&&U[1]?U[1]:"se"}});if(N.autoHide){N._handles.hide();A(M.element).addClass("ui-resizable-autohide").hover(function(){A(this).removeClass("ui-resizable-autohide");N._handles.show()},function(){if(!N.resizing){A(this).addClass("ui-resizable-autohide");N._handles.hide()}})}this.mouseInit()},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,options:this.options,originalSize:this.originalSize,originalPosition:this.originalPosition}},propagate:function(C,B){A.ui.plugin.call(this,C,[B,this.ui()]);if(C!="resize"){this.element.triggerHandler(["resize",C].join(""),[B,this.ui()],this.options[C])}},destroy:function(){var D=this.element,C=D.children(".ui-resizable").get(0);this.mouseDestroy();var B=function(E){A(E).removeClass("ui-resizable ui-resizable-disabled").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};B(D);if(D.is(".ui-wrapper")&&C){D.parent().append(A(C).css({position:D.css("position"),width:D.outerWidth(),height:D.outerHeight(),top:D.css("top"),left:D.css("left")})).end().remove();B(C)}},mouseStart:function(K){if(this.options.disabled){return false}var J=false;for(var H in this.options.handles){if(A(this.options.handles[H])[0]==K.target){J=true}}if(!J){return false}var C=this.options,B=this.element.position(),D=this.element,I=function(O){return parseInt(O,10)||0},G=A.browser.msie&&A.browser.version<7;C.resizing=true;C.documentScroll={top:A(document).scrollTop(),left:A(document).scrollLeft()};if(D.is(".ui-draggable")||(/absolute/).test(D.css("position"))){var M=A.browser.msie&&!C.containment&&(/absolute/).test(D.css("position"))&&!(/relative/).test(D.parent().css("position"));var L=M?C.documentScroll.top:0,F=M?C.documentScroll.left:0;D.css({position:"absolute",top:(B.top+L),left:(B.left+F)})}if(A.browser.opera&&/relative/.test(D.css("position"))){D.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var N=I(this.helper.css("left")),E=I(this.helper.css("top"));if(C.containment){N+=A(C.containment).scrollLeft()||0;E+=A(C.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:N,top:E};this.size=C.helper||G?{width:D.outerWidth(),height:D.outerHeight()}:{width:D.width(),height:D.height()};this.originalSize=C.helper||G?{width:D.outerWidth(),height:D.outerHeight()}:{width:D.width(),height:D.height()};this.originalPosition={left:N,top:E};this.sizeDiff={width:D.outerWidth()-D.width(),height:D.outerHeight()-D.height()};this.originalMousePosition={left:K.pageX,top:K.pageY};C.aspectRatio=(typeof C.aspectRatio=="number")?C.aspectRatio:((this.originalSize.height/this.originalSize.width)||1);if(C.preserveCursor){A("body").css("cursor",this.axis+"-resize")}this.propagate("start",K);return true},mouseDrag:function(I){var D=this.helper,C=this.options,J={},M=this,F=this.originalMousePosition,K=this.axis;var N=(I.pageX-F.left)||0,L=(I.pageY-F.top)||0;var E=this._change[K];if(!E){return false}var H=E.apply(this,[I,N,L]),G=A.browser.msie&&A.browser.version<7,B=this.sizeDiff;if(C._aspectRatio||I.shiftKey){H=this._updateRatio(H,I)}H=this._respectSize(H,I);this.propagate("resize",I);D.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!C.helper&&C.proportionallyResize){this._proportionallyResize()}this._updateCache(H);this.element.triggerHandler("resize",[I,this.ui()],this.options["resize"]);return false},mouseStop:function(I){this.options.resizing=false;var E=this.options,H=function(M){return parseInt(M,10)||0},K=this;if(E.helper){var D=E.proportionallyResize,B=D&&(/textarea/i).test(D.get(0).nodeName),C=B&&A.ui.hasScroll(D.get(0),"left")?0:K.sizeDiff.height,G=B?0:K.sizeDiff.width;var L={width:(K.size.width-G),height:(K.size.height-C)},F=(parseInt(K.element.css("left"),10)+(K.position.left-K.originalPosition.left))||null,J=(parseInt(K.element.css("top"),10)+(K.position.top-K.originalPosition.top))||null;if(!E.animate){this.element.css(A.extend(L,{top:J,left:F}))}if(E.helper&&!E.animate){this._proportionallyResize()}}if(E.preserveCursor){A("body").css("cursor","auto")}this.propagate("stop",I);if(E.helper){this.helper.remove()}return false},_updateCache:function(B){var C=this.options;this.offset=this.helper.offset();if(B.left){this.position.left=B.left}if(B.top){this.position.top=B.top}if(B.height){this.size.height=B.height}if(B.width){this.size.width=B.width}},_updateRatio:function(D,E){var F=this.options,G=this.position,C=this.size,B=this.axis;if(D.height){D.width=(C.height/F.aspectRatio)}else{if(D.width){D.height=(C.width*F.aspectRatio)}}if(B=="sw"){D.left=G.left+(C.width-D.width);D.top=null}if(B=="nw"){D.top=G.top+(C.height-D.height);D.left=G.left+(C.width-D.width)}return D},_respectSize:function(H,I){var F=this.helper,E=this.options,N=E._aspectRatio||I.shiftKey,M=this.axis,P=H.width&&E.maxWidth&&E.maxWidth<H.width,J=H.height&&E.maxHeight&&E.maxHeight<H.height,D=H.width&&E.minWidth&&E.minWidth>H.width,O=H.height&&E.minHeight&&E.minHeight>H.height;if(D){H.width=E.minWidth}if(O){H.height=E.minHeight}if(P){H.width=E.maxWidth}if(J){H.height=E.maxHeight}var C=this.originalPosition.left+this.originalSize.width,L=this.position.top+this.size.height;var G=/sw|nw|w/.test(M),B=/nw|ne|n/.test(M);if(D&&G){H.left=C-E.minWidth}if(P&&G){H.left=C-E.maxWidth}if(O&&B){H.top=L-E.minHeight}if(J&&B){H.top=L-E.maxHeight}var K=!H.width&&!H.height;if(K&&!H.left&&H.top){H.top=null}else{if(K&&!H.top&&H.left){H.left=null}}return H},_proportionallyResize:function(){var F=this.options;if(!F.proportionallyResize){return }var D=F.proportionallyResize,C=this.helper||this.element;if(!F.borderDif){var B=[D.css("borderTopWidth"),D.css("borderRightWidth"),D.css("borderBottomWidth"),D.css("borderLeftWidth")],E=[D.css("paddingTop"),D.css("paddingRight"),D.css("paddingBottom"),D.css("paddingLeft")];F.borderDif=A.map(B,function(G,I){var H=parseInt(G,10)||0,J=parseInt(E[I],10)||0;return H+J})}D.css({height:(C.height()-F.borderDif[0]-F.borderDif[2])+"px",width:(C.width()-F.borderDif[1]-F.borderDif[3])+"px"})},_renderProxy:function(){var C=this.element,F=this.options;this.elementOffset=C.offset();if(F.helper){this.helper=this.helper||A('<div style="overflow:hidden;"></div>');var B=A.browser.msie&&A.browser.version<7,D=(B?1:0),E=(B?2:-1);this.helper.addClass(F.helper).css({width:C.outerWidth()+E,height:C.outerHeight()+E,position:"absolute",left:this.elementOffset.left-D+"px",top:this.elementOffset.top-D+"px",zIndex:++F.zIndex});this.helper.appendTo("body");if(F.disableSelection){A.ui.disableSelection(this.helper.get(0))}}else{this.helper=C}},_change:{e:function(D,C,B){return{width:this.originalSize.width+C}},w:function(F,C,B){var G=this.options,D=this.originalSize,E=this.originalPosition;return{left:E.left+C,width:D.width-C}},n:function(F,C,B){var G=this.options,D=this.originalSize,E=this.originalPosition;return{top:E.top+B,height:D.height-B}},s:function(D,C,B){return{height:this.originalSize.height+B}},se:function(D,C,B){return A.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[D,C,B]))},sw:function(D,C,B){return A.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[D,C,B]))},ne:function(D,C,B){return A.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[D,C,B]))},nw:function(D,C,B){return A.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[D,C,B]))}}}));A.extend(A.ui.resizable,{defaults:{cancel:":input",distance:1,delay:0,preventDefault:true,transparent:false,minWidth:10,minHeight:10,aspectRatio:false,disableSelection:true,preserveCursor:true,autoHide:false,knobHandles:false}});A.ui.plugin.add("resizable","containment",{start:function(I,K){var E=K.options,M=A(this).data("resizable"),G=M.element;var C=E.containment,F=(C instanceof A)?C.get(0):(/parent/.test(C))?G.parent().get(0):C;if(!F){return }M.containerElement=A(F);if(/document/.test(C)||C==document){M.containerOffset={left:0,top:0};M.containerPosition={left:0,top:0};M.parentData={element:A(document),left:0,top:0,width:A(document).width(),height:A(document).height()||document.body.parentNode.scrollHeight}}else{M.containerOffset=A(F).offset();M.containerPosition=A(F).position();M.containerSize={height:A(F).innerHeight(),width:A(F).innerWidth()};var J=M.containerOffset,B=M.containerSize.height,H=M.containerSize.width,D=(A.ui.hasScroll(F,"left")?F.scrollWidth:H),L=(A.ui.hasScroll(F)?F.scrollHeight:B);M.parentData={element:F,left:J.left,top:J.top,width:D,height:L}}},resize:function(H,K){var E=K.options,N=A(this).data("resizable"),C=N.containerSize,J=N.containerOffset,G=N.size,I=N.position,L=E._aspectRatio||H.shiftKey,B={top:0,left:0},D=N.containerElement;if(D[0]!=document&&/static/.test(D.css("position"))){B=N.containerPosition}if(I.left<(E.helper?J.left:B.left)){N.size.width=N.size.width+(E.helper?(N.position.left-J.left):(N.position.left-B.left));if(L){N.size.height=N.size.width*E.aspectRatio}N.position.left=E.helper?J.left:B.left}if(I.top<(E.helper?J.top:0)){N.size.height=N.size.height+(E.helper?(N.position.top-J.top):N.position.top);if(L){N.size.width=N.size.height/E.aspectRatio}N.position.top=E.helper?J.top:0}var F=(E.helper?N.offset.left-J.left:(N.position.left-B.left))+N.sizeDiff.width,M=(E.helper?N.offset.top-J.top:N.position.top)+N.sizeDiff.height;if(F+N.size.width>=N.parentData.width){N.size.width=N.parentData.width-F;if(L){N.size.height=N.size.width*E.aspectRatio}}if(M+N.size.height>=N.parentData.height){N.size.height=N.parentData.height-M;if(L){N.size.width=N.size.height/E.aspectRatio}}},stop:function(G,J){var C=J.options,L=A(this).data("resizable"),H=L.position,I=L.containerOffset,B=L.containerPosition,D=L.containerElement;var E=A(L.helper),M=E.offset(),K=E.innerWidth(),F=E.innerHeight();if(C.helper&&!C.animate&&/relative/.test(D.css("position"))){A(this).css({left:(M.left-I.left),top:(M.top-I.top),width:K,height:F})}if(C.helper&&!C.animate&&/static/.test(D.css("position"))){A(this).css({left:B.left+(M.left-I.left),top:B.top+(M.top-I.top),width:K,height:F})}}});A.ui.plugin.add("resizable","grid",{resize:function(H,J){var D=J.options,L=A(this).data("resizable"),G=L.size,E=L.originalSize,F=L.originalPosition,K=L.axis,I=D._aspectRatio||H.shiftKey;D.grid=typeof D.grid=="number"?[D.grid,D.grid]:D.grid;var C=Math.round((G.width-E.width)/(D.grid[0]||1))*(D.grid[0]||1),B=Math.round((G.height-E.height)/(D.grid[1]||1))*(D.grid[1]||1);if(/^(se|s|e)$/.test(K)){L.size.width=E.width+C;L.size.height=E.height+B}else{if(/^(ne)$/.test(K)){L.size.width=E.width+C;L.size.height=E.height+B;L.position.top=F.top-B}else{if(/^(sw)$/.test(K)){L.size.width=E.width+C;L.size.height=E.height+B;L.position.left=F.left-C}else{L.size.width=E.width+C;L.size.height=E.height+B;L.position.top=F.top-B;L.position.left=F.left-C}}}}});A.ui.plugin.add("resizable","animate",{stop:function(I,K){var F=K.options,L=A(this).data("resizable");var E=F.proportionallyResize,B=E&&(/textarea/i).test(E.get(0).nodeName),C=B&&A.ui.hasScroll(E.get(0),"left")?0:L.sizeDiff.height,H=B?0:L.sizeDiff.width;var D={width:(L.size.width-H),height:(L.size.height-C)},G=(parseInt(L.element.css("left"),10)+(L.position.left-L.originalPosition.left))||null,J=(parseInt(L.element.css("top"),10)+(L.position.top-L.originalPosition.top))||null;L.element.animate(A.extend(D,J&&G?{top:J,left:G}:{}),{duration:F.animateDuration||"slow",easing:F.animateEasing||"swing",step:function(){var M={width:parseInt(L.element.css("width"),10),height:parseInt(L.element.css("height"),10),top:parseInt(L.element.css("top"),10),left:parseInt(L.element.css("left"),10)};if(E){E.css({width:M.width,height:M.height})}L._updateCache(M);L.propagate("animate",I)}})}});A.ui.plugin.add("resizable","ghost",{start:function(E,D){var F=D.options,B=A(this).data("resizable"),G=F.proportionallyResize,C=B.size;if(!G){B.ghost=B.element.clone()}else{B.ghost=G.clone()}B.ghost.css({opacity:0.25,display:"block",position:"relative",height:C.height,width:C.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof F.ghost=="string"?F.ghost:"");B.ghost.appendTo(B.helper)},resize:function(D,C){var E=C.options,B=A(this).data("resizable"),F=E.proportionallyResize;if(B.ghost){B.ghost.css({position:"relative",height:B.size.height,width:B.size.width})}},stop:function(D,C){var E=C.options,B=A(this).data("resizable"),F=E.proportionallyResize;if(B.ghost&&B.helper){B.helper.get(0).removeChild(B.ghost.get(0))}}});A.ui.plugin.add("resizable","alsoResize",{start:function(E,C){var F=C.options,B=A(this).data("resizable"),D=function(G){A(G).each(function(){A(this).data("resizable-alsoresize",{width:parseInt(A(this).width(),10),height:parseInt(A(this).height(),10),left:parseInt(A(this).css("left"),10),top:parseInt(A(this).css("top"),10)})})};if(typeof (F.alsoResize)=="object"){if(F.alsoResize.length){F.alsoResize=F.alsoResize[0];D(F.alsoResize)}else{A.each(F.alsoResize,function(G,H){D(G)})}}else{D(F.alsoResize)}},resize:function(F,E){var G=E.options,C=A(this).data("resizable"),D=C.originalSize,I=C.originalPosition;var H={height:(C.size.height-D.height)||0,width:(C.size.width-D.width)||0,top:(C.position.top-I.top)||0,left:(C.position.left-I.left)||0},B=function(J,K){A(J).each(function(){var N=A(this).data("resizable-alsoresize"),M={},L=K&&K.length?K:["width","height","top","left"];A.each(L||["width","height","top","left"],function(O,Q){var P=(N[Q]||0)+(H[Q]||0);if(P&&P>=0){M[Q]=P||null}});A(this).css(M)})};if(typeof (G.alsoResize)=="object"){A.each(G.alsoResize,function(J,K){B(J,K)})}else{B(G.alsoResize)}},stop:function(C,B){A(this).removeData("resizable-alsoresize-start")}})})(jQuery)
\ No newline at end of file
+/*
+ * jQuery UI Resizable 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Resizables
+ *
+ * Depends:
+ *     ui.core.js
+ */
+(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.1",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jquery/ui.selectable.js b/wp-includes/js/jquery/ui.selectable.js
new file mode 100644 (file)
index 0000000..69caa92
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * jQuery UI Selectable 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Selectables
+ *
+ * Depends:
+ *     ui.core.js
+ */
+(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.right<d||j.top>g||j.bottom<h))}else{if(e.tolerance=="fit"){k=(j.left>d&&j.right<b&&j.top>h&&j.bottom<g)}}if(k){if(j.selected){j.$element.removeClass("ui-selected");j.selected=false}if(j.unselecting){j.$element.removeClass("ui-unselecting");j.unselecting=false}if(!j.selecting){j.$element.addClass("ui-selecting");j.selecting=true;c._trigger("selecting",i,{selecting:j.element})}}else{if(j.selecting){if(i.metaKey&&j.startselected){j.$element.removeClass("ui-selecting");j.selecting=false;j.$element.addClass("ui-selected");j.selected=true}else{j.$element.removeClass("ui-selecting");j.selecting=false;if(j.startselected){j.$element.addClass("ui-unselecting");j.unselecting=true}c._trigger("unselecting",i,{unselecting:j.element})}}if(j.selected){if(!i.metaKey&&!j.startselected){j.$element.removeClass("ui-selected");j.selected=false;j.$element.addClass("ui-unselecting");j.unselecting=true;c._trigger("unselecting",i,{unselecting:j.element})}}}});return false},_mouseStop:function(d){var b=this;this.dragged=false;var c=this.options;a(".ui-unselecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-unselecting");e.unselecting=false;e.startselected=false;b._trigger("unselected",d,{unselected:e.element})});a(".ui-selecting",this.element[0]).each(function(){var e=a.data(this,"selectable-item");e.$element.removeClass("ui-selecting").addClass("ui-selected");e.selecting=false;e.selected=true;e.startselected=true;b._trigger("selected",d,{selected:e.element})});this._trigger("stop",d);this.helper.remove();return false}}));a.extend(a.ui.selectable,{version:"1.7.1",defaults:{appendTo:"body",autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:"*",tolerance:"touch"}})})(jQuery);
\ No newline at end of file
index f15f8b192bf7d3a4027ffea04b61d6bb7a3c927b..d30880639532ad3386aac04969daf51622c8cbf2 100644 (file)
@@ -1 +1,13 @@
-(function(B){function A(E,D){var C=B.browser.safari&&B.browser.version<522;if(E.contains&&!C){return E.contains(D)}if(E.compareDocumentPosition){return !!(E.compareDocumentPosition(D)&16)}while(D=D.parentNode){if(D==E){return true}}return false}B.widget("ui.sortable",B.extend({},B.ui.mouse,{init:function(){var C=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;if(!(/(relative|absolute|fixed)/).test(this.element.css("position"))){this.element.css("position","relative")}this.offset=this.element.offset();this.mouseInit()},plugins:{},ui:function(C){return{helper:(C||this)["helper"],placeholder:(C||this)["placeholder"]||B([]),position:(C||this)["position"],absolutePosition:(C||this)["positionAbs"],options:this.options,element:this.element,item:(C||this)["currentItem"],sender:C?C.element:null}},propagate:function(F,E,C,D){B.ui.plugin.call(this,F,[E,this.ui(C)]);if(!D){this.element.triggerHandler(F=="sort"?F:"sort"+F,[E,this.ui(C)],this.options[F])}},serialize:function(E){var C=(B.isFunction(this.options.items)?this.options.items.call(this.element):B(this.options.items,this.element)).not(".ui-sortable-helper");var D=[];E=E||{};C.each(function(){var F=(B(this).attr(E.attribute||"id")||"").match(E.expression||(/(.+)[-=_](.+)/));if(F){D.push((E.key||F[1])+"[]="+(E.key&&E.expression?F[1]:F[2]))}});return D.join("&")},toArray:function(C){var D=(B.isFunction(this.options.items)?this.options.items.call(this.element):B(this.options.items,this.element)).not(".ui-sortable-helper");var E=[];D.each(function(){E.push(B(this).attr(C||"id"))});return E},intersectsWith:function(J){var E=this.positionAbs.left,D=E+this.helperProportions.width,I=this.positionAbs.top,H=I+this.helperProportions.height;var F=J.left,C=F+J.width,K=J.top,G=K+J.height;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance=="guess"&&this.helperProportions[this.floating?"width":"height"]>J[this.floating?"width":"height"])){return(I+this.offset.click.top>K&&I+this.offset.click.top<G&&E+this.offset.click.left>F&&E+this.offset.click.left<C)}else{return(F<E+(this.helperProportions.width/2)&&D-(this.helperProportions.width/2)<C&&K<I+(this.helperProportions.height/2)&&H-(this.helperProportions.height/2)<G)}},intersectsWithEdge:function(J){var E=this.positionAbs.left,D=E+this.helperProportions.width,I=this.positionAbs.top,H=I+this.helperProportions.height;var F=J.left,C=F+J.width,K=J.top,G=K+J.height;if(this.options.toleranceMove=="pointer"||(this.options.toleranceMove=="guess"&&this.helperProportions[this.floating?"width":"height"]>J[this.floating?"width":"height"])){if(!(I+this.offset.click.top>K&&I+this.offset.click.top<G&&E+this.offset.click.left>F&&E+this.offset.click.left<C)){return false}if(this.floating){if(E+this.offset.click.left>F&&E+this.offset.click.left<F+J.width/2){return 2}if(E+this.offset.click.left>F+J.width/2&&E+this.offset.click.left<C){return 1}}else{if(I+this.offset.click.top>K&&I+this.offset.click.top<K+J.height/2){return 2}if(I+this.offset.click.top>K+J.height/2&&I+this.offset.click.top<G){return 1}}}else{if(!(F<E+(this.helperProportions.width/2)&&D-(this.helperProportions.width/2)<C&&K<I+(this.helperProportions.height/2)&&H-(this.helperProportions.height/2)<G)){return false}if(this.floating){if(D>F&&E<F){return 2}if(E<C&&D>C){return 1}}else{if(H>K&&I<K){return 1}if(I<G&&H>G){return 2}}}return false},refresh:function(){this.refreshItems();this.refreshPositions()},refreshItems:function(){this.items=[];this.containers=[this];var D=this.items;var C=this;var F=[[B.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):B(this.options.items,this.element),this]];if(this.options.connectWith){for(var G=this.options.connectWith.length-1;G>=0;G--){var I=B(this.options.connectWith[G]);for(var E=I.length-1;E>=0;E--){var H=B.data(I[E],"sortable");if(H&&!H.options.disabled){F.push([B.isFunction(H.options.items)?H.options.items.call(H.element):B(H.options.items,H.element),H]);this.containers.push(H)}}}}for(var G=F.length-1;G>=0;G--){F[G][0].each(function(){B.data(this,"sortable-item",F[G][1]);D.push({item:B(this),instance:F[G][1],width:0,height:0,left:0,top:0})})}},refreshPositions:function(D){if(this.offsetParent){var C=this.offsetParent.offset();this.offset.parent={top:C.top+this.offsetParentBorders.top,left:C.left+this.offsetParentBorders.left}}for(var F=this.items.length-1;F>=0;F--){if(this.items[F].instance!=this.currentContainer&&this.currentContainer&&this.items[F].item[0]!=this.currentItem[0]){continue}var E=this.options.toleranceElement?B(this.options.toleranceElement,this.items[F].item):this.items[F].item;if(!D){this.items[F].width=E[0].offsetWidth;this.items[F].height=E[0].offsetHeight}var G=E.offset();this.items[F].left=G.left;this.items[F].top=G.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var F=this.containers.length-1;F>=0;F--){var G=this.containers[F].element.offset();this.containers[F].containerCache.left=G.left;this.containers[F].containerCache.top=G.top;this.containers[F].containerCache.width=this.containers[F].element.outerWidth();this.containers[F].containerCache.height=this.containers[F].element.outerHeight()}}},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this.mouseDestroy();for(var C=this.items.length-1;C>=0;C--){this.items[C].item.removeData("sortable-item")}},createPlaceholder:function(E){var C=E||this,F=C.options;if(F.placeholder.constructor==String){var D=F.placeholder;F.placeholder={element:function(){return B("<div></div>").addClass(D)[0]},update:function(G,H){H.css(G.offset()).css({width:G.outerWidth(),height:G.outerHeight()})}}}C.placeholder=B(F.placeholder.element.call(C.element,C.currentItem)).appendTo("body").css({position:"absolute"});F.placeholder.update.call(C.element,C.currentItem,C.placeholder)},contactContainers:function(F){for(var D=this.containers.length-1;D>=0;D--){if(this.intersectsWith(this.containers[D].containerCache)){if(!this.containers[D].containerCache.over){if(this.currentContainer!=this.containers[D]){var I=10000;var H=null;var E=this.positionAbs[this.containers[D].floating?"left":"top"];for(var C=this.items.length-1;C>=0;C--){if(!A(this.containers[D].element[0],this.items[C].item[0])){continue}var G=this.items[C][this.containers[D].floating?"left":"top"];if(Math.abs(G-E)<I){I=Math.abs(G-E);H=this.items[C]}}if(!H&&!this.options.dropOnEmpty){continue}if(this.placeholder){this.placeholder.remove()}if(this.containers[D].options.placeholder){this.containers[D].createPlaceholder(this)}else{this.placeholder=null}this.currentContainer=this.containers[D];H?this.rearrange(F,H,null,true):this.rearrange(F,null,this.containers[D].element,true);this.propagate("change",F);this.containers[D].propagate("change",F,this)}this.containers[D].propagate("over",F,this);this.containers[D].containerCache.over=1}}else{if(this.containers[D].containerCache.over){this.containers[D].propagate("out",F,this);this.containers[D].containerCache.over=0}}}},mouseCapture:function(G,F){if(this.options.disabled||this.options.type=="static"){return false}this.refreshItems();var E=null,D=this,C=B(G.target).parents().each(function(){if(B.data(this,"sortable-item")==D){E=B(this);return false}});if(B.data(G.target,"sortable-item")==D){E=B(G.target)}if(!E){return false}if(this.options.handle&&!F){var H=false;B(this.options.handle,E).find("*").andSelf().each(function(){if(this==G.target){H=true}});if(!H){return false}}this.currentItem=E;return true},mouseStart:function(H,F,C){var J=this.options;this.currentContainer=this;this.refreshPositions();this.helper=typeof J.helper=="function"?B(J.helper.apply(this.element[0],[H,this.currentItem])):this.currentItem.clone();if(!this.helper.parents("body").length){B(J.appendTo!="parent"?J.appendTo:this.currentItem[0].parentNode)[0].appendChild(this.helper[0])}this.helper.css({position:"absolute",clear:"both"}).addClass("ui-sortable-helper");this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.click={left:H.pageX-this.offset.left,top:H.pageY-this.offset.top};this.offsetParent=this.helper.offsetParent();var D=this.offsetParent.offset();this.offsetParentBorders={top:(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};this.offset.parent={top:D.top+this.offsetParentBorders.top,left:D.left+this.offsetParentBorders.left};this.originalPosition=this.generatePosition(H);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(J.placeholder){this.createPlaceholder()}this.propagate("start",H);this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};if(J.cursorAt){if(J.cursorAt.left!=undefined){this.offset.click.left=J.cursorAt.left}if(J.cursorAt.right!=undefined){this.offset.click.left=this.helperProportions.width-J.cursorAt.right}if(J.cursorAt.top!=undefined){this.offset.click.top=J.cursorAt.top}if(J.cursorAt.bottom!=undefined){this.offset.click.top=this.helperProportions.height-J.cursorAt.bottom}}if(J.containment){if(J.containment=="parent"){J.containment=this.helper[0].parentNode}if(J.containment=="document"||J.containment=="window"){this.containment=[0-this.offset.parent.left,0-this.offset.parent.top,B(J.containment=="document"?document:window).width()-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.element.css("marginRight"),10)||0),(B(J.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.element.css("marginBottom"),10)||0)]}if(!(/^(document|window|parent)$/).test(J.containment)){var G=B(J.containment)[0];var I=B(J.containment).offset();this.containment=[I.left+(parseInt(B(G).css("borderLeftWidth"),10)||0)-this.offset.parent.left,I.top+(parseInt(B(G).css("borderTopWidth"),10)||0)-this.offset.parent.top,I.left+Math.max(G.scrollWidth,G.offsetWidth)-(parseInt(B(G).css("borderLeftWidth"),10)||0)-this.offset.parent.left-this.helperProportions.width-this.margins.left-(parseInt(this.currentItem.css("marginRight"),10)||0),I.top+Math.max(G.scrollHeight,G.offsetHeight)-(parseInt(B(G).css("borderTopWidth"),10)||0)-this.offset.parent.top-this.helperProportions.height-this.margins.top-(parseInt(this.currentItem.css("marginBottom"),10)||0)]}}if(this.options.placeholder!="clone"){this.currentItem.css("visibility","hidden")}if(!C){for(var E=this.containers.length-1;E>=0;E--){this.containers[E].propagate("activate",H,this)}}if(B.ui.ddmanager){B.ui.ddmanager.current=this}if(B.ui.ddmanager&&!J.dropBehaviour){B.ui.ddmanager.prepareOffsets(this,H)}this.dragging=true;this.mouseDrag(H);return true},convertPositionTo:function(D,E){if(!E){E=this.position}var C=D=="absolute"?1:-1;return{top:(E.top+this.offset.parent.top*C-(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)*C+this.margins.top*C),left:(E.left+this.offset.parent.left*C-(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft)*C+this.margins.left*C)}},generatePosition:function(F){var G=this.options;var C={top:(F.pageY-this.offset.click.top-this.offset.parent.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)),left:(F.pageX-this.offset.click.left-this.offset.parent.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft))};if(!this.originalPosition){return C}if(this.containment){if(C.left<this.containment[0]){C.left=this.containment[0]}if(C.top<this.containment[1]){C.top=this.containment[1]}if(C.left>this.containment[2]){C.left=this.containment[2]}if(C.top>this.containment[3]){C.top=this.containment[3]}}if(G.grid){var E=this.originalPosition.top+Math.round((C.top-this.originalPosition.top)/G.grid[1])*G.grid[1];C.top=this.containment?(!(E<this.containment[1]||E>this.containment[3])?E:(!(E<this.containment[1])?E-G.grid[1]:E+G.grid[1])):E;var D=this.originalPosition.left+Math.round((C.left-this.originalPosition.left)/G.grid[0])*G.grid[0];C.left=this.containment?(!(D<this.containment[0]||D>this.containment[2])?D:(!(D<this.containment[0])?D-G.grid[0]:D+G.grid[0])):D}return C},mouseDrag:function(D){this.position=this.generatePosition(D);this.positionAbs=this.convertPositionTo("absolute");B.ui.plugin.call(this,"sort",[D,this.ui()]);this.positionAbs=this.convertPositionTo("absolute");this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";for(var C=this.items.length-1;C>=0;C--){var E=this.intersectsWithEdge(this.items[C]);if(!E){continue}if(this.items[C].item[0]!=this.currentItem[0]&&this.currentItem[E==1?"next":"prev"]()[0]!=this.items[C].item[0]&&!A(this.currentItem[0],this.items[C].item[0])&&(this.options.type=="semi-dynamic"?!A(this.element[0],this.items[C].item[0]):true)){this.direction=E==1?"down":"up";this.rearrange(D,this.items[C]);this.propagate("change",D);break}}this.contactContainers(D);if(B.ui.ddmanager){B.ui.ddmanager.drag(this,D)}this.element.triggerHandler("sort",[D,this.ui()],this.options["sort"]);return false},rearrange:function(H,G,D,F){D?D[0].appendChild(this.currentItem[0]):G.item[0].parentNode.insertBefore(this.currentItem[0],(this.direction=="down"?G.item[0]:G.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var E=this,C=this.counter;window.setTimeout(function(){if(C==E.counter){E.refreshPositions(!F)}},0);if(this.options.placeholder){this.options.placeholder.update.call(this.element,this.currentItem,this.placeholder)}},mouseStop:function(E,D){if(B.ui.ddmanager&&!this.options.dropBehaviour){B.ui.ddmanager.drop(this,E)}if(this.options.revert){var C=this;var F=C.currentItem.offset();if(C.placeholder){C.placeholder.animate({opacity:"hide"},(parseInt(this.options.revert,10)||500)-50)}B(this.helper).animate({left:F.left-this.offset.parent.left-C.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:F.top-this.offset.parent.top-C.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){C.clear(E)})}else{this.clear(E,D)}return false},clear:function(E,D){if(this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0]){this.propagate("update",E,null,D)}if(!A(this.element[0],this.currentItem[0])){this.propagate("remove",E,null,D);for(var C=this.containers.length-1;C>=0;C--){if(A(this.containers[C].element[0],this.currentItem[0])){this.containers[C].propagate("update",E,this,D);this.containers[C].propagate("receive",E,this,D)}}}for(var C=this.containers.length-1;C>=0;C--){this.containers[C].propagate("deactivate",E,this,D);if(this.containers[C].containerCache.over){this.containers[C].propagate("out",E,this);this.containers[C].containerCache.over=0}}this.dragging=false;if(this.cancelHelperRemoval){this.propagate("stop",E,null,D);return false}B(this.currentItem).css("visibility","");if(this.placeholder){this.placeholder.remove()}this.helper.remove();this.helper=null;this.propagate("stop",E,null,D);return true}}));B.extend(B.ui.sortable,{getter:"serialize toArray",defaults:{helper:"clone",tolerance:"guess",toleranceMove:"guess",distance:1,delay:0,scroll:true,scrollSensitivity:20,scrollSpeed:20,cancel:":input",items:"> *",zIndex:1000,dropOnEmpty:true,appendTo:"parent"}});B.ui.plugin.add("sortable","cursor",{start:function(E,D){var C=B("body");if(C.css("cursor")){D.options._cursor=C.css("cursor")}C.css("cursor",D.options.cursor)},stop:function(D,C){if(C.options._cursor){B("body").css("cursor",C.options._cursor)}}});B.ui.plugin.add("sortable","zIndex",{start:function(E,D){var C=D.helper;if(C.css("zIndex")){D.options._zIndex=C.css("zIndex")}C.css("zIndex",D.options.zIndex)},stop:function(D,C){if(C.options._zIndex){B(C.helper).css("zIndex",C.options._zIndex)}}});B.ui.plugin.add("sortable","opacity",{start:function(E,D){var C=D.helper;if(C.css("opacity")){D.options._opacity=C.css("opacity")}C.css("opacity",D.options.opacity)},stop:function(D,C){if(C.options._opacity){B(C.helper).css("opacity",C.options._opacity)}}});B.ui.plugin.add("sortable","scroll",{start:function(E,D){var F=D.options;var C=B(this).data("sortable");C.overflowY=function(G){do{if(/auto|scroll/.test(G.css("overflow"))||(/auto|scroll/).test(G.css("overflow-y"))){return G}G=G.parent()}while(G[0].parentNode);return B(document)}(C.currentItem);C.overflowX=function(G){do{if(/auto|scroll/.test(G.css("overflow"))||(/auto|scroll/).test(G.css("overflow-x"))){return G}G=G.parent()}while(G[0].parentNode);return B(document)}(C.currentItem);if(C.overflowY[0]!=document&&C.overflowY[0].tagName!="HTML"){C.overflowYOffset=C.overflowY.offset()}if(C.overflowX[0]!=document&&C.overflowX[0].tagName!="HTML"){C.overflowXOffset=C.overflowX.offset()}},sort:function(E,D){var F=D.options;var C=B(this).data("sortable");if(C.overflowY[0]!=document&&C.overflowY[0].tagName!="HTML"){if((C.overflowYOffset.top+C.overflowY[0].offsetHeight)-E.pageY<F.scrollSensitivity){C.overflowY[0].scrollTop=C.overflowY[0].scrollTop+F.scrollSpeed}if(E.pageY-C.overflowYOffset.top<F.scrollSensitivity){C.overflowY[0].scrollTop=C.overflowY[0].scrollTop-F.scrollSpeed}}else{if(E.pageY-B(document).scrollTop()<F.scrollSensitivity){B(document).scrollTop(B(document).scrollTop()-F.scrollSpeed)}if(B(window).height()-(E.pageY-B(document).scrollTop())<F.scrollSensitivity){B(document).scrollTop(B(document).scrollTop()+F.scrollSpeed)}}if(C.overflowX[0]!=document&&C.overflowX[0].tagName!="HTML"){if((C.overflowXOffset.left+C.overflowX[0].offsetWidth)-E.pageX<F.scrollSensitivity){C.overflowX[0].scrollLeft=C.overflowX[0].scrollLeft+F.scrollSpeed}if(E.pageX-C.overflowXOffset.left<F.scrollSensitivity){C.overflowX[0].scrollLeft=C.overflowX[0].scrollLeft-F.scrollSpeed}}else{if(E.pageX-B(document).scrollLeft()<F.scrollSensitivity){B(document).scrollLeft(B(document).scrollLeft()-F.scrollSpeed)}if(B(window).width()-(E.pageX-B(document).scrollLeft())<F.scrollSensitivity){B(document).scrollLeft(B(document).scrollLeft()+F.scrollSpeed)}}}});B.ui.plugin.add("sortable","axis",{sort:function(E,D){var C=B(this).data("sortable");if(D.options.axis=="y"){C.position.left=C.originalPosition.left}if(D.options.axis=="x"){C.position.top=C.originalPosition.top}}})})(jQuery)
\ No newline at end of file
+/*
+ * jQuery UI Sortable 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Sortables
+ *
+ * Depends:
+ *     ui.core.js
+ */
+(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop+g.scrollSpeed}else{if(f.pageY-this.overflowOffset.top<g.scrollSensitivity){this.scrollParent[0].scrollTop=b=this.scrollParent[0].scrollTop-g.scrollSpeed}}if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-f.pageX<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft+g.scrollSpeed}else{if(f.pageX-this.overflowOffset.left<g.scrollSensitivity){this.scrollParent[0].scrollLeft=b=this.scrollParent[0].scrollLeft-g.scrollSpeed}}}else{if(f.pageY-a(document).scrollTop()<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()-g.scrollSpeed)}else{if(a(window).height()-(f.pageY-a(document).scrollTop())<g.scrollSensitivity){b=a(document).scrollTop(a(document).scrollTop()+g.scrollSpeed)}}if(f.pageX-a(document).scrollLeft()<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()-g.scrollSpeed)}else{if(a(window).width()-(f.pageX-a(document).scrollLeft())<g.scrollSensitivity){b=a(document).scrollLeft(a(document).scrollLeft()+g.scrollSpeed)}}}if(b!==false&&a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,f)}}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y"){this.helper[0].style.left=this.position.left+"px"}if(!this.options.axis||this.options.axis!="x"){this.helper[0].style.top=this.position.top+"px"}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)<i&&(e+h)>f&&(e+h)<c;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>m[this.floating?"width":"height"])){return g}else{return(f<e+(this.helperProportions.width/2)&&d-(this.helperProportions.width/2)<c&&n<k+(this.helperProportions.height/2)&&j-(this.helperProportions.height/2)<i)}},_intersectsWithPointer:function(d){var e=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,d.top,d.height),c=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,d.left,d.width),g=e&&c,b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(!g){return false}return this.floating?(((f&&f=="right")||b=="down")?2:1):(b&&(b=="down"?2:1))},_intersectsWithSides:function(e){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+(e.height/2),e.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+(e.width/2),e.width),b=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();if(this.floating&&f){return((f=="right"&&d)||(f=="left"&&!d))}else{return b&&((b=="down"&&c)||(b=="up"&&!c))}},_getDragVerticalDirection:function(){var b=this.positionAbs.top-this.lastPositionAbs.top;return b!=0&&(b>0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c<this.items.length;c++){for(var b=0;b<d.length;b++){if(d[b]==this.items[c].item[0]){this.items.splice(c,1)}}}},_refreshItems:function(b){this.items=[];this.containers=[this];var h=this.items;var p=this;var f=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]];var l=this._connectWith();if(l){for(var e=l.length-1;e>=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d<n;d++){var o=a(c[d]);o.data("sortable-item",k);h.push({item:o,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset()}for(var d=this.items.length-1;d>=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)<h){h=Math.abs(f-e);g=this.items[b]}}if(!g&&!this.options.dropOnEmpty){continue}this.currentContainer=this.containers[c];g?this._rearrange(d,g,null,true):this._rearrange(d,null,this.containers[c].element,true);this._trigger("change",d,this._uiHash());this.containers[c]._trigger("change",d,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder)}this.containers[c]._trigger("over",d,this._uiHash(this));this.containers[c].containerCache.over=1}}else{if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",d,this._uiHash(this));this.containers[c].containerCache.over=0}}}},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c,this.currentItem])):(d.helper=="clone"?this.currentItem.clone():this.currentItem);if(!b.parents("body").length){a(d.appendTo!="parent"?d.appendTo:this.currentItem[0].parentNode)[0].appendChild(b[0])}if(b[0]==this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}}if(b[0].style.width==""||d.forceHelperSize){b.width(this.currentItem.width())}if(b[0].style.height==""||d.forceHelperSize){b.height(this.currentItem.height())}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.currentItem.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)){var c=a(e.containment)[0];var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.left<this.containment[0]){d=this.containment[0]+this.offset.click.left}if(e.pageY-this.offset.click.top<this.containment[1]){c=this.containment[1]+this.offset.click.top}if(e.pageX-this.offset.click.left>this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:(!(g-this.offset.click.top<this.containment[1])?g-h.grid[1]:g+h.grid[1])):g;var f=this.originalPageX+Math.round((d-this.originalPageX)/h.grid[0])*h.grid[0];d=this.containment?(!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:(!(f-this.offset.click.left<this.containment[0])?f-h.grid[0]:f+h.grid[0])):f}}return{top:(c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(i?0:b.scrollTop())))),left:(d-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:b.scrollLeft())))}},_rearrange:function(g,f,c,e){c?c[0].appendChild(this.placeholder[0]):f.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=="down"?f.item[0]:f.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var d=this,b=this.counter;window.setTimeout(function(){if(b==d.counter){d.refreshPositions(!e)}},0)},_clear:function(d,e){this.reverting=false;var f=[],b=this;if(!this._noFinalSort&&this.currentItem[0].parentNode){this.placeholder.before(this.currentItem)}this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var c in this._storedCSS){if(this._storedCSS[c]=="auto"||this._storedCSS[c]=="static"){this._storedCSS[c]=""}}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}if(this.fromOutside&&!e){f.push(function(g){this._trigger("receive",g,this._uiHash(this.fromOutside))})}if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!e){f.push(function(g){this._trigger("update",g,this._uiHash())})}if(!a.ui.contains(this.element[0],this.currentItem[0])){if(!e){f.push(function(g){this._trigger("remove",g,this._uiHash())})}for(var c=this.containers.length-1;c>=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}return false}if(!e){this._trigger("beforeStop",d,this._uiHash())}this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0]){this.helper.remove()}this.helper=null;if(!e){for(var c=0;c<f.length;c++){f[c].call(this,d)}this._trigger("stop",d,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){if(a.widget.prototype._trigger.apply(this,arguments)===false){this.cancel()}},_uiHash:function(c){var b=c||this;return{helper:b.helper,placeholder:b.placeholder||a([]),position:b.position,absolutePosition:b.positionAbs,offset:b.positionAbs,item:b.currentItem,sender:c?c.element:null}}}));a.extend(a.ui.sortable,{getter:"serialize toArray",version:"1.7.1",eventPrefix:"sort",defaults:{appendTo:"parent",axis:false,cancel:":input,option",connectWith:false,containment:false,cursor:"auto",cursorAt:false,delay:0,distance:1,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);
\ No newline at end of file
index 137270e23943c6df9bb7ffcfb7e774e6f42c6d31..5796f0bbd9abdda3cf4262c067064687154fa83c 100644 (file)
@@ -1,2 +1,13 @@
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(A){A.3g("8.3",{3f:4(){2.c.t+=".3";2.1f(1d)},3e:4(B,C){5((/^7/).26(B)){2.17(C)}m{2.c[B]=C;2.1f()}},j:4(){d 2.$3.j},1G:4(B){d B.2b&&B.2b.14(/\\s/g,"2a").14(/[^A-3d-3c-9\\-2a:\\.]/g,"")||2.c.1S+A.f(B)},8:4(C,B){d{c:2.c,3b:C,1O:B,V:2.$3.V(C)}},1f:4(O){2.$i=A("1j:3a(a[n])",2.h);2.$3=2.$i.1t(4(){d A("a",2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.X(4(R,Q){5(Q.v&&Q.v.14("#","")){P.$b=P.$b.1c(Q.v)}m{5(A(Q).13("n")!="#"){A.f(Q,"n.3",Q.n);A.f(Q,"p.3",Q.n);6 T=P.1G(Q);Q.n="#"+T;6 S=A("#"+T);5(!S.j){S=A(D.1z).13("1g",T).l(D.19).39(P.$b[R-1]||P.h);S.f("1b.3",1d)}P.$b=P.$b.1c(S)}m{D.e.1Y(R+1)}}});5(O){2.h.l(D.1y);2.$b.X(4(){6 Q=A(2);Q.l(D.19)});5(D.7===1q){5(1L.v){2.$3.X(4(S,Q){5(Q.v==1L.v){D.7=S;5(A.Y.1h||A.Y.38){6 R=A(1L.v),T=R.13("1g");R.13("1g","");1B(4(){R.13("1g",T)},37)}36(0,0);d o}})}m{5(D.11){6 J=35(A.11("8-3"+A.f(P.h)),10);5(J&&P.$3[J]){D.7=J}}m{5(P.$i.U("."+D.k).j){D.7=P.$i.V(P.$i.U("."+D.k)[0])}}}}D.7=D.7===w||D.7!==1q?D.7:0;D.e=A.34(D.e.33(A.1t(2.$i.U("."+D.W),4(R,Q){d P.$i.V(R)}))).1X();5(A.1s(D.7,D.e)!=-1){D.e.32(A.1s(D.7,D.e),1)}2.$b.l(D.x);2.$i.q(D.k);5(D.7!==w){2.$b.r(D.7).1I().q(D.x);2.$i.r(D.7).l(D.k);6 K=4(){A(P.h).z("1v",[P.u("1v"),P.8(P.$3[D.7],P.$b[D.7])],D.1I)};5(A.f(2.$3[D.7],"p.3")){2.p(D.7,K)}m{K()}}A(31).16("30",4(){P.$3.15(".3");P.$i=P.$3=P.$b=w})}2Z(6 G=0,N;N=2.$i[G];G++){A(N)[A.1s(G,D.e)!=-1&&!A(N).12(D.k)?"l":"q"](D.W)}5(D.y===o){2.$3.1n("y.3")}6 C,I,B={"2Y-2X":0,1K:1},E="2W";5(D.Z&&D.Z.2V==2U){C=D.Z[0]||B,I=D.Z[1]||B}m{C=I=D.Z||B}6 H={1r:"",2T:"",2S:""};5(!A.Y.1h){H.1J=""}4 M(R,Q,S){Q.29(C,C.1K||E,4(){Q.l(D.x).1e(H);5(A.Y.1h&&C.1J){Q[0].28.U=""}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1e("1r","1F")}S.29(I,I.1K||E,4(){S.q(D.x).1e(H);5(A.Y.1h&&I.1J){S[0].28.U=""}A(P.h).z("1v",[P.u("1v"),P.8(R,S[0])],D.1I)})}4 F(R,T,Q,S){T.l(D.k).2R().q(D.k);M(R,Q,S)}2.$3.15(".3").16(D.t,4(){6 T=A(2).2Q("1j:r(0)"),Q=P.$b.U(":2P"),S=A(2.v);5((T.12(D.k)&&!D.1i)||T.12(D.W)||A(2).12(D.18)||A(P.h).z("27",[P.u("27"),P.8(2,S[0])],D.17)===o){2.1u();d o}P.c.7=P.$3.V(2);5(D.1i){5(T.12(D.k)){P.c.7=w;T.q(D.k);P.$b.1H();M(2,Q);2.1u();d o}m{5(!Q.j){P.$b.1H();6 R=2;P.p(P.$3.V(2),4(){T.l(D.k).l(D.1x);L(R,S)});2.1u();d o}}}5(D.11){A.11("8-3"+A.f(P.h),P.c.7,D.11)}P.$b.1H();5(S.j){6 R=2;P.p(P.$3.V(2),Q.j?4(){F(R,T,Q,S)}:4(){T.l(D.k);L(R,S)})}m{2O"1M 2N 2M: 2L 2K 2J."}5(A.Y.1h){2.1u()}d o});5(!(/^1A/).26(D.t)){2.$3.16("1A.3",4(){d o})}},1c:4(E,D,C){5(C==1q){C=2.$3.j}6 G=2.c;6 I=A(G.1R.14(/#\\{n\\}/g,E).14(/#\\{1k\\}/g,D));I.f("1b.3",1d);6 H=E.2I("#")==0?E.14("#",""):2.1G(A("a:2H-2G",I)[0]);6 F=A("#"+H);5(!F.j){F=A(G.1z).13("1g",H).l(G.x).f("1b.3",1d)}F.l(G.19);5(C>=2.$i.j){I.25(2.h);F.25(2.h[0].2F)}m{I.24(2.$i[C]);F.24(2.$b[C])}G.e=A.1t(G.e,4(K,J){d K>=C?++K:K});2.1f();5(2.$3.j==1){I.l(G.k);F.q(G.x);6 B=A.f(2.$3[0],"p.3");5(B){2.p(C,B)}}2.h.z("23",[2.u("23"),2.8(2.$3[C],2.$b[C])],G.1c)},1a:4(B){6 D=2.c,E=2.$i.r(B).1a(),C=2.$b.r(B).1a();5(E.12(D.k)&&2.$3.j>1){2.17(B+(B+1<2.$3.j?1:-1))}D.e=A.1t(A.21(D.e,4(G,F){d G!=B}),4(G,F){d G>=B?--G:G});2.1f();2.h.z("22",[2.u("22"),2.8(E.1E("a")[0],C[0])],D.1a)},1Z:4(B){6 C=2.c;5(A.1s(B,C.e)==-1){d}6 D=2.$i.r(B).q(C.W);5(A.Y.2E){D.1e("1r","2D-1F");1B(4(){D.1e("1r","1F")},0)}C.e=A.21(C.e,4(F,E){d F!=B});2.h.z("20",[2.u("20"),2.8(2.$3[B],2.$b[B])],C.1Z)},1V:4(C){6 B=2,D=2.c;5(C!=D.7){2.$i.r(C).l(D.W);D.e.1Y(C);D.e.1X();2.h.z("1W",[2.u("1W"),2.8(2.$3[C],2.$b[C])],D.1V)}},17:4(B){5(2C B=="2B"){B=2.$3.V(2.$3.U("[n$="+B+"]")[0])}2.$3.r(B).2A(2.c.t)},p:4(G,K){6 L=2,D=2.c,E=2.$3.r(G),J=E[0],H=K==1q||K===o,B=E.f("p.3");K=K||4(){};5(!B||!H&&A.f(J,"y.3")){K();d}6 M=4(N){6 O=A(N),P=O.1E("*:2z");d P.j&&P.2y(":2x(2w)")&&P||O};6 C=4(){L.$3.U("."+D.18).q(D.18).X(4(){5(D.1m){M(2).2v().1p(M(2).f("1k.3"))}});L.1o=w};5(D.1m){6 I=M(J).1p();M(J).2u("<1D></1D>").1E("1D").f("1k.3",I).1p(D.1m)}6 F=A.1N({},D.1l,{1T:B,1C:4(O,N){A(J.v).1p(O);C();5(D.y){A.f(J,"y.3",1d)}A(L.h).z("1U",[L.u("1U"),L.8(L.$3[G],L.$b[G])],D.p);D.1l.1C&&D.1l.1C(O,N);K()}});5(2.1o){2.1o.2t();C()}E.l(D.18);1B(4(){L.1o=A.2s(F)},0)},1T:4(C,B){2.$3.r(C).1n("y.3").f("p.3",B)},1b:4(){6 B=2.c;2.h.15(".3").q(B.1y).1n("3");2.$3.X(4(){6 C=A.f(2,"n.3");5(C){2.n=C}6 D=A(2).15(".3");A.X(["n","p","y"],4(E,F){D.1n(F+".3")})});2.$i.1c(2.$b).X(4(){5(A.f(2,"1b.3")){A(2).1a()}m{A(2).q([B.k,B.1x,B.W,B.19,B.x].2r(" "))}})},u:4(B){d A.t.2q({2p:B,2o:2.h[0]})}});A.8.3.2n={1i:o,t:"1A",e:[],11:w,1m:"2m&#2l;",y:o,1S:"8-3-",1l:{},Z:w,1R:\'<1j><a n="#{n}"><1Q>#{1k}</1Q></a></1j>\',1z:"<1P></1P>",1y:"8-3-2k",k:"8-3-7",1x:"8-3-1i",W:"8-3-e",19:"8-3-1O",x:"8-3-2j",18:"8-3-2i"};A.8.3.2h="j";A.1N(A.8.3.2g,{1w:w,2f:4(C,F){F=F||o;6 B=2,E=2.c.7;4 G(){B.1w=2e(4(){E=++E<B.$3.j?E:0;B.17(E)},C)}4 D(H){5(!H||H.2d){2c(B.1w)}}5(C){G();5(!F){2.$3.16(2.c.t,D)}m{2.$3.16(2.c.t,4(){D();E=B.c.7;G()})}}m{D();2.$3.15(2.c.t,D)}}})})(1M)',62,203,'||this|tabs|function|if|var|selected|ui|||panels|options|return|disabled|data||element|lis|length|selectedClass|addClass|else|href|false|load|removeClass|eq||event|fakeEvent|hash|null|hideClass|cache|triggerHandler|||||||||||||||||||||filter|index|disabledClass|each|browser|fx||cookie|hasClass|attr|replace|unbind|bind|select|loadingClass|panelClass|remove|destroy|add|true|css|tabify|id|msie|unselect|li|label|ajaxOptions|spinner|removeData|xhr|html|undefined|display|inArray|map|blur|tabsshow|rotation|unselectClass|navClass|panelTemplate|click|setTimeout|success|em|find|block|tabId|stop|show|opacity|duration|location|jQuery|extend|panel|div|span|tabTemplate|idPrefix|url|tabsload|disable|tabsdisable|sort|push|enable|tabsenable|grep|tabsremove|tabsadd|insertBefore|appendTo|test|tabsselect|style|animate|_|title|clearInterval|clientX|setInterval|rotate|prototype|getter|loading|hide|nav|8230|Loading|defaults|target|type|fix|join|ajax|abort|wrapInner|parent|img|not|is|last|trigger|string|typeof|inline|safari|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|visible|parents|siblings|height|overflow|Array|constructor|normal|width|min|for|unload|window|splice|concat|unique|parseInt|scrollTo|500|opera|insertAfter|has|tab|z0|Za|setData|init|widget'.split('|'),0,{}))
-
+/*
+ * jQuery UI Tabs 1.7.1
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Tabs
+ *
+ * Depends:
+ *     ui.core.js
+ */
+(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1<this.anchors.length?1:-1))}d.disabled=a.map(a.grep(d.disabled,function(g,f){return g!=b}),function(g,f){return g>=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.1",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"<div></div>",spinner:"<em>Loading&#8230;</em>",tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>'}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i<b.anchors.length?i:0)},d);if(h){h.stopPropagation()}});var e=b._unrotate||(b._unrotate=!f?function(h){if(h.clientX){b.rotate(null)}}:function(h){t=g.selected;c()});if(d){this.element.bind("tabsshow",c);this.anchors.bind(g.event+".tabs",e);c()}else{clearTimeout(b.rotation);this.element.unbind("tabsshow",c);this.anchors.unbind(g.event+".tabs",e);delete this._rotate;delete this._unrotate}}})})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/quicktags.dev.js b/wp-includes/js/quicktags.dev.js
new file mode 100644 (file)
index 0000000..83a0237
--- /dev/null
@@ -0,0 +1,577 @@
+// new edit toolbar used with permission
+// by Alex King
+// http://www.alexking.org/
+
+var edButtons = new Array(), edLinks = new Array(), edOpenTags = new Array(), now = new Date(), datetime;
+
+function edButton(id, display, tagStart, tagEnd, access, open) {
+       this.id = id;                           // used to name the toolbar button
+       this.display = display;         // label on button
+       this.tagStart = tagStart;       // open tag
+       this.tagEnd = tagEnd;           // close tag
+       this.access = access;           // access key
+       this.open = open;                       // set to -1 if tag does not need to be closed
+}
+
+function zeroise(number, threshold) {
+       // FIXME: or we could use an implementation of printf in js here
+       var str = number.toString();
+       if (number < 0) { str = str.substr(1, str.length) }
+       while (str.length < threshold) { str = "0" + str }
+       if (number < 0) { str = '-' + str }
+       return str;
+}
+
+datetime = now.getUTCFullYear() + '-' +
+zeroise(now.getUTCMonth() + 1, 2) + '-' +
+zeroise(now.getUTCDate(), 2) + 'T' +
+zeroise(now.getUTCHours(), 2) + ':' +
+zeroise(now.getUTCMinutes(), 2) + ':' +
+zeroise(now.getUTCSeconds() ,2) +
+'+00:00';
+
+edButtons[edButtons.length] =
+new edButton('ed_strong'
+,'b'
+,'<strong>'
+,'</strong>'
+,'b'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_em'
+,'i'
+,'<em>'
+,'</em>'
+,'i'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_link'
+,'link'
+,''
+,'</a>'
+,'a'
+); // special case
+
+edButtons[edButtons.length] =
+new edButton('ed_block'
+,'b-quote'
+,'\n\n<blockquote>'
+,'</blockquote>\n\n'
+,'q'
+);
+
+
+edButtons[edButtons.length] =
+new edButton('ed_del'
+,'del'
+,'<del datetime="' + datetime + '">'
+,'</del>'
+,'d'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_ins'
+,'ins'
+,'<ins datetime="' + datetime + '">'
+,'</ins>'
+,'s'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_img'
+,'img'
+,''
+,''
+,'m'
+,-1
+); // special case
+
+edButtons[edButtons.length] =
+new edButton('ed_ul'
+,'ul'
+,'<ul>\n'
+,'</ul>\n\n'
+,'u'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_ol'
+,'ol'
+,'<ol>\n'
+,'</ol>\n\n'
+,'o'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_li'
+,'li'
+,'\t<li>'
+,'</li>\n'
+,'l'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_code'
+,'code'
+,'<code>'
+,'</code>'
+,'c'
+);
+
+edButtons[edButtons.length] =
+new edButton('ed_more'
+,'more'
+,'<!--more-->'
+,''
+,'t'
+,-1
+);
+/*
+edButtons[edButtons.length] =
+new edButton('ed_next'
+,'page'
+,'<!--nextpage-->'
+,''
+,'p'
+,-1
+);
+*/
+function edLink() {
+       this.display = '';
+       this.URL = '';
+       this.newWin = 0;
+}
+
+edLinks[edLinks.length] = new edLink('WordPress'
+                                    ,'http://wordpress.org/'
+                                    );
+
+edLinks[edLinks.length] = new edLink('alexking.org'
+                                    ,'http://www.alexking.org/'
+                                    );
+
+function edShowButton(button, i) {
+       if (button.id == 'ed_img') {
+               document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />');
+       }
+       else if (button.id == 'ed_link') {
+               document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />');
+       }
+       else {
+               document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '"  />');
+       }
+}
+
+function edShowLinks() {
+       var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>' + quicktagsL10n.quickLinks + '</option>', i;
+       for (i = 0; i < edLinks.length; i++) {
+               tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>';
+       }
+       tempStr += '</select>';
+       document.write(tempStr);
+}
+
+function edAddTag(button) {
+       if (edButtons[button].tagEnd != '') {
+               edOpenTags[edOpenTags.length] = button;
+               document.getElementById(edButtons[button].id).value = '/' + document.getElementById(edButtons[button].id).value;
+       }
+}
+
+function edRemoveTag(button) {
+       for (var i = 0; i < edOpenTags.length; i++) {
+               if (edOpenTags[i] == button) {
+                       edOpenTags.splice(i, 1);
+                       document.getElementById(edButtons[button].id).value =           document.getElementById(edButtons[button].id).value.replace('/', '');
+               }
+       }
+}
+
+function edCheckOpenTags(button) {
+       var tag = 0, i;
+       for (i = 0; i < edOpenTags.length; i++) {
+               if (edOpenTags[i] == button) {
+                       tag++;
+               }
+       }
+       if (tag > 0) {
+               return true; // tag found
+       }
+       else {
+               return false; // tag not found
+       }
+}
+
+function edCloseAllTags() {
+       var count = edOpenTags.length, o;
+       for (o = 0; o < count; o++) {
+               edInsertTag(edCanvas, edOpenTags[edOpenTags.length - 1]);
+       }
+}
+
+function edQuickLink(i, thisSelect) {
+       if (i > -1) {
+               var newWin = '', tempStr;
+               if (edLinks[i].newWin == 1) {
+                       newWin = ' target="_blank"';
+               }
+               tempStr = '<a href="' + edLinks[i].URL + '"' + newWin + '>'
+                           + edLinks[i].display
+                           + '</a>';
+               thisSelect.selectedIndex = 0;
+               edInsertContent(edCanvas, tempStr);
+       }
+       else {
+               thisSelect.selectedIndex = 0;
+       }
+}
+
+function edSpell(myField) {
+       var word = '', sel, startPos, endPos;
+       if (document.selection) {
+               myField.focus();
+           sel = document.selection.createRange();
+               if (sel.text.length > 0) {
+                       word = sel.text;
+               }
+       }
+       else if (myField.selectionStart || myField.selectionStart == '0') {
+               startPos = myField.selectionStart;
+               endPos = myField.selectionEnd;
+               if (startPos != endPos) {
+                       word = myField.value.substring(startPos, endPos);
+               }
+       }
+       if (word == '') {
+               word = prompt(quicktagsL10n.wordLookup, '');
+       }
+       if (word !== null && /^\w[\w ]*$/.test(word)) {
+               window.open('http://www.answers.com/' + escape(word));
+       }
+}
+
+function edToolbar() {
+       document.write('<div id="ed_toolbar">');
+       for (var i = 0; i < edButtons.length; i++) {
+               edShowButton(edButtons[i], i);
+       }
+       document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />');
+       document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />');
+//     edShowLinks(); // disabled by default
+       document.write('</div>');
+}
+
+// insertion code
+
+function edInsertTag(myField, i) {
+       //IE support
+       if (document.selection) {
+               myField.focus();
+           var sel = document.selection.createRange();
+               if (sel.text.length > 0) {
+                       sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
+               }
+               else {
+                       if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
+                               sel.text = edButtons[i].tagStart;
+                               edAddTag(i);
+                       }
+                       else {
+                               sel.text = edButtons[i].tagEnd;
+                               edRemoveTag(i);
+                       }
+               }
+               myField.focus();
+       }
+       //MOZILLA/NETSCAPE support
+       else if (myField.selectionStart || myField.selectionStart == '0') {
+               var startPos = myField.selectionStart, endPos = myField.selectionEnd, cursorPos = endPos, scrollTop = myField.scrollTop;
+
+               if (startPos != endPos) {
+                       myField.value = myField.value.substring(0, startPos)
+                                     + edButtons[i].tagStart
+                                     + myField.value.substring(startPos, endPos)
+                                     + edButtons[i].tagEnd
+                                     + myField.value.substring(endPos, myField.value.length);
+                       cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length;
+               }
+               else {
+                       if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
+                               myField.value = myField.value.substring(0, startPos)
+                                             + edButtons[i].tagStart
+                                             + myField.value.substring(endPos, myField.value.length);
+                               edAddTag(i);
+                               cursorPos = startPos + edButtons[i].tagStart.length;
+                       }
+                       else {
+                               myField.value = myField.value.substring(0, startPos)
+                                             + edButtons[i].tagEnd
+                                             + myField.value.substring(endPos, myField.value.length);
+                               edRemoveTag(i);
+                               cursorPos = startPos + edButtons[i].tagEnd.length;
+                       }
+               }
+               myField.focus();
+               myField.selectionStart = cursorPos;
+               myField.selectionEnd = cursorPos;
+               myField.scrollTop = scrollTop;
+       }
+       else {
+               if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
+                       myField.value += edButtons[i].tagStart;
+                       edAddTag(i);
+               }
+               else {
+                       myField.value += edButtons[i].tagEnd;
+                       edRemoveTag(i);
+               }
+               myField.focus();
+       }
+}
+
+function edInsertContent(myField, myValue) {
+       var sel, startPos, endPos, scrollTop;
+       
+       //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') {
+               startPos = myField.selectionStart;
+               endPos = myField.selectionEnd;
+               scrollTop = myField.scrollTop;
+               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;
+               myField.scrollTop = scrollTop;
+       } else {
+               myField.value += myValue;
+               myField.focus();
+       }
+}
+
+function edInsertLink(myField, i, defaultValue) {
+       if (!defaultValue) {
+               defaultValue = 'http://';
+       }
+       if (!edCheckOpenTags(i)) {
+               var URL = prompt(quicktagsL10n.enterURL, defaultValue);
+               if (URL) {
+                       edButtons[i].tagStart = '<a href="' + URL + '">';
+                       edInsertTag(myField, i);
+               }
+       }
+       else {
+               edInsertTag(myField, i);
+       }
+}
+
+function edInsertImage(myField) {
+       var myValue = prompt(quicktagsL10n.enterImageURL, 'http://');
+       if (myValue) {
+               myValue = '<img src="'
+                               + myValue
+                               + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '')
+                               + '" />';
+               edInsertContent(myField, myValue);
+       }
+}
+
+
+// Allow multiple instances.
+// Name = unique value, id = textarea id, container = container div.
+// Can disable some buttons by passing comma delimited string as 4th param.
+var QTags = function(name, id, container, disabled) {
+       var t = this, cont = document.getElementById(container), i, tag, tb, html, sel;
+
+       t.Buttons = [];
+       t.Links = [];
+       t.OpenTags = [];
+       t.Canvas = document.getElementById(id);
+
+       if ( ! t.Canvas || ! cont )
+               return;
+
+       disabled = ( typeof disabled != 'undefined' ) ? ','+disabled+',' : '';
+
+       t.edShowButton = function(button, i) {
+               if ( disabled && (disabled.indexOf(','+button.display+',') != -1) )
+                       return '';
+               else if ( button.id == name+'_img' )
+                       return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage('+name+'.Canvas);" value="' + button.display + '" />';
+               else if (button.id == name+'_link')
+                       return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="'+name+'.edInsertLink('+i+');" value="'+button.display+'" />';
+               else
+                       return '<input type="button" id="' + button.id + '" accesskey="'+button.access+'" class="ed_button" onclick="'+name+'.edInsertTag('+i+');" value="'+button.display+'" />';
+       };
+
+       t.edAddTag = function(button) {
+               if ( t.Buttons[button].tagEnd != '' ) {
+                       t.OpenTags[t.OpenTags.length] = button;
+                       document.getElementById(t.Buttons[button].id).value = '/' + document.getElementById(t.Buttons[button].id).value;
+               }
+       };
+
+       t.edRemoveTag = function(button) {
+               for ( i = 0; i < t.OpenTags.length; i++ ) {
+                       if ( t.OpenTags[i] == button ) {
+                               t.OpenTags.splice(i, 1);
+                               document.getElementById(t.Buttons[button].id).value = document.getElementById(t.Buttons[button].id).value.replace('/', '');
+                       }
+               }
+       };
+
+       t.edCheckOpenTags = function(button) {
+               tag = 0;
+               for ( var i = 0; i < t.OpenTags.length; i++ ) {
+                       if ( t.OpenTags[i] == button )
+                               tag++;
+               }
+               if ( tag > 0 ) return true; // tag found
+               else return false; // tag not found
+       };
+
+       this.edCloseAllTags = function() {
+               var count = t.OpenTags.length;
+               for ( var o = 0; o < count; o++ )
+                       t.edInsertTag(t.OpenTags[t.OpenTags.length - 1]);
+       };
+
+       this.edQuickLink = function(i, thisSelect) {
+               if ( i > -1 ) {
+                       var newWin = '', tempStr;
+                       if ( Links[i].newWin == 1 ) {
+                               newWin = ' target="_blank"';
+                       }
+                       tempStr = '<a href="' + Links[i].URL + '"' + newWin + '>'
+                                   + Links[i].display
+                                   + '</a>';
+                       thisSelect.selectedIndex = 0;
+                       edInsertContent(t.Canvas, tempStr);
+               } else {
+                       thisSelect.selectedIndex = 0;
+               }
+       };
+
+       // insertion code
+       t.edInsertTag = function(i) {
+               //IE support
+               if ( document.selection ) {
+                       t.Canvas.focus();
+                   sel = document.selection.createRange();
+                       if ( sel.text.length > 0 ) {
+                               sel.text = t.Buttons[i].tagStart + sel.text + t.Buttons[i].tagEnd;
+                       } else {
+                               if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
+                                       sel.text = t.Buttons[i].tagStart;
+                                       t.edAddTag(i);
+                               } else {
+                                       sel.text = t.Buttons[i].tagEnd;
+                                       t.edRemoveTag(i);
+                               }
+                       }
+                       t.Canvas.focus();
+               } else if ( t.Canvas.selectionStart || t.Canvas.selectionStart == '0' ) { //MOZILLA/NETSCAPE support
+                       var startPos = t.Canvas.selectionStart, endPos = t.Canvas.selectionEnd, cursorPos = endPos, scrollTop = t.Canvas.scrollTop;
+
+                       if ( startPos != endPos ) {
+                               t.Canvas.value = t.Canvas.value.substring(0, startPos)
+                                             + t.Buttons[i].tagStart
+                                             + t.Canvas.value.substring(startPos, endPos)
+                                             + t.Buttons[i].tagEnd
+                                             + t.Canvas.value.substring(endPos, t.Canvas.value.length);
+                               cursorPos += t.Buttons[i].tagStart.length + t.Buttons[i].tagEnd.length;
+                       } else {
+                               if ( !t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
+                                       t.Canvas.value = t.Canvas.value.substring(0, startPos)
+                                                     + t.Buttons[i].tagStart
+                                                     + t.Canvas.value.substring(endPos, t.Canvas.value.length);
+                                       t.edAddTag(i);
+                                       cursorPos = startPos + t.Buttons[i].tagStart.length;
+                               } else {
+                                       t.Canvas.value = t.Canvas.value.substring(0, startPos)
+                                                     + t.Buttons[i].tagEnd
+                                                     + t.Canvas.value.substring(endPos, t.Canvas.value.length);
+                                       t.edRemoveTag(i);
+                                       cursorPos = startPos + t.Buttons[i].tagEnd.length;
+                               }
+                       }
+                       t.Canvas.focus();
+                       t.Canvas.selectionStart = cursorPos;
+                       t.Canvas.selectionEnd = cursorPos;
+                       t.Canvas.scrollTop = scrollTop;
+               } else {
+                       if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
+                               t.Canvas.value += Buttons[i].tagStart;
+                               t.edAddTag(i);
+                       } else {
+                               t.Canvas.value += Buttons[i].tagEnd;
+                               t.edRemoveTag(i);
+                       }
+                       t.Canvas.focus();
+               }
+       };
+
+       this.edInsertLink = function(i, defaultValue) {
+               if ( ! defaultValue )
+                       defaultValue = 'http://';
+
+               if ( ! t.edCheckOpenTags(i) ) {
+                       var URL = prompt(quicktagsL10n.enterURL, defaultValue);
+                       if ( URL ) {
+                               t.Buttons[i].tagStart = '<a href="' + URL + '">';
+                               t.edInsertTag(i);
+                       }
+               } else {
+                       t.edInsertTag(i);
+               }
+       };
+
+       this.edInsertImage = function() {
+               var myValue = prompt(quicktagsL10n.enterImageURL, 'http://');
+               if ( myValue ) {
+                       myValue = '<img src="'
+                                       + myValue
+                                       + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '')
+                                       + '" />';
+                       edInsertContent(t.Canvas, myValue);
+               }
+       };
+
+       t.Buttons[t.Buttons.length] = new edButton(name+'_strong','b','<strong>','</strong>','b');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_em','i','<em>','</em>','i');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_link','link','','</a>','a'); // special case
+       t.Buttons[t.Buttons.length] = new edButton(name+'_block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_del','del','<del datetime="' + datetime + '">','</del>','d');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_ins','ins','<ins datetime="' + datetime + '">','</ins>','s');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_img','img','','','m',-1); // special case
+       t.Buttons[t.Buttons.length] = new edButton(name+'_ul','ul','<ul>\n','</ul>\n\n','u');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_ol','ol','<ol>\n','</ol>\n\n','o');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_li','li','\t<li>','</li>\n','l');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_code','code','<code>','</code>','c');
+       t.Buttons[t.Buttons.length] = new edButton(name+'_more','more','<!--more-->','','t',-1);
+//     t.Buttons[t.Buttons.length] = new edButton(name+'_next','page','<!--nextpage-->','','p',-1);
+
+       tb = document.createElement('div');
+       tb.id = name+'_qtags';
+
+       html = '<div id="'+name+'_toolbar">';
+       for (i = 0; i < t.Buttons.length; i++)
+               html += t.edShowButton(t.Buttons[i], i);
+
+       html += '<input type="button" id="'+name+'_ed_spell" class="ed_button" onclick="edSpell('+name+'.Canvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />';
+       html += '<input type="button" id="'+name+'_ed_close" class="ed_button" onclick="'+name+'.edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" /></div>';
+
+       tb.innerHTML = html;
+       cont.parentNode.insertBefore(tb, cont);
+
+};
index da1405594918167c7521b364af5a7d801d0151b0..da51f4e96fc3fc72497221033cb5ecd6939573dc 100644 (file)
@@ -1,582 +1 @@
-// new edit toolbar used with permission
-// by Alex King
-// http://www.alexking.org/
-
-var edButtons = new Array();
-var edLinks = new Array();
-var edOpenTags = new Array();
-
-function edButton(id, display, tagStart, tagEnd, access, open) {
-       this.id = id;                           // used to name the toolbar button
-       this.display = display;         // label on button
-       this.tagStart = tagStart;       // open tag
-       this.tagEnd = tagEnd;           // close tag
-       this.access = access;           // access key
-       this.open = open;                       // set to -1 if tag does not need to be closed
-}
-
-function zeroise(number, threshold) {
-       // FIXME: or we could use an implementation of printf in js here
-       var str = number.toString();
-       if (number < 0) { str = str.substr(1, str.length) }
-       while (str.length < threshold) { str = "0" + str }
-       if (number < 0) { str = '-' + str }
-       return str;
-}
-
-var now = new Date();
-var datetime = now.getUTCFullYear() + '-' +
-zeroise(now.getUTCMonth() + 1, 2) + '-' +
-zeroise(now.getUTCDate(), 2) + 'T' +
-zeroise(now.getUTCHours(), 2) + ':' +
-zeroise(now.getUTCMinutes(), 2) + ':' +
-zeroise(now.getUTCSeconds() ,2) +
-'+00:00';
-
-edButtons[edButtons.length] =
-new edButton('ed_strong'
-,'b'
-,'<strong>'
-,'</strong>'
-,'b'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_em'
-,'i'
-,'<em>'
-,'</em>'
-,'i'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_link'
-,'link'
-,''
-,'</a>'
-,'a'
-); // special case
-
-edButtons[edButtons.length] =
-new edButton('ed_block'
-,'b-quote'
-,'\n\n<blockquote>'
-,'</blockquote>\n\n'
-,'q'
-);
-
-
-edButtons[edButtons.length] =
-new edButton('ed_del'
-,'del'
-,'<del datetime="' + datetime + '">'
-,'</del>'
-,'d'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_ins'
-,'ins'
-,'<ins datetime="' + datetime + '">'
-,'</ins>'
-,'s'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_img'
-,'img'
-,''
-,''
-,'m'
-,-1
-); // special case
-
-edButtons[edButtons.length] =
-new edButton('ed_ul'
-,'ul'
-,'<ul>\n'
-,'</ul>\n\n'
-,'u'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_ol'
-,'ol'
-,'<ol>\n'
-,'</ol>\n\n'
-,'o'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_li'
-,'li'
-,'\t<li>'
-,'</li>\n'
-,'l'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_code'
-,'code'
-,'<code>'
-,'</code>'
-,'c'
-);
-
-edButtons[edButtons.length] =
-new edButton('ed_more'
-,'more'
-,'<!--more-->'
-,''
-,'t'
-,-1
-);
-/*
-edButtons[edButtons.length] =
-new edButton('ed_next'
-,'page'
-,'<!--nextpage-->'
-,''
-,'p'
-,-1
-);
-*/
-function edLink() {
-       this.display = '';
-       this.URL = '';
-       this.newWin = 0;
-}
-
-edLinks[edLinks.length] = new edLink('WordPress'
-                                    ,'http://wordpress.org/'
-                                    );
-
-edLinks[edLinks.length] = new edLink('alexking.org'
-                                    ,'http://www.alexking.org/'
-                                    );
-
-function edShowButton(button, i) {
-       if (button.id == 'ed_img') {
-               document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />');
-       }
-       else if (button.id == 'ed_link') {
-               document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />');
-       }
-       else {
-               document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '"  />');
-       }
-}
-
-function edShowLinks() {
-       var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>' + quicktagsL10n.quickLinks + '</option>';
-       for (i = 0; i < edLinks.length; i++) {
-               tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>';
-       }
-       tempStr += '</select>';
-       document.write(tempStr);
-}
-
-function edAddTag(button) {
-       if (edButtons[button].tagEnd != '') {
-               edOpenTags[edOpenTags.length] = button;
-               document.getElementById(edButtons[button].id).value = '/' + document.getElementById(edButtons[button].id).value;
-       }
-}
-
-function edRemoveTag(button) {
-       for (i = 0; i < edOpenTags.length; i++) {
-               if (edOpenTags[i] == button) {
-                       edOpenTags.splice(i, 1);
-                       document.getElementById(edButtons[button].id).value =           document.getElementById(edButtons[button].id).value.replace('/', '');
-               }
-       }
-}
-
-function edCheckOpenTags(button) {
-       var tag = 0;
-       for (i = 0; i < edOpenTags.length; i++) {
-               if (edOpenTags[i] == button) {
-                       tag++;
-               }
-       }
-       if (tag > 0) {
-               return true; // tag found
-       }
-       else {
-               return false; // tag not found
-       }
-}
-
-function edCloseAllTags() {
-       var count = edOpenTags.length;
-       for (o = 0; o < count; o++) {
-               edInsertTag(edCanvas, edOpenTags[edOpenTags.length - 1]);
-       }
-}
-
-function edQuickLink(i, thisSelect) {
-       if (i > -1) {
-               var newWin = '';
-               if (edLinks[i].newWin == 1) {
-                       newWin = ' target="_blank"';
-               }
-               var tempStr = '<a href="' + edLinks[i].URL + '"' + newWin + '>'
-                           + edLinks[i].display
-                           + '</a>';
-               thisSelect.selectedIndex = 0;
-               edInsertContent(edCanvas, tempStr);
-       }
-       else {
-               thisSelect.selectedIndex = 0;
-       }
-}
-
-function edSpell(myField) {
-       var word = '';
-       if (document.selection) {
-               myField.focus();
-           var sel = document.selection.createRange();
-               if (sel.text.length > 0) {
-                       word = sel.text;
-               }
-       }
-       else if (myField.selectionStart || myField.selectionStart == '0') {
-               var startPos = myField.selectionStart;
-               var endPos = myField.selectionEnd;
-               if (startPos != endPos) {
-                       word = myField.value.substring(startPos, endPos);
-               }
-       }
-       if (word == '') {
-               word = prompt(quicktagsL10n.wordLookup, '');
-       }
-       if (word !== null && /^\w[\w ]*$/.test(word)) {
-               window.open('http://www.answers.com/' + escape(word));
-       }
-}
-
-function edToolbar() {
-       document.write('<div id="ed_toolbar">');
-       for (i = 0; i < edButtons.length; i++) {
-               edShowButton(edButtons[i], i);
-       }
-       document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />');
-       document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />');
-//     edShowLinks(); // disabled by default
-       document.write('</div>');
-}
-
-// insertion code
-
-function edInsertTag(myField, i) {
-       //IE support
-       if (document.selection) {
-               myField.focus();
-           sel = document.selection.createRange();
-               if (sel.text.length > 0) {
-                       sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
-               }
-               else {
-                       if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
-                               sel.text = edButtons[i].tagStart;
-                               edAddTag(i);
-                       }
-                       else {
-                               sel.text = edButtons[i].tagEnd;
-                               edRemoveTag(i);
-                       }
-               }
-               myField.focus();
-       }
-       //MOZILLA/NETSCAPE support
-       else if (myField.selectionStart || myField.selectionStart == '0') {
-               var startPos = myField.selectionStart;
-               var endPos = myField.selectionEnd;
-               var cursorPos = endPos;
-               var scrollTop = myField.scrollTop;
-
-               if (startPos != endPos) {
-                       myField.value = myField.value.substring(0, startPos)
-                                     + edButtons[i].tagStart
-                                     + myField.value.substring(startPos, endPos)
-                                     + edButtons[i].tagEnd
-                                     + myField.value.substring(endPos, myField.value.length);
-                       cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length;
-               }
-               else {
-                       if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
-                               myField.value = myField.value.substring(0, startPos)
-                                             + edButtons[i].tagStart
-                                             + myField.value.substring(endPos, myField.value.length);
-                               edAddTag(i);
-                               cursorPos = startPos + edButtons[i].tagStart.length;
-                       }
-                       else {
-                               myField.value = myField.value.substring(0, startPos)
-                                             + edButtons[i].tagEnd
-                                             + myField.value.substring(endPos, myField.value.length);
-                               edRemoveTag(i);
-                               cursorPos = startPos + edButtons[i].tagEnd.length;
-                       }
-               }
-               myField.focus();
-               myField.selectionStart = cursorPos;
-               myField.selectionEnd = cursorPos;
-               myField.scrollTop = scrollTop;
-       }
-       else {
-               if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
-                       myField.value += edButtons[i].tagStart;
-                       edAddTag(i);
-               }
-               else {
-                       myField.value += edButtons[i].tagEnd;
-                       edRemoveTag(i);
-               }
-               myField.focus();
-       }
-}
-
-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();
-       }
-}
-
-function edInsertLink(myField, i, defaultValue) {
-       if (!defaultValue) {
-               defaultValue = 'http://';
-       }
-       if (!edCheckOpenTags(i)) {
-               var URL = prompt(quicktagsL10n.enterURL, defaultValue);
-               if (URL) {
-                       edButtons[i].tagStart = '<a href="' + URL + '">';
-                       edInsertTag(myField, i);
-               }
-       }
-       else {
-               edInsertTag(myField, i);
-       }
-}
-
-function edInsertImage(myField) {
-       var myValue = prompt(quicktagsL10n.enterImageURL, 'http://');
-       if (myValue) {
-               myValue = '<img src="'
-                               + myValue
-                               + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '')
-                               + '" />';
-               edInsertContent(myField, myValue);
-       }
-}
-
-
-// Allow multiple instances.
-// Name = unique value, id = textarea id, container = container div.
-// Can disable some buttons by passing comma delimited string as 4th param.
-var QTags = function(name, id, container, disabled) {
-       var t = this, cont = document.getElementById(container);
-
-       t.Buttons = [];
-       t.Links = [];
-       t.OpenTags = [];
-       t.Canvas = document.getElementById(id);
-
-       if ( ! t.Canvas || ! cont )
-               return;
-
-       disabled = ( typeof disabled != 'undefined' ) ? ','+disabled+',' : '';
-
-       t.edShowButton = function(button, i) {
-               if ( disabled && (disabled.indexOf(','+button.display+',') != -1) )
-                       return '';
-               else if ( button.id == name+'_img' )
-                       return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage('+name+'.Canvas);" value="' + button.display + '" />';
-               else if (button.id == name+'_link')
-                       return '<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="'+name+'.edInsertLink('+i+');" value="'+button.display+'" />';
-               else
-                       return '<input type="button" id="' + button.id + '" accesskey="'+button.access+'" class="ed_button" onclick="'+name+'.edInsertTag('+i+');" value="'+button.display+'" />';
-       };
-
-       t.edAddTag = function(button) {
-               if ( t.Buttons[button].tagEnd != '' ) {
-                       t.OpenTags[t.OpenTags.length] = button;
-                       document.getElementById(t.Buttons[button].id).value = '/' + document.getElementById(t.Buttons[button].id).value;
-               }
-       };
-
-       t.edRemoveTag = function(button) {
-               for ( var i = 0; i < t.OpenTags.length; i++ ) {
-                       if ( t.OpenTags[i] == button ) {
-                               t.OpenTags.splice(i, 1);
-                               document.getElementById(t.Buttons[button].id).value = document.getElementById(t.Buttons[button].id).value.replace('/', '');
-                       }
-               }
-       };
-
-       t.edCheckOpenTags = function(button) {
-               var tag = 0;
-               for ( var i = 0; i < t.OpenTags.length; i++ ) {
-                       if ( t.OpenTags[i] == button )
-                               tag++;
-               }
-               if ( tag > 0 ) return true; // tag found
-               else return false; // tag not found
-       };
-
-       this.edCloseAllTags = function() {
-               var count = t.OpenTags.length;
-               for ( var o = 0; o < count; o++ )
-                       t.edInsertTag(t.OpenTags[t.OpenTags.length - 1]);
-       };
-
-       this.edQuickLink = function(i, thisSelect) {
-               if ( i > -1 ) {
-                       var newWin = '';
-                       if ( Links[i].newWin == 1 ) {
-                               newWin = ' target="_blank"';
-                       }
-                       var tempStr = '<a href="' + Links[i].URL + '"' + newWin + '>'
-                                   + Links[i].display
-                                   + '</a>';
-                       thisSelect.selectedIndex = 0;
-                       edInsertContent(t.Canvas, tempStr);
-               } else {
-                       thisSelect.selectedIndex = 0;
-               }
-       };
-
-       // insertion code
-       t.edInsertTag = function(i) {
-               //IE support
-               if ( document.selection ) {
-                       t.Canvas.focus();
-                   sel = document.selection.createRange();
-                       if ( sel.text.length > 0 ) {
-                               sel.text = t.Buttons[i].tagStart + sel.text + t.Buttons[i].tagEnd;
-                       } else {
-                               if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
-                                       sel.text = t.Buttons[i].tagStart;
-                                       t.edAddTag(i);
-                               } else {
-                                       sel.text = t.Buttons[i].tagEnd;
-                                       t.edRemoveTag(i);
-                               }
-                       }
-                       t.Canvas.focus();
-               } else if ( t.Canvas.selectionStart || t.Canvas.selectionStart == '0' ) { //MOZILLA/NETSCAPE support
-                       var startPos = t.Canvas.selectionStart;
-                       var endPos = t.Canvas.selectionEnd;
-                       var cursorPos = endPos;
-                       var scrollTop = t.Canvas.scrollTop;
-
-                       if ( startPos != endPos ) {
-                               t.Canvas.value = t.Canvas.value.substring(0, startPos)
-                                             + t.Buttons[i].tagStart
-                                             + t.Canvas.value.substring(startPos, endPos)
-                                             + t.Buttons[i].tagEnd
-                                             + t.Canvas.value.substring(endPos, t.Canvas.value.length);
-                               cursorPos += t.Buttons[i].tagStart.length + t.Buttons[i].tagEnd.length;
-                       } else {
-                               if ( !t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
-                                       t.Canvas.value = t.Canvas.value.substring(0, startPos)
-                                                     + t.Buttons[i].tagStart
-                                                     + t.Canvas.value.substring(endPos, t.Canvas.value.length);
-                                       t.edAddTag(i);
-                                       cursorPos = startPos + t.Buttons[i].tagStart.length;
-                               } else {
-                                       t.Canvas.value = t.Canvas.value.substring(0, startPos)
-                                                     + t.Buttons[i].tagEnd
-                                                     + t.Canvas.value.substring(endPos, t.Canvas.value.length);
-                                       t.edRemoveTag(i);
-                                       cursorPos = startPos + t.Buttons[i].tagEnd.length;
-                               }
-                       }
-                       t.Canvas.focus();
-                       t.Canvas.selectionStart = cursorPos;
-                       t.Canvas.selectionEnd = cursorPos;
-                       t.Canvas.scrollTop = scrollTop;
-               } else {
-                       if ( ! t.edCheckOpenTags(i) || t.Buttons[i].tagEnd == '' ) {
-                               t.Canvas.value += Buttons[i].tagStart;
-                               t.edAddTag(i);
-                       } else {
-                               t.Canvas.value += Buttons[i].tagEnd;
-                               t.edRemoveTag(i);
-                       }
-                       t.Canvas.focus();
-               }
-       };
-
-       this.edInsertLink = function(i, defaultValue) {
-               if ( ! defaultValue )
-                       defaultValue = 'http://';
-
-               if ( ! t.edCheckOpenTags(i) ) {
-                       var URL = prompt(quicktagsL10n.enterURL, defaultValue);
-                       if ( URL ) {
-                               t.Buttons[i].tagStart = '<a href="' + URL + '">';
-                               t.edInsertTag(i);
-                       }
-               } else {
-                       t.edInsertTag(i);
-               }
-       };
-
-       this.edInsertImage = function() {
-               var myValue = prompt(quicktagsL10n.enterImageURL, 'http://');
-               if ( myValue ) {
-                       myValue = '<img src="'
-                                       + myValue
-                                       + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '')
-                                       + '" />';
-                       edInsertContent(t.Canvas, myValue);
-               }
-       };
-
-       t.Buttons[t.Buttons.length] = new edButton(name+'_strong','b','<strong>','</strong>','b');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_em','i','<em>','</em>','i');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_link','link','','</a>','a'); // special case
-       t.Buttons[t.Buttons.length] = new edButton(name+'_block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_del','del','<del datetime="' + datetime + '">','</del>','d');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_ins','ins','<ins datetime="' + datetime + '">','</ins>','s');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_img','img','','','m',-1); // special case
-       t.Buttons[t.Buttons.length] = new edButton(name+'_ul','ul','<ul>\n','</ul>\n\n','u');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_ol','ol','<ol>\n','</ol>\n\n','o');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_li','li','\t<li>','</li>\n','l');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_code','code','<code>','</code>','c');
-       t.Buttons[t.Buttons.length] = new edButton(name+'_more','more','<!--more-->','','t',-1);
-//     t.Buttons[t.Buttons.length] = new edButton(name+'_next','page','<!--nextpage-->','','p',-1);
-
-       var tb = document.createElement('div');
-       tb.id = name+'_qtags';
-
-       var html = '<div id="'+name+'_toolbar">';
-       for (var i = 0; i < t.Buttons.length; i++)
-               html += t.edShowButton(t.Buttons[i], i);
-
-       html += '<input type="button" id="'+name+'_ed_spell" class="ed_button" onclick="edSpell('+name+'.Canvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />';
-       html += '<input type="button" id="'+name+'_ed_close" class="ed_button" onclick="'+name+'.edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" /></div>';
-
-       tb.innerHTML = html;
-       cont.parentNode.insertBefore(tb, cont);
-
-};
+var edButtons=new Array(),edLinks=new Array(),edOpenTags=new Array(),now=new Date(),datetime;function edButton(f,e,c,b,a,d){this.id=f;this.display=e;this.tagStart=c;this.tagEnd=b;this.access=a;this.open=d}function zeroise(b,a){var c=b.toString();if(b<0){c=c.substr(1,c.length)}while(c.length<a){c="0"+c}if(b<0){c="-"+c}return c}datetime=now.getUTCFullYear()+"-"+zeroise(now.getUTCMonth()+1,2)+"-"+zeroise(now.getUTCDate(),2)+"T"+zeroise(now.getUTCHours(),2)+":"+zeroise(now.getUTCMinutes(),2)+":"+zeroise(now.getUTCSeconds(),2)+"+00:00";edButtons[edButtons.length]=new edButton("ed_strong","b","<strong>","</strong>","b");edButtons[edButtons.length]=new edButton("ed_em","i","<em>","</em>","i");edButtons[edButtons.length]=new edButton("ed_link","link","","</a>","a");edButtons[edButtons.length]=new edButton("ed_block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q");edButtons[edButtons.length]=new edButton("ed_del","del",'<del datetime="'+datetime+'">',"</del>","d");edButtons[edButtons.length]=new edButton("ed_ins","ins",'<ins datetime="'+datetime+'">',"</ins>","s");edButtons[edButtons.length]=new edButton("ed_img","img","","","m",-1);edButtons[edButtons.length]=new edButton("ed_ul","ul","<ul>\n","</ul>\n\n","u");edButtons[edButtons.length]=new edButton("ed_ol","ol","<ol>\n","</ol>\n\n","o");edButtons[edButtons.length]=new edButton("ed_li","li","\t<li>","</li>\n","l");edButtons[edButtons.length]=new edButton("ed_code","code","<code>","</code>","c");edButtons[edButtons.length]=new edButton("ed_more","more","<!--more-->","","t",-1);function edLink(){this.display="";this.URL="";this.newWin=0}edLinks[edLinks.length]=new edLink("WordPress","http://wordpress.org/");edLinks[edLinks.length]=new edLink("alexking.org","http://www.alexking.org/");function edShowButton(b,a){if(b.id=="ed_img"){document.write('<input type="button" id="'+b.id+'" accesskey="'+b.access+'" class="ed_button" onclick="edInsertImage(edCanvas);" value="'+b.display+'" />')}else{if(b.id=="ed_link"){document.write('<input type="button" id="'+b.id+'" accesskey="'+b.access+'" class="ed_button" onclick="edInsertLink(edCanvas, '+a+');" value="'+b.display+'" />')}else{document.write('<input type="button" id="'+b.id+'" accesskey="'+b.access+'" class="ed_button" onclick="edInsertTag(edCanvas, '+a+');" value="'+b.display+'"  />')}}}function edShowLinks(){var a='<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>'+quicktagsL10n.quickLinks+"</option>",b;for(b=0;b<edLinks.length;b++){a+='<option value="'+b+'">'+edLinks[b].display+"</option>"}a+="</select>";document.write(a)}function edAddTag(a){if(edButtons[a].tagEnd!=""){edOpenTags[edOpenTags.length]=a;document.getElementById(edButtons[a].id).value="/"+document.getElementById(edButtons[a].id).value}}function edRemoveTag(b){for(var a=0;a<edOpenTags.length;a++){if(edOpenTags[a]==b){edOpenTags.splice(a,1);document.getElementById(edButtons[b].id).value=document.getElementById(edButtons[b].id).value.replace("/","")}}}function edCheckOpenTags(c){var a=0,b;for(b=0;b<edOpenTags.length;b++){if(edOpenTags[b]==c){a++}}if(a>0){return true}else{return false}}function edCloseAllTags(){var a=edOpenTags.length,b;for(b=0;b<a;b++){edInsertTag(edCanvas,edOpenTags[edOpenTags.length-1])}}function edQuickLink(c,d){if(c>-1){var b="",a;if(edLinks[c].newWin==1){b=' target="_blank"'}a='<a href="'+edLinks[c].URL+'"'+b+">"+edLinks[c].display+"</a>";d.selectedIndex=0;edInsertContent(edCanvas,a)}else{d.selectedIndex=0}}function edSpell(c){var e="",d,b,a;if(document.selection){c.focus();d=document.selection.createRange();if(d.text.length>0){e=d.text}}else{if(c.selectionStart||c.selectionStart=="0"){b=c.selectionStart;a=c.selectionEnd;if(b!=a){e=c.value.substring(b,a)}}}if(e==""){e=prompt(quicktagsL10n.wordLookup,"")}if(e!==null&&/^\w[\w ]*$/.test(e)){window.open("http://www.answers.com/"+escape(e))}}function edToolbar(){document.write('<div id="ed_toolbar">');for(var a=0;a<edButtons.length;a++){edShowButton(edButtons[a],a)}document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="'+quicktagsL10n.dictionaryLookup+'" value="'+quicktagsL10n.lookup+'" />');document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="'+quicktagsL10n.closeAllOpenTags+'" value="'+quicktagsL10n.closeTags+'" />');document.write("</div>")}function edInsertTag(d,c){if(document.selection){d.focus();var e=document.selection.createRange();if(e.text.length>0){e.text=edButtons[c].tagStart+e.text+edButtons[c].tagEnd}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){e.text=edButtons[c].tagStart;edAddTag(c)}else{e.text=edButtons[c].tagEnd;edRemoveTag(c)}}d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){var b=d.selectionStart,a=d.selectionEnd,g=a,f=d.scrollTop;if(b!=a){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(b,a)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);g+=edButtons[c].tagStart.length+edButtons[c].tagEnd.length}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value=d.value.substring(0,b)+edButtons[c].tagStart+d.value.substring(a,d.value.length);edAddTag(c);g=b+edButtons[c].tagStart.length}else{d.value=d.value.substring(0,b)+edButtons[c].tagEnd+d.value.substring(a,d.value.length);edRemoveTag(c);g=b+edButtons[c].tagEnd.length}}d.focus();d.selectionStart=g;d.selectionEnd=g;d.scrollTop=f}else{if(!edCheckOpenTags(c)||edButtons[c].tagEnd==""){d.value+=edButtons[c].tagStart;edAddTag(c)}else{d.value+=edButtons[c].tagEnd;edRemoveTag(c)}d.focus()}}}function edInsertContent(d,c){var e,b,a,f;if(document.selection){d.focus();e=document.selection.createRange();e.text=c;d.focus()}else{if(d.selectionStart||d.selectionStart=="0"){b=d.selectionStart;a=d.selectionEnd;f=d.scrollTop;d.value=d.value.substring(0,b)+c+d.value.substring(a,d.value.length);d.focus();d.selectionStart=b+c.length;d.selectionEnd=b+c.length;d.scrollTop=f}else{d.value+=c;d.focus()}}}function edInsertLink(d,c,b){if(!b){b="http://"}if(!edCheckOpenTags(c)){var a=prompt(quicktagsL10n.enterURL,b);if(a){edButtons[c].tagStart='<a href="'+a+'">';edInsertTag(d,c)}}else{edInsertTag(d,c)}}function edInsertImage(b){var a=prompt(quicktagsL10n.enterImageURL,"http://");if(a){a='<img src="'+a+'" alt="'+prompt(quicktagsL10n.enterImageDescription,"")+'" />';edInsertContent(b,a)}}var QTags=function(a,c,b,f){var j=this,k=document.getElementById(b),g,l,e,h,d;j.Buttons=[];j.Links=[];j.OpenTags=[];j.Canvas=document.getElementById(c);if(!j.Canvas||!k){return}f=(typeof f!="undefined")?","+f+",":"";j.edShowButton=function(n,m){if(f&&(f.indexOf(","+n.display+",")!=-1)){return""}else{if(n.id==a+"_img"){return'<input type="button" id="'+n.id+'" accesskey="'+n.access+'" class="ed_button" onclick="edInsertImage('+a+'.Canvas);" value="'+n.display+'" />'}else{if(n.id==a+"_link"){return'<input type="button" id="'+n.id+'" accesskey="'+n.access+'" class="ed_button" onclick="'+a+".edInsertLink("+m+');" value="'+n.display+'" />'}else{return'<input type="button" id="'+n.id+'" accesskey="'+n.access+'" class="ed_button" onclick="'+a+".edInsertTag("+m+');" value="'+n.display+'" />'}}}};j.edAddTag=function(i){if(j.Buttons[i].tagEnd!=""){j.OpenTags[j.OpenTags.length]=i;document.getElementById(j.Buttons[i].id).value="/"+document.getElementById(j.Buttons[i].id).value}};j.edRemoveTag=function(i){for(g=0;g<j.OpenTags.length;g++){if(j.OpenTags[g]==i){j.OpenTags.splice(g,1);document.getElementById(j.Buttons[i].id).value=document.getElementById(j.Buttons[i].id).value.replace("/","")}}};j.edCheckOpenTags=function(n){l=0;for(var m=0;m<j.OpenTags.length;m++){if(j.OpenTags[m]==n){l++}}if(l>0){return true}else{return false}};this.edCloseAllTags=function(){var i=j.OpenTags.length;for(var m=0;m<i;m++){j.edInsertTag(j.OpenTags[j.OpenTags.length-1])}};this.edQuickLink=function(o,p){if(o>-1){var n="",m;if(Links[o].newWin==1){n=' target="_blank"'}m='<a href="'+Links[o].URL+'"'+n+">"+Links[o].display+"</a>";p.selectedIndex=0;edInsertContent(j.Canvas,m)}else{p.selectedIndex=0}};j.edInsertTag=function(o){if(document.selection){j.Canvas.focus();d=document.selection.createRange();if(d.text.length>0){d.text=j.Buttons[o].tagStart+d.text+j.Buttons[o].tagEnd}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){d.text=j.Buttons[o].tagStart;j.edAddTag(o)}else{d.text=j.Buttons[o].tagEnd;j.edRemoveTag(o)}}j.Canvas.focus()}else{if(j.Canvas.selectionStart||j.Canvas.selectionStart=="0"){var n=j.Canvas.selectionStart,m=j.Canvas.selectionEnd,q=m,p=j.Canvas.scrollTop;if(n!=m){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(n,m)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);q+=j.Buttons[o].tagStart.length+j.Buttons[o].tagEnd.length}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagStart+j.Canvas.value.substring(m,j.Canvas.value.length);j.edAddTag(o);q=n+j.Buttons[o].tagStart.length}else{j.Canvas.value=j.Canvas.value.substring(0,n)+j.Buttons[o].tagEnd+j.Canvas.value.substring(m,j.Canvas.value.length);j.edRemoveTag(o);q=n+j.Buttons[o].tagEnd.length}}j.Canvas.focus();j.Canvas.selectionStart=q;j.Canvas.selectionEnd=q;j.Canvas.scrollTop=p}else{if(!j.edCheckOpenTags(o)||j.Buttons[o].tagEnd==""){j.Canvas.value+=Buttons[o].tagStart;j.edAddTag(o)}else{j.Canvas.value+=Buttons[o].tagEnd;j.edRemoveTag(o)}j.Canvas.focus()}}};this.edInsertLink=function(o,n){if(!n){n="http://"}if(!j.edCheckOpenTags(o)){var m=prompt(quicktagsL10n.enterURL,n);if(m){j.Buttons[o].tagStart='<a href="'+m+'">';j.edInsertTag(o)}}else{j.edInsertTag(o)}};this.edInsertImage=function(){var i=prompt(quicktagsL10n.enterImageURL,"http://");if(i){i='<img src="'+i+'" alt="'+prompt(quicktagsL10n.enterImageDescription,"")+'" />';edInsertContent(j.Canvas,i)}};j.Buttons[j.Buttons.length]=new edButton(a+"_strong","b","<strong>","</strong>","b");j.Buttons[j.Buttons.length]=new edButton(a+"_em","i","<em>","</em>","i");j.Buttons[j.Buttons.length]=new edButton(a+"_link","link","","</a>","a");j.Buttons[j.Buttons.length]=new edButton(a+"_block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q");j.Buttons[j.Buttons.length]=new edButton(a+"_del","del",'<del datetime="'+datetime+'">',"</del>","d");j.Buttons[j.Buttons.length]=new edButton(a+"_ins","ins",'<ins datetime="'+datetime+'">',"</ins>","s");j.Buttons[j.Buttons.length]=new edButton(a+"_img","img","","","m",-1);j.Buttons[j.Buttons.length]=new edButton(a+"_ul","ul","<ul>\n","</ul>\n\n","u");j.Buttons[j.Buttons.length]=new edButton(a+"_ol","ol","<ol>\n","</ol>\n\n","o");j.Buttons[j.Buttons.length]=new edButton(a+"_li","li","\t<li>","</li>\n","l");j.Buttons[j.Buttons.length]=new edButton(a+"_code","code","<code>","</code>","c");j.Buttons[j.Buttons.length]=new edButton(a+"_more","more","<!--more-->","","t",-1);e=document.createElement("div");e.id=a+"_qtags";h='<div id="'+a+'_toolbar">';for(g=0;g<j.Buttons.length;g++){h+=j.edShowButton(j.Buttons[g],g)}h+='<input type="button" id="'+a+'_ed_spell" class="ed_button" onclick="edSpell('+a+'.Canvas);" title="'+quicktagsL10n.dictionaryLookup+'" value="'+quicktagsL10n.lookup+'" />';h+='<input type="button" id="'+a+'_ed_close" class="ed_button" onclick="'+a+'.edCloseAllTags();" title="'+quicktagsL10n.closeAllOpenTags+'" value="'+quicktagsL10n.closeTags+'" /></div>';e.innerHTML=h;k.parentNode.insertBefore(e,k)};
\ No newline at end of file
diff --git a/wp-includes/js/swfobject.js b/wp-includes/js/swfobject.js
new file mode 100644 (file)
index 0000000..08fb270
--- /dev/null
@@ -0,0 +1,5 @@
+/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
+       Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
+       This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
\ No newline at end of file
diff --git a/wp-includes/js/swfupload/handlers.dev.js b/wp-includes/js/swfupload/handlers.dev.js
new file mode 100644 (file)
index 0000000..bc7e5ef
--- /dev/null
@@ -0,0 +1,316 @@
+
+function fileDialogStart() {
+       jQuery("#media-upload-error").empty();
+}
+
+// progress and success handlers for media multi uploads
+function fileQueued(fileObj) {
+       // Get rid of unused form
+       jQuery('.media-blank').remove();
+       // Collapse a single item
+       if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
+               jQuery('.describe-toggle-on').show();
+               jQuery('.describe-toggle-off').hide();
+               jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
+       }
+       // Create a progress bar containing the filename
+       jQuery('#media-items').append('<div id="media-item-' + fileObj.id + '" class="media-item child-of-' + post_id + '"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> ' + fileObj.name + '</div></div>');
+       // Display the progress div
+       jQuery('#media-item-' + fileObj.id + ' .progress').show();
+
+       // Disable submit and enable cancel
+       jQuery('#insert-gallery').attr('disabled', 'disabled');
+       jQuery('#cancel-upload').attr('disabled', '');
+}
+
+function uploadStart(fileObj) {
+       return true;
+}
+
+function uploadProgress(fileObj, bytesDone, bytesTotal) {
+       // Lengthen the progress bar
+       var w = jQuery('#media-items').width() - 2;
+       jQuery('#media-item-' + fileObj.id + ' .bar').width( w * bytesDone / bytesTotal );
+       jQuery('#media-item-' + fileObj.id + ' .percent').html( Math.ceil(bytesDone / bytesTotal * 100) + '%' );
+
+       if ( bytesDone == bytesTotal )
+               jQuery('#media-item-' + fileObj.id + ' .bar').html('<strong class="crunching">' + swfuploadL10n.crunching + '</strong>');
+}
+
+function prepareMediaItem(fileObj, serverData) {
+       // Move the progress bar to 100%
+       jQuery('#media-item-' + fileObj.id + ' .bar').remove();
+       jQuery('#media-item-' + fileObj.id + ' .progress').hide();
+
+       var f = ( typeof shortform == 'undefined' ) ? 1 : 2;
+       // Old style: Append the HTML returned by the server -- thumbnail and form inputs
+       if ( isNaN(serverData) || !serverData ) {
+               jQuery('#media-item-' + fileObj.id).append(serverData);
+               prepareMediaItemInit(fileObj);
+       }
+       // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
+       else {
+               jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
+       }
+}
+               
+function prepareMediaItemInit(fileObj) {
+
+       // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
+       jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id);
+
+       // Replace the original filename with the new (unique) one assigned during upload
+       jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
+
+       // Also bind toggle to the links
+       jQuery('#media-item-' + fileObj.id + ' a.toggle').click(function(){
+               jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){
+                       var o = jQuery(this).offset();
+                       window.scrollTo(0, o.top-36);
+               });
+               jQuery(this).parent().children('.toggle').toggle();
+               jQuery(this).siblings('a.toggle').focus();
+               return false;
+       });
+
+       // Bind AJAX to the new Delete button
+       jQuery('#media-item-' + fileObj.id + ' a.delete').click(function(){
+               // Tell the server to delete it. TODO: handle exceptions
+               jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{
+                       id : this.id.replace(/[^0-9]/g,''),
+                       action : 'delete-post',
+                       _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')}
+                       });
+               return false;
+       });
+
+       // Open this item if it says to start open (e.g. to display an error)
+       jQuery('#media-item-' + fileObj.id + '.startopen').removeClass('startopen').slideToggle(500).parent().children('.toggle').toggle();
+}
+
+function itemAjaxError(id, html) {
+       var error = jQuery('#media-item-error' + id);
+
+       error.html('<div class="file-error"><button type="button" id="dismiss-'+id+'" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+html+'</div>');
+       jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})});
+}
+
+function deleteSuccess(data, textStatus) {
+       if ( data == '-1' )
+               return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
+       if ( data == '0' )
+               return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
+
+       var item = jQuery('#media-item-' + this.id);
+
+       // Decrement the counters.
+       if ( type = jQuery('#type-of-' + this.id).val() )
+               jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1);
+       if ( item.hasClass('child-of-'+post_id) )
+               jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1);
+
+       if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
+               jQuery('.toggle').toggle();
+               jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
+       }
+
+       // Vanish it.
+       jQuery('#media-item-' + this.id + ' .filename:empty').remove();
+       jQuery('#media-item-' + this.id + ' .filename').append(' <span class="file-error">'+swfuploadL10n.deleted+'</span>').siblings('a.toggle').remove();
+       jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end()
+                       .animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50})
+                       .animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()})
+                       .animate({backgroundColor:'#fff'}, 400)
+                       .animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();});
+
+       return;
+}
+
+function deleteError(X, textStatus, errorThrown) {
+       // TODO
+}
+
+function updateMediaForm() {
+       storeState();
+       // Just one file, no need for collapsible part
+       if ( jQuery('.type-form #media-items>*').length == 1 ) {
+               jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle();
+               jQuery('.type-form .slidetoggle').siblings().addClass('hidden');
+       }
+
+       // Only show Save buttons when there is at least one file.
+       if ( jQuery('#media-items>*').not('.media-blank').length > 0 )
+               jQuery('.savebutton').show();
+       else
+               jQuery('.savebutton').hide();
+
+       // Only show Gallery button when there are at least two files.
+       if ( jQuery('#media-items>*').length > 1 )
+               jQuery('.insert-gallery').show();
+       else
+               jQuery('.insert-gallery').hide();
+}
+
+function uploadSuccess(fileObj, serverData) {
+       // if async-upload returned an error message, place it in the media item div and return
+       if ( serverData.match('media-upload-error') ) {
+               jQuery('#media-item-' + fileObj.id).html(serverData);
+               return;
+       }
+
+       prepareMediaItem(fileObj, serverData);
+       updateMediaForm();
+
+       // Increment the counter.
+       if ( jQuery('#media-item-' + fileObj.id).hasClass('child-of-' + post_id) )
+               jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
+}
+
+function uploadComplete(fileObj) {
+       // If no more uploads queued, enable the submit button
+       if ( swfu.getStats().files_queued == 0 ) {
+               jQuery('#cancel-upload').attr('disabled', 'disabled');
+               jQuery('#insert-gallery').attr('disabled', '');
+       }
+}
+
+
+// wp-specific error handlers
+
+// generic message
+function wpQueueError(message) {
+       jQuery('#media-upload-error').show().text(message);
+}
+
+// file-specific message
+function wpFileError(fileObj, message) {
+       jQuery('#media-item-' + fileObj.id + ' .filename').after('<div class="file-error"><button type="button" id="dismiss-' + fileObj.id + '" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+message+'</div>').siblings('.toggle').remove();
+       jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
+}
+
+function fileQueueError(fileObj, error_code, message)  {
+       // Handle this error separately because we don't want to create a FileProgress element for it.
+       if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) {
+               wpQueueError(swfuploadL10n.queue_limit_exceeded);
+       }
+       else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) {
+               fileQueued(fileObj);
+               wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit);
+       }
+       else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) {
+               fileQueued(fileObj);
+               wpFileError(fileObj, swfuploadL10n.zero_byte_file);
+       }
+       else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) {
+               fileQueued(fileObj);
+               wpFileError(fileObj, swfuploadL10n.invalid_filetype);
+       }
+       else {
+               wpQueueError(swfuploadL10n.default_error);
+       }
+}
+
+function fileDialogComplete(num_files_queued) {
+       try {
+               if (num_files_queued > 0) {
+                       this.startUpload();
+               }
+       } catch (ex) {
+               this.debug(ex);
+       }
+}
+
+function switchUploader(s) {
+       var f = document.getElementById(swfu.customSettings.swfupload_element_id), h = document.getElementById(swfu.customSettings.degraded_element_id);
+       if ( s ) {
+               f.style.display = 'block';
+               h.style.display = 'none';
+       } else {
+               f.style.display = 'none';
+               h.style.display = 'block';
+       }
+}
+
+function swfuploadPreLoad() {
+       if ( !uploaderMode ) {
+               switchUploader(1);
+       } else {
+               switchUploader(0);
+       }
+}
+
+function swfuploadLoadFailed() {
+       switchUploader(0);
+       jQuery('.upload-html-bypass').hide();
+}
+
+function uploadError(fileObj, errorCode, message) {
+       
+       switch (errorCode) {
+               case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
+                       wpFileError(fileObj, swfuploadL10n.missing_upload_url);
+                       break;
+               case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
+                       wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded);
+                       break;
+               case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
+                       wpQueueError(swfuploadL10n.http_error);
+                       break;
+               case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
+                       wpQueueError(swfuploadL10n.upload_failed);
+                       break;
+               case SWFUpload.UPLOAD_ERROR.IO_ERROR:
+                       wpQueueError(swfuploadL10n.io_error);
+                       break;
+               case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
+                       wpQueueError(swfuploadL10n.security_error);
+                       break;
+               case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
+               case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
+                       jQuery('#media-item-' + fileObj.id).remove();
+                       break;
+               default:
+                       wpFileError(fileObj, swfuploadL10n.default_error);
+       }
+}
+
+function cancelUpload() {
+       swfu.cancelQueue();
+}
+
+// remember the last used image size, alignment and url
+var storeState;
+(function($){
+
+storeState = function(){
+       var align = getUserSetting('align') || '', imgsize = getUserSetting('imgsize') || '';
+
+       $('tr.align input[type="radio"]').click(function(){
+               setUserSetting('align', $(this).val());
+       }).filter(function(){
+               if ( $(this).val() == align )
+                       return true;
+               return false;
+       }).attr('checked','checked');
+
+       $('tr.image-size input[type="radio"]').click(function(){
+               setUserSetting('imgsize', $(this).val());
+       }).filter(function(){
+               if ( $(this).attr('disabled') || $(this).val() != imgsize )
+                       return false;
+               return true;
+       }).attr('checked','checked');
+
+       $('tr.url button').click(function(){
+               var c = this.className || '';
+               c = c.replace(/.*?(url[^ '"]+).*/, '$1');
+               if (c) setUserSetting('urlbutton', c);
+               $(this).siblings('.urlfield').val( $(this).attr('title') );
+       });
+
+       $('tr.url .urlfield').each(function(){
+               var b = getUserSetting('urlbutton');
+               $(this).val( $(this).siblings('button.'+b).attr('title') );
+       });
+}
+})(jQuery);
index fccaf71cd48b3a1a51ef5dfcc7f8509bfc8a78dc..40439e3cb6a2b00af2ed3c515daff5fbced628dd 100644 (file)
@@ -1,287 +1 @@
-function fileDialogStart() {
-       jQuery("#media-upload-error").empty();
-}
-
-// progress and success handlers for media multi uploads
-function fileQueued(fileObj) {
-       // Get rid of unused form
-       jQuery('.media-blank').remove();
-       // Collapse a single item
-       if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
-               jQuery('.toggle').toggle();
-               jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
-       }
-       // Create a progress bar containing the filename
-       jQuery('#media-items').append('<div id="media-item-' + fileObj.id + '" class="media-item child-of-' + post_id + '"><div class="progress"><div class="bar"></div></div><div class="filename original">' + fileObj.name + '</div></div>');
-       // Display the progress div
-       jQuery('#media-item-' + fileObj.id + ' .progress').show();
-
-       // Disable the submit button
-       jQuery('#insert-gallery').attr('disabled', 'disabled');
-}
-
-function uploadStart(fileObj) { return true; }
-
-function uploadProgress(fileObj, bytesDone, bytesTotal) {
-       // Lengthen the progress bar
-       jQuery('#media-item-' + fileObj.id + ' .bar').width(620*bytesDone/bytesTotal);
-
-       if ( bytesDone == bytesTotal )
-               jQuery('#media-item-' + fileObj.id + ' .bar').html('<strong class="crunching">' + swfuploadL10n.crunching + '</strong>');
-}
-
-function prepareMediaItem(fileObj, serverData) {
-       // Move the progress bar to 100%
-       jQuery('#media-item-' + fileObj.id + ' .bar').remove();
-       jQuery('#media-item-' + fileObj.id + ' .progress').hide();
-
-       var f = ( typeof shortform == 'undefined' ) ? 1 : 2;
-       // Old style: Append the HTML returned by the server -- thumbnail and form inputs
-       if ( isNaN(serverData) || !serverData ) {
-               jQuery('#media-item-' + fileObj.id).append(serverData);
-               prepareMediaItemInit(fileObj);
-       }
-       // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
-       else {
-               jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
-       }
-}
-               
-function prepareMediaItemInit(fileObj) {
-
-       // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
-       jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id);
-
-       // Replace the original filename with the new (unique) one assigned during upload
-       jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
-
-       // Also bind toggle to the links
-       jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){var o=jQuery(this).offset();window.scrollTo(0,o.top-36);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
-
-       // Bind AJAX to the new Delete button
-       jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){
-               // Tell the server to delete it. TODO: handle exceptions
-               jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{
-                       id : this.id.replace(/[^0-9]/g,''),
-                       action : 'delete-post',
-                       _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')}
-                       });
-               return false;
-       });
-
-       // Open this item if it says to start open (e.g. to display an error)
-       jQuery('#media-item-' + fileObj.id + '.startopen')
-               .removeClass('startopen')
-               .slideToggle(500)
-               .parent().eq(0).children('.toggle').toggle();
-}
-
-function itemAjaxError(id, html) {
-       var error = jQuery('#media-item-error' + id);
-
-       error.html('<div class="file-error"><button type="button" id="dismiss-'+id+'" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+html+'</div>');
-       jQuery('#dismiss-'+id).click(function(){jQuery(this).parents('.file-error').slideUp(200, function(){jQuery(this).empty();})});
-}
-
-function deleteSuccess(data, textStatus) {
-       if ( data == '-1' )
-               return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
-       if ( data == '0' )
-               return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
-
-       var item = jQuery('#media-item-' + this.id);
-
-       // Decrement the counters.
-       if ( type = jQuery('#type-of-' + this.id).val() )
-               jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1);
-       if ( item.hasClass('child-of-'+post_id) )
-               jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1);
-
-       if ( jQuery('.type-form #media-items>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
-               jQuery('.toggle').toggle();
-               jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
-       }
-
-       // Vanish it.
-       jQuery('#media-item-' + this.id + ' .filename:empty').remove();
-       jQuery('#media-item-' + this.id + ' .filename').append(' <span class="file-error">'+swfuploadL10n.deleted+'</span>').siblings('a.toggle').remove();
-       jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end()
-                       .animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50})
-                       .animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()})
-                       .animate({backgroundColor:'#fff'}, 400)
-                       .animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();});
-
-       return;
-}
-
-function deleteError(X, textStatus, errorThrown) {
-       // TODO
-}
-
-function updateMediaForm() {
-       storeState();
-       // Just one file, no need for collapsible part
-       if ( jQuery('.type-form #media-items>*').length == 1 ) {
-               jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle();
-               jQuery('.type-form .slidetoggle').siblings().addClass('hidden');
-       }
-
-       // Only show Save buttons when there is at least one file.
-       if ( jQuery('#media-items>*').not('.media-blank').length > 0 )
-               jQuery('.savebutton').show();
-       else
-               jQuery('.savebutton').hide();
-
-       // Only show Gallery button when there are at least two files.
-       if ( jQuery('#media-items>*').length > 1 )
-               jQuery('.insert-gallery').show();
-       else
-               jQuery('.insert-gallery').hide();
-}
-
-function uploadSuccess(fileObj, serverData) {
-       // if async-upload returned an error message, place it in the media item div and return
-       if ( serverData.match('media-upload-error') ) {
-               jQuery('#media-item-' + fileObj.id).html(serverData);
-               return;
-       }
-
-       prepareMediaItem(fileObj, serverData);
-       updateMediaForm();
-
-       // Increment the counter.
-       if ( jQuery('#media-item-' + fileObj.id).hasClass('child-of-' + post_id) )
-               jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
-}
-
-function uploadComplete(fileObj) {
-       // If no more uploads queued, enable the submit button
-       if ( swfu.getStats().files_queued == 0 )
-               jQuery('#insert-gallery').attr('disabled', '');
-}
-
-
-// wp-specific error handlers
-
-// generic message
-function wpQueueError(message) {
-       jQuery('#media-upload-error').show().text(message);
-}
-
-// file-specific message
-function wpFileError(fileObj, message) {
-       jQuery('#media-item-' + fileObj.id + ' .filename').after('<div class="file-error"><button type="button" id="dismiss-' + fileObj.id + '" class="button dismiss">'+swfuploadL10n.dismiss+'</button>'+message+'</div>').siblings('.toggle').remove();
-       jQuery('#dismiss-' + fileObj.id).click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
-}
-
-function fileQueueError(fileObj, error_code, message)  {
-       // Handle this error separately because we don't want to create a FileProgress element for it.
-       if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) {
-               wpQueueError(swfuploadL10n.queue_limit_exceeded);
-       }
-       else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) {
-               fileQueued(fileObj);
-               wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit);
-       }
-       else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) {
-               fileQueued(fileObj);
-               wpFileError(fileObj, swfuploadL10n.zero_byte_file);
-       }
-       else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) {
-               fileQueued(fileObj);
-               wpFileError(fileObj, swfuploadL10n.invalid_filetype);
-       }
-       else {
-               wpQueueError(swfuploadL10n.default_error);
-       }
-}
-
-function fileDialogComplete(num_files_queued) {
-       try {
-               if (num_files_queued > 0) {
-                       this.startUpload();
-               }
-       } catch (ex) {
-               this.debug(ex);
-       }
-}
-
-function swfuploadPreLoad() {
-       var swfupload_element = jQuery('#'+swfu.customSettings.swfupload_element_id).get(0);
-       jQuery('#' + swfu.customSettings.degraded_element_id).hide();
-       // Doing this directly because jQuery().show() seems to have timing problems
-       if ( swfupload_element && ! swfupload_element.style.display )
-                       swfupload_element.style.display = 'block';
-}
-
-function swfuploadLoadFailed() {
-       jQuery('#' + swfu.customSettings.swfupload_element_id).hide();
-       jQuery('#' + swfu.customSettings.degraded_element_id).show();
-}
-
-function uploadError(fileObj, error_code, message) {
-       // first the file specific error
-       if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) {
-               wpFileError(fileObj, swfuploadL10n.missing_upload_url);
-       }
-       else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED ) {
-               wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded);
-       }
-       else {
-               wpFileError(fileObj, swfuploadL10n.default_error);
-       }
-
-       // now the general upload status
-       if ( error_code == SWFUpload.UPLOAD_ERROR.HTTP_ERROR ) {
-               wpQueueError(swfuploadL10n.http_error);
-       }
-       else if ( error_code == SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED ) {
-               wpQueueError(swfuploadL10n.upload_failed);
-       }
-       else if ( error_code == SWFUpload.UPLOAD_ERROR.IO_ERROR ) {
-               wpQueueError(swfuploadL10n.io_error);
-       }
-       else if ( error_code == SWFUpload.UPLOAD_ERROR.SECURITY_ERROR ) {
-               wpQueueError(swfuploadL10n.security_error);
-       }
-       else if ( error_code == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED ) {
-               wpQueueError(swfuploadL10n.security_error);
-       }
-}
-
-// remember the last used image size, alignment and url
-var storeState;
-(function($){
-
-storeState = function(){
-       var align = getUserSetting('align') || '', imgsize = getUserSetting('imgsize') || '';
-
-       $('tr.align input[type="radio"]').click(function(){
-               setUserSetting('align', $(this).val());
-       }).filter(function(){
-               if ( $(this).val() == align )
-                       return true;
-               return false;
-       }).attr('checked','checked');
-
-       $('tr.image-size input[type="radio"]').click(function(){
-               setUserSetting('imgsize', $(this).val());
-       }).filter(function(){
-               if ( $(this).attr('disabled') || $(this).val() != imgsize )
-                       return false;
-               return true;
-       }).attr('checked','checked');
-
-       $('tr.url button').click(function(){
-               var c = this.className || '';
-               c = c.replace(/.*?(url[^ '"]+).*/, '$1');
-               if (c) setUserSetting('urlbutton', c);
-               $(this).siblings('.urlfield').val( $(this).attr('title') );
-       });
-
-       $('tr.url .urlfield').each(function(){
-               var b = getUserSetting('urlbutton');
-               $(this).val( $(this).siblings('button.'+b).attr('title') );
-       });
-}
-})(jQuery);
+function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".describe-toggle-on").show();jQuery(".describe-toggle-off").hide();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> '+a.name+"</div></div>");jQuery("#media-item-"+a.id+" .progress").show();jQuery("#insert-gallery").attr("disabled","disabled");jQuery("#cancel-upload").attr("disabled","")}function uploadStart(a){return true}function uploadProgress(d,b,c){var a=jQuery("#media-items").width()-2;jQuery("#media-item-"+d.id+" .bar").width(a*b/c);jQuery("#media-item-"+d.id+" .percent").html(Math.ceil(b/c*100)+"%");if(b==c){jQuery("#media-item-"+d.id+" .bar").html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(b,a){jQuery("#media-item-"+b.id+" .bar").remove();jQuery("#media-item-"+b.id+" .progress").hide();var c=(typeof shortform=="undefined")?1:2;if(isNaN(a)||!a){jQuery("#media-item-"+b.id).append(a);prepareMediaItemInit(b)}else{jQuery("#media-item-"+b.id).load("async-upload.php",{attachment_id:a,fetch:c},function(){prepareMediaItemInit(b);updateMediaForm()})}}function prepareMediaItemInit(a){jQuery("#media-item-"+a.id+" .thumbnail").clone().attr("className","pinkynail toggle").prependTo("#media-item-"+a.id);jQuery("#media-item-"+a.id+" .filename.original").replaceWith(jQuery("#media-item-"+a.id+" .filename.new"));jQuery("#media-item-"+a.id+" a.toggle").click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(150,function(){var b=jQuery(this).offset();window.scrollTo(0,b.top-36)});jQuery(this).parent().children(".toggle").toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("#media-item-"+a.id+" a.delete").click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:a.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"delete-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("#media-item-"+a.id+".startopen").removeClass("startopen").slideToggle(500).parent().children(".toggle").toggle()}function itemAjaxError(c,b){var a=jQuery("#media-item-error"+c);a.html('<div class="file-error"><button type="button" id="dismiss-'+c+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+b+"</div>");jQuery("#dismiss-"+c).click(function(){jQuery(this).parents(".file-error").slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,c){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var a=jQuery("#media-item-"+this.id);if(type=jQuery("#type-of-"+this.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-item-"+this.id+" .filename:empty").remove();jQuery("#media-item-"+this.id+" .filename").append(' <span class="file-error">'+swfuploadL10n.deleted+"</span>").siblings("a.toggle").remove();jQuery("#media-item-"+this.id).children(".describe").css({backgroundColor:"#fff"}).end().animate({backgroundColor:"#ffc0c0"},{queue:false,duration:50}).animate({minHeight:0,height:36},400,null,function(){jQuery(this).children(".describe").remove()}).animate({backgroundColor:"#fff"},400).animate({height:0},800,null,function(){jQuery(this).remove();updateMediaForm()});return}function deleteError(c,b,a){}function updateMediaForm(){storeState();if(jQuery(".type-form #media-items>*").length==1){jQuery("#media-items .slidetoggle").slideDown(500).parent().eq(0).children(".toggle").toggle();jQuery(".type-form .slidetoggle").siblings().addClass("hidden")}if(jQuery("#media-items>*").not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(jQuery("#media-items>*").length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#cancel-upload").attr("disabled","disabled");jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(b,a){jQuery("#media-item-"+b.id+" .filename").after('<div class="file-error"><button type="button" id="dismiss-'+b.id+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+a+"</div>").siblings(".toggle").remove();jQuery("#dismiss-"+b.id).click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b>0){this.startUpload()}}catch(a){this.debug(a)}}function switchUploader(b){var c=document.getElementById(swfu.customSettings.swfupload_element_id),a=document.getElementById(swfu.customSettings.degraded_element_id);if(b){c.style.display="block";a.style.display="none"}else{c.style.display="none";a.style.display="block"}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").hide()}function uploadError(b,c,a){switch(c){case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:wpFileError(b,swfuploadL10n.missing_upload_url);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:wpFileError(b,swfuploadL10n.upload_limit_exceeded);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:wpQueueError(swfuploadL10n.http_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:wpQueueError(swfuploadL10n.upload_failed);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:wpQueueError(swfuploadL10n.io_error);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:wpQueueError(swfuploadL10n.security_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:jQuery("#media-item-"+b.id).remove();break;default:wpFileError(b,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}var storeState;(function(a){storeState=function(){var c=getUserSetting("align")||"",b=getUserSetting("imgsize")||"";a('tr.align input[type="radio"]').click(function(){setUserSetting("align",a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr("checked","checked");a('tr.image-size input[type="radio"]').click(function(){setUserSetting("imgsize",a(this).val())}).filter(function(){if(a(this).attr("disabled")||a(this).val()!=b){return false}return true}).attr("checked","checked");a("tr.url button").click(function(){var d=this.className||"";d=d.replace(/.*?(url[^ '"]+).*/,"$1");if(d){setUserSetting("urlbutton",d)}a(this).siblings(".urlfield").val(a(this).attr("title"))});a("tr.url .urlfield").each(function(){var d=getUserSetting("urlbutton");a(this).val(a(this).siblings("button."+d).attr("title"))})}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/swfupload/plugins/swfupload.documentready.js b/wp-includes/js/swfupload/plugins/swfupload.documentready.js
deleted file mode 100644 (file)
index a95bac5..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-       DocumentReady Plug-in
-       
-       This plugin loads SWFUpload as soon as the document is ready.  You should not load SWFUpload inside window.onload using this plugin.
-       You can also chain other functions by calling SWFUpload.DocumentReady(your function).
-       
-       Warning: Embedded Ads or other scripts that overwrite window.onload or use their own document ready functions may interfer with this plugin.  You
-               should not set window.onload when using this plugin.
-       
-       Usage Example:
-       
-       var swfu = new SWFUpload(your settings object);
-       SWFUpload.DocumentReady(function () { alert('Document Ready!'; });
-       
-*/
-
-var SWFUpload;
-if (typeof(SWFUpload) === "function") {
-       // Override iniSWFUpload so SWFUpload gets inited when the document is ready rather than immediately
-       SWFUpload.prototype.initSWFUpload = function (old_initSWFUpload) {
-               return function (init_settings) {
-                       var self = this;
-                       if  (typeof(old_initSWFUpload) === "function") {
-                               SWFUpload.DocumentReady(function () {
-                                       old_initSWFUpload.call(self, init_settings);
-                               });
-                       }
-               }
-               
-       }(SWFUpload.prototype.initSWFUpload);
-
-       
-       // The DocumentReady function adds the passed in function to
-       // the functions that will be executed when the document is ready/loaded
-       SWFUpload.DocumentReady = function (fn) {
-               // Add the function to the chain
-               SWFUpload.DocumentReady.InternalOnloadChain = function (previous_link_fn) {
-                       return function () {
-                               if (typeof(previous_link_fn) === "function") {
-                                       previous_link_fn();
-                               }
-                               fn();
-                       };
-               }(SWFUpload.DocumentReady.InternalOnloadChain);
-       };
-       SWFUpload.DocumentReady.InternalOnloadChain = null;
-       SWFUpload.DocumentReady.Onload = function () {
-               // Execute the onload function chain
-               if (typeof(SWFUpload.DocumentReady.InternalOnloadChain) === "function") {
-                       SWFUpload.DocumentReady.InternalOnloadChain();
-               }
-       };
-       SWFUpload.DocumentReady.SetupComplete = false;
-
-
-       /* ********************************************
-               This portion of the code gets executed as soon it is loaded.
-               It binds the proper event for executing JavaScript is
-               early as possible.  This is a per browser function and so
-               some browser sniffing is used.
-               
-               This solution still has the "exposed" issue (See the Global Delegation section at http://peter.michaux.ca/article/553 )
-               
-               Base solution from http://dean.edwards.name/weblog/2006/06/again/ and http://dean.edwards.name/weblog/2005/09/busted/
-       ******************************************** */
-       if (!SWFUpload.DocumentReady.SetupComplete) {
-               // for Internet Explorer (using conditional comments)
-               /*@cc_on @*/
-               /*@if (@_win32)
-               document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
-               var script = document.getElementById("__ie_onload");
-               script.onreadystatechange = function() {
-                       if (this.readyState == "complete") {
-                               SWFUpload.DocumentReady.Onload(); // call the onload handler
-                       }
-               };
-               SWFUpload.DocumentReady.SetupComplete = true;
-               /*@end @*/
-       }
-
-       if (!SWFUpload.DocumentReady.SetupComplete && /WebKit/i.test(navigator.userAgent)) { // sniff
-               var _timer = setInterval(function() {
-                       if (/loaded|complete/.test(document.readyState)) {
-                               clearInterval(_timer);
-                               SWFUpload.DocumentReady.Onload(); // call the onload handler
-                       }
-               }, 10);
-               SWFUpload.DocumentReady.SetupComplete = true;
-       }
-
-       /* for Mozilla */
-       if (!SWFUpload.DocumentReady.SetupComplete && document.addEventListener) {
-               document.addEventListener("DOMContentLoaded", SWFUpload.DocumentReady.Onload, false);
-               SWFUpload.DocumentReady.SetupComplete = true;
-       }
-
-       /* for other browsers */
-       if (!SWFUpload.DocumentReady.SetupComplete) {
-               window.onload = SWFUpload.DocumentReady.Onload;
-               SWFUpload.DocumentReady.SetupComplete = true;
-       }
-}
diff --git a/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js b/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js
deleted file mode 100644 (file)
index c26b404..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 
-       SWFUpload Graceful Degradation Plug-in
-
-       This plugin allows SWFUpload to display only if it is loaded successfully.  Otherwise a default form is left displayed.
-       
-       Usage:
-       
-       To use this plugin create two HTML containers. Each should have an ID defined.  One container should hold the SWFUpload UI.  The other should hold the degraded UI.
-       
-       The SWFUpload container should have its CSS "display" property set to "none".
-       
-       If SWFUpload loads successfully the SWFUpload container will be displayed ("display" set to "block") and the
-       degraded container will be hidden ("display" set to "none").
-       
-       Use the settings "swfupload_element_id" and "degraded_element_id" to indicate your container IDs.  The default values are "swfupload_container" and "degraded_container".
-       
-*/
-
-var SWFUpload;
-if (typeof(SWFUpload) === "function") {
-       SWFUpload.gracefulDegradation = {};
-       SWFUpload.prototype.initSettings = function (old_initSettings) {
-               return function (init_settings) {
-                       if (typeof(old_initSettings) === "function") {
-                               old_initSettings.call(this, init_settings);
-                       }
-                       
-                       this.addSetting("swfupload_element_id",                         init_settings.swfupload_element_id,                             "swfupload_container");
-                       this.addSetting("degraded_element_id",                          init_settings.degraded_element_id,                              "degraded_container");
-                       this.addSetting("user_swfUploadLoaded_handler",         init_settings.swfupload_loaded_handler,                 SWFUpload.swfUploadLoaded);
-
-                       this.swfUploadLoaded_handler = SWFUpload.gracefulDegradation.swfUploadLoaded;
-               };
-       }(SWFUpload.prototype.initSettings);
-
-       SWFUpload.gracefulDegradation.swfUploadLoaded = function () {
-               var swfupload_container_id, swfupload_container, degraded_container_id, degraded_container, user_swfUploadLoaded_handler;
-               try {
-                       if (uploadDegradeOptions.is_lighttpd_before_150) throw "Lighttpd versions earlier than 1.5.0 aren't supported!";
-                       swfupload_element_id = this.getSetting("swfupload_element_id");
-                       degraded_element_id = this.getSetting("degraded_element_id");
-                       
-                       // Show the UI container
-                       swfupload_container = document.getElementById(swfupload_element_id);
-                       if (swfupload_container !== null) {
-                               swfupload_container.style.display = "block";
-
-                               // Now take care of hiding the degraded UI
-                               degraded_container = document.getElementById(degraded_element_id);
-                               if (degraded_container !== null) {
-                                       degraded_container.style.display = "none";
-                               }
-                       }
-               } catch (ex) {
-                       this.debug(ex);
-               }
-               
-               user_swfUploadLoaded_handler = this.getSetting("user_swfUploadLoaded_handler");
-               if (typeof(user_swfUploadLoaded_handler) === "function") {
-                       user_swfUploadLoaded_handler.apply(this);
-               }
-       };
-
-}
index b04d87acf4ad70554db770b32405256794dbe9f3..f09933e387e5561ddf4b538342c7bec303056e42 100644 (file)
@@ -21,23 +21,27 @@ if (typeof(SWFUpload) === "function") {
                                oldInitSettings.call(this);
                        }
                        
                                oldInitSettings.call(this);
                        }
                        
-                       this.customSettings.queue_cancelled_flag = false;
-                       this.customSettings.queue_upload_count = 0;
+                       this.queueSettings = {};
                        
                        
-                       this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
+                       this.queueSettings.queue_cancelled_flag = false;
+                       this.queueSettings.queue_upload_count = 0;
+                       
+                       this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
+                       this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
                        this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
                        this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
+                       this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
                        
                        this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
                };
        })(SWFUpload.prototype.initSettings);
 
        SWFUpload.prototype.startUpload = function (fileID) {
                        
                        this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
                };
        })(SWFUpload.prototype.initSettings);
 
        SWFUpload.prototype.startUpload = function (fileID) {
-               this.customSettings.queue_cancelled_flag = false;
-               this.callFlash("StartUpload", false, [fileID]);
+               this.queueSettings.queue_cancelled_flag = false;
+               this.callFlash("StartUpload", [fileID]);
        };
 
        SWFUpload.prototype.cancelQueue = function () {
        };
 
        SWFUpload.prototype.cancelQueue = function () {
-               this.customSettings.queue_cancelled_flag = true;
+               this.queueSettings.queue_cancelled_flag = true;
                this.stopUpload();
                
                var stats = this.getStats();
                this.stopUpload();
                
                var stats = this.getStats();
@@ -47,31 +51,48 @@ if (typeof(SWFUpload) === "function") {
                }
        };
        
                }
        };
        
+       SWFUpload.queue.uploadStartHandler = function (file) {
+               var returnValue;
+               if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
+                       returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
+               }
+               
+               // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
+               returnValue = (returnValue === false) ? false : true;
+               
+               this.queueSettings.queue_cancelled_flag = !returnValue;
+
+               return returnValue;
+       };
+       
        SWFUpload.queue.uploadCompleteHandler = function (file) {
        SWFUpload.queue.uploadCompleteHandler = function (file) {
-               var user_upload_complete_handler = this.settings.user_upload_complete_handler;
+               var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
                var continueUpload;
                
                if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
                var continueUpload;
                
                if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
-                       this.customSettings.queue_upload_count++;
+                       this.queueSettings.queue_upload_count++;
                }
 
                if (typeof(user_upload_complete_handler) === "function") {
                        continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
                }
 
                if (typeof(user_upload_complete_handler) === "function") {
                        continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+               } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
+                       // If the file was stopped and re-queued don't restart the upload
+                       continueUpload = false;
                } else {
                        continueUpload = true;
                }
                
                if (continueUpload) {
                        var stats = this.getStats();
                } else {
                        continueUpload = true;
                }
                
                if (continueUpload) {
                        var stats = this.getStats();
-                       if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
+                       if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
                                this.startUpload();
                                this.startUpload();
-                       } else if (this.customSettings.queue_cancelled_flag === false) {
-                               this.queueEvent("queue_complete_handler", [this.customSettings.queue_upload_count]);
-                               this.customSettings.queue_upload_count = 0;
+                       } else if (this.queueSettings.queue_cancelled_flag === false) {
+                               this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
+                               this.queueSettings.queue_upload_count = 0;
                        } else {
                        } else {
-                               this.customSettings.queue_cancelled_flag = false;
-                               this.customSettings.queue_upload_count = 0;
+                               this.queueSettings.queue_cancelled_flag = false;
+                               this.queueSettings.queue_upload_count = 0;
                        }
                }
        };
                        }
                }
        };
-}
\ No newline at end of file
+}
diff --git a/wp-includes/js/swfupload/plugins/swfupload.speed.js b/wp-includes/js/swfupload/plugins/swfupload.speed.js
new file mode 100644 (file)
index 0000000..6b7bf94
--- /dev/null
@@ -0,0 +1,342 @@
+/*\r
+       Speed Plug-in\r
+       \r
+       Features:\r
+               *Adds several properties to the 'file' object indicated upload speed, time left, upload time, etc.\r
+                       - currentSpeed -- String indicating the upload speed, bytes per second\r
+                       - averageSpeed -- Overall average upload speed, bytes per second\r
+                       - movingAverageSpeed -- Speed over averaged over the last several measurements, bytes per second\r
+                       - timeRemaining -- Estimated remaining upload time in seconds\r
+                       - timeElapsed -- Number of seconds passed for this upload\r
+                       - percentUploaded -- Percentage of the file uploaded (0 to 100)\r
+                       - sizeUploaded -- Formatted size uploaded so far, bytes\r
+               \r
+               *Adds setting 'moving_average_history_size' for defining the window size used to calculate the moving average speed.\r
+               \r
+               *Adds several Formatting functions for formatting that values provided on the file object.\r
+                       - SWFUpload.speed.formatBPS(bps) -- outputs string formatted in the best units (Gbps, Mbps, Kbps, bps)\r
+                       - SWFUpload.speed.formatTime(seconds) -- outputs string formatted in the best units (x Hr y M z S)\r
+                       - SWFUpload.speed.formatSize(bytes) -- outputs string formatted in the best units (w GB x MB y KB z B )\r
+                       - SWFUpload.speed.formatPercent(percent) -- outputs string formatted with a percent sign (x.xx %)\r
+                       - SWFUpload.speed.formatUnits(baseNumber, divisionArray, unitLabelArray, fractionalBoolean)\r
+                               - Formats a number using the division array to determine how to apply the labels in the Label Array\r
+                               - factionalBoolean indicates whether the number should be returned as a single fractional number with a unit (speed)\r
+                                   or as several numbers labeled with units (time)\r
+       */\r
+\r
+var SWFUpload;\r
+if (typeof(SWFUpload) === "function") {\r
+       SWFUpload.speed = {};\r
+       \r
+       SWFUpload.prototype.initSettings = (function (oldInitSettings) {\r
+               return function () {\r
+                       if (typeof(oldInitSettings) === "function") {\r
+                               oldInitSettings.call(this);\r
+                       }\r
+                       \r
+                       this.ensureDefault = function (settingName, defaultValue) {\r
+                               this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];\r
+                       };\r
+\r
+                       // List used to keep the speed stats for the files we are tracking\r
+                       this.fileSpeedStats = {};\r
+                       this.speedSettings = {};\r
+\r
+                       this.ensureDefault("moving_average_history_size", "10");\r
+                       \r
+                       this.speedSettings.user_file_queued_handler = this.settings.file_queued_handler;\r
+                       this.speedSettings.user_file_queue_error_handler = this.settings.file_queue_error_handler;\r
+                       this.speedSettings.user_upload_start_handler = this.settings.upload_start_handler;\r
+                       this.speedSettings.user_upload_error_handler = this.settings.upload_error_handler;\r
+                       this.speedSettings.user_upload_progress_handler = this.settings.upload_progress_handler;\r
+                       this.speedSettings.user_upload_success_handler = this.settings.upload_success_handler;\r
+                       this.speedSettings.user_upload_complete_handler = this.settings.upload_complete_handler;\r
+                       \r
+                       this.settings.file_queued_handler = SWFUpload.speed.fileQueuedHandler;\r
+                       this.settings.file_queue_error_handler = SWFUpload.speed.fileQueueErrorHandler;\r
+                       this.settings.upload_start_handler = SWFUpload.speed.uploadStartHandler;\r
+                       this.settings.upload_error_handler = SWFUpload.speed.uploadErrorHandler;\r
+                       this.settings.upload_progress_handler = SWFUpload.speed.uploadProgressHandler;\r
+                       this.settings.upload_success_handler = SWFUpload.speed.uploadSuccessHandler;\r
+                       this.settings.upload_complete_handler = SWFUpload.speed.uploadCompleteHandler;\r
+                       \r
+                       delete this.ensureDefault;\r
+               };\r
+       })(SWFUpload.prototype.initSettings);\r
+\r
+       \r
+       SWFUpload.speed.fileQueuedHandler = function (file) {\r
+               if (typeof this.speedSettings.user_file_queued_handler === "function") {\r
+                       file = SWFUpload.speed.extendFile(file);\r
+                       \r
+                       return this.speedSettings.user_file_queued_handler.call(this, file);\r
+               }\r
+       };\r
+       \r
+       SWFUpload.speed.fileQueueErrorHandler = function (file, errorCode, message) {\r
+               if (typeof this.speedSettings.user_file_queue_error_handler === "function") {\r
+                       file = SWFUpload.speed.extendFile(file);\r
+                       \r
+                       return this.speedSettings.user_file_queue_error_handler.call(this, file, errorCode, message);\r
+               }\r
+       };\r
+\r
+       SWFUpload.speed.uploadStartHandler = function (file) {\r
+               if (typeof this.speedSettings.user_upload_start_handler === "function") {\r
+                       file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);\r
+                       return this.speedSettings.user_upload_start_handler.call(this, file);\r
+               }\r
+       };\r
+       \r
+       SWFUpload.speed.uploadErrorHandler = function (file, errorCode, message) {\r
+               file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);\r
+               SWFUpload.speed.removeTracking(file, this.fileSpeedStats);\r
+\r
+               if (typeof this.speedSettings.user_upload_error_handler === "function") {\r
+                       return this.speedSettings.user_upload_error_handler.call(this, file, errorCode, message);\r
+               }\r
+       };\r
+       SWFUpload.speed.uploadProgressHandler = function (file, bytesComplete, bytesTotal) {\r
+               this.updateTracking(file, bytesComplete);\r
+               file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);\r
+\r
+               if (typeof this.speedSettings.user_upload_progress_handler === "function") {\r
+                       return this.speedSettings.user_upload_progress_handler.call(this, file, bytesComplete, bytesTotal);\r
+               }\r
+       };\r
+       \r
+       SWFUpload.speed.uploadSuccessHandler = function (file, serverData) {\r
+               if (typeof this.speedSettings.user_upload_success_handler === "function") {\r
+                       file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);\r
+                       return this.speedSettings.user_upload_success_handler.call(this, file, serverData);\r
+               }\r
+       };\r
+       SWFUpload.speed.uploadCompleteHandler = function (file) {\r
+               file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);\r
+               SWFUpload.speed.removeTracking(file, this.fileSpeedStats);\r
+\r
+               if (typeof this.speedSettings.user_upload_complete_handler === "function") {\r
+                       return this.speedSettings.user_upload_complete_handler.call(this, file);\r
+               }\r
+       };\r
+       \r
+       // Private: extends the file object with the speed plugin values\r
+       SWFUpload.speed.extendFile = function (file, trackingList) {\r
+               var tracking;\r
+               \r
+               if (trackingList) {\r
+                       tracking = trackingList[file.id];\r
+               }\r
+               \r
+               if (tracking) {\r
+                       file.currentSpeed = tracking.currentSpeed;\r
+                       file.averageSpeed = tracking.averageSpeed;\r
+                       file.movingAverageSpeed = tracking.movingAverageSpeed;\r
+                       file.timeRemaining = tracking.timeRemaining;\r
+                       file.timeElapsed = tracking.timeElapsed;\r
+                       file.percentUploaded = tracking.percentUploaded;\r
+                       file.sizeUploaded = tracking.bytesUploaded;\r
+\r
+               } else {\r
+                       file.currentSpeed = 0;\r
+                       file.averageSpeed = 0;\r
+                       file.movingAverageSpeed = 0;\r
+                       file.timeRemaining = 0;\r
+                       file.timeElapsed = 0;\r
+                       file.percentUploaded = 0;\r
+                       file.sizeUploaded = 0;\r
+               }\r
+               \r
+               return file;\r
+       };\r
+       \r
+       // Private: Updates the speed tracking object, or creates it if necessary\r
+       SWFUpload.prototype.updateTracking = function (file, bytesUploaded) {\r
+               var tracking = this.fileSpeedStats[file.id];\r
+               if (!tracking) {\r
+                       this.fileSpeedStats[file.id] = tracking = {};\r
+               }\r
+               \r
+               // Sanity check inputs\r
+               bytesUploaded = bytesUploaded || tracking.bytesUploaded || 0;\r
+               if (bytesUploaded < 0) {\r
+                       bytesUploaded = 0;\r
+               }\r
+               if (bytesUploaded > file.size) {\r
+                       bytesUploaded = file.size;\r
+               }\r
+               \r
+               var tickTime = (new Date()).getTime();\r
+               if (!tracking.startTime) {\r
+                       tracking.startTime = (new Date()).getTime();\r
+                       tracking.lastTime = tracking.startTime;\r
+                       tracking.currentSpeed = 0;\r
+                       tracking.averageSpeed = 0;\r
+                       tracking.movingAverageSpeed = 0;\r
+                       tracking.movingAverageHistory = [];\r
+                       tracking.timeRemaining = 0;\r
+                       tracking.timeElapsed = 0;\r
+                       tracking.percentUploaded = bytesUploaded / file.size;\r
+                       tracking.bytesUploaded = bytesUploaded;\r
+               } else if (tracking.startTime > tickTime) {\r
+                       this.debug("When backwards in time");\r
+               } else {\r
+                       // Get time and deltas\r
+                       var now = (new Date()).getTime();\r
+                       var lastTime = tracking.lastTime;\r
+                       var deltaTime = now - lastTime;\r
+                       var deltaBytes = bytesUploaded - tracking.bytesUploaded;\r
+                       \r
+                       if (deltaBytes === 0 || deltaTime === 0) {\r
+                               return tracking;\r
+                       }\r
+                       \r
+                       // Update tracking object\r
+                       tracking.lastTime = now;\r
+                       tracking.bytesUploaded = bytesUploaded;\r
+                       \r
+                       // Calculate speeds\r
+                       tracking.currentSpeed = (deltaBytes * 8 ) / (deltaTime / 1000);\r
+                       tracking.averageSpeed = (tracking.bytesUploaded * 8) / ((now - tracking.startTime) / 1000);\r
+\r
+                       // Calculate moving average\r
+                       tracking.movingAverageHistory.push(tracking.currentSpeed);\r
+                       if (tracking.movingAverageHistory.length > this.settings.moving_average_history_size) {\r
+                               tracking.movingAverageHistory.shift();\r
+                       }\r
+                       \r
+                       tracking.movingAverageSpeed = SWFUpload.speed.calculateMovingAverage(tracking.movingAverageHistory);\r
+                       \r
+                       // Update times\r
+                       tracking.timeRemaining = (file.size - tracking.bytesUploaded) * 8 / tracking.movingAverageSpeed;\r
+                       tracking.timeElapsed = (now - tracking.startTime) / 1000;\r
+                       \r
+                       // Update percent\r
+                       tracking.percentUploaded = (tracking.bytesUploaded / file.size * 100);\r
+               }\r
+               \r
+               return tracking;\r
+       };\r
+       SWFUpload.speed.removeTracking = function (file, trackingList) {\r
+               try {\r
+                       trackingList[file.id] = null;\r
+                       delete trackingList[file.id];\r
+               } catch (ex) {\r
+               }\r
+       };\r
+       \r
+       SWFUpload.speed.formatUnits = function (baseNumber, unitDivisors, unitLabels, singleFractional) {\r
+               var i, unit, unitDivisor, unitLabel;\r
+\r
+               if (baseNumber === 0) {\r
+                       return "0 " + unitLabels[unitLabels.length - 1];\r
+               }\r
+               \r
+               if (singleFractional) {\r
+                       unit = baseNumber;\r
+                       unitLabel = unitLabels.length >= unitDivisors.length ? unitLabels[unitDivisors.length - 1] : "";\r
+                       for (i = 0; i < unitDivisors.length; i++) {\r
+                               if (baseNumber >= unitDivisors[i]) {\r
+                                       unit = (baseNumber / unitDivisors[i]).toFixed(2);\r
+                                       unitLabel = unitLabels.length >= i ? " " + unitLabels[i] : "";\r
+                                       break;\r
+                               }\r
+                       }\r
+                       \r
+                       return unit + unitLabel;\r
+               } else {\r
+                       var formattedStrings = [];\r
+                       var remainder = baseNumber;\r
+                       \r
+                       for (i = 0; i < unitDivisors.length; i++) {\r
+                               unitDivisor = unitDivisors[i];\r
+                               unitLabel = unitLabels.length > i ? " " + unitLabels[i] : "";\r
+                               \r
+                               unit = remainder / unitDivisor;\r
+                               if (i < unitDivisors.length -1) {\r
+                                       unit = Math.floor(unit);\r
+                               } else {\r
+                                       unit = unit.toFixed(2);\r
+                               }\r
+                               if (unit > 0) {\r
+                                       remainder = remainder % unitDivisor;\r
+                                       \r
+                                       formattedStrings.push(unit + unitLabel);\r
+                               }\r
+                       }\r
+                       \r
+                       return formattedStrings.join(" ");\r
+               }\r
+       };\r
+       \r
+       SWFUpload.speed.formatBPS = function (baseNumber) {\r
+               var bpsUnits = [1073741824, 1048576, 1024, 1], bpsUnitLabels = ["Gbps", "Mbps", "Kbps", "bps"];\r
+               return SWFUpload.speed.formatUnits(baseNumber, bpsUnits, bpsUnitLabels, true);\r
+       \r
+       };\r
+       SWFUpload.speed.formatTime = function (baseNumber) {\r
+               var timeUnits = [86400, 3600, 60, 1], timeUnitLabels = ["d", "h", "m", "s"];\r
+               return SWFUpload.speed.formatUnits(baseNumber, timeUnits, timeUnitLabels, false);\r
+       \r
+       };\r
+       SWFUpload.speed.formatBytes = function (baseNumber) {\r
+               var sizeUnits = [1073741824, 1048576, 1024, 1], sizeUnitLabels = ["GB", "MB", "KB", "bytes"];\r
+               return SWFUpload.speed.formatUnits(baseNumber, sizeUnits, sizeUnitLabels, true);\r
+       \r
+       };\r
+       SWFUpload.speed.formatPercent = function (baseNumber) {\r
+               return baseNumber.toFixed(2) + " %";\r
+       };\r
+       \r
+       SWFUpload.speed.calculateMovingAverage = function (history) {\r
+               var vals = [], size, sum = 0.0, mean = 0.0, varianceTemp = 0.0, variance = 0.0, standardDev = 0.0;\r
+               var i;\r
+               var mSum = 0, mCount = 0;\r
+               \r
+               size = history.length;\r
+               \r
+               // Check for sufficient data\r
+               if (size >= 8) {\r
+                       // Clone the array and Calculate sum of the values \r
+                       for (i = 0; i < size; i++) {\r
+                               vals[i] = history[i];\r
+                               sum += vals[i];\r
+                       }\r
+\r
+                       mean = sum / size;\r
+\r
+                       // Calculate variance for the set\r
+                       for (i = 0; i < size; i++) {\r
+                               varianceTemp += Math.pow((vals[i] - mean), 2);\r
+                       }\r
+\r
+                       variance = varianceTemp / size;\r
+                       standardDev = Math.sqrt(variance);\r
+                       \r
+                       //Standardize the Data\r
+                       for (i = 0; i < size; i++) {\r
+                               vals[i] = (vals[i] - mean) / standardDev;\r
+                       }\r
+\r
+                       // Calculate the average excluding outliers\r
+                       var deviationRange = 2.0;\r
+                       for (i = 0; i < size; i++) {\r
+                               \r
+                               if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {\r
+                                       mCount++;\r
+                                       mSum += history[i];\r
+                               }\r
+                       }\r
+                       \r
+               } else {\r
+                       // Calculate the average (not enough data points to remove outliers)\r
+                       mCount = size;\r
+                       for (i = 0; i < size; i++) {\r
+                               mSum += history[i];\r
+                       }\r
+               }\r
+\r
+               return mSum / mCount;\r
+       };\r
+       \r
+}
\ No newline at end of file
index 9d6c3d87df46908594ca265b0f7da8935facfd80..22cb17889db8812a4db670e3bae8dff0bf5cec8b 100644 (file)
 */
 
 
 */
 
 
-/*     SWFObject v2.0 rc4 <http://code.google.com/p/swfobject/>
-       Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
-       This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
-*/
-var swfobject=function(){var X="undefined",P="object",a="visibility:visible",e="visibility:hidden",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",V="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,S=false,C=false;var Y=function(){var l=typeof g.getElementById!=X&&typeof g.getElementsByTagName!=X&&typeof g.createElement!=X&&typeof g.appendChild!=X&&typeof g.replaceChild!=X&&typeof g.removeChild!=X&&typeof g.cloneNode!=X,t=[0,0,0],n=null;if(typeof N.plugins!=X&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=X){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var d=function(){if(!Y.w3cdom){return }J(I);if(Y.ie&&Y.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=b("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);U()}}}}catch(j){}}if(Y.webkit&&typeof g.readyState!=X){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){U()}},10)}if(typeof g.addEventListener!=X){g.addEventListener("DOMContentLoaded",U,null)}M(U)}();function U(){if(S){return }if(Y.ie&&Y.win){var m=W("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=X){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=X){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=X){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(Y.pv[0]>0){var k=b(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(Y.webkit&&Y.webkit<312){T(k)}}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(Y.win||Y.mac)){D(H[j])}else{c(k)}}}}A("#"+m,a)}}function T(m){var k=m.getElementsByTagName(P)[0];if(k){var p=W("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(Y.ie&&Y.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=b(i);for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)})}}function D(j){C=true;var o=b(j.id);if(o){if(j.altContentId){var l=b(j.altContentId);if(l){L=l}}else{L=Z(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=Y.ie&&Y.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(Y.ie&&Y.win&&o.readyState!=4){var i=W("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function c(j){if(Y.ie&&Y.win&&j.readyState!=4){var i=W("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(Z(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(Z(j),j)}}function Z(n){var m=W("div");if(Y.win&&Y.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=b(q);if(typeof AE.id==X){AE.id=q}if(Y.ie&&Y.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=b(AE.id)}else{if(Y.webkit&&Y.webkit<312){var AA=W("embed");AA.setAttribute("type",V);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=W(P);s.setAttribute("type",V);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=W("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function b(i){return g.getElementById(i)}function W(i){return g.createElement(i)}function O(k){var j=Y.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(Y.ie&&Y.mac){return }var l=g.getElementsByTagName("head")[0],k=W("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(Y.ie&&Y.win)&&typeof g.createTextNode!=X){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(Y.ie&&Y.win&&typeof g.styleSheets!=X&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}return{registerObject:function(l,i,k){if(!Y.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;A("#"+l,e)},getObjectById:function(l){var i=null;if(Y.w3cdom&&S){var j=b(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=X)){i=j}else{if(typeof k.SetVariable!=X){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!Y.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){A("#"+u,e);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=X){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);A("#"+u,a)})}else{if(m&&!C&&O("6.0.65")&&(Y.win||Y.mac)){A("#"+u,e);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i);A("#"+u,a)})}}},getFlashPlayerVersion:function(){return{major:Y.pv[0],minor:Y.pv[1],release:Y.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(Y.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(Y.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=b(K);if(i){i.parentNode.replaceChild(L,i);L=null;C=false}}}}}();
-
+// SWFObject v2.1 must be loaded
        
 var SWFUpload;
 if (typeof(SWFUpload) === "function") {
        
 var SWFUpload;
 if (typeof(SWFUpload) === "function") {
diff --git a/wp-includes/js/swfupload/swfupload-all.js b/wp-includes/js/swfupload/swfupload-all.js
new file mode 100644 (file)
index 0000000..afb7921
--- /dev/null
@@ -0,0 +1,8 @@
+// swfupload
+var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)}}SWFUpload.prototype.initSWFUpload=function(b){try{this.customSettings={};this.settings=b;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash()}catch(a){delete SWFUpload.instances[this.movieName];throw a}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(a){if(typeof(a)!=="string"||a.match(/^https?:\/\//i)||a.match(/^\//)){return a}var c,b;c=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");b=window.location.pathname.lastIndexOf("/");if(b<=0){path="/"}else{path=window.location.pathname.substr(0,b)+"/"}return path+a};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(b,a){this.settings[b]=(this.settings[b]==undefined)?a:this.settings[b]};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime()}if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}a=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(a==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id}b=document.createElement("div");b.innerHTML=this.getFlashHTML();a.parentNode.replaceChild(b.firstChild,a);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")};SWFUpload.prototype.getFlashVars=function(){var b=this.buildParamString(),a=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(a),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(b),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var c=this.settings.post_params,b=[],a;if(typeof(c)==="object"){for(a in c){if(c.hasOwnProperty(a)){b.push(encodeURIComponent(a.toString())+"="+encodeURIComponent(c[a].toString()))}}}return b.join("&amp;")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var a=null,c;a=this.getMovieElement();if(a&&typeof(a.CallFunction)==="unknown"){for(c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(e){}}try{a.parentNode.removeChild(a)}catch(b){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true}catch(d){return false}};SWFUpload.prototype.addSetting=function(b,c,a){if(c==undefined){return(this.settings[b]=a)}else{return(this.settings[b]=c)}};SWFUpload.prototype.getSetting=function(a){if(this.settings[a]!=undefined){return this.settings[a]}return""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement(),returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+"</invoke>");returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue)}return returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelUpload=function(a,b){if(b!==false){b=true}this.callFlash("CancelUpload",[a,b])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])};SWFUpload.prototype.getFile=function(a){if(typeof(a)==="number"){return this.callFlash("GetFileByIndex",[a])}else{return this.callFlash("GetFile",[a])}};SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])};SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])};SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString();this.callFlash("SetUploadURL",[a])};SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a;this.callFlash("SetPostParams",[a])};SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a;this.settings.file_types_description=b;this.callFlash("SetFileTypes",[a,b])};SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a;this.callFlash("SetFileSizeLimit",[a])};SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a;this.callFlash("SetFileUploadLimit",[a])};SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a;this.callFlash("SetFileQueueLimit",[a])};SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a;this.callFlash("SetFilePostName",[a])};SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a;this.callFlash("SetUseQueryString",[a])};SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a;this.callFlash("SetRequeueOnError",[a])};SWFUpload.prototype.setHTTPSuccess=function(a){if(typeof a==="string"){a=a.replace(" ","").split(",")}this.settings.http_success=a;this.callFlash("SetHTTPSuccess",[a])};SWFUpload.prototype.setAssumeSuccessTimeout=function(a){this.settings.assume_success_timeout=a;this.callFlash("SetAssumeSuccessTimeout",[a])};SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a;this.callFlash("SetDebugEnabled",[a])};SWFUpload.prototype.setButtonImageURL=function(a){if(a==undefined){a=""}this.settings.button_image_url=a;this.callFlash("SetButtonImageURL",[a])};SWFUpload.prototype.setButtonDimensions=function(c,a){this.settings.button_width=c;this.settings.button_height=a;var b=this.getMovieElement();if(b!=undefined){b.style.width=c+"px";b.style.height=a+"px"}this.callFlash("SetButtonDimensions",[c,a])};SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a;this.callFlash("SetButtonText",[a])};SWFUpload.prototype.setButtonTextPadding=function(b,a){this.settings.button_text_top_padding=a;this.settings.button_text_left_padding=b;this.callFlash("SetButtonTextPadding",[b,a])};SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a;this.callFlash("SetButtonTextStyle",[a])};SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a;this.callFlash("SetButtonDisabled",[a])};SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a;this.callFlash("SetButtonAction",[a])};SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a;this.callFlash("SetButtonCursor",[a])};SWFUpload.prototype.queueEvent=function(b,c){if(c==undefined){c=[]}else{if(!(c instanceof Array)){c=[c]}}var a=this;if(typeof this.settings[b]==="function"){this.eventQueue.push(function(){this.settings[b].apply(this,c)});setTimeout(function(){a.executeNextEvent()},0)}else{if(this.settings[b]!==null){throw"Event handler "+b+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;if(typeof(a)==="function"){a.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(c){var e=/[$]([0-9a-f]{4})/i,f={},d,a,b;if(c!=undefined){for(a in c.post){if(c.post.hasOwnProperty(a)){d=a;while((b=e.exec(d))!==null){d=d.replace(b[0],String.fromCharCode(parseInt("0x"+b[1],16)))}f[d]=c.post[a]}}c.post=f}return c};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(a){return false}};SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();if(!a){this.debug("Flash called back ready but the flash movie can't be found.");return}this.cleanUp(a);this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.cleanUp=function(a){var c;try{if(this.movieElement&&typeof(a.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(b){}}}}catch(d){}window.__flash__removeCallback=function(e,f){try{if(e){e[f]=null}}catch(g){}}};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("file_queued_handler",a)};SWFUpload.prototype.fileQueueError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("file_queue_error_handler",[a,c,b])};SWFUpload.prototype.fileDialogComplete=function(b,c,a){this.queueEvent("file_dialog_complete_handler",[b,c,a])};SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("return_upload_start_handler",a)};SWFUpload.prototype.returnUploadStart=function(a){var b;if(typeof this.settings.upload_start_handler==="function"){a=this.unescapeFilePostParams(a);b=this.settings.upload_start_handler.call(this,a)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(b===undefined){b=true}b=!!b;this.callFlash("ReturnUploadStart",[b])};SWFUpload.prototype.uploadProgress=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_progress_handler",[a,c,b])};SWFUpload.prototype.uploadError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_error_handler",[a,c,b])};SWFUpload.prototype.uploadSuccess=function(b,a,c){b=this.unescapeFilePostParams(b);this.queueEvent("upload_success_handler",[b,a,c])};SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("upload_complete_handler",a)};SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)};
+// swfupload.queue
+var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.queueSettings={};this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.queueSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null}})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload=function(a){this.queueSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=true;this.stopUpload();var a=this.getStats();while(a.files_queued>0){this.cancelUpload();a=this.getStats()}};SWFUpload.queue.uploadStartHandler=function(a){var b;if(typeof(this.queueSettings.user_upload_start_handler)==="function"){b=this.queueSettings.user_upload_start_handler.call(this,a)}b=(b===false)?false:true;this.queueSettings.queue_cancelled_flag=!b;return b};SWFUpload.queue.uploadCompleteHandler=function(b){var c=this.queueSettings.user_upload_complete_handler,d,a;if(b.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.queueSettings.queue_upload_count++}if(typeof(c)==="function"){d=(c.call(this,b)===false)?false:true}else{if(b.filestatus===SWFUpload.FILE_STATUS.QUEUED){d=false}else{d=true}}if(d){a=this.getStats();if(a.files_queued>0&&this.queueSettings.queue_cancelled_flag===false){this.startUpload()}else{if(this.queueSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]);this.queueSettings.queue_upload_count=0}else{this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0}}}}};
+// swfobject
+var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
+// swfupload.swfobject
+var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.onload=function(){};swfobject.addDomLoadEvent(function(){if(typeof(SWFUpload.onload)==="function"){SWFUpload.onload.call(window)}});SWFUpload.prototype.initSettings=(function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.ensureDefault=function(c,b){this.settings[c]=(this.settings[c]==undefined)?b:this.settings[c]};this.ensureDefault("minimum_flash_version","9.0.28");this.ensureDefault("swfupload_pre_load_handler",null);this.ensureDefault("swfupload_load_failed_handler",null);delete this.ensureDefault}})(SWFUpload.prototype.initSettings);SWFUpload.prototype.loadFlash=function(a){return function(){var b=swfobject.hasFlashPlayerVersion(this.settings.minimum_flash_version);if(b){this.queueEvent("swfupload_pre_load_handler");if(typeof(a)==="function"){a.call(this)}}else{this.queueEvent("swfupload_load_failed_handler")}}}(SWFUpload.prototype.loadFlash)};
index 849cf28e6bb59ece00d509b1eadd34ad5c3dbc62..e65b19cb29e3a05550ec21e15a052045f0e703f1 100644 (file)
@@ -31,6 +31,7 @@ SWFUpload.prototype.initSWFUpload = function (settings) {
                this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
                this.movieElement = null;
 
                this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
                this.movieElement = null;
 
+
                // Setup global control tracking
                SWFUpload.instances[this.movieName] = this;
 
                // Setup global control tracking
                SWFUpload.instances[this.movieName] = this;
 
@@ -49,7 +50,7 @@ SWFUpload.prototype.initSWFUpload = function (settings) {
 /* *************** */
 SWFUpload.instances = {};
 SWFUpload.movieCount = 0;
 /* *************** */
 SWFUpload.instances = {};
 SWFUpload.movieCount = 0;
-SWFUpload.version = "2.2.0 Beta 2";
+SWFUpload.version = "2.2.0 2009-03-25";
 SWFUpload.QUEUE_ERROR = {
        QUEUE_LIMIT_EXCEEDED                    : -100,
        FILE_EXCEEDS_SIZE_LIMIT                 : -110,
 SWFUpload.QUEUE_ERROR = {
        QUEUE_LIMIT_EXCEEDED                    : -100,
        FILE_EXCEEDS_SIZE_LIMIT                 : -110,
@@ -90,6 +91,27 @@ SWFUpload.WINDOW_MODE = {
        OPAQUE : "opaque"
 };
 
        OPAQUE : "opaque"
 };
 
+// Private: takes a URL, determines if it is relative and converts to an absolute URL
+// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
+SWFUpload.completeURL = function(url) {
+       if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
+               return url;
+       }
+       
+       var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
+       
+       var indexSlash = window.location.pathname.lastIndexOf("/");
+       if (indexSlash <= 0) {
+               path = "/";
+       } else {
+               path = window.location.pathname.substr(0, indexSlash) + "/";
+       }
+       
+       return /*currentURL +*/ path + url;
+       
+};
+
+
 /* ******************** */
 /* Instance Members  */
 /* ******************** */
 /* ******************** */
 /* Instance Members  */
 /* ******************** */
@@ -103,11 +125,13 @@ SWFUpload.prototype.initSettings = function () {
        
        // Upload backend settings
        this.ensureDefault("upload_url", "");
        
        // Upload backend settings
        this.ensureDefault("upload_url", "");
+       this.ensureDefault("preserve_relative_urls", false);
        this.ensureDefault("file_post_name", "Filedata");
        this.ensureDefault("post_params", {});
        this.ensureDefault("use_query_string", false);
        this.ensureDefault("requeue_on_error", false);
        this.ensureDefault("http_success", []);
        this.ensureDefault("file_post_name", "Filedata");
        this.ensureDefault("post_params", {});
        this.ensureDefault("use_query_string", false);
        this.ensureDefault("requeue_on_error", false);
        this.ensureDefault("http_success", []);
+       this.ensureDefault("assume_success_timeout", 0);
        
        // File Settings
        this.ensureDefault("file_types", "*.*");
        
        // File Settings
        this.ensureDefault("file_types", "*.*");
@@ -130,7 +154,8 @@ SWFUpload.prototype.initSettings = function () {
        this.ensureDefault("button_text_left_padding", 0);
        this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
        this.ensureDefault("button_disabled", false);
        this.ensureDefault("button_text_left_padding", 0);
        this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
        this.ensureDefault("button_disabled", false);
-       this.ensureDefault("button_placeholder_id", null);
+       this.ensureDefault("button_placeholder_id", "");
+       this.ensureDefault("button_placeholder", null);
        this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
        this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
        
        this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
        this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
        
@@ -160,50 +185,21 @@ SWFUpload.prototype.initSettings = function () {
        this.customSettings = this.settings.custom_settings;
        
        // Update the flash url if needed
        this.customSettings = this.settings.custom_settings;
        
        // Update the flash url if needed
-       if (this.settings.prevent_swf_caching) {
-               this.settings.flash_url = this.settings.flash_url + "?swfuploadrnd=" + Math.floor(Math.random() * 999999999);
+       if (!!this.settings.prevent_swf_caching) {
+               this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
+       }
+       
+       if (!this.settings.preserve_relative_urls) {
+               //this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url);     // Don't need to do this one since flash doesn't look at it
+               this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
+               this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
        }
        
        delete this.ensureDefault;
 };
 
        }
        
        delete this.ensureDefault;
 };
 
+// Private: loadFlash replaces the button_placeholder element with the flash movie.
 SWFUpload.prototype.loadFlash = function () {
 SWFUpload.prototype.loadFlash = function () {
-       if (this.settings.button_placeholder_id !== "") {
-               this.replaceWithFlash();
-       } else {
-               this.appendFlash();
-       }
-};
-
-// Private: appendFlash gets the HTML tag for the Flash
-// It then appends the flash to the body
-SWFUpload.prototype.appendFlash = function () {
-       var targetElement, container;
-
-       // Make sure an element with the ID we are going to use doesn't already exist
-       if (document.getElementById(this.movieName) !== null) {
-               throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
-       }
-
-       // Get the body tag where we will be adding the flash movie
-       targetElement = document.getElementsByTagName("body")[0];
-
-       if (targetElement == undefined) {
-               throw "Could not find the 'body' element.";
-       }
-
-       // Append the container and load the flash
-       container = document.createElement("div");
-       container.style.width = "1px";
-       container.style.height = "1px";
-       container.style.overflow = "hidden";
-
-       targetElement.appendChild(container);
-       container.innerHTML = this.getFlashHTML();      // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
-};
-
-// Private: replaceWithFlash replaces the button_placeholder element with the flash movie.
-SWFUpload.prototype.replaceWithFlash = function () {
        var targetElement, tempParent;
 
        // Make sure an element with the ID we are going to use doesn't already exist
        var targetElement, tempParent;
 
        // Make sure an element with the ID we are going to use doesn't already exist
@@ -212,10 +208,10 @@ SWFUpload.prototype.replaceWithFlash = function () {
        }
 
        // Get the element where we will be placing the flash movie
        }
 
        // Get the element where we will be placing the flash movie
-       targetElement = document.getElementById(this.settings.button_placeholder_id);
+       targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
 
        if (targetElement == undefined) {
 
        if (targetElement == undefined) {
-               throw "Could not find the placeholder element.";
+               throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
        }
 
        // Append the container and load the flash
        }
 
        // Append the container and load the flash
@@ -223,13 +219,18 @@ SWFUpload.prototype.replaceWithFlash = function () {
        tempParent.innerHTML = this.getFlashHTML();     // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
        targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
 
        tempParent.innerHTML = this.getFlashHTML();     // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
        targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
 
+       // Fix IE Flash/Form bug
+       if (window[this.movieName] == undefined) {
+               window[this.movieName] = this.getMovieElement();
+       }
+       
 };
 
 // Private: getFlashHTML generates the object tag needed to embed the flash in to the document
 SWFUpload.prototype.getFlashHTML = function () {
        // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
        return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
 };
 
 // Private: getFlashHTML generates the object tag needed to embed the flash in to the document
 SWFUpload.prototype.getFlashHTML = function () {
        // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
        return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
-                               '<param name="wmode" value="', this.settings.button_window_mode , '" />',
+                               '<param name="wmode" value="', this.settings.button_window_mode, '" />',
                                '<param name="movie" value="', this.settings.flash_url, '" />',
                                '<param name="quality" value="high" />',
                                '<param name="menu" value="false" />',
                                '<param name="movie" value="', this.settings.flash_url, '" />',
                                '<param name="quality" value="high" />',
                                '<param name="menu" value="false" />',
@@ -251,6 +252,7 @@ SWFUpload.prototype.getFlashVars = function () {
                        "&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
                        "&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
                        "&amp;httpSuccess=", encodeURIComponent(httpSuccessString),
                        "&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
                        "&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
                        "&amp;httpSuccess=", encodeURIComponent(httpSuccessString),
+                       "&amp;assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
                        "&amp;params=", encodeURIComponent(paramString),
                        "&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
                        "&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
                        "&amp;params=", encodeURIComponent(paramString),
                        "&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
                        "&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
@@ -306,46 +308,54 @@ SWFUpload.prototype.buildParamString = function () {
 // Public: Used to remove a SWFUpload instance from the page. This method strives to remove
 // all references to the SWF, and other objects so memory is properly freed.
 // Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
 // Public: Used to remove a SWFUpload instance from the page. This method strives to remove
 // all references to the SWF, and other objects so memory is properly freed.
 // Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
+// Credits: Major improvements provided by steffen
 SWFUpload.prototype.destroy = function () {
        try {
                // Make sure Flash is done before we try to remove it
 SWFUpload.prototype.destroy = function () {
        try {
                // Make sure Flash is done before we try to remove it
-               this.stopUpload();
+               this.cancelUpload(null, false);
                
                
+
                // Remove the SWFUpload DOM nodes
                var movieElement = null;
                // Remove the SWFUpload DOM nodes
                var movieElement = null;
-               try {
-                       movieElement = this.getMovieElement();
-               } catch (ex) {
-               }
+               movieElement = this.getMovieElement();
                
                
-               if (movieElement != undefined && movieElement.parentNode != undefined && typeof movieElement.parentNode.removeChild === "function") {
-                       var container = movieElement.parentNode;
-                       if (container != undefined) {
-                               container.removeChild(movieElement);
-                               if (container.parentNode != undefined && typeof container.parentNode.removeChild === "function") {
-                                       container.parentNode.removeChild(container);
-                               }
+               if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
+                       // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
+                       for (var i in movieElement) {
+                               try {
+                                       if (typeof(movieElement[i]) === "function") {
+                                               movieElement[i] = null;
+                                       }
+                               } catch (ex1) {}
                        }
                        }
+
+                       // Remove the Movie Element from the page
+                       try {
+                               movieElement.parentNode.removeChild(movieElement);
+                       } catch (ex) {}
                }
                
                }
                
-               // Destroy references
+               // Remove IE form fix reference
+               window[this.movieName] = null;
+
+               // Destroy other references
                SWFUpload.instances[this.movieName] = null;
                delete SWFUpload.instances[this.movieName];
 
                SWFUpload.instances[this.movieName] = null;
                delete SWFUpload.instances[this.movieName];
 
-               delete this.movieElement;
-               delete this.settings;
-               delete this.customSettings;
-               delete this.eventQueue;
-               delete this.movieName;
+               this.movieElement = null;
+               this.settings = null;
+               this.customSettings = null;
+               this.eventQueue = null;
+               this.movieName = null;
                
                
-               delete window[this.movieName];
                
                return true;
                
                return true;
-       } catch (ex1) {
+       } catch (ex2) {
                return false;
        }
 };
 
                return false;
        }
 };
 
+
 // Public: displayDebugInfo prints out settings and configuration
 // information about this SWFUpload instance.
 // This function (and any references to it) can be deleted when placing
 // Public: displayDebugInfo prints out settings and configuration
 // information about this SWFUpload instance.
 // This function (and any references to it) can be deleted when placing
@@ -362,6 +372,7 @@ SWFUpload.prototype.displayDebugInfo = function () {
                        "\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",
                        "\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n",
                        "\t", "http_success:             ", this.settings.http_success.join(", "), "\n",
                        "\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",
                        "\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n",
                        "\t", "http_success:             ", this.settings.http_success.join(", "), "\n",
+                       "\t", "assume_success_timeout:   ", this.settings.assume_success_timeout, "\n",
                        "\t", "file_post_name:           ", this.settings.file_post_name, "\n",
                        "\t", "post_params:              ", this.settings.post_params.toString(), "\n",
                        "\t", "file_types:               ", this.settings.file_types, "\n",
                        "\t", "file_post_name:           ", this.settings.file_post_name, "\n",
                        "\t", "post_params:              ", this.settings.post_params.toString(), "\n",
                        "\t", "file_types:               ", this.settings.file_types, "\n",
@@ -374,6 +385,7 @@ SWFUpload.prototype.displayDebugInfo = function () {
                        "\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",
 
                        "\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",
                        "\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",
 
                        "\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",
+                       "\t", "button_placeholder:       ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
                        "\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",
                        "\t", "button_width:             ", this.settings.button_width.toString(), "\n",
                        "\t", "button_height:            ", this.settings.button_height.toString(), "\n",
                        "\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",
                        "\t", "button_width:             ", this.settings.button_width.toString(), "\n",
                        "\t", "button_height:            ", this.settings.button_height.toString(), "\n",
@@ -430,33 +442,23 @@ SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
        argumentArray = argumentArray || [];
        
        var movieElement = this.getMovieElement();
        argumentArray = argumentArray || [];
        
        var movieElement = this.getMovieElement();
-       var returnValue;
+       var returnValue, returnString;
 
 
-       if (typeof movieElement[functionName] === "function") {
-               // We have to go through all this if/else stuff because the Flash functions don't have apply() and only accept the exact number of arguments.
-               if (argumentArray.length === 0) {
-                       returnValue = movieElement[functionName]();
-               } else if (argumentArray.length === 1) {
-                       returnValue = movieElement[functionName](argumentArray[0]);
-               } else if (argumentArray.length === 2) {
-                       returnValue = movieElement[functionName](argumentArray[0], argumentArray[1]);
-               } else if (argumentArray.length === 3) {
-                       returnValue = movieElement[functionName](argumentArray[0], argumentArray[1], argumentArray[2]);
-               } else {
-                       throw "Too many arguments";
-               }
-               
-               // Unescape file post param values
-               if (returnValue != undefined && typeof returnValue.post === "object") {
-                       returnValue = this.unescapeFilePostParams(returnValue);
-               }
-               
-               return returnValue;
-       } else {
-               throw "Invalid function name: " + functionName;
+       // Flash's method if calling ExternalInterface methods (code adapted from MooTools).
+       try {
+               returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
+               returnValue = eval(returnString);
+       } catch (ex) {
+               throw "Call to " + functionName + " failed";
+       }
+       
+       // Unescape file post param values
+       if (returnValue != undefined && typeof returnValue.post === "object") {
+               returnValue = this.unescapeFilePostParams(returnValue);
        }
        }
-};
 
 
+       return returnValue;
+};
 
 /* *****************************
        -- Flash control methods --
 
 /* *****************************
        -- Flash control methods --
@@ -464,17 +466,19 @@ SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
        to operate SWFUpload
    ***************************** */
 
        to operate SWFUpload
    ***************************** */
 
+// WARNING: this function does not work in Flash Player 10
 // Public: selectFile causes a File Selection Dialog window to appear.  This
 // Public: selectFile causes a File Selection Dialog window to appear.  This
-// dialog only allows 1 file to be selected. WARNING: this function does not work in Flash Player 10
+// dialog only allows 1 file to be selected.
 SWFUpload.prototype.selectFile = function () {
        this.callFlash("SelectFile");
 };
 
 SWFUpload.prototype.selectFile = function () {
        this.callFlash("SelectFile");
 };
 
+// WARNING: this function does not work in Flash Player 10
 // Public: selectFiles causes a File Selection Dialog window to appear/ This
 // dialog allows the user to select any number of files
 // Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
 // If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
 // Public: selectFiles causes a File Selection Dialog window to appear/ This
 // dialog allows the user to select any number of files
 // Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
 // If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
-// for this bug.  WARNING: this function does not work in Flash Player 10
+// for this bug.
 SWFUpload.prototype.selectFiles = function () {
        this.callFlash("SelectFiles");
 };
 SWFUpload.prototype.selectFiles = function () {
        this.callFlash("SelectFiles");
 };
@@ -623,6 +627,11 @@ SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
        this.callFlash("SetHTTPSuccess", [http_status_codes]);
 };
 
        this.callFlash("SetHTTPSuccess", [http_status_codes]);
 };
 
+// Public: setHTTPSuccess changes the http_success setting
+SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
+       this.settings.assume_success_timeout = timeout_seconds;
+       this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
+};
 
 // Public: setDebugEnabled changes the debug_enabled setting
 SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
 
 // Public: setDebugEnabled changes the debug_enabled setting
 SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
@@ -763,21 +772,65 @@ SWFUpload.prototype.unescapeFilePostParams = function (file) {
        return file;
 };
 
        return file;
 };
 
+// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
+SWFUpload.prototype.testExternalInterface = function () {
+       try {
+               return this.callFlash("TestExternalInterface");
+       } catch (ex) {
+               return false;
+       }
+};
+
+// Private: This event is called by Flash when it has finished loading. Don't modify this.
+// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
 SWFUpload.prototype.flashReady = function () {
        // Check that the movie element is loaded correctly with its ExternalInterface methods defined
        var movieElement = this.getMovieElement();
 SWFUpload.prototype.flashReady = function () {
        // Check that the movie element is loaded correctly with its ExternalInterface methods defined
        var movieElement = this.getMovieElement();
-       if (typeof movieElement.StartUpload !== "function") {
-               throw "ExternalInterface methods failed to initialize.";
-       }
 
 
-       // Fix IE Flash/Form bug
-       if (window[this.movieName] == undefined) {
-               window[this.movieName] = movieElement;
+       if (!movieElement) {
+               this.debug("Flash called back ready but the flash movie can't be found.");
+               return;
        }
        }
+
+       this.cleanUp(movieElement);
        
        this.queueEvent("swfupload_loaded_handler");
 };
 
        
        this.queueEvent("swfupload_loaded_handler");
 };
 
+// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
+// This function is called by Flash each time the ExternalInterface functions are created.
+SWFUpload.prototype.cleanUp = function (movieElement) {
+       // Pro-actively unhook all the Flash functions
+       try {
+               if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
+                       this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
+                       for (var key in movieElement) {
+                               try {
+                                       if (typeof(movieElement[key]) === "function") {
+                                               movieElement[key] = null;
+                                       }
+                               } catch (ex) {
+                               }
+                       }
+               }
+       } catch (ex1) {
+       
+       }
+
+       // Fix Flashes own cleanup code so if the SWFMovie was removed from the page
+       // it doesn't display errors.
+       window["__flash__removeCallback"] = function (instance, name) {
+               try {
+                       if (instance) {
+                               instance[name] = null;
+                       }
+               } catch (flashEx) {
+               
+               }
+       };
+
+};
+
 
 /* This is a chance to do something before the browse window opens */
 SWFUpload.prototype.fileDialogStart = function () {
 
 /* This is a chance to do something before the browse window opens */
 SWFUpload.prototype.fileDialogStart = function () {
@@ -800,8 +853,8 @@ SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
 
 /* Called after the file dialog has closed and the selected files have been queued.
        You could call startUpload here if you want the queued files to begin uploading immediately. */
 
 /* Called after the file dialog has closed and the selected files have been queued.
        You could call startUpload here if you want the queued files to begin uploading immediately. */
-SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued) {
-       this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued]);
+SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
+       this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
 };
 
 SWFUpload.prototype.uploadStart = function (file) {
 };
 
 SWFUpload.prototype.uploadStart = function (file) {
@@ -841,9 +894,9 @@ SWFUpload.prototype.uploadError = function (file, errorCode, message) {
        this.queueEvent("upload_error_handler", [file, errorCode, message]);
 };
 
        this.queueEvent("upload_error_handler", [file, errorCode, message]);
 };
 
-SWFUpload.prototype.uploadSuccess = function (file, serverData) {
+SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
        file = this.unescapeFilePostParams(file);
        file = this.unescapeFilePostParams(file);
-       this.queueEvent("upload_success_handler", [file, serverData]);
+       this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
 };
 
 SWFUpload.prototype.uploadComplete = function (file) {
 };
 
 SWFUpload.prototype.uploadComplete = function (file) {
index a627b19b1d88a1ccd6e90f81eee9d19bf511890f..e3f767031ca8243a5f0b89bc0f154cc5962e01e9 100644 (file)
Binary files a/wp-includes/js/swfupload/swfupload.swf and b/wp-includes/js/swfupload/swfupload.swf differ
diff --git a/wp-includes/js/swfupload/swfupload_f9.swf b/wp-includes/js/swfupload/swfupload_f9.swf
deleted file mode 100644 (file)
index 2aba003..0000000
Binary files a/wp-includes/js/swfupload/swfupload_f9.swf and /dev/null differ
index f2873c91aa52dc372956fa48d5d97b882af19b31..df602f3cffddaf9514abdd0f0838c57a45cd015a 100644 (file)
@@ -77,7 +77,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
                        TB_imageCount = "";
                        TB_FoundURL = false;
                        if(imageGroup){
                        TB_imageCount = "";
                        TB_FoundURL = false;
                        if(imageGroup){
-                               TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
+                               TB_TempArray = jQuery("a[rel="+imageGroup+"]").get();
                                for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
                                        var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
                                                if (!(TB_TempArray[TB_Counter].href == url)) {                                          
                                for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
                                        var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
                                                if (!(TB_TempArray[TB_Counter].href == url)) {                                          
index af6d6d80e6affd1d190d12a83d4298c850d58d89..8320f2a5ff28875718f4c3ae9a126a58bdf9fbb5 100644 (file)
@@ -18,7 +18,7 @@ function mce_escape($text) {
        global $language;
 
        if ( 'en' == $language ) return $text;
        global $language;
 
        if ( 'en' == $language ) return $text;
-       else return js_escape($text);
+       else return esc_js($text);
 }
 
 $lang = 'tinyMCE.addI18n({' . $language . ':{
 }
 
 $lang = 'tinyMCE.addI18n({' . $language . ':{
@@ -150,8 +150,8 @@ desc:"' . mce_escape( __('Toggle fullscreen mode') ) . ' (Alt+Shift+G)"
 },
 media:{
 desc:"' . mce_escape( __('Insert / edit embedded media') ) . '",
 },
 media:{
 desc:"' . mce_escape( __('Insert / edit embedded media') ) . '",
-delta_width:"' . mce_escape( _c('0| Extra width for the media popup in pixels') ) . '",
-delta_height:"' . mce_escape( _c('0| Extra height for the media popup in pixels') ) . '",
+delta_width:"' . /* translators: Extra width for the media popup in pixels */ mce_escape( _x('0', 'media popup width') ) . '",
+delta_height:"' . /* translators: Extra height for the media popup in pixels */ mce_escape( _x('0', 'media popup height') ) . '",
 edit:"' . mce_escape( __('Edit embedded media') ) . '"
 },
 fullpage:{
 edit:"' . mce_escape( __('Edit embedded media') ) . '"
 },
 fullpage:{
@@ -179,7 +179,7 @@ desc:"' . mce_escape( __('Insert page break.') ) . '"
 }}});
 
 tinyMCE.addI18n("' . $language . '.advanced",{
 }}});
 
 tinyMCE.addI18n("' . $language . '.advanced",{
-style_select:"' . mce_escape( __('Styles') ) . '",
+style_select:"' . mce_escape( /* translators: TinyMCE font styles */ _x('Styles', 'TinyMCE font styles') ) . '",
 font_size:"' . mce_escape( __('Font size') ) . '",
 fontdefault:"' . mce_escape( __('Font family') ) . '",
 block:"' . mce_escape( __('Format') ) . '",
 font_size:"' . mce_escape( __('Font size') ) . '",
 fontdefault:"' . mce_escape( __('Font family') ) . '",
 block:"' . mce_escape( __('Format') ) . '",
@@ -213,12 +213,12 @@ indent_desc:"' . mce_escape( __('Indent') ) . '",
 undo_desc:"' . mce_escape( __('Undo') ) . ' (Ctrl+Z)",
 redo_desc:"' . mce_escape( __('Redo') ) . ' (Ctrl+Y)",
 link_desc:"' . mce_escape( __('Insert/edit link') ) . ' (Alt+Shift+A)",
 undo_desc:"' . mce_escape( __('Undo') ) . ' (Ctrl+Z)",
 redo_desc:"' . mce_escape( __('Redo') ) . ' (Ctrl+Y)",
 link_desc:"' . mce_escape( __('Insert/edit link') ) . ' (Alt+Shift+A)",
-link_delta_width:"' . mce_escape( _c('0| Extra width for the link popup in pixels') ) . '",
-link_delta_height:"' . mce_escape( _c('0| Extra height for the link popup in pixels') ) . '",
+link_delta_width:"' . /* translators: Extra width for the link popup in pixels */ mce_escape( _x('0', 'link popup width') ) . '",
+link_delta_height:"' . /* translators: Extra height for the link popup in pixels */ mce_escape( _x('0', 'link popup height') ) . '",
 unlink_desc:"' . mce_escape( __('Unlink') ) . ' (Alt+Shift+S)",
 image_desc:"' . mce_escape( __('Insert/edit image') ) . ' (Alt+Shift+M)",
 unlink_desc:"' . mce_escape( __('Unlink') ) . ' (Alt+Shift+S)",
 image_desc:"' . mce_escape( __('Insert/edit image') ) . ' (Alt+Shift+M)",
-image_delta_width:"' . mce_escape( _c('0| Extra width for the image popup in pixels') ) . '",
-image_delta_height:"' . mce_escape( _c('0| Extra height for the image popup in pixels') ) . '",
+image_delta_width:"' . /* translators: Extra width for the image popup in pixels */ mce_escape( _x('0', 'image popup width') ) . '",
+image_delta_height:"' . /* translators: Extra height for the image popup in pixels */ mce_escape( _x('0', 'image popup height') ) . '",
 cleanup_desc:"' . mce_escape( __('Cleanup messy code') ) . '",
 code_desc:"' . mce_escape( __('Edit HTML Source') ) . '",
 sub_desc:"' . mce_escape( __('Subscript') ) . '",
 cleanup_desc:"' . mce_escape( __('Cleanup messy code') ) . '",
 code_desc:"' . mce_escape( __('Edit HTML Source') ) . '",
 sub_desc:"' . mce_escape( __('Subscript') ) . '",
@@ -242,8 +242,8 @@ path:"' . mce_escape( __('Path') ) . '",
 newdocument:"' . mce_escape( __('Are you sure you want to clear all contents?') ) . '",
 toolbar_focus:"' . mce_escape( __('Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X') ) . '",
 more_colors:"' . mce_escape( __('More colors') ) . '",
 newdocument:"' . mce_escape( __('Are you sure you want to clear all contents?') ) . '",
 toolbar_focus:"' . mce_escape( __('Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X') ) . '",
 more_colors:"' . mce_escape( __('More colors') ) . '",
-colorpicker_delta_width:"' . mce_escape( _c('0| Extra width for the colorpicker popup in pixels') ) . '",
-colorpicker_delta_height:"' . mce_escape( _c('0| Extra height for the colorpicker popup in pixels') ) . '"
+colorpicker_delta_width:"' . /* translators: Extra width for the colorpicker popup in pixels */ mce_escape( _x('0', 'colorpicker popup width') ) . '",
+colorpicker_delta_height:"' . /* translators: Extra height for the colorpicker popup in pixels */ mce_escape( _x('0', 'colorpicker popup height') ) . '"
 });
 
 tinyMCE.addI18n("' . $language . '.advanced_dlg",{
 });
 
 tinyMCE.addI18n("' . $language . '.advanced_dlg",{
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
deleted file mode 100644 (file)
index 01a994e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-(function(){tinymce.create('tinymce.plugins.AutoSavePlugin',{init:function(ed,url){var t=this;t.editor=ed;window.onbeforeunload=tinymce.plugins.AutoSavePlugin._beforeUnloadHandler;},getInfo:function(){return{longname:'Auto save',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',version:tinymce.majorVersion+"."+tinymce.minorVersion};},'static':{_beforeUnloadHandler:function(){var msg;tinymce.each(tinyMCE.editors,function(ed){if(ed.getParam("fullscreen_is_enabled"))return;if(ed.isDirty()){msg=ed.getLang("autosave.unload_msg");return false;}});return msg;}}});tinymce.PluginManager.add('autosave',tinymce.plugins.AutoSavePlugin);})();
\ No newline at end of file
index 6966d80af49716199816005abbcded88ca67cef5..bce8e73995d05c6bdd18f476a595be3e633b9782 100644 (file)
@@ -1 +1 @@
-(function(){tinymce.create('tinymce.plugins.Directionality',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceDirectionLTR',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="ltr")ed.dom.setAttrib(e,"dir","ltr");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addCommand('mceDirectionRTL',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="rtl")ed.dom.setAttrib(e,"dir","rtl");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addButton('ltr',{title:'directionality.ltr_desc',cmd:'mceDirectionLTR'});ed.addButton('rtl',{title:'directionality.rtl_desc',cmd:'mceDirectionRTL'});ed.onNodeChange.add(t._nodeChange,t);},getInfo:function(){return{longname:'Directionality',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_nodeChange:function(ed,cm,n){var dom=ed.dom,dir;n=dom.getParent(n,dom.isBlock);if(!n){cm.setDisabled('ltr',1);cm.setDisabled('rtl',1);return;}dir=dom.getAttrib(n,'dir');cm.setActive('ltr',dir=="ltr");cm.setDisabled('ltr',0);cm.setActive('rtl',dir=="rtl");cm.setDisabled('rtl',0);}});tinymce.PluginManager.add('directionality',tinymce.plugins.Directionality);})();
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceDirectionLTR",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="ltr"){a.dom.setAttrib(d,"dir","ltr")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addCommand("mceDirectionRTL",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="rtl"){a.dom.setAttrib(d,"dir","rtl")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});a.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});a.onNodeChange.add(c._nodeChange,c)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();
\ No newline at end of file
index fbcec59e875ee2f5dfa6d73dcc0909a35f3a19a4..dfb3f16cccec3d1d1523b3ad7ed5df4df429d3e8 100644 (file)
@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(tinymce.isIE&&(s.fullscreen_html_overflow=='visible'||s.fullscreen_html_overflow=='scroll'))s.fullscreen_html_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:'+(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel)?'absolute':'fixed')+';top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})();
\ No newline at end of file
+(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(c,d){var e=this,f={},b;e.editor=c;c.addCommand("mceFullScreen",function(){var h,i=a.doc.documentElement;if(c.getParam("fullscreen_is_enabled")){if(c.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",e.resizeFunc);tinyMCE.get(c.getParam("fullscreen_editor_id")).setContent(c.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(c);a.remove("mce_fullscreen_container");i.style.overflow=c.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",c.getParam("fullscreen_overflow"));a.win.scrollTo(c.getParam("fullscreen_scrollx"),c.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(c.getParam("fullscreen_new_window")){h=a.win.open(d+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{h.resizeTo(screen.availWidth,screen.availHeight)}catch(g){}}else{tinyMCE.oldSettings=tinyMCE.settings;f.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";f.fullscreen_html_overflow=a.getStyle(i,"overflow",1);b=a.getViewPort();f.fullscreen_scrollx=b.x;f.fullscreen_scrolly=b.y;if(tinymce.isOpera&&f.fullscreen_overflow=="visible"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&f.fullscreen_overflow=="scroll"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&(f.fullscreen_html_overflow=="visible"||f.fullscreen_html_overflow=="scroll")){f.fullscreen_html_overflow="auto"}if(f.fullscreen_overflow=="0px"){f.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");i.style.overflow="hidden";b=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){b.h-=1}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+(tinymce.isIE6||(tinymce.isIE&&!a.boxModel)?"absolute":"fixed")+";top:0;left:0;width:"+b.w+"px;height:"+b.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(c.settings,function(j,k){f[k]=j});f.id="mce_fullscreen";f.width=n.clientWidth;f.height=n.clientHeight-15;f.fullscreen_is_enabled=true;f.fullscreen_editor_id=c.id;f.theme_advanced_resizing=false;f.save_onsavecallback=function(){c.setContent(tinyMCE.get(f.id).getContent({format:"raw"}),{format:"raw"});c.execCommand("mceSave")};tinymce.each(c.getParam("fullscreen_settings"),function(l,j){f[j]=l});if(f.theme_advanced_toolbar_location==="external"){f.theme_advanced_toolbar_location="top"}e.fullscreenEditor=new tinymce.Editor("mce_fullscreen",f);e.fullscreenEditor.onInit.add(function(){e.fullscreenEditor.setContent(c.getContent());e.fullscreenEditor.focus()});e.fullscreenEditor.render();tinyMCE.add(e.fullscreenEditor);e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var j=tinymce.DOM.getViewPort();e.fullscreenEditor.theme.resizeTo(j.w,j.h)})}});c.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});c.onNodeChange.add(function(h,g){g.setActive("fullscreen",h.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
\ No newline at end of file
index 430f798c21ff6c30d1e99ff4c32385c5915db52e..26ecafb6959e209607bddd28072a212f6f8af2c0 100644 (file)
@@ -3,7 +3,7 @@
 <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-       <script type="text/javascript" src="../../tiny_mce.js?ver=3211"></script>
+       <script type="text/javascript" src="../../tiny_mce.js?ver=3241-1141"></script>
        <script type="text/javascript">
                function patchCallback(settings, key) {
                        if (settings[key])
        <script type="text/javascript">
                function patchCallback(settings, key) {
                        if (settings[key])
@@ -96,7 +96,6 @@
                // Add onunload
                tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
        </script>
                // Add onunload
                tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
        </script>
-       <base target="_self" />
 </head>
 <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
 <form onsubmit="doParentSubmit();">
 </head>
 <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
 <form onsubmit="doParentSubmit();">
index 5560b6b1894f2c466558cc9ca5921c9eed892642..4affad454e658368e29991d6c4157dda7d0b9115 100644 (file)
@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;t.windows={};},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','<br />'));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&&t.editor.getParam('dialog_type','modal')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!DOM.boxModel))DOM.setStyles('mceModalBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w;if(w=t.windows[id]){w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;}},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;i<ne.length;i++)t._addAll(te,ne[i]);}},_startDrag:function(id,se,ac){var t=this,mu,mm,d=DOM.doc,eb,w=t.windows[id],we=w.element,sp=we.getXY(),p,sz,ph,cp,vp,sx,sy,sex,sey,dx,dy,dw,dh;cp={x:0,y:0};vp=DOM.getViewPort();vp.w-=2;vp.h-=2;sex=se.screenX;sey=se.screenY;dx=dy=dw=dh=0;mu=Event.add(d,'mouseup',function(e){Event.remove(d,'mouseup',mu);Event.remove(d,'mousemove',mm);if(eb)eb.remove();we.moveBy(dx,dy);we.resizeBy(dw,dh);sz=we.getSize();DOM.setStyles(id+'_ifr',{width:sz.w-w.deltaWidth,height:sz.h-w.deltaHeight});t._fixIELayout(id,1);return Event.cancel(e);});if(ac!='Move')startMove();function startMove(){if(eb)return;t._fixIELayout(id,0);DOM.add(d.body,'div',{id:'mceEventBlocker','class':'mceEventBlocker '+(t.editor.settings.inlinepopups_skin||'clearlooks2'),style:{zIndex:t.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel))DOM.setStyles('mceEventBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});eb=new Element('mceEventBlocker');eb.update();p=we.getXY();sz=we.getSize();sx=cp.x+p.x-vp.x;sy=cp.y+p.y-vp.y;DOM.add(eb.get(),'div',{id:'mcePlaceHolder','class':'mcePlaceHolder',style:{left:sx,top:sy,width:sz.w,height:sz.h}});ph=new Element('mcePlaceHolder');};mm=Event.add(d,'mousemove',function(e){var x,y,v;startMove();x=e.screenX-sex;y=e.screenY-sey;switch(ac){case'ResizeW':dx=x;dw=0-x;break;case'ResizeE':dw=x;break;case'ResizeN':case'ResizeNW':case'ResizeNE':if(ac=="ResizeNW"){dx=x;dw=0-x;}else if(ac=="ResizeNE")dw=x;dy=y;dh=0-y;break;case'ResizeS':case'ResizeSW':case'ResizeSE':if(ac=="ResizeSW"){dx=x;dw=0-x;}else if(ac=="ResizeSE")dw=x;dh=y;break;case'mceMove':dx=x;dy=y;break;}if(dw<(v=w.features.min_width-sz.w)){if(dx!==0)dx+=dw-v;dw=v;}if(dh<(v=w.features.min_height-sz.h)){if(dy!==0)dy+=dh-v;dh=v;}dw=Math.min(dw,w.features.max_width-sz.w);dh=Math.min(dh,w.features.max_height-sz.h);dx=Math.max(dx,vp.x-(sx+vp.x));dy=Math.max(dy,vp.y-(sy+vp.y));dx=Math.min(dx,(vp.w+vp.x)-(sx+sz.w+vp.x));dy=Math.min(dy,(vp.h+vp.y)-(sy+sz.h+vp.y));if(dx+dy!==0){if(sx+dx<0)dx=0;if(sy+dy<0)dy=0;ph.moveTo(sx+dx,sy+dy);}if(dw+dh!==0)ph.resizeTo(sz.w+dw,sz.h+dh);return Event.cancel(e);});return Event.cancel(se);},resizeBy:function(dw,dh,id){var w=this.windows[id];if(w){w.element.resizeBy(dw,dh);w.iframeElement.resizeBy(dw,dh);}},close:function(win,id){var t=this,w,d=DOM.doc,ix=0,fw,id;id=t._findId(id||win);if(!t.windows[id]){t.parent(win);return;}t.count--;if(t.count==0)DOM.remove('mceModalBlocker');if(w=t.windows[id]){t.onClose.dispatch(t);Event.remove(d,'mousedown',w.mousedownFunc);Event.remove(d,'click',w.clickFunc);Event.clear(id);Event.clear(id+'_ifr');DOM.setAttrib(id+'_ifr','src','javascript:""');w.element.remove();delete t.windows[id];each(t.windows,function(w){if(w.zIndex>ix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(w,ti){var e;w=this._findId(w);if(e=DOM.get(w+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_findId:function(w){var t=this;if(typeof(w)=='string')return w;each(t.windows,function(wo){var ifr=DOM.get(wo.id+'_ifr');if(ifr&&w==ifr.contentWindow){w=wo.id;return false;}});return w;},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})();
\ No newline at end of file
+(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark("simple")}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
\ No newline at end of file
index 113d7e426aa8a4c1b3f9a621a1fdf7d735e91150..cfee3cf073cf5d72c2712885a53f856ad702943d 100644 (file)
@@ -3,12 +3,11 @@
 .clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;}
 
 /* General */
 .clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;}
 
 /* General */
-.clearlooks2 div, .clearlooks2 span, .clearlooks2 a {position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block;}
-.clearlooks2 {position:absolute;}
+.clearlooks2 {position:absolute; direction:ltr}
 .clearlooks2 .mceWrapper {position:static}
 .clearlooks2 .mceWrapper {position:static}
-.mceEventBlocker {position:absolute; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%;}
-.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; filter:alpha(opacity=50);}
-.clearlooks2_modalBlocker {position:absolute; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; filter:alpha(opacity=60); display:none}
+.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%}
+.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)}
+.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none}
 
 /* Top */
 .clearlooks2 .mceTop, 
 
 /* Top */
 .clearlooks2 .mceTop, 
index 4bd3a1bbe7009248e599bd3dac9ae86ecceaead1..f7bff5dd39f4580282580c57e36bcf7d191d8222 100644 (file)
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>Template for dialogs</title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>Template for dialogs</title>
-<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?ver=3211" />
+<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?ver=3241-1141" />
 </head>
 <body>
 
 </head>
 <body>
 
index b226b00d3e72e7d28c5202f5d03a848626865625..951d1e43ad23534230e458a5b0c6a1fd44eaddb8 100644 (file)
@@ -1 +1 @@
-(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.onPreInit.add(function(){ed.serializer.addRules('param[name|value|_mce_value]');});ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};ed.selection.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.selection.onBeforeSetContent.add(t._objectsToSpans,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(t._objectsToSpans,t);ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_mce_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<img[^>]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='<script type="text/javascript">write'+cl.substring(7)+'({'+t._serialize(at)+'});</script>';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_objectsToSpans:function(ed,o){var t=this,h=o.content;h=h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return'<img class="mceItem'+b+'" title="'+ed.dom.encode(c)+'" src="'+t.url+'/img/trans.gif" width="'+o.width+'" height="'+o.height+'" />'});h=h.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');h=h.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');h=h.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');h=h.replace(/<\/(object)([^>]*)>/gi,'</span>');h=h.replace(/<\/embed>/gi,'');h=h.replace(/<param([^>]*)>/gi,function(a,b){return'<span '+b.replace(/value=/gi,'_mce_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title),stc;stc=ed.getParam('media_strict',true)&&o.type=='application/x-shockwave-flash';p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;if(p.src)p.src=ed.convertURL(p.src,'src',n);if(stc){ob=dom.create('span',{mce_name:'object',type:'application/x-shockwave-flash',data:p.src,width:o.width,height:o.height});}else{ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});}each(p,function(v,k){if(!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';if(v)dom.add(ob,'span',{mce_name:'param',name:k,'_mce_value':v});}});if(!stc)dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='',args;args=['id','name','width','height','bgcolor','align','flashvars','src','wmode','allowfullscreen','quality'];im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(args,function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_mce_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}n=dom.select('.mceItemEmbed',n)[0];if(n){each(args,function(na){var v=dom.getAttrib(n,na);if(v&&!pa[na])pa[na]=v;});}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();
\ No newline at end of file
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
index 27439fe52c48897c9c1906893c216702ffd90f8f..cde592ee211f1d1cd4036f1dcbbb47d62c0e177c 100644 (file)
@@ -218,7 +218,7 @@ function insertMedia() {
                                break;
                }
 
                                break;
                }
 
-               if (fe.width != f.width.value || fe.height != f.height.height)
+               if (fe.width != f.width.value || fe.height != f.height.value)
                        ed.execCommand('mceRepaint');
 
                fe.title = serializeParameters();
                        ed.execCommand('mceRepaint');
 
                fe.title = serializeParameters();
@@ -469,7 +469,7 @@ function setBool(pl, p, n) {
        if (typeof(pl[n]) == "undefined")
                return;
 
        if (typeof(pl[n]) == "undefined")
                return;
 
-       document.forms[0].elements[p + "_" + n].checked = pl[n];
+       document.forms[0].elements[p + "_" + n].checked = pl[n] != 'false';
 }
 
 function setStr(pl, p, n) {
 }
 
 function setStr(pl, p, n) {
@@ -490,7 +490,7 @@ function getBool(p, n, d, tv, fv) {
        tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
        fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
 
        tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
        fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
 
-       return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ',');
+       return (v == d) ? '' : n + (v ? ':' + tv + ',' : ":\'" + fv + "\',");
 }
 
 function getStr(p, n, d) {
 }
 
 function getStr(p, n, d) {
index a6a3344d0b886c415d9b65d87828e61524b00be9..18f1887c960decfe4ad767e59543c5d913b169fd 100644 (file)
@@ -2,14 +2,13 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#media_dlg.title}</title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#media_dlg.title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="js/media.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/validate.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/editable_selects.js?ver=3211"></script>
-       <link href="css/media.css?ver=3211" rel="stylesheet" type="text/css" />
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/media.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/validate.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/form_utils.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/editable_selects.js?ver=3241-1141"></script>
+       <link href="css/media.css?ver=3241-1141" rel="stylesheet" type="text/css" />
 </head>
 <body style="display: none">
     <form onsubmit="insertMedia();return false;" action="#">
 </head>
 <body style="display: none">
     <form onsubmit="insertMedia();return false;" action="#">
@@ -52,7 +51,7 @@
                                                        </tr>
                                                        <tr id="linklistrow">
                                                                <td><label for="linklist">{#media_dlg.list}</label></td>
                                                        </tr>
                                                        <tr id="linklistrow">
                                                                <td><label for="linklist">{#media_dlg.list}</label></td>
-                                                               <td id="linklistcontainer">&nbsp;</td>
+                                                               <td id="linklistcontainer"><select id="linklist"><option value=""></option></select></td>
                                                        </tr>
                                                        <tr>
                                                                <td><label for="width">{#media_dlg.size}</label></td>
                                                        </tr>
                                                        <tr>
                                                                <td><label for="width">{#media_dlg.size}</label></td>
                                                        <td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td>
                                                        <td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td>
 
                                                        <td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td>
                                                        <td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td>
 
-                                                       <td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
-                                                       <td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
+
                                                </tr>
 
                                                <tr>
                                                </tr>
 
                                                <tr>
index b99dd17d497788e7d10425ae7d7f157aaa112a0a..4382a11ca43c7a7fc581b061672df11f977de5a2 100644 (file)
@@ -2,8 +2,7 @@
 <head>
 <title>blank_page</title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <head>
 <title>blank_page</title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link href="css/blank.css?ver=3211" rel="stylesheet" type="text/css" />
-<base target="_self" />
+<link href="css/blank.css?ver=3223_1087" rel="stylesheet" type="text/css" />
 <script type="text/javascript">
 function init() {
        if (parent.tinymce.isIE)
 <script type="text/javascript">
 function init() {
        if (parent.tinymce.isIE)
diff --git a/wp-includes/js/tinymce/plugins/paste/css/blank.css b/wp-includes/js/tinymce/plugins/paste/css/blank.css
deleted file mode 100644 (file)
index f1ab113..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-html, body {height:98%}
-body {
-background-color: #FFFFFF;
-font-family: Verdana, Arial, Helvetica, sans-serif;
-font-size: 10px;
-scrollbar-3dlight-color: #F0F0EE;
-scrollbar-arrow-color: #676662;
-scrollbar-base-color: #F0F0EE;
-scrollbar-darkshadow-color: #DDDDDD;
-scrollbar-face-color: #E0E0DD;
-scrollbar-highlight-color: #F0F0EE;
-scrollbar-shadow-color: #F0F0EE;
-scrollbar-track-color: #F5F5F5;
-}
diff --git a/wp-includes/js/tinymce/plugins/paste/css/pasteword.css b/wp-includes/js/tinymce/plugins/paste/css/pasteword.css
deleted file mode 100644 (file)
index 77685fd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-.sourceIframe {
-       border: 1px solid #808080;
-}
index eeeebd5bb7b4222835d63dec9a43e00ce6407831..e0e51b5b17bd62d200b7d259da564a5e837147e9 100644 (file)
@@ -1 +1 @@
-(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(!this.editor.selection.isCollapsed())this.editor.execCommand("Delete");if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'</p><p>');content=content.replace(/\r\r/g,'</p><p>');content=content.replace(/\n\n/g,'</p><p>');if((pos=content.indexOf('</p><p>'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'<br />');content=content.replace(/\r/g,'<br />');content=content.replace(/\n/g,'<br />');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(/<!--([\s\S]*?)-->|<style>[\s\S]*?<\/style>/g,"");content=content.replace(/<(meta|link)[^>]+>/g,"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi,'<p>&nbsp;&nbsp;</p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b>&nbsp;<\/b>/gi,'<b>&nbsp;&nbsp;</b>');content=content.replace(/^(&nbsp;)*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var ed=this.editor,mdot=String.fromCharCode(183),bull=String.fromCharCode(8226);var nodes,prevul,i,p,ul,li,np,cp,li;nodes=div.getElementsByTagName("p");for(i=0;i<nodes.length;i++){p=nodes[i];if(p.innerHTML.indexOf(search)==0){ul=ed.dom.create("ul");if(class_name)ul.className=class_name;li=ed.dom.create("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');ul.appendChild(li);np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)){if(!prevul){prevul=ul;ul=ed.dom.create("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}cp=np.nextSibling;li=ed.dom.create("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})();
\ No newline at end of file
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var k=c.dom,j={content:i};e.onPreProcess.dispatch(e,j);j.node=k.create("div",0,j.content);e.onPostProcess.dispatch(e,j);j.content=c.serializer.serialize(j.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(j.content)){e._insertBlockContent(c,k,j.content)}else{e._insert(j.content)}}c.addCommand("mceInsertClipboardContent",function(i,h){g(h)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"&nbsp;");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);g(p.innerHTML);return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var r=o.get("_mcePaste"),q;r.id="_mceRemoved";o.remove(r);r=o.get("_mcePaste")||r;q=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML;o.remove(r);if(k){j.setRng(k)}g(q)},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(d,g){var b=this.editor,c=g.content,f,e;function f(h){a(h,function(i){if(i.constructor==RegExp){c=c.replace(i,"")}else{c=c.replace(i[0],i[1])}})}f([/^\s*(&nbsp;)+/g,/(&nbsp;|<br[^>]*>)+\s*$/g]);if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)){g.wordContent=true;if(b.getParam("paste_convert_middot_lists",true)){f([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<span[^>]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}f([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/&nbsp;/g,"\u00a0"]]);if(!b.getParam("paste_retain_style_properties")){f([/<\/?(span)[^>]*>/gi])}}e=b.getParam("paste_strip_class_attributes","all");if(e!="none"){if(e=="all"){f([/ class=\"([^\"]*)\"/gi,/ class=(\w+)/gi])}else{f([/ class=\"(mso[^\"]*)\"/gi,/ class=(mso\w+)/gi])}}if(b.getParam("paste_remove_spans")){f([/<\/?(span)[^>]*>/gi])}g.content=c},_postProcess:function(e,g){var d=this,c=d.editor,f=c.dom,b;if(g.wordContent){a(f.select("a",g.node),function(h){if(!h.href||h.href.indexOf("#_Toc")!=-1){f.remove(h,1)}});if(d.editor.getParam("paste_convert_middot_lists",true)){d._convertLists(e,g)}b=c.getParam("paste_retain_style_properties");if(tinymce.is(b,"string")){b=tinymce.explode(b)}a(f.select("*",g.node),function(l){var m={},j=0,k,n,h;if(b){for(k=0;k<b.length;k++){n=b[k];h=f.getStyle(l,n);if(h){m[n]=h;j++}}}f.setAttrib(l,"style","");if(b&&j>0){f.setStyles(l,m)}else{if(l.nodeName=="SPAN"&&!l.className){f.remove(l,true)}}})}if(c.getParam("paste_remove_styles")||(c.getParam("paste_remove_styles_if_webkit")&&tinymce.isWebKit)){a(f.select("*[style]",g.node),function(h){h.removeAttribute("style");h.removeAttribute("mce_style")})}else{if(tinymce.isWebKit){a(f.select("*",g.node),function(h){h.removeAttribute("mce_style")})}}},_convertLists:function(e,c){var g=e.editor.dom,f,j,b=-1,d,k=[],i,h;a(g.select("p",c.node),function(r){var n,s="",q,o,l,m;for(n=r.firstChild;n&&n.nodeType==3;n=n.nextSibling){s+=n.nodeValue}s=r.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(s)){q="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(s)){q="ol"}if(q){d=parseFloat(r.style.marginLeft||0);if(d>b){k.push(d)}if(!f||q!=i){f=g.create(q);g.insertAfter(f,r)}else{if(d>b){f=j.appendChild(g.create(q))}else{if(d<b){l=tinymce.inArray(k,d);m=g.getParents(f.parentNode,q);f=m[m.length-1-l]||f}}}a(g.select("span",r),function(t){var p=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(q=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){g.remove(t)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){g.remove(t)}}});o=r.innerHTML;if(q=="ul"){o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}j=f.appendChild(g.create("li",0,o));g.remove(r);b=d;i=q}else{f=b=0}});h=c.node.innerHTML;if(h.indexOf("__MCE_ITEM__")!=-1){c.node.innerHTML=h.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker">&nbsp;</span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol");if(c){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.getDoc().execCommand("Delete",false,null)}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:parseInt(b.getParam("paste_dialog_width","450")),height:parseInt(b.getParam("paste_dialog_height","400")),inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No newline at end of file
index 28073877e166f3030862247666dbef5cf8bee6d5..ebaabddaa9ed59177a991909a7e163d156ecaf4e 100644 (file)
@@ -1,42 +1,36 @@
 tinyMCEPopup.requireLangPack();
 
 tinyMCEPopup.requireLangPack();
 
-function saveContent() {
-       if (document.forms[0].htmlSource.value == '') {
+var PasteTextDialog = {
+       init : function() {
+               this.resize();
+       },
+
+       insert : function() {
+               var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
+
+               // Convert linebreaks into paragraphs
+               if (document.getElementById('linebreaks').checked) {
+                       lines = h.split(/\r?\n/);
+                       if (lines.length > 1) {
+                               h = '';
+                               tinymce.each(lines, function(row) {
+                                       h += '<p>' + row + '</p>';
+                               });
+                       }
+               }
+
+               tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h);
                tinyMCEPopup.close();
                tinyMCEPopup.close();
-               return false;
-       }
-
-       tinyMCEPopup.execCommand('mcePasteText', false, {
-               html : document.forms[0].htmlSource.value,
-               linebreaks : document.forms[0].linebreaks.checked
-       });
-
-       tinyMCEPopup.close();
-}
+       },
 
 
-function onLoadInit() {
-       tinyMCEPopup.resizeToInnerSize();
+       resize : function() {
+               var vp = tinyMCEPopup.dom.getViewPort(window), el;
 
 
-       // Remove Gecko spellchecking
-       if (tinymce.isGecko)
-               document.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
+               el = document.getElementById('content');
 
 
-       resizeInputs();
-}
-
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
-
-function resizeInputs() {
-       if (!tinymce.isIE) {
-               wHeight = self.innerHeight-80;
-               wWidth = self.innerWidth-17;
-       } else {
-               wHeight = document.body.clientHeight-80;
-               wWidth = document.body.clientWidth-17;
+               el.style.width  = (vp.w - 20) + 'px';
+               el.style.height = (vp.h - 90) + 'px';
        }
        }
+};
 
 
-       document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
-       document.forms[0].htmlSource.style.width  = Math.abs(wWidth) + 'px';
-}
-
-tinyMCEPopup.onInit.add(onLoadInit);
\ No newline at end of file
+tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);
index ea9c29c2b08a676a65e0876904c05fa32a25934d..fb3e54da2ac130ff6696b434d1d01e79d7973696 100644 (file)
@@ -1,56 +1,51 @@
 tinyMCEPopup.requireLangPack();
 
 tinyMCEPopup.requireLangPack();
 
-function saveContent() {
-       var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
-
-       if (html == ''){
+var PasteWordDialog = {
+       init : function() {
+               var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
+
+               // Create iframe
+               el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
+               ifr = document.getElementById('iframe');
+               doc = ifr.contentWindow.document;
+
+               // Force absolute CSS urls
+               css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
+               css = css.concat(tinymce.explode(ed.settings.content_css) || []);
+               tinymce.each(css, function(u) {
+                       cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />';
+               });
+
+               // Write content into iframe
+               doc.open();
+               doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
+               doc.close();
+
+               doc.designMode = 'on';
+               this.resize();
+
+               window.setTimeout(function() {
+                       ifr.contentWindow.focus();
+               }, 10);
+       },
+
+       insert : function() {
+               var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
+
+               tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, h);
                tinyMCEPopup.close();
                tinyMCEPopup.close();
-               return false;
-       }
-
-       tinyMCEPopup.execCommand('mcePasteWord', false, html);
-       tinyMCEPopup.close();
-}
-
-function onLoadInit() {
-       tinyMCEPopup.resizeToInnerSize();
-
-       // Fix for endless reloading in FF
-       window.setTimeout(createIFrame, 10);
-}
-
-function createIFrame() {
-       document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
-}
+       },
 
 
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+       resize : function() {
+               var vp = tinyMCEPopup.dom.getViewPort(window), el;
 
 
-function initIframe(doc) {
-       var dir = tinyMCEPopup.editor.settings.directionality;
-
-       doc.body.dir = dir;
-
-       // Remove Gecko spellchecking
-       if (tinymce.isGecko)
-               doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
-
-       resizeInputs();
-}
-
-function resizeInputs() {
-       if (!tinymce.isIE) {
-               wHeight = self.innerHeight - 80;
-               wWidth = self.innerWidth - 18;
-       } else {
-               wHeight = document.body.clientHeight - 80;
-               wWidth = document.body.clientWidth - 18;
-       }
+               el = document.getElementById('iframe');
 
 
-       var elm = document.getElementById('frmData');
-       if (elm) {
-               elm.style.height = Math.abs(wHeight) + 'px';
-               elm.style.width  = Math.abs(wWidth) + 'px';
+               if (el) {
+                       el.style.width  = (vp.w - 20) + 'px';
+                       el.style.height = (vp.h - 90) + 'px';
+               }
        }
        }
-}
+};
 
 
-tinyMCEPopup.onInit.add(onLoadInit);
+tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);
index 19cdbf4bd6ddec1612ebda2b4d05aab65cf94296..bedde9adc3ee1737c26fcca689d9a5d3a30a08f0 100644 (file)
@@ -2,33 +2,32 @@
 <head>
        <title>{#paste.paste_text_desc}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <head>
        <title>{#paste.paste_text_desc}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="js/pastetext.js?ver=3211"></script>
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/pastetext.js?ver=3241-1141"></script>
 </head>
 </head>
-<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
-<form name="source" onsubmit="saveContent();return false;" action="#">
-       <div style="float: left" class="title">{#paste.paste_text_desc}</div>
+<body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;">
+       <form name="source" onsubmit="return PasteTextDialog.insert();" action="#">
+               <div style="float: left" class="title">{#paste.paste_text_desc}</div>
 
 
-       <div style="float: right">
-               <input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
-       </div>
+               <div style="float: right">
+                       <input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
+               </div>
 
 
-       <br style="clear: both" />
+               <br style="clear: both" />
 
 
-       <div>{#paste_dlg.text_title}</div>
+               <div>{#paste_dlg.text_title}</div>
 
 
-       <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
+               <textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
 
 
-       <div class="mceActionPanel">
-               <div style="float: left">
-                       <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
-               </div>
+               <div class="mceActionPanel">
+                       <div style="float: left">
+                               <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
+                       </div>
 
 
-               <div style="float: right">
-                       <input type="submit" name="insert" value="{#insert}" id="insert" />
+                       <div style="float: right">
+                               <input type="submit" name="insert" value="{#insert}" id="insert" />
+                       </div>
                </div>
                </div>
-       </div>
-</form>
+       </form>
 </body> 
 </html>
 </body> 
 </html>
index 8c74b399409cb28d4ef9e1b930f21efa77c80377..de6b5e4f701dd1a936feeb013fb26856016fe504 100644 (file)
@@ -2,13 +2,11 @@
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>{#paste.paste_word_desc}</title>
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>{#paste.paste_word_desc}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="js/pasteword.js?ver=3211"></script>
-       <link href="css/pasteword.css?ver=3211" rel="stylesheet" type="text/css" />
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/pasteword.js?ver=3241-1141"></script>
 </head>
 </head>
-<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
-       <form name="source" onsubmit="saveContent();" action="#">
+<body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;">
+       <form name="source" onsubmit="return PasteWordDialog.insert();" action="#">
                <div class="title">{#paste.paste_word_desc}</div>
 
                <div>{#paste_dlg.word_title}</div>
                <div class="title">{#paste.paste_word_desc}</div>
 
                <div>{#paste_dlg.word_title}</div>
@@ -21,7 +19,7 @@
                        </div>
 
                        <div style="float: right">
                        </div>
 
                        <div style="float: right">
-                               <input type="button" id="insert" name="insert" value="{#insert}" onclick="saveContent();" />
+                               <input type="submit" id="insert" name="insert" value="{#insert}" />
                        </div>
                </div>
        </form>
                        </div>
                </div>
        </form>
index 4daac19ffac59a466fea3c141bad8e882ca225ca..794477c95b614a3264284a491b4069ec8bfb615e 100644 (file)
@@ -1 +1 @@
-(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;function isEmpty(d,e,f){var w,n;w=d.createTreeWalker(e,NodeFilter.SHOW_ALL,null,false);while(n=w.nextNode()){if(f){if(!f(n))return false;}if(n.nodeType==3&&n.nodeValue&&/[^\s\u00a0]+/.test(n.nodeValue))return false;if(n.nodeType==1&&/^(HR|IMG|TABLE)$/.test(n.nodeName))return false;}return true;};tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.addCommand('CreateLink',function(u,v){var n=ed.selection.getNode(),dom=ed.dom,a;if(n&&(/^(left|right)$/i.test(dom.getStyle(n,'float',1))||/^(left|right)$/i.test(dom.getAttrib(n,'align')))){a=dom.create('a',{href:v},n.cloneNode());n.parentNode.replaceChild(a,n);ed.selection.select(a);}else ed.getDoc().execCommand("CreateLink",false,v);});ed.onPaste.add(function(ed,e){function removeStyles(e){e=e.target;if(e.nodeType==1){e.style.cssText='';each(ed.dom.select('*',e),function(e){e.style.cssText='';});}};Event.add(ed.getDoc(),'DOMNodeInserted',removeStyles);window.setTimeout(function(){Event.remove(ed.getDoc(),'DOMNodeInserted',removeStyles);},0);});ed.onKeyUp.add(function(ed,e){var h,b,r,n,s;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;s=ed.selection;if(b.childNodes.length==1&&!/<(img|hr)/.test(h)&&tinymce.trim(h.replace(/<[^>]+>/g,'')).length==0){ed.setContent('<p><br mce_bogus="1" /></p>',{format:'raw'});n=b.firstChild;r=s.getRng();r.setStart(n,0);r.setEnd(n,0);s.setRng(r);}}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,ed.dom.processHTML(v)+'<span id="_mce_tmp">XX</span>');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){var se,li,lic,r1,r2,n,sel,doc,be,af,pa;if(e.keyCode==13){sel=ed.selection;se=sel.getNode();if(e.shiftKey||ed.settings.force_br_newlines&&se.nodeName!='LI'){t._insertBR(ed);Event.cancel(e);}if(li=dom.getParent(se,'LI')){lic=dom.getParent(li,'OL,UL');doc=ed.getDoc();pa=dom.create('p');dom.add(pa,'br',{mce_bogus:"1"});if(isEmpty(doc,li)){if(n=dom.getParent(lic.parentNode,'LI,OL,UL'))return;n=dom.getParent(lic,'p,h1,h2,h3,h4,h5,h6,div')||lic;r1=doc.createRange();r1.setStartBefore(n);r1.setEndBefore(li);r2=doc.createRange();r2.setStartAfter(li);r2.setEndAfter(n);be=r1.cloneContents();af=r2.cloneContents();if(!isEmpty(doc,af))dom.insertAfter(af,n);dom.insertAfter(pa,n);if(!isEmpty(doc,be))dom.insertAfter(be,n);dom.remove(n);n=pa.firstChild;r1=doc.createRange();r1.setStartBefore(n);r1.setEndBefore(n);sel.setRng(r1);return Event.cancel(e);}}}});ed.onExecCommand.add(function(ed,cmd){var sel,dom,bl,bm;if(cmd=='InsertUnorderedList'||cmd=='InsertOrderedList'){sel=ed.selection;dom=ed.dom;if(bl=dom.getParent(sel.getNode(),function(n){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName);})){bm=sel.getBookmark();dom.remove(bl,1);sel.moveToBookmark(bm);}}});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onInit.add(function(){t._fixWebKitSpans();if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,'</$1>');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},getInfo:function(){return{longname:'Safari compatibility',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})();
\ No newline at end of file
+(function(){var a=tinymce.dom.Event,c=tinymce.grep,d=tinymce.each,b=tinymce.inArray;function e(j,i,h){var g,k;g=j.createTreeWalker(i,NodeFilter.SHOW_ALL,null,false);while(k=g.nextNode()){if(h){if(!h(k)){return false}}if(k.nodeType==3&&k.nodeValue&&/[^\s\u00a0]+/.test(k.nodeValue)){return false}if(k.nodeType==1&&/^(HR|IMG|TABLE)$/.test(k.nodeName)){return false}}return true}tinymce.create("tinymce.plugins.Safari",{init:function(f){var g=this,h;if(!tinymce.isWebKit){return}g.editor=f;g.webKitFontSizes=["x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large"];g.namedFontSizes=["xx-small","x-small","small","medium","large","x-large","xx-large"];f.addCommand("CreateLink",function(k,j){var m=f.selection.getNode(),l=f.dom,i;if(m&&(/^(left|right)$/i.test(l.getStyle(m,"float",1))||/^(left|right)$/i.test(l.getAttrib(m,"align")))){i=l.create("a",{href:j},m.cloneNode());m.parentNode.replaceChild(i,m);f.selection.select(i)}else{f.getDoc().execCommand("CreateLink",false,j)}});f.onKeyUp.add(function(j,o){var l,i,m,p,k;if(o.keyCode==46||o.keyCode==8){i=j.getBody();l=i.innerHTML;k=j.selection;if(i.childNodes.length==1&&!/<(img|hr)/.test(l)&&tinymce.trim(l.replace(/<[^>]+>/g,"")).length==0){j.setContent('<p><br mce_bogus="1" /></p>',{format:"raw"});p=i.firstChild;m=k.getRng();m.setStart(p,0);m.setEnd(p,0);k.setRng(m)}}});f.addCommand("FormatBlock",function(j,i){var l=f.dom,k=l.getParent(f.selection.getNode(),l.isBlock);if(k){l.replace(l.create(i),k,1)}else{f.getDoc().execCommand("FormatBlock",false,i)}});f.addCommand("mceInsertContent",function(j,i){f.getDoc().execCommand("InsertText",false,"mce_marker");f.getBody().innerHTML=f.getBody().innerHTML.replace(/mce_marker/g,f.dom.processHTML(i)+'<span id="_mce_tmp">XX</span>');f.selection.select(f.dom.get("_mce_tmp"));f.getDoc().execCommand("Delete",false," ")});f.onKeyPress.add(function(o,p){var q,v,r,l,j,k,i,u,m,t,s;if(p.keyCode==13){i=o.selection;q=i.getNode();if(p.shiftKey||o.settings.force_br_newlines&&q.nodeName!="LI"){g._insertBR(o);a.cancel(p)}if(v=h.getParent(q,"LI")){r=h.getParent(v,"OL,UL");u=o.getDoc();s=h.create("p");h.add(s,"br",{mce_bogus:"1"});if(e(u,v)){if(k=h.getParent(r.parentNode,"LI,OL,UL")){return}k=h.getParent(r,"p,h1,h2,h3,h4,h5,h6,div")||r;l=u.createRange();l.setStartBefore(k);l.setEndBefore(v);j=u.createRange();j.setStartAfter(v);j.setEndAfter(k);m=l.cloneContents();t=j.cloneContents();if(!e(u,t)){h.insertAfter(t,k)}h.insertAfter(s,k);if(!e(u,m)){h.insertAfter(m,k)}h.remove(k);k=s.firstChild;l=u.createRange();l.setStartBefore(k);l.setEndBefore(k);i.setRng(l);return a.cancel(p)}}}});f.onExecCommand.add(function(i,k){var j,m,n,l;if(k=="InsertUnorderedList"||k=="InsertOrderedList"){j=i.selection;m=i.dom;if(n=m.getParent(j.getNode(),function(o){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)})){l=j.getBookmark();m.remove(n,1);j.moveToBookmark(l)}}});f.onClick.add(function(i,j){j=j.target;if(j.nodeName=="IMG"){g.selElm=j;i.selection.select(j)}else{g.selElm=null}});f.onInit.add(function(){g._fixWebKitSpans()});f.onSetContent.add(function(){h=f.dom;d(["strong","b","em","u","strike","sub","sup","a"],function(i){d(c(h.select(i)).reverse(),function(l){var k=l.nodeName.toLowerCase(),j;if(k=="a"){if(l.name){h.replace(h.create("img",{mce_name:"a",name:l.name,"class":"mceItemAnchor"}),l)}return}switch(k){case"b":case"strong":if(k=="b"){k="strong"}j="font-weight: bold;";break;case"em":j="font-style: italic;";break;case"u":j="text-decoration: underline;";break;case"sub":j="vertical-align: sub;";break;case"sup":j="vertical-align: super;";break;case"strike":j="text-decoration: line-through;";break}h.replace(h.create("span",{mce_name:k,style:j,"class":"Apple-style-span"}),l,1)})})});f.onPreProcess.add(function(i,j){h=i.dom;d(c(j.node.getElementsByTagName("span")).reverse(),function(m){var k,l;if(j.get){if(h.hasClass(m,"Apple-style-span")){l=m.style.backgroundColor;switch(h.getAttrib(m,"mce_name")){case"font":if(!i.settings.convert_fonts_to_spans){h.setAttrib(m,"style","")}break;case"strong":case"em":case"sub":case"sup":h.setAttrib(m,"style","");break;case"strike":case"u":if(!i.settings.inline_styles){h.setAttrib(m,"style","")}else{h.setAttrib(m,"mce_name","")}break;default:if(!i.settings.inline_styles){h.setAttrib(m,"style","")}}if(l){m.style.backgroundColor=l}}}if(h.hasClass(m,"mceItemRemoved")){h.remove(m,1)}})});f.onPostProcess.add(function(i,j){j.content=j.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,"</$1>");j.content=j.content.replace(/ id=\"undefined\"/g,"")})},getInfo:function(){return{longname:"Safari compatibility",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_fixWebKitSpans:function(){var g=this,f=g.editor;a.add(f.getDoc(),"DOMNodeInserted",function(h){h=h.target;if(h&&h.nodeType==1){g._fixAppleSpan(h)}})},_fixAppleSpan:function(l){var g=this.editor,m=g.dom,i=this.webKitFontSizes,f=this.namedFontSizes,j=g.settings,h,k;if(m.getAttrib(l,"mce_fixed")){return}if(l.nodeName=="SPAN"&&l.className=="Apple-style-span"){h=l.style;if(!j.convert_fonts_to_spans){if(h.fontSize){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"size",b(i,h.fontSize)+1)}if(h.fontFamily){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"face",h.fontFamily)}if(h.color){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"color",m.toHex(h.color))}if(h.backgroundColor){m.setAttrib(l,"mce_name","font");m.setStyle(l,"background-color",h.backgroundColor)}}else{if(h.fontSize){m.setStyle(l,"fontSize",f[b(i,h.fontSize)])}}if(h.fontWeight=="bold"){m.setAttrib(l,"mce_name","strong")}if(h.fontStyle=="italic"){m.setAttrib(l,"mce_name","em")}if(h.textDecoration=="underline"){m.setAttrib(l,"mce_name","u")}if(h.textDecoration=="line-through"){m.setAttrib(l,"mce_name","strike")}if(h.verticalAlign=="super"){m.setAttrib(l,"mce_name","sup")}if(h.verticalAlign=="sub"){m.setAttrib(l,"mce_name","sub")}m.setAttrib(l,"mce_fixed","1")}},_insertBR:function(f){var j=f.dom,h=f.selection,i=h.getRng(),g;i.insertNode(g=j.create("br"));i.setStartAfter(g);i.setEndAfter(g);h.setRng(i);if(h.getSel().focusNode==g.previousSibling){h.select(j.insertAfter(j.doc.createTextNode("\u00a0"),g));h.collapse(1)}f.getWin().scrollTo(0,j.getPos(h.getRng().startContainer).y)}});tinymce.PluginManager.add("safari",tinymce.plugins.Safari)})();
\ No newline at end of file
index a76239bbc88b869f31e73d3c31564224df85d99b..054a2da0518dc6e64f6478381f715d1b871a6cf1 100644 (file)
@@ -15,7 +15,7 @@
                                author : 'Moxiecode Systems AB',
                                authorurl : 'http://tinymce.moxiecode.com',
                                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
                                author : 'Moxiecode Systems AB',
                                authorurl : 'http://tinymce.moxiecode.com',
                                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
-                               version : "2.0.2"
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion
                        };
                },
 
                        };
                },
 
 
        // Register plugin
        tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
 
        // Register plugin
        tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
-})();
+})();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js b/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js
new file mode 100644 (file)
index 0000000..7f1fe26
--- /dev/null
@@ -0,0 +1 @@
+(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.EditorManager.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js
new file mode 100644 (file)
index 0000000..0962cff
--- /dev/null
@@ -0,0 +1,297 @@
+/**
+ * WordPress plugin.
+ */
+
+(function() {
+       var DOM = tinymce.DOM;
+
+       tinymce.create('tinymce.plugins.WordPress', {
+               init : function(ed, url) {
+                       var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML;
+                       moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
+                       nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
+
+                       if ( getUserSetting('hidetb', '0') == '1' )
+                               ed.settings.wordpress_adv_hidden = 0;
+
+                       // Hides the specified toolbar and resizes the iframe
+                       ed.onPostRender.add(function() {
+                               if ( ed.getParam('wordpress_adv_hidden', 1) ) {
+                                       DOM.hide(ed.controlManager.get(tbId).id);
+                                       t._resizeIframe(ed, tbId, 28);
+                               }
+                       });
+
+                       // Register commands
+                       ed.addCommand('WP_More', function() {
+                               ed.execCommand('mceInsertContent', 0, moreHTML);
+                       });
+
+                       ed.addCommand('WP_Page', function() {
+                               ed.execCommand('mceInsertContent', 0, nextpageHTML);
+                       });
+
+                       ed.addCommand('WP_Help', function() {
+                                       ed.windowManager.open({
+                                               url : tinymce.baseURL + '/wp-mce-help.php',
+                                               width : 450,
+                                               height : 420,
+                                               inline : 1
+                                       });
+                               });
+
+                       ed.addCommand('WP_Adv', function() {
+                               var id = ed.controlManager.get(tbId).id, cm = ed.controlManager;
+
+                               if (DOM.isHidden(id)) {
+                                       cm.setActive('wp_adv', 1);
+                                       DOM.show(id);
+                                       t._resizeIframe(ed, tbId, -28);
+                                       ed.settings.wordpress_adv_hidden = 0;
+                                       setUserSetting('hidetb', '1');
+                               } else {
+                                       cm.setActive('wp_adv', 0);
+                                       DOM.hide(id);
+                                       t._resizeIframe(ed, tbId, 28);
+                                       ed.settings.wordpress_adv_hidden = 1;
+                                       setUserSetting('hidetb', '0');
+                               }
+                       });
+
+                       // Register buttons
+                       ed.addButton('wp_more', {
+                               title : 'wordpress.wp_more_desc',
+                               image : url + '/img/more.gif',
+                               cmd : 'WP_More'
+                       });
+
+                       ed.addButton('wp_page', {
+                               title : 'wordpress.wp_page_desc',
+                               image : url + '/img/page.gif',
+                               cmd : 'WP_Page'
+                       });
+
+                       ed.addButton('wp_help', {
+                               title : 'wordpress.wp_help_desc',
+                               image : url + '/img/help.gif',
+                               cmd : 'WP_Help'
+                       });
+
+                       ed.addButton('wp_adv', {
+                               title : 'wordpress.wp_adv_desc',
+                               image : url + '/img/toolbars.gif',
+                               cmd : 'WP_Adv'
+                       });
+
+                       // Add Media buttons
+                       ed.addButton('add_media', {
+                               title : 'wordpress.add_media',
+                               image : url + '/img/media.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_media').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                               }
+                       });
+
+                       ed.addButton('add_image', {
+                               title : 'wordpress.add_image',
+                               image : url + '/img/image.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_image').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                               }
+                       });
+
+                       ed.addButton('add_video', {
+                               title : 'wordpress.add_video',
+                               image : url + '/img/video.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_video').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                               }
+                       });
+
+                       ed.addButton('add_audio', {
+                               title : 'wordpress.add_audio',
+                               image : url + '/img/audio.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_audio').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                               }
+                       });
+
+                       // Add Media buttons to fullscreen
+                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
+                               if ( 'mceFullScreen' != cmd ) return;
+                               if ( 'mce_fullscreen' != ed.id )
+                                       ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
+                       });
+
+                       // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
+                       ed.addCommand('JustifyLeft', function() {
+                               var n = ed.selection.getNode();
+
+                               if ( n.nodeName != 'IMG' )
+                                       ed.editorCommands.mceJustify('JustifyLeft', 'left');
+                               else ed.plugins.wordpress.do_align(n, 'alignleft');
+                       });
+
+                       ed.addCommand('JustifyRight', function() {
+                               var n = ed.selection.getNode();
+
+                               if ( n.nodeName != 'IMG' )
+                                       ed.editorCommands.mceJustify('JustifyRight', 'right');
+                               else ed.plugins.wordpress.do_align(n, 'alignright');
+                       });
+
+                       ed.addCommand('JustifyCenter', function() {
+                               var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl');
+
+                               if ( n.nodeName == 'IMG' && ( P || DL ) )
+                                       ed.plugins.wordpress.do_align(n, 'aligncenter');
+                               else ed.editorCommands.mceJustify('JustifyCenter', 'center');
+                       });
+
+                       // Word count if script is loaded
+                       if ( 'undefined' != typeof wpWordCount ) {
+                               ed.onKeyUp.add(function(ed, e) {
+                                       if ( e.keyCode == last ) return;
+                                       if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) );
+                                       last = e.keyCode;
+                               });
+                       };
+
+                       // Add listeners to handle more break
+                       t._handleMoreBreak(ed, url);
+
+                       // Add custom shortcuts
+                       ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
+                       ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight');
+                       ed.addShortcut('alt+shift+l', ed.getLang('justifyleft_desc'), 'JustifyLeft');
+                       ed.addShortcut('alt+shift+j', ed.getLang('justifyfull_desc'), 'JustifyFull');
+                       ed.addShortcut('alt+shift+q', ed.getLang('blockquote_desc'), 'mceBlockQuote');
+                       ed.addShortcut('alt+shift+u', ed.getLang('bullist_desc'), 'InsertUnorderedList');
+                       ed.addShortcut('alt+shift+o', ed.getLang('numlist_desc'), 'InsertOrderedList');
+                       ed.addShortcut('alt+shift+d', ed.getLang('striketrough_desc'), 'Strikethrough');
+                       ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck');
+                       ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink');
+                       ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink');
+                       ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage');
+                       ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen');
+                       ed.addShortcut('alt+shift+z', ed.getLang('wp_adv_desc'), 'WP_Adv');
+                       ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help');
+                       ed.addShortcut('alt+shift+t', ed.getLang('wp_more_desc'), 'WP_More');
+                       ed.addShortcut('alt+shift+p', ed.getLang('wp_page_desc'), 'WP_Page');
+                       ed.addShortcut('ctrl+s', ed.getLang('save_desc'), function(){if('function'==typeof autosave)autosave();});
+
+                       if ( tinymce.isWebKit ) {
+                               ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold');
+                               ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic');
+                       }
+               },
+
+               getInfo : function() {
+                       return {
+                               longname : 'WordPress Plugin',
+                               author : 'WordPress', // add Moxiecode?
+                               authorurl : 'http://wordpress.org',
+                               infourl : 'http://wordpress.org',
+                               version : '3.0'
+                       };
+               },
+
+               // Internal functions
+               do_align : function(n, a) {
+                       var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
+
+                       if ( /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className) )
+                               return;
+
+                       P = ed.dom.getParent(n, 'p');
+                       DL = ed.dom.getParent(n, 'dl');
+                       DIV = ed.dom.getParent(n, 'div');
+
+                       if ( DL && DIV ) {
+                               cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
+                               DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
+                               ed.dom.addClass(DL, cls);
+                               c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter');
+                       } else if ( P ) {
+                               cls = ed.dom.hasClass(n, a) ? 'alignnone' : a;
+                               n.className = n.className.replace(/align[^ '"]+\s?/g, '');
+                               ed.dom.addClass(n, cls);
+                               if ( cls == 'aligncenter' )
+                                       ed.dom.setStyle(P, 'textAlign', 'center');
+                               else if (P.style && P.style.textAlign == 'center')
+                                       ed.dom.setStyle(P, 'textAlign', '');
+                       }
+
+                       ed.execCommand('mceRepaint');
+               },
+
+               // Resizes the iframe by a relative height value
+               _resizeIframe : function(ed, tb_id, dy) {
+                       var ifr = ed.getContentAreaContainer().firstChild;
+
+                       DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe
+                       ed.theme.deltaHeight += dy; // For resize cookie
+               },
+
+               _handleMoreBreak : function(ed, url) {
+                       var moreHTML, nextpageHTML;
+                       
+                       moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
+                       nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
+
+                       // Load plugin specific CSS into editor
+                       ed.onInit.add(function() {
+                               ed.dom.loadCSS(url + '/css/content.css');
+                       });
+
+                       // Display morebreak instead if img in element path
+                       ed.onPostRender.add(function() {
+                               if (ed.theme.onResolveName) {
+                                       ed.theme.onResolveName.add(function(th, o) {
+                                               if (o.node.nodeName == 'IMG') {
+                                                       if ( ed.dom.hasClass(o.node, 'mceWPmore') )
+                                                               o.name = 'wpmore';
+                                                       if ( ed.dom.hasClass(o.node, 'mceWPnextpage') )
+                                                               o.name = 'wppage';
+                                               }
+
+                                       });
+                               }
+                       });
+
+                       // Replace morebreak with images
+                       ed.onBeforeSetContent.add(function(ed, o) {
+                               o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
+                               o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
+                       });
+
+                       // Replace images with morebreak
+                       ed.onPostProcess.add(function(ed, o) {
+                               if (o.get)
+                                       o.content = o.content.replace(/<img[^>]+>/g, function(im) {
+                                               if (im.indexOf('class="mceWPmore') !== -1) {
+                                                       var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
+                                                       im = '<!--more'+moretext+'-->';
+                                               }
+                                               if (im.indexOf('class="mceWPnextpage') !== -1)
+                                                       im = '<!--nextpage-->';
+
+                                               return im;
+                                       });
+                       });
+
+                       // Set active buttons if user selected pagebreak or more break
+                       ed.onNodeChange.add(function(ed, cm, n) {
+                               cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage'));
+                               cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore'));
+                       });
+               }
+       });
+
+       // Register plugin
+       tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);
+})();
index f5ce86158c9259724a31a75edf0f61e86bc7f3ac..28f6c62ca8ddeab020c8f910c8163f29382a8100 100644 (file)
@@ -1,298 +1 @@
-/**
- * WordPress plugin.
- */
-
-(function() {
-       var DOM = tinymce.DOM;
-
-       // Load plugin specific language pack
-       tinymce.PluginManager.requireLangPack('wordpress');
-
-       tinymce.create('tinymce.plugins.WordPress', {
-               init : function(ed, url) {
-                       var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2');
-                       var moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
-                       var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
-
-                       if ( getUserSetting('hidetb', '0') == '1' )
-                               ed.settings.wordpress_adv_hidden = 0;
-
-                       // Hides the specified toolbar and resizes the iframe
-                       ed.onPostRender.add(function() {
-                               if ( ed.getParam('wordpress_adv_hidden', 1) ) {
-                                       DOM.hide(ed.controlManager.get(tbId).id);
-                                       t._resizeIframe(ed, tbId, 28);
-                               }
-                       });
-
-                       // Register commands
-                       ed.addCommand('WP_More', function() {
-                               ed.execCommand('mceInsertContent', 0, moreHTML);
-                       });
-
-                       ed.addCommand('WP_Page', function() {
-                               ed.execCommand('mceInsertContent', 0, nextpageHTML);
-                       });
-
-                       ed.addCommand('WP_Help', function() {
-                                       ed.windowManager.open({
-                                               url : tinymce.baseURL + '/wp-mce-help.php',
-                                               width : 450,
-                                               height : 420,
-                                               inline : 1
-                                       });
-                               });
-
-                       ed.addCommand('WP_Adv', function() {
-                               var id = ed.controlManager.get(tbId).id, cm = ed.controlManager;
-
-                               if (DOM.isHidden(id)) {
-                                       cm.setActive('wp_adv', 1);
-                                       DOM.show(id);
-                                       t._resizeIframe(ed, tbId, -28);
-                                       ed.settings.wordpress_adv_hidden = 0;
-                                       setUserSetting('hidetb', '1');
-                               } else {
-                                       cm.setActive('wp_adv', 0);
-                                       DOM.hide(id);
-                                       t._resizeIframe(ed, tbId, 28);
-                                       ed.settings.wordpress_adv_hidden = 1;
-                                       setUserSetting('hidetb', '0');
-                               }
-                       });
-
-                       // Register buttons
-                       ed.addButton('wp_more', {
-                               title : 'wordpress.wp_more_desc',
-                               image : url + '/img/more.gif',
-                               cmd : 'WP_More'
-                       });
-
-                       ed.addButton('wp_page', {
-                               title : 'wordpress.wp_page_desc',
-                               image : url + '/img/page.gif',
-                               cmd : 'WP_Page'
-                       });
-
-                       ed.addButton('wp_help', {
-                               title : 'wordpress.wp_help_desc',
-                               image : url + '/img/help.gif',
-                               cmd : 'WP_Help'
-                       });
-
-                       ed.addButton('wp_adv', {
-                               title : 'wordpress.wp_adv_desc',
-                               image : url + '/img/toolbars.gif',
-                               cmd : 'WP_Adv'
-                       });
-
-                       // Add Media buttons
-                       ed.addButton('add_media', {
-                               title : 'wordpress.add_media',
-                               image : url + '/img/media.gif',
-                               onclick : function() {
-                                       tb_show('', tinymce.DOM.get('add_media').href);
-                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
-                               }
-                       });
-
-                       ed.addButton('add_image', {
-                               title : 'wordpress.add_image',
-                               image : url + '/img/image.gif',
-                               onclick : function() {
-                                       tb_show('', tinymce.DOM.get('add_image').href);
-                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
-                               }
-                       });
-
-                       ed.addButton('add_video', {
-                               title : 'wordpress.add_video',
-                               image : url + '/img/video.gif',
-                               onclick : function() {
-                                       tb_show('', tinymce.DOM.get('add_video').href);
-                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
-                               }
-                       });
-
-                       ed.addButton('add_audio', {
-                               title : 'wordpress.add_audio',
-                               image : url + '/img/audio.gif',
-                               onclick : function() {
-                                       tb_show('', tinymce.DOM.get('add_audio').href);
-                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
-                               }
-                       });
-
-                       // Add Media buttons to fullscreen
-                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
-                               if ( 'mceFullScreen' != cmd ) return;
-                               if ( 'mce_fullscreen' != ed.id )
-                                       ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
-                       });
-
-                       // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
-                       ed.addCommand('JustifyLeft', function() {
-                               var n = ed.selection.getNode();
-
-                               if ( n.nodeName != 'IMG' )
-                                       ed.editorCommands.mceJustify('JustifyLeft', 'left');
-                               else ed.plugins.wordpress.do_align(n, 'alignleft');
-                       });
-
-                       ed.addCommand('JustifyRight', function() {
-                               var n = ed.selection.getNode();
-
-                               if ( n.nodeName != 'IMG' )
-                                       ed.editorCommands.mceJustify('JustifyRight', 'right');
-                               else ed.plugins.wordpress.do_align(n, 'alignright');
-                       });
-
-                       ed.addCommand('JustifyCenter', function() {
-                               var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl');
-
-                               if ( n.nodeName == 'IMG' && ( P || DL ) )
-                                       ed.plugins.wordpress.do_align(n, 'aligncenter');
-                               else ed.editorCommands.mceJustify('JustifyCenter', 'center');
-                       });
-
-                       // Word count if script is loaded
-                       if ( 'undefined' != typeof wpWordCount ) {
-                               var last = 0;
-                               ed.onKeyUp.add(function(ed, e) {
-                                       if ( e.keyCode == last ) return;
-                                       if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) );
-                                       last = e.keyCode;
-                               });
-                       };
-
-                       // Add listeners to handle more break
-                       t._handleMoreBreak(ed, url);
-
-                       // Add custom shortcuts
-                       ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
-                       ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight');
-                       ed.addShortcut('alt+shift+l', ed.getLang('justifyleft_desc'), 'JustifyLeft');
-                       ed.addShortcut('alt+shift+j', ed.getLang('justifyfull_desc'), 'JustifyFull');
-                       ed.addShortcut('alt+shift+q', ed.getLang('blockquote_desc'), 'mceBlockQuote');
-                       ed.addShortcut('alt+shift+u', ed.getLang('bullist_desc'), 'InsertUnorderedList');
-                       ed.addShortcut('alt+shift+o', ed.getLang('numlist_desc'), 'InsertOrderedList');
-                       ed.addShortcut('alt+shift+d', ed.getLang('striketrough_desc'), 'Strikethrough');
-                       ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck');
-                       ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink');
-                       ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink');
-                       ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage');
-                       ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen');
-                       ed.addShortcut('alt+shift+z', ed.getLang('wp_adv_desc'), 'WP_Adv');
-                       ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help');
-                       ed.addShortcut('alt+shift+t', ed.getLang('wp_more_desc'), 'WP_More');
-                       ed.addShortcut('alt+shift+p', ed.getLang('wp_page_desc'), 'WP_Page');
-
-                       if ( tinymce.isWebKit ) {
-                               ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold');
-                               ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic');
-                       }
-               },
-
-               getInfo : function() {
-                       return {
-                               longname : 'WordPress Plugin',
-                               author : 'WordPress', // add Moxiecode?
-                               authorurl : 'http://wordpress.org',
-                               infourl : 'http://wordpress.org',
-                               version : '3.0'
-                       };
-               },
-
-               // Internal functions
-               do_align : function(n, a) {
-                       var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
-
-                       if ( /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className) )
-                               return;
-
-                       P = ed.dom.getParent(n, 'p');
-                       DL = ed.dom.getParent(n, 'dl');
-                       DIV = ed.dom.getParent(n, 'div');
-
-                       if ( DL && DIV ) {
-                               cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
-                               DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
-                               ed.dom.addClass(DL, cls);
-                               c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter');
-                       } else if ( P ) {
-                               cls = ed.dom.hasClass(n, a) ? 'alignnone' : a;
-                               n.className = n.className.replace(/align[^ '"]+\s?/g, '');
-                               ed.dom.addClass(n, cls);
-                               if ( cls == 'aligncenter' )
-                                       ed.dom.setStyle(P, 'textAlign', 'center');
-                               else if (P.style && P.style.textAlign == 'center')
-                                       ed.dom.setStyle(P, 'textAlign', '');
-                       }
-
-                       ed.execCommand('mceRepaint');
-               },
-
-               // Resizes the iframe by a relative height value
-               _resizeIframe : function(ed, tb_id, dy) {
-                       var ifr = ed.getContentAreaContainer().firstChild;
-
-                       DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe
-                       ed.theme.deltaHeight += dy; // For resize cookie
-               },
-
-               _handleMoreBreak : function(ed, url) {
-                       var moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
-                       var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
-
-                       // Load plugin specific CSS into editor
-                       ed.onInit.add(function() {
-                               ed.dom.loadCSS(url + '/css/content.css');
-                       });
-
-                       // Display morebreak instead if img in element path
-                       ed.onPostRender.add(function() {
-                               if (ed.theme.onResolveName) {
-                                       ed.theme.onResolveName.add(function(th, o) {
-                                               if (o.node.nodeName == 'IMG') {
-                                                       if ( ed.dom.hasClass(o.node, 'mceWPmore') )
-                                                               o.name = 'wpmore';
-                                                       if ( ed.dom.hasClass(o.node, 'mceWPnextpage') )
-                                                               o.name = 'wppage';
-                                               }
-
-                                       });
-                               }
-                       });
-
-                       // Replace morebreak with images
-                       ed.onBeforeSetContent.add(function(ed, o) {
-                               o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
-                               o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
-                       });
-
-                       // Replace images with morebreak
-                       ed.onPostProcess.add(function(ed, o) {
-                               if (o.get)
-                                       o.content = o.content.replace(/<img[^>]+>/g, function(im) {
-                                               if (im.indexOf('class="mceWPmore') !== -1) {
-                                                       var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
-                                                       im = '<!--more'+moretext+'-->';
-                                               }
-                                               if (im.indexOf('class="mceWPnextpage') !== -1)
-                                                       im = '<!--nextpage-->';
-
-                                               return im;
-                                       });
-                       });
-
-                       // Set active buttons if user selected pagebreak or more break
-                       ed.onNodeChange.add(function(ed, cm, n) {
-                               cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage'));
-                               cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore'));
-                       });
-               }
-       });
-
-       // Register plugin
-       tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);
-})();
+(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{init:function(c,d){var e=this,h=c.getParam("wordpress_adv_toolbar","toolbar2"),g=0,f,b;f='<img src="'+d+'/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';if(getUserSetting("hidetb","0")=="1"){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){if(c.getParam("wordpress_adv_hidden",1)){a.hide(c.controlManager.get(h).id);e._resizeIframe(c,h,28)}});c.addCommand("WP_More",function(){c.execCommand("mceInsertContent",0,f)});c.addCommand("WP_Page",function(){c.execCommand("mceInsertContent",0,b)});c.addCommand("WP_Help",function(){c.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})});c.addCommand("WP_Adv",function(){var j=c.controlManager.get(h).id,i=c.controlManager;if(a.isHidden(j)){i.setActive("wp_adv",1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting("hidetb","1")}else{i.setActive("wp_adv",0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting("hidetb","0")}});c.addButton("wp_more",{title:"wordpress.wp_more_desc",image:d+"/img/more.gif",cmd:"WP_More"});c.addButton("wp_page",{title:"wordpress.wp_page_desc",image:d+"/img/page.gif",cmd:"WP_Page"});c.addButton("wp_help",{title:"wordpress.wp_help_desc",image:d+"/img/help.gif",cmd:"WP_Help"});c.addButton("wp_adv",{title:"wordpress.wp_adv_desc",image:d+"/img/toolbars.gif",cmd:"WP_Adv"});c.addButton("add_media",{title:"wordpress.add_media",image:d+"/img/media.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_media").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_image",{title:"wordpress.add_image",image:d+"/img/image.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_image").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_video",{title:"wordpress.add_video",image:d+"/img/video.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_video").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_audio",{title:"wordpress.add_audio",image:d+"/img/audio.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_audio").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.onBeforeExecCommand.add(function(i,k,j,l){if("mceFullScreen"!=k){return}if("mce_fullscreen"!=i.id){i.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}});c.addCommand("JustifyLeft",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyLeft","left")}else{c.plugins.wordpress.do_align(i,"alignleft")}});c.addCommand("JustifyRight",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyRight","right")}else{c.plugins.wordpress.do_align(i,"alignright")}});c.addCommand("JustifyCenter",function(){var k=c.selection.getNode(),j=c.dom.getParent(k,"p"),i=c.dom.getParent(k,"dl");if(k.nodeName=="IMG"&&(j||i)){c.plugins.wordpress.do_align(k,"aligncenter")}else{c.editorCommands.mceJustify("JustifyCenter","center")}});if("undefined"!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:"raw"}))}g=j.keyCode})}e._handleMoreBreak(c,d);c.addShortcut("alt+shift+c",c.getLang("justifycenter_desc"),"JustifyCenter");c.addShortcut("alt+shift+r",c.getLang("justifyright_desc"),"JustifyRight");c.addShortcut("alt+shift+l",c.getLang("justifyleft_desc"),"JustifyLeft");c.addShortcut("alt+shift+j",c.getLang("justifyfull_desc"),"JustifyFull");c.addShortcut("alt+shift+q",c.getLang("blockquote_desc"),"mceBlockQuote");c.addShortcut("alt+shift+u",c.getLang("bullist_desc"),"InsertUnorderedList");c.addShortcut("alt+shift+o",c.getLang("numlist_desc"),"InsertOrderedList");c.addShortcut("alt+shift+d",c.getLang("striketrough_desc"),"Strikethrough");c.addShortcut("alt+shift+n",c.getLang("spellchecker.desc"),"mceSpellCheck");c.addShortcut("alt+shift+a",c.getLang("link_desc"),"mceLink");c.addShortcut("alt+shift+s",c.getLang("unlink_desc"),"unlink");c.addShortcut("alt+shift+m",c.getLang("image_desc"),"mceImage");c.addShortcut("alt+shift+g",c.getLang("fullscreen.desc"),"mceFullScreen");c.addShortcut("alt+shift+z",c.getLang("wp_adv_desc"),"WP_Adv");c.addShortcut("alt+shift+h",c.getLang("help_desc"),"WP_Help");c.addShortcut("alt+shift+t",c.getLang("wp_more_desc"),"WP_More");c.addShortcut("alt+shift+p",c.getLang("wp_page_desc"),"WP_Page");c.addShortcut("ctrl+s",c.getLang("save_desc"),function(){if("function"==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut("alt+shift+b",c.getLang("bold_desc"),"Bold");c.addShortcut("alt+shift+i",c.getLang("italic_desc"),"Italic")}},getInfo:function(){return{longname:"WordPress Plugin",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"3.0"}},do_align:function(j,d){var h,f,g,b,i,e=tinyMCE.activeEditor;if(/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(j.className)){return}h=e.dom.getParent(j,"p");f=e.dom.getParent(j,"dl");g=e.dom.getParent(j,"div");if(f&&g){b=e.dom.hasClass(f,d)?"alignnone":d;f.className=f.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(f,b);i=(b=="aligncenter")?e.dom.addClass(g,"mceIEcenter"):e.dom.removeClass(g,"mceIEcenter")}else{if(h){b=e.dom.hasClass(j,d)?"alignnone":d;j.className=j.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(j,b);if(b=="aligncenter"){e.dom.setStyle(h,"textAlign","center")}else{if(h.style&&h.style.textAlign=="center"){e.dom.setStyle(h,"textAlign","")}}}}e.execCommand("mceRepaint")},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,"height",d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e='<img src="'+d+'/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';c.onInit.add(function(){c.dom.loadCSS(d+"/css/content.css")});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName=="IMG"){if(c.dom.hasClass(g.node,"mceWPmore")){g.name="wpmore"}if(c.dom.hasClass(g.node,"mceWPnextpage")){g.name="wppage"}}})}});c.onBeforeSetContent.add(function(f,g){g.content=g.content.replace(/<!--more(.*?)-->/g,e);g.content=g.content.replace(/<!--nextpage-->/g,b)});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mceWPmore')!==-1){var h,j=(h=i.match(/alt="(.*?)"/))?h[1]:"";i="<!--more"+j+"-->"}if(i.indexOf('class="mceWPnextpage')!==-1){i="<!--nextpage-->"}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive("wp_page",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPnextpage"));f.setActive("wp_more",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPmore"))})}});tinymce.PluginManager.add("wordpress",tinymce.plugins.WordPress)})();
\ No newline at end of file
index 5768e9f144c63c7f3814af7f1b3f25a855364c13..efba4a2042f4b604120cbc478e055d8302d3258f 100644 (file)
@@ -4,14 +4,14 @@
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title></title>
 
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title></title>
 
-<script type="text/javascript" src="js/editimage.js?ver=321"></script>
-<script type="text/javascript" src="../../utils/form_utils.js?ver=321"></script>
+<script type="text/javascript" src="js/editimage.js?ver=3223"></script>
+<script type="text/javascript" src="../../utils/form_utils.js?ver=3223"></script>
 
 
-<link rel="stylesheet" href="css/editimage.css?ver=321" type="text/css" media="all" />
+<link rel="stylesheet" href="css/editimage.css?ver=3223" type="text/css" media="all" />
 
 <script type="text/javascript">
 if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
 
 <script type="text/javascript">
 if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
-       document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=321" type="text/css" media="all" />');
+       document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=3223" type="text/css" media="all" />');
 </script>
 <base target="_self" />
 </head>
 </script>
 <base target="_self" />
 </head>
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js
new file mode 100644 (file)
index 0000000..2e256a0
--- /dev/null
@@ -0,0 +1,243 @@
+
+(function() {
+       tinymce.create('tinymce.plugins.wpEditImage', {
+
+               init : function(ed, url) {
+                       var t = this;
+
+                       t.url = url;
+                       t._createButtons();
+
+                       // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
+                       ed.addCommand('WP_EditImage', function() {
+                               var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w, cls = ed.dom.getAttrib(el, 'class');
+
+                               if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' )
+                                       return;
+
+                               tb_show('', url + '/editimage.html?ver=321&TB_iframe=true');
+                               tinymce.DOM.setStyles('TB_window', {
+                                       'width':( W - 50 )+'px',
+                                       'height':( H - 45 )+'px',
+                                       'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px'
+                               });
+
+                               if ( ! tinymce.isIE6 ) {
+                                       tinymce.DOM.setStyles('TB_window', {
+                                               'top':'20px',
+                                               'marginTop':'0'
+                                       });
+                               }
+
+                               tinymce.DOM.setStyles('TB_iframeContent', {
+                                       'width':( W - 50 )+'px',
+                                       'height':( H - 75 )+'px'
+                               });
+                               tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                       });
+
+                       ed.onInit.add(function(ed) {
+                               tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
+                                       ed.plugins.wpeditimage.hideButtons();
+                               });
+                       });
+
+                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
+                               ed.plugins.wpeditimage.hideButtons();
+                       });
+
+                       ed.onSaveContent.add(function(ed, o) {
+                               ed.plugins.wpeditimage.hideButtons();
+                       });
+
+                       ed.onMouseUp.add(function(ed, e) {
+                               var n, DL;
+                               
+                               if ( tinymce.isOpera ) {
+                                       if ( e.target.nodeName == 'IMG' )
+                                               ed.plugins.wpeditimage.showButtons(e.target);
+                               } else if ( ! tinymce.isWebKit ) {
+                                       n = ed.selection.getNode();
+                                       
+                                       if ( n.nodeName == 'IMG' && (DL = ed.dom.getParent(n, 'DL')) ) {                                        
+                                               window.setTimeout(function(){
+                                                       var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'DL');
+                                               
+                                                       if ( n.width != (parseInt(ed.dom.getStyle(DL, 'width')) - 10) ) {
+                                                               ed.dom.setStyle(DL, 'width', parseInt(n.width)+10);
+                                                               ed.execCommand('mceRepaint');
+                                                       }
+                                               }, 100);
+                                       }
+                               }
+                       });
+
+                       ed.onMouseDown.add(function(ed, e) {
+                               if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
+                                       t.hideButtons();
+                                       return;
+                               }
+                               ed.plugins.wpeditimage.showButtons(e.target);
+                       });
+
+                       ed.onKeyPress.add(function(ed, e) {
+                               var DL, DIV, P;
+
+                               if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) ) {
+                                       P = ed.dom.create('p', {}, '&nbsp;');
+                                       if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' ) 
+                                               ed.dom.insertAfter( P, DIV );
+                                       else ed.dom.insertAfter( P, DL );
+
+                                       tinymce.dom.Event.cancel(e);
+                                       ed.selection.select(P);
+                                       return false;
+                               }
+                       });
+
+                       ed.onBeforeSetContent.add(function(ed, o) {
+                               o.content = t._do_shcode(o.content);
+                       });
+
+                       ed.onPostProcess.add(function(ed, o) {
+                               if (o.get)
+                                       o.content = t._get_shcode(o.content);
+                       });
+               },
+
+               _do_shcode : function(co) {
+                       return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){
+                               var id, cls, w, cap, div_cls;
+                               
+                               b = b.replace(/\\'|\\&#39;|\\&#039;/g, '&#39;').replace(/\\"|\\&quot;/g, '&quot;');
+                               c = c.replace(/\\&#39;|\\&#039;/g, '&#39;').replace(/\\&quot;/g, '&quot;');
+                               id = b.match(/id=['"]([^'"]+)/i);
+                               cls = b.match(/align=['"]([^'"]+)/i);
+                               w = b.match(/width=['"]([0-9]+)/);
+                               cap = b.match(/caption=['"]([^'"]+)/i);
+
+                               id = ( id && id[1] ) ? id[1] : '';
+                               cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
+                               w = ( w && w[1] ) ? w[1] : '';
+                               cap = ( cap && cap[1] ) ? cap[1] : '';
+                               if ( ! w || ! cap ) return c;
+                               
+                               div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
+
+                               return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+
+                               'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
+                       });
+               },
+
+               _get_shcode : function(co) {
+                       return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){
+                               var id, cls, w;
+                               
+                               id = b.match(/id=['"]([^'"]+)/i);
+                               cls = b.match(/class=['"]([^'"]+)/i);
+                               w = c.match(/width=['"]([0-9]+)/);
+
+                               id = ( id && id[1] ) ? id[1] : '';
+                               cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
+                               w = ( w && w[1] ) ? w[1] : '';
+
+                               if ( ! w || ! cap ) return c;
+                               cls = cls.match(/align[^ '"]+/) || 'alignnone';
+                               cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
+
+                               return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
+                       });
+               },
+
+               showButtons : function(n) {
+                       var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y, cls = ed.dom.getAttrib(n, 'class');
+
+                       if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 )
+                               return;
+
+                       vp = ed.dom.getViewPort(ed.getWin());
+                       p1 = DOM.getPos(ed.getContentAreaContainer());
+                       p2 = ed.dom.getPos(n);
+
+                       X = Math.max(p2.x - vp.x, 0) + p1.x;
+                       Y = Math.max(p2.y - vp.y, 0) + p1.y;
+
+                       DOM.setStyles('wp_editbtns', {
+                               'top' : Y+5+'px',
+                               'left' : X+5+'px',
+                               'display' : 'block'
+                       });
+
+                       t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 );
+               },
+
+               hideButtons : function() {
+                       if ( tinymce.DOM.isHidden('wp_editbtns') ) return;
+
+                       tinymce.DOM.hide('wp_editbtns');
+                       window.clearTimeout(this.btnsTout);
+               },
+
+               _createButtons : function() {
+                       var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, wp_editbtns, wp_editimgbtn, wp_delimgbtn;
+
+                       DOM.remove('wp_editbtns');
+
+                       wp_editbtns = DOM.add(document.body, 'div', {
+                               id : 'wp_editbtns',
+                               style : 'display:none;'
+                       });
+
+                       wp_editimgbtn = DOM.add('wp_editbtns', 'img', {
+                               src : t.url+'/img/image.png',
+                               id : 'wp_editimgbtn',
+                               width : '24',
+                               height : '24',
+                               title : ed.getLang('wpeditimage.edit_img')
+                       });
+
+                       wp_editimgbtn.onmousedown = function(e) {
+                               var ed = tinyMCE.activeEditor;
+                               ed.windowManager.bookmark = ed.selection.getBookmark('simple');
+                               ed.execCommand("WP_EditImage");
+                               this.parentNode.style.display = 'none';
+                       };
+
+                       wp_delimgbtn = DOM.add('wp_editbtns', 'img', {
+                               src : t.url+'/img/delete.png',
+                               id : 'wp_delimgbtn',
+                               width : '24',
+                               height : '24',
+                               title : ed.getLang('wpeditimage.del_img')
+                       });
+
+                       wp_delimgbtn.onmousedown = function(e) {
+                               var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p;
+
+                               if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
+                                       if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
+                                               ed.dom.remove(p);
+                                       else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
+                                               ed.dom.remove(p);
+                                       else ed.dom.remove(el);
+
+                                       this.parentNode.style.display = 'none';
+                                       ed.execCommand('mceRepaint');
+                                       return false;
+                               }
+                       };
+               },
+
+               getInfo : function() {
+                       return {
+                               longname : 'Edit Image',
+                               author : 'WordPress',
+                               authorurl : 'http://wordpress.org',
+                               infourl : '',
+                               version : "1.0"
+                       };
+               }
+       });
+
+       tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
+})();
index f24d0bafae768e88baec9874c27bcaff445147bb..9c17ed34f0f4a6ae7d71626eb174fe2cc3c52842 100644 (file)
@@ -1,236 +1 @@
-
-(function() {
-       tinymce.create('tinymce.plugins.wpEditImage', {
-
-               init : function(ed, url) {
-                       var t = this;
-
-                       t.url = url;
-                       t._createButtons();
-
-                       // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
-                       ed.addCommand('WP_EditImage', function() {
-                               var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), H = vp.h, W = ( 720 < vp.w ) ? 720 : vp.w;
-                               var cls = ed.dom.getAttrib(el, 'class');
-
-                               if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' )
-                                       return;
-
-                               tb_show('', url + '/editimage.html?ver=321&TB_iframe=true');
-                               tinymce.DOM.setStyles('TB_window', {
-                                       'width':( W - 50 )+'px',
-                                       'height':( H - 45 )+'px',
-                                       'margin-left':'-'+parseInt((( W - 50 ) / 2),10) + 'px'
-                               });
-
-                               if ( ! tinymce.isIE6 ) {
-                                       tinymce.DOM.setStyles('TB_window', {
-                                               'top':'20px',
-                                               'marginTop':'0'
-                                       });
-                               }
-
-                               tinymce.DOM.setStyles('TB_iframeContent', {
-                                       'width':( W - 50 )+'px',
-                                       'height':( H - 75 )+'px'
-                               });
-                               tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
-                       });
-
-                       ed.onInit.add(function(ed) {
-                               tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
-                                       ed.plugins.wpeditimage.hideButtons();
-                               });
-                       });
-
-                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
-                               ed.plugins.wpeditimage.hideButtons();
-                       });
-
-                       ed.onSaveContent.add(function(ed, o) {
-                               ed.plugins.wpeditimage.hideButtons();
-                       });
-
-                       ed.onMouseUp.add(function(ed, e) {
-                               if ( tinymce.isOpera ) {
-                                       if ( e.target.nodeName == 'IMG' )
-                                               ed.plugins.wpeditimage.showButtons(e.target);
-                               } else if ( ! tinymce.isWebKit ) {
-                                       var n = ed.selection.getNode(), DL;
-                                       
-                                       if ( n.nodeName == 'IMG' && (DL = ed.dom.getParent(n, 'DL')) ) {                                        
-                                               window.setTimeout(function(){
-                                                       var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'DL');
-                                               
-                                                       if ( n.width != (parseInt(ed.dom.getStyle(DL, 'width')) - 10) ) {
-                                                               ed.dom.setStyle(DL, 'width', parseInt(n.width)+10);
-                                                               ed.execCommand('mceRepaint');
-                                                       }
-                                               }, 100);
-                                       }
-                               }
-                       });
-
-                       ed.onMouseDown.add(function(ed, e) {
-                               if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
-                                       t.hideButtons();
-                                       return;
-                               }
-                               ed.plugins.wpeditimage.showButtons(e.target);
-                       });
-
-                       ed.onKeyPress.add(function(ed, e) {
-                               var DL, DIV;
-
-                               if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) ) {
-                                       var P = ed.dom.create('p', {}, '&nbsp;');
-                                       if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' ) 
-                                               ed.dom.insertAfter( P, DIV );
-                                       else ed.dom.insertAfter( P, DL );
-
-                                       tinymce.dom.Event.cancel(e);
-                                       ed.selection.select(P);
-                                       return false;
-                               }
-                       });
-
-                       ed.onBeforeSetContent.add(function(ed, o) {
-                               o.content = t._do_shcode(o.content);
-                       });
-
-                       ed.onPostProcess.add(function(ed, o) {
-                               if (o.get)
-                                       o.content = t._get_shcode(o.content);
-                       });
-               },
-
-               _do_shcode : function(co) {
-                       return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){
-                               b = b.replace(/\\'|\\&#39;|\\&#039;/g, '&#39;').replace(/\\"|\\&quot;/g, '&quot;');
-                               c = c.replace(/\\&#39;|\\&#039;/g, '&#39;').replace(/\\&quot;/g, '&quot;');
-                               var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i);
-                               var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/i);
-
-                               id = ( id && id[1] ) ? id[1] : '';
-                               cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
-                               w = ( w && w[1] ) ? w[1] : '';
-                               cap = ( cap && cap[1] ) ? cap[1] : '';
-                               if ( ! w || ! cap ) return c;
-                               
-                               var div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
-
-                               return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+
-                               'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
-                       });
-               },
-
-               _get_shcode : function(co) {
-                       return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){
-                               var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/class=['"]([^'"]+)/i);
-                               var w = c.match(/width=['"]([0-9]+)/);
-
-                               id = ( id && id[1] ) ? id[1] : '';
-                               cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
-                               w = ( w && w[1] ) ? w[1] : '';
-
-                               if ( ! w || ! cap ) return c;
-                               cls = cls.match(/align[^ '"]+/) || 'alignnone';
-                               cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
-
-                               return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
-                       });
-               },
-
-               showButtons : function(n) {
-                       var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
-                       var cls = ed.dom.getAttrib(n, 'class');
-
-                       if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 )
-                               return;
-
-                       vp = ed.dom.getViewPort(ed.getWin());
-                       p1 = DOM.getPos(ed.getContentAreaContainer());
-                       p2 = ed.dom.getPos(n);
-
-                       X = Math.max(p2.x - vp.x, 0) + p1.x;
-                       Y = Math.max(p2.y - vp.y, 0) + p1.y;
-
-                       DOM.setStyles('wp_editbtns', {
-                               'top' : Y+5+'px',
-                               'left' : X+5+'px',
-                               'display' : 'block'
-                       });
-
-                       t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 );
-               },
-
-               hideButtons : function() {
-                       if ( tinymce.DOM.isHidden('wp_editbtns') ) return;
-
-                       tinymce.DOM.hide('wp_editbtns');
-                       window.clearTimeout(this.btnsTout);
-               },
-
-               _createButtons : function() {
-                       var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM;
-
-                       DOM.remove('wp_editbtns');
-
-                       var wp_editbtns = DOM.add(document.body, 'div', {
-                               id : 'wp_editbtns',
-                               style : 'display:none;'
-                       });
-
-                       var wp_editimgbtn = DOM.add('wp_editbtns', 'img', {
-                               src : t.url+'/img/image.png',
-                               id : 'wp_editimgbtn',
-                               width : '24',
-                               height : '24',
-                               title : ed.getLang('wpeditimage.edit_img')
-                       });
-
-                       wp_editimgbtn.onmousedown = function(e) {
-                               var ed = tinyMCE.activeEditor;
-                               ed.windowManager.bookmark = ed.selection.getBookmark('simple');
-                               ed.execCommand("WP_EditImage");
-                               this.parentNode.style.display = 'none';
-                       };
-
-                       var wp_delimgbtn = DOM.add('wp_editbtns', 'img', {
-                               src : t.url+'/img/delete.png',
-                               id : 'wp_delimgbtn',
-                               width : '24',
-                               height : '24',
-                               title : ed.getLang('wpeditimage.del_img')
-                       });
-
-                       wp_delimgbtn.onmousedown = function(e) {
-                               var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p;
-
-                               if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
-                                       if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
-                                               ed.dom.remove(p);
-                                       else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
-                                               ed.dom.remove(p);
-                                       else ed.dom.remove(el);
-
-                                       this.parentNode.style.display = 'none';
-                                       ed.execCommand('mceRepaint');
-                                       return false;
-                               }
-                       };
-               },
-
-               getInfo : function() {
-                       return {
-                               longname : 'Edit Image',
-                               author : 'WordPress',
-                               authorurl : 'http://wordpress.org',
-                               infourl : '',
-                               version : "1.0"
-                       };
-               }
-       });
-
-       tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
-})();
+(function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_EditImage",function(){var h=a.selection.getNode(),f=tinymce.DOM.getViewPort(),g=f.h,d=(720<f.w)?720:f.w,e=a.dom.getAttrib(h,"class");if(e.indexOf("mceItem")!=-1||e.indexOf("wpGallery")!=-1||h.nodeName!="IMG"){return}tb_show("",b+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(d-50)+"px",height:(g-45)+"px","margin-left":"-"+parseInt(((d-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(d-50)+"px",height:(g-75)+"px"});tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getWin(),"scroll",function(f){d.plugins.wpeditimage.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpeditimage.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpeditimage.hideButtons()});a.onMouseUp.add(function(d,g){var h,f;if(tinymce.isOpera){if(g.target.nodeName=="IMG"){d.plugins.wpeditimage.showButtons(g.target)}}else{if(!tinymce.isWebKit){h=d.selection.getNode();if(h.nodeName=="IMG"&&(f=d.dom.getParent(h,"DL"))){window.setTimeout(function(){var e=tinyMCE.activeEditor,j=e.selection.getNode(),i=e.dom.getParent(j,"DL");if(j.width!=(parseInt(e.dom.getStyle(i,"width"))-10)){e.dom.setStyle(i,"width",parseInt(j.width)+10);e.execCommand("mceRepaint")}},100)}}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpeditimage.showButtons(f.target)});a.onKeyPress.add(function(d,i){var f,h,g;if(i.keyCode==13&&(f=d.dom.getParent(d.selection.getNode(),"DL"))){g=d.dom.create("p",{},"&nbsp;");if((h=f.parentNode)&&h.nodeName=="DIV"){d.dom.insertAfter(g,h)}else{d.dom.insertAfter(g,f)}tinymce.dom.Event.cancel(i);d.selection.select(g);return false}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_shcode(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_shcode(e.content)}})},_do_shcode:function(a){return a.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\&#39;|\\&#039;/g,"&#39;").replace(/\\"|\\&quot;/g,"&quot;");k=k.replace(/\\&#39;|\\&#039;/g,"&#39;").replace(/\\&quot;/g,"&quot;");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'"><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"&#39;").replace(/"/g,"&quot;");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},showButtons:function(d){var j=this,e=tinyMCE.activeEditor,g,f,a,i=tinymce.DOM,c,b,h=e.dom.getAttrib(d,"class");if(h.indexOf("mceItem")!=-1||h.indexOf("wpGallery")!=-1){return}a=e.dom.getViewPort(e.getWin());g=i.getPos(e.getContentAreaContainer());f=e.dom.getPos(d);c=Math.max(f.x-a.x,0)+g.x;b=Math.max(f.y-a.y,0)+g.y;i.setStyles("wp_editbtns",{top:b+5+"px",left:c+5+"px",display:"block"});j.btnsTout=window.setTimeout(function(){e.plugins.wpeditimage.hideButtons()},5000)},hideButtons:function(){if(tinymce.DOM.isHidden("wp_editbtns")){return}tinymce.DOM.hide("wp_editbtns");window.clearTimeout(this.btnsTout)},_createButtons:function(){var d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,a,c,f;e.remove("wp_editbtns");a=e.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});c=e.add("wp_editbtns","img",{src:d.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:b.getLang("wpeditimage.edit_img")});c.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_EditImage");this.parentNode.style.display="none"};f=e.add("wp_editbtns","img",{src:d.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:b.getLang("wpeditimage.del_img")});f.onmousedown=function(j){var g=tinyMCE.activeEditor,h=g.selection.getNode(),i;if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("mceItem")==-1){if((i=g.dom.getParent(h,"div"))&&g.dom.hasClass(i,"mceTemp")){g.dom.remove(i)}else{if((i=g.dom.getParent(h,"A"))&&i.childNodes.length==1){g.dom.remove(i)}else{g.dom.remove(h)}}this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js b/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js
new file mode 100644 (file)
index 0000000..3c9701d
--- /dev/null
@@ -0,0 +1,174 @@
+
+(function() {
+       tinymce.create('tinymce.plugins.wpGallery', {
+
+               init : function(ed, url) {
+                       var t = this;
+
+                       t.url = url;
+                       t._createButtons();
+
+                       // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
+                       ed.addCommand('WP_Gallery', function() {
+                               var el = ed.selection.getNode(), post_id, vp = tinymce.DOM.getViewPort(), H = vp.h - 80, W = ( 640 < vp.w ) ? 640 : vp.w;
+
+                               if ( el.nodeName != 'IMG' ) return;
+                               if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return;
+
+                               post_id = tinymce.DOM.get('post_ID').value;
+                               tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true&width='+W+'&height='+H);
+
+                               tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                       });
+
+                       ed.onInit.add(function(ed) {
+                               tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
+                                       ed.plugins.wpgallery.hideButtons();
+                               });
+                       });
+
+                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
+                               ed.plugins.wpgallery.hideButtons();
+                       });
+
+                       ed.onSaveContent.add(function(ed, o) {
+                               ed.plugins.wpgallery.hideButtons();
+                       });
+
+                       ed.onMouseUp.add(function(ed, e) {
+                               if ( tinymce.isOpera ) {
+                                       if ( e.target.nodeName == 'IMG' )
+                                               ed.plugins.wpgallery.showButtons(e.target);
+                               }
+
+                       });
+
+                       ed.onMouseDown.add(function(ed, e) {
+                               if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
+                                       t.hideButtons();
+                                       return;
+                               }
+                               ed.plugins.wpgallery.showButtons(e.target);
+                       });
+
+                       ed.onBeforeSetContent.add(function(ed, o) {
+                               o.content = t._do_gallery(o.content);
+                       });
+
+                       ed.onPostProcess.add(function(ed, o) {
+                               if (o.get)
+                                       o.content = t._get_gallery(o.content);
+                       });
+               },
+
+               _do_gallery : function(co) {
+                       return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){
+                               return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';
+                       });
+               },
+
+               _get_gallery : function(co) {
+
+                       function getAttr(s, n) {
+                               n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
+                               return n ? tinymce.DOM.decode(n[1]) : '';
+                       };
+
+                       return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
+                               var cls = getAttr(im, 'class');
+
+                               if ( cls.indexOf('wpGallery') != -1 )
+                                       return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
+
+                               return a;
+                       });
+               },
+
+               showButtons : function(n) {
+                       var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
+
+                       if (ed.dom.getAttrib(n, 'class').indexOf('wpGallery') == -1)
+                               return;
+
+                       vp = ed.dom.getViewPort(ed.getWin());
+                       p1 = DOM.getPos(ed.getContentAreaContainer());
+                       p2 = ed.dom.getPos(n);
+
+                       X = Math.max(p2.x - vp.x, 0) + p1.x;
+                       Y = Math.max(p2.y - vp.y, 0) + p1.y;
+
+                       DOM.setStyles('wp_gallerybtns', {
+                               'top' : Y+5+'px',
+                               'left' : X+5+'px',
+                               'display' : 'block'
+                       });
+
+                       t.btnsTout = window.setTimeout( function(){ed.plugins.wpgallery.hideButtons();}, 5000 );
+               },
+
+               hideButtons : function() {
+                       if ( tinymce.DOM.isHidden('wp_gallerybtns') ) return;
+
+                       tinymce.DOM.hide('wp_gallerybtns');
+                       window.clearTimeout(this.btnsTout);
+               },
+
+               _createButtons : function() {
+                       var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, wp_gallerybtns, wp_editgallery, wp_delgallery;
+
+                       DOM.remove('wp_gallerybtns');
+
+                       wp_gallerybtns = DOM.add(document.body, 'div', {
+                               id : 'wp_gallerybtns',
+                               style : 'display:none;'
+                       });
+
+                       wp_editgallery = DOM.add('wp_gallerybtns', 'img', {
+                               src : t.url+'/img/edit.png',
+                               id : 'wp_editgallery',
+                               width : '24',
+                               height : '24',
+                               title : ed.getLang('wordpress.editgallery')
+                       });
+
+                       wp_editgallery.onmousedown = function(e) {
+                               var ed = tinyMCE.activeEditor;
+                               ed.windowManager.bookmark = ed.selection.getBookmark('simple');
+                               ed.execCommand("WP_Gallery");
+                               this.parentNode.style.display = 'none';
+                       };
+
+                       wp_delgallery = DOM.add('wp_gallerybtns', 'img', {
+                               src : t.url+'/img/delete.png',
+                               id : 'wp_delgallery',
+                               width : '24',
+                               height : '24',
+                               title : ed.getLang('wordpress.delgallery')
+                       });
+
+                       wp_delgallery.onmousedown = function(e) {
+                               var ed = tinyMCE.activeEditor, el = ed.selection.getNode();
+
+                               if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('wpGallery') != -1 ) {
+                                       ed.dom.remove(el);
+
+                                       this.parentNode.style.display = 'none';
+                                       ed.execCommand('mceRepaint');
+                                       return false;
+                               }
+                       };
+               },
+
+               getInfo : function() {
+                       return {
+                               longname : 'Gallery Settings',
+                               author : 'WordPress',
+                               authorurl : 'http://wordpress.org',
+                               infourl : '',
+                               version : "1.0"
+                       };
+               }
+       });
+
+       tinymce.PluginManager.add('wpgallery', tinymce.plugins.wpGallery);
+})();
index bdb6b7c71bd6b85ce3fdb11bf2d79ca31de73726..e924e3dc248de0ef94aa9f089d3218ca068668b4 100644 (file)
@@ -1,174 +1 @@
-\r
-(function() {\r
-       tinymce.create('tinymce.plugins.wpGallery', {\r
-\r
-               init : function(ed, url) {\r
-                       var t = this;\r
-\r
-                       t.url = url;\r
-                       t._createButtons();\r
-\r
-                       // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');\r
-                       ed.addCommand('WP_Gallery', function() {\r
-                               var el = ed.selection.getNode(), vp = tinymce.DOM.getViewPort(), W = ( 720 < vp.w ) ? 720 : vp.w;\r
-\r
-                               if ( el.nodeName != 'IMG' ) return;\r
-                               if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return;\r
-\r
-                               var post_id = tinymce.DOM.get('post_ID').value;\r
-                               tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true');\r
-\r
-                               tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );\r
-                       });\r
-\r
-                       ed.onInit.add(function(ed) {\r
-                               tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {\r
-                                       ed.plugins.wpgallery.hideButtons();\r
-                               });\r
-                       });\r
-\r
-                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {\r
-                               ed.plugins.wpgallery.hideButtons();\r
-                       });\r
-\r
-                       ed.onSaveContent.add(function(ed, o) {\r
-                               ed.plugins.wpgallery.hideButtons();\r
-                       });\r
-\r
-                       ed.onMouseUp.add(function(ed, e) {\r
-                               if ( tinymce.isOpera ) {\r
-                                       if ( e.target.nodeName == 'IMG' )\r
-                                               ed.plugins.wpgallery.showButtons(e.target);\r
-                               }\r
-\r
-                       });\r
-\r
-                       ed.onMouseDown.add(function(ed, e) {\r
-                               if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {\r
-                                       t.hideButtons();\r
-                                       return;\r
-                               }\r
-                               ed.plugins.wpgallery.showButtons(e.target);\r
-                       });\r
-\r
-                       ed.onBeforeSetContent.add(function(ed, o) {\r
-                               o.content = t._do_gallery(o.content);\r
-                       });\r
-\r
-                       ed.onPostProcess.add(function(ed, o) {\r
-                               if (o.get)\r
-                                       o.content = t._get_gallery(o.content);\r
-                       });\r
-               },\r
-\r
-               _do_gallery : function(co) {\r
-                       return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){\r
-                               return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';\r
-                       });\r
-               },\r
-\r
-               _get_gallery : function(co) {\r
-\r
-                       function getAttr(s, n) {\r
-                               n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);\r
-                               return n ? tinymce.DOM.decode(n[1]) : '';\r
-                       };\r
-\r
-                       return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {\r
-                               var cls = getAttr(im, 'class');\r
-\r
-                               if ( cls.indexOf('wpGallery') != -1 )\r
-                                       return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';\r
-\r
-                               return a;\r
-                       });\r
-               },\r
-\r
-               showButtons : function(n) {\r
-                       var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;\r
-\r
-                       if (ed.dom.getAttrib(n, 'class').indexOf('wpGallery') == -1)\r
-                               return;\r
-\r
-                       vp = ed.dom.getViewPort(ed.getWin());\r
-                       p1 = DOM.getPos(ed.getContentAreaContainer());\r
-                       p2 = ed.dom.getPos(n);\r
-\r
-                       X = Math.max(p2.x - vp.x, 0) + p1.x;\r
-                       Y = Math.max(p2.y - vp.y, 0) + p1.y;\r
-\r
-                       DOM.setStyles('wp_gallerybtns', {\r
-                               'top' : Y+5+'px',\r
-                               'left' : X+5+'px',\r
-                               'display' : 'block'\r
-                       });\r
-\r
-                       t.btnsTout = window.setTimeout( function(){ed.plugins.wpgallery.hideButtons();}, 5000 );\r
-               },\r
-\r
-               hideButtons : function() {\r
-                       if ( tinymce.DOM.isHidden('wp_gallerybtns') ) return;\r
-\r
-                       tinymce.DOM.hide('wp_gallerybtns');\r
-                       window.clearTimeout(this.btnsTout);\r
-               },\r
-\r
-               _createButtons : function() {\r
-                       var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM;\r
-\r
-                       DOM.remove('wp_gallerybtns');\r
-\r
-                       var wp_gallerybtns = DOM.add(document.body, 'div', {\r
-                               id : 'wp_gallerybtns',\r
-                               style : 'display:none;'\r
-                       });\r
-\r
-                       var wp_editgallery = DOM.add('wp_gallerybtns', 'img', {\r
-                               src : t.url+'/img/edit.png',\r
-                               id : 'wp_editgallery',\r
-                               width : '24',\r
-                               height : '24',\r
-                               title : ed.getLang('wordpress.editgallery')\r
-                       });\r
-\r
-                       wp_editgallery.onmousedown = function(e) {\r
-                               var ed = tinyMCE.activeEditor;\r
-                               ed.windowManager.bookmark = ed.selection.getBookmark('simple');\r
-                               ed.execCommand("WP_Gallery");\r
-                               this.parentNode.style.display = 'none';\r
-                       };\r
-\r
-                       var wp_delgallery = DOM.add('wp_gallerybtns', 'img', {\r
-                               src : t.url+'/img/delete.png',\r
-                               id : 'wp_delgallery',\r
-                               width : '24',\r
-                               height : '24',\r
-                               title : ed.getLang('wordpress.delgallery')\r
-                       });\r
-\r
-                       wp_delgallery.onmousedown = function(e) {\r
-                               var ed = tinyMCE.activeEditor, el = ed.selection.getNode();\r
-\r
-                               if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('wpGallery') != -1 ) {\r
-                                       ed.dom.remove(el);\r
-\r
-                                       this.parentNode.style.display = 'none';\r
-                                       ed.execCommand('mceRepaint');\r
-                                       return false;\r
-                               }\r
-                       };\r
-               },\r
-\r
-               getInfo : function() {\r
-                       return {\r
-                               longname : 'Gallery Settings',\r
-                               author : 'WordPress',\r
-                               authorurl : 'http://wordpress.org',\r
-                               infourl : '',\r
-                               version : "1.0"\r
-                       };\r
-               }\r
-       });\r
-\r
-       tinymce.PluginManager.add('wpgallery', tinymce.plugins.wpGallery);\r
-})();\r
+(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var h=a.selection.getNode(),f,e=tinymce.DOM.getViewPort(),g=e.h-80,d=(640<e.w)?640:e.w;if(h.nodeName!="IMG"){return}if(a.dom.getAttrib(h,"class").indexOf("wpGallery")==-1){return}f=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+f+"&tab=gallery&TB_iframe=true&width="+d+"&height="+g);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getWin(),"scroll",function(f){d.plugins.wpgallery.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpgallery.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpgallery.hideButtons()});a.onMouseUp.add(function(d,f){if(tinymce.isOpera){if(f.target.nodeName=="IMG"){d.plugins.wpgallery.showButtons(f.target)}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpgallery.showButtons(f.target)});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},showButtons:function(d){var i=this,e=tinyMCE.activeEditor,g,f,a,h=tinymce.DOM,c,b;if(e.dom.getAttrib(d,"class").indexOf("wpGallery")==-1){return}a=e.dom.getViewPort(e.getWin());g=h.getPos(e.getContentAreaContainer());f=e.dom.getPos(d);c=Math.max(f.x-a.x,0)+g.x;b=Math.max(f.y-a.y,0)+g.y;h.setStyles("wp_gallerybtns",{top:b+5+"px",left:c+5+"px",display:"block"});i.btnsTout=window.setTimeout(function(){e.plugins.wpgallery.hideButtons()},5000)},hideButtons:function(){if(tinymce.DOM.isHidden("wp_gallerybtns")){return}tinymce.DOM.hide("wp_gallerybtns");window.clearTimeout(this.btnsTout)},_createButtons:function(){var d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,c,f,a;e.remove("wp_gallerybtns");c=e.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});f=e.add("wp_gallerybtns","img",{src:d.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:b.getLang("wordpress.editgallery")});f.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_Gallery");this.parentNode.style.display="none"};a=e.add("wp_gallerybtns","img",{src:d.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:b.getLang("wordpress.delgallery")});a.onmousedown=function(i){var g=tinyMCE.activeEditor,h=g.selection.getNode();if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("wpGallery")!=-1){g.dom.remove(h);this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();
\ No newline at end of file
index 23b51cbcdf9b9cd23dbc6f49dbf4655705fb00a9..f521bd51498af2dafafa2f61db9f8f336f0de724 100644 (file)
@@ -1,10 +1,10 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!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">
 <head>
        <title>{#advanced_dlg.about_title}</title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.about_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=3211"></script>
-       <script type="text/javascript" src="js/about.js?ver=3211"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/about.js?ver=3241-1141"></script>
 </head>
 <body id="about" style="display: none">
                <div class="tabs">
 </head>
 <body id="about" style="display: none">
                <div class="tabs">
index f259c6394356c9d7f8c229d727381319e18ae11f..2928b04f805972210baae180dd7f13a92b3a0ef0 100644 (file)
@@ -2,9 +2,8 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.anchor_title}</title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.anchor_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="js/anchor.js?ver=3211"></script>
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/anchor.js?ver=3241-1141"></script>
 </head>
 <body style="display: none">
 <form onsubmit="AnchorDialog.update();return false;" action="#">
 </head>
 <body style="display: none">
 <form onsubmit="AnchorDialog.update();return false;" action="#">
@@ -13,7 +12,7 @@
                        <td colspan="2" class="title">{#advanced_dlg.anchor_title}</td>
                </tr>
                <tr>
                        <td colspan="2" class="title">{#advanced_dlg.anchor_title}</td>
                </tr>
                <tr>
-                       <td nowrap="nowrap">{#advanced_dlg.anchor_name}:</td>
+                       <td class="nowrap">{#advanced_dlg.anchor_name}:</td>
                        <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td>
                </tr>
        </table>
                        <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td>
                </tr>
        </table>
index cb495d816cef05960bac7c17a6d49090afaeb39f..42ceaa3a21364a12f911bd307adebd4b144830fa 100644 (file)
@@ -1,11 +1,10 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!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">
 <head>
        <title>{#advanced_dlg.charmap_title}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.charmap_title}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="js/charmap.js?ver=3211"></script>
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/charmap.js?ver=3241-1141"></script>
 </head>
 <body id="charmap" style="display:none">
 <table align="center" border="0" cellspacing="0" cellpadding="2">
 </head>
 <body id="charmap" style="display:none">
 <table align="center" border="0" cellspacing="0" cellpadding="2">
index d8ffcaa82c0306069e3baf205a1a60de696252bb..5cdca6eabe0f615b9daa5cdf9f89371e70d0df62 100644 (file)
@@ -2,10 +2,9 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.colorpicker_title}</title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.colorpicker_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=3211"></script>
-       <script type="text/javascript" src="js/color_picker.js?ver=3211"></script>
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/color_picker.js?ver=3241-1141"></script>
 </head>
 <body id="colorpicker" style="display: none">
 <form onsubmit="insertAction();return false" action="#">
 </head>
 <body id="colorpicker" style="display: none">
 <form onsubmit="insertAction();return false" action="#">
@@ -22,7 +21,7 @@
                        <fieldset>
                                <legend>{#advanced_dlg.colorpicker_picker_title}</legend>
                                <div id="picker">
                        <fieldset>
                                <legend>{#advanced_dlg.colorpicker_picker_title}</legend>
                                <div id="picker">
-                                       <img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" />
+                                       <img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt=" " />
 
                                        <div id="light">
                                                <!-- Will be filled with divs -->
 
                                        <div id="light">
                                                <!-- Will be filled with divs -->
index d72d5425f3ed2aac6d0a0b318c3abb056f4c7244..628c793cc7961c7e22d2e1c04940aa2bf66f7132 100644 (file)
@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,each=tinymce.each,Cookie=tinymce.util.Cookie,lastExtID,explode=tinymce.explode;tinymce.ThemeManager.requireLangPack('advanced');tinymce.create('tinymce.themes.AdvancedTheme',{sizes:[8,10,12,14,18,24,36],controls:{bold:['bold_desc','Bold'],italic:['italic_desc','Italic'],underline:['underline_desc','Underline'],strikethrough:['striketrough_desc','Strikethrough'],justifyleft:['justifyleft_desc','JustifyLeft'],justifycenter:['justifycenter_desc','JustifyCenter'],justifyright:['justifyright_desc','JustifyRight'],justifyfull:['justifyfull_desc','JustifyFull'],bullist:['bullist_desc','InsertUnorderedList'],numlist:['numlist_desc','InsertOrderedList'],outdent:['outdent_desc','Outdent'],indent:['indent_desc','Indent'],cut:['cut_desc','Cut'],copy:['copy_desc','Copy'],paste:['paste_desc','Paste'],undo:['undo_desc','Undo'],redo:['redo_desc','Redo'],link:['link_desc','mceLink'],unlink:['unlink_desc','unlink'],image:['image_desc','mceImage'],cleanup:['cleanup_desc','mceCleanup'],help:['help_desc','mceHelp'],code:['code_desc','mceCodeEditor'],hr:['hr_desc','InsertHorizontalRule'],removeformat:['removeformat_desc','RemoveFormat'],sub:['sub_desc','subscript'],sup:['sup_desc','superscript'],forecolor:['forecolor_desc','ForeColor'],forecolorpicker:['forecolor_desc','mceForeColor'],backcolor:['backcolor_desc','HiliteColor'],backcolorpicker:['backcolor_desc','mceBackColor'],charmap:['charmap_desc','mceCharMap'],visualaid:['visualaid_desc','mceToggleVisualAid'],anchor:['anchor_desc','mceInsertAnchor'],newdocument:['newdocument_desc','mceNewDocument'],blockquote:['blockquote_desc','mceBlockQuote']},stateControls:['bold','italic','underline','strikethrough','bullist','numlist','justifyleft','justifycenter','justifyright','justifyfull','sub','sup','blockquote'],init:function(ed,url){var t=this,s,v,o;t.editor=ed;t.url=url;t.onResolveName=new tinymce.util.Dispatcher(this);t.settings=s=extend({theme_advanced_path:true,theme_advanced_toolbar_location:'bottom',theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:ed.settings.readonly},ed.settings);if(!s.font_size_style_values)s.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt";if(tinymce.is(s.theme_advanced_font_sizes,'string')){s.font_size_style_values=tinymce.explode(s.font_size_style_values);s.font_size_classes=tinymce.explode(s.font_size_classes||'');o={};ed.settings.theme_advanced_font_sizes=s.theme_advanced_font_sizes;each(ed.getParam('theme_advanced_font_sizes','','hash'),function(v,k){var cl;if(k==v&&v>=1&&v<=7){k=v+' ('+t.sizes[v-1]+'pt)';if(ed.settings.convert_fonts_to_spans){cl=s.font_size_classes[v-1];v=s.font_size_style_values[v-1]||(t.sizes[v-1]+'pt');}}if(/\s*\./.test(v))cl=v.replace(/\./g,'');o[k]=cl?{'class':cl}:{fontSize:v};});s.theme_advanced_font_sizes=o;}if((v=s.theme_advanced_path_location)&&v!='none')s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(s.editor_css?ed.documentBaseURI.toAbsolute(s.editor_css):url+"/skins/"+ed.settings.skin+"/ui.css");if(s.skin_variant)DOM.loadCSS(url+"/skins/"+ed.settings.skin+"/ui_"+s.skin_variant+".css");},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(e){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});if(c){each(ed.getParam('theme_advanced_styles','','hash'),function(v,k){if(v)c.add(t.editor.translate(k),v);});c.onPostRender.add(function(ed,n){if(!c.NativeListBox){Event.add(n.id+'_text','focus',t._importClasses,t);Event.add(n.id+'_text','mousedown',t._importClasses,t);Event.add(n.id+'_open','focus',t._importClasses,t);Event.add(n.id+'_open','mousedown',t._importClasses,t);}else Event.add(n.id,'focus',t._importClasses,t);});}return c;},_createFontSelect:function(){var c,t=this,ed=t.editor;c=ed.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});if(c){each(ed.getParam('theme_advanced_fonts',t.settings.theme_advanced_fonts,'hash'),function(v,k){c.add(ed.translate(k),v,{style:v.indexOf('dings')==-1?'font-family:'+v:''});});}return c;},_createFontSizeSelect:function(){var t=this,ed=t.editor,c,i=0,cl=[];c=ed.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',onselect:function(v){if(v.fontSize)ed.execCommand('FontSize',false,v.fontSize);else{each(t.settings.theme_advanced_font_sizes,function(v,k){if(v['class'])cl.push(v['class']);});ed.editorCommands._applyInlineStyle('span',{'class':v['class']},{check_classes:cl});}}});if(c){each(t.settings.theme_advanced_font_sizes,function(v,k){var fz=v.fontSize;if(fz>=1&&fz<=7)fz=t.sizes[parseInt(fz)-1]+'pt';c.add(k,v,{'style':'font-size:'+fz,'class':'mceFontSize'+(i++)+(' '+(v['class']||''))});});}return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});if(c){each(t.editor.getParam('theme_advanced_blockformats',t.settings.theme_advanced_blockformats,'hash'),function(v,k){c.add(t.editor.translate(k!=v?k:fmts[v]),v,{'class':'mce_formatPreview mce_'+v});});}return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;if(s.theme_advanced_default_foreground_color)o.default_color=s.theme_advanced_default_foreground_color;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;if(s.theme_advanced_default_background_color)o.default_color=s.theme_advanced_default_background_color;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('span',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'+(s.skin_variant?' '+ed.settings.skin+'Skin'+t._ufirst(s.skin_variant):'')});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=DOM.stdMode?sc.getElementsByTagName('tr'):sc.rows;DOM.addClass(nl[0],'mceFirst');DOM.addClass(nl[nl.length-1],'mceLast');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'mceFirst');DOM.addClass(n.childNodes[n.childNodes.length-1],'mceLast');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/,'$1'));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},'<!-- IE -->'),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Advanced theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},resizeBy:function(dw,dh){var e=DOM.get(this.editor.id+'_tbl');this.resizeTo(e.clientWidth+dw,e.clientHeight+dh);},resizeTo:function(w,h){var ed=this.editor,s=ed.settings,e=DOM.get(ed.id+'_tbl'),ifr=DOM.get(ed.id+'_ifr'),dh;w=Math.max(s.theme_advanced_resizing_min_width||100,w);h=Math.max(s.theme_advanced_resizing_min_height||100,h);w=Math.min(s.theme_advanced_resizing_max_width||0xFFFF,w);h=Math.min(s.theme_advanced_resizing_max_height||0xFFFF,h);dh=e.clientHeight-ifr.clientHeight;DOM.setStyle(ifr,'height',h-dh);DOM.setStyles(e,{width:w,height:h});},destroy:function(){var id=this.editor.id;Event.clear(id+'_resize');Event.clear(id+'_path_row');Event.clear(id+'_external_close');},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(s.readonly){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});return ic;}if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to,a;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each(explode(s.theme_advanced_containers||''),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(v.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:a=(s['theme_advanced_container_'+c+'_align']||da).toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc)+' '+a||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(explode(s.theme_advanced_disable),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(explode(v),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[],a;a=s.theme_advanced_toolbar_align.toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar '+a});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},'<!-- IE -->'));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus")},'<!-- IE -->'));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();'},'<!-- IE -->'));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':'&nbsp;');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'mceResize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,o.cw)+'px';c.style.height=Math.max(10,o.ch)+'px';DOM.get(ed.id+'_ifr').style.height=Math.max(10,parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(DOM.doc,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(DOM.doc,'mouseup',function(e){var ifr;Event.remove(DOM.doc,'mousemove',mf);Event.remove(DOM.doc,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,r.w+r.dx)+'px';c.style.height=Math.max(10,r.h+r.dy)+'px';ifr.style.height=Math.max(10,ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings,cl,fz,fn;if(s.readonly)return;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(ed.settings.convert_fonts_to_spans){ed.dom.getParent(n,function(n){if(n.nodeName==='SPAN'){if(!cl&&n.className)cl=n.className;if(!fz&&n.style.fontSize)fz=n.style.fontSize;if(!fn&&n.style.fontFamily)fn=n.style.fontFamily.replace(/[\"\']+/g,'').replace(/^([^,]+).*/,'$1').toLowerCase();}return false;});if(c=cm.get('fontselect')){c.select(function(v){return v.replace(/^([^,]+).*/,'$1').toLowerCase()==fn;});}if(c=cm.get('fontsizeselect')){c.select(function(v){if(v.fontSize&&v.fontSize===fz)return true;if(v['class']&&v['class']===cl)return true;});}}else{if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect')){v=ed.queryCommandValue('FontSize');c.select(function(iv){return iv.fontSize==v;});}}if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||n.nodeName==='BR'||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"javascript:;",onmousedown:"return false;",title:ti,'class':'mcePath_'+(de++)},na);if(p.hasChildNodes()){p.insertBefore(DOM.doc.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{color:t.fgColor,func:function(co){t.fgColor=co;t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{color:t.bgColor,func:function(co){t.bgColor=co;t.editor.execCommand('HiliteColor',false,co);}});},_ufirst:function(s){return s.substring(0,1).toUpperCase()+s.substring(1);}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}());
\ No newline at end of file
+(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":"&#160;");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce));
\ No newline at end of file
index e8eac798723be4e73b15298115f0960ec42cb24b..487227bc3c8207928f06bdb1943668d41275ad4b 100644 (file)
@@ -2,11 +2,10 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.image_title}</title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.image_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?ver=3211"></script>
-       <script type="text/javascript" src="js/image.js?ver=3211"></script>
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/form_utils.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/image.js?ver=3241-1141"></script>
 </head>
 <body id="image" style="display: none">
 <form onsubmit="ImageDialog.update();return false;" action="#">
 </head>
 <body id="image" style="display: none">
 <form onsubmit="ImageDialog.update();return false;" action="#">
@@ -20,7 +19,7 @@
                <div id="general_panel" class="panel current">
      <table border="0" cellpadding="4" cellspacing="0">
           <tr>
                <div id="general_panel" class="panel current">
      <table border="0" cellpadding="4" cellspacing="0">
           <tr>
-            <td nowrap="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
+            <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
             <td><table border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
                        <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>
                  </tr>
           <tr>
                        <td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>
                  </tr>
           <tr>
-            <td nowrap="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
+            <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
             <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
           </tr>
           <tr>
             <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
+            <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
             <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
                 <option value="">{#not_set}</option>
                 <option value="baseline">{#advanced_dlg.image_align_baseline}</option>
             <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
                 <option value="">{#not_set}</option>
                 <option value="baseline">{#advanced_dlg.image_align_baseline}</option>
               </select></td>
           </tr>
           <tr>
               </select></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
+            <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
             <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
               x
               <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
           </tr>
           <tr>
             <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
               x
               <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
+            <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
             <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
             <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
+            <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
             <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
             <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
+            <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
             <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
                  <tr>
             <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
                  <tr>
-            <td nowrap="nowrap"><label for="class_name">{#class_name}</label></td>
+            <td class="nowrap"><label for="class_name">{#class_name}</label></td>
             <td><input type="text" id="class_name" name="class_name" style="width: 140px" value="" /></td>
           </tr>
         </table>
             <td><input type="text" id="class_name" name="class_name" style="width: 140px" value="" /></td>
           </tr>
         </table>
index c8cb642a955e45052d4996471df3bc82edc0ea22..f46137c5939a51491d3196e6a332d87827b3a9ca 100644 (file)
@@ -53,6 +53,7 @@ var LinkDialog = {
 
                // Create new anchor elements
                if (e == null) {
 
                // Create new anchor elements
                if (e == null) {
+                       ed.getDoc().execCommand("unlink", false, null);
                        tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
 
                        tinymce.each(ed.dom.select("a"), function(n) {
                        tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
 
                        tinymce.each(ed.dom.select("a"), function(n) {
@@ -92,7 +93,7 @@ var LinkDialog = {
                if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
                        n.value = 'mailto:' + n.value;
 
                if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
                        n.value = 'mailto:' + n.value;
 
-               if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
+               if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
                        n.value = 'http://' + n.value;
        },
 
                        n.value = 'http://' + n.value;
        },
 
index a6235a38155612fcb9b2d4a3bd3fa547f265cdc6..81063ecbcdef6e1b22e325ae44fb5158107207a9 100644 (file)
@@ -2,7 +2,7 @@ tinyMCEPopup.requireLangPack();
 tinyMCEPopup.onInit.add(onLoadInit);
 
 function saveContent() {
 tinyMCEPopup.onInit.add(onLoadInit);
 
 function saveContent() {
-       tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value);
+       tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
        tinyMCEPopup.close();
 }
 
        tinyMCEPopup.close();
 }
 
@@ -13,7 +13,7 @@ function onLoadInit() {
        if (tinymce.isGecko)
                document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
 
        if (tinymce.isGecko)
                document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
 
-       document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent();
+       document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
 
        if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
                setWrap('soft');
 
        if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
                setWrap('soft');
index 97b583351ff098cb544a6b37831464ef4215c2de..09ba2a6f2a11cd81beeb0f10a219bb92548a231d 100644 (file)
@@ -2,12 +2,11 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.link_title}</title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.link_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?ver=3211"></script>
-       <script type="text/javascript" src="../../utils/validate.js?ver=3211"></script>
-       <script type="text/javascript" src="js/link.js?ver=3211"></script>
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/form_utils.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="../../utils/validate.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/link.js?ver=3241-1141"></script>
 </head>
 <body id="link" style="display: none">
 <form onsubmit="LinkDialog.update();return false;" action="#">
 </head>
 <body id="link" style="display: none">
 <form onsubmit="LinkDialog.update();return false;" action="#">
@@ -22,7 +21,7 @@
 
                <table border="0" cellpadding="4" cellspacing="0">
           <tr>
 
                <table border="0" cellpadding="4" cellspacing="0">
           <tr>
-            <td nowrap="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>
+            <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0"> 
                                  <tr> 
                                        <td><input id="href" name="href" type="text" class="mceFocus" value="http://" style="width: 200px" onfocus="try{this.select();}catch(e){}" /></td> 
             <td><table border="0" cellspacing="0" cellpadding="0"> 
                                  <tr> 
                                        <td><input id="href" name="href" type="text" class="mceFocus" value="http://" style="width: 200px" onfocus="try{this.select();}catch(e){}" /></td> 
@@ -39,7 +38,7 @@
                        <td><select id="target_list" name="target_list"></select></td>
                </tr>
           <tr>
                        <td><select id="target_list" name="target_list"></select></td>
                </tr>
           <tr>
-            <td nowrap="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>
+            <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>
             <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>
           </tr>
                        <tr>
             <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>
           </tr>
                        <tr>
index 8b21c0260492035730d93940f6edf12a103a92de..fa2df2541405221f052a8e45517202adf710be66 100644 (file)
@@ -19,6 +19,7 @@ td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
 textarea {resize:none;outline:none;}
 a:link, a:visited {color:black;}
 a:hover {color:#2B6FB6;}
 textarea {resize:none;outline:none;}
 a:link, a:visited {color:black;}
 a:hover {color:#2B6FB6;}
+.nowrap {white-space: nowrap}
 
 /* Forms */
 fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
 
 /* Forms */
 fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
@@ -47,6 +48,7 @@ padding-bottom:2px;
 #cancel {background:url(img/buttons.png) 0 0;}
 
 /* Browse */
 #cancel {background:url(img/buttons.png) 0 0;}
 
 /* Browse */
+a.pickcolor, a.browse {text-decoration:none}
 a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
 .mceOldBoxModel a.browse span {width:22px; height:20px;}
 a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
 a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
 .mceOldBoxModel a.browse span {width:22px; height:20px;}
 a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
index 4f6188294b3fff2b103fa303b067dd867f05a9b7..6b278b64f96a7751de84271ab82ad267bb157349 100644 (file)
@@ -19,6 +19,7 @@ td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
 textarea {resize:none;outline:none;}
 a:link, a:visited {color:black;}
 a:hover {color:#2B6FB6;}
 textarea {resize:none;outline:none;}
 a:link, a:visited {color:black;}
 a:hover {color:#2B6FB6;}
+.nowrap {white-space: nowrap}
 
 /* Forms */
 fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
 
 /* Forms */
 fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
@@ -47,6 +48,7 @@ padding-bottom:2px;
 #cancel {background:url(../default/img/buttons.png) 0 0;}
 
 /* Browse */
 #cancel {background:url(../default/img/buttons.png) 0 0;}
 
 /* Browse */
+a.pickcolor, a.browse {text-decoration:none}
 a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
 .mceOldBoxModel a.browse span {width:22px; height:20px;}
 a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
 a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
 .mceOldBoxModel a.browse span {width:22px; height:20px;}
 a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
index 0ae41557e526663918af3f0f629ca5cb3eacd8c3..aee70e7634c6359fbd3b73799ff45a925072a82a 100644 (file)
@@ -1,4 +1,4 @@
-body, td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
+/* default styles */
 body {background:#FFF;}
 body.mceForceColors {background:#FFF; color:#000;}
 h1 {font-size: 2em}
 body {background:#FFF;}
 body.mceForceColors {background:#FFF; color:#000;}
 h1 {font-size: 2em}
@@ -17,3 +17,76 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green}
 del {color:red; text-decoration:line-through}
 cite {border-bottom:1px dashed blue}
 acronym {border-bottom:1px dotted #CCC; cursor:help}
 del {color:red; text-decoration:line-through}
 cite {border-bottom:1px dashed blue}
 acronym {border-bottom:1px dotted #CCC; cursor:help}
+abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
+
+/* WordPress styles */
+html {
+       background-color: #fff;
+}
+
+.aligncenter,
+dl.aligncenter {
+       display: block;
+       margin-left: auto;
+       margin-right: auto;
+}
+
+.alignleft {
+       float: left;
+}
+
+.alignright {
+       float: right;
+}
+
+.wp-caption {
+       border: 1px solid #ddd;
+       text-align: center;
+       background-color: #f3f3f3;
+       padding-top: 4px;
+       margin: 10px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+}
+
+.wp-caption img {
+       margin: 0;
+       padding: 0;
+       border: 0 none;
+}
+
+.wp-caption-dd {
+       font-size: 11px;
+       line-height: 17px;
+       padding: 0 4px 5px;
+       margin: 0;
+}
+
+img.wpGallery {
+       border: 1px dotted #cc0000;
+       background: #ffffcc url("../../../../plugins/wpgallery/img/gallery.png") no-repeat scroll center center;
+       width: 99%;
+       height: 250px;
+}
+
+body.mceContentBody {
+       font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       padding: 0.6em;
+       margin: 0;
+}
+
+pre {
+       font: 12px/18px Consolas, Monaco, "Courier New", Courier, monospace;
+}
+
+td {
+       color: #000;
+       font-size: 11px;
+       margin: 8px;
+}
+
+.mceIEcenter {
+       text-align: center;
+}
index 7e86f0c17764d4af170ca61d657cdfb49693af87..7fe6b8dcc41a5f0489d2844842f1186755f567af 100644 (file)
@@ -11,6 +11,7 @@ td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
 textarea {resize:none;outline:none;}
 a:link, a:visited {color:black;}
 a:hover {color:#2B6FB6;}
 textarea {resize:none;outline:none;}
 a:link, a:visited {color:black;}
 a:hover {color:#2B6FB6;}
+.nowrap {white-space: nowrap}
 
 /* Forms */
 fieldset {margin:0; padding:4px; border:1px solid #dfdfdf; font-family:Verdana, Arial; font-size:10px;}
 
 /* Forms */
 fieldset {margin:0; padding:4px; border:1px solid #dfdfdf; font-family:Verdana, Arial; font-size:10px;}
@@ -35,6 +36,7 @@ input.checkbox {border:1px none #000000; background:transparent; vertical-align:
        width:94px; 
        height:24px;
        background:url(img/fade-butt.png) 0 0;
        width:94px; 
        height:24px;
        background:url(img/fade-butt.png) 0 0;
+       color:#000;
        cursor:pointer;
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
        cursor:pointer;
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
@@ -55,7 +57,7 @@ a.browse:hover span.disabled {border:1px solid white; background-color:transpare
 a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
 .mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
 a.pickcolor:hover span {background-color:#B2BBD0;}
 a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
 .mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
 a.pickcolor:hover span {background-color:#B2BBD0;}
-a.pickcolor:hover span.disabled {}
+a.pickcolor, a.browse {text-decoration:none}
 
 /* Charmap */
 table.charmap {border:1px solid #AAA; text-align:center}
 
 /* Charmap */
 table.charmap {border:1px solid #AAA; text-align:center}
index 0053a53480c77aa1373d6362e1a1370f0a7bada4..1cd2771a8c633f6bcfba42b24f6cfa2923112197 100644 (file)
@@ -142,13 +142,13 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
 }
 .wp_themeSkin table.mceSplitButton td {
        padding: 2px;
 }
 .wp_themeSkin table.mceSplitButton td {
        padding: 2px;
+       background-image: url(img/butt2.png);
+       background-position: left top;
+       background-repeat: repeat-x;
 }
 .wp_themeSkin .mceSplitButton a.mceAction {
        height:20px;
        width:20px;
 }
 .wp_themeSkin .mceSplitButton a.mceAction {
        height:20px;
        width:20px;
-       background-image: url(img/butt2.png);
-       background-position: left top;
-       background-repeat: repeat-x;
        padding: 1px 2px;
 }
 .wp_themeSkin .mceSplitButton span.mceAction {
        padding: 1px 2px;
 }
 .wp_themeSkin .mceSplitButton span.mceAction {
@@ -158,31 +158,13 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
 .wp_themeSkin .mceSplitButton a.mceOpen {
        width:10px;
        height:20px;
 .wp_themeSkin .mceSplitButton a.mceOpen {
        width:10px;
        height:20px;
-       border-collapse:separate;
-       background-image: url(img/butt2.png);
-       background-position: left top;
-       background-repeat: repeat-x;
-       padding: 1px;
-       border-left: 0 none !important;
-}
-.wp_themeSkin .mceSplitButton span.mceOpen {
-       width:10px; 
        background-image: url(img/down_arrow.gif);
        background-image: url(img/down_arrow.gif);
-       background-position: 0px 1px;
+       background-position: 1px 2px;
        background-repeat: no-repeat;
        background-repeat: no-repeat;
-       border-collapse:separate;
+       padding: 1px;
        border-left: 0 none !important;
 }
        border-left: 0 none !important;
 }
-.wp_themeSkin .mceSplitButton a.mceOpen:hover,
-.wp_themeSkin .mceSplitButtonSelected a.mceOpen,
-.wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
-.wp_themeSkin .mceSplitButton a.mceAction:hover {
-       background-image: none;
-}
-.wp_themeSkin table.mceSplitButtonEnabled:hover span.mceOpen, 
-.wp_themeSkin .mceSplitButtonHover span.mceOpen, 
-.wp_themeSkin .mceSplitButtonSelected span.mceOpen {
-}
+.wp_themeSkin .mceSplitButton span.mceOpen {display:none}
 .wp_themeSkin .mceSplitButtonDisabled .mceAction {
        opacity:0.3; filter:alpha(opacity=30);
 }
 .wp_themeSkin .mceSplitButtonDisabled .mceAction {
        opacity:0.3; filter:alpha(opacity=30);
 }
index bf657eef0dff21d4bd200d64e0672dc04d3fdd0b..41d7ed4b38c87a6fecbc68888dd2aa1ab40e22fd 100644 (file)
@@ -2,9 +2,8 @@
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>{#advanced_dlg.code_title}</title>
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>{#advanced_dlg.code_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3211"></script>
-       <script type="text/javascript" src="js/source_editor.js?ver=3211"></script>
-       <base target="_self" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=3241-1141"></script>
+       <script type="text/javascript" src="js/source_editor.js?ver=3241-1141"></script>
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
        <form name="source" onsubmit="saveContent();return false;" action="#">
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
        <form name="source" onsubmit="saveContent();return false;" action="#">
index 55aba6e3b2231bfa572b506656573f989387f535..5e2fe090123a7152fd4dd5224dac8cf17d3674a9 100644 (file)
@@ -1 +1 @@
-var tinymce={majorVersion:'3',minorVersion:'2.1.1',releaseDate:'2008-11-27',_init:function(){var t=this,d=document,w=window,na=navigator,ua=na.userAgent,i,nl,n,base,p,v;t.isOpera=w.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!w.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(na.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;t.isAir=/adobeair/i.test(ua);if(w.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;t.query=tinyMCEPreInit.query;return;}t.suffix='';nl=d.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(v=nl[i].href){if(/^https?:\/\/[^\/]+$/.test(v))v+='/';base=v?v.match(/.*\//)[0]:'';}}function getBase(n){if(n.src&&/tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)){if(/_(src|dev)\.js/g.test(n.src))t.suffix='_src';if((p=n.src.indexOf('?'))!=-1)t.query=n.src.substring(p+1);t.baseURL=n.src.substring(0,n.src.lastIndexOf('/'));if(base&&t.baseURL.indexOf('://')==-1)t.baseURL=base+t.baseURL;return t.baseURL;}return null;};nl=d.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}n=d.getElementsByTagName('head')[0];if(n){nl=n.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}}return;},is:function(o,t){var n=typeof(o);if(!t)return n!='undefined';if(t=='array'&&(o instanceof Array))return true;return n==t;},each:function(o,cb,s){var n,l;if(!o)return 0;s=s||o;if(typeof(o.length)!='undefined'){for(n=0,l=o.length;n<l;n++){if(cb.call(s,o[n],n,o)===false)return 0;}}else{for(n in o){if(o.hasOwnProperty(n)){if(cb.call(s,o[n],n,o)===false)return 0;}}}return 1;},map:function(a,f){var o=[];tinymce.each(a,function(v){o.push(f(v));});return o;},grep:function(a,f){var o=[];tinymce.each(a,function(v){if(!f||f(v))o.push(v);});return o;},inArray:function(a,v){var i,l;if(a){for(i=0,l=a.length;i<l;i++){if(a[i]===v)return i;}}return-1;},extend:function(o,e){var i,a=arguments;for(i=1;i<a.length;i++){e=a[i];tinymce.each(e,function(v,n){if(typeof(v)!=='undefined')o[n]=v;});}return o;},trim:function(s){return(s?''+s:'').replace(/^\s*|\s*$/g,'');},create:function(s,p){var t=this,sp,ns,cn,scn,c,de=0;s=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);cn=s[3].match(/(^|\.)(\w+)$/i)[2];ns=t.createNS(s[3].replace(/\.\w+$/,''));if(ns[cn])return;if(s[2]=='static'){ns[cn]=p;if(this.onCreate)this.onCreate(s[2],s[3],ns[cn]);return;}if(!p[cn]){p[cn]=function(){};de=1;}ns[cn]=p[cn];t.extend(ns[cn].prototype,p);if(s[5]){sp=t.resolve(s[5]).prototype;scn=s[5].match(/\.(\w+)$/i)[1];c=ns[cn];if(de){ns[cn]=function(){return sp[scn].apply(this,arguments);};}else{ns[cn]=function(){this.parent=sp[scn];return c.apply(this,arguments);};}ns[cn].prototype[cn]=ns[cn];t.each(sp,function(f,n){ns[cn].prototype[n]=sp[n];});t.each(p,function(f,n){if(sp[n]){ns[cn].prototype[n]=function(){this.parent=sp[n];return f.apply(this,arguments);};}else{if(n!=cn)ns[cn].prototype[n]=f;}});}t.each(p['static'],function(f,n){ns[cn][n]=f;});if(this.onCreate)this.onCreate(s[2],s[3],ns[cn].prototype);},walk:function(o,f,n,s){s=s||this;if(o){if(n)o=o[n];tinymce.each(o,function(o,i){if(f.call(s,o,i,n)===false)return false;tinymce.walk(o,f,n,s);});}},createNS:function(n,o){var i,v;o=o||window;n=n.split('.');for(i=0;i<n.length;i++){v=n[i];if(!o[v])o[v]={};o=o[v];}return o;},resolve:function(n,o){var i,l;o=o||window;n=n.split('.');for(i=0,l=n.length;i<l;i++){o=o[n[i]];if(!o)break;}return o;},addUnload:function(f,s){var t=this,w=window;f={func:f,scope:s||this};if(!t.unloads){function unload(){var li=t.unloads,o,n;if(li){for(n in li){o=li[n];if(o&&o.func)o.func.call(o.scope,1);}if(w.detachEvent){w.detachEvent('onbeforeunload',fakeUnload);w.detachEvent('onunload',unload);}else if(w.removeEventListener)w.removeEventListener('unload',unload,false);t.unloads=o=li=w=unload=null;if(window.CollectGarbage)window.CollectGarbage();}};function fakeUnload(){var d=document;if(d.readyState=='interactive'){function stop(){d.detachEvent('onstop',stop);unload();d=null;};d.attachEvent('onstop',stop);window.setTimeout(function(){d.detachEvent('onstop',stop);},0);}};if(w.attachEvent){w.attachEvent('onunload',unload);w.attachEvent('onbeforeunload',fakeUnload);}else if(w.addEventListener)w.addEventListener('unload',unload,false);t.unloads=[f];}else t.unloads.push(f);return f;},removeUnload:function(f){var u=this.unloads,r=null;tinymce.each(u,function(o,i){if(o&&o.func==f){u.splice(i,1);r=f;return false;}});return r;},explode:function(s,d){return s?tinymce.map(s.split(d||','),tinymce.trim):s;},_addVer:function(u){var v;if(!this.query)return u;v=(u.indexOf('?')==-1?'?':'&')+this.query;if(u.indexOf('#')==-1)return u+v;return u.replace('#',v+'#');}};window.tinymce=tinymce;tinymce._init();tinymce.create('tinymce.util.Dispatcher',{scope:null,listeners:null,Dispatcher:function(s){this.scope=s||this;this.listeners=[];},add:function(cb,s){this.listeners.push({cb:cb,scope:s||this.scope});return cb;},addToTop:function(cb,s){this.listeners.unshift({cb:cb,scope:s||this.scope});return cb;},remove:function(cb){var l=this.listeners,o=null;tinymce.each(l,function(c,i){if(cb==c.cb){o=cb;l.splice(i,1);return false;}});return o;},dispatch:function(){var s,a=arguments,i,li=this.listeners,c;for(i=0;i<li.length;i++){c=li[i];s=c.cb.apply(c.scope,a);if(s===false)break;}return s;}});(function(){var each=tinymce.each;tinymce.create('tinymce.util.URI',{URI:function(u,s){var t=this,o,a,b;s=t.settings=s||{};if(/^(mailto|news|javascript|about):/i.test(u)||/^\s*#/.test(u)){t.source=u;return;}if(u.indexOf('/')===0&&u.indexOf('//')!==0)u=(s.base_uri?s.base_uri.protocol||'http':'http')+'://mce_host'+u;if(u.indexOf(':/')===-1&&u.indexOf('//')!==0)u=(s.base_uri.protocol||'http')+'://mce_host'+t.toAbsPath(s.base_uri.path,u);u=u.replace(/@@/g,'(mce_at)');u=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(v,i){var s=u[i];if(s)s=s.replace(/\(mce_at\)/g,'@@');t[v]=s;});if(b=s.base_uri){if(!t.protocol)t.protocol=b.protocol;if(!t.userInfo)t.userInfo=b.userInfo;if(!t.port&&t.host=='mce_host')t.port=b.port;if(!t.host||t.host=='mce_host')t.host=b.host;t.source='';}},setPath:function(p){var t=this;p=/^(.*?)\/?(\w+)?$/.exec(p);t.path=p[0];t.directory=p[1];t.file=p[2];t.source='';t.getURI();},toRelative:function(u){var t=this,o;if(u==="./")return u;u=new tinymce.util.URI(u,{base_uri:t});if((u.host!='mce_host'&&t.host!=u.host&&u.host)||t.port!=u.port||t.protocol!=u.protocol)return u.getURI();o=t.toRelPath(t.path,u.path);if(u.query)o+='?'+u.query;if(u.anchor)o+='#'+u.anchor;return o;},toAbsolute:function(u,nh){var u=new tinymce.util.URI(u,{base_uri:this});return u.getURI(this.host==u.host?nh:0);},toRelPath:function(base,path){var items,bp=0,out='',i,l;base=base.substring(0,base.lastIndexOf('/'));base=base.split('/');items=path.split('/');if(base.length>=items.length){for(i=0,l=base.length;i<l;i++){if(i>=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length<items.length){for(i=0,l=items.length;i<l;i++){if(i>=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0,l=base.length-(bp-1);i<l;i++)out+="../";for(i=bp-1,l=items.length;i<l;i++){if(i!=bp-1)out+="/"+items[i];else out+=items[i];}return out;},toAbsPath:function(base,path){var i,nb=0,o=[];base=base.split('/');path=path.split('/');each(base,function(k){if(k)o.push(k);});base=o;for(i=path.length-1,o=[];i>=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i<o.length;i++)v+=(i>0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);function ready(){if(!o.async||x.readyState==4||c++>10000){if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}else w.setTimeout(ready,10);};if(!o.async)return ready();t=w.setTimeout(ready,10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,sr;e=t.get(e);p=t.getPos(e);sr=t.getSize(e);return{x:p.x,y:p.y,w:sr.w,h:sr.h};},getSize:function(e){var t=this,w,h;e=t.get(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName.toUpperCase()==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n,xp;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(!t.selectorRe)t.selectorRe=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;;if(tinymce.isAir){each(tinymce.explode(pa),function(v){if(!(xp=t.cache[v])){xp='';each(v.split(' '),function(v){v=t.selectorRe.exec(v);xp+=v[1]?'//'+v[1]:'//*';if(v[2])xp+="[@id='"+v[2]+"']";if(v[3]){each(v[3].split('.'),function(n){xp+="[@class = '"+n+"' or contains(concat(' ', @class, ' '), ' "+n+" ')]";});}});t.cache[v]=xp;}xp=t.doc.evaluate(xp,s,null,4,null);while(n=xp.iterateNext())o.push(n);});return o;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i<l;i++)o.push(x[i]);return o;}if(t.elmClassPattern.test(pa)){pl=t.elmClassPattern.exec(pa);x=get(s,pl[1]||'*');c=' '+pl[2]+' ';for(i=0,l=x.length;i<l;i++){n=x[i];if(n.className&&(' '+n.className+' ').indexOf(c)!==-1)o.push(n);}return o;}function collect(n){if(!n.mce_save){n.mce_save=1;o.push(n);}};function collectIE(n){if(!n.getAttribute('mce_save')){n.setAttribute('mce_save','1');o.push(n);}};function find(n,f,r){var i,l,nl=get(r,n);for(i=0,l=nl.length;i<l;i++)f(nl[i]);};each(pa.split(','),function(v,i){v=tinymce.trim(v);if(t.elmPattern.test(v)){each(get(s,v),function(n){collect(n);});return;}if(t.elmClassPattern.test(v)){x=t.elmClassPattern.exec(v);each(get(s,x[1]),function(n){if(t.hasClass(n,x[2]))collect(n);});return;}if(!(cs=t.cache[pa])){cs='x=(function(cf, s) {';pl=v.split(' ');each(pl,function(v){var p=t.selectorRe.exec(v);p[1]=p[1]||'*';cs+='find("'+p[1]+'", function(n) {';if(p[2])cs+='if (n.id !== "'+p[2]+'") return;';if(p[3]){cs+='var c = " " + n.className + " ";';cs+='if (';c='';each(p[3].split('.'),function(v){if(v)c+=(c?'||':'')+'c.indexOf(" '+v+' ") === -1';});cs+=c+') return;';}});cs+='cf(n);';for(i=pl.length-1;i>=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;t.setAttribs(e,a);if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'</'+n+'>';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(!e||!n)return;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(!is(v,'string')){each(v,function(v,n){t.setStyle(e,n,v);});return;}if(s.keep_values){if(v&&!t._isRes(v))e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;case"shape":e.setAttribute('mce_style',v);break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv='';if(/^(src|href|style|coords|shape)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}if(isIE&&t.props[n]){v=e[t.props[n]];v=v&&v.nodeValue?v.nodeValue:v;}if(!v)v=e.getAttribute(n,2);if(n==='style'){v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&!t._isRes(v))e.setAttribute('mce_style',v);}}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0'||v===20)v='';break;case'width':case'height':case'vspace':case'checked':case'disabled':case'readonly':if(v===0)v='';break;case'hspace':if(v===-1)v='';break;case'maxlength':case'tabindex':if(v===32768||v===2147483647||v==='32768')v='';break;case'compact':case'noshade':case'nowrap':if(v===65535)return n;return dv;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v!==undefined&&v!==null&&v!=='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};st=st.replace(/&(#?[a-z0-9]+);/g,'&$1_MCE_SEMI_');each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/_MCE_SEMI_/g,';');v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null)+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){if(tinymce.isGecko&&k.indexOf('-moz-')===0)return;switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return!e||e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='<br />'+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='<br />'+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/<p ([^>]+)>|<p>/g,'<div $1 mce_tmp="1">');h=h.replace(/<\/p>/g,'</div>');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x<n.childNodes.length;x++)p.appendChild(n.childNodes[x].cloneNode(true));n.swapNode(p);}}}}}else e.innerHTML=h;return h;});},processHTML:function(h){var t=this,s=t.settings;if(!s.process_html)return h;if(tinymce.isGecko){h=h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|<em( [^>]+)>/gi,'<$1i$2>');}else if(isIE){h=h.replace(/&apos;/g,'&#39;');h=h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,'');}h=h.replace(/<a( )([^>]+)\/>|<a\/>/gi,'<a$1$2></a>');if(s.keep_values){if(/<script|style/.test(h)){function trim(s){s=s.replace(/(<!--\[CDATA\[|\]\]-->)/g,'\n');s=s.replace(/^[\r\n]*|[\r\n]*$/g,'');s=s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,'');s=s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,'');return s;};h=h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g,function(v,a,b){b=trim(b);if(!a)a=' type="text/javascript"';if(b)b='<!--\n'+b+'\n// -->';return'<mce:script'+a+'>'+b+'</mce:script>';});h=h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g,function(v,a,b){b=trim(b);return'<mce:style'+a+'><!--\n'+b+'\n--></mce:style><style'+a+' mce_bogus="1">'+b+'</style>';});}h=h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,'<!--[CDATA[$1]]-->');h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e,n,v;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;n=e.firstChild;v='';if(n){do{v+=n.nodeValue;}while(n.nextSibling);}return v||s;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.get(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;if(e.domLoaded)return;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');DOM.get("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){Event._pageInit();DOM.get("__ie_onload").onreadystatechange=null;}};}else{Event._add(window,'DOMContentLoaded',Event._pageInit,Event);if(isIE||isWebKit){t=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(t);Event._pageInit();}},10);}}}});Event=tinymce.dom.Event;Event._wait();tinymce.addUnload(Event._unload);})();(function(){var each=tinymce.each;tinymce.create('tinymce.dom.Element',{Element:function(id,s){var t=this,dom,el;s=s||{};t.id=id;t.dom=dom=s.dom||tinymce.DOM;t.settings=s;if(!tinymce.isIE)el=t.dom.get(t.id);each(['getPos','getRect','getParent','add','setStyle','getStyle','setStyles','setAttrib','setAttribs','getAttrib','addClass','removeClass','hasClass','getOuterHTML','setOuterHTML','remove','show','hide','isHidden','setHTML','get'],function(k){t[k]=function(){var a=arguments,o;if(tinymce.isOpera){a=[id];each(arguments,function(v){a.push(v);});}else Array.prototype.unshift.call(a,el||id);o=dom[k].apply(dom,a);t.update(k);return o;};});},on:function(n,f,s){return tinymce.dom.Event.add(this.id,n,f,s);},getXY:function(){return{x:parseInt(this.getStyle('left')),y:parseInt(this.getStyle('top'))};},getSize:function(){var n=this.dom.get(this.id);return{w:parseInt(this.getStyle('width')||n.clientWidth),h:parseInt(this.getStyle('height')||n.clientHeight)};},moveTo:function(x,y){this.setStyles({left:x,top:y});},moveBy:function(x,y){var p=this.getXY();this.moveTo(p.x+x,p.y+y);},resizeTo:function(w,h){this.setStyles({width:w,height:h});},resizeBy:function(w,h){var s=this.getSize();this.resizeTo(s.w+w,s.h+h);},update:function(k){var t=this,b,dom=t.dom;if(tinymce.isIE6&&t.settings.blocker){k=k||'';if(k.indexOf('get')===0||k.indexOf('has')===0||k.indexOf('is')===0)return;if(k=='remove'){dom.remove(t.blocker);return;}if(!t.blocker){t.blocker=dom.uniqueId();b=dom.add(t.settings.container||dom.getRoot(),'iframe',{id:t.blocker,style:'position:absolute;',frameBorder:0,src:'javascript:""'});dom.setStyle(b,'opacity',0);}else b=dom.get(t.blocker);dom.setStyle(b,'left',t.getStyle('left',1));dom.setStyle(b,'top',t.getStyle('top',1));dom.setStyle(b,'width',t.getStyle('width',1));dom.setStyle(b,'height',t.getStyle('height',1));dom.setStyle(b,'display',t.getStyle('display',1));dom.setStyle(b,'zIndex',parseInt(t.getStyle('zIndex',1)||0)-1);}}});})();(function(){function trimNl(s){return s.replace(/[\n\r]+/g,'');};var is=tinymce.is,isIE=tinymce.isIE,each=tinymce.each;tinymce.create('tinymce.dom.Selection',{Selection:function(dom,win,serializer){var t=this;t.dom=dom;t.win=win;t.serializer=serializer;each(['onBeforeSetContent','onBeforeGetContent','onSetContent','onGetContent'],function(e){t[e]=new tinymce.util.Dispatcher(t);});tinymce.addUnload(t.destroy,t);},getContent:function(s){var t=this,r=t.getRng(),e=t.dom.create("body"),se=t.getSel(),wb,wa,n;s=s||{};wb=wa='';s.get=true;s.format=s.format||'html';t.onBeforeGetContent.dispatch(t,s);if(s.format=='text')return t.isCollapsed()?'':(r.text||(se.toString?se.toString():''));if(r.cloneContents){n=r.cloneContents();if(n)e.appendChild(n);}else if(is(r.item)||is(r.htmlText))e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();if(/^\s/.test(e.innerHTML))wb=' ';if(/\s+$/.test(e.innerHTML))wa=' ';s.getInner=true;s.content=t.isCollapsed()?'':wb+t.serializer.serialize(e,s)+wa;t.onGetContent.dispatch(t,s);return s.content;},setContent:function(h,s){var t=this,r=t.getRng(),c,d=t.win.document;s=s||{format:'html'};s.set=true;h=s.content=t.dom.processHTML(h);t.onBeforeSetContent.dispatch(t,s);h=s.content;if(r.insertNode){h+='<span id="__caret">_</span>';r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h));c=t.dom.get('__caret');r=d.createRange();r.setStartBefore(c);r.setEndAfter(c);t.setRng(r);d.execCommand('Delete',false,null);t.dom.remove('__caret');}else{if(r.item){d.execCommand('Delete',false,null);r=t.getRng();}r.pasteHTML(h);}t.onSetContent.dispatch(t,s);},getStart:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(1);e=r.parentElement();if(e&&e.nodeName=='BODY')return e.firstChild;return e;}else{e=r.startContainer;if(e.nodeName=='BODY')return e.firstChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getEnd:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(0);e=r.parentElement();if(e&&e.nodeName=='BODY')return e.lastChild;return e;}else{e=r.endContainer;if(e.nodeName=='BODY')return e.lastChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getBookmark:function(si){var t=this,r=t.getRng(),tr,sx,sy,vp=t.dom.getViewPort(t.win),e,sp,bp,le,c=-0xFFFFFF,s,ro=t.dom.getRoot(),wb=0,wa=0,nv;sx=vp.x;sy=vp.y;if(si=='simple')return{rng:r,scrollX:sx,scrollY:sy};if(isIE){if(r.item){e=r.item(0);each(t.dom.select(e.nodeName),function(n,i){if(e==n){sp=i;return false;}});return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy};}tr=t.dom.doc.body.createTextRange();tr.moveToElementText(ro);tr.collapse(true);bp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(true);sp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(false);le=Math.abs(tr.move('character',c))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy};}e=t.getNode();s=t.getSel();if(!s)return null;if(e&&e.nodeName=='IMG'){return{scrollX:sx,scrollY:sy};}function getPos(r,sn,en){var w=t.dom.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d;}p+=trimNl(n.nodeValue||'').length;}return null;};if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=getPos(ro,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};trimNl(s.anchorNode.nodeValue||'').replace(/^\s+/,function(a){wb=a.length;});return{start:Math.max(e.start+s.anchorOffset-wb,0),end:Math.max(e.end+s.focusOffset-wb,0),scrollX:sx,scrollY:sy,beg:s.anchorOffset-wb==0};}else{e=getPos(ro,r.startContainer,r.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:Math.max(e.start+r.startOffset-wb,0),end:Math.max(e.end+r.endOffset-wa,0),scrollX:sx,scrollY:sy,beg:r.startOffset-wb==0};}},moveToBookmark:function(b){var t=this,r=t.getRng(),s=t.getSel(),ro=t.dom.getRoot(),sd,nvl,nv;function getPos(r,sp,ep){var w=t.dom.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={},o,v,wa,wb;while((n=w.nextNode())!=null){wa=wb=0;nv=n.nodeValue||'';nvl=trimNl(nv).length;p+=nvl;if(p>=sp&&!d.startNode){o=sp-(p-nvl);if(b.beg&&o>=nvl)continue;d.startNode=n;d.startOffset=o+wb;}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-nvl)+wb;return d;}}return null;};if(!b)return false;t.win.scrollTo(b.scrollX,b.scrollY);if(isIE){if(r=b.rng){try{r.select();}catch(ex){}return true;}t.win.focus();if(b.tag){r=ro.createControlRange();each(t.dom.select(b.tag),function(n,i){if(i==b.index)r.addElement(n);});}else{try{if(b.start<0)return true;r=s.createRange();r.moveToElementText(ro);r.collapse(true);r.moveStart('character',b.start);r.moveEnd('character',b.length);}catch(ex2){return true;}}try{r.select();}catch(ex){}return true;}if(!s)return false;if(b.rng){s.removeAllRanges();s.addRange(b.rng);}else{if(is(b.start)&&is(b.end)){try{sd=getPos(ro,b.start,b.end);if(sd){r=t.dom.doc.createRange();r.setStart(sd.startNode,sd.startOffset);r.setEnd(sd.endNode,sd.endOffset);s.removeAllRanges();s.addRange(r);}if(!tinymce.isOpera)t.win.focus();}catch(ex){}}}},select:function(n,c){var t=this,r=t.getRng(),s=t.getSel(),b,fn,ln,d=t.win.document;function first(n){return n?d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode():null;};function last(n){var c,o,w;if(!n)return null;w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while(c=w.nextNode())o=c;return o;};if(isIE){try{b=d.body;if(/^(IMG|TABLE)$/.test(n.nodeName)){r=b.createControlRange();r.addElement(n);}else{r=b.createTextRange();r.moveToElementText(n);}r.select();}catch(ex){}}else{if(c){fn=first(n);ln=last(n);if(fn&&ln){r=d.createRange();r.setStart(fn,0);r.setEnd(ln,ln.nodeValue.length);}else r.selectNode(n);}else r.selectNode(n);t.setRng(r);}return n;},isCollapsed:function(){var t=this,r=t.getRng(),s=t.getSel();if(!r||r.item)return false;return!s||r.boundingWidth==0||r.collapsed;},collapse:function(b){var t=this,r=t.getRng(),n;if(r.item){n=r.item(0);r=this.win.document.body.createTextRange();r.moveToElementText(n);}r.collapse(!!b);t.setRng(r);},getSel:function(){var t=this,w=this.win;return w.getSelection?w.getSelection():w.document.selection;},getRng:function(){var t=this,s=t.getSel(),r;try{if(s)r=s.rangeCount>0?s.getRangeAt(0):(s.createRange?s.createRange():t.win.document.createRange());}catch(ex){}if(!r)r=isIE?t.win.document.body.createTextRange():t.win.document.createRange();return r;},setRng:function(r){var s;if(!isIE){s=this.getSel();if(s){s.removeAllRanges();s.addRange(r);}}else{try{r.select();}catch(ex){}}},setNode:function(n){var t=this;t.setContent(t.dom.getOuterHTML(n));return n;},getNode:function(){var t=this,r=t.getRng(),s=t.getSel(),e;if(!isIE){if(!r)return t.dom.getRoot();e=r.commonAncestorContainer;if(!r.collapsed){if(tinymce.isWebKit&&s.anchorNode&&s.anchorNode.nodeType==1)return s.anchorNode.childNodes[s.anchorOffset];if(r.startContainer==r.endContainer){if(r.startOffset-r.endOffset<2){if(r.startContainer.hasChildNodes())e=r.startContainer.childNodes[r.startOffset];}}}return t.dom.getParent(e,function(n){return n.nodeType==1;});}return r.item?r.item(0):r.parentElement();},destroy:function(s){var t=this;t.win=null;if(!s)tinymce.removeUnload(t.destroy);}});})();(function(){tinymce.create('tinymce.dom.XMLWriter',{node:null,XMLWriter:function(s){function getXML(){var i=document.implementation;if(!i||!i.createDocument){try{return new ActiveXObject('MSXML2.DOMDocument');}catch(ex){}try{return new ActiveXObject('Microsoft.XmlDom');}catch(ex){}}else return i.createDocument('','',null);};this.doc=getXML();this.valid=tinymce.isOpera||tinymce.isWebKit;this.reset();},reset:function(){var t=this,d=t.doc;if(d.firstChild)d.removeChild(d.firstChild);t.node=d.appendChild(d.createElement("html"));},writeStartElement:function(n){var t=this;t.node=t.node.appendChild(t.doc.createElement(n));},writeAttribute:function(n,v){if(this.valid)v=v.replace(/>/g,'%MCGT%');this.node.setAttribute(n,v);},writeEndElement:function(){this.node=this.node.parentNode;},writeFullEndElement:function(){var t=this,n=t.node;n.appendChild(t.doc.createTextNode(""));t.node=n.parentNode;},writeText:function(v){if(this.valid)v=v.replace(/>/g,'%MCGT%');this.node.appendChild(this.doc.createTextNode(v));},writeCDATA:function(v){this.node.appendChild(this.doc.createCDATA(v));},writeComment:function(v){if(tinymce.isIE)v=v.replace(/^\-|\-$/g,' ');this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g,' ')));},getContent:function(){var h;h=this.doc.xml||new XMLSerializer().serializeToString(this.doc);h=h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,'');h=h.replace(/ ?\/>/g,' />');if(this.valid)h=h.replace(/\%MCGT%/g,'&gt;');return h;}});})();(function(){tinymce.create('tinymce.dom.StringWriter',{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(s){this.settings=tinymce.extend({indent_char:' ',indentation:1},s);this.reset();},reset:function(){this.indent='';this.str="";this.tags=[];this.count=0;},writeStartElement:function(n){this._writeAttributesEnd();this.writeRaw('<'+n);this.tags.push(n);this.inAttr=true;this.count++;this.elementCount=this.count;},writeAttribute:function(n,v){var t=this;t.writeRaw(" "+t.encode(n)+'="'+t.encode(v)+'"');},writeEndElement:function(){var n;if(this.tags.length>0){n=this.tags.pop();if(this._writeAttributesEnd(1))this.writeRaw('</'+n+'>');if(this.settings.indentation>0)this.writeRaw('\n');}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw('</'+this.tags.pop()+'>');if(this.settings.indentation>0)this.writeRaw('\n');}},writeText:function(v){this._writeAttributesEnd();this.writeRaw(this.encode(v));this.count++;},writeCDATA:function(v){this._writeAttributesEnd();this.writeRaw('<![CDATA['+v+']]>');this.count++;},writeComment:function(v){this._writeAttributesEnd();this.writeRaw('<!-- '+v+'-->');this.count++;},writeRaw:function(v){this.str+=v;},encode:function(s){return s.replace(/[<>&"]/g,function(v){switch(v){case'<':return'&lt;';case'>':return'&gt;';case'&':return'&amp;';case'"':return'&quot;';}return v;});},getContent:function(){return this.str;},_writeAttributesEnd:function(s){if(!this.inAttr)return;this.inAttr=false;if(s&&this.elementCount==this.count){this.writeRaw(' />');return false;}this.writeRaw('>');return true;}});})();(function(){var extend=tinymce.extend,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher,isIE=tinymce.isIE,isGecko=tinymce.isGecko;function getIEAtts(n){var o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;};function wildcardToRE(s){return s.replace(/([?+*])/g,'.$1');};tinymce.create('tinymce.dom.Serializer',{Serializer:function(s){var t=this;t.key=0;t.onPreProcess=new Dispatcher(t);t.onPostProcess=new Dispatcher(t);if(tinymce.relaxedDomain&&tinymce.isGecko){t.writer=new tinymce.dom.StringWriter();}else{try{t.writer=new tinymce.dom.XMLWriter();}catch(ex){t.writer=new tinymce.dom.StringWriter();}}t.settings=s=extend({dom:tinymce.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_)/,closed:/(br|hr|input|meta|img|link|param)/,entity_encoding:'named',entities:'160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',bool_attrs:/(checked|disabled|readonly|selected|nowrap)/,valid_elements:'*[*]',extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:0,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:'simple',indent_char:'\t',indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:'xhtml'},s);t.dom=s.dom;if(s.remove_redundant_brs){t.onPostProcess.add(function(se,o){o.content=o.content.replace(/<br \/>(\s*<\/li>)/g,'$1');});}if(s.element_format=='html'){t.onPostProcess.add(function(se,o){o.content=o.content.replace(/<([^>]+) \/>/g,'<$1>');});}if(s.fix_list_elements){t.onPreProcess.add(function(se,o){var nl,x,a=['ol','ul'],i,n,p,r=/^(OL|UL)$/,np;function prevNode(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e;}}return null;};for(x=0;x<a.length;x++){nl=t.dom.select(a[x],o.node);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=prevNode(n,'LI');if(!np){np=t.dom.create('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild);}else np.appendChild(n);}}}});}if(s.fix_table_elements){t.onPreProcess.add(function(se,o){each(t.dom.select('table',o.node),function(e){var pa=t.dom.getParent(e,'H1,H2,H3,H4,H5,H6,P'),pa2,n,tm,pl=[],i,ns;if(pa){pa2=pa.cloneNode(false);pl.push(e);for(n=e;n=n.parentNode;){pl.push(n);if(n==pa)break;}tm=pa2;for(i=pl.length-1;i>=0;i--){if(i==pl.length-1){while(ns=pl[i-1].nextSibling)tm.appendChild(ns.parentNode.removeChild(ns));}else{n=pl[i].cloneNode(false);if(i!=0){while(ns=pl[i-1].nextSibling)n.appendChild(ns.parentNode.removeChild(ns));}tm=tm.appendChild(n);}}e=t.dom.insertAfter(e.parentNode.removeChild(e),pa);t.dom.insertAfter(e,pa);t.dom.insertAfter(pa2,e);}});});}},setEntities:function(s){var t=this,a,i,l={},re='',v;if(t.entityLookup)return;a=s.split(',');for(i=0;i<a.length;i+=2){v=a[i];if(v==34||v==38||v==60||v==62)continue;l[String.fromCharCode(a[i])]=a[i+1];v=parseInt(a[i]).toString(16);re+='\\u'+'0000'.substring(v.length)+v;}if(!re){t.settings.entity_encoding='raw';return;}t.entitiesRE=new RegExp('['+re+']','g');t.entityLookup=l;},setValidChildRules:function(s){this.childRules=null;this.addValidChildRules(s);},addValidChildRules:function(s){var t=this,inst,intr,bloc;if(!s)return;inst='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';intr='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';bloc='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';each(s.split(','),function(s){var p=s.split(/\[|\]/),re;s='';each(p[1].split('|'),function(v){if(s)s+='|';switch(v){case'%itrans':v=intr;break;case'%itrans_na':v=intr.substring(2);break;case'%istrict':v=inst;break;case'%istrict_na':v=inst.substring(2);break;case'%btrans':v=bloc;break;case'%bstrict':v=bloc;break;}s+=v;});re=new RegExp('^('+s.toLowerCase()+')$','i');each(p[0].split('/'),function(s){t.childRules=t.childRules||{};t.childRules[s]=re;});});s='';each(t.childRules,function(v,k){if(s)s+='|';s+=k;});t.parentElementsRE=new RegExp('^('+s.toLowerCase()+')$','i');},setRules:function(s){var t=this;t._setup();t.rules={};t.wildRules=[];t.validElements={};return t.addRules(s);},addRules:function(s){var t=this,dr;if(!s)return;t._setup();each(s.split(','),function(s){var p=s.split(/\[|\]/),tn=p[0].split('/'),ra,at,wat,va=[];if(dr)at=tinymce.extend([],dr.attribs);if(p.length>1){each(p[1].split('|'),function(s){var ar={},i;at=at||[];s=s.replace(/::/g,'~');s=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s);s[2]=s[2].replace(/~/g,':');if(s[1]=='!'){ra=ra||[];ra.push(s[2]);}if(s[1]=='-'){for(i=0;i<at.length;i++){if(at[i].name==s[2]){at.splice(i,1);return;}}}switch(s[3]){case'=':ar.defaultVal=s[4]||'';break;case':':ar.forcedVal=s[4];break;case'<':ar.validVals=s[4].split('?');break;}if(/[*.?]/.test(s[2])){wat=wat||[];ar.nameRE=new RegExp('^'+wildcardToRE(s[2])+'$');wat.push(ar);}else{ar.name=s[2];at.push(ar);}va.push(s[2]);});}each(tn,function(s,i){var pr=s.charAt(0),x=1,ru={};if(dr){if(dr.noEmpty)ru.noEmpty=dr.noEmpty;if(dr.fullEnd)ru.fullEnd=dr.fullEnd;if(dr.padd)ru.padd=dr.padd;}switch(pr){case'-':ru.noEmpty=true;break;case'+':ru.fullEnd=true;break;case'#':ru.padd=true;break;default:x=0;}tn[i]=s=s.substring(x);t.validElements[s]=1;if(/[*.?]/.test(tn[0])){ru.nameRE=new RegExp('^'+wildcardToRE(tn[0])+'$');t.wildRules=t.wildRules||{};t.wildRules.push(ru);}else{ru.name=tn[0];if(tn[0]=='@')dr=ru;t.rules[s]=ru;}ru.attribs=at;if(ra)ru.requiredAttribs=ra;if(wat){s='';each(va,function(v){if(s)s+='|';s+='('+wildcardToRE(v)+')';});ru.validAttribsRE=new RegExp('^'+s.toLowerCase()+'$');ru.wildAttribs=wat;}});});s='';each(t.validElements,function(v,k){if(s)s+='|';if(k!='@')s+=k;});t.validElementsRE=new RegExp('^('+wildcardToRE(s.toLowerCase())+')$');},findRule:function(n){var t=this,rl=t.rules,i,r;t._setup();r=rl[n];if(r)return r;rl=t.wildRules;for(i=0;i<rl.length;i++){if(rl[i].nameRE.test(n))return rl[i];}return null;},findAttribRule:function(ru,n){var i,wa=ru.wildAttribs;for(i=0;i<wa.length;i++){if(wa[i].nameRE.test(n))return wa[i];}return null;},serialize:function(n,o){var h,t=this;t._setup();o=o||{};o.format=o.format||'html';t.processObj=o;n=n.cloneNode(true);t.key=''+(parseInt(t.key)+1);if(!o.no_events){o.node=n;t.onPreProcess.dispatch(t,o);}t.writer.reset();t._serializeNode(n,o.getInner);o.content=t.writer.getContent();if(!o.no_events)t.onPostProcess.dispatch(t,o);t._postProcess(o);o.node=null;return tinymce.trim(o.content);},_postProcess:function(o){var t=this,s=t.settings,h=o.content,sc=[],p;if(o.format=='html'){p=t._protect({content:h,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});h=p.content;if(s.entity_encoding!=='raw')h=t._encode(h);if(!o.set){h=h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,s.entity_encoding=='numeric'?'<p$1>&#160;</p>':'<p$1>&nbsp;</p>');if(s.remove_linebreaks){h=h.replace(/\r?\n|\r/g,' ');h=h.replace(/(<[^>]+>)\s+/g,'$1 ');h=h.replace(/\s+(<\/[^>]+>)/g,' $1');h=h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,'<$1 $2>');h=h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,'<$1>');h=h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,'</$1>');}if(s.apply_source_formatting&&s.indent_mode=='simple'){h=h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,'\n<$1$2$3>\n');h=h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,'\n<$1$2>');h=h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,'</$1>\n');h=h.replace(/\n\n/g,'\n');}}h=t._unprotect(h,p);h=h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,'<![CDATA[$1]]>');if(s.entity_encoding=='raw')h=h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,'<p$1>\u00a0</p>');}o.content=h;},_serializeNode:function(n,inn){var t=this,s=t.settings,w=t.writer,hc,el,cn,i,l,a,at,no,v,nn,ru,ar,iv;if(!s.node_filter||s.node_filter(n)){switch(n.nodeType){case 1:if(n.hasAttribute?n.hasAttribute('mce_bogus'):n.getAttribute('mce_bogus'))return;iv=false;hc=n.hasChildNodes();nn=n.getAttribute('mce_name')||n.nodeName.toLowerCase();if(isIE){if(n.scopeName!=='HTML'&&n.scopeName!=='html')nn=n.scopeName+':'+nn;}if(nn.indexOf('mce:')===0)nn=nn.substring(4);if(!t.validElementsRE.test(nn)||(t.invalidElementsRE&&t.invalidElementsRE.test(nn))||inn){iv=true;break;}if(isIE){if(s.fix_content_duplication){if(n.mce_serialized==t.key)return;n.mce_serialized=t.key;}if(nn.charAt(0)=='/')nn=nn.substring(1);}else if(isGecko){if(n.nodeName==='BR'&&n.getAttribute('type')=='_moz')return;}if(t.childRules){if(t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(nn)){iv=true;break;}}t.elementName=nn;}ru=t.findRule(nn);nn=ru.name||nn;if((!hc&&ru.noEmpty)||(isIE&&!nn)){iv=true;break;}if(ru.requiredAttribs){a=ru.requiredAttribs;for(i=a.length-1;i>=0;i--){if(this.dom.getAttrib(n,a[i])!=='')break;}if(i==-1){iv=true;break;}}w.writeStartElement(nn);if(ru.attribs){for(i=0,at=ru.attribs,l=at.length;i<l;i++){a=at[i];v=t._getAttrib(n,a);if(v!==null)w.writeAttribute(a.name,v);}}if(ru.validAttribsRE){at=isIE?getIEAtts(n):n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified){a=no.nodeName.toLowerCase();if(s.invalid_attrs.test(a)||!ru.validAttribsRE.test(a))continue;ar=t.findAttribRule(ru,a);v=t._getAttrib(n,ar,a);if(v!==null)w.writeAttribute(a,v);}}}if(ru.padd){if(hc&&(cn=n.firstChild)&&cn.nodeType===1&&n.childNodes.length===1){if(cn.hasAttribute?cn.hasAttribute('mce_bogus'):cn.getAttribute('mce_bogus'))w.writeText('\u00a0');}else if(!hc)w.writeText('\u00a0');}break;case 3:if(t.childRules&&t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(n.nodeName))return;}return w.writeText(n.nodeValue);case 4:return w.writeCDATA(n.nodeValue);case 8:return w.writeComment(n.nodeValue);}}else if(n.nodeType==1)hc=n.hasChildNodes();if(hc){cn=n.firstChild;while(cn){t._serializeNode(cn);t.elementName=nn;cn=cn.nextSibling;}}if(!iv){if(hc||!s.closed.test(nn))w.writeFullEndElement();else w.writeEndElement();}},_protect:function(o){var t=this;o.items=o.items||[];function enc(s){return s.replace(/[\r\n\\]/g,function(c){if(c==='\n')return'\\n';else if(c==='\\')return'\\\\';return'\\r';});};function dec(s){return s.replace(/\\[\\rn]/g,function(c){if(c==='\\n')return'\n';else if(c==='\\\\')return'\\';return'\r';});};each(o.patterns,function(p){o.content=dec(enc(o.content).replace(p.pattern,function(x,a,b,c){b=dec(b);if(p.encode)b=t._encode(b);o.items.push(b);return a+'<!--mce:'+(o.items.length-1)+'-->'+c;}));});return o;},_unprotect:function(h,o){h=h.replace(/\<!--mce:([0-9]+)--\>/g,function(a,b){return o.items[parseInt(b)];});o.items=[];return h;},_encode:function(h){var t=this,s=t.settings,l;if(s.entity_encoding!=='raw'){if(s.entity_encoding.indexOf('named')!=-1){t.setEntities(s.entities);l=t.entityLookup;h=h.replace(t.entitiesRE,function(a){var v;if(v=l[a])a='&'+v+';';return a;});}if(s.entity_encoding.indexOf('numeric')!=-1){h=h.replace(/[\u007E-\uFFFF]/g,function(a){return'&#'+a.charCodeAt(0)+';';});}}return h;},_setup:function(){var t=this,s=this.settings;if(t.done)return;t.done=1;t.setRules(s.valid_elements);t.addRules(s.extended_valid_elements);t.addValidChildRules(s.valid_child_elements);if(s.invalid_elements)t.invalidElementsRE=new RegExp('^('+wildcardToRE(s.invalid_elements.replace(/,/g,'|').toLowerCase())+')$');if(s.attrib_value_filter)t.attribValueFilter=s.attribValueFilter;},_getAttrib:function(n,a,na){var i,v;na=na||a.name;if(a.forcedVal&&(v=a.forcedVal)){if(v==='{$uid}')return this.dom.uniqueId();return v;}v=this.dom.getAttrib(n,na);if(this.settings.bool_attrs.test(na)&&v){v=(''+v).toLowerCase();if(v==='false'||v==='0')return null;v=na;}switch(na){case'rowspan':case'colspan':if(v=='1')v='';break;}if(this.attribValueFilter)v=this.attribValueFilter(na,v,n);if(a.validVals){for(i=a.validVals.length-1;i>=0;i--){if(v==a.validVals[i])break;}if(i==-1)return null;}if(v===''&&typeof(a.defaultVal)!='undefined'){v=a.defaultVal;if(v==='{$uid}')return this.dom.uniqueId();return v;}else{if(na=='class'&&this.processObj.get)v=v.replace(/\s?mceItem\w+\s?/g,'');}if(v==='')return null;return v;}});})();(function(){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create('tinymce.dom.ScriptLoader',{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={};},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0;},markDone:function(u){this.lookup[u]={state:2,url:u};},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2)cb.call(s||this);return o;}o={state:0,url:u,func:cb,scope:s||this};if(pr)t.queue.unshift(o);else t.queue.push(o);lo[u]=o;return o;},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2)cb.call(s||t);return o;}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co);}});}else document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"></script>');};if(!tinymce.is(u,'string')){each(u,function(u){loadScript(u);});if(cb)cb.call(s||t);}else{loadScript(u);if(cb)cb.call(s||t);}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb)cb.call(s||t);each(t.queueCallbacks,function(o){o.func.call(o.scope);});});}else if(cb)t.queueCallbacks.push({func:cb,scope:s||t});},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co);}catch(ex){eval(co,w);}}else w.execScript(co);},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func)o.func.call(o.scope||t);};function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--;}else load(o);});if(l===0&&cb){cb.call(s||t);cb=0;}};function load(o){if(o.state>0)return;o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone();});};each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o);}else o=lo[u];if(o.state>0)return;if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol='';if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone();});if(tinymce.isIE)ol=' onreadystatechange="';else ol=' onload="';ol+='tinymce.dom.ScriptLoader._onLoad(this,\''+u+'\','+ix+');"';}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+'></script>');if(!o.func)done(o);}else load(o);});allDone();},'static':{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1;},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=='complete')this._funcs[ix].call(this);},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0;}};if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done();}});}else{e=tinymce.DOM.create('script',{id:id,type:'text/javascript',src:tinymce._addVer(u)});Event.add(e,'load',done);(document.getElementsByTagName('head')[0]||document.body).appendChild(e);}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader();})();(function(){var DOM=tinymce.DOM,is=tinymce.is;tinymce.create('tinymce.ui.Control',{Control:function(id,s){this.id=id;this.settings=s=s||{};this.rendered=false;this.onRender=new tinymce.util.Dispatcher(this);this.classPrefix='';this.scope=s.scope||this;this.disabled=0;this.active=0;},setDisabled:function(s){var e;if(s!=this.disabled){e=DOM.get(this.id);if(e&&this.settings.unavailable_prefix){if(s){this.prevTitle=e.title;e.title=this.settings.unavailable_prefix+": "+e.title;}else e.title=this.prevTitle;}this.setState('Disabled',s);this.setState('Enabled',!s);this.disabled=s;}},isDisabled:function(){return this.disabled;},setActive:function(s){if(s!=this.active){this.setState('Active',s);this.active=s;}},isActive:function(){return this.active;},setState:function(c,s){var n=DOM.get(this.id);c=this.classPrefix+c;if(s)DOM.addClass(n,c);else DOM.removeClass(n,c);},isRendered:function(){return this.rendered;},renderHTML:function(){},renderTo:function(n){DOM.setHTML(n,this.renderHTML());},postRender:function(){var t=this,b;if(is(t.disabled)){b=t.disabled;t.disabled=-1;t.setDisabled(b);}if(is(t.active)){b=t.active;t.active=-1;t.setActive(b);}},remove:function(){DOM.remove(this.id);this.destroy();},destroy:function(){tinymce.dom.Event.clear(this.id);}});})();tinymce.create('tinymce.ui.Container:tinymce.ui.Control',{Container:function(id,s){this.parent(id,s);this.controls=[];this.lookup={};},add:function(c){this.lookup[c.id]=c;this.controls.push(c);return c;},get:function(n){return this.lookup[n];}});tinymce.create('tinymce.ui.Separator:tinymce.ui.Control',{Separator:function(id,s){this.parent(id,s);this.classPrefix='mceSeparator';},renderHTML:function(){return tinymce.DOM.createHTML('span',{'class':this.classPrefix});}});(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control',{MenuItem:function(id,s){this.parent(id,s);this.classPrefix='mceMenuItem';},setSelected:function(s){this.setState('Selected',s);this.selected=s;},isSelected:function(){return this.selected;},postRender:function(){var t=this;t.parent();if(is(t.selected))t.setSelected(t.selected);}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem',{Menu:function(id,s){var t=this;t.parent(id,s);t.items={};t.collapsed=false;t.menuCount=0;t.onAddItem=new tinymce.util.Dispatcher(this);},expand:function(d){var t=this;if(d){walk(t,function(o){if(o.expand)o.expand();},'items',t);}t.collapsed=false;},collapse:function(d){var t=this;if(d){walk(t,function(o){if(o.collapse)o.collapse();},'items',t);}t.collapsed=true;},isCollapsed:function(){return this.collapsed;},add:function(o){if(!o.settings)o=new tinymce.ui.MenuItem(o.id||DOM.uniqueId(),o);this.onAddItem.dispatch(this,o);return this.items[o.id]=o;},addSeparator:function(){return this.add({separator:true});},addMenu:function(o){if(!o.collapse)o=this.createMenu(o);this.menuCount++;return this.add(o);},hasMenus:function(){return this.menuCount!==0;},remove:function(o){delete this.items[o.id];},removeAll:function(){var t=this;walk(t,function(o){if(o.removeAll)o.removeAll();else o.remove();o.destroy();},'items',t);t.items={};},createMenu:function(o){var m=new tinymce.ui.Menu(o.id||DOM.uniqueId(),o);m.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return m;}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,Event=tinymce.dom.Event,Element=tinymce.dom.Element;tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu',{DropMenu:function(id,s){s=s||{};s.container=s.container||DOM.doc.body;s.offset_x=s.offset_x||0;s.offset_y=s.offset_y||0;s.vp_offset_x=s.vp_offset_x||0;s.vp_offset_y=s.vp_offset_y||0;if(is(s.icons)&&!s.icons)s['class']+=' mceNoIcons';this.parent(id,s);this.onShowMenu=new tinymce.util.Dispatcher(this);this.onHideMenu=new tinymce.util.Dispatcher(this);this.classPrefix='mceMenu';},createMenu:function(s){var t=this,cs=t.settings,m;s.container=s.container||cs.container;s.parent=t;s.constrain=s.constrain||cs.constrain;s['class']=s['class']||cs['class'];s.vp_offset_x=s.vp_offset_x||cs.vp_offset_x;s.vp_offset_y=s.vp_offset_y||cs.vp_offset_y;m=new tinymce.ui.DropMenu(s.id||DOM.uniqueId(),s);m.onAddItem.add(t.onAddItem.dispatch,t.onAddItem);return m;},update:function(){var t=this,s=t.settings,tb=DOM.get('menu_'+t.id+'_tbl'),co=DOM.get('menu_'+t.id+'_co'),tw,th;tw=s.max_width?Math.min(tb.clientWidth,s.max_width):tb.clientWidth;th=s.max_height?Math.min(tb.clientHeight,s.max_height):tb.clientHeight;if(!DOM.boxModel)t.element.setStyles({width:tw+2,height:th+2});else t.element.setStyles({width:tw,height:th});if(s.max_width)DOM.setStyle(co,'width',tw);if(s.max_height){DOM.setStyle(co,'height',th);if(tb.clientHeight<s.max_height)DOM.setStyle(co,'overflow','hidden');}},showMenu:function(x,y,px){var t=this,s=t.settings,co,vp=DOM.getViewPort(),w,h,mx,my,ot=2,dm,tb,cp=t.classPrefix;t.collapse(1);if(t.isMenuVisible)return;if(!t.rendered){co=DOM.add(t.settings.container,t.renderNode());each(t.items,function(o){o.postRender();});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});}else co=DOM.get('menu_'+t.id);if(!tinymce.isOpera)DOM.setStyles(co,{left:-0xFFFF,top:-0xFFFF});DOM.show(co);t.update();x+=s.offset_x||0;y+=s.offset_y||0;vp.w-=4;vp.h-=4;if(s.constrain){w=co.clientWidth-ot;h=co.clientHeight-ot;mx=vp.x+vp.w;my=vp.y+vp.h;if((x+s.vp_offset_x+w)>mx)x=px?px-w:Math.max(0,(mx-s.vp_offset_x)-w);if((y+s.vp_offset_y+h)>my)y=Math.max(0,(my-s.vp_offset_y)-h);}DOM.setStyles(co,{left:x,top:y});t.element.update();t.isMenuVisible=1;t.mouseClickFunc=Event.add(co,'click',function(e){var m;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))&&!DOM.hasClass(e,cp+'ItemSub')){m=t.items[e.id];if(m.isDisabled())return;dm=t;while(dm){if(dm.hideMenu)dm.hideMenu();dm=dm.settings.parent;}if(m.settings.onclick)m.settings.onclick(e);return Event.cancel(e);}});if(t.hasMenus()){t.mouseOverFunc=Event.add(co,'mouseover',function(e){var m,r,mi;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))){m=t.items[e.id];if(t.lastMenu)t.lastMenu.collapse(1);if(m.isDisabled())return;if(e&&DOM.hasClass(e,cp+'ItemSub')){r=DOM.getRect(e);m.showMenu((r.x+r.w-ot),r.y-ot,r.x);t.lastMenu=m;DOM.addClass(DOM.get(m.id).firstChild,cp+'ItemActive');}}});}t.onShowMenu.dispatch(t);if(s.keyboard_focus){Event.add(co,'keydown',t._keyHandler,t);DOM.select('a','menu_'+t.id)[0].focus();t._focusIdx=0;}},hideMenu:function(c){var t=this,co=DOM.get('menu_'+t.id),e;if(!t.isMenuVisible)return;Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);Event.remove(co,'keydown',t._keyHandler);DOM.hide(co);t.isMenuVisible=0;if(!c)t.collapse(1);if(t.element)t.element.hide();if(e=DOM.get(t.id))DOM.removeClass(e.firstChild,t.classPrefix+'ItemActive');t.onHideMenu.dispatch(t);},add:function(o){var t=this,co;o=t.parent(o);if(t.isRendered&&(co=DOM.get('menu_'+t.id)))t._add(DOM.select('tbody',co)[0],o);return o;},collapse:function(d){this.parent(d);this.hideMenu(1);},remove:function(o){DOM.remove(o.id);this.destroy();return this.parent(o);},destroy:function(){var t=this,co=DOM.get('menu_'+t.id);Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);if(t.element)t.element.remove();DOM.remove(co);},renderNode:function(){var t=this,s=t.settings,n,tb,co,w;w=DOM.create('div',{id:'menu_'+t.id,'class':s['class'],'style':'position:absolute;left:0;top:0;z-index:200000'});co=DOM.add(w,'div',{id:'menu_'+t.id+'_co','class':t.classPrefix+(s['class']?' '+s['class']:'')});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});if(s.menu_line)DOM.add(co,'span',{'class':t.classPrefix+'Line'});n=DOM.add(co,'table',{id:'menu_'+t.id+'_tbl',border:0,cellPadding:0,cellSpacing:0});tb=DOM.add(n,'tbody');each(t.items,function(o){t._add(tb,o);});t.rendered=true;return w;},_keyHandler:function(e){var t=this,kc=e.keyCode;function focus(d){var i=t._focusIdx+d,e=DOM.select('a','menu_'+t.id)[i];if(e){t._focusIdx=i;e.focus();}};switch(kc){case 38:focus(-1);return;case 40:focus(1);return;case 13:return;case 27:return this.hideMenu();}},_add:function(tb,o){var n,s=o.settings,a,ro,it,cp=this.classPrefix,ic;if(s.separator){ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'ItemSeparator'});DOM.add(ro,'td',{'class':cp+'ItemSeparator'});if(n=ro.previousSibling)DOM.addClass(n,'mceLast');return;}n=ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'Item '+cp+'ItemEnabled'});n=it=DOM.add(n,'td');n=a=DOM.add(n,'a',{href:'javascript:;',onclick:"return false;",onmousedown:'return false;'});DOM.addClass(it,s['class']);ic=DOM.add(n,'span',{'class':'mceIcon'+(s.icon?' mce_'+s.icon:'')});if(s.icon_src)DOM.add(ic,'img',{src:s.icon_src});n=DOM.add(n,s.element||'span',{'class':'mceText',title:o.settings.title},o.settings.title);if(o.settings.style)DOM.setAttrib(n,'style',o.settings.style);if(tb.childNodes.length==1)DOM.addClass(ro,'mceFirst');if((n=ro.previousSibling)&&DOM.hasClass(n,cp+'ItemSeparator'))DOM.addClass(ro,'mceFirst');if(o.collapse)DOM.addClass(ro,cp+'ItemSub');if(n=ro.previousSibling)DOM.removeClass(n,'mceLast');DOM.addClass(ro,'mceLast');}});})();(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.ui.Button:tinymce.ui.Control',{Button:function(id,s){this.parent(id,s);this.classPrefix='mceButton';},renderHTML:function(){var cp=this.classPrefix,s=this.settings,h,l;l=DOM.encode(s.label||'');h='<a id="'+this.id+'" href="javascript:;" class="'+cp+' '+cp+'Enabled '+s['class']+(l?' '+cp+'Labeled':'')+'" onmousedown="return false;" onclick="return false;" title="'+DOM.encode(s.title)+'">';if(s.image)h+='<img class="mceIcon" src="'+s.image+'" />'+l+'</a>';else h+='<span class="mceIcon '+s['class']+'"></span>'+(l?'<span class="'+cp+'Label">'+l+'</span>':'')+'</a>';return h;},postRender:function(){var t=this,s=t.settings;tinymce.dom.Event.add(t.id,'click',function(e){if(!t.isDisabled())return s.onclick.call(s.scope,e);});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control',{ListBox:function(id,s){var t=this;t.parent(id,s);t.items=[];t.onChange=new Dispatcher(t);t.onPostRender=new Dispatcher(t);t.onAdd=new Dispatcher(t);t.onRenderMenu=new tinymce.util.Dispatcher(this);t.classPrefix='mceListBox';},select:function(va){var t=this,fv,f;if(va==undefined)return t.selectByIndex(-1);if(va&&va.call)f=va;else{f=function(v){return v==va;};}if(va!=t.selectedValue){each(t.items,function(o,i){if(f(o.value)){fv=1;t.selectByIndex(i);return false;}});if(!fv)t.selectByIndex(-1);}},selectByIndex:function(idx){var t=this,e,o;if(idx!=t.selectedIndex){e=DOM.get(t.id+'_text');o=t.items[idx];if(o){t.selectedValue=o.value;t.selectedIndex=idx;DOM.setHTML(e,DOM.encode(o.title));DOM.removeClass(e,'mceTitle');}else{DOM.setHTML(e,DOM.encode(t.settings.title));DOM.addClass(e,'mceTitle');t.selectedValue=t.selectedIndex=null;}e=0;}else t.selectedValue=t.selectedIndex=null;},add:function(n,v,o){var t=this;o=o||{};o=tinymce.extend(o,{title:n,value:v});t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return this.items.length;},renderHTML:function(){var h='',t=this,s=t.settings,cp=t.classPrefix;h='<table id="'+t.id+'" cellpadding="0" cellspacing="0" class="'+cp+' '+cp+'Enabled'+(s['class']?(' '+s['class']):'')+'"><tbody><tr>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_text',href:'javascript:;','class':'mceText',onclick:"return false;",onmousedown:'return false;'},DOM.encode(t.settings.title))+'</td>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',tabindex:-1,href:'javascript:;','class':'mceOpen',onclick:"return false;",onmousedown:'return false;'},'<span></span>')+'</td>';h+='</tr></tbody></table>';return h;},showMenu:function(){var t=this,p1,p2,e=DOM.get(this.id),m;if(t.isDisabled()||t.items.length==0)return;if(t.menu&&t.menu.isMenuVisible)return t.hideMenu();if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(this.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.keyboard_focus=!tinymce.isOpera;if(t.oldID)m.items[t.oldID].setSelected(0);each(t.items,function(o){if(o.value===t.selectedValue){m.items[o.id].setSelected(1);t.oldID=o.id;}});m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);DOM.addClass(t.id,t.classPrefix+'Selected');},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&(e.target.id==t.id+'_text'||e.target.id==t.id+'_open'))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){DOM.removeClass(t.id,t.classPrefix+'Selected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':t.classPrefix+'Menu mceNoIcons',max_width:150,max_height:150});m.onHideMenu.add(t.hideMenu,t);m.add({title:t.settings.title,'class':'mceMenuItemTitle',onclick:function(){if(t.settings.onselect('')!==false)t.select('');}});each(t.items,function(o){o.id=DOM.uniqueId();o.onclick=function(){if(t.settings.onselect(o.value)!==false)t.select(o.value);};m.add(o);});t.onRenderMenu.dispatch(t,m);t.menu=m;},postRender:function(){var t=this,cp=t.classPrefix;Event.add(t.id,'click',t.showMenu,t);Event.add(t.id+'_text','focus',function(e){if(!t._focused){t.keyDownHandler=Event.add(t.id+'_text','keydown',function(e){var idx=-1,v,kc=e.keyCode;each(t.items,function(v,i){if(t.selectedValue==v.value)idx=i;});if(kc==38)v=t.items[idx-1];else if(kc==40)v=t.items[idx+1];else if(kc==13){v=t.selectedValue;t.selectedValue=null;t.settings.onselect(v);return Event.cancel(e);}if(v){t.hideMenu();t.select(v.value);}});}t._focused=1;});Event.add(t.id+'_text','blur',function(){Event.remove(t.id+'_text','keydown',t.keyDownHandler);t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.addClass(t.id,cp+'Hover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.removeClass(t.id,cp+'Hover');});}t.onPostRender.dispatch(t,DOM.get(t.id));},destroy:function(){this.parent();Event.clear(this.id+'_text');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox',{NativeListBox:function(id,s){this.parent(id,s);this.classPrefix='mceNativeListBox';},setDisabled:function(s){DOM.get(this.id).disabled=s;},isDisabled:function(){return DOM.get(this.id).disabled;},select:function(va){var t=this,fv,f;if(va==undefined)return t.selectByIndex(-1);if(va&&va.call)f=va;else{f=function(v){return v==va;};}if(va!=t.selectedValue){each(t.items,function(o,i){if(f(o.value)){fv=1;t.selectByIndex(i);return false;}});if(!fv)t.selectByIndex(-1);}},selectByIndex:function(idx){DOM.get(this.id).selectedIndex=idx+1;this.selectedValue=this.items[idx]?this.items[idx].value:null;},add:function(n,v,a){var o,t=this;a=a||{};a.value=v;if(t.isRendered())DOM.add(DOM.get(this.id),'option',a,n);o={title:n,value:v,attribs:a};t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return DOM.get(this.id).options.length-1;},renderHTML:function(){var h,t=this;h=DOM.createHTML('option',{value:''},'-- '+t.settings.title+' --');each(t.items,function(it){h+=DOM.createHTML('option',{value:it.value},it.title);});h=DOM.createHTML('select',{id:t.id,'class':'mceNativeListBox'},h);return h;},postRender:function(){var t=this,ch;t.rendered=true;function onChange(e){var v=t.items[e.target.selectedIndex-1];if(v&&(v=v.value)){t.onChange.dispatch(t,v);if(t.settings.onselect)t.settings.onselect(v);}};Event.add(t.id,'change',onChange);Event.add(t.id,'keydown',function(e){var bf;Event.remove(t.id,'change',ch);bf=Event.add(t.id,'blur',function(){Event.add(t.id,'change',onChange);Event.remove(t.id,'blur',bf);});if(e.keyCode==13||e.keyCode==32){onChange(e);return Event.cancel(e);}});t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button',{MenuButton:function(id,s){this.parent(id,s);this.onRenderMenu=new tinymce.util.Dispatcher(this);s.menu_container=s.menu_container||DOM.doc.body;},showMenu:function(){var t=this,p1,p2,e=DOM.get(t.id),m;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();p1=DOM.getPos(t.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.vp_offset_x=p2.x;m.settings.vp_offset_y=p2.y;m.settings.keyboard_focus=t._focused;m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);t.setState('Selected',1);t.isMenuVisible=1;},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':this.classPrefix+'Menu',icons:t.settings.icons});m.onHideMenu.add(t.hideMenu,t);t.onRenderMenu.dispatch(t,m);t.menu=m;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id||e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){t.setState('Selected',0);Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}t.isMenuVisible=0;},postRender:function(){var t=this,s=t.settings;Event.add(t.id,'click',function(){if(!t.isDisabled()){if(s.onclick)s.onclick(t.value);t.showMenu();}});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton',{SplitButton:function(id,s){this.parent(id,s);this.classPrefix='mceSplitButton';},renderHTML:function(){var h,t=this,s=t.settings,h1;h='<tbody><tr>';if(s.image)h1=DOM.createHTML('img ',{src:s.image,'class':'mceAction '+s['class']});else h1=DOM.createHTML('span',{'class':'mceAction '+s['class']},'');h+='<td>'+DOM.createHTML('a',{id:t.id+'_action',href:'javascript:;','class':'mceAction '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h1=DOM.createHTML('span',{'class':'mceOpen '+s['class']});h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'mceOpen '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h+='</tr></tbody>';return DOM.createHTML('table',{id:t.id,'class':'mceSplitButton mceSplitButtonEnabled '+s['class'],cellpadding:'0',cellspacing:'0',onmousedown:'return false;',title:s.title},h);},postRender:function(){var t=this,s=t.settings;if(s.onclick){Event.add(t.id+'_action','click',function(){if(!t.isDisabled())s.onclick(t.value);});}Event.add(t.id+'_open','click',t.showMenu,t);Event.add(t.id+'_open','focus',function(){t._focused=1;});Event.add(t.id+'_open','blur',function(){t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.addClass(t.id,'mceSplitButtonHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.removeClass(t.id,'mceSplitButtonHover');});}},destroy:function(){this.parent();Event.clear(this.id+'_action');Event.clear(this.id+'_open');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,is=tinymce.is,each=tinymce.each;tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton',{ColorSplitButton:function(id,s){var t=this;t.parent(id,s);t.settings=s=tinymce.extend({colors:'000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',grid_width:8,default_color:'#888888'},t.settings);t.onShowMenu=new tinymce.util.Dispatcher(t);t.onHideMenu=new tinymce.util.Dispatcher(t);t.value=s.default_color;},showMenu:function(){var t=this,r,p,e,p2;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();e=DOM.get(t.id);DOM.show(t.id+'_menu');DOM.addClass(e,'mceSplitButtonSelected');p2=DOM.getPos(e);DOM.setStyles(t.id+'_menu',{left:p2.x,top:p2.y+e.clientHeight,zIndex:200000});e=0;Event.add(DOM.doc,'mousedown',t.hideMenu,t);if(t._focused){t._keyHandler=Event.add(t.id+'_menu','keydown',function(e){if(e.keyCode==27)t.hideMenu();});DOM.select('a',t.id+'_menu')[0].focus();}t.onShowMenu.dispatch(t);t.isMenuVisible=1;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceSplitButtonMenu');})){DOM.removeClass(t.id,'mceSplitButtonSelected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);Event.remove(t.id+'_menu','keydown',t._keyHandler);DOM.hide(t.id+'_menu');}t.onHideMenu.dispatch(t);t.isMenuVisible=0;},renderMenu:function(){var t=this,m,i=0,s=t.settings,n,tb,tr,w;w=DOM.add(s.menu_container,'div',{id:t.id+'_menu','class':s['menu_class']+' '+s['class'],style:'position:absolute;left:0;top:-1000px;'});m=DOM.add(w,'div',{'class':s['class']+' mceSplitButtonMenu'});DOM.add(m,'span',{'class':'mceMenuLine'});n=DOM.add(m,'table',{'class':'mceColorSplitMenu'});tb=DOM.add(n,'tbody');i=0;each(is(s.colors,'array')?s.colors:s.colors.split(','),function(c){c=c.replace(/^#/,'');if(!i--){tr=DOM.add(tb,'tr');i=s.grid_width-1;}n=DOM.add(tr,'td');n=DOM.add(n,'a',{href:'javascript:;',style:{backgroundColor:'#'+c},mce_color:'#'+c});});if(s.more_colors_func){n=DOM.add(tb,'tr');n=DOM.add(n,'td',{colspan:s.grid_width,'class':'mceMoreColors'});n=DOM.add(n,'a',{id:t.id+'_more',href:'javascript:;',onclick:'return false;','class':'mceMoreColors'},s.more_colors_title);Event.add(n,'click',function(e){s.more_colors_func.call(s.more_colors_scope||this);return Event.cancel(e);});}DOM.addClass(m,'mceColorSplitMenu');Event.add(t.id+'_menu','click',function(e){var c;e=e.target;if(e.nodeName=='A'&&(c=e.getAttribute('mce_color')))t.setColor(c);return Event.cancel(e);});return w;},setColor:function(c){var t=this;DOM.setStyle(t.id+'_preview','backgroundColor',c);t.value=c;t.hideMenu();t.settings.onselect(c);},postRender:function(){var t=this,id=t.id;t.parent();DOM.add(id+'_action','div',{id:id+'_preview','class':'mceColorPreview'});DOM.setStyle(t.id+'_preview','backgroundColor',t.value);},destroy:function(){this.parent();Event.clear(this.id+'_menu');Event.clear(this.id+'_more');DOM.remove(this.id+'_menu');}});})();tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container',{renderHTML:function(){var t=this,h='',c,co,dom=tinymce.DOM,s=t.settings,i,pr,nx,cl;cl=t.controls;for(i=0;i<cl.length;i++){co=cl[i];pr=cl[i-1];nx=cl[i+1];if(i===0){c='mceToolbarStart';if(co.Button)c+=' mceToolbarStartButton';else if(co.SplitButton)c+=' mceToolbarStartSplitButton';else if(co.ListBox)c+=' mceToolbarStartListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,'<!-- IE -->'));}if(pr&&co.ListBox){if(pr.Button||pr.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarEnd'},dom.createHTML('span',null,'<!-- IE -->'));}if(dom.stdMode)h+='<td style="position: relative">'+co.renderHTML()+'</td>';else h+='<td>'+co.renderHTML()+'</td>';if(nx&&co.ListBox){if(nx.Button||nx.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarStart'},dom.createHTML('span',null,'<!-- IE -->'));}}c='mceToolbarEnd';if(co.Button)c+=' mceToolbarEndButton';else if(co.SplitButton)c+=' mceToolbarEndSplitButton';else if(co.ListBox)c+=' mceToolbarEndListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,'<!-- IE -->'));return dom.createHTML('table',{id:t.id,'class':'mceToolbar'+(s['class']?' '+s['class']:''),cellpadding:'0',cellspacing:'0',align:t.settings.align||''},'<tbody><tr>'+h+'</tr></tbody>');}});(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each;tinymce.create('tinymce.AddOnManager',{items:[],urls:{},lookup:{},onAdd:new Dispatcher(this),get:function(n){return this.lookup[n];},requireLangPack:function(n){var u,s=tinymce.EditorManager.settings;if(s&&s.language){u=this.urls[n]+'/langs/'+s.language+'.js';if(!tinymce.dom.Event.domLoaded&&!s.strict_mode)tinymce.ScriptLoader.load(u);else tinymce.ScriptLoader.add(u);}},add:function(id,o){this.items.push(o);this.lookup[id]=o;this.onAdd.dispatch(this,id,o);return o;},load:function(n,u,cb,s){var t=this;if(t.urls[n])return;if(u.indexOf('/')!=0&&u.indexOf('://')==-1)u=tinymce.baseURL+'/'+u;t.urls[n]=u.substring(0,u.lastIndexOf('/'));tinymce.ScriptLoader.add(u,cb,s);}});tinymce.PluginManager=new tinymce.AddOnManager();tinymce.ThemeManager=new tinymce.AddOnManager();}());(function(){var each=tinymce.each,extend=tinymce.extend,DOM=tinymce.DOM,Event=tinymce.dom.Event,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,explode=tinymce.explode;tinymce.create('static tinymce.EditorManager',{editors:{},i18n:{},activeEditor:null,preInit:function(){var t=this,lo=window.location;tinymce.documentBaseURL=lo.href.replace(/[\?#].*$/,'').replace(/[\/\\][^\/]+$/,'');if(!/[\/\\]$/.test(tinymce.documentBaseURL))tinymce.documentBaseURL+='/';tinymce.baseURL=new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);tinymce.EditorManager.baseURI=new tinymce.util.URI(tinymce.baseURL);if(document.domain&&lo.hostname!=document.domain)tinymce.relaxedDomain=document.domain;if(!tinymce.relaxedDomain&&tinymce.EditorManager.baseURI.host!=lo.hostname&&lo.hostname)document.domain=tinymce.relaxedDomain=lo.hostname.replace(/.*\.(.+\..+)$/,'$1');t.onBeforeUnload=new tinymce.util.Dispatcher(t);Event.add(window,'beforeunload',function(e){t.onBeforeUnload.dispatch(t,e);});},init:function(s){var t=this,pl,sl=tinymce.ScriptLoader,c,e,el=[],ed;function execCallback(se,n,s){var f=se[n];if(!f)return;if(tinymce.is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);}return f.apply(s||this,Array.prototype.slice.call(arguments,2));};s=extend({theme:"simple",language:"en",strict_loading_mode:document.contentType=='application/xhtml+xml'},s);t.settings=s;if(!Event.domLoaded&&!s.strict_loading_mode){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme&&s.theme.charAt(0)!='-'&&!ThemeManager.urls[s.theme])ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');if(s.plugins){pl=explode(s.plugins);if(tinymce.inArray(pl,'compat2x')!=-1)PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');each(pl,function(v){if(v&&v.charAt(0)!='-'&&!PluginManager.urls[v]){if(!tinymce.isWebKit&&v=='safari')return;PluginManager.load(v,'plugins/'+v+'/editor_plugin'+tinymce.suffix+'.js');}});}sl.loadQueue();}Event.add(document,'init',function(){var l,co;execCallback(s,'onpageload');if(s.browsers){l=false;each(explode(s.browsers),function(v){switch(v){case'ie':case'msie':if(tinymce.isIE)l=true;break;case'gecko':if(tinymce.isGecko)l=true;break;case'safari':case'webkit':if(tinymce.isWebKit)l=true;break;case'opera':if(tinymce.isOpera)l=true;break;}});if(!l)return;}switch(s.mode){case"exact":l=s.elements||'';if(l.length>0){each(explode(l),function(v){if(DOM.get(v)){ed=new tinymce.Editor(v,s);el.push(ed);ed.render(1);}else{c=0;each(document.forms,function(f){each(f.elements,function(e){if(e.name===v){v='mce_editor_'+c;DOM.setAttrib(e,'id',v);ed=new tinymce.Editor(v,s);el.push(ed);ed.render(1);}});});}});}break;case"textareas":case"specific_textareas":function hasClass(n,c){return c.constructor===RegExp?c.test(n.className):DOM.hasClass(n,c);};each(DOM.select('textarea'),function(v){if(s.editor_deselector&&hasClass(v,s.editor_deselector))return;if(!s.editor_selector||hasClass(v,s.editor_selector)){e=DOM.get(v.name);if(!v.id&&!e)v.id=v.name;if(!v.id||t.get(v.id))v.id=DOM.uniqueId();ed=new tinymce.Editor(v.id,s);el.push(ed);ed.render(1);}});break;}if(s.oninit){l=co=0;each(el,function(ed){co++;if(!ed.initialized){ed.onInit.add(function(){l++;if(l==co)execCallback(s,'oninit');});}else l++;if(l==co)execCallback(s,'oninit');});}});},get:function(id){return this.editors[id];},getInstanceById:function(id){return this.get(id);},add:function(e){this.editors[e.id]=e;this._setActive(e);return e;},remove:function(e){var t=this;if(!t.editors[e.id])return null;delete t.editors[e.id];if(t.activeEditor==e){each(t.editors,function(e){t._setActive(e);return false;});}e.destroy();return e;},execCommand:function(c,u,v){var t=this,ed=t.get(v),w;switch(c){case"mceFocus":ed.focus();return true;case"mceAddEditor":case"mceAddControl":if(!t.get(v))new tinymce.Editor(v,t.settings).render();return true;case"mceAddFrameControl":w=v.window;w.tinyMCE=tinyMCE;w.tinymce=tinymce;tinymce.DOM.doc=w.document;tinymce.DOM.win=w;ed=new tinymce.Editor(v.element_id,v);ed.render();if(tinymce.isIE){function clr(){ed.destroy();w.detachEvent('onunload',clr);w=w.tinyMCE=w.tinymce=null;};w.attachEvent('onunload',clr);}v.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(ed)ed.remove();return true;case'mceToggleEditor':if(!ed){t.execCommand('mceAddControl',0,v);return true;}if(ed.isHidden())ed.show();else ed.hide();return true;}if(t.activeEditor)return t.activeEditor.execCommand(c,u,v);return false;},execInstanceCommand:function(id,c,u,v){var ed=this.get(id);if(ed)return ed.execCommand(c,u,v);return false;},triggerSave:function(){each(this.editors,function(e){e.save();});},addI18n:function(p,o){var lo,i18n=this.i18n;if(!tinymce.is(p,'string')){each(p,function(o,lc){each(o,function(o,g){each(o,function(o,k){if(g==='common')i18n[lc+'.'+k]=o;else i18n[lc+'.'+g+'.'+k]=o;});});});}else{each(o,function(o,k){i18n[p+'.'+k]=o;});}},_setActive:function(e){this.selectedInstance=this.activeEditor=e;}});tinymce.EditorManager.preInit();})();var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,Dispatcher=tinymce.util.Dispatcher;var each=tinymce.each,isGecko=tinymce.isGecko,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit;var is=tinymce.is,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,EditorManager=tinymce.EditorManager;var inArray=tinymce.inArray,grep=tinymce.grep,explode=tinymce.explode;tinymce.create('tinymce.Editor',{Editor:function(id,s){var t=this;t.id=t.editorId=id;t.execCommands={};t.queryStateCommands={};t.queryValueCommands={};t.plugins={};each(['onPreInit','onBeforeRenderUI','onPostRender','onInit','onRemove','onActivate','onDeactivate','onClick','onEvent','onMouseUp','onMouseDown','onDblClick','onKeyDown','onKeyUp','onKeyPress','onContextMenu','onSubmit','onReset','onPaste','onPreProcess','onPostProcess','onBeforeSetContent','onBeforeGetContent','onSetContent','onGetContent','onLoadContent','onSaveContent','onNodeChange','onChange','onBeforeExecCommand','onExecCommand','onUndo','onRedo','onVisualAid','onSetProgressState'],function(e){t[e]=new Dispatcher(t);});t.settings=s=extend({id:id,language:'en',docs_language:'en',theme:'simple',skin:'default',delta_width:0,delta_height:0,popup_css:'',plugins:'',document_base_url:tinymce.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:'mceItemTable',visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:'xx-small,x-small,small,medium,large,x-large,xx-large',apply_source_formatting:1,directionality:'ltr',forced_root_block:'p',valid_elements:'@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:'30px',keep_styles:1},s);t.documentBaseURI=new tinymce.util.URI(s.document_base_url||tinymce.documentBaseURL,{base_uri:tinyMCE.baseURI});t.baseURI=EditorManager.baseURI;t.execCallback('setup',t);},render:function(nst){var t=this,s=t.settings,id=t.id,sl=tinymce.ScriptLoader;if(!Event.domLoaded){Event.add(document,'init',function(){t.render();});return;}if(!nst){s.strict_loading_mode=1;tinyMCE.settings=s;}if(!t.getElement())return;if(s.strict_loading_mode){sl.settings.strict_mode=s.strict_loading_mode;tinymce.DOM.settings.strict=1;}if(!/TEXTAREA|INPUT/i.test(t.getElement().nodeName)&&s.hidden_input&&DOM.getParent(id,'form'))DOM.insertAfter(DOM.create('input',{type:'hidden',name:id}),id);t.windowManager=new tinymce.WindowManager(t);if(s.encoding=='xml'){t.onGetContent.add(function(ed,o){if(o.save)o.content=DOM.encode(o.content);});}if(s.add_form_submit_trigger){t.onSubmit.addToTop(function(){if(t.initialized){t.save();t.isNotDirty=1;}});}if(s.add_unload_trigger&&!s.ask){t._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(t.initialized&&!t.destroyed&&!t.isHidden())t.save({format:'raw',no_events:true});});}tinymce.addUnload(t.destroy,t);if(s.submit_patch){t.onBeforeRenderUI.add(function(){var n=t.getElement().form;if(!n)return;if(n._mceOldSubmit)return;if(!n.submit.nodeType&&!n.submit.length){t.formElement=n;n._mceOldSubmit=n.submit;n.submit=function(){EditorManager.triggerSave();t.isNotDirty=1;return this._mceOldSubmit(this);};}n=null;});}function loadScripts(){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme.charAt(0)!='-'&&!ThemeManager.urls[s.theme])ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');each(explode(s.plugins),function(p){if(p&&p.charAt(0)!='-'&&!PluginManager.urls[p]){if(!isWebKit&&p=='safari')return;PluginManager.load(p,'plugins/'+p+'/editor_plugin'+tinymce.suffix+'.js');}});sl.loadQueue(function(){if(s.ask){function ask(){window.setTimeout(function(){Event.remove(t.id,'focus',ask);t.windowManager.confirm(t.getLang('edit_confirm'),function(s){if(s)t.init();});},0);};Event.add(t.id,'focus',ask);return;}if(!t.removed)t.init();});};if(s.plugins.indexOf('compat2x')!=-1){PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');sl.loadQueue(loadScripts);}else loadScripts();},init:function(){var n,t=this,s=t.settings,w,h,e=t.getElement(),o,ti,u,bi,bc,re;EditorManager.add(t);s.theme=s.theme.replace(/-/,'');o=ThemeManager.get(s.theme);t.theme=new o();if(t.theme.init&&s.init_theme)t.theme.init(t,ThemeManager.urls[s.theme]||tinymce.documentBaseURL.replace(/\/$/,''));each(explode(s.plugins.replace(/\-/g,'')),function(p){var c=PluginManager.get(p),u=PluginManager.urls[p]||tinymce.documentBaseURL.replace(/\/$/,''),po;if(c){po=new c(t,u);t.plugins[p]=po;if(po.init)po.init(t,u);}});if(s.popup_css!==false){if(s.popup_css)s.popup_css=t.documentBaseURI.toAbsolute(s.popup_css);else s.popup_css=t.baseURI.toAbsolute("themes/"+s.theme+"/skins/"+s.skin+"/dialog.css");}if(s.popup_css_add)s.popup_css+=','+t.documentBaseURI.toAbsolute(s.popup_css_add);t.controlManager=new tinymce.ControlManager(t);t.undoManager=new tinymce.UndoManager(t);t.undoManager.onAdd.add(function(um,l){if(!l.initial)return t.onChange.dispatch(t,l,um);});t.undoManager.onUndo.add(function(um,l){return t.onUndo.dispatch(t,l,um);});t.undoManager.onRedo.add(function(um,l){return t.onRedo.dispatch(t,l,um);});if(s.custom_undo_redo){t.onExecCommand.add(function(ed,cmd,ui,val,a){if(cmd!='Undo'&&cmd!='Redo'&&cmd!='mceRepaint'&&(!a||!a.skip_undo))t.undoManager.add();});}t.onExecCommand.add(function(ed,c){if(!/^(FontName|FontSize)$/.test(c))t.nodeChanged();});if(isGecko){function repaint(a,o){if(!o||!o.initial)t.execCommand('mceRepaint');};t.onUndo.add(repaint);t.onRedo.add(repaint);t.onSetContent.add(repaint);}t.onBeforeRenderUI.dispatch(t,t.controlManager);if(s.render_ui){w=s.width||e.style.width||e.offsetWidth;h=s.height||e.style.height||e.offsetHeight;t.orgDisplay=e.style.display;re=/^[0-9\.]+(|px)$/i;if(re.test(''+w))w=Math.max(parseInt(w)+(o.deltaWidth||0),100);if(re.test(''+h))h=Math.max(parseInt(h)+(o.deltaHeight||0),100);o=t.theme.renderUI({targetNode:e,width:w,height:h,deltaWidth:s.delta_width,deltaHeight:s.delta_height});t.editorContainer=o.editorContainer;}DOM.setStyles(o.sizeContainer||o.editorContainer,{width:w,height:h});h=(o.iframeHeight||h)+(typeof(h)=='number'?(o.deltaHeight||0):'');if(h<100)h=100;t.iframeHTML=s.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+t.documentBaseURI.getURI()+'" />';t.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(tinymce.relaxedDomain)t.iframeHTML+='<script type="text/javascript">document.domain = "'+tinymce.relaxedDomain+'";</script>';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='</head><body id="'+bi+'" class="mceContentBody '+bc+'"></body></html>';if(tinymce.relaxedDomain){if(isIE||(tinymce.isOpera&&parseFloat(opera.version())>=9.5))u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{if(!s.readonly)d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);if(!s.readonly)b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,element_format:s.element_format,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;if(!s.readonly)t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('</('+v+')>','g'),'</'+n+'>');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'<br />');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*<pre.*?>/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='<pre class="mceItemHidden">'+o.content+'</pre>';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,'');});}if(isGecko&&!s.readonly){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language||'en',i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[(this.settings.language||'en')+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;if(e){o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;}},save:function(o){var t=this,e=t.getElement(),h,f;if(!e||!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'<br mce_bogus="1" />');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko&&!s.readonly){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){var c=e.keyCode;if((c>=33&&c<=36)||(c>=37&&c<=40)||c==13||c==45||c==46||c==8||(tinymce.isMac&&(c==91||c==93))||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i<el.length;i++){if(el[i].type!='hidden')return el[i];}}else{for(i=x-1;i>=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'<h'+i+'>']);t.addShortcut('ctrl+7','',['FormatBlock',false,'<p>']);t.addShortcut('ctrl+8','',['FormatBlock',false,'<div>']);t.addShortcut('ctrl+9','',['FormatBlock',false,'<address>']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(tinymce.isMac&&o.ctrl!=e.metaKey)return;else if(!tinymce.isMac&&o.ctrl!=e.ctrlKey)return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function process(no){var n,sp,nl,x;if(!s.inline_styles)return;nl=t.dom.select('font',no);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}};t.onPreProcess.add(function(ed,o){if(o.get)process(o.node);});t.onSetContent.add(function(ed,o){if(o.initial)process(o.node);});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'</'+d[d.length-1].tag+'>';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='</'+d[i].tag+'>';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;function isBlock(n){return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName);};tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else{if(ed.settings.convert_fonts_to_spans)t._applyInlineStyle('span',{style:{fontFamily:v}});else ed.getDoc().execCommand('FontName',false,v);}},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fc,fs;if(s.convert_fonts_to_spans&&v>=1&&v<=7){fs=tinymce.explode(s.font_size_style_values);fc=tinymce.explode(s.font_size_classes);if(fc)v=fc[v-1]||v;else v=fs[v-1]||v;}if(v>=1&&v<=7)ed.getDoc().execCommand('FontSize',false,v);else this._applyInlineStyle('span',{style:{fontSize:v}});},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontSize;if(!v&&(isOpera||isWebKit)){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return v||this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontFamily.replace(/, /g,',').replace(/[\'\"]/g,'').toLowerCase();if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(bl||n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(bl&&/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(bl||n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('<hr />');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if((e=t.getSelectedElement())&&!ed.settings.force_span_wrappers)set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(ed.settings.force_span_wrappers&&p.nodeName!='SPAN')return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},ForeColor:function(ui,v){var ed=this.editor;if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{color:v}});return;}else ed.getDoc().execCommand('ForeColor',false,v);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{backgroundColor:val}});return;}function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'<p>'):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!ed.settings.inline_styles&&!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE'));},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),isBlock);eb=dom.getParent(s.getEnd(),isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_applyInlineStyle:function(na,at,op){var t=this,ed=t.editor,dom=ed.dom,bm,lo={},kh;na=na.toUpperCase();if(op&&op.check_classes&&at['class'])op.check_classes.push(at['class']);function replaceFonts(){var bm;each(dom.select(tinymce.isWebKit&&!tinymce.isAir?'span':'font'),function(n){if(n.style.fontFamily=='mceinline'||n.face=='mceinline'){if(!bm)bm=ed.selection.getBookmark();at._mce_new='1';dom.replace(dom.create(na,at),n,1);}});each(dom.select(na),function(n){if(n.getAttribute('_mce_new')){function removeStyle(n){if(n.nodeType==1){each(at.style,function(v,k){dom.setStyle(n,k,'');});if(at['class']&&n.className&&op){each(op.check_classes,function(c){if(dom.hasClass(n,c))dom.removeClass(n,c);});}}};each(dom.select(na,n),removeStyle);if(n.parentNode&&n.parentNode.nodeType==1&&n.parentNode.childNodes.length==1)removeStyle(n.parentNode);dom.getParent(n.parentNode,function(pn){if(pn.nodeType==1){if(at.style){each(at.style,function(v,k){var sv;if(!lo[k]&&(sv=dom.getStyle(pn,k))){if(sv===v)dom.setStyle(n,k,'');lo[k]=1;}});}if(at['class']&&pn.className&&op){each(op.check_classes,function(c){if(dom.hasClass(pn,c))dom.removeClass(n,c);});}}return false;});n.removeAttribute('_mce_new');}});each(dom.select(na).reverse(),function(n){var c=0;each(dom.getAttribs(n),function(an){if(an.nodeName.substring(0,1)!='_'&&dom.getAttrib(n,an.nodeName)!=''){c++;}});if(c==0)dom.remove(n,1);});ed.selection.moveToBookmark(bm);return!!bm;};ed.focus();ed.getDoc().execCommand('FontName',false,'mceinline');replaceFonts();if(kh=t._applyInlineStyle.keyhandler){ed.onKeyUp.remove(kh);ed.onKeyPress.remove(kh);ed.onKeyDown.remove(kh);ed.onSetContent.remove(t._applyInlineStyle.chandler);}if(ed.selection.isCollapsed()){t._pendingStyles=tinymce.extend(t._pendingStyles||{},at.style);t._applyInlineStyle.chandler=ed.onSetContent.add(function(){delete t._pendingStyles;});t._applyInlineStyle.keyhandler=kh=function(e){if(t._pendingStyles){at.style=t._pendingStyles;delete t._pendingStyles;}if(replaceFonts()){ed.onKeyDown.remove(t._applyInlineStyle.keyhandler);ed.onKeyPress.remove(t._applyInlineStyle.keyhandler);}if(e.type=='keyup')ed.onKeyUp.remove(t._applyInlineStyle.keyhandler);};ed.onKeyDown.add(kh);ed.onKeyPress.add(kh);ed.onKeyUp.add(kh);}else t._pendingStyles=0;},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),isBlock);eb=dom.getParent(en||s.getEnd(),isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i<t.data.length-1;i++)t.data[i]=t.data[i+1];t.data.length--;t.index=t.data.length;}}if(s.custom_undo_redo_restore_selection&&!l.initial)l.bookmark=b=l.bookmark||ed.selection.getBookmark();if(t.index<t.data.length)t.index++;if(t.data.length===0&&!l.initial)return null;t.data.length=t.index+1;t.data[t.index++]=l;if(l.initial)t.index=0;if(t.data.length==2&&t.data[0].initial)t.data[0].bookmark=b;t.onAdd.dispatch(t,l);ed.isNotDirty=0;return l;},undo:function(){var t=this,ed=t.editor,l=l,i;if(t.typing){t.add();t.typing=0;}if(t.index>0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index<t.data.length-1){l=t.data[++t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onRedo.dispatch(t,l);}return l;},clear:function(){var t=this;t.data=[];t.index=0;t.typing=0;t.add({initial:true});},hasUndo:function(){return this.index!=0||this.typing;},hasRedo:function(){return this.index<this.data.length-1;}});(function(){var Event,isIE,isGecko,isOpera,each,extend;Event=tinymce.dom.Event;isIE=tinymce.isIE;isGecko=tinymce.isGecko;isOpera=tinymce.isOpera;each=tinymce.each;extend=tinymce.extend;tinymce.create('tinymce.ForceBlocks',{ForceBlocks:function(ed){var t=this,s=ed.settings,elm;t.editor=ed;t.dom=ed.dom;elm=(s.forced_root_block||'p').toLowerCase();s.element=elm.toUpperCase();ed.onPreInit.add(t.setup,t);t.reOpera=new RegExp('(\\u00a0|&#160;|&nbsp;)<\/'+elm+'>','gi');t.rePadd=new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp('<p( )([^>]+)>(&nbsp;|&#160;)<\\\/p>|<p>(&nbsp;|&#160;)<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*<br \\/>\\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'</'+elm+'>');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0</'+elm+'>');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2><br /></'+elm+'>');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2><br /></'+elm+'>');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0</'+elm+'>');o.content=o.content.replace(t.reTrailBr,'</'+elm+'>');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('<br id="__" /> ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i,n,eid;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(r.startContainer.nodeType==1&&(n=r.startContainer.childNodes[r.startOffset])&&n.nodeType==1){eid=n.getAttribute("id");n.setAttribute("id","__mce");}else{if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}else if(!isIE&&(n=ed.dom.get('__mce'))){if(eid)n.setAttribute('id',eid);else n.removeAttribute('id');r=d.createRange();r.setStartBefore(n);r.setEndBefore(n);se.setRng(r);}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch,car;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'<br />');aft=ed.dom.add(sn,se.element,null,'<br />');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='<br />';function appendStyles(e,en){var nl=[],nn,n,i;e.innerHTML='';if(se.keep_styles){n=en;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)){nn=n.cloneNode(false);dom.setAttrib(nn,'id','');nl.push(nn);}}while(n=n.parentNode);}if(nl.length>0){for(i=nl.length-1,nn=e;i>=0;i--)nn=nn.appendChild(nl[i]);nl[0].innerHTML=isOpera?'&nbsp;':'<br />';return nl[0];}else e.innerHTML=isOpera?'&nbsp;':'<br />';};if(isEmpty(aft))car=appendStyles(aft,en);if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(car||aft):car||aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(y<vp.y||y+ch>vp.y+vp.h){ed.getWin().scrollTo(0,y<vp.y?y:y-vp.h+25);}return false;},backspaceDelete:function(e,bs){var t=this,ed=t.editor,b=ed.getBody(),n,se=ed.selection,r=se.getRng(),sc=r.startContainer,n,w,tn;if(sc&&ed.dom.isBlock(sc)&&!/^(TD|TH)$/.test(sc.nodeName)&&bs){if(sc.childNodes.length==0||(sc.childNodes.length==1&&sc.firstChild.nodeName=='BR')){n=sc;while((n=n.previousSibling)&&!ed.dom.isBlock(n));if(n){if(sc!=b.firstChild){w=ed.dom.doc.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while(tn=w.nextNode())n=tn;r=ed.getDoc().createRange();r.setStart(n,n.nodeValue?n.nodeValue.length:0);r.setEnd(n,n.nodeValue?n.nodeValue.length:0);se.setRng(r);ed.dom.remove(sc);}return Event.cancel(e);}}}function handler(e){var pr;e=e.target;if(e&&e.parentNode&&e.nodeName=='BR'&&(n=t.getParentBlock(e))){pr=e.previousSibling;Event.remove(b,'DOMNodeInserted',handler);if(pr&&pr.nodeType==3&&/\s+$/.test(pr.nodeValue))return;if(e.previousSibling||e.nextSibling)ed.dom.remove(e);}};Event._add(b,'DOMNodeInserted',handler);window.setTimeout(function(){Event._remove(b,'DOMNodeInserted',handler);},1);}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,extend=tinymce.extend;tinymce.create('tinymce.ControlManager',{ControlManager:function(ed,s){var t=this,i;s=s||{};t.editor=ed;t.controls={};t.onAdd=new tinymce.util.Dispatcher(t);t.onPostRender=new tinymce.util.Dispatcher(t);t.prefix=s.prefix||ed.id+'_';t._cls={};t.onPostRender.add(function(){each(t.controls,function(c){c.postRender();});});},get:function(id){return this.controls[this.prefix+id]||this.controls[id];},setActive:function(id,s){var c=null;if(c=this.get(id))c.setActive(s);return c;},setDisabled:function(id,s){var c=null;if(c=this.get(id))c.setDisabled(s);return c;},add:function(c){var t=this;if(c){t.controls[c.id]=c;t.onAdd.dispatch(c,t);}return c;},createControl:function(n){var c,t=this,ed=t.editor;each(ed.plugins,function(p){if(p.createControl){c=p.createControl(n,t);if(c)return false;}});switch(n){case"|":case"separator":return t.createSeparator();}if(!c&&ed.buttons&&(c=ed.buttons[n]))return t.createButton(n,c);return t.add(c);},createDropMenu:function(id,s,cc){var t=this,ed=t.editor,c,bm,v,cls;s=extend({'class':'mceDropDown',constrain:ed.settings.constrain_menus},s);s['class']=s['class']+' '+ed.getParam('skin')+'Skin';if(v=ed.getParam('skin_variant'))s['class']+=' '+ed.getParam('skin')+'Skin'+v.substring(0,1).toUpperCase()+v.substring(1);id=t.prefix+id;cls=cc||t._cls.dropmenu||tinymce.ui.DropMenu;c=t.controls[id]=new cls(id,s);c.onAddItem.add(function(c,o){var s=o.settings;s.title=ed.getLang(s.title,s.title);if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,s.value);};}});ed.onRemove.add(function(){c.destroy();});if(tinymce.isIE){c.onShowMenu.add(function(){bm=ed.selection.getBookmark(1);});c.onHideMenu.add(function(){if(bm)ed.selection.moveToBookmark(bm);});}return t.add(c);},createListBox:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,scope:s.scope,control_manager:t},s);id=t.prefix+id;if(ed.settings.use_native_selects)c=new tinymce.ui.NativeListBox(id,s);else{cls=cc||t._cls.listbox||tinymce.ui.ListBox;c=new cls(id,s);}t.controls[id]=c;if(tinymce.isWebKit){c.onPostRender.add(function(c,n){Event.add(n,'mousedown',function(){ed.bookmark=ed.selection.getBookmark('simple');});Event.add(n,'focus',function(){ed.selection.moveToBookmark(ed.bookmark);ed.bookmark=null;});});}if(c.hideMenu)ed.onMouseDown.add(c.hideMenu,c);return t.add(c);},createButton:function(id,s,cc){var t=this,ed=t.editor,o,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.label=ed.translate(s.label);s.scope=s.scope||ed;if(!s.onclick&&!s.menu_button){s.onclick=function(){ed.execCommand(s.cmd,s.ui||false,s.value);};}s=extend({title:s.title,'class':'mce_'+id,unavailable_prefix:ed.getLang('unavailable',''),scope:s.scope,control_manager:t},s);id=t.prefix+id;if(s.menu_button){cls=cc||t._cls.menubutton||tinymce.ui.MenuButton;c=new cls(id,s);ed.onMouseDown.add(c.hideMenu,c);}else{cls=t._cls.button||tinymce.ui.Button;c=new cls(id,s);}return t.add(c);},createMenuButton:function(id,s,cc){s=s||{};s.menu_button=1;return this.createButton(id,s,cc);},createSplitButton:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,scope:s.scope,control_manager:t},s);id=t.prefix+id;cls=cc||t._cls.splitbutton||tinymce.ui.SplitButton;c=t.add(new cls(id,s));ed.onMouseDown.add(c.hideMenu,c);return c;},createColorSplitButton:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls,bm;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,'menu_class':ed.getParam('skin')+'Skin',scope:s.scope,more_colors_title:ed.getLang('more_colors')},s);id=t.prefix+id;cls=cc||t._cls.colorsplitbutton||tinymce.ui.ColorSplitButton;c=new cls(id,s);ed.onMouseDown.add(c.hideMenu,c);ed.onRemove.add(function(){c.destroy();});if(tinymce.isIE){c.onShowMenu.add(function(){bm=ed.selection.getBookmark(1);});c.onHideMenu.add(function(){if(bm){ed.selection.moveToBookmark(bm);bm=0;}});}return t.add(c);},createToolbar:function(id,s,cc){var c,t=this,cls;id=t.prefix+id;cls=cc||t._cls.toolbar||tinymce.ui.Toolbar;c=new cls(id,s);if(t.get(id))return null;return t.add(c);},createSeparator:function(cc){var cls=cc||this._cls.separator||tinymce.ui.Separator;return new cls();},setControlType:function(n,c){return this._cls[n.toLowerCase()]=c;},destroy:function(){each(this.controls,function(c){c.destroy();});this.controls=null;}});})();(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each,isIE=tinymce.isIE,isOpera=tinymce.isOpera;tinymce.create('tinymce.WindowManager',{WindowManager:function(ed){var t=this;t.editor=ed;t.onOpen=new Dispatcher(t);t.onClose=new Dispatcher(t);t.params={};t.features={};},open:function(s,p){var t=this,f='',x,y,mo=t.editor.settings.dialog_type=='modal',w,sw,sh,vp=tinymce.DOM.getViewPort(),u;s=s||{};p=p||{};sw=isOpera?vp.w:screen.width;sh=isOpera?vp.h:screen.height;s.name=s.name||'mc_'+new Date().getTime();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240);s.resizable=true;s.left=s.left||parseInt(sw/ 2.0) - (s.width /2.0);s.top=s.top||parseInt(sh/ 2.0) - (s.height /2.0);p.inline=false;p.mce_width=s.width;p.mce_height=s.height;p.mce_auto_focus=s.auto_focus;if(mo){if(isIE){s.center=true;s.help=false;s.dialogWidth=s.width+'px';s.dialogHeight=s.height+'px';s.scroll=s.scrollbars||false;}}each(s,function(v,k){if(tinymce.is(v,'boolean'))v=v?'yes':'no';if(!/^(name|url)$/.test(k)){if(isIE&&mo)f+=(f?';':'')+k+':'+v;else f+=(f?',':'')+k+'='+v;}});t.features=s;t.params=p;t.onOpen.dispatch(t,s,p);u=s.url||s.file;if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);try{if(isIE&&mo){w=1;window.showModalDialog(u,window,f);}else w=window.open(u,s.name,f);}catch(ex){}if(!w)alert(t.editor.getLang('popup_blocked'));},close:function(w){w.close();this.onClose.dispatch(this);},createInstance:function(cl,a,b,c,d,e){var f=tinymce.resolve(cl);return new f(a,b,c,d,e);},confirm:function(t,cb,s,w){w=w||window;cb.call(s||this,w.confirm(this._decode(this.editor.getLang(t,t))));},alert:function(tx,cb,s,w){var t=this;w=w||window;w.alert(t._decode(t.editor.getLang(tx,tx)));if(cb)cb.call(s||t);},_decode:function(s){return tinymce.DOM.decode(s).replace(/\\n/g,'\n');}});}());
\ No newline at end of file
+var tinymce={majorVersion:"3",minorVersion:"2.4.1",releaseDate:"2009-05-25",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h<a.length;h++){if(m=a[h].href){if(/^https?:\/\/[^\/]+$/.test(m)){m+="/"}f=m?m.match(/.*\//)[0]:""}}function c(d){if(d.src&&/tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){o.suffix="_src"}if((e=d.src.indexOf("?"))!=-1){o.query=d.src.substring(e+1)}o.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(f&&o.baseURL.indexOf("://")==-1){o.baseURL=f+o.baseURL}return o.baseURL}return null}a=k.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}g=k.getElementsByTagName("head")[0];if(g){a=g.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}}return},is:function(b,a){var c=typeof(b);if(!a){return c!="undefined"}if(a=="array"&&(b.hasOwnProperty&&b instanceof Array)){return true}return c==a},each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},map:function(b,c){var d=[];tinymce.each(b,function(a){d.push(c(a))});return d},grep:function(b,c){var d=[];tinymce.each(b,function(a){if(!c||c(a)){d.push(a)}});return d},inArray:function(c,d){var e,b;if(c){for(e=0,b=c.length;e<b;e++){if(c[e]===d){return e}}}return -1},extend:function(f,d){var c,b=arguments;for(c=1;c<b.length;c++){d=b[c];tinymce.each(d,function(a,e){if(typeof(a)!=="undefined"){f[e]=a}})}return f},trim:function(a){return(a?""+a:"").replace(/^\s*|\s*$/g,"")},create:function(j,a){var i=this,b,e,f,g,d,h=0;j=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(j);f=j[3].match(/(^|\.)(\w+)$/i)[2];e=i.createNS(j[3].replace(/\.\w+$/,""));if(e[f]){return}if(j[2]=="static"){e[f]=a;if(this.onCreate){this.onCreate(j[2],j[3],e[f])}return}if(!a[f]){a[f]=function(){};h=1}e[f]=a[f];i.extend(e[f].prototype,a);if(j[5]){b=i.resolve(j[5]).prototype;g=j[5].match(/\.(\w+)$/i)[1];d=e[f];if(h){e[f]=function(){return b[g].apply(this,arguments)}}else{e[f]=function(){this.parent=b[g];return d.apply(this,arguments)}}e[f].prototype[f]=e[f];i.each(b,function(c,k){e[f].prototype[k]=b[k]});i.each(a,function(c,k){if(b[k]){e[f].prototype[k]=function(){this.parent=b[k];return c.apply(this,arguments)}}else{if(k!=f){e[f].prototype[k]=c}}})}i.each(a["static"],function(c,k){e[f][k]=c});if(this.onCreate){this.onCreate(j[2],j[3],e[f].prototype)}},walk:function(c,b,d,a){a=a||this;if(c){if(d){c=c[d]}tinymce.each(c,function(f,e){if(b.call(a,f,e,d)===false){return false}tinymce.walk(f,b,d,a)})}},createNS:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0;b<d.length;b++){a=d[b];if(!c[a]){c[a]={}}c=c[a]}return c},resolve:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0,a=d.length;b<a;b++){c=c[d[b]];if(!c){break}}return c},addUnload:function(e,d){var c=this,a=window;e={func:e,scope:d||this};if(!c.unloads){function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){h.func.call(h.scope,1)}}if(a.detachEvent){a.detachEvent("onbeforeunload",g);a.detachEvent("onunload",b)}else{if(a.removeEventListener){a.removeEventListener("unload",b,false)}}c.unloads=h=f=a=b=0;if(window.CollectGarbage){window.CollectGarbage()}}}function g(){var h=document;if(h.readyState=="interactive"){function f(){h.detachEvent("onstop",f);if(b){b()}h=0}if(h){h.attachEvent("onstop",f)}window.setTimeout(function(){if(h){h.detachEvent("onstop",f)}},0)}}if(a.attachEvent){a.attachEvent("onunload",b);a.attachEvent("onbeforeunload",g)}else{if(a.addEventListener){a.addEventListener("unload",b,false)}}c.unloads=[e]}else{c.unloads.push(e)}return e},removeUnload:function(c){var a=this.unloads,b=null;tinymce.each(a,function(e,d){if(e&&e.func==c){a.splice(d,1);b=c;return false}});return b},explode:function(a,b){return a?tinymce.map(a.split(b||","),tinymce.trim):a},_addVer:function(b){var a;if(!this.query){return b}a=(b.indexOf("?")==-1?"?":"&")+this.query;if(b.indexOf("#")==-1){return b+a}return b.replace("#",a+"#")}};window.tinymce=tinymce;tinymce._init();tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(e.indexOf(":/")===-1&&e.indexOf("//")!==0){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,g=[],d;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(h){if(h){g.push(h)}});e=g;for(c=f.length-1,g=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}g.push(f[c])}c=e.length-b;if(c<=0){return"/"+g.reverse().join("/")+d}return"/"+e.slice(0,c).join("/")+"/"+g.reverse().join("/")+d},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;f.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+"</"+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var h=this,i=h.doc,g;if(!f){f=""}g=h.select("head")[0];e(f.split(","),function(j){var k;if(h.files[j]){return}h.files[j]=true;k=h.create("link",{rel:"stylesheet",href:c._addVer(j)});if(a&&i.documentMode){k.onload=function(){i.recalc();k.onload=null}}g.appendChild(k)})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML="<br />"+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/<p ([^>]+)>|<p>/g,'<div $1 mce_tmp="1">');g=g.replace(/<\/p>/g,"</div>");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h<q.childNodes.length;h++){l.appendChild(q.childNodes[h].cloneNode(true))}q.swapNode(l)}}}}}else{m.innerHTML=g}return g})},processHTML:function(j){var g=this,i=g.settings;if(!i.process_html){return j}if(c.isGecko){j=j.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|<em( [^>]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/&apos;/g,"&#39;");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(i.keep_values){if(/<script|style/.test(j)){function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/^[\r\n]*|[\r\n]*$/g,"");h=h.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");h=h.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return h}j=j.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g,function(h,l,k){if(!l){l=' type="text/javascript"'}l=l.replace(/(type|language)=\"?/,"$&mce-");l=l.replace(/src=\"([^\"]+)\"?/,function(m,n){if(i.url_converter){n=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(n),"src","script"))}return'mce_src="'+n+'"'});if(c.trim(k)){k="<!--\n"+f(k)+"\n// -->"}return"<mce:script"+l+">"+k+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g,function(h,l,k){if(k){k="<!--\n"+f(k)+"\n-->"}return"<mce:style"+l+">"+k+"</mce:style><style "+l+' mce_bogus="1">'+k+"</style>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,l){function k(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}if(i.hex_colors){p=p.replace(/rgb\([^\)]+\)/g,function(m){return g.toHex(m)})}if(i.url_converter){p=p.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(m,r){return"url("+g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(r),n,l))+")"})}}else{if(n!="coords"&&n!="shape"){if(i.url_converter){p=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(q),n,l))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,k);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,k);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,k)})}return j},getOuterHTML:function(f){var g;f=this.get(f);if(!f){return null}if(f.outerHTML!==undefined){return f.outerHTML}g=(f.ownerDocument||this.doc).createElement("body");g.appendChild(f.cloneNode(true));return g.innerHTML},setOuterHTML:function(i,g,j){var f=this;return this.run(i,function(h){var l,k;h=f.get(h);j=j||h.ownerDocument||f.doc;if(a&&h.nodeType==1){h.outerHTML=g}else{k=j.createElement("body");k.innerHTML=g;l=k.lastChild;while(l){f.insertAfter(l.cloneNode(true),h);l=l.previousSibling}f.remove(h)}})},decode:function(g){var h,i,f;if(/&[^;]+;/.test(g)){h=this.doc.createElement("div");h.innerHTML=g;i=h.firstChild;f="";if(i){do{f+=i.nodeValue}while(i.nextSibling)}return f||g}return g},encode:function(f){return f?(""+f).replace(/[<>&\"]/g,function(h,g){switch(h){case"&":return"&amp;";case'"':return"&quot;";case"<":return"&lt;";case">":return"&gt;"}return h}):f},insertAfter:function(h,g){var f=this;g=f.get(g);return this.run(h,function(k){var j,i;j=g.parentNode;i=g.nextSibling;if(i){j.insertBefore(k,i)}else{j.appendChild(k)}return k})},isBlock:function(f){if(f.nodeType&&f.nodeType!==1){return false}f=f.nodeName||f;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(f)},replace:function(i,h,f){var g=this;if(b(h,"array")){i=i.cloneNode(true)}return g.run(h,function(j){if(f){e(j.childNodes,function(k){i.appendChild(k.cloneNode(true))})}if(g.fixPsuedoLeaks&&j.nodeType===1){j.parentNode.insertBefore(i,j);g.remove(j);return i}return j.parentNode.replaceChild(i,j)})},findCommonAncestor:function(h,f){var i=h,g;while(i){g=f;while(g&&i!=g){g=g.parentNode}if(i==g){break}i=i.parentNode}if(!i&&h.ownerDocument){return h.ownerDocument.documentElement}return i},toHex:function(f){var h=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(f);function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}if(h){f="#"+g(h[1])+g(h[2])+g(h[3]);return f}return f},getClasses:function(){var l=this,g=[],k,m={},n=l.settings.class_filter,j;if(l.classes){return l.classes}function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,function(i){switch(i.type||1){case 1:if(i.selectorText){e(i.selectorText.split(","),function(p){p=p.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(p)||!/\.[\w\-]+$/.test(p)){return}j=p;p=p.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(n&&!(p=n(p,j))){return}if(!m[p]){g.push({"class":p});m[p]=1}})}break;case 3:o(i.styleSheet);break}})}try{e(l.doc.styleSheets,o)}catch(h){}if(g.length>0){l.classes=g}return g},run:function(j,i,h){var g=this,k;if(g.doc&&typeof(j)==="string"){j=g.get(j)}if(!j){return false}h=h||this;if(!j.nodeType&&(j.length||j.length===0)){k=[];e(j,function(l,f){if(l){if(typeof(l)=="string"){l=g.doc.getElementById(l)}k.push(i.call(h,l,f))}});return k}return i.call(h,j)},getAttribs:function(g){var f;g=this.get(g);if(!g){return[]}if(a){f=[];if(g.nodeName=="OBJECT"){return g.attributes}g.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(i,h){f.push({specified:1,nodeName:h})});return f}return g.attributes},destroy:function(g){var f=this;if(f.events){f.events.destroy()}f.win=f.doc=f.root=f.events=null;if(!g){c.removeUnload(f.destroy)}},createRng:function(){var f=this.doc;return f.createRange?f.createRange():new c.dom.Range(this)},split:function(l,k,o){var p=this,f=p.createRng(),m,j,n;function g(r,q){r=r[q];if(r&&r[q]&&r[q].nodeType==1&&i(r[q])){p.remove(r[q])}}function i(q){q=p.getOuterHTML(q);q=q.replace(/<(img|hr|table)/gi,"-");q=q.replace(/<[^>]+>/g,"");return q.replace(/[ \t\r\n]+|&nbsp;|&#160;/g,"")==""}function h(r){var q=0;while(r.previousSibling){q++;r=r.previousSibling}return q}if(l&&k){f.setStart(l.parentNode,h(l));f.setEnd(k.parentNode,h(k));m=f.extractContents();f=p.createRng();f.setStart(k.parentNode,h(k)+1);f.setEnd(l.parentNode,h(l)+1);j=f.extractContents();n=l.parentNode;g(m,"lastChild");if(!i(m)){n.insertBefore(m,l)}if(o){n.replaceChild(o,k)}else{n.insertBefore(k,l)}g(j,"firstChild");if(!i(j)){n.insertBefore(j,l)}p.remove(l);return o||k}},bind:function(j,f,i,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.add(j,f,i,h||this)},unbind:function(i,f,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.remove(i,f,h)},_isRes:function(f){return/^(top|left|bottom|right|width|height)/i.test(f)||/;\s*(top|left|bottom|right|width|height)/i.test(f)}});c.DOM=new c.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(f){var h=0,c=1,e=2,d=tinymce.extend;function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild,j=0;l!=m;l=l.nextSibling){j++}return j}function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}return j}function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.firstChild;while(l!=null&&k>0){--k;l=l.nextSibling}if(l!=null){return l}return j}function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,endContainer:j,endOffset:0,collapsed:true,commonAncestorContainer:j,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3})}d(a.prototype,{setStart:function(k,j){this._setEndPoint(true,k,j)},setEnd:function(k,j){this._setEndPoint(false,k,j)},setStartBefore:function(j){this.setStart(j.parentNode,b(j))},setStartAfter:function(j){this.setStart(j.parentNode,b(j)+1)},setEndBefore:function(j){this.setEnd(j.parentNode,b(j))},setEndAfter:function(j){this.setEnd(j.parentNode,b(j)+1)},collapse:function(k){var j=this;if(k){j.endContainer=j.startContainer;j.endOffset=j.startOffset}else{j.startContainer=j.endContainer;j.startOffset=j.endOffset}j.collapsed=true},selectNode:function(j){this.setStartBefore(j);this.setEndAfter(j)},selectNodeContents:function(j){this.setStart(j,0);this.setEnd(j,j.nodeType===1?j.childNodes.length:j.nodeValue.length)},compareBoundaryPoints:function(m,n){var l=this,p=l.startContainer,o=l.startOffset,k=l.endContainer,j=l.endOffset;if(m===0){return l._compareBoundaryPoints(p,o,p,o)}if(m===1){return l._compareBoundaryPoints(p,o,k,j)}if(m===2){return l._compareBoundaryPoints(k,j,k,j)}if(m===3){return l._compareBoundaryPoints(k,j,p,o)}},deleteContents:function(){this._traverse(e)},extractContents:function(){return this._traverse(h)},cloneContents:function(){return this._traverse(c)},insertNode:function(m){var j=this,l,k;if(m.nodeType===3||m.nodeType===4){l=j.startContainer.splitText(j.startOffset);j.startContainer.parentNode.insertBefore(m,l)}else{if(j.startContainer.childNodes.length>0){k=j.startContainer.childNodes[j.startOffset]}j.startContainer.insertBefore(m,k)}},surroundContents:function(l){var j=this,k=j.extractContents();j.insertNode(l);l.appendChild(k);j.selectNode(l)},cloneRange:function(){var j=this;return d(new a(j.dom),{startContainer:j.startContainer,startOffset:j.startOffset,endContainer:j.endContainer,endOffset:j.endOffset,collapsed:j.collapsed,commonAncestorContainer:j.commonAncestorContainer})},_isCollapsed:function(){return(this.startContainer==this.endContainer&&this.startOffset==this.endOffset)},_compareBoundaryPoints:function(m,p,k,o){var q,l,j,r,t,s;if(m==k){if(p==o){return 0}else{if(p<o){return -1}else{return 1}}}q=k;while(q&&q.parentNode!=m){q=q.parentNode}if(q){l=0;j=m.firstChild;while(j!=q&&l<p){l++;j=j.nextSibling}if(p<=l){return -1}else{return 1}}q=m;while(q&&q.parentNode!=k){q=q.parentNode}if(q){l=0;j=k.firstChild;while(j!=q&&l<o){l++;j=j.nextSibling}if(l<o){return -1}else{return 1}}r=this.dom.findCommonAncestor(m,k);t=m;while(t&&t.parentNode!=r){t=t.parentNode}if(!t){t=r}s=k;while(s&&s.parentNode!=r){s=s.parentNode}if(!s){s=r}if(t==s){return 0}j=r.firstChild;while(j){if(j==t){return -1}if(j==s){return 1}j=j.nextSibling}},_setEndPoint:function(k,q,p){var l=this,j,m;if(k){l.startContainer=q;l.startOffset=p}else{l.endContainer=q;l.endOffset=p}j=l.endContainer;while(j.parentNode){j=j.parentNode}m=l.startContainer;while(m.parentNode){m=m.parentNode}if(m!=j){l.collapse(k)}else{if(l._compareBoundaryPoints(l.startContainer,l.startOffset,l.endContainer,l.endOffset)>0){l.collapse(k)}}l.collapsed=l._isCollapsed();l.commonAncestorContainer=l.dom.findCommonAncestor(l.startContainer,l.endContainer)},_traverse:function(r){var s=this,q,m=0,v=0,k,o,l,n,j,u;if(s.startContainer==s.endContainer){return s._traverseSameContainer(r)}for(q=s.endContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.startContainer){return s._traverseCommonStartContainer(q,r)}++m}for(q=s.startContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.endContainer){return s._traverseCommonEndContainer(q,r)}++v}o=v-m;l=s.startContainer;while(o>0){l=l.parentNode;o--}n=s.endContainer;while(o<0){n=n.parentNode;o++}for(j=l.parentNode,u=n.parentNode;j!=u;j=j.parentNode,u=u.parentNode){l=j;n=u}return s._traverseCommonAncestors(l,n,r)},_traverseSameContainer:function(o){var r=this,q,u,j,k,l,p,m;if(o!=e){q=r.dom.doc.createDocumentFragment()}if(r.startOffset==r.endOffset){return q}if(r.startContainer.nodeType==3){u=r.startContainer.nodeValue;j=u.substring(r.startOffset,r.endOffset);if(o!=c){r.startContainer.deleteData(r.startOffset,r.endOffset-r.startOffset);r.collapse(true)}if(o==e){return null}q.appendChild(r.dom.doc.createTextNode(j));return q}k=i(r.startContainer,r.startOffset);l=r.endOffset-r.startOffset;while(l>0){p=k.nextSibling;m=r._traverseFullySelected(k,o);if(q){q.appendChild(m)}--l;k=p}if(o!=c){r.collapse(true)}return q},_traverseCommonStartContainer:function(j,p){var s=this,r,k,l,m,q,o;if(p!=e){r=s.dom.doc.createDocumentFragment()}k=s._traverseRightBoundary(j,p);if(r){r.appendChild(k)}l=g(j,s.startContainer);m=l-s.startOffset;if(m<=0){if(p!=c){s.setEndBefore(j);s.collapse(false)}return r}k=j.previousSibling;while(m>0){q=k.previousSibling;o=s._traverseFullySelected(k,p);if(r){r.insertBefore(o,r.firstChild)}--m;k=q}if(p!=c){s.setEndBefore(j);s.collapse(false)}return r},_traverseCommonEndContainer:function(m,p){var s=this,r,o,j,k,q,l;if(p!=e){r=s.dom.doc.createDocumentFragment()}j=s._traverseLeftBoundary(m,p);if(r){r.appendChild(j)}o=g(m,s.endContainer);++o;k=s.endOffset-o;j=m.nextSibling;while(k>0){q=j.nextSibling;l=s._traverseFullySelected(j,p);if(r){r.appendChild(l)}--k;j=q}if(p!=c){s.setStartAfter(m);s.collapse(true)}return r},_traverseCommonAncestors:function(p,j,s){var w=this,l,v,o,q,r,k,u,m;if(s!=e){v=w.dom.doc.createDocumentFragment()}l=w._traverseLeftBoundary(p,s);if(v){v.appendChild(l)}o=p.parentNode;q=g(p,o);r=g(j,o);++q;k=r-q;u=p.nextSibling;while(k>0){m=u.nextSibling;l=w._traverseFullySelected(u,s);if(v){v.appendChild(l)}u=m;--k}l=w._traverseRightBoundary(j,s);if(v){v.appendChild(l)}if(s!=c){w.setStartAfter(p);w.collapse(true)}return v},_traverseRightBoundary:function(p,q){var s=this,l=i(s.endContainer,s.endOffset-1),r,o,n,j,k;var m=l!=s.endContainer;if(l==p){return s._traverseNode(l,m,false,q)}r=l.parentNode;o=s._traverseNode(r,false,false,q);while(r!=null){while(l!=null){n=l.previousSibling;j=s._traverseNode(l,m,false,q);if(q!=e){o.insertBefore(j,o.firstChild)}m=true;l=n}if(r==p){return o}l=r.previousSibling;r=r.parentNode;k=s._traverseNode(r,false,false,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseLeftBoundary:function(p,q){var s=this,m=i(s.startContainer,s.startOffset);var n=m!=s.startContainer,r,o,l,j,k;if(m==p){return s._traverseNode(m,n,true,q)}r=m.parentNode;o=s._traverseNode(r,false,true,q);while(r!=null){while(m!=null){l=m.nextSibling;j=s._traverseNode(m,n,true,q);if(q!=e){o.appendChild(j)}n=true;m=l}if(r==p){return o}m=r.nextSibling;r=r.parentNode;k=s._traverseNode(r,false,true,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseNode:function(j,o,r,s){var u=this,m,l,p,k,q;if(o){return u._traverseFullySelected(j,s)}if(j.nodeType==3){m=j.nodeValue;if(r){k=u.startOffset;l=m.substring(k);p=m.substring(0,k)}else{k=u.endOffset;l=m.substring(0,k);p=m.substring(k)}if(s!=c){j.nodeValue=p}if(s==e){return null}q=j.cloneNode(false);q.nodeValue=l;return q}if(s==e){return null}return j.cloneNode(false)},_traverseFullySelected:function(l,k){var j=this;if(k!=e){return k==c?l.cloneNode(true):l}l.parentNode.removeChild(l);return null}});f.Range=a})(tinymce.dom);(function(){function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.item&&i.item&&j.item(0)===i.item(0)){return 1}if(j.isEqual&&i.isEqual&&i.isEqual(j)){return 1}}return 0}function f(){var m=e.dom,j=e.getRng(),s=m.createRng(),p,k,n,q,o,l;function i(v){var t=v.parentNode.childNodes,u;for(u=t.length-1;u>=0;u--){if(t[u]==v){return u}}return -1}function r(v){var t=j.duplicate(),B,y,u,w,x=0,z=0,A,C;t.collapse(v);B=t.parentElement();t.pasteHTML(h);u=B.childNodes;for(y=0;y<u.length;y++){w=u[y];if(y>0&&(w.nodeType!==3||u[y-1].nodeType!==3)){z++}if(w.nodeType===3){A=w.nodeValue.indexOf(h);if(A!==-1){x+=A;break}x+=w.nodeValue.length}else{x=0}}t.moveStart("character",-1);t.text="";return{index:z,offset:x,parent:B}}n=j.item?j.item(0):j.parentElement();if(n.ownerDocument!=m.doc){return s}if(j.item||!n.hasChildNodes()){s.setStart(n.parentNode,i(n));s.setEnd(s.startContainer,s.startOffset+1);return s}l=e.isCollapsed();p=r(true);k=r(false);p.parent.normalize();k.parent.normalize();q=p.parent.childNodes[Math.min(p.index,p.parent.childNodes.length-1)];if(q.nodeType!=3){s.setStart(p.parent,p.index)}else{s.setStart(p.parent.childNodes[p.index],p.offset)}o=k.parent.childNodes[Math.min(k.index,k.parent.childNodes.length-1)];if(o.nodeType!=3){if(!l){k.index++}s.setEnd(k.parent,k.index)}else{s.setEnd(k.parent.childNodes[k.index],k.offset)}if(!l){q=s.startContainer;if(q.nodeType==1){s.setStart(q,Math.min(s.startOffset,q.childNodes.length))}o=s.endContainer;if(o.nodeType==1){s.setEnd(o,Math.min(s.endOffset,o.childNodes.length))}}d.addRange(s);return s}this.addRange=function(j){var o,m=e.dom.doc.body,p,k,q,l,n,i;q=j.startContainer;l=j.startOffset;n=j.endContainer;i=j.endOffset;o=m.createTextRange();q=q.nodeType==1?q.childNodes[Math.min(l,q.childNodes.length-1)]:q;n=n.nodeType==1?n.childNodes[Math.min(l==i?i:i-1,n.childNodes.length-1)]:n;if(q==n&&q.nodeType==1){if(/^(IMG|TABLE)$/.test(q.nodeName)&&l!=i){o=m.createControlRange();o.addElement(q)}else{o=m.createTextRange();if(!q.hasChildNodes()&&q.canHaveHTML){q.innerHTML=h}o.moveToElementText(q);if(q.innerHTML==h){o.collapse(true);q.removeChild(q.firstChild)}}if(l==i){o.collapse(i<=j.endContainer.childNodes.length-1)}o.select();return}function r(t,v){var u,s,w;if(t.nodeType!=3){return -1}u=t.nodeValue;s=m.createTextRange();t.nodeValue=u.substring(0,v)+h+u.substring(v);s.moveToElementText(t.parentNode);s.findText(h);w=Math.abs(s.moveStart("character",-1048575));t.nodeValue=u;return w}if(j.collapsed){pos=r(q,l);o=m.createTextRange();o.move("character",pos);o.select();return}else{if(q==n&&q.nodeType==3){p=r(q,l);o.move("character",p);o.moveEnd("character",i-l);o.select();return}p=r(q,l);k=r(n,i);o=m.createTextRange();if(p==-1){o.moveToElementText(q);p=0}else{o.move("character",p)}tmpRng=m.createTextRange();if(k==-1){tmpRng.moveToElementText(n)}else{tmpRng.move("character",k)}o.setEndPoint("EndToEnd",tmpRng);o.select();return}};this.getRangeAt=function(){if(!b||!c(g,e.getRng())){b=f();g=e.getRng()}return b};this.destroy=function(){g=b=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}if(!n.preventDefault){n.preventDefault=function(){n.returnValue=false}}if(!n.stopPropagation){n.stopPropagation=function(){n.cancelBubble=true}}}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){var b=a.each;a.create("tinymce.dom.Element",{Element:function(g,e){var c=this,f,d;e=e||{};c.id=g;c.dom=f=e.dom||a.DOM;c.settings=e;if(!a.isIE){d=c.dom.get(c.id)}b(["getPos","getRect","getParent","add","setStyle","getStyle","setStyles","setAttrib","setAttribs","getAttrib","addClass","removeClass","hasClass","getOuterHTML","setOuterHTML","remove","show","hide","isHidden","setHTML","get"],function(h){c[h]=function(){var j=[g],k;for(k=0;k<arguments.length;k++){j.push(arguments[k])}j=f[h].apply(f,j);c.update(h);return j}})},on:function(e,d,c){return a.dom.Event.add(this.id,e,d,c)},getXY:function(){return{x:parseInt(this.getStyle("left")),y:parseInt(this.getStyle("top"))}},getSize:function(){var c=this.dom.get(this.id);return{w:parseInt(this.getStyle("width")||c.clientWidth),h:parseInt(this.getStyle("height")||c.clientHeight)}},moveTo:function(c,d){this.setStyles({left:c,top:d})},moveBy:function(c,e){var d=this.getXY();this.moveTo(d.x+c,d.y+e)},resizeTo:function(c,d){this.setStyles({width:c,height:d})},resizeBy:function(c,e){var d=this.getSize();this.resizeTo(d.w+c,d.h+e)},update:function(d){var e=this,c,f=e.dom;if(a.isIE6&&e.settings.blocker){d=d||"";if(d.indexOf("get")===0||d.indexOf("has")===0||d.indexOf("is")===0){return}if(d=="remove"){f.remove(e.blocker);return}if(!e.blocker){e.blocker=f.uniqueId();c=f.add(e.settings.container||f.getRoot(),"iframe",{id:e.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});f.setStyle(c,"opacity",0)}else{c=f.get(e.blocker)}f.setStyle(c,"left",e.getStyle("left",1));f.setStyle(c,"top",e.getStyle("top",1));f.setStyle(c,"width",e.getStyle("width",1));f.setStyle(c,"height",e.getStyle("height",1));f.setStyle(c,"display",e.getStyle("display",1));f.setStyle(c,"zIndex",parseInt(e.getStyle("zIndex",1)||0)-1)}}})})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i));l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndAfter(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild}return h}else{h=g.startContainer;if(h.nodeName=="BODY"){return h.firstChild}return f.dom.getParent(h,"*")}},getEnd:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.lastChild}return h}else{h=g.endContainer;if(h.nodeName=="BODY"){return h.lastChild}return f.dom.getParent(h,"*")}},getBookmark:function(x){var j=this,m=j.getRng(),f,n,l,u=j.dom.getViewPort(j.win),v,p,z,o,w=-16777215,k,h=j.dom.getRoot(),g=0,i=0,y;n=u.x;l=u.y;if(x=="simple"){return{rng:m,scrollX:n,scrollY:l}}if(a){if(m.item){v=m.item(0);d(j.dom.select(v.nodeName),function(s,r){if(v==s){p=r;return false}});return{tag:v.nodeName,index:p,scrollX:n,scrollY:l}}f=j.dom.doc.body.createTextRange();f.moveToElementText(h);f.collapse(true);z=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(true);p=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(false);o=Math.abs(f.move("character",w))-p;return{start:p-z,length:o,scrollX:n,scrollY:l}}v=j.getNode();k=j.getSel();if(!k){return null}if(v&&v.nodeName=="IMG"){return{scrollX:n,scrollY:l}}function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false),E,B=0,C={};while((E=s.nextNode())!=null){if(E==D){C.start=B}if(E==t){C.end=B;return C}B+=e(E.nodeValue||"").length}return null}if(k.anchorNode==k.focusNode&&k.anchorOffset==k.focusOffset){v=q(h,k.anchorNode,k.focusNode);if(!v){return{scrollX:n,scrollY:l}}e(k.anchorNode.nodeValue||"").replace(/^\s+/,function(r){g=r.length});return{start:Math.max(v.start+k.anchorOffset-g,0),end:Math.max(v.end+k.focusOffset-g,0),scrollX:n,scrollY:l,beg:k.anchorOffset-g==0}}else{v=q(h,m.startContainer,m.endContainer);if(!v){return{scrollX:n,scrollY:l}}return{start:Math.max(v.start+m.startOffset-g,0),end:Math.max(v.end+m.endOffset-i,0),scrollX:n,scrollY:l,beg:m.startOffset-g==0}}},moveToBookmark:function(n){var o=this,g=o.getRng(),p=o.getSel(),j=o.dom.getRoot(),m,h,k;function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,false),x,s=0,A={},u,C,z,y;while((x=B.nextNode())!=null){z=y=0;k=x.nodeValue||"";h=e(k).length;s+=h;if(s>=t&&!A.startNode){u=t-(s-h);if(n.beg&&u>=h){continue}A.startNode=x;A.startOffset=u+y}if(s>=D){A.endNode=x;A.endOffset=D-(s-h)+y;return A}}return null}if(!n){return false}o.win.scrollTo(n.scrollX,n.scrollY);if(a){if(g=n.rng){try{g.select()}catch(l){}return true}o.win.focus();if(n.tag){g=j.createControlRange();d(o.dom.select(n.tag),function(r,q){if(q==n.index){g.addElement(r)}})}else{try{if(n.start<0){return true}g=p.createRange();g.moveToElementText(j);g.collapse(true);g.moveStart("character",n.start);g.moveEnd("character",n.length)}catch(f){return true}}try{g.select()}catch(l){}return true}if(!p){return false}if(n.rng){p.removeAllRanges();p.addRange(n.rng)}else{if(b(n.start)&&b(n.end)){try{m=i(j,n.start,n.end);if(m){g=o.dom.doc.createRange();g.setStart(m.startNode,m.startOffset);g.setEnd(m.endNode,m.endOffset);p.removeAllRanges();p.addRange(g)}if(!c.isOpera){o.win.focus()}}catch(l){}}}},select:function(g,l){var p=this,f=p.getRng(),q=p.getSel(),o,m,k,j=p.win.document;function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEXT,null,false);while(u=s.nextNode()){r=u;if(c.trim(u.nodeValue).length!=0){if(t){return u}else{r=u}}}}return r}if(a){try{o=j.body;if(/^(IMG|TABLE)$/.test(g.nodeName)){f=o.createControlRange();f.addElement(g)}else{f=o.createTextRange();f.moveToElementText(g)}f.select()}catch(i){}}else{if(l){m=h(g,1)||p.dom.select("br:first",g)[0];k=h(g,0)||p.dom.select("br:last",g)[0];if(m&&k){f=j.createRange();if(m.nodeName=="BR"){f.setStartBefore(m)}else{f.setStart(m,0)}if(k.nodeName=="BR"){f.setEndBefore(k)}else{f.setEnd(k,k.nodeValue.length)}}else{f.selectNode(g)}}else{f.selectNode(g)}p.setRng(f)}return g},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}return !g||h.boundingWidth==0||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var f=this,h=f.getRng(),g=f.getSel(),i;if(!a){if(!h){return f.dom.getRoot()}i=h.commonAncestorContainer;if(!h.collapsed){if(c.isWebKit&&g.anchorNode&&g.anchorNode.nodeType==1){return g.anchorNode.childNodes[g.anchorOffset]}if(h.startContainer==h.endContainer){if(h.startOffset-h.endOffset<2){if(h.startContainer.hasChildNodes()){i=h.startContainer.childNodes[h.startOffset]}}}}return f.dom.getParent(i,"*")}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",bool_attrs:/(checked|disabled|readonly|selected|nowrap)/,valid_elements:"*[*]",extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,y,w=["ol","ul"],u,t,q,k=/^(OL|UL)$/,z;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(y=0;y<w.length;y++){l=i.dom.select(w[y],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){z=m(t,"LI");if(!z){z=i.dom.create("li");z.innerHTML="&nbsp;";z.appendChild(t);q.insertBefore(z,q.firstChild)}else{z.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){f(i.dom.select("p table",l.node),function(m){i.dom.split(i.dom.getParent(m,"p"),m)})})}},setEntities:function(p){var n=this,j,m,h={},o="",k;if(n.entityLookup){return}j=p.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16);o+="\\u"+"0000".substring(k.length)+k}if(!o){n.settings.entity_encoding="raw";return}n.entitiesRE=new RegExp("["+o+"]","g");n.entityLookup=h},setValidChildRules:function(h){this.childRules=null;this.addValidChildRules(h)},addValidChildRules:function(k){var j=this,l,h,i;if(!k){return}l="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";h="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";i="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";f(k.split(","),function(n){var o=n.split(/\[|\]/),m;n="";f(o[1].split("|"),function(p){if(n){n+="|"}switch(p){case"%itrans":p=h;break;case"%itrans_na":p=h.substring(2);break;case"%istrict":p=l;break;case"%istrict_na":p=l.substring(2);break;case"%btrans":p=i;break;case"%bstrict":p=i;break}n+=p});m=new RegExp("^("+n.toLowerCase()+")$","i");f(o[0].split("/"),function(p){j.childRules=j.childRules||{};j.childRules[p]=m})});k="";f(j.childRules,function(n,m){if(k){k+="|"}k+=m});j.parentElementsRE=new RegExp("^("+k.toLowerCase()+")$","i")},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var w=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(w){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(l,k){var j,i=this;i._setup();k=k||{};k.format=k.format||"html";i.processObj=k;l=l.cloneNode(true);i.key=""+(parseInt(i.key)+1);if(!k.no_events){k.node=l;i.onPreProcess.dispatch(i,k)}i.writer.reset();i._serializeNode(l,k.getInner);k.content=i.writer.getContent();if(!k.no_events){i.onPostProcess.dispatch(i,k)}i._postProcess(k);k.node=null;return e.trim(k.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");j=j.replace(/(type|language)=\"mce-/g,'$1="');if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}}n.content=j},_serializeNode:function(D,o){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,G,B,h,y,k,r,C,p,m;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("mce_bogus"):D.getAttribute("mce_bogus")){return}p=false;q=D.hasChildNodes();k=D.getAttribute("mce_name")||D.nodeName.toLowerCase();if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||o){p=true;break}if(d){if(A.fix_content_duplication){if(D.mce_serialized==z.key){return}D.mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(z.childRules){if(z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(k)){p=true;break}}z.elementName=k}r=z.findRule(k);k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){G=r.requiredAttribs;for(F=G.length-1;F>=0;F--){if(this.dom.getAttrib(D,G[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){G=B[F];y=z._getAttrib(D,G);if(y!==null){x.writeAttribute(G.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){G=h.nodeName.toLowerCase();if(A.invalid_attrs.test(G)||!r.validAttribsRE.test(G)){continue}C=z.findAttribRule(r,G);y=z._getAttrib(D,C,G);if(y!==null){x.writeAttribute(G,y)}}}}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("mce_bogus"):u.getAttribute("mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(z.childRules&&z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(D.nodeName)){return}}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(j.entitiesRE,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);h.addValidChildRules(i.valid_child_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);if(this.settings.bool_attrs.test(h)&&k){k=(""+k).toLowerCase();if(k==="false"||k==="0"){return null}k=h}switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(tinymce){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create("tinymce.dom.ScriptLoader",{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={}},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0},markDone:function(u){this.lookup[u]={state:2,url:u}},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2){cb.call(s||this)}return o}o={state:0,url:u,func:cb,scope:s||this};if(pr){t.queue.unshift(o)}else{t.queue.push(o)}lo[u]=o;return o},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2){cb.call(s||t)}return o}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co)}})}else{document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"><\/script>')}}if(!tinymce.is(u,"string")){each(u,function(u){loadScript(u)});if(cb){cb.call(s||t)}}else{loadScript(u);if(cb){cb.call(s||t)}}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb){cb.call(s||t)}each(t.queueCallbacks,function(o){o.func.call(o.scope)})})}else{if(cb){t.queueCallbacks.push({func:cb,scope:s||t})}}},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co)}catch(ex){eval(co,w)}}else{w.execScript(co)}},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--}else{load(o)}});if(l===0&&cb){cb.call(s||t);cb=0}}function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone()})}each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o)}else{o=lo[u]}if(o.state>0){return}if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol="";if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone()});if(tinymce.isIE){ol=' onreadystatechange="'}else{ol=' onload="'}ol+="tinymce.dom.ScriptLoader._onLoad(this,'"+u+"',"+ix+');"'}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+"><\/script>");if(!o.func){done(o)}}else{load(o)}});allDone()},"static":{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=="complete"){this._funcs[ix].call(this)}},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0}}if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done()}})}else{e=tinymce.DOM.create("script",{id:id,type:"text/javascript",src:tinymce._addVer(u)});Event.add(e,"load",done);(document.getElementsByTagName("head")[0]||document.body).appendChild(e)}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader()})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(w){var h,t,s;w=w.target;if(w&&(w=c.getParent(w,"tr"))){h=z.items[w.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(w&&c.hasClass(w,m+"ItemSub")){t=c.getRect(w);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(f){var d,e=b.EditorManager.settings;if(e&&e.language){d=this.urls[f]+"/langs/"+e.language+".js";if(!b.dom.Event.domLoaded&&!e.strict_mode){b.ScriptLoader.load(d)}else{b.ScriptLoader.add(d)}}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(f){var g=f.each,h=f.extend,e=f.DOM,a=f.dom.Event,c=f.ThemeManager,b=f.PluginManager,d=f.explode;f.create("static tinymce.EditorManager",{editors:{},i18n:{},activeEditor:null,preInit:function(){var i=this,j=window.location;f.documentBaseURL=j.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(f.documentBaseURL)){f.documentBaseURL+="/"}f.baseURL=new f.util.URI(f.documentBaseURL).toAbsolute(f.baseURL);f.EditorManager.baseURI=new f.util.URI(f.baseURL);if(document.domain&&j.hostname!=document.domain){f.relaxedDomain=document.domain}i.onBeforeUnload=new f.util.Dispatcher(i);a.add(window,"beforeunload",function(k){i.onBeforeUnload.dispatch(i,k)})},init:function(q){var p=this,l,k=f.ScriptLoader,o,n,i=[],m;function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.replace(/\.\w+$/,"");r=r?f.resolve(r):0;t=f.resolve(t)}return t.apply(r||this,Array.prototype.slice.call(arguments,2))}q=h({theme:"simple",language:"en",strict_loading_mode:document.contentType=="application/xhtml+xml"},q);p.settings=q;if(!a.domLoaded&&!q.strict_loading_mode){if(q.language){k.add(f.baseURL+"/langs/"+q.language+".js")}if(q.theme&&q.theme.charAt(0)!="-"&&!c.urls[q.theme]){c.load(q.theme,"themes/"+q.theme+"/editor_template"+f.suffix+".js")}if(q.plugins){l=d(q.plugins);if(f.inArray(l,"compat2x")!=-1){b.load("compat2x","plugins/compat2x/editor_plugin"+f.suffix+".js")}g(l,function(r){if(r&&r.charAt(0)!="-"&&!b.urls[r]){if(!f.isWebKit&&r=="safari"){return}b.load(r,"plugins/"+r+"/editor_plugin"+f.suffix+".js")}})}k.loadQueue()}a.add(document,"init",function(){var r,t;j(q,"onpageload");if(q.browsers){r=false;g(d(q.browsers),function(u){switch(u){case"ie":case"msie":if(f.isIE){r=true}break;case"gecko":if(f.isGecko){r=true}break;case"safari":case"webkit":if(f.isWebKit){r=true}break;case"opera":if(f.isOpera){r=true}break}});if(!r){return}}switch(q.mode){case"exact":r=q.elements||"";if(r.length>0){g(d(r),function(u){if(e.get(u)){m=new f.Editor(u,q);i.push(m);m.render(1)}else{o=0;g(document.forms,function(v){g(v.elements,function(w){if(w.name===u){u="mce_editor_"+o;e.setAttrib(w,"id",u);m=new f.Editor(u,q);i.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasClass(v,u)}g(e.select("textarea"),function(u){if(q.editor_deselector&&s(u,q.editor_deselector)){return}if(!q.editor_selector||s(u,q.editor_selector)){n=e.get(u.name);if(!u.id&&!n){u.id=u.name}if(!u.id||p.get(u.id)){u.id=e.uniqueId()}m=new f.Editor(u.id,q);i.push(m);m.render(1)}});break}if(q.oninit){r=t=0;g(i,function(u){t++;if(!u.initialized){u.onInit.add(function(){r++;if(r==t){j(q,"oninit")}})}else{r++}if(r==t){j(q,"oninit")}})}})},get:function(i){return this.editors[i]},getInstanceById:function(i){return this.get(i)},add:function(i){this.editors[i.id]=i;this._setActive(i);return i},remove:function(j){var i=this;if(!i.editors[j.id]){return null}delete i.editors[j.id];if(i.activeEditor==j){g(i.editors,function(k){i._setActive(k);return false})}j.destroy();return j},execCommand:function(o,m,l){var n=this,k=n.get(l),i;switch(o){case"mceFocus":k.focus();return true;case"mceAddEditor":case"mceAddControl":if(!n.get(l)){new f.Editor(l,n.settings).render()}return true;case"mceAddFrameControl":i=l.window;i.tinyMCE=tinyMCE;i.tinymce=f;f.DOM.doc=i.document;f.DOM.win=i;k=new f.Editor(l.element_id,l);k.render();if(f.isIE){function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinymce=null}i.attachEvent("onunload",j)}l.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(k){k.remove()}return true;case"mceToggleEditor":if(!k){n.execCommand("mceAddControl",0,l);return true}if(k.isHidden()){k.show()}else{k.hide()}return true}if(n.activeEditor){return n.activeEditor.execCommand(o,m,l)}return false},execInstanceCommand:function(m,l,k,j){var i=this.get(m);if(i){return i.execCommand(l,k,j)}return false},triggerSave:function(){g(this.editors,function(i){i.save()})},addI18n:function(k,l){var i,j=this.i18n;if(!f.is(k,"string")){g(k,function(n,m){g(n,function(q,p){g(q,function(s,r){if(p==="common"){j[m+"."+r]=s}else{j[m+"."+p+"."+r]=s}})})})}else{g(l,function(n,m){j[k+"."+m]=n})}},_setActive:function(i){this.selectedInstance=this.activeEditor=i}});f.EditorManager.preInit()})(tinymce);var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher;var j=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit;var d=n.is,h=n.ThemeManager,c=n.PluginManager,i=n.EditorManager;var p=n.inArray,m=n.grep,g=n.explode;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.plugins={};j(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:"mceItemTable",visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,removeformat_selector:"span,b,strong,em,i,font,u,strike"},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=i.baseURI;q.execCallback("setup",q)},render:function(u){var v=this,w=v.settings,x=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}if(!u){w.strict_loading_mode=1;tinyMCE.settings=w}if(!v.getElement()){return}if(w.strict_loading_mode){q.settings.strict_mode=w.strict_loading_mode;n.DOM.settings.strict=1}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&w.hidden_input&&o.getParent(x,"form")){o.insertAfter(o.create("input",{type:"hidden",name:x}),x)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(w.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(w.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(w.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(w.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){i.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}if(w.theme&&w.theme.charAt(0)!="-"&&!h.urls[w.theme]){h.load(w.theme,"themes/"+w.theme+"/editor_template"+n.suffix+".js")}j(g(w.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(!e&&s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+n.suffix+".js")}});q.loadQueue(function(){if(!v.removed){v.init()}})}if(w.plugins.indexOf("compat2x")!=-1){c.load("compat2x","plugins/compat2x/editor_plugin"+n.suffix+".js");q.loadQueue(r)}else{r()}},init:function(){var v,F=this,G=F.settings,C,z,B=F.getElement(),r,q,D,y,A,E;i.add(F);if(G.theme){G.theme=G.theme.replace(/-/,"");r=h.get(G.theme);F.theme=new r();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||n.documentBaseURL.replace(/\/$/,""))}}j(g(G.plugins.replace(/\-/g,"")),function(w){var H=c.get(w),t=c.urls[w]||n.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(F,t);F.plugins[w]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new n.ControlManager(F);F.undoManager=new n.UndoManager(F);F.undoManager.onAdd.add(function(t,s){if(!s.initial){return F.onChange.dispatch(F,s,t)}});F.undoManager.onUndo.add(function(t,s){return F.onUndo.dispatch(F,s,t)});F.undoManager.onRedo.add(function(t,s){return F.onRedo.dispatch(F,s,t)});if(G.custom_undo_redo){F.onExecCommand.add(function(t,w,u,H,s){if(w!="Undo"&&w!="Redo"&&w!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(x);F.onRedo.add(x);F.onSetContent.add(x)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(r.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(r.deltaHeight||0),100)}r=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=r.editorContainer}o.setStyles(r.sizeContainer||r.editorContainer,{width:C,height:z});z=(r.iframeHeight||z)+(typeof(z)=="number"?(r.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+F.documentBaseURI.getURI()+'" />';F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(n.relaxedDomain){F.iframeHTML+='<script type="text/javascript">document.domain = "'+n.relaxedDomain+'";<\/script>'}y=G.body_id||"tinymce";if(y.indexOf("=")!=-1){y=F.getParam("body_id","","hash");y=y[F.id]||y}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+A+'"></body></html>';if(n.relaxedDomain){if(b||(n.isOpera&&parseFloat(opera.version())>=9.5)){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(n.isOpera){D='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}v=o.add(r.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",style:{width:"100%",height:z}});F.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=F.orgDisplay;o.get(F.id).style.display="none";if(!b||!n.relaxedDomain){F.setupIframe()}B=v=r=null},setupIframe:function(){var z=this,A=z.settings,u=o.get(z.id),v=z.getDoc(),r,x;if(!b||!n.relaxedDomain){v.open();v.write(z.iframeHTML);v.close()}if(!b){try{if(!A.readonly){v.designMode="On"}}catch(w){}}if(b){x=z.getBody();o.hide(x);if(!A.readonly){x.contentEditable=true}o.show(x)}z.dom=new n.DOM.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1});z.serializer=new n.dom.Serializer({entity_encoding:A.entity_encoding,entities:A.entities,valid_elements:A.verify_html===false?"*[*]":A.valid_elements,extended_valid_elements:A.extended_valid_elements,valid_child_elements:A.valid_child_elements,invalid_elements:A.invalid_elements,fix_table_elements:A.fix_table_elements,fix_list_elements:A.fix_list_elements,fix_content_duplication:A.fix_content_duplication,convert_fonts_to_spans:A.convert_fonts_to_spans,font_size_classes:A.font_size_classes,font_size_style_values:A.font_size_style_values,apply_source_formatting:A.apply_source_formatting,remove_linebreaks:A.remove_linebreaks,element_format:A.element_format,dom:z.dom});z.selection=new n.dom.Selection(z.dom,z.getWin(),z.serializer);z.forceBlocks=new n.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new n.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.auto_resize){z.onNodeChange.add(z.resizeToContent,z)}if(A.custom_elements){function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";j(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.convert_fonts_to_spans){z._convertFonts()}if(A.inline_styles){z._convertInlineElements()}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){k.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){q(s)}});z.onSetContent.add(z.selection.onSetContent.add(q));if(!A.readonly){try{v.designMode="Off";v.designMode="On"}catch(w){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.undoManager.add({initial:true});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){n.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=i.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);u=null},focus:function(r){var u,q=this,s=q.settings.content_editable;if(!r){if(!s&&(!b||q.selection.getNode().ownerDocument!=q.getDoc())){q.getWin().focus()}}if(i.activeEditor!=q){if((u=i.activeEditor)!=null){u.onDeactivate.dispatch(u,q)}q.onActivate.dispatch(q,u)}i._setActive(q)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=i.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return i.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(w,s,q){var t=n.trim,r=d(this.settings[w])?this.settings[w]:s,u;if(q==="hash"){u={};if(d(r,"string")){j(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(x){x=x.split("=");if(x.length>1){u[t(x[0])]=t(x[1])}else{u[t(x[0])]=t(x)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getNode()||q.getBody();if(q.initialized){q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,b&&v.ownerDocument!=q.getDoc()?q.getBody():v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(t,r,q){this.execCommands[t]={func:r,scope:q||this}},addQueryStateHandler:function(t,r,q){this.queryStateCommands[t]={func:r,scope:q||this}},addQueryValueHandler:function(t,r,q){this.queryValueCommands[t]={func:r,scope:q||this}},addShortcut:function(s,v,q,u){var r=this,w;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){w=q;q=function(){r.execCommand(w,false,null)}}if(d(q,"object")){w=q;q=function(){r.execCommand(w[0],w[1],w[2])}}j(g(s),function(t){var x={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};j(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});r.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,w,z,q){var u=this,v=0,y,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!q||!q.skip_focus)){u.focus()}y={};u.onBeforeExecCommand.dispatch(u,x,w,z,y);if(y.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(y=u.execCommands[x]){r=y.func.call(y.scope,w,z);if(r!==true){u.onExecCommand.dispatch(u,x,w,z,q);return r}}j(u.plugins,function(s){if(s.execCommand&&s.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(n.GlobalCommands.execCommand(u,x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(u.editorCommands.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}u.getDoc().execCommand(x,w,z);u.onExecCommand.dispatch(u,x,w,z,q)},queryCommandState:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryStateCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandState(w);if(v!==-1){return v}try{return this.getDoc().queryCommandState(w)}catch(q){}},queryCommandValue:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(w);if(d(v)){return v}try{return this.getDoc().queryCommandValue(w)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},resizeToContent:function(){var q=this;o.setStyle(q.id+"_ifr","height",q.getBody().scrollHeight)},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=0;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){j(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(r,s){var q=this;s=s||{};s.format=s.format||"html";s.set=true;s.content=r;if(!s.no_events){q.onBeforeSetContent.dispatch(q,s)}if(!n.isIE&&(r.length===0||/^\s+$/.test(r))){s.content=q.dom.setHTML(q.getBody(),'<br mce_bogus="1" />');s.format="raw"}s.content=q.dom.setHTML(q.getBody(),n.trim(s.content));if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;s.content=q.dom.setHTML(q.getBody(),q.serializer.serialize(q.getBody(),s))}if(!s.no_events){q.onSetContent.dispatch(q,s)}return s.content},getContent:function(s){var q=this,r;s=s||{};s.format=s.format||"html";s.get=true;if(!s.no_events){q.onBeforeGetContent.dispatch(q,s)}if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;r=q.serializer.serialize(q.getBody(),s)}else{r=q.getBody().innerHTML}r=r.replace(/^\s*|\s*$/g,"");s.content=r;if(!s.no_events){q.onGetContent.dispatch(q,s)}return s.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,x,w){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,w,true,x)}if(!v.convert_urls||(w&&w.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}j(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];i.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var w=this,v,y=w.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(w,t,A)!==false){w[x[t.fakeType||t.type]].dispatch(w,t,A)}}j(x,function(t,s){switch(s){case"contextmenu":if(n.isOpera){w.dom.bind(w.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";u(A)}})}else{w.dom.bind(w.getBody(),s,u)}break;case"paste":w.dom.bind(w.getBody(),s,function(A){u(A)});break;case"submit":case"reset":w.dom.bind(w.getElement().form||o.getParent(w.id,"form"),s,u);break;default:w.dom.bind(y.content_editable?w.getBody():w.getDoc(),s,u)}});w.dom.bind(y.content_editable?w.getBody():(a?w.getDoc():w.getWin()),"focus",function(s){w.focus(true)});if(n.isGecko){w.dom.bind(w.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("mce_src"))){t.src=w.documentBaseURI.toAbsolute(s)}})}if(a){function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}w.onBeforeExecCommand.add(q);w.onMouseDown.add(q)}w.onMouseUp.add(w.nodeChanged);w.onClick.add(w.nodeChanged);w.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(n.isMac&&(A==91||A==93))||t.ctrlKey){w.nodeChanged()}});w.onReset.add(function(){w.setContent(w.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){w.addShortcut("ctrl+z",w.getLang("undo_desc"),"Undo");w.addShortcut("ctrl+y",w.getLang("redo_desc"),"Redo")}if(a){w.addShortcut("ctrl+b",w.getLang("bold_desc"),"Bold");w.addShortcut("ctrl+i",w.getLang("italic_desc"),"Italic");w.addShortcut("ctrl+u",w.getLang("underline_desc"),"Underline")}for(v=1;v<=6;v++){w.addShortcut("ctrl+"+v,"",["FormatBlock",false,"<h"+v+">"])}w.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);w.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);w.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}j(w.shortcuts,function(A){if(n.isMac&&A.ctrl!=t.metaKey){return}else{if(!n.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}w.onKeyUp.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyPress.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return k.cancel(t)}})}if(n.isIE){w.dom.bind(w.getDoc(),"controlselect",function(A){var t=w.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){w.dom.unbind(t.node,t.ev,t.cb)}if(!w.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=w.dom.bind(A,ev,function(C){var B;C=C.target;if(B=w.dom.getStyle(C,"width")){w.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"width","")}if(B=w.dom.getStyle(C,"height")){w.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=w.dom.bind(A,"resizestart",k.cancel,k)}t=w.resizeInfo={node:A,ev:ev,cb:s}});w.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(w.selection.getRng().item){w.selection.getRng().item(0).removeNode();return k.cancel(t)}}})}if(n.isOpera){w.onClick.add(function(s,t){k.prevent(t)})}if(y.custom_undo_redo){function r(){w.undoManager.typing=0;w.undoManager.add()}if(n.isIE){w.dom.bind(w.getWin(),"blur",function(s){var t;if(w.selection){t=w.selection.getNode();if(!w.removed&&t.ownerDocument&&t.ownerDocument!=w.getDoc()){r()}}})}else{w.dom.bind(w.getDoc(),"blur",function(){if(w.selection&&!w.removed){r()}})}w.onMouseDown.add(r);w.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){w.undoManager.typing=0;w.undoManager.add()}});w.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(w.undoManager.typing){w.undoManager.add();w.undoManager.typing=0}return}if(!w.undoManager.typing){w.undoManager.add();w.undoManager.typing=1}})}},_convertInlineElements:function(){var z=this,B=z.settings,r=z.dom,y,w,u,A,q;function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("table,u,strike",t.node),function(v){switch(v.nodeName){case"TABLE":if(y=r.getAttrib(v,"height")){r.setStyle(v,"height",y);r.setAttrib(v,"height","")}break;case"U":case"STRIKE":v.style.textDecoration=v.nodeName=="U"?"underline":"line-through";r.setAttrib(v,"mce_style","");r.setAttrib(v,"mce_name","span");break}})}else{if(t.set){j(z.dom.select("table,span",t.node).reverse(),function(v){if(v.nodeName=="TABLE"){if(y=r.getStyle(v,"height")){r.setAttrib(v,"height",y.replace(/[^0-9%]+/g,""))}}else{if(v.style.textDecoration=="underline"){u="u"}else{if(v.style.textDecoration=="line-through"){u="strike"}else{u=""}}if(u){v.style.textDecoration="";r.setAttrib(v,"mce_style","");w=r.create(u,{style:r.getAttrib(v,"style")});r.replace(w,v,1)}}})}}}z.onPreProcess.add(x);if(!B.cleanup_on_startup){z.onSetContent.add(function(s,t){if(t.initial){x(z,{node:z.getBody(),set:1})}})}},_convertFonts:function(){var w=this,x=w.settings,z=w.dom,v,r,q,u;if(!x.inline_styles){return}v=[8,10,12,14,18,24,36];r=["xx-small","x-small","small","medium","large","x-large","xx-large"];if(q=x.font_size_style_values){q=g(q)}if(u=x.font_size_classes){u=g(u)}function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("font",B);for(s=t.length-1;s>=0;s--){C=t[s];A=z.create("span",{style:z.getAttrib(C,"style"),"class":z.getAttrib(C,"class")});z.setStyles(A,{fontFamily:z.getAttrib(C,"face"),color:z.getAttrib(C,"color"),backgroundColor:C.style.backgroundColor});if(C.size){if(q){z.setStyle(A,"fontSize",q[parseInt(C.size)-1])}else{z.setAttrib(A,"class",u[parseInt(C.size)-1])}}z.setAttrib(A,"mce_style","");z.replace(A,C,1)}}w.onPreProcess.add(function(s,t){if(t.get){y(t.node)}});w.onSetContent.add(function(s,t){if(t.initial){y(t.node)}})},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)},_fixNesting:function(r){var t=[],q;r=r.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(u,s,w){var v;if(s==="/"){if(!t.length){return""}if(w!==t[t.length-1].tag){for(q=t.length-1;q>=0;q--){if(t[q].tag===w){t[q].close=1;break}}return""}else{t.pop();if(t.length&&t[t.length-1].close){u=u+"</"+t[t.length-1].tag+">";t.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(w)){return u}if(/\/>$/.test(u)){return u}t.push({tag:w})}return u});for(q=t.length-1;q>=0;q--){r+="</"+t[q].tag+">"}return r}})})(tinymce);(function(d){var f=d.each,c=d.isIE,a=d.isGecko,b=d.isOpera,e=d.isWebKit;d.create("tinymce.EditorCommands",{EditorCommands:function(g){this.editor=g},execCommand:function(k,j,l){var h=this,g=h.editor,i;switch(k){case"mceResetDesignMode":case"mceBeginUndoLevel":return true;case"unlink":h.UnLink();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":h.mceJustify(k,k.substring(7).toLowerCase());return true;default:i=this[k];if(i){i.call(this,j,l);return true}}return false},Indent:function(){var g=this.editor,l=g.dom,j=g.selection,k,h,i;h=g.settings.indentation;i=/[a-z%]+$/i.exec(h);h=parseInt(h);if(g.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(j.getSelectedBlocks(),function(m){l.setStyle(m,"paddingLeft",(parseInt(m.style.paddingLeft||0)+h)+i)});return}g.getDoc().execCommand("Indent",false,null);if(c){l.getParent(j.getNode(),function(m){if(m.nodeName=="BLOCKQUOTE"){m.dir=m.style.cssText=""}})}},Outdent:function(){var h=this.editor,m=h.dom,k=h.selection,l,g,i,j;i=h.settings.indentation;j=/[a-z%]+$/i.exec(i);i=parseInt(i);if(h.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(k.getSelectedBlocks(),function(n){g=Math.max(0,parseInt(n.style.paddingLeft||0)-i);m.setStyle(n,"paddingLeft",g?g+j:"")});return}h.getDoc().execCommand("Outdent",false,null)},mceSetContent:function(h,g){this.editor.setContent(g)},mceToggleVisualAid:function(){var g=this.editor;g.hasVisual=!g.hasVisual;g.addVisual()},mceReplaceContent:function(h,g){var i=this.editor.selection;i.setContent(g.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(i,h){var g=this.editor,j=g.selection,k=g.dom.getParent(j.getNode(),"a");if(d.is(h,"string")){h={href:h}}function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}if(!k){g.execCommand("CreateLink",false,"javascript:mctmp(0);");f(g.dom.select("a[href=javascript:mctmp(0);]"),function(m){l(m)})}else{if(h.href){l(k)}else{g.dom.remove(k,1)}}},UnLink:function(){var g=this.editor,h=g.selection;if(h.isCollapsed()){h.select(h.getNode())}g.getDoc().execCommand("unlink",false,null);h.collapse(0)},FontName:function(i,h){var j=this,g=j.editor,k=g.selection,l;if(!h){if(k.isCollapsed()){k.select(k.getNode())}}else{if(g.settings.convert_fonts_to_spans){j._applyInlineStyle("span",{style:{fontFamily:h}})}else{g.getDoc().execCommand("FontName",false,h)}}},FontSize:function(j,i){var h=this.editor,l=h.settings,k,g;if(l.convert_fonts_to_spans&&i>=1&&i<=7){g=d.explode(l.font_size_style_values);k=d.explode(l.font_size_classes);if(k){i=k[i-1]||i}else{i=g[i-1]||i}}if(i>=1&&i<=7){h.getDoc().execCommand("FontSize",false,i)}else{this._applyInlineStyle("span",{style:{fontSize:i}})}},queryCommandValue:function(h){var g=this["queryValue"+h];if(g){return g.call(this,h)}return false},queryCommandState:function(h){var g;switch(h){case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":return this.queryStateJustify(h,h.substring(7).toLowerCase());default:if(g=this["queryState"+h]){return g.call(this,h)}}return -1},_queryState:function(h){try{return this.editor.getDoc().queryCommandState(h)}catch(g){}},_queryVal:function(h){try{return this.editor.getDoc().queryCommandValue(h)}catch(g){}},queryValueFontSize:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontSize}if(!g&&(b||e)){if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.size}return g}return g||this._queryVal("FontSize")},queryValueFontName:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.face}if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}if(!g){g=this._queryVal("FontName")}return g},mceJustify:function(o,p){var k=this.editor,m=k.selection,g=m.getNode(),q=g.nodeName,h,j,i=k.dom,l;if(k.settings.inline_styles&&this.queryStateJustify(o,p)){l=1}h=i.getParent(g,k.dom.isBlock);if(q=="IMG"){if(p=="full"){return}if(l){if(p=="center"){i.setStyle(h||g.parentNode,"textAlign","")}i.setStyle(g,"float","");this.mceRepaint();return}if(p=="center"){if(h&&/^(TD|TH)$/.test(h.nodeName)){h=0}if(!h||h.childNodes.length>1){j=i.create("p");j.appendChild(g.cloneNode(false));if(h){i.insertAfter(j,h)}else{i.insertAfter(j,g)}i.remove(g);g=j.firstChild;h=j}i.setStyle(h,"textAlign",p);i.setStyle(g,"float","")}else{i.setStyle(g,"float",p);i.setStyle(h||g.parentNode,"textAlign","")}this.mceRepaint();return}if(k.settings.inline_styles&&k.settings.forced_root_block){if(l){p=""}f(m.getSelectedBlocks(i.getParent(m.getStart(),i.isBlock),i.getParent(m.getEnd(),i.isBlock)),function(n){i.setAttrib(n,"align","");i.setStyle(n,"textAlign",p=="full"?"justify":p)});return}else{if(!l){k.getDoc().execCommand(o,false,null)}}if(k.settings.inline_styles){if(l){i.getParent(k.selection.getNode(),function(r){if(r.style&&r.style.textAlign){i.setStyle(r,"textAlign","")}});return}f(i.select("*"),function(s){var r=s.align;if(r){if(r=="full"){r="justify"}i.setStyle(s,"textAlign",r);i.setAttrib(s,"align","")}})}},mceSetCSSClass:function(h,g){this.mceSetStyleInfo(0,{command:"setattrib",name:"class",value:g})},getSelectedElement:function(){var w=this,o=w.editor,n=o.dom,s=o.selection,h=s.getRng(),l,k,u,p,j,g,q,i,x,v;if(s.isCollapsed()||h.item){return s.getNode()}v=o.settings.merge_styles_invalid_parents;if(d.is(v,"string")){v=new RegExp(v,"i")}if(c){l=h.duplicate();l.collapse(true);u=l.parentElement();k=h.duplicate();k.collapse(false);p=k.parentElement();if(u!=p){l.move("character",1);u=l.parentElement()}if(u==p){l=h.duplicate();l.moveToElementText(u);if(l.compareEndPoints("StartToStart",h)==0&&l.compareEndPoints("EndToEnd",h)==0){return v&&v.test(u.nodeName)?null:u}}}else{function m(r){return n.getParent(r,"*")}u=h.startContainer;p=h.endContainer;j=h.startOffset;g=h.endOffset;if(!h.collapsed){if(u==p){if(j-g<2){if(u.hasChildNodes()){i=u.childNodes[j];return v&&v.test(i.nodeName)?null:i}}}}if(u.nodeType!=3||p.nodeType!=3){return null}if(j==0){i=m(u);if(i&&i.firstChild!=u){i=null}}if(j==u.nodeValue.length){q=u.nextSibling;if(q&&q.nodeType==1){i=u.nextSibling}}if(g==0){q=p.previousSibling;if(q&&q.nodeType==1){x=q}}if(g==p.nodeValue.length){x=m(p);if(x&&x.lastChild!=p){x=null}}if(i==x){return v&&i&&v.test(i.nodeName)?null:i}}return null},mceSetStyleInfo:function(n,m){var q=this,h=q.editor,j=h.getDoc(),g=h.dom,i,k,r=h.selection,p=m.wrapper||"span",k=r.getBookmark(),o;function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":return g.setAttrib(t,m.name,m.value);case"setstyle":return g.setStyle(t,m.name,m.value);case"removeformat":return g.setAttrib(t,"class","")}}}o=h.settings.merge_styles_invalid_parents;if(d.is(o,"string")){o=new RegExp(o,"i")}if((i=q.getSelectedElement())&&!h.settings.force_span_wrappers){l(i,1)}else{j.execCommand("FontName",false,"__");f(g.select("span,font"),function(u){var s,t;if(g.getAttrib(u,"face")=="__"||u.style.fontFamily==="__"){s=g.create(p,{mce_new:"1"});l(s);f(u.childNodes,function(v){s.appendChild(v.cloneNode(true))});g.replace(s,u)}})}f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!g.getAttrib(t,"mce_new")){s=g.getParent(t,"*[mce_new]");if(s){g.remove(t,1)}}});f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!s||!g.getAttrib(t,"mce_new")){return}if(h.settings.force_span_wrappers&&s.nodeName!="SPAN"){return}if(s.nodeName==p.toUpperCase()&&s.childNodes.length==1){return g.remove(s,1)}if(t.nodeType==1&&(!o||!o.test(s.nodeName))&&s.childNodes.length==1){l(s);g.setAttrib(t,"class","")}});f(g.select(p).reverse(),function(s){if(g.getAttrib(s,"mce_new")||(g.getAttribs(s).length<=1&&s.className==="")){if(!g.getAttrib(s,"class")&&!g.getAttrib(s,"style")){return g.remove(s,1)}g.setAttrib(s,"mce_new","")}});r.moveToBookmark(k)},queryStateJustify:function(k,h){var g=this.editor,j=g.selection.getNode(),i=g.dom;if(j&&j.nodeName=="IMG"){if(i.getStyle(j,"float")==h){return 1}return j.parentNode.style.textAlign==h}j=i.getParent(g.selection.getStart(),function(l){return l.nodeType==1&&l.style.textAlign});if(h=="full"){h="justify"}if(g.settings.inline_styles){return(j&&j.style.textAlign==h)}return this._queryState(k)},ForeColor:function(i,h){var g=this.editor;if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{color:h}});return}else{g.getDoc().execCommand("ForeColor",false,h)}},HiliteColor:function(i,k){var h=this,g=h.editor,j=g.getDoc();if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{backgroundColor:k}});return}function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(m){j.execCommand("useCSS",0,!n)}}if(a||b){l(true);j.execCommand("hilitecolor",false,k);l(false)}else{j.execCommand("BackColor",false,k)}},FormatBlock:function(n,h){var o=this,l=o.editor,p=l.selection,j=l.dom,g,k,m;function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nodeName)}g=j.getParent(p.getNode(),function(q){return i(q)});if(g){if((c&&i(g.parentNode))||g.nodeName=="DIV"){k=l.dom.create(h);f(j.getAttribs(g),function(q){j.setAttrib(k,q.nodeName,j.getAttrib(g,q.nodeName))});m=p.getBookmark();j.replace(k,g,1);p.moveToBookmark(m);l.nodeChanged();return}}h=l.settings.forced_root_block?(h||"<p>"):h;if(h.indexOf("<")==-1){h="<"+h+">"}if(d.isGecko){h=h.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,"$1")}l.getDoc().execCommand("FormatBlock",false,h)},mceCleanup:function(){var h=this.editor,i=h.selection,g=i.getBookmark();h.setContent(h.getContent());i.moveToBookmark(g)},mceRemoveNode:function(j,k){var h=this.editor,i=h.selection,g,l=k||i.getNode();if(l==h.getBody()){return}g=i.getBookmark();h.dom.remove(l,1);i.moveToBookmark(g);h.nodeChanged()},mceSelectNodeDepth:function(i,j){var g=this.editor,h=g.selection,k=0;g.dom.getParent(h.getNode(),function(l){if(l.nodeType==1&&k++==j){h.select(l);g.nodeChanged();return false}},g.getBody())},mceSelectNode:function(h,g){this.editor.selection.select(g)},mceInsertContent:function(g,h){this.editor.selection.setContent(h)},mceInsertRawHTML:function(h,i){var g=this.editor;g.selection.setContent("tiny_mce_marker");g.setContent(g.getContent().replace(/tiny_mce_marker/g,i))},mceRepaint:function(){var i,g,j=this.editor;if(d.isGecko){try{i=j.selection;g=i.getBookmark(true);if(i.getSel()){i.getSel().selectAllChildren(j.getBody())}i.collapse(true);i.moveToBookmark(g)}catch(h){}}},queryStateUnderline:function(){var g=this.editor,h=g.selection.getNode();if(h&&h.nodeName=="A"){return false}return this._queryState("Underline")},queryStateOutdent:function(){var g=this.editor,h;if(g.settings.inline_styles){if((h=g.dom.getParent(g.selection.getStart(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}if((h=g.dom.getParent(g.selection.getEnd(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!g.settings.inline_styles&&!!g.dom.getParent(g.selection.getNode(),"BLOCKQUOTE"))},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"UL")},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"OL")},queryStatemceBlockQuote:function(){return !!this.editor.dom.getParent(this.editor.selection.getStart(),function(g){return g.nodeName==="BLOCKQUOTE"})},_applyInlineStyle:function(o,j,m){var q=this,n=q.editor,l=n.dom,i,p={},k,r;o=o.toUpperCase();if(m&&m.check_classes&&j["class"]){m.check_classes.push(j["class"])}function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(t),function(u){if(u.nodeName.substring(0,1)!="_"&&l.getAttrib(t,u.nodeName)!=""){s++}});if(s==0){l.remove(t,1)}})}function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFamily=="mceinline"||t.face=="mceinline"){if(!s){s=n.selection.getBookmark()}j._mce_new="1";l.replace(l.create(o,j),t,1)}});f(l.select(o+"[_mce_new]"),function(u){function t(v){if(v.nodeType==1){f(j.style,function(x,w){l.setStyle(v,w,"")});if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(v,w)}})}}}f(l.select(o,u),t);if(u.parentNode&&u.parentNode.nodeType==1&&u.parentNode.childNodes.length==1){t(u.parentNode)}l.getParent(u.parentNode,function(v){if(v.nodeType==1){if(j.style){f(j.style,function(y,x){var w;if(!p[x]&&(w=l.getStyle(v,x))){if(w===y){l.setStyle(u,x,"")}p[x]=1}})}if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(u,w)}})}}return false});u.removeAttribute("_mce_new")});h();n.selection.moveToBookmark(s);return !!s}n.focus();n.getDoc().execCommand("FontName",false,"mceinline");g();if(k=q._applyInlineStyle.keyhandler){n.onKeyUp.remove(k);n.onKeyPress.remove(k);n.onKeyDown.remove(k);n.onSetContent.remove(q._applyInlineStyle.chandler)}if(n.selection.isCollapsed()){if(!c){f(l.getParents(n.selection.getNode(),"span"),function(s){f(j.style,function(u,t){var w;if(w=l.getStyle(s,t)){if(w==u){l.setStyle(s,t,"");r=2;return false}r=1;return false}});if(r){return false}});if(r==2){i=n.selection.getBookmark();h();n.selection.moveToBookmark(i);window.setTimeout(function(){n.nodeChanged()},1);return}}q._pendingStyles=d.extend(q._pendingStyles||{},j.style);q._applyInlineStyle.chandler=n.onSetContent.add(function(){delete q._pendingStyles});q._applyInlineStyle.keyhandler=k=function(s){if(q._pendingStyles){j.style=q._pendingStyles;delete q._pendingStyles}if(g()){n.onKeyDown.remove(q._applyInlineStyle.keyhandler);n.onKeyPress.remove(q._applyInlineStyle.keyhandler)}if(s.type=="keyup"){n.onKeyUp.remove(q._applyInlineStyle.keyhandler)}};n.onKeyDown.add(k);n.onKeyPress.add(k);n.onKeyUp.add(k)}else{q._pendingStyles=0}}})})(tinymce);(function(a){a.create("tinymce.UndoManager",{index:0,data:null,typing:0,UndoManager:function(c){var d=this,b=a.util.Dispatcher;d.editor=c;d.data=[];d.onAdd=new b(this);d.onUndo=new b(this);d.onRedo=new b(this)},add:function(d){var g=this,f,e=g.editor,c,h=e.settings,j;d=d||{};d.content=d.content||e.getContent({format:"raw",no_events:1});d.content=d.content.replace(/^\s*|\s*$/g,"");j=g.data[g.index>0&&(g.index==0||g.index==g.data.length)?g.index-1:g.index];if(!d.initial&&j&&d.content==j.content){return null}if(h.custom_undo_redo_levels){if(g.data.length>h.custom_undo_redo_levels){for(f=0;f<g.data.length-1;f++){g.data[f]=g.data[f+1]}g.data.length--;g.index=g.data.length}}if(h.custom_undo_redo_restore_selection&&!d.initial){d.bookmark=c=d.bookmark||e.selection.getBookmark()}if(g.index<g.data.length){g.index++}if(g.data.length===0&&!d.initial){return null}g.data.length=g.index+1;g.data[g.index++]=d;if(d.initial){g.index=0}if(g.data.length==2&&g.data[0].initial){g.data[0].bookmark=c}g.onAdd.dispatch(g,d);e.isNotDirty=0;return d},undo:function(){var e=this,c=e.editor,b=b,d;if(e.typing){e.add();e.typing=0}if(e.index>0){if(e.index==e.data.length&&e.index>1){d=e.index;e.typing=0;if(!e.add()){e.index=d}--e.index}b=e.data[--e.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);e.onUndo.dispatch(e,b)}return b},redo:function(){var d=this,c=d.editor,b=null;if(d.index<d.data.length-1){b=d.data[++d.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);d.onRedo.dispatch(d,b)}return b},clear:function(){var b=this;b.data=[];b.index=0;b.typing=0;b.add({initial:true})},hasUndo:function(){return this.index!=0||this.typing},hasRedo:function(){return this.index<this.data.length-1}})})(tinymce);(function(e){var b,d,a,c,f,h;b=e.dom.Event;d=e.isIE;a=e.isGecko;c=e.isOpera;f=e.each;h=e.extend;function g(i){i=i.innerHTML;i=i.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");i=i.replace(/<[^>]+>/g,"");return i.replace(/[ \t\r\n]+/g,"")==""}e.create("tinymce.ForceBlocks",{ForceBlocks:function(j){var k=this,l=j.settings,m;k.editor=j;k.dom=j.dom;m=(l.forced_root_block||"p").toLowerCase();l.element=m.toUpperCase();j.onPreInit.add(k.setup,k);k.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+m+">","gi");k.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,m),"gi");k.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,m),"gi");function i(n,p){if(c){p.content=p.content.replace(k.reOpera,"</"+m+">")}p.content=p.content.replace(k.rePadd,"<"+m+"$1$2$3$4$5$6>\u00a0</"+m+">");if(!d&&!c&&p.set){p.content=p.content.replace(k.reNbsp2BR1,"<"+m+"$1$2><br /></"+m+">");p.content=p.content.replace(k.reNbsp2BR2,"<"+m+"$1$2><br /></"+m+">")}else{p.content=p.content.replace(k.reBR2Nbsp,"<"+m+"$1$2>\u00a0</"+m+">")}}j.onBeforeSetContent.add(i);j.onPostProcess.add(i);if(l.forced_root_block){j.onInit.add(k.forceRoots,k);j.onSetContent.add(k.forceRoots,k);j.onBeforeGetContent.add(k.forceRoots,k)}},setup:function(){var j=this,i=j.editor,k=i.settings;if(k.forced_root_block){i.onKeyUp.add(j.forceRoots,j);i.onPreProcess.add(j.forceRoots,j)}if(k.force_br_newlines){if(d){i.onKeyPress.add(function(m,p){var q,o=m.selection;if(p.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('<br id="__" /> ',{format:"raw"});q=m.dom.get("__");q.removeAttribute("id");o.select(q);o.collapse();return b.cancel(p)}})}return}if(!d&&k.force_p_newlines){i.onKeyPress.add(function(m,n){if(n.keyCode==13&&!n.shiftKey){if(!j.insertPara(n)){b.cancel(n)}}});if(a){i.onKeyDown.add(function(m,n){if((n.keyCode==8||n.keyCode==46)&&!n.shiftKey){j.backspaceDelete(n,n.keyCode==8)}})}}function l(n,m){var o=i.dom.create(m);f(n.attributes,function(p){if(p.specified&&p.nodeValue){o.setAttribute(p.nodeName.toLowerCase(),p.nodeValue)}});f(n.childNodes,function(p){o.appendChild(p.cloneNode(true))});n.parentNode.replaceChild(o,n);return o}i.onPreProcess.add(function(m,n){f(m.dom.select("p,h1,h2,h3,h4,h5,h6,div",n.node),function(o){if(g(o)){f(m.dom.select("span,em,strong,b,i",n.node),function(p){if(!p.hasChildNodes()){p.appendChild(m.getDoc().createTextNode("\u00a0"));return false}})}})});if(d){if(k.element!="P"){i.onKeyPress.add(function(m,n){j.lastElm=m.selection.getNode().nodeName});i.onKeyUp.add(function(o,q){var s,p=o.selection,r=p.getNode(),m=o.getBody();if(m.childNodes.length===1&&r.nodeName=="P"){r=l(r,k.element);p.select(r);p.collapse();o.nodeChanged()}else{if(q.keyCode==13&&!q.shiftKey&&j.lastElm!="P"){s=o.dom.getParent(r,"p");if(s){l(s,k.element);o.nodeChanged()}}}})}}},find:function(o,k,l){var j=this.editor,i=j.getDoc().createTreeWalker(o,4,null,false),m=-1;while(o=i.nextNode()){m++;if(k==0&&o==l){return m}if(k==1&&m==l){return o}}return -1},forceRoots:function(p,D){var u=this,p=u.editor,H=p.getBody(),E=p.getDoc(),K=p.selection,v=K.getSel(),w=K.getRng(),I=-2,o,B,j,k,F=-16777215;var G,l,J,A,x,m=H.childNodes,z,y,q;for(z=m.length-1;z>=0;z--){G=m[z];if(G.nodeType==3||(!u.dom.isBlock(G)&&G.nodeType!=8)){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!d){if(w.startContainer.nodeType==1&&(y=w.startContainer.childNodes[w.startOffset])&&y.nodeType==1){q=y.getAttribute("id");y.setAttribute("id","__mce")}else{if(p.dom.getParent(w.startContainer,function(i){return i===H})){B=w.startOffset;j=w.endOffset;I=u.find(H,0,w.startContainer);o=u.find(H,0,w.endContainer)}}}else{k=E.body.createTextRange();k.moveToElementText(H);k.collapse(1);J=k.move("character",F)*-1;k=w.duplicate();k.collapse(1);A=k.move("character",F)*-1;k=w.duplicate();k.collapse(0);x=(k.move("character",F)*-1)-A;I=A-J;o=x}}l=p.dom.create(p.settings.forced_root_block);l.appendChild(G.cloneNode(1));G.parentNode.replaceChild(l,G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!d){l=H.getElementsByTagName(p.settings.element)[0];w=E.createRange();if(I!=-1){w.setStart(u.find(H,1,I),B)}else{w.setStart(l,0)}if(o!=-1){w.setEnd(u.find(H,1,o),j)}else{w.setEnd(l,0)}if(v){v.removeAllRanges();v.addRange(w)}}else{try{w=v.createRange();w.moveToElementText(H);w.collapse(1);w.moveStart("character",I);w.moveEnd("character",o);w.select()}catch(C){}}}else{if(!d&&(y=p.dom.get("__mce"))){if(q){y.setAttribute("id",q)}else{y.removeAttribute("id")}w=E.createRange();w.setStartBefore(y);w.setEndBefore(y);K.setRng(w)}}},getParentBlock:function(j){var i=this.dom;return i.getParent(j,i.isBlock)},insertPara:function(M){var A=this,o=A.editor,I=o.dom,N=o.getDoc(),R=o.settings,B=o.selection.getSel(),C=B.getRangeAt(0),Q=N.body;var F,G,D,K,J,l,j,m,q,i,x,P,k,p,E,H=I.getViewPort(o.getWin()),w,z,v;F=N.createRange();F.setStart(B.anchorNode,B.anchorOffset);F.collapse(true);G=N.createRange();G.setStart(B.focusNode,B.focusOffset);G.collapse(true);D=F.compareBoundaryPoints(F.START_TO_END,G)<0;K=D?B.anchorNode:B.focusNode;J=D?B.anchorOffset:B.focusOffset;l=D?B.focusNode:B.anchorNode;j=D?B.focusOffset:B.anchorOffset;if(K===l&&/^(TD|TH)$/.test(K.nodeName)){if(K.firstChild.nodeName=="BR"){I.remove(K.firstChild)}if(K.childNodes.length==0){o.dom.add(K,R.element,null,"<br />");P=o.dom.add(K,R.element,null,"<br />")}else{E=K.innerHTML;K.innerHTML="";o.dom.add(K,R.element,null,E);P=o.dom.add(K,R.element,null,"<br />")}C=N.createRange();C.selectNodeContents(P);C.collapse(1);o.selection.setRng(C);return false}if(K==Q&&l==Q&&Q.firstChild&&o.dom.isBlock(Q.firstChild)){K=l=K.firstChild;J=j=0;F=N.createRange();F.setStart(K,0);G=N.createRange();G.setStart(l,0)}K=K.nodeName=="HTML"?N.body:K;K=K.nodeName=="BODY"?K.firstChild:K;l=l.nodeName=="HTML"?N.body:l;l=l.nodeName=="BODY"?l.firstChild:l;m=A.getParentBlock(K);q=A.getParentBlock(l);i=m?m.nodeName:R.element;if(A.dom.getParent(m,"ol,ul,pre")){return true}if(m&&(m.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;m=null}if(q&&(q.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;q=null}if(/(TD|TABLE|TH|CAPTION)/.test(i)||(m&&i=="DIV"&&/left|right/gi.test(I.getStyle(m,"float",1)))){i=R.element;m=q=null}x=(m&&m.nodeName==i)?m.cloneNode(0):o.dom.create(i);P=(q&&q.nodeName==i)?q.cloneNode(0):o.dom.create(i);P.removeAttribute("id");if(/^(H[1-6])$/.test(i)&&K.nodeValue&&J==K.nodeValue.length){P=o.dom.create(R.element)}E=k=K;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}k=E}while((E=E.previousSibling?E.previousSibling:E.parentNode));E=p=l;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}p=E}while((E=E.nextSibling?E.nextSibling:E.parentNode));if(k.nodeName==i){F.setStart(k,0)}else{F.setStartBefore(k)}F.setEnd(K,J);x.appendChild(F.cloneContents()||N.createTextNode(""));try{G.setEndAfter(p)}catch(L){}G.setStart(l,j);P.appendChild(G.cloneContents()||N.createTextNode(""));C=N.createRange();if(!k.previousSibling&&k.parentNode.nodeName==i){C.setStartBefore(k.parentNode)}else{if(F.startContainer.nodeName==i&&F.startOffset==0){C.setStartBefore(F.startContainer)}else{C.setStart(F.startContainer,F.startOffset)}}if(!p.nextSibling&&p.parentNode.nodeName==i){C.setEndAfter(p.parentNode)}else{C.setEnd(G.endContainer,G.endOffset)}C.deleteContents();if(c){o.getWin().scrollTo(0,H.y)}if(x.firstChild&&x.firstChild.nodeName==i){x.innerHTML=x.firstChild.innerHTML}if(P.firstChild&&P.firstChild.nodeName==i){P.innerHTML=P.firstChild.innerHTML}if(g(x)){x.innerHTML="<br />"}function O(y,s){var r=[],T,S,t;y.innerHTML="";if(R.keep_styles){S=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(S.nodeName)){T=S.cloneNode(false);I.setAttrib(T,"id","");r.push(T)}}while(S=S.parentNode)}if(r.length>0){for(t=r.length-1,T=y;t>=0;t--){T=T.appendChild(r[t])}r[0].innerHTML=c?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=c?"&nbsp;":"<br />"}}if(g(P)){v=O(P,l)}if(c&&parseFloat(opera.version())<9.5){C.insertNode(x);C.insertNode(P)}else{C.insertNode(P);C.insertNode(x)}P.normalize();x.normalize();function u(r){return N.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}C=N.createRange();C.selectNodeContents(a?u(v||P):v||P);C.collapse(1);B.removeAllRanges();B.addRange(C);w=o.dom.getPos(P).y;z=P.clientHeight;if(w<H.y||w+z>H.y+H.h){o.getWin().scrollTo(0,w<H.y?w:w-H.h+25)}return false},backspaceDelete:function(l,u){var x=this,k=x.editor,p=k.getBody(),j,m=k.selection,i=m.getRng(),o=i.startContainer,j,q,s;if(o&&k.dom.isBlock(o)&&!/^(TD|TH)$/.test(o.nodeName)&&u){if(o.childNodes.length==0||(o.childNodes.length==1&&o.firstChild.nodeName=="BR")){j=o;while((j=j.previousSibling)&&!k.dom.isBlock(j)){}if(j){if(o!=p.firstChild){q=k.dom.doc.createTreeWalker(j,NodeFilter.SHOW_TEXT,null,false);while(s=q.nextNode()){j=s}i=k.getDoc().createRange();i.setStart(j,j.nodeValue?j.nodeValue.length:0);i.setEnd(j,j.nodeValue?j.nodeValue.length:0);m.setRng(i);k.dom.remove(o)}return b.cancel(l)}}}function v(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(j=x.getParentBlock(n))){r=n.previousSibling;b.remove(p,"DOMNodeInserted",v);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){k.dom.remove(n)}}}b._add(p,"DOMNodeInserted",v);window.setTimeout(function(){b._remove(p,"DOMNodeInserted",v)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){i.execCommand(p.cmd,p.ui||false,p.value)}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark("simple")});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.CommandManager=function(){var c={},b={},d={};function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i[j.toLowerCase()]={func:g,scope:f}})}a.extend(this,{add:function(h,g,f){e(c,h,g,f)},addQueryStateHandler:function(h,g,f){e(b,h,g,f)},addQueryValueHandler:function(h,g,f){e(d,h,g,f)},execCommand:function(g,j,i,h,f){if(j=c[j.toLowerCase()]){if(j.func.call(g||j.scope,i,h,f)!==false){return true}}},queryCommandValue:function(){if(cmd=d[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=b[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})};a.GlobalCommands=new a.CommandManager()})(tinymce);(function(b){function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o){return p}p=p.parentNode}while(p)}function c(o){m(o);b.walk(o,m,"childNodes")}j=i.findCommonAncestor(d,h);e=k(d,j)||d;l=k(h,j)||h;for(g=d;g&&g!=e;g=g.parentNode){for(f=g.nextSibling;f;f=f.nextSibling){c(f)}}if(e!=l){for(g=e.nextSibling;g&&g!=l;g=g.nextSibling){c(g)}}else{c(e)}for(g=h;g&&g!=l;g=g.parentNode){for(f=g.previousSibling;f;f=f.previousSibling){c(f)}}}b.GlobalCommands.add("RemoveFormat",function(){var m=this,l=m.dom,u=m.selection,d=u.getRng(1),e=[],h,f,j,q,g,o,c,i;function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("removeformat_selector"))){r=v}return l.isBlock(v)},m.getBody());return r}function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}function t(r){p(r);b.walk(r,p,"childNodes")}h=u.getBookmark();q=d.startContainer;o=d.endContainer;g=d.startOffset;c=d.endOffset;q=q.nodeType==1?q.childNodes[Math.min(g,q.childNodes.length-1)]:q;o=o.nodeType==1?o.childNodes[Math.min(g==c?c:c-1,o.childNodes.length-1)]:o;if(q==o){f=k(q);if(q.nodeType==3){if(f&&f.nodeType==1){i=q.splitText(g);i.splitText(c-g);l.split(f,i);u.moveToBookmark(h)}return}t(l.split(f,q)||q)}else{f=k(q);j=k(o);if(f){if(q.nodeType==3){if(g==q.nodeValue.length){q.nodeValue+="\uFEFF"}q=q.splitText(g)}}if(j){if(o.nodeType==3){o.splitText(c)}}if(f&&f==j){l.replace(l.create("span",{id:"__end"},o.cloneNode(true)),o)}if(f){f=l.split(f,q)}else{f=q}if(i=l.get("__end")){o=i;j=k(o)}if(j){j=l.split(j,o)}else{j=o}a(l,f,j,p);if(q.nodeValue=="\uFEFF"){q.nodeValue=""}t(o);t(q)}b.each(e,function(r){l.remove(r,1)});l.remove("__end",1);u.moveToBookmark(h)})})(tinymce);(function(a){a.GlobalCommands.add("mceBlockQuote",function(){var j=this,o=j.selection,f=j.dom,l,k,e,d,p,c,m,h,b;function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOCKQUOTE"})}l=f.getParent(o.getStart(),f.isBlock);k=f.getParent(o.getEnd(),f.isBlock);if(p=g(l)){if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}if(g(k)){m=p.cloneNode(false);while(e=k.nextSibling){m.appendChild(e.parentNode.removeChild(e))}}if(m){f.insertAfter(m,p)}b=o.getSelectedBlocks(l,k);for(h=b.length-1;h>=0;h--){f.insertAfter(b[h],p)}if(/^\s*$/.test(p.innerHTML)){f.remove(p,1)}if(m&&/^\s*$/.test(m.innerHTML)){f.remove(m,1)}if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(0);if(f.getParent(o.getStart(),f.isBlock)!=l){c=o.getRng();c.move("character",-1);c.select()}}}else{j.selection.moveToBookmark(d)}return}if(a.isIE&&!l&&!k){j.getDoc().execCommand("Indent");e=g(o.getNode());e.style.margin=e.dir="";return}if(!l||!k){return}if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}a.each(o.getSelectedBlocks(g(o.getStart()),g(o.getEnd())),function(i){if(i.nodeName=="BLOCKQUOTE"&&!p){p=i;return}if(!p){p=f.create("blockquote");i.parentNode.insertBefore(p,i)}if(i.nodeName=="BLOCKQUOTE"&&p){e=i.firstChild;while(e){p.appendChild(e.cloneNode(true));e=e.nextSibling}f.remove(i);return}p.appendChild(f.remove(i))});if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(1)}}else{o.moveToBookmark(d)}})})(tinymce);(function(a){a.each(["Cut","Copy","Paste"],function(b){a.GlobalCommands.add(b,function(){var c=this,e=c.getDoc();try{e.execCommand(b,false,null);if(!e.queryCommandSupported(b)){throw"Error"}}catch(d){c.windowManager.alert(c.getLang("clipboard_no_support"))}})})})(tinymce);(function(a){a.GlobalCommands.add("InsertHorizontalRule",function(){if(a.isOpera){return this.getDoc().execCommand("InsertHorizontalRule",false,"")}this.selection.setContent("<hr />")})})(tinymce);(function(){var a=tinymce.GlobalCommands;a.add(["mceEndUndoLevel","mceAddUndoLevel"],function(){this.undoManager.add()});a.add("Undo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.undo();b.nodeChanged();return true}return false});a.add("Redo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.redo();b.nodeChanged();return true}return false})})();
index d5d88e2976230cf35a2ecc6d256cc4f290703a10..d235abd58637e82302ad2f3edbca41abfebad9a3 100644 (file)
@@ -1,294 +1,5 @@
-// Some global instances
-var tinymce = null, tinyMCEPopup, tinyMCE;
 
 
-tinyMCEPopup = {
-       init : function() {
-               var t = this, w, ti, li, q, i, it;
+// Uncomment and change this document.domain value if you are loading the script cross subdomains
+// document.domain = 'moxiecode.com';
 
 
-               li = ('' + document.location.search).replace(/^\?/, '').split('&');
-               q = {};
-               for (i=0; i<li.length; i++) {
-                       it = li[i].split('=');
-                       q[unescape(it[0])] = unescape(it[1]);
-               }
-
-               if (q.mce_rdomain)
-                       document.domain = q.mce_rdomain;
-
-               // Find window & API
-               w = t.getWin();
-               tinymce = w.tinymce;
-               tinyMCE = w.tinyMCE;
-               t.editor = tinymce.EditorManager.activeEditor;
-               t.params = t.editor.windowManager.params;
-               t.features = t.editor.windowManager.features;
-
-               // Setup local DOM
-               t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
-
-               // Enables you to skip loading the default css
-               if (t.features.popup_css !== false)
-                       t.dom.loadCSS(t.features.popup_css || t.editor.settings.popup_css);
-
-               // Setup on init listeners
-               t.listeners = [];
-               t.onInit = {
-                       add : function(f, s) {
-                               t.listeners.push({func : f, scope : s});
-                       }
-               };
-
-               t.isWindow = !t.getWindowArg('mce_inline');
-               t.id = t.getWindowArg('mce_window_id');
-               t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
-       },
-
-       getWin : function() {
-               return window.dialogArguments || opener || parent || top;
-       },
-
-       getWindowArg : function(n, dv) {
-               var v = this.params[n];
-
-               return tinymce.is(v) ? v : dv;
-       },
-
-       getParam : function(n, dv) {
-               return this.editor.getParam(n, dv);
-       },
-
-       getLang : function(n, dv) {
-               return this.editor.getLang(n, dv);
-       },
-
-       execCommand : function(cmd, ui, val, a) {
-               a = a || {};
-               a.skip_focus = 1;
-
-               this.restoreSelection();
-               return this.editor.execCommand(cmd, ui, val, a);
-       },
-
-       resizeToInnerSize : function() {
-               var t = this, n, b = document.body, vp = t.dom.getViewPort(window), dw, dh;
-
-               dw = t.getWindowArg('mce_width') - vp.w;
-               dh = t.getWindowArg('mce_height') - vp.h;
-
-               if (t.isWindow)
-                       window.resizeBy(dw, dh);
-               else
-                       t.editor.windowManager.resizeBy(dw, dh, t.id);
-       },
-
-       executeOnLoad : function(s) {
-               this.onInit.add(function() {
-                       eval(s);
-               });
-       },
-
-       storeSelection : function() {
-               this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
-       },
-
-       restoreSelection : function() {
-               var t = tinyMCEPopup;
-
-               if (!t.isWindow && tinymce.isIE)
-                       t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
-       },
-
-       requireLangPack : function() {
-               var u = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url');
-
-               if (u && this.editor.settings.language) {
-                       u += '/langs/' + this.editor.settings.language + '_dlg.js';
-
-                       if (!tinymce.ScriptLoader.isDone(u)) {
-                               document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
-                               tinymce.ScriptLoader.markDone(u);
-                       }
-               }
-       },
-
-       pickColor : function(e, element_id) {
-               this.execCommand('mceColorPicker', true, {
-                       color : document.getElementById(element_id).value,
-                       func : function(c) {
-                               document.getElementById(element_id).value = c;
-
-                               try {
-                                       document.getElementById(element_id).onchange();
-                               } catch (ex) {
-                                       // Try fire event, ignore errors
-                               }
-                       }
-               });
-       },
-
-       openBrowser : function(element_id, type, option) {
-               tinyMCEPopup.restoreSelection();
-               this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
-       },
-
-       confirm : function(t, cb, s) {
-               this.editor.windowManager.confirm(t, cb, s, window);
-       },
-
-       alert : function(tx, cb, s) {
-               this.editor.windowManager.alert(tx, cb, s, window);
-       },
-
-       close : function() {
-               var t = this;
-
-               // To avoid domain relaxing issue in Opera
-               function close() {
-                       t.editor.windowManager.close(window);
-                       tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
-               };
-
-               if (tinymce.isOpera)
-                       t.getWin().setTimeout(close, 0);
-               else
-                       close();
-       },
-
-       // Internal functions   
-
-       _restoreSelection : function() {
-               var e = window.event.srcElement;
-
-               if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
-                       tinyMCEPopup.restoreSelection();
-       },
-
-/*     _restoreSelection : function() {
-               var e = window.event.srcElement;
-
-               // If user focus a non text input or textarea
-               if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
-                       tinyMCEPopup.restoreSelection();
-       },*/
-
-       _onDOMLoaded : function() {
-               var t = this, ti = document.title, bm, h, nv;
-
-               // Translate page
-               if (t.features.translate_i18n !== false) {
-                       h = document.body.innerHTML;
-
-                       // Replace a=x with a="x" in IE
-                       if (tinymce.isIE)
-                               h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
-
-                       document.dir = t.editor.getParam('directionality','');
-
-                       if ((nv = t.editor.translate(h)) && nv != h)
-                               document.body.innerHTML = nv;
-
-                       if ((nv = t.editor.translate(ti)) && nv != ti)
-                               document.title = ti = nv;
-               }
-
-               document.body.style.display = '';
-
-               // Restore selection in IE when focus is placed on a non textarea or input element of the type text
-               if (tinymce.isIE)
-                       document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
-
-               t.restoreSelection();
-               t.resizeToInnerSize();
-
-               // Set inline title
-               if (!t.isWindow)
-                       t.editor.windowManager.setTitle(window, ti);
-               else
-                       window.focus();
-
-               if (!tinymce.isIE && !t.isWindow) {
-                       tinymce.dom.Event._add(document, 'focus', function() {
-                               t.editor.windowManager.focus(t.id)
-                       });
-               }
-
-               // Patch for accessibility
-               tinymce.each(t.dom.select('select'), function(e) {
-                       e.onkeydown = tinyMCEPopup._accessHandler;
-               });
-
-               // Call onInit
-               // Init must be called before focus so the selection won't get lost by the focus call
-               tinymce.each(t.listeners, function(o) {
-                       o.func.call(o.scope, t.editor);
-               });
-
-               // Move focus to window
-               if (t.getWindowArg('mce_auto_focus', true)) {
-                       window.focus();
-
-                       // Focus element with mceFocus class
-                       tinymce.each(document.forms, function(f) {
-                               tinymce.each(f.elements, function(e) {
-                                       if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
-                                               e.focus();
-                                               return false; // Break loop
-                                       }
-                               });
-                       });
-               }
-
-               document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
-       },
-
-       _accessHandler : function(e) {
-               e = e || window.event;
-
-               if (e.keyCode == 13 || e.keyCode == 32) {
-                       e = e.target || e.srcElement;
-
-                       if (e.onchange)
-                               e.onchange();
-
-                       return tinymce.dom.Event.cancel(e);
-               }
-       },
-
-       _closeWinKeyHandler : function(e) {
-               e = e || window.event;
-
-               if (e.keyCode == 27)
-                       tinyMCEPopup.close();
-       },
-
-       _wait : function() {
-               var t = this, ti;
-
-               if (tinymce.isIE && document.location.protocol != 'https:') {
-                       // Fake DOMContentLoaded on IE
-                       document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');
-                       document.getElementById("__ie_onload").onreadystatechange = function() {
-                               if (this.readyState == "complete") {
-                                       t._onDOMLoaded();
-                                       document.getElementById("__ie_onload").onreadystatechange = null; // Prevent leak
-                               }
-                       };
-               } else {
-                       if (tinymce.isIE || tinymce.isWebKit) {
-                               ti = setInterval(function() {
-                                       if (/loaded|complete/.test(document.readyState)) {
-                                               clearInterval(ti);
-                                               t._onDOMLoaded();
-                                       }
-                               }, 10);
-                       } else {
-                               window.addEventListener('DOMContentLoaded', function() {
-                                       t._onDOMLoaded();
-                               }, false);
-                       }
-               }
-       }
-};
-
-tinyMCEPopup.init();
-tinyMCEPopup._wait(); // Wait for DOM Content Loaded
+var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var e=this,g,a=document.body,c=e.dom.getViewPort(window),d,f;d=e.getWindowArg("mce_width")-c.w;f=e.getWindowArg("mce_height")-c.h;if(e.isWindow){window.resizeBy(d,f)}else{e.editor.windowManager.resizeBy(d,f,e.id)}},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark("simple")},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait();
\ No newline at end of file
index 6d79d0a0366b28485921216478da3391cd609559..1d56306984d58c23a1c7f3ef2f73f9911f6938fe 100644 (file)
@@ -1,5 +1,5 @@
 /**
 /**
- * $Id: form_utils.js 673 2008-03-06 13:26:20Z spocke $
+ * $Id: form_utils.js 996 2009-02-06 17:32:20Z spocke $
  *
  * Various form utilitiy functions.
  *
  *
  * Various form utilitiy functions.
  *
@@ -13,7 +13,7 @@ function getColorPickerHTML(id, target_form_element) {
        var h = "";
 
        h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
        var h = "";
 
        h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
-       h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"></span></a>';
+       h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
 
        return h;
 }
 
        return h;
 }
@@ -50,7 +50,7 @@ function getBrowserHTML(id, target_form_element, type, prefix) {
 
        html = "";
        html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
 
        html = "";
        html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
-       html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"></span></a>';
+       html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
 
        return html;
 }
 
        return html;
 }
diff --git a/wp-includes/js/tinymce/utils/mclayer.js b/wp-includes/js/tinymce/utils/mclayer.js
deleted file mode 100644 (file)
index a46d174..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/**
- * $Id: mclayer.js 520 2008-01-07 16:30:32Z spocke $
- *
- * Moxiecode floating layer script.
- *
- * @author Moxiecode
- * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-function MCLayer(id) {
-       this.id = id;
-       this.settings = new Array();
-       this.blockerElement = null;
-       this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
-       this.events = false;
-       this.autoHideCallback = null;
-}
-
-MCLayer.prototype = {
-       moveRelativeTo : function(re, p, a) {
-               var rep = this.getAbsPosition(re);
-               var w = parseInt(re.offsetWidth);
-               var h = parseInt(re.offsetHeight);
-               var x, y;
-
-               switch (p) {
-                       case "tl":
-                               break;
-
-                       case "tr":
-                               x = rep.absLeft + w;
-                               y = rep.absTop;
-                               break;
-
-                       case "bl":
-                               break;
-
-                       case "br":
-                               break;
-               }
-
-               this.moveTo(x, y);
-       },
-
-       moveBy : function(dx, dy) {
-               var e = this.getElement();
-               var x = parseInt(e.style.left);
-               var y = parseInt(e.style.top);
-
-               e.style.left = (x + dx) + "px";
-               e.style.top = (y + dy) + "px";
-
-               this.updateBlocker();
-       },
-
-       moveTo : function(x, y) {
-               var e = this.getElement();
-
-               e.style.left = x + "px";
-               e.style.top = y + "px";
-
-               this.updateBlocker();
-       },
-
-       show : function() {
-               MCLayer.visibleLayer = this;
-
-               this.getElement().style.display = 'block';
-               this.updateBlocker();
-       },
-
-       hide : function() {
-               this.getElement().style.display = 'none';
-               this.updateBlocker();
-       },
-
-       setAutoHide : function(s, cb) {
-               this.autoHideCallback = cb;
-               this.registerEventHandlers();
-       },
-
-       getElement : function() {
-               return document.getElementById(this.id);
-       },
-
-       updateBlocker : function() {
-               if (!this.isMSIE)
-                       return;
-
-               var e = this.getElement();
-               var b = this.getBlocker();
-               var x = this.parseInt(e.style.left);
-               var y = this.parseInt(e.style.top);
-               var w = this.parseInt(e.offsetWidth);
-               var h = this.parseInt(e.offsetHeight);
-
-               b.style.left = x + 'px';
-               b.style.top = y + 'px';
-               b.style.width = w + 'px';
-               b.style.height = h + 'px';
-               b.style.display = e.style.display;
-       },
-
-       getBlocker : function() {
-               if (!this.blockerElement) {
-                       var d = document, b = d.createElement("iframe");
-
-                       b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
-                       b.src = 'javascript:false;';
-                       b.frameBorder = '0';
-                       b.scrolling = 'no';
-
-                       d.body.appendChild(b);
-                       this.blockerElement = b;
-               }
-
-               return this.blockerElement;
-       },
-
-       getAbsPosition : function(n) {
-               var p = {absLeft : 0, absTop : 0};
-
-               while (n) {
-                       p.absLeft += n.offsetLeft;
-                       p.absTop += n.offsetTop;
-                       n = n.offsetParent;
-               }
-
-               return p;
-       },
-
-       registerEventHandlers : function() {
-               if (!this.events) {
-                       var d = document;
-
-                       this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
-
-                       this.events = true;
-               }
-       },
-
-       addEvent : function(o, n, h) {
-               if (o.attachEvent)
-                       o.attachEvent("on" + n, h);
-               else
-                       o.addEventListener(n, h, false);
-       },
-
-       onMouseDown : function(e) {
-               e = typeof(e) == "undefined" ? window.event : e;
-               var b = document.body;
-               var l = MCLayer.visibleLayer;
-
-               if (l) {
-                       var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
-                       var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
-                       var el = l.getElement();
-                       var x = parseInt(el.style.left);
-                       var y = parseInt(el.style.top);
-                       var w = parseInt(el.offsetWidth);
-                       var h = parseInt(el.offsetHeight);
-
-                       if (!(mx > x && mx < x + w && my > y && my < y + h)) {
-                               MCLayer.visibleLayer = null;
-
-                               if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
-                                       return true;
-
-                               l.hide();
-                       }
-               }
-       },
-
-       addCSSClass : function(e, c) {
-               this.removeCSSClass(e, c);
-               var a = this.explode(' ', e.className);
-               a[a.length] = c;
-               e.className = a.join(' ');
-       },
-
-       removeCSSClass : function(e, c) {
-               var a = this.explode(' ', e.className), i;
-
-               for (i=0; i<a.length; i++) {
-                       if (a[i] == c)
-                               a[i] = '';
-               }
-
-               e.className = a.join(' ');
-       },
-
-       explode : function(d, s) {
-               var ar = s.split(d);
-               var oar = new Array();
-
-               for (var i = 0; i<ar.length; i++) {
-                       if (ar[i] != "")
-                               oar[oar.length] = ar[i];
-               }
-
-               return oar;
-       },
-
-       parseInt : function(s) {
-               if (s == null || s == '')
-                       return 0;
-
-               return parseInt(s);
-       }
-}
diff --git a/wp-includes/js/tinymce/wordpress.css b/wp-includes/js/tinymce/wordpress.css
deleted file mode 100644 (file)
index eff18ff..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
-html {
-       background-color: #fff;
-}
-
-.aligncenter,
-dl.aligncenter {
-       display: block;
-       margin-left: auto;
-       margin-right: auto;
-}
-
-.alignleft {
-       float: left;
-}
-
-.alignright {
-       float: right;
-}
-
-.wp-caption {
-       border: 1px solid #ddd;
-       text-align: center;
-       background-color: #f3f3f3;
-       padding-top: 4px;
-       margin: 10px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-}
-
-.wp-caption img {
-       margin: 0;
-       padding: 0;
-       border: 0 none;
-}
-
-.wp-caption-dd {
-       font-size: 11px;
-       line-height: 17px;
-       padding: 0 4px 5px;
-       margin: 0;
-}
-
-img.wpGallery {
-       border: 1px dotted #cc0000;
-       background: #ffffcc url("plugins/wpgallery/img/gallery.png") no-repeat scroll center center;
-       width: 99%;
-       height: 250px;
-}
-
-body.mceContentBody {
-       font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
-       padding: 0.6em;
-       margin: 0;
-}
-
-body.mceForceColors {
-       background:#fff;
-       color:#000;
-}
-
-h1 {font-size: 2em}
-h2 {font-size: 1.5em}
-h3 {font-size: 1.17em}
-h4 {font-size: 1em}
-h5 {font-size: .83em}
-h6 {font-size: .75em}
-
-.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {
-       border: 1px dashed #BBB;
-}
-
-img {
-       border:0;
-}
-
-td {
-       font-size: 10px;
-}
-
-pre {
-       font: 12px/18px "Courier New", monospace;
-}
-
-.mceIEcenter {
-       text-align: center;
-}
index d84410cccada50762273446744d4a58131859e99..a946f9af1b350023b3c6d1eaf02e35ec8a083dd3 100644 (file)
@@ -14,7 +14,7 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
 <head>
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
 <title><?php _e('Rich Editor Help') ?></title>
 <head>
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
 <title><?php _e('Rich Editor Help') ?></title>
-<script type="text/javascript" src="tiny_mce_popup.js?ver=321"></script>
+<script type="text/javascript" src="tiny_mce_popup.js?ver=3223"></script>
 <?php
 wp_admin_css( 'global', true );
 wp_admin_css( 'wp-admin', true );
 <?php
 wp_admin_css( 'global', true );
 wp_admin_css( 'wp-admin', true );
@@ -245,7 +245,7 @@ wp_admin_css( 'wp-admin', true );
        <p><?php _e('For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.') ?></p>
 
        <div id="buttoncontainer">
        <p><?php _e('For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.') ?></p>
 
        <div id="buttoncontainer">
-               <a href="http://www.moxiecode.com" target="_new"><img src="themes/advanced/img/gotmoxie.png" alt="<?php _e('Got Moxie?') ?>" style="border: none;" /></a>
+               <a href="http://www.moxiecode.com" target="_blank"><img src="themes/advanced/img/gotmoxie.png" alt="<?php _e('Got Moxie?') ?>" style="border: none;" /></a>
                <a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="themes/advanced/img/sflogo.png" alt="<?php _e('Hosted By Sourceforge') ?>" style="border: none;" /></a>
                <a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="themes/advanced/img/fm.gif" alt="<?php _e('Also on freshmeat') ?>" style="border: none;" /></a>
        </div>
                <a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="themes/advanced/img/sflogo.png" alt="<?php _e('Hosted By Sourceforge') ?>" style="border: none;" /></a>
                <a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="themes/advanced/img/fm.gif" alt="<?php _e('Also on freshmeat') ?>" style="border: none;" /></a>
        </div>
diff --git a/wp-includes/js/tinymce/wp-tinymce.js b/wp-includes/js/tinymce/wp-tinymce.js
new file mode 100644 (file)
index 0000000..cc13fc8
--- /dev/null
@@ -0,0 +1,28 @@
+//core
+var tinymce={majorVersion:"3",minorVersion:"2.4.1",releaseDate:"2009-05-25",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h<a.length;h++){if(m=a[h].href){if(/^https?:\/\/[^\/]+$/.test(m)){m+="/"}f=m?m.match(/.*\//)[0]:""}}function c(d){if(d.src&&/tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){o.suffix="_src"}if((e=d.src.indexOf("?"))!=-1){o.query=d.src.substring(e+1)}o.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(f&&o.baseURL.indexOf("://")==-1){o.baseURL=f+o.baseURL}return o.baseURL}return null}a=k.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}g=k.getElementsByTagName("head")[0];if(g){a=g.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}}return},is:function(b,a){var c=typeof(b);if(!a){return c!="undefined"}if(a=="array"&&(b.hasOwnProperty&&b instanceof Array)){return true}return c==a},each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},map:function(b,c){var d=[];tinymce.each(b,function(a){d.push(c(a))});return d},grep:function(b,c){var d=[];tinymce.each(b,function(a){if(!c||c(a)){d.push(a)}});return d},inArray:function(c,d){var e,b;if(c){for(e=0,b=c.length;e<b;e++){if(c[e]===d){return e}}}return -1},extend:function(f,d){var c,b=arguments;for(c=1;c<b.length;c++){d=b[c];tinymce.each(d,function(a,e){if(typeof(a)!=="undefined"){f[e]=a}})}return f},trim:function(a){return(a?""+a:"").replace(/^\s*|\s*$/g,"")},create:function(j,a){var i=this,b,e,f,g,d,h=0;j=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(j);f=j[3].match(/(^|\.)(\w+)$/i)[2];e=i.createNS(j[3].replace(/\.\w+$/,""));if(e[f]){return}if(j[2]=="static"){e[f]=a;if(this.onCreate){this.onCreate(j[2],j[3],e[f])}return}if(!a[f]){a[f]=function(){};h=1}e[f]=a[f];i.extend(e[f].prototype,a);if(j[5]){b=i.resolve(j[5]).prototype;g=j[5].match(/\.(\w+)$/i)[1];d=e[f];if(h){e[f]=function(){return b[g].apply(this,arguments)}}else{e[f]=function(){this.parent=b[g];return d.apply(this,arguments)}}e[f].prototype[f]=e[f];i.each(b,function(c,k){e[f].prototype[k]=b[k]});i.each(a,function(c,k){if(b[k]){e[f].prototype[k]=function(){this.parent=b[k];return c.apply(this,arguments)}}else{if(k!=f){e[f].prototype[k]=c}}})}i.each(a["static"],function(c,k){e[f][k]=c});if(this.onCreate){this.onCreate(j[2],j[3],e[f].prototype)}},walk:function(c,b,d,a){a=a||this;if(c){if(d){c=c[d]}tinymce.each(c,function(f,e){if(b.call(a,f,e,d)===false){return false}tinymce.walk(f,b,d,a)})}},createNS:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0;b<d.length;b++){a=d[b];if(!c[a]){c[a]={}}c=c[a]}return c},resolve:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0,a=d.length;b<a;b++){c=c[d[b]];if(!c){break}}return c},addUnload:function(e,d){var c=this,a=window;e={func:e,scope:d||this};if(!c.unloads){function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){h.func.call(h.scope,1)}}if(a.detachEvent){a.detachEvent("onbeforeunload",g);a.detachEvent("onunload",b)}else{if(a.removeEventListener){a.removeEventListener("unload",b,false)}}c.unloads=h=f=a=b=0;if(window.CollectGarbage){window.CollectGarbage()}}}function g(){var h=document;if(h.readyState=="interactive"){function f(){h.detachEvent("onstop",f);if(b){b()}h=0}if(h){h.attachEvent("onstop",f)}window.setTimeout(function(){if(h){h.detachEvent("onstop",f)}},0)}}if(a.attachEvent){a.attachEvent("onunload",b);a.attachEvent("onbeforeunload",g)}else{if(a.addEventListener){a.addEventListener("unload",b,false)}}c.unloads=[e]}else{c.unloads.push(e)}return e},removeUnload:function(c){var a=this.unloads,b=null;tinymce.each(a,function(e,d){if(e&&e.func==c){a.splice(d,1);b=c;return false}});return b},explode:function(a,b){return a?tinymce.map(a.split(b||","),tinymce.trim):a},_addVer:function(b){var a;if(!this.query){return b}a=(b.indexOf("?")==-1?"?":"&")+this.query;if(b.indexOf("#")==-1){return b+a}return b.replace("#",a+"#")}};window.tinymce=tinymce;tinymce._init();tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(e.indexOf(":/")===-1&&e.indexOf("//")!==0){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,g=[],d;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(h){if(h){g.push(h)}});e=g;for(c=f.length-1,g=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}g.push(f[c])}c=e.length-b;if(c<=0){return"/"+g.reverse().join("/")+d}return"/"+e.slice(0,c).join("/")+"/"+g.reverse().join("/")+d},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;f.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+"</"+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var h=this,i=h.doc,g;if(!f){f=""}g=h.select("head")[0];e(f.split(","),function(j){var k;if(h.files[j]){return}h.files[j]=true;k=h.create("link",{rel:"stylesheet",href:c._addVer(j)});if(a&&i.documentMode){k.onload=function(){i.recalc();k.onload=null}}g.appendChild(k)})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML="<br />"+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/<p ([^>]+)>|<p>/g,'<div $1 mce_tmp="1">');g=g.replace(/<\/p>/g,"</div>");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h<q.childNodes.length;h++){l.appendChild(q.childNodes[h].cloneNode(true))}q.swapNode(l)}}}}}else{m.innerHTML=g}return g})},processHTML:function(j){var g=this,i=g.settings;if(!i.process_html){return j}if(c.isGecko){j=j.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|<em( [^>]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/&apos;/g,"&#39;");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(i.keep_values){if(/<script|style/.test(j)){function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/^[\r\n]*|[\r\n]*$/g,"");h=h.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");h=h.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return h}j=j.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g,function(h,l,k){if(!l){l=' type="text/javascript"'}l=l.replace(/(type|language)=\"?/,"$&mce-");l=l.replace(/src=\"([^\"]+)\"?/,function(m,n){if(i.url_converter){n=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(n),"src","script"))}return'mce_src="'+n+'"'});if(c.trim(k)){k="<!--\n"+f(k)+"\n// -->"}return"<mce:script"+l+">"+k+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g,function(h,l,k){if(k){k="<!--\n"+f(k)+"\n-->"}return"<mce:style"+l+">"+k+"</mce:style><style "+l+' mce_bogus="1">'+k+"</style>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,l){function k(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}if(i.hex_colors){p=p.replace(/rgb\([^\)]+\)/g,function(m){return g.toHex(m)})}if(i.url_converter){p=p.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(m,r){return"url("+g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(r),n,l))+")"})}}else{if(n!="coords"&&n!="shape"){if(i.url_converter){p=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(q),n,l))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,k);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,k);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,k)})}return j},getOuterHTML:function(f){var g;f=this.get(f);if(!f){return null}if(f.outerHTML!==undefined){return f.outerHTML}g=(f.ownerDocument||this.doc).createElement("body");g.appendChild(f.cloneNode(true));return g.innerHTML},setOuterHTML:function(i,g,j){var f=this;return this.run(i,function(h){var l,k;h=f.get(h);j=j||h.ownerDocument||f.doc;if(a&&h.nodeType==1){h.outerHTML=g}else{k=j.createElement("body");k.innerHTML=g;l=k.lastChild;while(l){f.insertAfter(l.cloneNode(true),h);l=l.previousSibling}f.remove(h)}})},decode:function(g){var h,i,f;if(/&[^;]+;/.test(g)){h=this.doc.createElement("div");h.innerHTML=g;i=h.firstChild;f="";if(i){do{f+=i.nodeValue}while(i.nextSibling)}return f||g}return g},encode:function(f){return f?(""+f).replace(/[<>&\"]/g,function(h,g){switch(h){case"&":return"&amp;";case'"':return"&quot;";case"<":return"&lt;";case">":return"&gt;"}return h}):f},insertAfter:function(h,g){var f=this;g=f.get(g);return this.run(h,function(k){var j,i;j=g.parentNode;i=g.nextSibling;if(i){j.insertBefore(k,i)}else{j.appendChild(k)}return k})},isBlock:function(f){if(f.nodeType&&f.nodeType!==1){return false}f=f.nodeName||f;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(f)},replace:function(i,h,f){var g=this;if(b(h,"array")){i=i.cloneNode(true)}return g.run(h,function(j){if(f){e(j.childNodes,function(k){i.appendChild(k.cloneNode(true))})}if(g.fixPsuedoLeaks&&j.nodeType===1){j.parentNode.insertBefore(i,j);g.remove(j);return i}return j.parentNode.replaceChild(i,j)})},findCommonAncestor:function(h,f){var i=h,g;while(i){g=f;while(g&&i!=g){g=g.parentNode}if(i==g){break}i=i.parentNode}if(!i&&h.ownerDocument){return h.ownerDocument.documentElement}return i},toHex:function(f){var h=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(f);function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}if(h){f="#"+g(h[1])+g(h[2])+g(h[3]);return f}return f},getClasses:function(){var l=this,g=[],k,m={},n=l.settings.class_filter,j;if(l.classes){return l.classes}function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,function(i){switch(i.type||1){case 1:if(i.selectorText){e(i.selectorText.split(","),function(p){p=p.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(p)||!/\.[\w\-]+$/.test(p)){return}j=p;p=p.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(n&&!(p=n(p,j))){return}if(!m[p]){g.push({"class":p});m[p]=1}})}break;case 3:o(i.styleSheet);break}})}try{e(l.doc.styleSheets,o)}catch(h){}if(g.length>0){l.classes=g}return g},run:function(j,i,h){var g=this,k;if(g.doc&&typeof(j)==="string"){j=g.get(j)}if(!j){return false}h=h||this;if(!j.nodeType&&(j.length||j.length===0)){k=[];e(j,function(l,f){if(l){if(typeof(l)=="string"){l=g.doc.getElementById(l)}k.push(i.call(h,l,f))}});return k}return i.call(h,j)},getAttribs:function(g){var f;g=this.get(g);if(!g){return[]}if(a){f=[];if(g.nodeName=="OBJECT"){return g.attributes}g.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(i,h){f.push({specified:1,nodeName:h})});return f}return g.attributes},destroy:function(g){var f=this;if(f.events){f.events.destroy()}f.win=f.doc=f.root=f.events=null;if(!g){c.removeUnload(f.destroy)}},createRng:function(){var f=this.doc;return f.createRange?f.createRange():new c.dom.Range(this)},split:function(l,k,o){var p=this,f=p.createRng(),m,j,n;function g(r,q){r=r[q];if(r&&r[q]&&r[q].nodeType==1&&i(r[q])){p.remove(r[q])}}function i(q){q=p.getOuterHTML(q);q=q.replace(/<(img|hr|table)/gi,"-");q=q.replace(/<[^>]+>/g,"");return q.replace(/[ \t\r\n]+|&nbsp;|&#160;/g,"")==""}function h(r){var q=0;while(r.previousSibling){q++;r=r.previousSibling}return q}if(l&&k){f.setStart(l.parentNode,h(l));f.setEnd(k.parentNode,h(k));m=f.extractContents();f=p.createRng();f.setStart(k.parentNode,h(k)+1);f.setEnd(l.parentNode,h(l)+1);j=f.extractContents();n=l.parentNode;g(m,"lastChild");if(!i(m)){n.insertBefore(m,l)}if(o){n.replaceChild(o,k)}else{n.insertBefore(k,l)}g(j,"firstChild");if(!i(j)){n.insertBefore(j,l)}p.remove(l);return o||k}},bind:function(j,f,i,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.add(j,f,i,h||this)},unbind:function(i,f,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.remove(i,f,h)},_isRes:function(f){return/^(top|left|bottom|right|width|height)/i.test(f)||/;\s*(top|left|bottom|right|width|height)/i.test(f)}});c.DOM=new c.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(f){var h=0,c=1,e=2,d=tinymce.extend;function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild,j=0;l!=m;l=l.nextSibling){j++}return j}function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}return j}function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.firstChild;while(l!=null&&k>0){--k;l=l.nextSibling}if(l!=null){return l}return j}function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,endContainer:j,endOffset:0,collapsed:true,commonAncestorContainer:j,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3})}d(a.prototype,{setStart:function(k,j){this._setEndPoint(true,k,j)},setEnd:function(k,j){this._setEndPoint(false,k,j)},setStartBefore:function(j){this.setStart(j.parentNode,b(j))},setStartAfter:function(j){this.setStart(j.parentNode,b(j)+1)},setEndBefore:function(j){this.setEnd(j.parentNode,b(j))},setEndAfter:function(j){this.setEnd(j.parentNode,b(j)+1)},collapse:function(k){var j=this;if(k){j.endContainer=j.startContainer;j.endOffset=j.startOffset}else{j.startContainer=j.endContainer;j.startOffset=j.endOffset}j.collapsed=true},selectNode:function(j){this.setStartBefore(j);this.setEndAfter(j)},selectNodeContents:function(j){this.setStart(j,0);this.setEnd(j,j.nodeType===1?j.childNodes.length:j.nodeValue.length)},compareBoundaryPoints:function(m,n){var l=this,p=l.startContainer,o=l.startOffset,k=l.endContainer,j=l.endOffset;if(m===0){return l._compareBoundaryPoints(p,o,p,o)}if(m===1){return l._compareBoundaryPoints(p,o,k,j)}if(m===2){return l._compareBoundaryPoints(k,j,k,j)}if(m===3){return l._compareBoundaryPoints(k,j,p,o)}},deleteContents:function(){this._traverse(e)},extractContents:function(){return this._traverse(h)},cloneContents:function(){return this._traverse(c)},insertNode:function(m){var j=this,l,k;if(m.nodeType===3||m.nodeType===4){l=j.startContainer.splitText(j.startOffset);j.startContainer.parentNode.insertBefore(m,l)}else{if(j.startContainer.childNodes.length>0){k=j.startContainer.childNodes[j.startOffset]}j.startContainer.insertBefore(m,k)}},surroundContents:function(l){var j=this,k=j.extractContents();j.insertNode(l);l.appendChild(k);j.selectNode(l)},cloneRange:function(){var j=this;return d(new a(j.dom),{startContainer:j.startContainer,startOffset:j.startOffset,endContainer:j.endContainer,endOffset:j.endOffset,collapsed:j.collapsed,commonAncestorContainer:j.commonAncestorContainer})},_isCollapsed:function(){return(this.startContainer==this.endContainer&&this.startOffset==this.endOffset)},_compareBoundaryPoints:function(m,p,k,o){var q,l,j,r,t,s;if(m==k){if(p==o){return 0}else{if(p<o){return -1}else{return 1}}}q=k;while(q&&q.parentNode!=m){q=q.parentNode}if(q){l=0;j=m.firstChild;while(j!=q&&l<p){l++;j=j.nextSibling}if(p<=l){return -1}else{return 1}}q=m;while(q&&q.parentNode!=k){q=q.parentNode}if(q){l=0;j=k.firstChild;while(j!=q&&l<o){l++;j=j.nextSibling}if(l<o){return -1}else{return 1}}r=this.dom.findCommonAncestor(m,k);t=m;while(t&&t.parentNode!=r){t=t.parentNode}if(!t){t=r}s=k;while(s&&s.parentNode!=r){s=s.parentNode}if(!s){s=r}if(t==s){return 0}j=r.firstChild;while(j){if(j==t){return -1}if(j==s){return 1}j=j.nextSibling}},_setEndPoint:function(k,q,p){var l=this,j,m;if(k){l.startContainer=q;l.startOffset=p}else{l.endContainer=q;l.endOffset=p}j=l.endContainer;while(j.parentNode){j=j.parentNode}m=l.startContainer;while(m.parentNode){m=m.parentNode}if(m!=j){l.collapse(k)}else{if(l._compareBoundaryPoints(l.startContainer,l.startOffset,l.endContainer,l.endOffset)>0){l.collapse(k)}}l.collapsed=l._isCollapsed();l.commonAncestorContainer=l.dom.findCommonAncestor(l.startContainer,l.endContainer)},_traverse:function(r){var s=this,q,m=0,v=0,k,o,l,n,j,u;if(s.startContainer==s.endContainer){return s._traverseSameContainer(r)}for(q=s.endContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.startContainer){return s._traverseCommonStartContainer(q,r)}++m}for(q=s.startContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.endContainer){return s._traverseCommonEndContainer(q,r)}++v}o=v-m;l=s.startContainer;while(o>0){l=l.parentNode;o--}n=s.endContainer;while(o<0){n=n.parentNode;o++}for(j=l.parentNode,u=n.parentNode;j!=u;j=j.parentNode,u=u.parentNode){l=j;n=u}return s._traverseCommonAncestors(l,n,r)},_traverseSameContainer:function(o){var r=this,q,u,j,k,l,p,m;if(o!=e){q=r.dom.doc.createDocumentFragment()}if(r.startOffset==r.endOffset){return q}if(r.startContainer.nodeType==3){u=r.startContainer.nodeValue;j=u.substring(r.startOffset,r.endOffset);if(o!=c){r.startContainer.deleteData(r.startOffset,r.endOffset-r.startOffset);r.collapse(true)}if(o==e){return null}q.appendChild(r.dom.doc.createTextNode(j));return q}k=i(r.startContainer,r.startOffset);l=r.endOffset-r.startOffset;while(l>0){p=k.nextSibling;m=r._traverseFullySelected(k,o);if(q){q.appendChild(m)}--l;k=p}if(o!=c){r.collapse(true)}return q},_traverseCommonStartContainer:function(j,p){var s=this,r,k,l,m,q,o;if(p!=e){r=s.dom.doc.createDocumentFragment()}k=s._traverseRightBoundary(j,p);if(r){r.appendChild(k)}l=g(j,s.startContainer);m=l-s.startOffset;if(m<=0){if(p!=c){s.setEndBefore(j);s.collapse(false)}return r}k=j.previousSibling;while(m>0){q=k.previousSibling;o=s._traverseFullySelected(k,p);if(r){r.insertBefore(o,r.firstChild)}--m;k=q}if(p!=c){s.setEndBefore(j);s.collapse(false)}return r},_traverseCommonEndContainer:function(m,p){var s=this,r,o,j,k,q,l;if(p!=e){r=s.dom.doc.createDocumentFragment()}j=s._traverseLeftBoundary(m,p);if(r){r.appendChild(j)}o=g(m,s.endContainer);++o;k=s.endOffset-o;j=m.nextSibling;while(k>0){q=j.nextSibling;l=s._traverseFullySelected(j,p);if(r){r.appendChild(l)}--k;j=q}if(p!=c){s.setStartAfter(m);s.collapse(true)}return r},_traverseCommonAncestors:function(p,j,s){var w=this,l,v,o,q,r,k,u,m;if(s!=e){v=w.dom.doc.createDocumentFragment()}l=w._traverseLeftBoundary(p,s);if(v){v.appendChild(l)}o=p.parentNode;q=g(p,o);r=g(j,o);++q;k=r-q;u=p.nextSibling;while(k>0){m=u.nextSibling;l=w._traverseFullySelected(u,s);if(v){v.appendChild(l)}u=m;--k}l=w._traverseRightBoundary(j,s);if(v){v.appendChild(l)}if(s!=c){w.setStartAfter(p);w.collapse(true)}return v},_traverseRightBoundary:function(p,q){var s=this,l=i(s.endContainer,s.endOffset-1),r,o,n,j,k;var m=l!=s.endContainer;if(l==p){return s._traverseNode(l,m,false,q)}r=l.parentNode;o=s._traverseNode(r,false,false,q);while(r!=null){while(l!=null){n=l.previousSibling;j=s._traverseNode(l,m,false,q);if(q!=e){o.insertBefore(j,o.firstChild)}m=true;l=n}if(r==p){return o}l=r.previousSibling;r=r.parentNode;k=s._traverseNode(r,false,false,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseLeftBoundary:function(p,q){var s=this,m=i(s.startContainer,s.startOffset);var n=m!=s.startContainer,r,o,l,j,k;if(m==p){return s._traverseNode(m,n,true,q)}r=m.parentNode;o=s._traverseNode(r,false,true,q);while(r!=null){while(m!=null){l=m.nextSibling;j=s._traverseNode(m,n,true,q);if(q!=e){o.appendChild(j)}n=true;m=l}if(r==p){return o}m=r.nextSibling;r=r.parentNode;k=s._traverseNode(r,false,true,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseNode:function(j,o,r,s){var u=this,m,l,p,k,q;if(o){return u._traverseFullySelected(j,s)}if(j.nodeType==3){m=j.nodeValue;if(r){k=u.startOffset;l=m.substring(k);p=m.substring(0,k)}else{k=u.endOffset;l=m.substring(0,k);p=m.substring(k)}if(s!=c){j.nodeValue=p}if(s==e){return null}q=j.cloneNode(false);q.nodeValue=l;return q}if(s==e){return null}return j.cloneNode(false)},_traverseFullySelected:function(l,k){var j=this;if(k!=e){return k==c?l.cloneNode(true):l}l.parentNode.removeChild(l);return null}});f.Range=a})(tinymce.dom);(function(){function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.item&&i.item&&j.item(0)===i.item(0)){return 1}if(j.isEqual&&i.isEqual&&i.isEqual(j)){return 1}}return 0}function f(){var m=e.dom,j=e.getRng(),s=m.createRng(),p,k,n,q,o,l;function i(v){var t=v.parentNode.childNodes,u;for(u=t.length-1;u>=0;u--){if(t[u]==v){return u}}return -1}function r(v){var t=j.duplicate(),B,y,u,w,x=0,z=0,A,C;t.collapse(v);B=t.parentElement();t.pasteHTML(h);u=B.childNodes;for(y=0;y<u.length;y++){w=u[y];if(y>0&&(w.nodeType!==3||u[y-1].nodeType!==3)){z++}if(w.nodeType===3){A=w.nodeValue.indexOf(h);if(A!==-1){x+=A;break}x+=w.nodeValue.length}else{x=0}}t.moveStart("character",-1);t.text="";return{index:z,offset:x,parent:B}}n=j.item?j.item(0):j.parentElement();if(n.ownerDocument!=m.doc){return s}if(j.item||!n.hasChildNodes()){s.setStart(n.parentNode,i(n));s.setEnd(s.startContainer,s.startOffset+1);return s}l=e.isCollapsed();p=r(true);k=r(false);p.parent.normalize();k.parent.normalize();q=p.parent.childNodes[Math.min(p.index,p.parent.childNodes.length-1)];if(q.nodeType!=3){s.setStart(p.parent,p.index)}else{s.setStart(p.parent.childNodes[p.index],p.offset)}o=k.parent.childNodes[Math.min(k.index,k.parent.childNodes.length-1)];if(o.nodeType!=3){if(!l){k.index++}s.setEnd(k.parent,k.index)}else{s.setEnd(k.parent.childNodes[k.index],k.offset)}if(!l){q=s.startContainer;if(q.nodeType==1){s.setStart(q,Math.min(s.startOffset,q.childNodes.length))}o=s.endContainer;if(o.nodeType==1){s.setEnd(o,Math.min(s.endOffset,o.childNodes.length))}}d.addRange(s);return s}this.addRange=function(j){var o,m=e.dom.doc.body,p,k,q,l,n,i;q=j.startContainer;l=j.startOffset;n=j.endContainer;i=j.endOffset;o=m.createTextRange();q=q.nodeType==1?q.childNodes[Math.min(l,q.childNodes.length-1)]:q;n=n.nodeType==1?n.childNodes[Math.min(l==i?i:i-1,n.childNodes.length-1)]:n;if(q==n&&q.nodeType==1){if(/^(IMG|TABLE)$/.test(q.nodeName)&&l!=i){o=m.createControlRange();o.addElement(q)}else{o=m.createTextRange();if(!q.hasChildNodes()&&q.canHaveHTML){q.innerHTML=h}o.moveToElementText(q);if(q.innerHTML==h){o.collapse(true);q.removeChild(q.firstChild)}}if(l==i){o.collapse(i<=j.endContainer.childNodes.length-1)}o.select();return}function r(t,v){var u,s,w;if(t.nodeType!=3){return -1}u=t.nodeValue;s=m.createTextRange();t.nodeValue=u.substring(0,v)+h+u.substring(v);s.moveToElementText(t.parentNode);s.findText(h);w=Math.abs(s.moveStart("character",-1048575));t.nodeValue=u;return w}if(j.collapsed){pos=r(q,l);o=m.createTextRange();o.move("character",pos);o.select();return}else{if(q==n&&q.nodeType==3){p=r(q,l);o.move("character",p);o.moveEnd("character",i-l);o.select();return}p=r(q,l);k=r(n,i);o=m.createTextRange();if(p==-1){o.moveToElementText(q);p=0}else{o.move("character",p)}tmpRng=m.createTextRange();if(k==-1){tmpRng.moveToElementText(n)}else{tmpRng.move("character",k)}o.setEndPoint("EndToEnd",tmpRng);o.select();return}};this.getRangeAt=function(){if(!b||!c(g,e.getRng())){b=f();g=e.getRng()}return b};this.destroy=function(){g=b=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}if(!n.preventDefault){n.preventDefault=function(){n.returnValue=false}}if(!n.stopPropagation){n.stopPropagation=function(){n.cancelBubble=true}}}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){var b=a.each;a.create("tinymce.dom.Element",{Element:function(g,e){var c=this,f,d;e=e||{};c.id=g;c.dom=f=e.dom||a.DOM;c.settings=e;if(!a.isIE){d=c.dom.get(c.id)}b(["getPos","getRect","getParent","add","setStyle","getStyle","setStyles","setAttrib","setAttribs","getAttrib","addClass","removeClass","hasClass","getOuterHTML","setOuterHTML","remove","show","hide","isHidden","setHTML","get"],function(h){c[h]=function(){var j=[g],k;for(k=0;k<arguments.length;k++){j.push(arguments[k])}j=f[h].apply(f,j);c.update(h);return j}})},on:function(e,d,c){return a.dom.Event.add(this.id,e,d,c)},getXY:function(){return{x:parseInt(this.getStyle("left")),y:parseInt(this.getStyle("top"))}},getSize:function(){var c=this.dom.get(this.id);return{w:parseInt(this.getStyle("width")||c.clientWidth),h:parseInt(this.getStyle("height")||c.clientHeight)}},moveTo:function(c,d){this.setStyles({left:c,top:d})},moveBy:function(c,e){var d=this.getXY();this.moveTo(d.x+c,d.y+e)},resizeTo:function(c,d){this.setStyles({width:c,height:d})},resizeBy:function(c,e){var d=this.getSize();this.resizeTo(d.w+c,d.h+e)},update:function(d){var e=this,c,f=e.dom;if(a.isIE6&&e.settings.blocker){d=d||"";if(d.indexOf("get")===0||d.indexOf("has")===0||d.indexOf("is")===0){return}if(d=="remove"){f.remove(e.blocker);return}if(!e.blocker){e.blocker=f.uniqueId();c=f.add(e.settings.container||f.getRoot(),"iframe",{id:e.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});f.setStyle(c,"opacity",0)}else{c=f.get(e.blocker)}f.setStyle(c,"left",e.getStyle("left",1));f.setStyle(c,"top",e.getStyle("top",1));f.setStyle(c,"width",e.getStyle("width",1));f.setStyle(c,"height",e.getStyle("height",1));f.setStyle(c,"display",e.getStyle("display",1));f.setStyle(c,"zIndex",parseInt(e.getStyle("zIndex",1)||0)-1)}}})})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i));l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndAfter(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild}return h}else{h=g.startContainer;if(h.nodeName=="BODY"){return h.firstChild}return f.dom.getParent(h,"*")}},getEnd:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.lastChild}return h}else{h=g.endContainer;if(h.nodeName=="BODY"){return h.lastChild}return f.dom.getParent(h,"*")}},getBookmark:function(x){var j=this,m=j.getRng(),f,n,l,u=j.dom.getViewPort(j.win),v,p,z,o,w=-16777215,k,h=j.dom.getRoot(),g=0,i=0,y;n=u.x;l=u.y;if(x=="simple"){return{rng:m,scrollX:n,scrollY:l}}if(a){if(m.item){v=m.item(0);d(j.dom.select(v.nodeName),function(s,r){if(v==s){p=r;return false}});return{tag:v.nodeName,index:p,scrollX:n,scrollY:l}}f=j.dom.doc.body.createTextRange();f.moveToElementText(h);f.collapse(true);z=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(true);p=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(false);o=Math.abs(f.move("character",w))-p;return{start:p-z,length:o,scrollX:n,scrollY:l}}v=j.getNode();k=j.getSel();if(!k){return null}if(v&&v.nodeName=="IMG"){return{scrollX:n,scrollY:l}}function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false),E,B=0,C={};while((E=s.nextNode())!=null){if(E==D){C.start=B}if(E==t){C.end=B;return C}B+=e(E.nodeValue||"").length}return null}if(k.anchorNode==k.focusNode&&k.anchorOffset==k.focusOffset){v=q(h,k.anchorNode,k.focusNode);if(!v){return{scrollX:n,scrollY:l}}e(k.anchorNode.nodeValue||"").replace(/^\s+/,function(r){g=r.length});return{start:Math.max(v.start+k.anchorOffset-g,0),end:Math.max(v.end+k.focusOffset-g,0),scrollX:n,scrollY:l,beg:k.anchorOffset-g==0}}else{v=q(h,m.startContainer,m.endContainer);if(!v){return{scrollX:n,scrollY:l}}return{start:Math.max(v.start+m.startOffset-g,0),end:Math.max(v.end+m.endOffset-i,0),scrollX:n,scrollY:l,beg:m.startOffset-g==0}}},moveToBookmark:function(n){var o=this,g=o.getRng(),p=o.getSel(),j=o.dom.getRoot(),m,h,k;function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,false),x,s=0,A={},u,C,z,y;while((x=B.nextNode())!=null){z=y=0;k=x.nodeValue||"";h=e(k).length;s+=h;if(s>=t&&!A.startNode){u=t-(s-h);if(n.beg&&u>=h){continue}A.startNode=x;A.startOffset=u+y}if(s>=D){A.endNode=x;A.endOffset=D-(s-h)+y;return A}}return null}if(!n){return false}o.win.scrollTo(n.scrollX,n.scrollY);if(a){if(g=n.rng){try{g.select()}catch(l){}return true}o.win.focus();if(n.tag){g=j.createControlRange();d(o.dom.select(n.tag),function(r,q){if(q==n.index){g.addElement(r)}})}else{try{if(n.start<0){return true}g=p.createRange();g.moveToElementText(j);g.collapse(true);g.moveStart("character",n.start);g.moveEnd("character",n.length)}catch(f){return true}}try{g.select()}catch(l){}return true}if(!p){return false}if(n.rng){p.removeAllRanges();p.addRange(n.rng)}else{if(b(n.start)&&b(n.end)){try{m=i(j,n.start,n.end);if(m){g=o.dom.doc.createRange();g.setStart(m.startNode,m.startOffset);g.setEnd(m.endNode,m.endOffset);p.removeAllRanges();p.addRange(g)}if(!c.isOpera){o.win.focus()}}catch(l){}}}},select:function(g,l){var p=this,f=p.getRng(),q=p.getSel(),o,m,k,j=p.win.document;function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEXT,null,false);while(u=s.nextNode()){r=u;if(c.trim(u.nodeValue).length!=0){if(t){return u}else{r=u}}}}return r}if(a){try{o=j.body;if(/^(IMG|TABLE)$/.test(g.nodeName)){f=o.createControlRange();f.addElement(g)}else{f=o.createTextRange();f.moveToElementText(g)}f.select()}catch(i){}}else{if(l){m=h(g,1)||p.dom.select("br:first",g)[0];k=h(g,0)||p.dom.select("br:last",g)[0];if(m&&k){f=j.createRange();if(m.nodeName=="BR"){f.setStartBefore(m)}else{f.setStart(m,0)}if(k.nodeName=="BR"){f.setEndBefore(k)}else{f.setEnd(k,k.nodeValue.length)}}else{f.selectNode(g)}}else{f.selectNode(g)}p.setRng(f)}return g},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}return !g||h.boundingWidth==0||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var f=this,h=f.getRng(),g=f.getSel(),i;if(!a){if(!h){return f.dom.getRoot()}i=h.commonAncestorContainer;if(!h.collapsed){if(c.isWebKit&&g.anchorNode&&g.anchorNode.nodeType==1){return g.anchorNode.childNodes[g.anchorOffset]}if(h.startContainer==h.endContainer){if(h.startOffset-h.endOffset<2){if(h.startContainer.hasChildNodes()){i=h.startContainer.childNodes[h.startOffset]}}}}return f.dom.getParent(i,"*")}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",bool_attrs:/(checked|disabled|readonly|selected|nowrap)/,valid_elements:"*[*]",extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,y,w=["ol","ul"],u,t,q,k=/^(OL|UL)$/,z;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(y=0;y<w.length;y++){l=i.dom.select(w[y],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){z=m(t,"LI");if(!z){z=i.dom.create("li");z.innerHTML="&nbsp;";z.appendChild(t);q.insertBefore(z,q.firstChild)}else{z.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){f(i.dom.select("p table",l.node),function(m){i.dom.split(i.dom.getParent(m,"p"),m)})})}},setEntities:function(p){var n=this,j,m,h={},o="",k;if(n.entityLookup){return}j=p.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16);o+="\\u"+"0000".substring(k.length)+k}if(!o){n.settings.entity_encoding="raw";return}n.entitiesRE=new RegExp("["+o+"]","g");n.entityLookup=h},setValidChildRules:function(h){this.childRules=null;this.addValidChildRules(h)},addValidChildRules:function(k){var j=this,l,h,i;if(!k){return}l="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";h="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";i="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";f(k.split(","),function(n){var o=n.split(/\[|\]/),m;n="";f(o[1].split("|"),function(p){if(n){n+="|"}switch(p){case"%itrans":p=h;break;case"%itrans_na":p=h.substring(2);break;case"%istrict":p=l;break;case"%istrict_na":p=l.substring(2);break;case"%btrans":p=i;break;case"%bstrict":p=i;break}n+=p});m=new RegExp("^("+n.toLowerCase()+")$","i");f(o[0].split("/"),function(p){j.childRules=j.childRules||{};j.childRules[p]=m})});k="";f(j.childRules,function(n,m){if(k){k+="|"}k+=m});j.parentElementsRE=new RegExp("^("+k.toLowerCase()+")$","i")},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var w=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(w){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(l,k){var j,i=this;i._setup();k=k||{};k.format=k.format||"html";i.processObj=k;l=l.cloneNode(true);i.key=""+(parseInt(i.key)+1);if(!k.no_events){k.node=l;i.onPreProcess.dispatch(i,k)}i.writer.reset();i._serializeNode(l,k.getInner);k.content=i.writer.getContent();if(!k.no_events){i.onPostProcess.dispatch(i,k)}i._postProcess(k);k.node=null;return e.trim(k.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");j=j.replace(/(type|language)=\"mce-/g,'$1="');if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}}n.content=j},_serializeNode:function(D,o){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,G,B,h,y,k,r,C,p,m;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("mce_bogus"):D.getAttribute("mce_bogus")){return}p=false;q=D.hasChildNodes();k=D.getAttribute("mce_name")||D.nodeName.toLowerCase();if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||o){p=true;break}if(d){if(A.fix_content_duplication){if(D.mce_serialized==z.key){return}D.mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(z.childRules){if(z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(k)){p=true;break}}z.elementName=k}r=z.findRule(k);k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){G=r.requiredAttribs;for(F=G.length-1;F>=0;F--){if(this.dom.getAttrib(D,G[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){G=B[F];y=z._getAttrib(D,G);if(y!==null){x.writeAttribute(G.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){G=h.nodeName.toLowerCase();if(A.invalid_attrs.test(G)||!r.validAttribsRE.test(G)){continue}C=z.findAttribRule(r,G);y=z._getAttrib(D,C,G);if(y!==null){x.writeAttribute(G,y)}}}}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("mce_bogus"):u.getAttribute("mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(z.childRules&&z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(D.nodeName)){return}}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(j.entitiesRE,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);h.addValidChildRules(i.valid_child_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);if(this.settings.bool_attrs.test(h)&&k){k=(""+k).toLowerCase();if(k==="false"||k==="0"){return null}k=h}switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(tinymce){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create("tinymce.dom.ScriptLoader",{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={}},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0},markDone:function(u){this.lookup[u]={state:2,url:u}},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2){cb.call(s||this)}return o}o={state:0,url:u,func:cb,scope:s||this};if(pr){t.queue.unshift(o)}else{t.queue.push(o)}lo[u]=o;return o},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2){cb.call(s||t)}return o}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co)}})}else{document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"><\/script>')}}if(!tinymce.is(u,"string")){each(u,function(u){loadScript(u)});if(cb){cb.call(s||t)}}else{loadScript(u);if(cb){cb.call(s||t)}}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb){cb.call(s||t)}each(t.queueCallbacks,function(o){o.func.call(o.scope)})})}else{if(cb){t.queueCallbacks.push({func:cb,scope:s||t})}}},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co)}catch(ex){eval(co,w)}}else{w.execScript(co)}},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--}else{load(o)}});if(l===0&&cb){cb.call(s||t);cb=0}}function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone()})}each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o)}else{o=lo[u]}if(o.state>0){return}if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol="";if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone()});if(tinymce.isIE){ol=' onreadystatechange="'}else{ol=' onload="'}ol+="tinymce.dom.ScriptLoader._onLoad(this,'"+u+"',"+ix+');"'}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+"><\/script>");if(!o.func){done(o)}}else{load(o)}});allDone()},"static":{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=="complete"){this._funcs[ix].call(this)}},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0}}if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done()}})}else{e=tinymce.DOM.create("script",{id:id,type:"text/javascript",src:tinymce._addVer(u)});Event.add(e,"load",done);(document.getElementsByTagName("head")[0]||document.body).appendChild(e)}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader()})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(w){var h,t,s;w=w.target;if(w&&(w=c.getParent(w,"tr"))){h=z.items[w.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(w&&c.hasClass(w,m+"ItemSub")){t=c.getRect(w);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(f){var d,e=b.EditorManager.settings;if(e&&e.language){d=this.urls[f]+"/langs/"+e.language+".js";if(!b.dom.Event.domLoaded&&!e.strict_mode){b.ScriptLoader.load(d)}else{b.ScriptLoader.add(d)}}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(f){var g=f.each,h=f.extend,e=f.DOM,a=f.dom.Event,c=f.ThemeManager,b=f.PluginManager,d=f.explode;f.create("static tinymce.EditorManager",{editors:{},i18n:{},activeEditor:null,preInit:function(){var i=this,j=window.location;f.documentBaseURL=j.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(f.documentBaseURL)){f.documentBaseURL+="/"}f.baseURL=new f.util.URI(f.documentBaseURL).toAbsolute(f.baseURL);f.EditorManager.baseURI=new f.util.URI(f.baseURL);if(document.domain&&j.hostname!=document.domain){f.relaxedDomain=document.domain}i.onBeforeUnload=new f.util.Dispatcher(i);a.add(window,"beforeunload",function(k){i.onBeforeUnload.dispatch(i,k)})},init:function(q){var p=this,l,k=f.ScriptLoader,o,n,i=[],m;function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.replace(/\.\w+$/,"");r=r?f.resolve(r):0;t=f.resolve(t)}return t.apply(r||this,Array.prototype.slice.call(arguments,2))}q=h({theme:"simple",language:"en",strict_loading_mode:document.contentType=="application/xhtml+xml"},q);p.settings=q;if(!a.domLoaded&&!q.strict_loading_mode){if(q.language){k.add(f.baseURL+"/langs/"+q.language+".js")}if(q.theme&&q.theme.charAt(0)!="-"&&!c.urls[q.theme]){c.load(q.theme,"themes/"+q.theme+"/editor_template"+f.suffix+".js")}if(q.plugins){l=d(q.plugins);if(f.inArray(l,"compat2x")!=-1){b.load("compat2x","plugins/compat2x/editor_plugin"+f.suffix+".js")}g(l,function(r){if(r&&r.charAt(0)!="-"&&!b.urls[r]){if(!f.isWebKit&&r=="safari"){return}b.load(r,"plugins/"+r+"/editor_plugin"+f.suffix+".js")}})}k.loadQueue()}a.add(document,"init",function(){var r,t;j(q,"onpageload");if(q.browsers){r=false;g(d(q.browsers),function(u){switch(u){case"ie":case"msie":if(f.isIE){r=true}break;case"gecko":if(f.isGecko){r=true}break;case"safari":case"webkit":if(f.isWebKit){r=true}break;case"opera":if(f.isOpera){r=true}break}});if(!r){return}}switch(q.mode){case"exact":r=q.elements||"";if(r.length>0){g(d(r),function(u){if(e.get(u)){m=new f.Editor(u,q);i.push(m);m.render(1)}else{o=0;g(document.forms,function(v){g(v.elements,function(w){if(w.name===u){u="mce_editor_"+o;e.setAttrib(w,"id",u);m=new f.Editor(u,q);i.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasClass(v,u)}g(e.select("textarea"),function(u){if(q.editor_deselector&&s(u,q.editor_deselector)){return}if(!q.editor_selector||s(u,q.editor_selector)){n=e.get(u.name);if(!u.id&&!n){u.id=u.name}if(!u.id||p.get(u.id)){u.id=e.uniqueId()}m=new f.Editor(u.id,q);i.push(m);m.render(1)}});break}if(q.oninit){r=t=0;g(i,function(u){t++;if(!u.initialized){u.onInit.add(function(){r++;if(r==t){j(q,"oninit")}})}else{r++}if(r==t){j(q,"oninit")}})}})},get:function(i){return this.editors[i]},getInstanceById:function(i){return this.get(i)},add:function(i){this.editors[i.id]=i;this._setActive(i);return i},remove:function(j){var i=this;if(!i.editors[j.id]){return null}delete i.editors[j.id];if(i.activeEditor==j){g(i.editors,function(k){i._setActive(k);return false})}j.destroy();return j},execCommand:function(o,m,l){var n=this,k=n.get(l),i;switch(o){case"mceFocus":k.focus();return true;case"mceAddEditor":case"mceAddControl":if(!n.get(l)){new f.Editor(l,n.settings).render()}return true;case"mceAddFrameControl":i=l.window;i.tinyMCE=tinyMCE;i.tinymce=f;f.DOM.doc=i.document;f.DOM.win=i;k=new f.Editor(l.element_id,l);k.render();if(f.isIE){function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinymce=null}i.attachEvent("onunload",j)}l.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(k){k.remove()}return true;case"mceToggleEditor":if(!k){n.execCommand("mceAddControl",0,l);return true}if(k.isHidden()){k.show()}else{k.hide()}return true}if(n.activeEditor){return n.activeEditor.execCommand(o,m,l)}return false},execInstanceCommand:function(m,l,k,j){var i=this.get(m);if(i){return i.execCommand(l,k,j)}return false},triggerSave:function(){g(this.editors,function(i){i.save()})},addI18n:function(k,l){var i,j=this.i18n;if(!f.is(k,"string")){g(k,function(n,m){g(n,function(q,p){g(q,function(s,r){if(p==="common"){j[m+"."+r]=s}else{j[m+"."+p+"."+r]=s}})})})}else{g(l,function(n,m){j[k+"."+m]=n})}},_setActive:function(i){this.selectedInstance=this.activeEditor=i}});f.EditorManager.preInit()})(tinymce);var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher;var j=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit;var d=n.is,h=n.ThemeManager,c=n.PluginManager,i=n.EditorManager;var p=n.inArray,m=n.grep,g=n.explode;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.plugins={};j(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:"mceItemTable",visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,removeformat_selector:"span,b,strong,em,i,font,u,strike"},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=i.baseURI;q.execCallback("setup",q)},render:function(u){var v=this,w=v.settings,x=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}if(!u){w.strict_loading_mode=1;tinyMCE.settings=w}if(!v.getElement()){return}if(w.strict_loading_mode){q.settings.strict_mode=w.strict_loading_mode;n.DOM.settings.strict=1}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&w.hidden_input&&o.getParent(x,"form")){o.insertAfter(o.create("input",{type:"hidden",name:x}),x)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(w.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(w.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(w.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(w.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){i.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}if(w.theme&&w.theme.charAt(0)!="-"&&!h.urls[w.theme]){h.load(w.theme,"themes/"+w.theme+"/editor_template"+n.suffix+".js")}j(g(w.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(!e&&s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+n.suffix+".js")}});q.loadQueue(function(){if(!v.removed){v.init()}})}if(w.plugins.indexOf("compat2x")!=-1){c.load("compat2x","plugins/compat2x/editor_plugin"+n.suffix+".js");q.loadQueue(r)}else{r()}},init:function(){var v,F=this,G=F.settings,C,z,B=F.getElement(),r,q,D,y,A,E;i.add(F);if(G.theme){G.theme=G.theme.replace(/-/,"");r=h.get(G.theme);F.theme=new r();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||n.documentBaseURL.replace(/\/$/,""))}}j(g(G.plugins.replace(/\-/g,"")),function(w){var H=c.get(w),t=c.urls[w]||n.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(F,t);F.plugins[w]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new n.ControlManager(F);F.undoManager=new n.UndoManager(F);F.undoManager.onAdd.add(function(t,s){if(!s.initial){return F.onChange.dispatch(F,s,t)}});F.undoManager.onUndo.add(function(t,s){return F.onUndo.dispatch(F,s,t)});F.undoManager.onRedo.add(function(t,s){return F.onRedo.dispatch(F,s,t)});if(G.custom_undo_redo){F.onExecCommand.add(function(t,w,u,H,s){if(w!="Undo"&&w!="Redo"&&w!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(x);F.onRedo.add(x);F.onSetContent.add(x)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(r.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(r.deltaHeight||0),100)}r=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=r.editorContainer}o.setStyles(r.sizeContainer||r.editorContainer,{width:C,height:z});z=(r.iframeHeight||z)+(typeof(z)=="number"?(r.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+F.documentBaseURI.getURI()+'" />';F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(n.relaxedDomain){F.iframeHTML+='<script type="text/javascript">document.domain = "'+n.relaxedDomain+'";<\/script>'}y=G.body_id||"tinymce";if(y.indexOf("=")!=-1){y=F.getParam("body_id","","hash");y=y[F.id]||y}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+A+'"></body></html>';if(n.relaxedDomain){if(b||(n.isOpera&&parseFloat(opera.version())>=9.5)){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(n.isOpera){D='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}v=o.add(r.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",style:{width:"100%",height:z}});F.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=F.orgDisplay;o.get(F.id).style.display="none";if(!b||!n.relaxedDomain){F.setupIframe()}B=v=r=null},setupIframe:function(){var z=this,A=z.settings,u=o.get(z.id),v=z.getDoc(),r,x;if(!b||!n.relaxedDomain){v.open();v.write(z.iframeHTML);v.close()}if(!b){try{if(!A.readonly){v.designMode="On"}}catch(w){}}if(b){x=z.getBody();o.hide(x);if(!A.readonly){x.contentEditable=true}o.show(x)}z.dom=new n.DOM.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1});z.serializer=new n.dom.Serializer({entity_encoding:A.entity_encoding,entities:A.entities,valid_elements:A.verify_html===false?"*[*]":A.valid_elements,extended_valid_elements:A.extended_valid_elements,valid_child_elements:A.valid_child_elements,invalid_elements:A.invalid_elements,fix_table_elements:A.fix_table_elements,fix_list_elements:A.fix_list_elements,fix_content_duplication:A.fix_content_duplication,convert_fonts_to_spans:A.convert_fonts_to_spans,font_size_classes:A.font_size_classes,font_size_style_values:A.font_size_style_values,apply_source_formatting:A.apply_source_formatting,remove_linebreaks:A.remove_linebreaks,element_format:A.element_format,dom:z.dom});z.selection=new n.dom.Selection(z.dom,z.getWin(),z.serializer);z.forceBlocks=new n.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new n.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.auto_resize){z.onNodeChange.add(z.resizeToContent,z)}if(A.custom_elements){function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";j(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.convert_fonts_to_spans){z._convertFonts()}if(A.inline_styles){z._convertInlineElements()}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){k.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){q(s)}});z.onSetContent.add(z.selection.onSetContent.add(q));if(!A.readonly){try{v.designMode="Off";v.designMode="On"}catch(w){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.undoManager.add({initial:true});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){n.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=i.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);u=null},focus:function(r){var u,q=this,s=q.settings.content_editable;if(!r){if(!s&&(!b||q.selection.getNode().ownerDocument!=q.getDoc())){q.getWin().focus()}}if(i.activeEditor!=q){if((u=i.activeEditor)!=null){u.onDeactivate.dispatch(u,q)}q.onActivate.dispatch(q,u)}i._setActive(q)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=i.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return i.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(w,s,q){var t=n.trim,r=d(this.settings[w])?this.settings[w]:s,u;if(q==="hash"){u={};if(d(r,"string")){j(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(x){x=x.split("=");if(x.length>1){u[t(x[0])]=t(x[1])}else{u[t(x[0])]=t(x)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getNode()||q.getBody();if(q.initialized){q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,b&&v.ownerDocument!=q.getDoc()?q.getBody():v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(t,r,q){this.execCommands[t]={func:r,scope:q||this}},addQueryStateHandler:function(t,r,q){this.queryStateCommands[t]={func:r,scope:q||this}},addQueryValueHandler:function(t,r,q){this.queryValueCommands[t]={func:r,scope:q||this}},addShortcut:function(s,v,q,u){var r=this,w;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){w=q;q=function(){r.execCommand(w,false,null)}}if(d(q,"object")){w=q;q=function(){r.execCommand(w[0],w[1],w[2])}}j(g(s),function(t){var x={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};j(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});r.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,w,z,q){var u=this,v=0,y,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!q||!q.skip_focus)){u.focus()}y={};u.onBeforeExecCommand.dispatch(u,x,w,z,y);if(y.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(y=u.execCommands[x]){r=y.func.call(y.scope,w,z);if(r!==true){u.onExecCommand.dispatch(u,x,w,z,q);return r}}j(u.plugins,function(s){if(s.execCommand&&s.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(n.GlobalCommands.execCommand(u,x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(u.editorCommands.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}u.getDoc().execCommand(x,w,z);u.onExecCommand.dispatch(u,x,w,z,q)},queryCommandState:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryStateCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandState(w);if(v!==-1){return v}try{return this.getDoc().queryCommandState(w)}catch(q){}},queryCommandValue:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(w);if(d(v)){return v}try{return this.getDoc().queryCommandValue(w)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},resizeToContent:function(){var q=this;o.setStyle(q.id+"_ifr","height",q.getBody().scrollHeight)},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=0;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){j(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(r,s){var q=this;s=s||{};s.format=s.format||"html";s.set=true;s.content=r;if(!s.no_events){q.onBeforeSetContent.dispatch(q,s)}if(!n.isIE&&(r.length===0||/^\s+$/.test(r))){s.content=q.dom.setHTML(q.getBody(),'<br mce_bogus="1" />');s.format="raw"}s.content=q.dom.setHTML(q.getBody(),n.trim(s.content));if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;s.content=q.dom.setHTML(q.getBody(),q.serializer.serialize(q.getBody(),s))}if(!s.no_events){q.onSetContent.dispatch(q,s)}return s.content},getContent:function(s){var q=this,r;s=s||{};s.format=s.format||"html";s.get=true;if(!s.no_events){q.onBeforeGetContent.dispatch(q,s)}if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;r=q.serializer.serialize(q.getBody(),s)}else{r=q.getBody().innerHTML}r=r.replace(/^\s*|\s*$/g,"");s.content=r;if(!s.no_events){q.onGetContent.dispatch(q,s)}return s.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,x,w){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,w,true,x)}if(!v.convert_urls||(w&&w.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}j(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];i.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var w=this,v,y=w.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(w,t,A)!==false){w[x[t.fakeType||t.type]].dispatch(w,t,A)}}j(x,function(t,s){switch(s){case"contextmenu":if(n.isOpera){w.dom.bind(w.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";u(A)}})}else{w.dom.bind(w.getBody(),s,u)}break;case"paste":w.dom.bind(w.getBody(),s,function(A){u(A)});break;case"submit":case"reset":w.dom.bind(w.getElement().form||o.getParent(w.id,"form"),s,u);break;default:w.dom.bind(y.content_editable?w.getBody():w.getDoc(),s,u)}});w.dom.bind(y.content_editable?w.getBody():(a?w.getDoc():w.getWin()),"focus",function(s){w.focus(true)});if(n.isGecko){w.dom.bind(w.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("mce_src"))){t.src=w.documentBaseURI.toAbsolute(s)}})}if(a){function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}w.onBeforeExecCommand.add(q);w.onMouseDown.add(q)}w.onMouseUp.add(w.nodeChanged);w.onClick.add(w.nodeChanged);w.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(n.isMac&&(A==91||A==93))||t.ctrlKey){w.nodeChanged()}});w.onReset.add(function(){w.setContent(w.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){w.addShortcut("ctrl+z",w.getLang("undo_desc"),"Undo");w.addShortcut("ctrl+y",w.getLang("redo_desc"),"Redo")}if(a){w.addShortcut("ctrl+b",w.getLang("bold_desc"),"Bold");w.addShortcut("ctrl+i",w.getLang("italic_desc"),"Italic");w.addShortcut("ctrl+u",w.getLang("underline_desc"),"Underline")}for(v=1;v<=6;v++){w.addShortcut("ctrl+"+v,"",["FormatBlock",false,"<h"+v+">"])}w.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);w.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);w.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}j(w.shortcuts,function(A){if(n.isMac&&A.ctrl!=t.metaKey){return}else{if(!n.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}w.onKeyUp.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyPress.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return k.cancel(t)}})}if(n.isIE){w.dom.bind(w.getDoc(),"controlselect",function(A){var t=w.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){w.dom.unbind(t.node,t.ev,t.cb)}if(!w.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=w.dom.bind(A,ev,function(C){var B;C=C.target;if(B=w.dom.getStyle(C,"width")){w.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"width","")}if(B=w.dom.getStyle(C,"height")){w.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=w.dom.bind(A,"resizestart",k.cancel,k)}t=w.resizeInfo={node:A,ev:ev,cb:s}});w.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(w.selection.getRng().item){w.selection.getRng().item(0).removeNode();return k.cancel(t)}}})}if(n.isOpera){w.onClick.add(function(s,t){k.prevent(t)})}if(y.custom_undo_redo){function r(){w.undoManager.typing=0;w.undoManager.add()}if(n.isIE){w.dom.bind(w.getWin(),"blur",function(s){var t;if(w.selection){t=w.selection.getNode();if(!w.removed&&t.ownerDocument&&t.ownerDocument!=w.getDoc()){r()}}})}else{w.dom.bind(w.getDoc(),"blur",function(){if(w.selection&&!w.removed){r()}})}w.onMouseDown.add(r);w.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){w.undoManager.typing=0;w.undoManager.add()}});w.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(w.undoManager.typing){w.undoManager.add();w.undoManager.typing=0}return}if(!w.undoManager.typing){w.undoManager.add();w.undoManager.typing=1}})}},_convertInlineElements:function(){var z=this,B=z.settings,r=z.dom,y,w,u,A,q;function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("table,u,strike",t.node),function(v){switch(v.nodeName){case"TABLE":if(y=r.getAttrib(v,"height")){r.setStyle(v,"height",y);r.setAttrib(v,"height","")}break;case"U":case"STRIKE":v.style.textDecoration=v.nodeName=="U"?"underline":"line-through";r.setAttrib(v,"mce_style","");r.setAttrib(v,"mce_name","span");break}})}else{if(t.set){j(z.dom.select("table,span",t.node).reverse(),function(v){if(v.nodeName=="TABLE"){if(y=r.getStyle(v,"height")){r.setAttrib(v,"height",y.replace(/[^0-9%]+/g,""))}}else{if(v.style.textDecoration=="underline"){u="u"}else{if(v.style.textDecoration=="line-through"){u="strike"}else{u=""}}if(u){v.style.textDecoration="";r.setAttrib(v,"mce_style","");w=r.create(u,{style:r.getAttrib(v,"style")});r.replace(w,v,1)}}})}}}z.onPreProcess.add(x);if(!B.cleanup_on_startup){z.onSetContent.add(function(s,t){if(t.initial){x(z,{node:z.getBody(),set:1})}})}},_convertFonts:function(){var w=this,x=w.settings,z=w.dom,v,r,q,u;if(!x.inline_styles){return}v=[8,10,12,14,18,24,36];r=["xx-small","x-small","small","medium","large","x-large","xx-large"];if(q=x.font_size_style_values){q=g(q)}if(u=x.font_size_classes){u=g(u)}function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("font",B);for(s=t.length-1;s>=0;s--){C=t[s];A=z.create("span",{style:z.getAttrib(C,"style"),"class":z.getAttrib(C,"class")});z.setStyles(A,{fontFamily:z.getAttrib(C,"face"),color:z.getAttrib(C,"color"),backgroundColor:C.style.backgroundColor});if(C.size){if(q){z.setStyle(A,"fontSize",q[parseInt(C.size)-1])}else{z.setAttrib(A,"class",u[parseInt(C.size)-1])}}z.setAttrib(A,"mce_style","");z.replace(A,C,1)}}w.onPreProcess.add(function(s,t){if(t.get){y(t.node)}});w.onSetContent.add(function(s,t){if(t.initial){y(t.node)}})},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)},_fixNesting:function(r){var t=[],q;r=r.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(u,s,w){var v;if(s==="/"){if(!t.length){return""}if(w!==t[t.length-1].tag){for(q=t.length-1;q>=0;q--){if(t[q].tag===w){t[q].close=1;break}}return""}else{t.pop();if(t.length&&t[t.length-1].close){u=u+"</"+t[t.length-1].tag+">";t.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(w)){return u}if(/\/>$/.test(u)){return u}t.push({tag:w})}return u});for(q=t.length-1;q>=0;q--){r+="</"+t[q].tag+">"}return r}})})(tinymce);(function(d){var f=d.each,c=d.isIE,a=d.isGecko,b=d.isOpera,e=d.isWebKit;d.create("tinymce.EditorCommands",{EditorCommands:function(g){this.editor=g},execCommand:function(k,j,l){var h=this,g=h.editor,i;switch(k){case"mceResetDesignMode":case"mceBeginUndoLevel":return true;case"unlink":h.UnLink();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":h.mceJustify(k,k.substring(7).toLowerCase());return true;default:i=this[k];if(i){i.call(this,j,l);return true}}return false},Indent:function(){var g=this.editor,l=g.dom,j=g.selection,k,h,i;h=g.settings.indentation;i=/[a-z%]+$/i.exec(h);h=parseInt(h);if(g.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(j.getSelectedBlocks(),function(m){l.setStyle(m,"paddingLeft",(parseInt(m.style.paddingLeft||0)+h)+i)});return}g.getDoc().execCommand("Indent",false,null);if(c){l.getParent(j.getNode(),function(m){if(m.nodeName=="BLOCKQUOTE"){m.dir=m.style.cssText=""}})}},Outdent:function(){var h=this.editor,m=h.dom,k=h.selection,l,g,i,j;i=h.settings.indentation;j=/[a-z%]+$/i.exec(i);i=parseInt(i);if(h.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(k.getSelectedBlocks(),function(n){g=Math.max(0,parseInt(n.style.paddingLeft||0)-i);m.setStyle(n,"paddingLeft",g?g+j:"")});return}h.getDoc().execCommand("Outdent",false,null)},mceSetContent:function(h,g){this.editor.setContent(g)},mceToggleVisualAid:function(){var g=this.editor;g.hasVisual=!g.hasVisual;g.addVisual()},mceReplaceContent:function(h,g){var i=this.editor.selection;i.setContent(g.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(i,h){var g=this.editor,j=g.selection,k=g.dom.getParent(j.getNode(),"a");if(d.is(h,"string")){h={href:h}}function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}if(!k){g.execCommand("CreateLink",false,"javascript:mctmp(0);");f(g.dom.select("a[href=javascript:mctmp(0);]"),function(m){l(m)})}else{if(h.href){l(k)}else{g.dom.remove(k,1)}}},UnLink:function(){var g=this.editor,h=g.selection;if(h.isCollapsed()){h.select(h.getNode())}g.getDoc().execCommand("unlink",false,null);h.collapse(0)},FontName:function(i,h){var j=this,g=j.editor,k=g.selection,l;if(!h){if(k.isCollapsed()){k.select(k.getNode())}}else{if(g.settings.convert_fonts_to_spans){j._applyInlineStyle("span",{style:{fontFamily:h}})}else{g.getDoc().execCommand("FontName",false,h)}}},FontSize:function(j,i){var h=this.editor,l=h.settings,k,g;if(l.convert_fonts_to_spans&&i>=1&&i<=7){g=d.explode(l.font_size_style_values);k=d.explode(l.font_size_classes);if(k){i=k[i-1]||i}else{i=g[i-1]||i}}if(i>=1&&i<=7){h.getDoc().execCommand("FontSize",false,i)}else{this._applyInlineStyle("span",{style:{fontSize:i}})}},queryCommandValue:function(h){var g=this["queryValue"+h];if(g){return g.call(this,h)}return false},queryCommandState:function(h){var g;switch(h){case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":return this.queryStateJustify(h,h.substring(7).toLowerCase());default:if(g=this["queryState"+h]){return g.call(this,h)}}return -1},_queryState:function(h){try{return this.editor.getDoc().queryCommandState(h)}catch(g){}},_queryVal:function(h){try{return this.editor.getDoc().queryCommandValue(h)}catch(g){}},queryValueFontSize:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontSize}if(!g&&(b||e)){if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.size}return g}return g||this._queryVal("FontSize")},queryValueFontName:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.face}if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}if(!g){g=this._queryVal("FontName")}return g},mceJustify:function(o,p){var k=this.editor,m=k.selection,g=m.getNode(),q=g.nodeName,h,j,i=k.dom,l;if(k.settings.inline_styles&&this.queryStateJustify(o,p)){l=1}h=i.getParent(g,k.dom.isBlock);if(q=="IMG"){if(p=="full"){return}if(l){if(p=="center"){i.setStyle(h||g.parentNode,"textAlign","")}i.setStyle(g,"float","");this.mceRepaint();return}if(p=="center"){if(h&&/^(TD|TH)$/.test(h.nodeName)){h=0}if(!h||h.childNodes.length>1){j=i.create("p");j.appendChild(g.cloneNode(false));if(h){i.insertAfter(j,h)}else{i.insertAfter(j,g)}i.remove(g);g=j.firstChild;h=j}i.setStyle(h,"textAlign",p);i.setStyle(g,"float","")}else{i.setStyle(g,"float",p);i.setStyle(h||g.parentNode,"textAlign","")}this.mceRepaint();return}if(k.settings.inline_styles&&k.settings.forced_root_block){if(l){p=""}f(m.getSelectedBlocks(i.getParent(m.getStart(),i.isBlock),i.getParent(m.getEnd(),i.isBlock)),function(n){i.setAttrib(n,"align","");i.setStyle(n,"textAlign",p=="full"?"justify":p)});return}else{if(!l){k.getDoc().execCommand(o,false,null)}}if(k.settings.inline_styles){if(l){i.getParent(k.selection.getNode(),function(r){if(r.style&&r.style.textAlign){i.setStyle(r,"textAlign","")}});return}f(i.select("*"),function(s){var r=s.align;if(r){if(r=="full"){r="justify"}i.setStyle(s,"textAlign",r);i.setAttrib(s,"align","")}})}},mceSetCSSClass:function(h,g){this.mceSetStyleInfo(0,{command:"setattrib",name:"class",value:g})},getSelectedElement:function(){var w=this,o=w.editor,n=o.dom,s=o.selection,h=s.getRng(),l,k,u,p,j,g,q,i,x,v;if(s.isCollapsed()||h.item){return s.getNode()}v=o.settings.merge_styles_invalid_parents;if(d.is(v,"string")){v=new RegExp(v,"i")}if(c){l=h.duplicate();l.collapse(true);u=l.parentElement();k=h.duplicate();k.collapse(false);p=k.parentElement();if(u!=p){l.move("character",1);u=l.parentElement()}if(u==p){l=h.duplicate();l.moveToElementText(u);if(l.compareEndPoints("StartToStart",h)==0&&l.compareEndPoints("EndToEnd",h)==0){return v&&v.test(u.nodeName)?null:u}}}else{function m(r){return n.getParent(r,"*")}u=h.startContainer;p=h.endContainer;j=h.startOffset;g=h.endOffset;if(!h.collapsed){if(u==p){if(j-g<2){if(u.hasChildNodes()){i=u.childNodes[j];return v&&v.test(i.nodeName)?null:i}}}}if(u.nodeType!=3||p.nodeType!=3){return null}if(j==0){i=m(u);if(i&&i.firstChild!=u){i=null}}if(j==u.nodeValue.length){q=u.nextSibling;if(q&&q.nodeType==1){i=u.nextSibling}}if(g==0){q=p.previousSibling;if(q&&q.nodeType==1){x=q}}if(g==p.nodeValue.length){x=m(p);if(x&&x.lastChild!=p){x=null}}if(i==x){return v&&i&&v.test(i.nodeName)?null:i}}return null},mceSetStyleInfo:function(n,m){var q=this,h=q.editor,j=h.getDoc(),g=h.dom,i,k,r=h.selection,p=m.wrapper||"span",k=r.getBookmark(),o;function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":return g.setAttrib(t,m.name,m.value);case"setstyle":return g.setStyle(t,m.name,m.value);case"removeformat":return g.setAttrib(t,"class","")}}}o=h.settings.merge_styles_invalid_parents;if(d.is(o,"string")){o=new RegExp(o,"i")}if((i=q.getSelectedElement())&&!h.settings.force_span_wrappers){l(i,1)}else{j.execCommand("FontName",false,"__");f(g.select("span,font"),function(u){var s,t;if(g.getAttrib(u,"face")=="__"||u.style.fontFamily==="__"){s=g.create(p,{mce_new:"1"});l(s);f(u.childNodes,function(v){s.appendChild(v.cloneNode(true))});g.replace(s,u)}})}f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!g.getAttrib(t,"mce_new")){s=g.getParent(t,"*[mce_new]");if(s){g.remove(t,1)}}});f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!s||!g.getAttrib(t,"mce_new")){return}if(h.settings.force_span_wrappers&&s.nodeName!="SPAN"){return}if(s.nodeName==p.toUpperCase()&&s.childNodes.length==1){return g.remove(s,1)}if(t.nodeType==1&&(!o||!o.test(s.nodeName))&&s.childNodes.length==1){l(s);g.setAttrib(t,"class","")}});f(g.select(p).reverse(),function(s){if(g.getAttrib(s,"mce_new")||(g.getAttribs(s).length<=1&&s.className==="")){if(!g.getAttrib(s,"class")&&!g.getAttrib(s,"style")){return g.remove(s,1)}g.setAttrib(s,"mce_new","")}});r.moveToBookmark(k)},queryStateJustify:function(k,h){var g=this.editor,j=g.selection.getNode(),i=g.dom;if(j&&j.nodeName=="IMG"){if(i.getStyle(j,"float")==h){return 1}return j.parentNode.style.textAlign==h}j=i.getParent(g.selection.getStart(),function(l){return l.nodeType==1&&l.style.textAlign});if(h=="full"){h="justify"}if(g.settings.inline_styles){return(j&&j.style.textAlign==h)}return this._queryState(k)},ForeColor:function(i,h){var g=this.editor;if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{color:h}});return}else{g.getDoc().execCommand("ForeColor",false,h)}},HiliteColor:function(i,k){var h=this,g=h.editor,j=g.getDoc();if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{backgroundColor:k}});return}function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(m){j.execCommand("useCSS",0,!n)}}if(a||b){l(true);j.execCommand("hilitecolor",false,k);l(false)}else{j.execCommand("BackColor",false,k)}},FormatBlock:function(n,h){var o=this,l=o.editor,p=l.selection,j=l.dom,g,k,m;function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nodeName)}g=j.getParent(p.getNode(),function(q){return i(q)});if(g){if((c&&i(g.parentNode))||g.nodeName=="DIV"){k=l.dom.create(h);f(j.getAttribs(g),function(q){j.setAttrib(k,q.nodeName,j.getAttrib(g,q.nodeName))});m=p.getBookmark();j.replace(k,g,1);p.moveToBookmark(m);l.nodeChanged();return}}h=l.settings.forced_root_block?(h||"<p>"):h;if(h.indexOf("<")==-1){h="<"+h+">"}if(d.isGecko){h=h.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,"$1")}l.getDoc().execCommand("FormatBlock",false,h)},mceCleanup:function(){var h=this.editor,i=h.selection,g=i.getBookmark();h.setContent(h.getContent());i.moveToBookmark(g)},mceRemoveNode:function(j,k){var h=this.editor,i=h.selection,g,l=k||i.getNode();if(l==h.getBody()){return}g=i.getBookmark();h.dom.remove(l,1);i.moveToBookmark(g);h.nodeChanged()},mceSelectNodeDepth:function(i,j){var g=this.editor,h=g.selection,k=0;g.dom.getParent(h.getNode(),function(l){if(l.nodeType==1&&k++==j){h.select(l);g.nodeChanged();return false}},g.getBody())},mceSelectNode:function(h,g){this.editor.selection.select(g)},mceInsertContent:function(g,h){this.editor.selection.setContent(h)},mceInsertRawHTML:function(h,i){var g=this.editor;g.selection.setContent("tiny_mce_marker");g.setContent(g.getContent().replace(/tiny_mce_marker/g,i))},mceRepaint:function(){var i,g,j=this.editor;if(d.isGecko){try{i=j.selection;g=i.getBookmark(true);if(i.getSel()){i.getSel().selectAllChildren(j.getBody())}i.collapse(true);i.moveToBookmark(g)}catch(h){}}},queryStateUnderline:function(){var g=this.editor,h=g.selection.getNode();if(h&&h.nodeName=="A"){return false}return this._queryState("Underline")},queryStateOutdent:function(){var g=this.editor,h;if(g.settings.inline_styles){if((h=g.dom.getParent(g.selection.getStart(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}if((h=g.dom.getParent(g.selection.getEnd(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!g.settings.inline_styles&&!!g.dom.getParent(g.selection.getNode(),"BLOCKQUOTE"))},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"UL")},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"OL")},queryStatemceBlockQuote:function(){return !!this.editor.dom.getParent(this.editor.selection.getStart(),function(g){return g.nodeName==="BLOCKQUOTE"})},_applyInlineStyle:function(o,j,m){var q=this,n=q.editor,l=n.dom,i,p={},k,r;o=o.toUpperCase();if(m&&m.check_classes&&j["class"]){m.check_classes.push(j["class"])}function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(t),function(u){if(u.nodeName.substring(0,1)!="_"&&l.getAttrib(t,u.nodeName)!=""){s++}});if(s==0){l.remove(t,1)}})}function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFamily=="mceinline"||t.face=="mceinline"){if(!s){s=n.selection.getBookmark()}j._mce_new="1";l.replace(l.create(o,j),t,1)}});f(l.select(o+"[_mce_new]"),function(u){function t(v){if(v.nodeType==1){f(j.style,function(x,w){l.setStyle(v,w,"")});if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(v,w)}})}}}f(l.select(o,u),t);if(u.parentNode&&u.parentNode.nodeType==1&&u.parentNode.childNodes.length==1){t(u.parentNode)}l.getParent(u.parentNode,function(v){if(v.nodeType==1){if(j.style){f(j.style,function(y,x){var w;if(!p[x]&&(w=l.getStyle(v,x))){if(w===y){l.setStyle(u,x,"")}p[x]=1}})}if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(u,w)}})}}return false});u.removeAttribute("_mce_new")});h();n.selection.moveToBookmark(s);return !!s}n.focus();n.getDoc().execCommand("FontName",false,"mceinline");g();if(k=q._applyInlineStyle.keyhandler){n.onKeyUp.remove(k);n.onKeyPress.remove(k);n.onKeyDown.remove(k);n.onSetContent.remove(q._applyInlineStyle.chandler)}if(n.selection.isCollapsed()){if(!c){f(l.getParents(n.selection.getNode(),"span"),function(s){f(j.style,function(u,t){var w;if(w=l.getStyle(s,t)){if(w==u){l.setStyle(s,t,"");r=2;return false}r=1;return false}});if(r){return false}});if(r==2){i=n.selection.getBookmark();h();n.selection.moveToBookmark(i);window.setTimeout(function(){n.nodeChanged()},1);return}}q._pendingStyles=d.extend(q._pendingStyles||{},j.style);q._applyInlineStyle.chandler=n.onSetContent.add(function(){delete q._pendingStyles});q._applyInlineStyle.keyhandler=k=function(s){if(q._pendingStyles){j.style=q._pendingStyles;delete q._pendingStyles}if(g()){n.onKeyDown.remove(q._applyInlineStyle.keyhandler);n.onKeyPress.remove(q._applyInlineStyle.keyhandler)}if(s.type=="keyup"){n.onKeyUp.remove(q._applyInlineStyle.keyhandler)}};n.onKeyDown.add(k);n.onKeyPress.add(k);n.onKeyUp.add(k)}else{q._pendingStyles=0}}})})(tinymce);(function(a){a.create("tinymce.UndoManager",{index:0,data:null,typing:0,UndoManager:function(c){var d=this,b=a.util.Dispatcher;d.editor=c;d.data=[];d.onAdd=new b(this);d.onUndo=new b(this);d.onRedo=new b(this)},add:function(d){var g=this,f,e=g.editor,c,h=e.settings,j;d=d||{};d.content=d.content||e.getContent({format:"raw",no_events:1});d.content=d.content.replace(/^\s*|\s*$/g,"");j=g.data[g.index>0&&(g.index==0||g.index==g.data.length)?g.index-1:g.index];if(!d.initial&&j&&d.content==j.content){return null}if(h.custom_undo_redo_levels){if(g.data.length>h.custom_undo_redo_levels){for(f=0;f<g.data.length-1;f++){g.data[f]=g.data[f+1]}g.data.length--;g.index=g.data.length}}if(h.custom_undo_redo_restore_selection&&!d.initial){d.bookmark=c=d.bookmark||e.selection.getBookmark()}if(g.index<g.data.length){g.index++}if(g.data.length===0&&!d.initial){return null}g.data.length=g.index+1;g.data[g.index++]=d;if(d.initial){g.index=0}if(g.data.length==2&&g.data[0].initial){g.data[0].bookmark=c}g.onAdd.dispatch(g,d);e.isNotDirty=0;return d},undo:function(){var e=this,c=e.editor,b=b,d;if(e.typing){e.add();e.typing=0}if(e.index>0){if(e.index==e.data.length&&e.index>1){d=e.index;e.typing=0;if(!e.add()){e.index=d}--e.index}b=e.data[--e.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);e.onUndo.dispatch(e,b)}return b},redo:function(){var d=this,c=d.editor,b=null;if(d.index<d.data.length-1){b=d.data[++d.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);d.onRedo.dispatch(d,b)}return b},clear:function(){var b=this;b.data=[];b.index=0;b.typing=0;b.add({initial:true})},hasUndo:function(){return this.index!=0||this.typing},hasRedo:function(){return this.index<this.data.length-1}})})(tinymce);(function(e){var b,d,a,c,f,h;b=e.dom.Event;d=e.isIE;a=e.isGecko;c=e.isOpera;f=e.each;h=e.extend;function g(i){i=i.innerHTML;i=i.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");i=i.replace(/<[^>]+>/g,"");return i.replace(/[ \t\r\n]+/g,"")==""}e.create("tinymce.ForceBlocks",{ForceBlocks:function(j){var k=this,l=j.settings,m;k.editor=j;k.dom=j.dom;m=(l.forced_root_block||"p").toLowerCase();l.element=m.toUpperCase();j.onPreInit.add(k.setup,k);k.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+m+">","gi");k.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,m),"gi");k.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,m),"gi");function i(n,p){if(c){p.content=p.content.replace(k.reOpera,"</"+m+">")}p.content=p.content.replace(k.rePadd,"<"+m+"$1$2$3$4$5$6>\u00a0</"+m+">");if(!d&&!c&&p.set){p.content=p.content.replace(k.reNbsp2BR1,"<"+m+"$1$2><br /></"+m+">");p.content=p.content.replace(k.reNbsp2BR2,"<"+m+"$1$2><br /></"+m+">")}else{p.content=p.content.replace(k.reBR2Nbsp,"<"+m+"$1$2>\u00a0</"+m+">")}}j.onBeforeSetContent.add(i);j.onPostProcess.add(i);if(l.forced_root_block){j.onInit.add(k.forceRoots,k);j.onSetContent.add(k.forceRoots,k);j.onBeforeGetContent.add(k.forceRoots,k)}},setup:function(){var j=this,i=j.editor,k=i.settings;if(k.forced_root_block){i.onKeyUp.add(j.forceRoots,j);i.onPreProcess.add(j.forceRoots,j)}if(k.force_br_newlines){if(d){i.onKeyPress.add(function(m,p){var q,o=m.selection;if(p.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('<br id="__" /> ',{format:"raw"});q=m.dom.get("__");q.removeAttribute("id");o.select(q);o.collapse();return b.cancel(p)}})}return}if(!d&&k.force_p_newlines){i.onKeyPress.add(function(m,n){if(n.keyCode==13&&!n.shiftKey){if(!j.insertPara(n)){b.cancel(n)}}});if(a){i.onKeyDown.add(function(m,n){if((n.keyCode==8||n.keyCode==46)&&!n.shiftKey){j.backspaceDelete(n,n.keyCode==8)}})}}function l(n,m){var o=i.dom.create(m);f(n.attributes,function(p){if(p.specified&&p.nodeValue){o.setAttribute(p.nodeName.toLowerCase(),p.nodeValue)}});f(n.childNodes,function(p){o.appendChild(p.cloneNode(true))});n.parentNode.replaceChild(o,n);return o}i.onPreProcess.add(function(m,n){f(m.dom.select("p,h1,h2,h3,h4,h5,h6,div",n.node),function(o){if(g(o)){f(m.dom.select("span,em,strong,b,i",n.node),function(p){if(!p.hasChildNodes()){p.appendChild(m.getDoc().createTextNode("\u00a0"));return false}})}})});if(d){if(k.element!="P"){i.onKeyPress.add(function(m,n){j.lastElm=m.selection.getNode().nodeName});i.onKeyUp.add(function(o,q){var s,p=o.selection,r=p.getNode(),m=o.getBody();if(m.childNodes.length===1&&r.nodeName=="P"){r=l(r,k.element);p.select(r);p.collapse();o.nodeChanged()}else{if(q.keyCode==13&&!q.shiftKey&&j.lastElm!="P"){s=o.dom.getParent(r,"p");if(s){l(s,k.element);o.nodeChanged()}}}})}}},find:function(o,k,l){var j=this.editor,i=j.getDoc().createTreeWalker(o,4,null,false),m=-1;while(o=i.nextNode()){m++;if(k==0&&o==l){return m}if(k==1&&m==l){return o}}return -1},forceRoots:function(p,D){var u=this,p=u.editor,H=p.getBody(),E=p.getDoc(),K=p.selection,v=K.getSel(),w=K.getRng(),I=-2,o,B,j,k,F=-16777215;var G,l,J,A,x,m=H.childNodes,z,y,q;for(z=m.length-1;z>=0;z--){G=m[z];if(G.nodeType==3||(!u.dom.isBlock(G)&&G.nodeType!=8)){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!d){if(w.startContainer.nodeType==1&&(y=w.startContainer.childNodes[w.startOffset])&&y.nodeType==1){q=y.getAttribute("id");y.setAttribute("id","__mce")}else{if(p.dom.getParent(w.startContainer,function(i){return i===H})){B=w.startOffset;j=w.endOffset;I=u.find(H,0,w.startContainer);o=u.find(H,0,w.endContainer)}}}else{k=E.body.createTextRange();k.moveToElementText(H);k.collapse(1);J=k.move("character",F)*-1;k=w.duplicate();k.collapse(1);A=k.move("character",F)*-1;k=w.duplicate();k.collapse(0);x=(k.move("character",F)*-1)-A;I=A-J;o=x}}l=p.dom.create(p.settings.forced_root_block);l.appendChild(G.cloneNode(1));G.parentNode.replaceChild(l,G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!d){l=H.getElementsByTagName(p.settings.element)[0];w=E.createRange();if(I!=-1){w.setStart(u.find(H,1,I),B)}else{w.setStart(l,0)}if(o!=-1){w.setEnd(u.find(H,1,o),j)}else{w.setEnd(l,0)}if(v){v.removeAllRanges();v.addRange(w)}}else{try{w=v.createRange();w.moveToElementText(H);w.collapse(1);w.moveStart("character",I);w.moveEnd("character",o);w.select()}catch(C){}}}else{if(!d&&(y=p.dom.get("__mce"))){if(q){y.setAttribute("id",q)}else{y.removeAttribute("id")}w=E.createRange();w.setStartBefore(y);w.setEndBefore(y);K.setRng(w)}}},getParentBlock:function(j){var i=this.dom;return i.getParent(j,i.isBlock)},insertPara:function(M){var A=this,o=A.editor,I=o.dom,N=o.getDoc(),R=o.settings,B=o.selection.getSel(),C=B.getRangeAt(0),Q=N.body;var F,G,D,K,J,l,j,m,q,i,x,P,k,p,E,H=I.getViewPort(o.getWin()),w,z,v;F=N.createRange();F.setStart(B.anchorNode,B.anchorOffset);F.collapse(true);G=N.createRange();G.setStart(B.focusNode,B.focusOffset);G.collapse(true);D=F.compareBoundaryPoints(F.START_TO_END,G)<0;K=D?B.anchorNode:B.focusNode;J=D?B.anchorOffset:B.focusOffset;l=D?B.focusNode:B.anchorNode;j=D?B.focusOffset:B.anchorOffset;if(K===l&&/^(TD|TH)$/.test(K.nodeName)){if(K.firstChild.nodeName=="BR"){I.remove(K.firstChild)}if(K.childNodes.length==0){o.dom.add(K,R.element,null,"<br />");P=o.dom.add(K,R.element,null,"<br />")}else{E=K.innerHTML;K.innerHTML="";o.dom.add(K,R.element,null,E);P=o.dom.add(K,R.element,null,"<br />")}C=N.createRange();C.selectNodeContents(P);C.collapse(1);o.selection.setRng(C);return false}if(K==Q&&l==Q&&Q.firstChild&&o.dom.isBlock(Q.firstChild)){K=l=K.firstChild;J=j=0;F=N.createRange();F.setStart(K,0);G=N.createRange();G.setStart(l,0)}K=K.nodeName=="HTML"?N.body:K;K=K.nodeName=="BODY"?K.firstChild:K;l=l.nodeName=="HTML"?N.body:l;l=l.nodeName=="BODY"?l.firstChild:l;m=A.getParentBlock(K);q=A.getParentBlock(l);i=m?m.nodeName:R.element;if(A.dom.getParent(m,"ol,ul,pre")){return true}if(m&&(m.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;m=null}if(q&&(q.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;q=null}if(/(TD|TABLE|TH|CAPTION)/.test(i)||(m&&i=="DIV"&&/left|right/gi.test(I.getStyle(m,"float",1)))){i=R.element;m=q=null}x=(m&&m.nodeName==i)?m.cloneNode(0):o.dom.create(i);P=(q&&q.nodeName==i)?q.cloneNode(0):o.dom.create(i);P.removeAttribute("id");if(/^(H[1-6])$/.test(i)&&K.nodeValue&&J==K.nodeValue.length){P=o.dom.create(R.element)}E=k=K;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}k=E}while((E=E.previousSibling?E.previousSibling:E.parentNode));E=p=l;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}p=E}while((E=E.nextSibling?E.nextSibling:E.parentNode));if(k.nodeName==i){F.setStart(k,0)}else{F.setStartBefore(k)}F.setEnd(K,J);x.appendChild(F.cloneContents()||N.createTextNode(""));try{G.setEndAfter(p)}catch(L){}G.setStart(l,j);P.appendChild(G.cloneContents()||N.createTextNode(""));C=N.createRange();if(!k.previousSibling&&k.parentNode.nodeName==i){C.setStartBefore(k.parentNode)}else{if(F.startContainer.nodeName==i&&F.startOffset==0){C.setStartBefore(F.startContainer)}else{C.setStart(F.startContainer,F.startOffset)}}if(!p.nextSibling&&p.parentNode.nodeName==i){C.setEndAfter(p.parentNode)}else{C.setEnd(G.endContainer,G.endOffset)}C.deleteContents();if(c){o.getWin().scrollTo(0,H.y)}if(x.firstChild&&x.firstChild.nodeName==i){x.innerHTML=x.firstChild.innerHTML}if(P.firstChild&&P.firstChild.nodeName==i){P.innerHTML=P.firstChild.innerHTML}if(g(x)){x.innerHTML="<br />"}function O(y,s){var r=[],T,S,t;y.innerHTML="";if(R.keep_styles){S=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(S.nodeName)){T=S.cloneNode(false);I.setAttrib(T,"id","");r.push(T)}}while(S=S.parentNode)}if(r.length>0){for(t=r.length-1,T=y;t>=0;t--){T=T.appendChild(r[t])}r[0].innerHTML=c?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=c?"&nbsp;":"<br />"}}if(g(P)){v=O(P,l)}if(c&&parseFloat(opera.version())<9.5){C.insertNode(x);C.insertNode(P)}else{C.insertNode(P);C.insertNode(x)}P.normalize();x.normalize();function u(r){return N.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}C=N.createRange();C.selectNodeContents(a?u(v||P):v||P);C.collapse(1);B.removeAllRanges();B.addRange(C);w=o.dom.getPos(P).y;z=P.clientHeight;if(w<H.y||w+z>H.y+H.h){o.getWin().scrollTo(0,w<H.y?w:w-H.h+25)}return false},backspaceDelete:function(l,u){var x=this,k=x.editor,p=k.getBody(),j,m=k.selection,i=m.getRng(),o=i.startContainer,j,q,s;if(o&&k.dom.isBlock(o)&&!/^(TD|TH)$/.test(o.nodeName)&&u){if(o.childNodes.length==0||(o.childNodes.length==1&&o.firstChild.nodeName=="BR")){j=o;while((j=j.previousSibling)&&!k.dom.isBlock(j)){}if(j){if(o!=p.firstChild){q=k.dom.doc.createTreeWalker(j,NodeFilter.SHOW_TEXT,null,false);while(s=q.nextNode()){j=s}i=k.getDoc().createRange();i.setStart(j,j.nodeValue?j.nodeValue.length:0);i.setEnd(j,j.nodeValue?j.nodeValue.length:0);m.setRng(i);k.dom.remove(o)}return b.cancel(l)}}}function v(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(j=x.getParentBlock(n))){r=n.previousSibling;b.remove(p,"DOMNodeInserted",v);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){k.dom.remove(n)}}}b._add(p,"DOMNodeInserted",v);window.setTimeout(function(){b._remove(p,"DOMNodeInserted",v)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){i.execCommand(p.cmd,p.ui||false,p.value)}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark("simple")});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.CommandManager=function(){var c={},b={},d={};function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i[j.toLowerCase()]={func:g,scope:f}})}a.extend(this,{add:function(h,g,f){e(c,h,g,f)},addQueryStateHandler:function(h,g,f){e(b,h,g,f)},addQueryValueHandler:function(h,g,f){e(d,h,g,f)},execCommand:function(g,j,i,h,f){if(j=c[j.toLowerCase()]){if(j.func.call(g||j.scope,i,h,f)!==false){return true}}},queryCommandValue:function(){if(cmd=d[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=b[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})};a.GlobalCommands=new a.CommandManager()})(tinymce);(function(b){function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o){return p}p=p.parentNode}while(p)}function c(o){m(o);b.walk(o,m,"childNodes")}j=i.findCommonAncestor(d,h);e=k(d,j)||d;l=k(h,j)||h;for(g=d;g&&g!=e;g=g.parentNode){for(f=g.nextSibling;f;f=f.nextSibling){c(f)}}if(e!=l){for(g=e.nextSibling;g&&g!=l;g=g.nextSibling){c(g)}}else{c(e)}for(g=h;g&&g!=l;g=g.parentNode){for(f=g.previousSibling;f;f=f.previousSibling){c(f)}}}b.GlobalCommands.add("RemoveFormat",function(){var m=this,l=m.dom,u=m.selection,d=u.getRng(1),e=[],h,f,j,q,g,o,c,i;function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("removeformat_selector"))){r=v}return l.isBlock(v)},m.getBody());return r}function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}function t(r){p(r);b.walk(r,p,"childNodes")}h=u.getBookmark();q=d.startContainer;o=d.endContainer;g=d.startOffset;c=d.endOffset;q=q.nodeType==1?q.childNodes[Math.min(g,q.childNodes.length-1)]:q;o=o.nodeType==1?o.childNodes[Math.min(g==c?c:c-1,o.childNodes.length-1)]:o;if(q==o){f=k(q);if(q.nodeType==3){if(f&&f.nodeType==1){i=q.splitText(g);i.splitText(c-g);l.split(f,i);u.moveToBookmark(h)}return}t(l.split(f,q)||q)}else{f=k(q);j=k(o);if(f){if(q.nodeType==3){if(g==q.nodeValue.length){q.nodeValue+="\uFEFF"}q=q.splitText(g)}}if(j){if(o.nodeType==3){o.splitText(c)}}if(f&&f==j){l.replace(l.create("span",{id:"__end"},o.cloneNode(true)),o)}if(f){f=l.split(f,q)}else{f=q}if(i=l.get("__end")){o=i;j=k(o)}if(j){j=l.split(j,o)}else{j=o}a(l,f,j,p);if(q.nodeValue=="\uFEFF"){q.nodeValue=""}t(o);t(q)}b.each(e,function(r){l.remove(r,1)});l.remove("__end",1);u.moveToBookmark(h)})})(tinymce);(function(a){a.GlobalCommands.add("mceBlockQuote",function(){var j=this,o=j.selection,f=j.dom,l,k,e,d,p,c,m,h,b;function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOCKQUOTE"})}l=f.getParent(o.getStart(),f.isBlock);k=f.getParent(o.getEnd(),f.isBlock);if(p=g(l)){if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}if(g(k)){m=p.cloneNode(false);while(e=k.nextSibling){m.appendChild(e.parentNode.removeChild(e))}}if(m){f.insertAfter(m,p)}b=o.getSelectedBlocks(l,k);for(h=b.length-1;h>=0;h--){f.insertAfter(b[h],p)}if(/^\s*$/.test(p.innerHTML)){f.remove(p,1)}if(m&&/^\s*$/.test(m.innerHTML)){f.remove(m,1)}if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(0);if(f.getParent(o.getStart(),f.isBlock)!=l){c=o.getRng();c.move("character",-1);c.select()}}}else{j.selection.moveToBookmark(d)}return}if(a.isIE&&!l&&!k){j.getDoc().execCommand("Indent");e=g(o.getNode());e.style.margin=e.dir="";return}if(!l||!k){return}if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}a.each(o.getSelectedBlocks(g(o.getStart()),g(o.getEnd())),function(i){if(i.nodeName=="BLOCKQUOTE"&&!p){p=i;return}if(!p){p=f.create("blockquote");i.parentNode.insertBefore(p,i)}if(i.nodeName=="BLOCKQUOTE"&&p){e=i.firstChild;while(e){p.appendChild(e.cloneNode(true));e=e.nextSibling}f.remove(i);return}p.appendChild(f.remove(i))});if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(1)}}else{o.moveToBookmark(d)}})})(tinymce);(function(a){a.each(["Cut","Copy","Paste"],function(b){a.GlobalCommands.add(b,function(){var c=this,e=c.getDoc();try{e.execCommand(b,false,null);if(!e.queryCommandSupported(b)){throw"Error"}}catch(d){c.windowManager.alert(c.getLang("clipboard_no_support"))}})})})(tinymce);(function(a){a.GlobalCommands.add("InsertHorizontalRule",function(){if(a.isOpera){return this.getDoc().execCommand("InsertHorizontalRule",false,"")}this.selection.setContent("<hr />")})})(tinymce);(function(){var a=tinymce.GlobalCommands;a.add(["mceEndUndoLevel","mceAddUndoLevel"],function(){this.undoManager.add()});a.add("Undo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.undo();b.nodeChanged();return true}return false});a.add("Redo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.redo();b.nodeChanged();return true}return false})})();
+// advanced/editor_template.js
+(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":"&#160;");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce));
+// plugins/directionality
+(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceDirectionLTR",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="ltr"){a.dom.setAttrib(d,"dir","ltr")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addCommand("mceDirectionRTL",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="rtl"){a.dom.setAttrib(d,"dir","rtl")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});a.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});a.onNodeChange.add(c._nodeChange,c)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();
+// plugins/fullscreen
+(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(c,d){var e=this,f={},b;e.editor=c;c.addCommand("mceFullScreen",function(){var h,i=a.doc.documentElement;if(c.getParam("fullscreen_is_enabled")){if(c.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",e.resizeFunc);tinyMCE.get(c.getParam("fullscreen_editor_id")).setContent(c.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(c);a.remove("mce_fullscreen_container");i.style.overflow=c.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",c.getParam("fullscreen_overflow"));a.win.scrollTo(c.getParam("fullscreen_scrollx"),c.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(c.getParam("fullscreen_new_window")){h=a.win.open(d+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{h.resizeTo(screen.availWidth,screen.availHeight)}catch(g){}}else{tinyMCE.oldSettings=tinyMCE.settings;f.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";f.fullscreen_html_overflow=a.getStyle(i,"overflow",1);b=a.getViewPort();f.fullscreen_scrollx=b.x;f.fullscreen_scrolly=b.y;if(tinymce.isOpera&&f.fullscreen_overflow=="visible"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&f.fullscreen_overflow=="scroll"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&(f.fullscreen_html_overflow=="visible"||f.fullscreen_html_overflow=="scroll")){f.fullscreen_html_overflow="auto"}if(f.fullscreen_overflow=="0px"){f.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");i.style.overflow="hidden";b=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){b.h-=1}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+(tinymce.isIE6||(tinymce.isIE&&!a.boxModel)?"absolute":"fixed")+";top:0;left:0;width:"+b.w+"px;height:"+b.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(c.settings,function(j,k){f[k]=j});f.id="mce_fullscreen";f.width=n.clientWidth;f.height=n.clientHeight-15;f.fullscreen_is_enabled=true;f.fullscreen_editor_id=c.id;f.theme_advanced_resizing=false;f.save_onsavecallback=function(){c.setContent(tinyMCE.get(f.id).getContent({format:"raw"}),{format:"raw"});c.execCommand("mceSave")};tinymce.each(c.getParam("fullscreen_settings"),function(l,j){f[j]=l});if(f.theme_advanced_toolbar_location==="external"){f.theme_advanced_toolbar_location="top"}e.fullscreenEditor=new tinymce.Editor("mce_fullscreen",f);e.fullscreenEditor.onInit.add(function(){e.fullscreenEditor.setContent(c.getContent());e.fullscreenEditor.focus()});e.fullscreenEditor.render();tinyMCE.add(e.fullscreenEditor);e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var j=tinymce.DOM.getViewPort();e.fullscreenEditor.theme.resizeTo(j.w,j.h)})}});c.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});c.onNodeChange.add(function(h,g){g.setActive("fullscreen",h.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
+// plugins/inlinepopups
+(function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark("simple")}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
+// plugins/media
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
+// plugins/paste
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var k=c.dom,j={content:i};e.onPreProcess.dispatch(e,j);j.node=k.create("div",0,j.content);e.onPostProcess.dispatch(e,j);j.content=c.serializer.serialize(j.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(j.content)){e._insertBlockContent(c,k,j.content)}else{e._insert(j.content)}}c.addCommand("mceInsertClipboardContent",function(i,h){g(h)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"&nbsp;");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);g(p.innerHTML);return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var r=o.get("_mcePaste"),q;r.id="_mceRemoved";o.remove(r);r=o.get("_mcePaste")||r;q=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML;o.remove(r);if(k){j.setRng(k)}g(q)},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(d,g){var b=this.editor,c=g.content,f,e;function f(h){a(h,function(i){if(i.constructor==RegExp){c=c.replace(i,"")}else{c=c.replace(i[0],i[1])}})}f([/^\s*(&nbsp;)+/g,/(&nbsp;|<br[^>]*>)+\s*$/g]);if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)){g.wordContent=true;if(b.getParam("paste_convert_middot_lists",true)){f([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<span[^>]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}f([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/&nbsp;/g,"\u00a0"]]);if(!b.getParam("paste_retain_style_properties")){f([/<\/?(span)[^>]*>/gi])}}e=b.getParam("paste_strip_class_attributes","all");if(e!="none"){if(e=="all"){f([/ class=\"([^\"]*)\"/gi,/ class=(\w+)/gi])}else{f([/ class=\"(mso[^\"]*)\"/gi,/ class=(mso\w+)/gi])}}if(b.getParam("paste_remove_spans")){f([/<\/?(span)[^>]*>/gi])}g.content=c},_postProcess:function(e,g){var d=this,c=d.editor,f=c.dom,b;if(g.wordContent){a(f.select("a",g.node),function(h){if(!h.href||h.href.indexOf("#_Toc")!=-1){f.remove(h,1)}});if(d.editor.getParam("paste_convert_middot_lists",true)){d._convertLists(e,g)}b=c.getParam("paste_retain_style_properties");if(tinymce.is(b,"string")){b=tinymce.explode(b)}a(f.select("*",g.node),function(l){var m={},j=0,k,n,h;if(b){for(k=0;k<b.length;k++){n=b[k];h=f.getStyle(l,n);if(h){m[n]=h;j++}}}f.setAttrib(l,"style","");if(b&&j>0){f.setStyles(l,m)}else{if(l.nodeName=="SPAN"&&!l.className){f.remove(l,true)}}})}if(c.getParam("paste_remove_styles")||(c.getParam("paste_remove_styles_if_webkit")&&tinymce.isWebKit)){a(f.select("*[style]",g.node),function(h){h.removeAttribute("style");h.removeAttribute("mce_style")})}else{if(tinymce.isWebKit){a(f.select("*",g.node),function(h){h.removeAttribute("mce_style")})}}},_convertLists:function(e,c){var g=e.editor.dom,f,j,b=-1,d,k=[],i,h;a(g.select("p",c.node),function(r){var n,s="",q,o,l,m;for(n=r.firstChild;n&&n.nodeType==3;n=n.nextSibling){s+=n.nodeValue}s=r.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(s)){q="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(s)){q="ol"}if(q){d=parseFloat(r.style.marginLeft||0);if(d>b){k.push(d)}if(!f||q!=i){f=g.create(q);g.insertAfter(f,r)}else{if(d>b){f=j.appendChild(g.create(q))}else{if(d<b){l=tinymce.inArray(k,d);m=g.getParents(f.parentNode,q);f=m[m.length-1-l]||f}}}a(g.select("span",r),function(t){var p=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(q=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){g.remove(t)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){g.remove(t)}}});o=r.innerHTML;if(q=="ul"){o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}j=f.appendChild(g.create("li",0,o));g.remove(r);b=d;i=q}else{f=b=0}});h=c.node.innerHTML;if(h.indexOf("__MCE_ITEM__")!=-1){c.node.innerHTML=h.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker">&nbsp;</span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol");if(c){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.getDoc().execCommand("Delete",false,null)}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:parseInt(b.getParam("paste_dialog_width","450")),height:parseInt(b.getParam("paste_dialog_height","400")),inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
+// plugins/safari
+(function(){var a=tinymce.dom.Event,c=tinymce.grep,d=tinymce.each,b=tinymce.inArray;function e(j,i,h){var g,k;g=j.createTreeWalker(i,NodeFilter.SHOW_ALL,null,false);while(k=g.nextNode()){if(h){if(!h(k)){return false}}if(k.nodeType==3&&k.nodeValue&&/[^\s\u00a0]+/.test(k.nodeValue)){return false}if(k.nodeType==1&&/^(HR|IMG|TABLE)$/.test(k.nodeName)){return false}}return true}tinymce.create("tinymce.plugins.Safari",{init:function(f){var g=this,h;if(!tinymce.isWebKit){return}g.editor=f;g.webKitFontSizes=["x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large"];g.namedFontSizes=["xx-small","x-small","small","medium","large","x-large","xx-large"];f.addCommand("CreateLink",function(k,j){var m=f.selection.getNode(),l=f.dom,i;if(m&&(/^(left|right)$/i.test(l.getStyle(m,"float",1))||/^(left|right)$/i.test(l.getAttrib(m,"align")))){i=l.create("a",{href:j},m.cloneNode());m.parentNode.replaceChild(i,m);f.selection.select(i)}else{f.getDoc().execCommand("CreateLink",false,j)}});f.onKeyUp.add(function(j,o){var l,i,m,p,k;if(o.keyCode==46||o.keyCode==8){i=j.getBody();l=i.innerHTML;k=j.selection;if(i.childNodes.length==1&&!/<(img|hr)/.test(l)&&tinymce.trim(l.replace(/<[^>]+>/g,"")).length==0){j.setContent('<p><br mce_bogus="1" /></p>',{format:"raw"});p=i.firstChild;m=k.getRng();m.setStart(p,0);m.setEnd(p,0);k.setRng(m)}}});f.addCommand("FormatBlock",function(j,i){var l=f.dom,k=l.getParent(f.selection.getNode(),l.isBlock);if(k){l.replace(l.create(i),k,1)}else{f.getDoc().execCommand("FormatBlock",false,i)}});f.addCommand("mceInsertContent",function(j,i){f.getDoc().execCommand("InsertText",false,"mce_marker");f.getBody().innerHTML=f.getBody().innerHTML.replace(/mce_marker/g,f.dom.processHTML(i)+'<span id="_mce_tmp">XX</span>');f.selection.select(f.dom.get("_mce_tmp"));f.getDoc().execCommand("Delete",false," ")});f.onKeyPress.add(function(o,p){var q,v,r,l,j,k,i,u,m,t,s;if(p.keyCode==13){i=o.selection;q=i.getNode();if(p.shiftKey||o.settings.force_br_newlines&&q.nodeName!="LI"){g._insertBR(o);a.cancel(p)}if(v=h.getParent(q,"LI")){r=h.getParent(v,"OL,UL");u=o.getDoc();s=h.create("p");h.add(s,"br",{mce_bogus:"1"});if(e(u,v)){if(k=h.getParent(r.parentNode,"LI,OL,UL")){return}k=h.getParent(r,"p,h1,h2,h3,h4,h5,h6,div")||r;l=u.createRange();l.setStartBefore(k);l.setEndBefore(v);j=u.createRange();j.setStartAfter(v);j.setEndAfter(k);m=l.cloneContents();t=j.cloneContents();if(!e(u,t)){h.insertAfter(t,k)}h.insertAfter(s,k);if(!e(u,m)){h.insertAfter(m,k)}h.remove(k);k=s.firstChild;l=u.createRange();l.setStartBefore(k);l.setEndBefore(k);i.setRng(l);return a.cancel(p)}}}});f.onExecCommand.add(function(i,k){var j,m,n,l;if(k=="InsertUnorderedList"||k=="InsertOrderedList"){j=i.selection;m=i.dom;if(n=m.getParent(j.getNode(),function(o){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)})){l=j.getBookmark();m.remove(n,1);j.moveToBookmark(l)}}});f.onClick.add(function(i,j){j=j.target;if(j.nodeName=="IMG"){g.selElm=j;i.selection.select(j)}else{g.selElm=null}});f.onInit.add(function(){g._fixWebKitSpans()});f.onSetContent.add(function(){h=f.dom;d(["strong","b","em","u","strike","sub","sup","a"],function(i){d(c(h.select(i)).reverse(),function(l){var k=l.nodeName.toLowerCase(),j;if(k=="a"){if(l.name){h.replace(h.create("img",{mce_name:"a",name:l.name,"class":"mceItemAnchor"}),l)}return}switch(k){case"b":case"strong":if(k=="b"){k="strong"}j="font-weight: bold;";break;case"em":j="font-style: italic;";break;case"u":j="text-decoration: underline;";break;case"sub":j="vertical-align: sub;";break;case"sup":j="vertical-align: super;";break;case"strike":j="text-decoration: line-through;";break}h.replace(h.create("span",{mce_name:k,style:j,"class":"Apple-style-span"}),l,1)})})});f.onPreProcess.add(function(i,j){h=i.dom;d(c(j.node.getElementsByTagName("span")).reverse(),function(m){var k,l;if(j.get){if(h.hasClass(m,"Apple-style-span")){l=m.style.backgroundColor;switch(h.getAttrib(m,"mce_name")){case"font":if(!i.settings.convert_fonts_to_spans){h.setAttrib(m,"style","")}break;case"strong":case"em":case"sub":case"sup":h.setAttrib(m,"style","");break;case"strike":case"u":if(!i.settings.inline_styles){h.setAttrib(m,"style","")}else{h.setAttrib(m,"mce_name","")}break;default:if(!i.settings.inline_styles){h.setAttrib(m,"style","")}}if(l){m.style.backgroundColor=l}}}if(h.hasClass(m,"mceItemRemoved")){h.remove(m,1)}})});f.onPostProcess.add(function(i,j){j.content=j.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,"</$1>");j.content=j.content.replace(/ id=\"undefined\"/g,"")})},getInfo:function(){return{longname:"Safari compatibility",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_fixWebKitSpans:function(){var g=this,f=g.editor;a.add(f.getDoc(),"DOMNodeInserted",function(h){h=h.target;if(h&&h.nodeType==1){g._fixAppleSpan(h)}})},_fixAppleSpan:function(l){var g=this.editor,m=g.dom,i=this.webKitFontSizes,f=this.namedFontSizes,j=g.settings,h,k;if(m.getAttrib(l,"mce_fixed")){return}if(l.nodeName=="SPAN"&&l.className=="Apple-style-span"){h=l.style;if(!j.convert_fonts_to_spans){if(h.fontSize){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"size",b(i,h.fontSize)+1)}if(h.fontFamily){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"face",h.fontFamily)}if(h.color){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"color",m.toHex(h.color))}if(h.backgroundColor){m.setAttrib(l,"mce_name","font");m.setStyle(l,"background-color",h.backgroundColor)}}else{if(h.fontSize){m.setStyle(l,"fontSize",f[b(i,h.fontSize)])}}if(h.fontWeight=="bold"){m.setAttrib(l,"mce_name","strong")}if(h.fontStyle=="italic"){m.setAttrib(l,"mce_name","em")}if(h.textDecoration=="underline"){m.setAttrib(l,"mce_name","u")}if(h.textDecoration=="line-through"){m.setAttrib(l,"mce_name","strike")}if(h.verticalAlign=="super"){m.setAttrib(l,"mce_name","sup")}if(h.verticalAlign=="sub"){m.setAttrib(l,"mce_name","sub")}m.setAttrib(l,"mce_fixed","1")}},_insertBR:function(f){var j=f.dom,h=f.selection,i=h.getRng(),g;i.insertNode(g=j.create("br"));i.setStartAfter(g);i.setEndAfter(g);h.setRng(i);if(h.getSel().focusNode==g.previousSibling){h.select(j.insertAfter(j.doc.createTextNode("\u00a0"),g));h.collapse(1)}f.getWin().scrollTo(0,j.getPos(h.getRng().startContainer).y)}});tinymce.PluginManager.add("safari",tinymce.plugins.Safari)})();
+// plugins/spellchecker
+(function(){var JSONRequest=tinymce.util.JSONRequest,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.SpellcheckerPlugin',{getInfo:function(){return{longname:'Spellchecker',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',version:tinymce.majorVersion+"."+tinymce.minorVersion};},init:function(ed,url){var t=this,cm;t.url=url;t.editor=ed;ed.addCommand('mceSpellCheck',function(){if(!t.active){ed.setProgressState(1);t._sendRPC('checkWords',[t.selectedLang,t._getWords()],function(r){if(r.length>0){t.active=1;t._markWords(r);ed.setProgressState(0);ed.nodeChanged();}else{ed.setProgressState(0);ed.windowManager.alert('spellchecker.no_mpell');}});}else t._done();});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+'/css/content.css');});ed.onClick.add(t._showMenu,t);ed.onContextMenu.add(t._showMenu,t);ed.onBeforeGetContent.add(function(){if(t.active)t._removeWords();});ed.onNodeChange.add(function(ed,cm){cm.setActive('spellchecker',t.active);});ed.onSetContent.add(function(){t._done();});ed.onBeforeGetContent.add(function(){t._done();});ed.onBeforeExecCommand.add(function(ed,cmd){if(cmd=='mceFullScreen')t._done();});t.languages={};each(ed.getParam('spellchecker_languages','+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv','hash'),function(v,k){if(k.indexOf('+')===0){k=k.substring(1);t.selectedLang=v;}t.languages[k]=v;});},createControl:function(n,cm){var t=this,c,ed=t.editor;if(n=='spellchecker'){c=cm.createSplitButton(n,{title:'spellchecker.desc',cmd:'mceSpellCheck',scope:t});c.onRenderMenu.add(function(c,m){m.add({title:'spellchecker.langs','class':'mceMenuItemTitle'}).setDisabled(1);each(t.languages,function(v,k){var o={icon:1},mi;o.onclick=function(){mi.setSelected(1);t.selectedItem.setSelected(0);t.selectedItem=mi;t.selectedLang=v;};o.title=k;mi=m.add(o);mi.setSelected(v==t.selectedLang);if(v==t.selectedLang)t.selectedItem=mi;})});return c;}},_walk:function(n,f){var d=this.editor.getDoc(),w;if(d.createTreeWalker){w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while((n=w.nextNode())!=null)f.call(this,n);}else tinymce.walk(n,f,'childNodes');},_getSeparators:function(){var re='',i,str=this.editor.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}����������������\u201d\u201c');for(i=0;i<str.length;i++)re+='\\'+str.charAt(i);return re;},_getWords:function(){var ed=this.editor,wl=[],tx='',lo={};this._walk(ed.getBody(),function(n){if(n.nodeType==3)tx+=n.nodeValue+' ';});tx=tx.replace(new RegExp('([0-9]|['+this._getSeparators()+'])','g'),' ');tx=tinymce.trim(tx.replace(/(\s+)/g,' '));each(tx.split(' '),function(v){if(!lo[v]){wl.push(v);lo[v]=1;}});return wl;},_removeWords:function(w){var ed=this.editor,dom=ed.dom,se=ed.selection,b=se.getBookmark();each(dom.select('span').reverse(),function(n){if(n&&(dom.hasClass(n,'mceItemHiddenSpellWord')||dom.hasClass(n,'mceItemHidden'))){if(!w||dom.decode(n.innerHTML)==w)dom.remove(n,1);}});se.moveToBookmark(b);},_markWords:function(wl){var r1,r2,r3,r4,r5,w='',ed=this.editor,re=this._getSeparators(),dom=ed.dom,nl=[];var se=ed.selection,b=se.getBookmark();each(wl,function(v){w+=(w?'|':'')+v;});r1=new RegExp('(['+re+'])('+w+')(['+re+'])','g');r2=new RegExp('^('+w+')','g');r3=new RegExp('('+w+')(['+re+']?)$','g');r4=new RegExp('^('+w+')(['+re+']?)$','g');r5=new RegExp('('+w+')(['+re+'])','g');this._walk(this.editor.getBody(),function(n){if(n.nodeType==3){nl.push(n);}});each(nl,function(n){var v;if(n.nodeType==3){v=n.nodeValue;if(r1.test(v)||r2.test(v)||r3.test(v)||r4.test(v)){v=dom.encode(v);v=v.replace(r5,'<span class="mceItemHiddenSpellWord">$1</span>$2');v=v.replace(r3,'<span class="mceItemHiddenSpellWord">$1</span>$2');dom.replace(dom.create('span',{'class':'mceItemHidden'},v),n);}}});se.moveToBookmark(b);},_showMenu:function(ed,e){var t=this,ed=t.editor,m=t._menu,p1,dom=ed.dom,vp=dom.getViewPort(ed.getWin());if(!m){p1=DOM.getPos(ed.getContentAreaContainer());m=ed.controlManager.createDropMenu('spellcheckermenu',{offset_x:p1.x,offset_y:p1.y,'class':'mceNoIcons'});t._menu=m;}if(dom.hasClass(e.target,'mceItemHiddenSpellWord')){m.removeAll();m.add({title:'spellchecker.wait','class':'mceMenuItemTitle'}).setDisabled(1);t._sendRPC('getSuggestions',[t.selectedLang,dom.decode(e.target.innerHTML)],function(r){m.removeAll();if(r.length>0){m.add({title:'spellchecker.sug','class':'mceMenuItemTitle'}).setDisabled(1);each(r,function(v){m.add({title:v,onclick:function(){dom.replace(ed.getDoc().createTextNode(v),e.target);t._checkDone();}});});m.addSeparator();}else m.add({title:'spellchecker.no_sug','class':'mceMenuItemTitle'}).setDisabled(1);m.add({title:'spellchecker.ignore_word',onclick:function(){dom.remove(e.target,1);t._checkDone();}});m.add({title:'spellchecker.ignore_words',onclick:function(){t._removeWords(dom.decode(e.target.innerHTML));t._checkDone();}});m.update();});ed.selection.select(e.target);p1=dom.getPos(e.target);m.showMenu(p1.x,p1.y+e.target.offsetHeight-vp.y);return tinymce.dom.Event.cancel(e);}else m.hideMenu();},_checkDone:function(){var t=this,ed=t.editor,dom=ed.dom,o;each(dom.select('span'),function(n){if(n&&dom.hasClass(n,'mceItemHiddenSpellWord')){o=true;return false;}});if(!o)t._done();},_done:function(){var t=this,la=t.active;if(t.active){t.active=0;t._removeWords();if(t._menu)t._menu.hideMenu();if(la)t.editor.nodeChanged();}},_sendRPC:function(m,p,cb){var t=this,url=t.editor.getParam("spellchecker_rpc_url",this.url+'/rpc.php');if(url=='{backend}'){t.editor.setProgressState(0);alert('Please specify: spellchecker_rpc_url');return;}JSONRequest.sendRPC({url:url,method:m,params:p,success:cb,error:function(e,x){t.editor.setProgressState(0);t.editor.windowManager.alert(e.errstr||('Error response: '+x.responseText));}});}});tinymce.PluginManager.add('spellchecker',tinymce.plugins.SpellcheckerPlugin);})();
+// plugins/tabfocus
+(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m<n.length;m++){if(n[m].type!="hidden"){return n[m]}}}else{for(m=j-1;m>=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.EditorManager.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
+// plugins/wordpress
+(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{init:function(c,d){var e=this,h=c.getParam("wordpress_adv_toolbar","toolbar2"),g=0,f,b;f='<img src="'+d+'/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';if(getUserSetting("hidetb","0")=="1"){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){if(c.getParam("wordpress_adv_hidden",1)){a.hide(c.controlManager.get(h).id);e._resizeIframe(c,h,28)}});c.addCommand("WP_More",function(){c.execCommand("mceInsertContent",0,f)});c.addCommand("WP_Page",function(){c.execCommand("mceInsertContent",0,b)});c.addCommand("WP_Help",function(){c.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})});c.addCommand("WP_Adv",function(){var j=c.controlManager.get(h).id,i=c.controlManager;if(a.isHidden(j)){i.setActive("wp_adv",1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting("hidetb","1")}else{i.setActive("wp_adv",0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting("hidetb","0")}});c.addButton("wp_more",{title:"wordpress.wp_more_desc",image:d+"/img/more.gif",cmd:"WP_More"});c.addButton("wp_page",{title:"wordpress.wp_page_desc",image:d+"/img/page.gif",cmd:"WP_Page"});c.addButton("wp_help",{title:"wordpress.wp_help_desc",image:d+"/img/help.gif",cmd:"WP_Help"});c.addButton("wp_adv",{title:"wordpress.wp_adv_desc",image:d+"/img/toolbars.gif",cmd:"WP_Adv"});c.addButton("add_media",{title:"wordpress.add_media",image:d+"/img/media.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_media").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_image",{title:"wordpress.add_image",image:d+"/img/image.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_image").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_video",{title:"wordpress.add_video",image:d+"/img/video.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_video").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_audio",{title:"wordpress.add_audio",image:d+"/img/audio.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_audio").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.onBeforeExecCommand.add(function(i,k,j,l){if("mceFullScreen"!=k){return}if("mce_fullscreen"!=i.id){i.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}});c.addCommand("JustifyLeft",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyLeft","left")}else{c.plugins.wordpress.do_align(i,"alignleft")}});c.addCommand("JustifyRight",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyRight","right")}else{c.plugins.wordpress.do_align(i,"alignright")}});c.addCommand("JustifyCenter",function(){var k=c.selection.getNode(),j=c.dom.getParent(k,"p"),i=c.dom.getParent(k,"dl");if(k.nodeName=="IMG"&&(j||i)){c.plugins.wordpress.do_align(k,"aligncenter")}else{c.editorCommands.mceJustify("JustifyCenter","center")}});if("undefined"!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:"raw"}))}g=j.keyCode})}e._handleMoreBreak(c,d);c.addShortcut("alt+shift+c",c.getLang("justifycenter_desc"),"JustifyCenter");c.addShortcut("alt+shift+r",c.getLang("justifyright_desc"),"JustifyRight");c.addShortcut("alt+shift+l",c.getLang("justifyleft_desc"),"JustifyLeft");c.addShortcut("alt+shift+j",c.getLang("justifyfull_desc"),"JustifyFull");c.addShortcut("alt+shift+q",c.getLang("blockquote_desc"),"mceBlockQuote");c.addShortcut("alt+shift+u",c.getLang("bullist_desc"),"InsertUnorderedList");c.addShortcut("alt+shift+o",c.getLang("numlist_desc"),"InsertOrderedList");c.addShortcut("alt+shift+d",c.getLang("striketrough_desc"),"Strikethrough");c.addShortcut("alt+shift+n",c.getLang("spellchecker.desc"),"mceSpellCheck");c.addShortcut("alt+shift+a",c.getLang("link_desc"),"mceLink");c.addShortcut("alt+shift+s",c.getLang("unlink_desc"),"unlink");c.addShortcut("alt+shift+m",c.getLang("image_desc"),"mceImage");c.addShortcut("alt+shift+g",c.getLang("fullscreen.desc"),"mceFullScreen");c.addShortcut("alt+shift+z",c.getLang("wp_adv_desc"),"WP_Adv");c.addShortcut("alt+shift+h",c.getLang("help_desc"),"WP_Help");c.addShortcut("alt+shift+t",c.getLang("wp_more_desc"),"WP_More");c.addShortcut("alt+shift+p",c.getLang("wp_page_desc"),"WP_Page");c.addShortcut("ctrl+s",c.getLang("save_desc"),function(){if("function"==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut("alt+shift+b",c.getLang("bold_desc"),"Bold");c.addShortcut("alt+shift+i",c.getLang("italic_desc"),"Italic")}},getInfo:function(){return{longname:"WordPress Plugin",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"3.0"}},do_align:function(j,d){var h,f,g,b,i,e=tinyMCE.activeEditor;if(/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(j.className)){return}h=e.dom.getParent(j,"p");f=e.dom.getParent(j,"dl");g=e.dom.getParent(j,"div");if(f&&g){b=e.dom.hasClass(f,d)?"alignnone":d;f.className=f.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(f,b);i=(b=="aligncenter")?e.dom.addClass(g,"mceIEcenter"):e.dom.removeClass(g,"mceIEcenter")}else{if(h){b=e.dom.hasClass(j,d)?"alignnone":d;j.className=j.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(j,b);if(b=="aligncenter"){e.dom.setStyle(h,"textAlign","center")}else{if(h.style&&h.style.textAlign=="center"){e.dom.setStyle(h,"textAlign","")}}}}e.execCommand("mceRepaint")},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,"height",d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e='<img src="'+d+'/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+c.getLang("wordpress.wp_more_alt")+'" />';b='<img src="'+d+'/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+c.getLang("wordpress.wp_page_alt")+'" />';c.onInit.add(function(){c.dom.loadCSS(d+"/css/content.css")});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName=="IMG"){if(c.dom.hasClass(g.node,"mceWPmore")){g.name="wpmore"}if(c.dom.hasClass(g.node,"mceWPnextpage")){g.name="wppage"}}})}});c.onBeforeSetContent.add(function(f,g){g.content=g.content.replace(/<!--more(.*?)-->/g,e);g.content=g.content.replace(/<!--nextpage-->/g,b)});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/<img[^>]+>/g,function(i){if(i.indexOf('class="mceWPmore')!==-1){var h,j=(h=i.match(/alt="(.*?)"/))?h[1]:"";i="<!--more"+j+"-->"}if(i.indexOf('class="mceWPnextpage')!==-1){i="<!--nextpage-->"}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive("wp_page",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPnextpage"));f.setActive("wp_more",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPmore"))})}});tinymce.PluginManager.add("wordpress",tinymce.plugins.WordPress)})();
+// plugins/wpeditimage
+(function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_EditImage",function(){var h=a.selection.getNode(),f=tinymce.DOM.getViewPort(),g=f.h,d=(720<f.w)?720:f.w,e=a.dom.getAttrib(h,"class");if(e.indexOf("mceItem")!=-1||e.indexOf("wpGallery")!=-1||h.nodeName!="IMG"){return}tb_show("",b+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(d-50)+"px",height:(g-45)+"px","margin-left":"-"+parseInt(((d-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(d-50)+"px",height:(g-75)+"px"});tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getWin(),"scroll",function(f){d.plugins.wpeditimage.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpeditimage.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpeditimage.hideButtons()});a.onMouseUp.add(function(d,g){var h,f;if(tinymce.isOpera){if(g.target.nodeName=="IMG"){d.plugins.wpeditimage.showButtons(g.target)}}else{if(!tinymce.isWebKit){h=d.selection.getNode();if(h.nodeName=="IMG"&&(f=d.dom.getParent(h,"DL"))){window.setTimeout(function(){var e=tinyMCE.activeEditor,j=e.selection.getNode(),i=e.dom.getParent(j,"DL");if(j.width!=(parseInt(e.dom.getStyle(i,"width"))-10)){e.dom.setStyle(i,"width",parseInt(j.width)+10);e.execCommand("mceRepaint")}},100)}}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpeditimage.showButtons(f.target)});a.onKeyPress.add(function(d,i){var f,h,g;if(i.keyCode==13&&(f=d.dom.getParent(d.selection.getNode(),"DL"))){g=d.dom.create("p",{},"&nbsp;");if((h=f.parentNode)&&h.nodeName=="DIV"){d.dom.insertAfter(g,h)}else{d.dom.insertAfter(g,f)}tinymce.dom.Event.cancel(i);d.selection.select(g);return false}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_shcode(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_shcode(e.content)}})},_do_shcode:function(a){return a.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\&#39;|\\&#039;/g,"&#39;").replace(/\\"|\\&quot;/g,"&quot;");k=k.replace(/\\&#39;|\\&#039;/g,"&#39;").replace(/\\&quot;/g,"&quot;");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'"><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"&#39;").replace(/"/g,"&quot;");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},showButtons:function(d){var j=this,e=tinyMCE.activeEditor,g,f,a,i=tinymce.DOM,c,b,h=e.dom.getAttrib(d,"class");if(h.indexOf("mceItem")!=-1||h.indexOf("wpGallery")!=-1){return}a=e.dom.getViewPort(e.getWin());g=i.getPos(e.getContentAreaContainer());f=e.dom.getPos(d);c=Math.max(f.x-a.x,0)+g.x;b=Math.max(f.y-a.y,0)+g.y;i.setStyles("wp_editbtns",{top:b+5+"px",left:c+5+"px",display:"block"});j.btnsTout=window.setTimeout(function(){e.plugins.wpeditimage.hideButtons()},5000)},hideButtons:function(){if(tinymce.DOM.isHidden("wp_editbtns")){return}tinymce.DOM.hide("wp_editbtns");window.clearTimeout(this.btnsTout)},_createButtons:function(){var d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,a,c,f;e.remove("wp_editbtns");a=e.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});c=e.add("wp_editbtns","img",{src:d.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:b.getLang("wpeditimage.edit_img")});c.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_EditImage");this.parentNode.style.display="none"};f=e.add("wp_editbtns","img",{src:d.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:b.getLang("wpeditimage.del_img")});f.onmousedown=function(j){var g=tinyMCE.activeEditor,h=g.selection.getNode(),i;if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("mceItem")==-1){if((i=g.dom.getParent(h,"div"))&&g.dom.hasClass(i,"mceTemp")){g.dom.remove(i)}else{if((i=g.dom.getParent(h,"A"))&&i.childNodes.length==1){g.dom.remove(i)}else{g.dom.remove(h)}}this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();
+// plugins/wpgallery
+(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c._createButtons();a.addCommand("WP_Gallery",function(){var e=a.selection.getNode(),d;if(e.nodeName!="IMG"){return}if(a.dom.getAttrib(e,"class").indexOf("wpGallery")==-1){return}d=tinymce.DOM.get("post_ID").value;tb_show("",tinymce.documentBaseURL+"/media-upload.php?post_id="+d+"&tab=gallery&TB_iframe=true");tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(d){tinymce.dom.Event.add(d.getWin(),"scroll",function(f){d.plugins.wpgallery.hideButtons()})});a.onBeforeExecCommand.add(function(d,f,e,g){d.plugins.wpgallery.hideButtons()});a.onSaveContent.add(function(d,e){d.plugins.wpgallery.hideButtons()});a.onMouseUp.add(function(d,f){if(tinymce.isOpera){if(f.target.nodeName=="IMG"){d.plugins.wpgallery.showButtons(f.target)}}});a.onMouseDown.add(function(d,f){if(tinymce.isOpera||f.target.nodeName!="IMG"){c.hideButtons();return}d.plugins.wpgallery.showButtons(f.target)});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},showButtons:function(d){var i=this,e=tinyMCE.activeEditor,g,f,a,h=tinymce.DOM,c,b;if(e.dom.getAttrib(d,"class").indexOf("wpGallery")==-1){return}a=e.dom.getViewPort(e.getWin());g=h.getPos(e.getContentAreaContainer());f=e.dom.getPos(d);c=Math.max(f.x-a.x,0)+g.x;b=Math.max(f.y-a.y,0)+g.y;h.setStyles("wp_gallerybtns",{top:b+5+"px",left:c+5+"px",display:"block"});i.btnsTout=window.setTimeout(function(){e.plugins.wpgallery.hideButtons()},5000)},hideButtons:function(){if(tinymce.DOM.isHidden("wp_gallerybtns")){return}tinymce.DOM.hide("wp_gallerybtns");window.clearTimeout(this.btnsTout)},_createButtons:function(){var d=this,b=tinyMCE.activeEditor,e=tinymce.DOM,c,f,a;e.remove("wp_gallerybtns");c=e.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});f=e.add("wp_gallerybtns","img",{src:d.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:b.getLang("wordpress.editgallery")});f.onmousedown=function(h){var g=tinyMCE.activeEditor;g.windowManager.bookmark=g.selection.getBookmark("simple");g.execCommand("WP_Gallery");this.parentNode.style.display="none"};a=e.add("wp_gallerybtns","img",{src:d.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:b.getLang("wordpress.delgallery")});a.onmousedown=function(i){var g=tinyMCE.activeEditor,h=g.selection.getNode();if(h.nodeName=="IMG"&&g.dom.getAttrib(h,"class").indexOf("wpGallery")!=-1){g.dom.remove(h);this.parentNode.style.display="none";g.execCommand("mceRepaint");return false}}},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();
+// mark as loaded
+tinyMCEPreInit.go=function(){var b=this,a=tinymce.ScriptLoader,f=b.mceInit.language,e=b.mceInit.theme,c=b.mceInit.plugins,d=b.suffix;a.markDone(b.base+"/langs/"+f+".js");a.markDone(b.base+"/themes/"+e+"/editor_template"+d+".js");a.markDone(b.base+"/themes/"+e+"/langs/"+f+".js");a.markDone(b.base+"/themes/"+e+"/langs/"+f+"_dlg.js");tinymce.each(c.split(","),function(g){if(g&&g.charAt(0)!="-"){a.markDone(b.base+"/plugins/"+g+"/editor_plugin"+d+".js");a.markDone(b.base+"/plugins/"+g+"/langs/"+f+".js");a.markDone(b.base+"/plugins/"+g+"/langs/"+f+"_dlg.js")}})};
diff --git a/wp-includes/js/tinymce/wp-tinymce.js.gz b/wp-includes/js/tinymce/wp-tinymce.js.gz
new file mode 100644 (file)
index 0000000..aeb541d
Binary files /dev/null and b/wp-includes/js/tinymce/wp-tinymce.js.gz differ
diff --git a/wp-includes/js/tinymce/wp-tinymce.php b/wp-includes/js/tinymce/wp-tinymce.php
new file mode 100644 (file)
index 0000000..a51eeb7
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+$basepath = dirname(__FILE__);
+
+function get_file($path) {
+
+       if ( function_exists('realpath') )
+               $path = realpath($path);
+
+       if ( ! $path || ! @is_file($path) )
+               return '';
+
+       return @file_get_contents($path);
+}
+
+$expires_offset = 31536000;
+
+header('Content-Type: application/x-javascript; charset=UTF-8');
+header('Vary: Accept-Encoding'); // Handle proxies
+header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
+header("Cache-Control: public, max-age=$expires_offset");
+
+if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {
+       header('Content-Encoding: gzip');
+       echo get_file($basepath . '/wp-tinymce.js.gz');
+} else {
+       echo get_file($basepath . '/wp-tinymce.js');
+}
+exit;
diff --git a/wp-includes/js/tw-sack.dev.js b/wp-includes/js/tw-sack.dev.js
new file mode 100644 (file)
index 0000000..f93f2a4
--- /dev/null
@@ -0,0 +1,193 @@
+/* Simple AJAX Code-Kit (SACK) v1.6.1 */
+/* ©2005 Gregory Wild-Smith */
+/* www.twilightuniverse.com */
+/* Software licenced under a modified X11 licence,
+   see documentation or authors website for more details */
+
+function sack(file) {
+       this.xmlhttp = null;
+
+       this.resetData = function() {
+               this.method = "POST";
+               this.queryStringSeparator = "?";
+               this.argumentSeparator = "&";
+               this.URLString = "";
+               this.encodeURIString = true;
+               this.execute = false;
+               this.element = null;
+               this.elementObj = null;
+               this.requestFile = file;
+               this.vars = new Object();
+               this.responseStatus = new Array(2);
+       };
+
+       this.resetFunctions = function() {
+               this.onLoading = function() { };
+               this.onLoaded = function() { };
+               this.onInteractive = function() { };
+               this.onCompletion = function() { };
+               this.onError = function() { };
+               this.onFail = function() { };
+       };
+
+       this.reset = function() {
+               this.resetFunctions();
+               this.resetData();
+       };
+
+       this.createAJAX = function() {
+               try {
+                       this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+               } catch (e1) {
+                       try {
+                               this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+                       } catch (e2) {
+                               this.xmlhttp = null;
+                       }
+               }
+
+               if (! this.xmlhttp) {
+                       if (typeof XMLHttpRequest != "undefined") {
+                               this.xmlhttp = new XMLHttpRequest();
+                       } else {
+                               this.failed = true;
+                       }
+               }
+       };
+
+       this.setVar = function(name, value){
+               this.vars[name] = Array(value, false);
+       };
+
+       this.encVar = function(name, value, returnvars) {
+               if (true == returnvars) {
+                       return Array(encodeURIComponent(name), encodeURIComponent(value));
+               } else {
+                       this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
+               }
+       }
+
+       this.processURLString = function(string, encode) {
+               encoded = encodeURIComponent(this.argumentSeparator);
+               regexp = new RegExp(this.argumentSeparator + "|" + encoded);
+               varArray = string.split(regexp);
+               for (i = 0; i < varArray.length; i++){
+                       urlVars = varArray[i].split("=");
+                       if (true == encode){
+                               this.encVar(urlVars[0], urlVars[1]);
+                       } else {
+                               this.setVar(urlVars[0], urlVars[1]);
+                       }
+               }
+       }
+
+       this.createURLString = function(urlstring) {
+               if (this.encodeURIString && this.URLString.length) {
+                       this.processURLString(this.URLString, true);
+               }
+
+               if (urlstring) {
+                       if (this.URLString.length) {
+                               this.URLString += this.argumentSeparator + urlstring;
+                       } else {
+                               this.URLString = urlstring;
+                       }
+               }
+
+               // prevents caching of URLString
+               this.setVar("rndval", new Date().getTime());
+
+               urlstringtemp = new Array();
+               for (key in this.vars) {
+                       if (false == this.vars[key][1] && true == this.encodeURIString) {
+                               encoded = this.encVar(key, this.vars[key][0], true);
+                               delete this.vars[key];
+                               this.vars[encoded[0]] = Array(encoded[1], true);
+                               key = encoded[0];
+                       }
+
+                       urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
+               }
+               if (urlstring){
+                       this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
+               } else {
+                       this.URLString += urlstringtemp.join(this.argumentSeparator);
+               }
+       }
+
+       this.runResponse = function() {
+               eval(this.response);
+       }
+
+       this.runAJAX = function(urlstring) {
+               if (this.failed) {
+                       this.onFail();
+               } else {
+                       this.createURLString(urlstring);
+                       if (this.element) {
+                               this.elementObj = document.getElementById(this.element);
+                       }
+                       if (this.xmlhttp) {
+                               var self = this;
+                               if (this.method == "GET") {
+                                       totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
+                                       this.xmlhttp.open(this.method, totalurlstring, true);
+                               } else {
+                                       this.xmlhttp.open(this.method, this.requestFile, true);
+                                       try {
+                                               this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
+                                       } catch (e) { }
+                               }
+
+                               this.xmlhttp.onreadystatechange = function() {
+                                       switch (self.xmlhttp.readyState) {
+                                               case 1:
+                                                       self.onLoading();
+                                                       break;
+                                               case 2:
+                                                       self.onLoaded();
+                                                       break;
+                                               case 3:
+                                                       self.onInteractive();
+                                                       break;
+                                               case 4:
+                                                       self.response = self.xmlhttp.responseText;
+                                                       self.responseXML = self.xmlhttp.responseXML;
+                                                       self.responseStatus[0] = self.xmlhttp.status;
+                                                       self.responseStatus[1] = self.xmlhttp.statusText;
+
+                                                       if (self.execute) {
+                                                               self.runResponse();
+                                                       }
+
+                                                       if (self.elementObj) {
+                                                               elemNodeName = self.elementObj.nodeName;
+                                                               elemNodeName.toLowerCase();
+                                                               if (elemNodeName == "input"
+                                                               || elemNodeName == "select"
+                                                               || elemNodeName == "option"
+                                                               || elemNodeName == "textarea") {
+                                                                       self.elementObj.value = self.response;
+                                                               } else {
+                                                                       self.elementObj.innerHTML = self.response;
+                                                               }
+                                                       }
+                                                       if (self.responseStatus[0] == "200") {
+                                                               self.onCompletion();
+                                                       } else {
+                                                               self.onError();
+                                                       }
+
+                                                       self.URLString = "";
+                                                       break;
+                                       }
+                               };
+
+                               this.xmlhttp.send(this.URLString);
+                       }
+               }
+       };
+
+       this.reset();
+       this.createAJAX();
+}
index f93f2a429c7c3c1ca92fbfce67f3b742b0a2f03d..d1b5561e5050e027c04b35afe577df84bd6ca434 100644 (file)
@@ -1,193 +1 @@
-/* Simple AJAX Code-Kit (SACK) v1.6.1 */
-/* ©2005 Gregory Wild-Smith */
-/* www.twilightuniverse.com */
-/* Software licenced under a modified X11 licence,
-   see documentation or authors website for more details */
-
-function sack(file) {
-       this.xmlhttp = null;
-
-       this.resetData = function() {
-               this.method = "POST";
-               this.queryStringSeparator = "?";
-               this.argumentSeparator = "&";
-               this.URLString = "";
-               this.encodeURIString = true;
-               this.execute = false;
-               this.element = null;
-               this.elementObj = null;
-               this.requestFile = file;
-               this.vars = new Object();
-               this.responseStatus = new Array(2);
-       };
-
-       this.resetFunctions = function() {
-               this.onLoading = function() { };
-               this.onLoaded = function() { };
-               this.onInteractive = function() { };
-               this.onCompletion = function() { };
-               this.onError = function() { };
-               this.onFail = function() { };
-       };
-
-       this.reset = function() {
-               this.resetFunctions();
-               this.resetData();
-       };
-
-       this.createAJAX = function() {
-               try {
-                       this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
-               } catch (e1) {
-                       try {
-                               this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
-                       } catch (e2) {
-                               this.xmlhttp = null;
-                       }
-               }
-
-               if (! this.xmlhttp) {
-                       if (typeof XMLHttpRequest != "undefined") {
-                               this.xmlhttp = new XMLHttpRequest();
-                       } else {
-                               this.failed = true;
-                       }
-               }
-       };
-
-       this.setVar = function(name, value){
-               this.vars[name] = Array(value, false);
-       };
-
-       this.encVar = function(name, value, returnvars) {
-               if (true == returnvars) {
-                       return Array(encodeURIComponent(name), encodeURIComponent(value));
-               } else {
-                       this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
-               }
-       }
-
-       this.processURLString = function(string, encode) {
-               encoded = encodeURIComponent(this.argumentSeparator);
-               regexp = new RegExp(this.argumentSeparator + "|" + encoded);
-               varArray = string.split(regexp);
-               for (i = 0; i < varArray.length; i++){
-                       urlVars = varArray[i].split("=");
-                       if (true == encode){
-                               this.encVar(urlVars[0], urlVars[1]);
-                       } else {
-                               this.setVar(urlVars[0], urlVars[1]);
-                       }
-               }
-       }
-
-       this.createURLString = function(urlstring) {
-               if (this.encodeURIString && this.URLString.length) {
-                       this.processURLString(this.URLString, true);
-               }
-
-               if (urlstring) {
-                       if (this.URLString.length) {
-                               this.URLString += this.argumentSeparator + urlstring;
-                       } else {
-                               this.URLString = urlstring;
-                       }
-               }
-
-               // prevents caching of URLString
-               this.setVar("rndval", new Date().getTime());
-
-               urlstringtemp = new Array();
-               for (key in this.vars) {
-                       if (false == this.vars[key][1] && true == this.encodeURIString) {
-                               encoded = this.encVar(key, this.vars[key][0], true);
-                               delete this.vars[key];
-                               this.vars[encoded[0]] = Array(encoded[1], true);
-                               key = encoded[0];
-                       }
-
-                       urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
-               }
-               if (urlstring){
-                       this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
-               } else {
-                       this.URLString += urlstringtemp.join(this.argumentSeparator);
-               }
-       }
-
-       this.runResponse = function() {
-               eval(this.response);
-       }
-
-       this.runAJAX = function(urlstring) {
-               if (this.failed) {
-                       this.onFail();
-               } else {
-                       this.createURLString(urlstring);
-                       if (this.element) {
-                               this.elementObj = document.getElementById(this.element);
-                       }
-                       if (this.xmlhttp) {
-                               var self = this;
-                               if (this.method == "GET") {
-                                       totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
-                                       this.xmlhttp.open(this.method, totalurlstring, true);
-                               } else {
-                                       this.xmlhttp.open(this.method, this.requestFile, true);
-                                       try {
-                                               this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
-                                       } catch (e) { }
-                               }
-
-                               this.xmlhttp.onreadystatechange = function() {
-                                       switch (self.xmlhttp.readyState) {
-                                               case 1:
-                                                       self.onLoading();
-                                                       break;
-                                               case 2:
-                                                       self.onLoaded();
-                                                       break;
-                                               case 3:
-                                                       self.onInteractive();
-                                                       break;
-                                               case 4:
-                                                       self.response = self.xmlhttp.responseText;
-                                                       self.responseXML = self.xmlhttp.responseXML;
-                                                       self.responseStatus[0] = self.xmlhttp.status;
-                                                       self.responseStatus[1] = self.xmlhttp.statusText;
-
-                                                       if (self.execute) {
-                                                               self.runResponse();
-                                                       }
-
-                                                       if (self.elementObj) {
-                                                               elemNodeName = self.elementObj.nodeName;
-                                                               elemNodeName.toLowerCase();
-                                                               if (elemNodeName == "input"
-                                                               || elemNodeName == "select"
-                                                               || elemNodeName == "option"
-                                                               || elemNodeName == "textarea") {
-                                                                       self.elementObj.value = self.response;
-                                                               } else {
-                                                                       self.elementObj.innerHTML = self.response;
-                                                               }
-                                                       }
-                                                       if (self.responseStatus[0] == "200") {
-                                                               self.onCompletion();
-                                                       } else {
-                                                               self.onError();
-                                                       }
-
-                                                       self.URLString = "";
-                                                       break;
-                                       }
-                               };
-
-                               this.xmlhttp.send(this.URLString);
-                       }
-               }
-       };
-
-       this.reset();
-       this.createAJAX();
-}
+function sack(file){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="";this.encodeURIString=true;this.execute=false;this.element=null;this.elementObj=null;this.requestFile=file;this.vars=new Object();this.responseStatus=new Array(2)};this.resetFunctions=function(){this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.onError=function(){};this.onFail=function(){}};this.reset=function(){this.resetFunctions();this.resetData()};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e1){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e2){this.xmlhttp=null}}if(!this.xmlhttp){if(typeof XMLHttpRequest!="undefined"){this.xmlhttp=new XMLHttpRequest()}else{this.failed=true}}};this.setVar=function(name,value){this.vars[name]=Array(value,false)};this.encVar=function(name,value,returnvars){if(true==returnvars){return Array(encodeURIComponent(name),encodeURIComponent(value))}else{this.vars[encodeURIComponent(name)]=Array(encodeURIComponent(value),true)}};this.processURLString=function(string,encode){encoded=encodeURIComponent(this.argumentSeparator);regexp=new RegExp(this.argumentSeparator+"|"+encoded);varArray=string.split(regexp);for(i=0;i<varArray.length;i++){urlVars=varArray[i].split("=");if(true==encode){this.encVar(urlVars[0],urlVars[1])}else{this.setVar(urlVars[0],urlVars[1])}}};this.createURLString=function(urlstring){if(this.encodeURIString&&this.URLString.length){this.processURLString(this.URLString,true)}if(urlstring){if(this.URLString.length){this.URLString+=this.argumentSeparator+urlstring}else{this.URLString=urlstring}}this.setVar("rndval",new Date().getTime());urlstringtemp=new Array();for(key in this.vars){if(false==this.vars[key][1]&&true==this.encodeURIString){encoded=this.encVar(key,this.vars[key][0],true);delete this.vars[key];this.vars[encoded[0]]=Array(encoded[1],true);key=encoded[0]}urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0]}if(urlstring){this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator)}else{this.URLString+=urlstringtemp.join(this.argumentSeparator)}};this.runResponse=function(){eval(this.response)};this.runAJAX=function(urlstring){if(this.failed){this.onFail()}else{this.createURLString(urlstring);if(this.element){this.elementObj=document.getElementById(this.element)}if(this.xmlhttp){var self=this;if(this.method=="GET"){totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true)}else{this.xmlhttp.open(this.method,this.requestFile,true);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(e){}}this.xmlhttp.onreadystatechange=function(){switch(self.xmlhttp.readyState){case 1:self.onLoading();break;case 2:self.onLoaded();break;case 3:self.onInteractive();break;case 4:self.response=self.xmlhttp.responseText;self.responseXML=self.xmlhttp.responseXML;self.responseStatus[0]=self.xmlhttp.status;self.responseStatus[1]=self.xmlhttp.statusText;if(self.execute){self.runResponse()}if(self.elementObj){elemNodeName=self.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){self.elementObj.value=self.response}else{self.elementObj.innerHTML=self.response}}if(self.responseStatus[0]=="200"){self.onCompletion()}else{self.onError()}self.URLString="";break}};this.xmlhttp.send(this.URLString)}}};this.reset();this.createAJAX()};
\ No newline at end of file
diff --git a/wp-includes/js/wp-ajax-response.dev.js b/wp-includes/js/wp-ajax-response.dev.js
new file mode 100644 (file)
index 0000000..81483e2
--- /dev/null
@@ -0,0 +1,64 @@
+var wpAjax = jQuery.extend( {
+       unserialize: function( s ) {
+               var r = {}, q, pp, i, p;
+               if ( !s ) { return r; }
+               q = s.split('?'); if ( q[1] ) { s = q[1]; }
+               pp = s.split('&');
+               for ( i in pp ) {
+                       if ( jQuery.isFunction(pp.hasOwnProperty) && !pp.hasOwnProperty(i) ) { continue; }
+                       p = pp[i].split('=');
+                       r[p[0]] = p[1];
+               }
+               return r;
+       },
+       parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission
+               var parsed = {}, re = jQuery('#' + r).html(''), err = '';
+
+               if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) {
+                       parsed.responses = [];
+                       parsed.errors = false;
+                       jQuery('response', x).each( function() {
+                               var th = jQuery(this), child = jQuery(this.firstChild), response;
+                               response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') };
+                               response.data = jQuery( 'response_data', child ).text();
+                               response.supplemental = {};
+                               if ( !jQuery( 'supplemental', child ).children().each( function() {
+                                       response.supplemental[this.nodeName] = jQuery(this).text();
+                               } ).size() ) { response.supplemental = false }
+                               response.errors = [];
+                               if ( !jQuery('wp_error', child).each( function() {
+                                       var code = jQuery(this).attr('code'), anError, errorData, formField;
+                                       anError = { code: code, message: this.firstChild.nodeValue, data: false };
+                                       errorData = jQuery('wp_error_data[code="' + code + '"]', x);
+                                       if ( errorData ) { anError.data = errorData.get(); }
+                                       formField = jQuery( 'form-field', errorData ).text();
+                                       if ( formField ) { code = formField; }
+                                       if ( e ) { wpAjax.invalidateForm( jQuery('#' + e + ' :input[name="' + code + '"]' ).parents('.form-field:first') ); }
+                                       err += '<p>' + anError.message + '</p>';
+                                       response.errors.push( anError );
+                                       parsed.errors = true;
+                               } ).size() ) { response.errors = false; }
+                               parsed.responses.push( response );
+                       } );
+                       if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); }
+                       return parsed;
+               }
+               if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
+               x = parseInt(x,10);
+               if ( -1 == x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); }
+               else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken  + '</p></div>'); }
+               return true;
+       },
+       invalidateForm: function ( selector ) {
+               return jQuery( selector ).addClass( 'form-invalid' ).change( function() { jQuery(this).removeClass( 'form-invalid' ); } );
+       },
+       validateForm: function( selector ) {
+               selector = jQuery( selector );
+               return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() == ''; } ) ).size();
+       }
+}, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } );
+
+// Basic form validation
+jQuery(document).ready( function($){
+       $('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
+});
index d941f2179ef0cf9949a551b9990e6ec2d25bd014..9625a66c1af551235480b4deb2b6c1414b02b459 100644 (file)
@@ -1,60 +1 @@
-var wpAjax = jQuery.extend( {
-       unserialize: function( s ) {
-               var r = {}; if ( !s ) { return r; }
-               var q = s.split('?'); if ( q[1] ) { s = q[1]; }
-               var pp = s.split('&');
-               for ( var i in pp ) {
-                       if ( jQuery.isFunction(pp.hasOwnProperty) && !pp.hasOwnProperty(i) ) { continue; }
-                       var p = pp[i].split('=');
-                       r[p[0]] = p[1];
-               }
-               return r;
-       },
-       parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission
-               var parsed = {};
-               var re = jQuery('#' + r).html('');
-               if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) {
-                       parsed.responses = [];
-                       parsed.errors = false;
-                       var err = '';
-                       jQuery('response', x).each( function() {
-                               var th = jQuery(this);
-                               var child = jQuery(this.firstChild);
-                               var response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') };
-                               response.data = jQuery( 'response_data', child ).text();
-                               response.supplemental = {};
-                               if ( !jQuery( 'supplemental', child ).children().each( function() {
-                                       response.supplemental[this.nodeName] = jQuery(this).text();
-                               } ).size() ) { response.supplemental = false }
-                               response.errors = [];
-                               if ( !jQuery('wp_error', child).each( function() {
-                                       var code = jQuery(this).attr('code');
-                                       var anError = { code: code, message: this.firstChild.nodeValue, data: false };
-                                       var errorData = jQuery('wp_error_data[code="' + code + '"]', x);
-                                       if ( errorData ) { anError.data = errorData.get(); }
-                                       var formField = jQuery( 'form-field', errorData ).text();
-                                       if ( formField ) { code = formField; }
-                                       if ( e ) { wpAjax.invalidateForm( jQuery('#' + e + ' :input[name="' + code + '"]' ).parents('.form-field:first') ); }
-                                       err += '<p>' + anError.message + '</p>';
-                                       response.errors.push( anError );
-                                       parsed.errors = true;
-                               } ).size() ) { response.errors = false; }
-                               parsed.responses.push( response );
-                       } );
-                       if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); }
-                       return parsed;
-               }
-               if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
-               x = parseInt(x,10);
-               if ( -1 == x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); }
-               else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken  + '</p></div>'); }
-               return true;
-       },
-       invalidateForm: function ( selector ) {
-               return jQuery( selector ).addClass( 'form-invalid' ).change( function() { jQuery(this).removeClass( 'form-invalid' ); } );
-       },
-       validateForm: function( selector ) {
-               selector = jQuery( selector );
-               return !wpAjax.invalidateForm( selector.find('.form-required').andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]') ).size();
-       }
-}, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } );
+var wpAjax=jQuery.extend({unserialize:function(c){var d={},e,a,b,f;if(!c){return d}e=c.split("?");if(e[1]){c=e[1]}a=c.split("&");for(b in a){if(jQuery.isFunction(a.hasOwnProperty)&&!a.hasOwnProperty(b)){continue}f=a[b].split("=");d[f[0]]=f[1]}return d},parseAjaxResponse:function(a,f,g){var b={},c=jQuery("#"+f).html(""),d="";if(a&&typeof a=="object"&&a.getElementsByTagName("wp_ajax")){b.responses=[];b.errors=false;jQuery("response",a).each(function(){var h=jQuery(this),i=jQuery(this.firstChild),e;e={action:h.attr("action"),what:i.get(0).nodeName,id:i.attr("id"),oldId:i.attr("old_id"),position:i.attr("position")};e.data=jQuery("response_data",i).text();e.supplemental={};if(!jQuery("supplemental",i).children().each(function(){e.supplemental[this.nodeName]=jQuery(this).text()}).size()){e.supplemental=false}e.errors=[];if(!jQuery("wp_error",i).each(function(){var j=jQuery(this).attr("code"),m,l,k;m={code:j,message:this.firstChild.nodeValue,data:false};l=jQuery('wp_error_data[code="'+j+'"]',a);if(l){m.data=l.get()}k=jQuery("form-field",l).text();if(k){j=k}if(g){wpAjax.invalidateForm(jQuery("#"+g+' :input[name="'+j+'"]').parents(".form-field:first"))}d+="<p>"+m.message+"</p>";e.errors.push(m);b.errors=true}).size()){e.errors=false}b.responses.push(e)});if(d.length){c.html('<div class="error">'+d+"</div>")}return b}if(isNaN(a)){return !c.html('<div class="error"><p>'+a+"</p></div>")}a=parseInt(a,10);if(-1==a){return !c.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>")}else{if(0===a){return !c.html('<div class="error"><p>'+wpAjax.broken+"</p></div>")}}return true},invalidateForm:function(a){return jQuery(a).addClass("form-invalid").change(function(){jQuery(this).removeClass("form-invalid")})},validateForm:function(a){a=jQuery(a);return !wpAjax.invalidateForm(a.find(".form-required").filter(function(){return jQuery("input:visible",this).val()==""})).size()}},wpAjax||{noPerm:"You do not have permission to do that.",broken:"An unidentified error has occurred."});jQuery(document).ready(function(a){a("form.validate").submit(function(){return wpAjax.validateForm(a(this))})});
\ No newline at end of file
diff --git a/wp-includes/js/wp-lists.dev.js b/wp-includes/js/wp-lists.dev.js
new file mode 100644 (file)
index 0000000..ae17fc6
--- /dev/null
@@ -0,0 +1,357 @@
+(function($) {
+var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'}, wpList;
+
+wpList = {
+       settings: {
+               url: wpListL10n.url, type: 'POST',
+               response: 'ajax-response',
+
+               what: '',
+               alt: 'alternate', altOffset: 0,
+               addColor: null, delColor: null, dimAddColor: null, dimDelColor: null,
+
+               confirm: null,
+               addBefore: null, addAfter: null,
+               delBefore: null, delAfter: null,
+               dimBefore: null, dimAfter: null
+       },
+
+       nonce: function(e,s) {
+               var url = wpAjax.unserialize(e.attr('href'));
+               return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0;
+       },
+
+       parseClass: function(e,t) {
+               var c = [], cl;
+               try {
+                       cl = $(e).attr('class') || '';
+                       cl = cl.match(new RegExp(t+':[\\S]+'));
+                       if ( cl ) { c = cl[0].split(':'); }
+               } catch(r) {}
+               return c;
+       },
+
+       pre: function(e,s,a) {
+               var bg, r;
+               s = $.extend( {}, this.wpList.settings, {
+                       element: null,
+                       nonce: 0,
+                       target: e.get(0)
+               }, s || {} );
+               if ( $.isFunction( s.confirm ) ) {
+                       if ( 'add' != a ) {
+                               bg = $('#' + s.element).css('backgroundColor');
+                               $('#' + s.element).css('backgroundColor', '#FF9966');
+                       }
+                       r = s.confirm.call(this,e,s,a,bg);
+                       if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); }
+                       if ( !r ) { return false; }
+               }
+               return s;
+       },
+
+       ajaxAdd: function( e, s ) {
+               e = $(e);
+               s = s || {};
+               var list = this, cls = wpList.parseClass(e,'add'), es, valid, formData;
+               s = wpList.pre.call( list, e, s, 'add' );
+
+               s.element = cls[2] || e.attr( 'id' ) || s.element || null;
+               if ( cls[3] ) { s.addColor = '#' + cls[3]; }
+               else { s.addColor = s.addColor || '#FFFF33'; }
+
+               if ( !s ) { return false; }
+
+               if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); }
+
+               if ( !s.element ) { return true; }
+
+               s.action = 'add-' + s.what;
+
+               s.nonce = wpList.nonce(e,s);
+
+               es = $('#' + s.element + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]');
+               valid = wpAjax.validateForm( '#' + s.element );
+               if ( !valid ) { return false; }
+
+               s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) );
+               formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize();
+               if ( formData ) { s.data += '&' + formData; }
+
+               if ( $.isFunction(s.addBefore) ) {
+                       s = s.addBefore( s );
+                       if ( !s ) { return true; }
+               }
+               if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) ) { return true; }
+
+               s.success = function(r) {
+                       var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
+                       if ( !res || res.errors ) { return false; }
+
+                       if ( true === res ) { return true; }
+
+                       jQuery.each( res.responses, function() {
+                               wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue
+                                       pos: this.position || 0,
+                                       id: this.id || 0,
+                                       oldId: this.oldId || null
+                               } ) );
+                       } );
+
+                       if ( $.isFunction(s.addAfter) ) {
+                               o = this.complete;
+                               this.complete = function(x,st) {
+                                       var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+                                       s.addAfter( r, _s );
+                                       if ( $.isFunction(o) ) { o(x,st); }
+                               };
+                       }
+                       list.wpList.recolor();
+                       wpList.clear.call(list,'#' + s.element);
+               };
+
+               $.ajax( s );
+               return false;
+       },
+
+       ajaxDel: function( e, s ) {
+               e = $(e); s = s || {};
+               var list = this, cls = wpList.parseClass(e,'delete'), element, anim;
+               s = wpList.pre.call( list, e, s, 'delete' );
+
+               s.element = cls[2] || s.element || null;
+               if ( cls[3] ) { s.delColor = '#' + cls[3]; }
+               else { s.delColor = s.delColor || '#FF3333'; }
+
+               if ( !s || !s.element ) { return false; }
+
+               s.action = 'delete-' + s.what;
+
+               s.nonce = wpList.nonce(e,s);
+
+               s.data = $.extend(
+                       { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce },
+                       wpAjax.unserialize( cls[4] || '' )
+               );
+
+               if ( $.isFunction(s.delBefore) ) {
+                       s = s.delBefore( s );
+                       if ( !s ) { return true; }
+               }
+               if ( !s.data._ajax_nonce ) { return true; }
+
+               element = $('#' + s.element);
+
+               if ( 'none' != s.delColor ) {
+                       anim = 'slideUp';
+                       if ( element.css( 'display' ).match(/table/) )
+                               anim = 'fadeOut'; // Can't slideup table rows and other table elements.  Known jQuery bug
+                       element
+                               .animate( { backgroundColor: s.delColor }, 'fast'  )[anim]( 'fast' )
+                               .queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+               } else {
+                       list.wpList.recolor();
+               }
+
+               s.success = function(r) {
+                       var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
+                       if ( !res || res.errors ) {
+                               element.stop().stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+                               return false;
+                       }
+                       if ( $.isFunction(s.delAfter) ) {
+                               o = this.complete;
+                               this.complete = function(x,st) {
+                                       element.queue( function() {
+                                               var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+                                               s.delAfter( r, _s );
+                                               if ( $.isFunction(o) ) { o(x,st); }
+                                       } ).dequeue();
+                               };
+                       }
+               };
+               $.ajax( s );
+               return false;
+       },
+
+       ajaxDim: function( e, s ) {
+               if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys
+                       return false;
+               e = $(e); s = s || {};
+               var list = this, cls = wpList.parseClass(e,'dim'), element, isClass, color, dimColor;
+               s = wpList.pre.call( list, e, s, 'dim' );
+
+               s.element = cls[2] || s.element || null;
+               s.dimClass =  cls[3] || s.dimClass || null;
+               if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; }
+               else { s.dimAddColor = s.dimAddColor || '#FFFF33'; }
+               if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; }
+               else { s.dimDelColor = s.dimDelColor || '#FF3333'; }
+
+               if ( !s || !s.element || !s.dimClass ) { return true; }
+
+               s.action = 'dim-' + s.what;
+
+               s.nonce = wpList.nonce(e,s);
+
+               s.data = $.extend(
+                       { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce },
+                       wpAjax.unserialize( cls[6] || '' )
+               );
+
+               if ( $.isFunction(s.dimBefore) ) {
+                       s = s.dimBefore( s );
+                       if ( !s ) { return true; }
+               }
+
+               element = $('#' + s.element);
+               isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
+               color = wpList.getColor( element );
+               element.toggleClass( s.dimClass )
+               dimColor = isClass ? s.dimAddColor : s.dimDelColor;
+               if ( 'none' != dimColor ) {
+                       element
+                               .animate( { backgroundColor: dimColor }, 'fast' )
+                               .queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } )
+                               .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+               }
+
+               if ( !s.data._ajax_nonce ) { return true; }
+
+               s.success = function(r) {
+                       var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
+                       if ( !res || res.errors ) {
+                               element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+                               return false;
+                       }
+                       if ( $.isFunction(s.dimAfter) ) {
+                               o = this.complete;
+                               this.complete = function(x,st) {
+                                       element.queue( function() {
+                                               var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+                                               s.dimAfter( r, _s );
+                                               if ( $.isFunction(o) ) { o(x,st); }
+                                       } ).dequeue();
+                               };
+                       }
+               };
+
+               $.ajax( s );
+               return false;
+       },
+
+       // From jquery.color.js: jQuery Color Animation by John Resig
+       getColor: function( el ) {
+               if ( el.constructor == Object )
+                       el = el.get(0);
+               var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" );
+               do {
+                       color = jQuery.curCSS(elem, 'backgroundColor');
+                       if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") )
+                               break;
+               } while ( elem = elem.parentNode );
+               return color || '#ffffff';
+       },
+
+       add: function( e, s ) {
+               e = $(e);
+
+               var list = $(this), old = false, _s = { pos: 0, id: 0, oldId: null }, ba, ref, color;
+               if ( 'string' == typeof s ) { s = { what: s }; }
+               s = $.extend(_s, this.wpList.settings, s);
+               if ( !e.size() || !s.what ) { return false; }
+               if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); }
+               if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); }
+
+               if ( old && old.size() ) {
+                       old.before(e);
+                       old.remove();
+               } else if ( isNaN(s.pos) ) {
+                       ba = 'after';
+                       if ( '-' == s.pos.substr(0,1) ) {
+                               s.pos = s.pos.substr(1);
+                               ba = 'before';
+                       }
+                       ref = list.find( '#' + s.pos );
+                       if ( 1 === ref.size() ) { ref[ba](e); }
+                       else { list.append(e); }
+               } else if ( s.pos < 0 ) {
+                       list.prepend(e);
+               } else {
+                       list.append(e);
+               }
+
+               if ( s.alt ) {
+                       if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); }
+                       else { e.addClass( s.alt ); }
+               }
+
+               if ( 'none' != s.addColor ) {
+                       color = wpList.getColor( e );
+                       e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+               }
+               list.each( function() { this.wpList.process( e ); } );
+               return e;
+       },
+
+       clear: function(e) {
+               var list = this, t, tag;
+               e = $(e);
+               if ( list.wpList && e.parents( '#' + list.id ).size() ) { return; }
+               e.find(':input').each( function() {
+                       if ( $(this).parents('.form-no-clear').size() )
+                               return;
+                       t = this.type.toLowerCase();
+                       tag = this.tagName.toLowerCase();
+                       if ( 'text' == t || 'password' == t || 'textarea' == tag ) { this.value = ''; }
+                       else if ( 'checkbox' == t || 'radio' == t ) { this.checked = false; }
+                       else if ( 'select' == tag ) { this.selectedIndex = null; }
+               });
+       },
+
+       process: function(el) {
+               var list = this;
+               $("[class^=add:" + list.id + ":]", el || null)
+                       .filter('form').submit( function() { return list.wpList.add(this); } ).end()
+                       .not('form').click( function() { return list.wpList.add(this); } );
+               $("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } );
+               $("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } );
+       },
+
+       recolor: function() {
+               var list = this, items, eo;
+               if ( !list.wpList.settings.alt ) { return; }
+               items = $('.list-item:visible', list);
+               if ( !items.size() ) { items = $(list).children(':visible'); }
+               eo = [':even',':odd'];
+               if ( list.wpList.settings.altOffset % 2 ) { eo.reverse(); }
+               items.filter(eo[0]).addClass(list.wpList.settings.alt).end().filter(eo[1]).removeClass(list.wpList.settings.alt);
+       },
+
+       init: function() {
+               var lists = this;
+               lists.wpList.process = function(a) {
+                       lists.each( function() {
+                               this.wpList.process(a);
+                       } );
+               };
+               lists.wpList.recolor = function() {
+                       lists.each( function() {
+                               this.wpList.recolor();
+                       } );
+               };
+       }
+};
+
+$.fn.wpList = function( settings ) {
+       this.each( function() {
+               var _this = this;
+               this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseClass(this,'list')[1] || '' }, settings ) };
+               $.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } );
+       } );
+       wpList.init.call(this);
+       this.wpList.process();
+       return this;
+};
+
+})(jQuery);
index 128cf157a2047ce8c33ef7e4f84f9eb7725b8004..34af57e336c76b51b800d9c6bde203cfbedf262d 100644 (file)
@@ -1,374 +1 @@
-(function($) {
-var currentFormEl = false;
-var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'};
-
-var wpList = {
-       settings: {
-               url: wpListL10n.url, type: 'POST',
-               response: 'ajax-response',
-
-               what: '',
-               alt: 'alternate', altOffset: 0,
-               addColor: null, delColor: null, dimAddColor: null, dimDelColor: null,
-
-               confirm: null,
-               addBefore: null, addAfter: null,
-               delBefore: null, delAfter: null,
-               dimBefore: null, dimAfter: null
-       },
-
-       nonce: function(e,s) {
-               var url = wpAjax.unserialize(e.attr('href'));
-               return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name=_ajax_nonce]').val() || url._wpnonce || $('#' + s.element + ' input[name=_wpnonce]').val() || 0;
-       },
-
-       parseClass: function(e,t) {
-               var c = [], cl;
-               try {
-                       cl = $(e).attr('class') || '';
-                       cl = cl.match(new RegExp(t+':[\\S]+'));
-                       if ( cl ) { c = cl[0].split(':'); }
-               } catch(r) {}
-               return c;
-       },
-
-       pre: function(e,s,a) {
-               var bg; var r;
-               s = $.extend( {}, this.wpList.settings, {
-                       element: null,
-                       nonce: 0,
-                       target: e.get(0)
-               }, s || {} );
-               if ( $.isFunction( s.confirm ) ) {
-                       if ( 'add' != a ) {
-                               bg = $('#' + s.element).css('backgroundColor');
-                               $('#' + s.element).css('backgroundColor', '#FF9966');
-                       }
-                       r = s.confirm.call(this,e,s,a,bg);
-                       if ( 'add' != a ) { $('#' + s.element).css('backgroundColor', bg ); }
-                       if ( !r ) { return false; }
-               }
-               return s;
-       },
-
-       ajaxAdd: function( e, s ) {
-               var list = this; e = $(e); s = s || {};
-               var cls = wpList.parseClass(e,'add');
-               s = wpList.pre.call( list, e, s, 'add' );
-
-               s.element = cls[2] || e.attr( 'id' ) || s.element || null;
-               if ( cls[3] ) { s.addColor = '#' + cls[3]; }
-               else { s.addColor = s.addColor || '#FFFF33'; }
-
-               if ( !s ) { return false; }
-
-               if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); }
-
-               if ( !s.element ) { return true; }
-
-               s.action = 'add-' + s.what;
-
-               s.nonce = wpList.nonce(e,s);
-
-               var es = $('#' + s.element + ' :input').not('[name=_ajax_nonce], [name=_wpnonce], [name=action]');
-               var valid = wpAjax.validateForm( '#' + s.element );
-               if ( !valid ) { return false; }
-
-               s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) );
-               var formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize();
-               if ( formData ) { s.data += '&' + formData; }
-
-               if ( $.isFunction(s.addBefore) ) {
-                       s = s.addBefore( s );
-                       if ( !s ) { return true; }
-               }
-               if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) ) { return true; }
-
-               s.success = function(r) {
-                       var res = wpAjax.parseAjaxResponse(r, s.response, s.element);
-                       if ( !res || res.errors ) { return false; }
-
-                       if ( true === res ) { return true; }
-
-                       jQuery.each( res.responses, function() {
-                               wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue
-                                       pos: this.position || 0,
-                                       id: this.id || 0,
-                                       oldId: this.oldId || null
-                               } ) );
-                       } );
-
-                       if ( $.isFunction(s.addAfter) ) {
-                               var o = this.complete;
-                               this.complete = function(x,st) {
-                                       var _s = $.extend( { xml: x, status: st, parsed: res }, s );
-                                       s.addAfter( r, _s );
-                                       if ( $.isFunction(o) ) { o(x,st); }
-                               };
-                       }
-                       list.wpList.recolor();
-                       wpList.clear.call(list,'#' + s.element);
-               };
-
-               $.ajax( s );
-               return false;
-       },
-
-       ajaxDel: function( e, s ) {
-               var list = this; e = $(e); s = s || {};
-               var cls = wpList.parseClass(e,'delete');
-               s = wpList.pre.call( list, e, s, 'delete' );
-
-               s.element = cls[2] || s.element || null;
-               if ( cls[3] ) { s.delColor = '#' + cls[3]; }
-               else { s.delColor = s.delColor || '#FF3333'; }
-
-               if ( !s || !s.element ) { return false; }
-
-               s.action = 'delete-' + s.what;
-
-               s.nonce = wpList.nonce(e,s);
-
-               s.data = $.extend(
-                       { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce },
-                       wpAjax.unserialize( cls[4] || '' )
-               );
-
-               if ( $.isFunction(s.delBefore) ) {
-                       s = s.delBefore( s );
-                       if ( !s ) { return true; }
-               }
-               if ( !s.data._ajax_nonce ) { return true; }
-
-               var element = $('#' + s.element);
-
-               if ( 'none' != s.delColor ) {
-                       var anim = 'slideUp';
-                       if ( element.css( 'display' ).match(/table/) )
-                               anim = 'fadeOut'; // Can't slideup table rows and other table elements.  Known jQuery bug
-                       element
-                               .animate( { backgroundColor: s.delColor }, 'fast'  )[anim]( 'fast' )
-                               .queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
-               } else {
-                       list.wpList.recolor();
-               }
-
-               s.success = function(r) {
-                       var res = wpAjax.parseAjaxResponse(r, s.response, s.element);
-                       if ( !res || res.errors ) {
-                               element.stop().stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
-                               return false;
-                       }
-                       if ( $.isFunction(s.delAfter) ) {
-                               var o = this.complete;
-                               this.complete = function(x,st) {
-                                       element.queue( function() {
-                                               var _s = $.extend( { xml: x, status: st, parsed: res }, s );
-                                               s.delAfter( r, _s );
-                                               if ( $.isFunction(o) ) { o(x,st); }
-                                       } ).dequeue();
-                               };
-                       }
-               };
-               $.ajax( s );
-               return false;
-       },
-
-       ajaxDim: function( e, s ) {
-               if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys
-                       return false;
-               var list = this; e = $(e); s = s || {};
-               var cls = wpList.parseClass(e,'dim');
-               s = wpList.pre.call( list, e, s, 'dim' );
-
-               s.element = cls[2] || s.element || null;
-               s.dimClass =  cls[3] || s.dimClass || null;
-               if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; }
-               else { s.dimAddColor = s.dimAddColor || '#FFFF33'; }
-               if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; }
-               else { s.dimDelColor = s.dimDelColor || '#FF3333'; }
-
-               if ( !s || !s.element || !s.dimClass ) { return true; }
-
-               s.action = 'dim-' + s.what;
-
-               s.nonce = wpList.nonce(e,s);
-
-               s.data = $.extend(
-                       { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce },
-                       wpAjax.unserialize( cls[6] || '' )
-               );
-
-               if ( $.isFunction(s.dimBefore) ) {
-                       s = s.dimBefore( s );
-                       if ( !s ) { return true; }
-               }
-
-               var element = $('#' + s.element);
-               var isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
-               var color = wpList.getColor( element );
-               element.toggleClass( s.dimClass )
-               var dimColor = isClass ? s.dimAddColor : s.dimDelColor;
-               if ( 'none' != dimColor ) {
-                       element
-                               .animate( { backgroundColor: dimColor }, 'fast' )
-                               .queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } )
-                               .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
-               }
-
-               if ( !s.data._ajax_nonce ) { return true; }
-
-               s.success = function(r) {
-                       var res = wpAjax.parseAjaxResponse(r, s.response, s.element);
-                       if ( !res || res.errors ) {
-                               element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
-                               return false;
-                       }
-                       if ( $.isFunction(s.dimAfter) ) {
-                               var o = this.complete;
-                               this.complete = function(x,st) {
-                                       element.queue( function() {
-                                               var _s = $.extend( { xml: x, status: st, parsed: res }, s );
-                                               s.dimAfter( r, _s );
-                                               if ( $.isFunction(o) ) { o(x,st); }
-                                       } ).dequeue();
-                               };
-                       }
-               };
-
-               $.ajax( s );
-               return false;
-       },
-
-       // From jquery.color.js: jQuery Color Animation by John Resig
-       getColor: function( el ) {
-               if ( el.constructor == Object )
-                       el = el.get(0);
-               var elem = el, color, rgbaTrans = new RegExp( "rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)", "i" );
-               do {
-                       color = jQuery.curCSS(elem, 'backgroundColor');
-                       if ( color != '' && color != 'transparent' && !color.match(rgbaTrans) || jQuery.nodeName(elem, "body") )
-                               break;
-               } while ( elem = elem.parentNode );
-               return color || '#ffffff';
-       },
-
-       add: function( e, s ) {
-               var list = $(this);
-               e = $(e);
-
-               var old = false;
-               var _s = { pos: 0, id: 0, oldId: null };
-               if ( 'string' == typeof s ) { s = { what: s }; }
-               s = $.extend(_s, this.wpList.settings, s);
-               if ( !e.size() || !s.what ) { return false; }
-               if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); }
-               if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); }
-
-               if ( old && old.size() ) {
-                       old.replaceWith(e);
-               } else if ( isNaN(s.pos) ) {
-                       var ba = 'after';
-                       if ( '-' == s.pos.substr(0,1) ) {
-                               s.pos = s.pos.substr(1);
-                               ba = 'before';
-                       }
-                       var ref = list.find( '#' + s.pos );
-                       if ( 1 === ref.size() ) { ref[ba](e); }
-                       else { list.append(e); }
-               } else if ( s.pos < 0 ) {
-                       list.prepend(e);
-               } else {
-                       list.append(e);
-               }
-
-               if ( s.alt ) {
-                       if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); }
-                       else { e.addClass( s.alt ); }
-               }
-
-               if ( 'none' != s.addColor ) {
-                       var color = wpList.getColor( e );
-                       e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
-               }
-               list.each( function() { this.wpList.process( e ); } );
-               return e;
-       },
-
-       clear: function(e) {
-               var list = this;
-               e = $(e);
-               if ( list.wpList && e.parents( '#' + list.id ).size() ) { return; }
-               e.find(':input').each( function() {
-                       if ( $(this).parents('.form-no-clear').size() )
-                               return;
-                       var t = this.type.toLowerCase(); var tag = this.tagName.toLowerCase();
-                       if ( 'text' == t || 'password' == t || 'textarea' == tag ) { this.value = ''; }
-                       else if ( 'checkbox' == t || 'radio' == t ) { this.checked = false; }
-                       else if ( 'select' == tag ) { this.selectedIndex = null; }
-               });
-       },
-
-       process: function(el) {
-               var list = this;
-               $("[class^=add:" + list.id + ":]", el || null)
-                       .filter('form').submit( function() { return list.wpList.add(this); } ).end()
-                       .not('form').click( function() { return list.wpList.add(this); } ).each( function() {
-                               var addEl = this;
-                               var c = wpList.parseClass(this,'add')[2] || addEl.id;
-                               if ( !c ) { return; }
-                               var forms = []; var ins = []; // this is all really inefficient
-                               $('#' + c + ' :input').focus( function() { currentFormEl = this; } ).blur( function() { currentFormEl = false; } ).each( function() {
-                                       ins.push(this);
-                                       var f = $(this).parents('form:first').get(0);
-                                       if ( $.inArray(f,forms) < 0 ) { forms.push(f); }
-                               } );
-                               $(forms).submit( function() {
-                                       if ( 0 <= $.inArray(currentFormEl,ins) ) {
-                                               $(addEl).trigger( 'click' );
-                                               $(currentFormEl).focus();
-                                               return false;
-                                       }
-                               } );
-                       } );
-               $("[class^=delete:" + list.id + ":]", el || null).click( function() { return list.wpList.del(this); } );
-               $("[class^=dim:" + list.id + ":]", el || null).click( function() { return list.wpList.dim(this); } );
-       },
-
-       recolor: function() {
-               var list = this;
-               if ( !list.wpList.settings.alt ) { return; }
-               var items = $('.list-item:visible', list);
-               if ( !items.size() ) { items = $(list).children(':visible'); }
-               var eo = [':even',':odd'];
-               if ( list.wpList.settings.altOffset % 2 ) { eo.reverse(); }
-               items.filter(eo[0]).addClass(list.wpList.settings.alt).end().filter(eo[1]).removeClass(list.wpList.settings.alt);
-       },
-
-       init: function() {
-               var lists = this;
-               lists.wpList.process = function(a) {
-                       lists.each( function() {
-                               this.wpList.process(a);
-                       } );
-               };
-               lists.wpList.recolor = function() {
-                       lists.each( function() {
-                               this.wpList.recolor();
-                       } );
-               };
-       }
-};
-
-$.fn.wpList = function( settings ) {
-       this.each( function() {
-               var _this = this;
-               this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseClass(this,'list')[1] || '' }, settings ) };
-               $.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } );
-       } );
-       wpList.init.call(this);
-       this.wpList.process();
-       return this;
-};
-
-})(jQuery);
+(function(b){var a={add:"ajaxAdd",del:"ajaxDel",dim:"ajaxDim",process:"process",recolor:"recolor"},c;c={settings:{url:wpListL10n.url,type:"POST",response:"ajax-response",what:"",alt:"alternate",altOffset:0,addColor:null,delColor:null,dimAddColor:null,dimDelColor:null,confirm:null,addBefore:null,addAfter:null,delBefore:null,delAfter:null,dimBefore:null,dimAfter:null},nonce:function(g,f){var d=wpAjax.unserialize(g.attr("href"));return f.nonce||d._ajax_nonce||b("#"+f.element+" input[name=_ajax_nonce]").val()||d._wpnonce||b("#"+f.element+" input[name=_wpnonce]").val()||0},parseClass:function(h,f){var i=[],d;try{d=b(h).attr("class")||"";d=d.match(new RegExp(f+":[\\S]+"));if(d){i=d[0].split(":")}}catch(g){}return i},pre:function(i,g,d){var f,h;g=b.extend({},this.wpList.settings,{element:null,nonce:0,target:i.get(0)},g||{});if(b.isFunction(g.confirm)){if("add"!=d){f=b("#"+g.element).css("backgroundColor");b("#"+g.element).css("backgroundColor","#FF9966")}h=g.confirm.call(this,i,g,d,f);if("add"!=d){b("#"+g.element).css("backgroundColor",f)}if(!h){return false}}return g},ajaxAdd:function(j,f){j=b(j);f=f||{};var h=this,d=c.parseClass(j,"add"),k,g,i;f=c.pre.call(h,j,f,"add");f.element=d[2]||j.attr("id")||f.element||null;if(d[3]){f.addColor="#"+d[3]}else{f.addColor=f.addColor||"#FFFF33"}if(!f){return false}if(!j.is("[class^=add:"+h.id+":]")){return !c.add.call(h,j,f)}if(!f.element){return true}f.action="add-"+f.what;f.nonce=c.nonce(j,f);k=b("#"+f.element+" :input").not("[name=_ajax_nonce], [name=_wpnonce], [name=action]");g=wpAjax.validateForm("#"+f.element);if(!g){return false}f.data=b.param(b.extend({_ajax_nonce:f.nonce,action:f.action},wpAjax.unserialize(d[4]||"")));i=b.isFunction(k.fieldSerialize)?k.fieldSerialize():k.serialize();if(i){f.data+="&"+i}if(b.isFunction(f.addBefore)){f=f.addBefore(f);if(!f){return true}}if(!f.data.match(/_ajax_nonce=[a-f0-9]+/)){return true}f.success=function(l){var e=wpAjax.parseAjaxResponse(l,f.response,f.element),m;if(!e||e.errors){return false}if(true===e){return true}jQuery.each(e.responses,function(){c.add.call(h,this.data,b.extend({},f,{pos:this.position||0,id:this.id||0,oldId:this.oldId||null}))});if(b.isFunction(f.addAfter)){m=this.complete;this.complete=function(n,o){var p=b.extend({xml:n,status:o,parsed:e},f);f.addAfter(l,p);if(b.isFunction(m)){m(n,o)}}}h.wpList.recolor();c.clear.call(h,"#"+f.element)};b.ajax(f);return false},ajaxDel:function(j,g){j=b(j);g=g||{};var i=this,d=c.parseClass(j,"delete"),f,h;g=c.pre.call(i,j,g,"delete");g.element=d[2]||g.element||null;if(d[3]){g.delColor="#"+d[3]}else{g.delColor=g.delColor||"#FF3333"}if(!g||!g.element){return false}g.action="delete-"+g.what;g.nonce=c.nonce(j,g);g.data=b.extend({action:g.action,id:g.element.split("-").pop(),_ajax_nonce:g.nonce},wpAjax.unserialize(d[4]||""));if(b.isFunction(g.delBefore)){g=g.delBefore(g);if(!g){return true}}if(!g.data._ajax_nonce){return true}f=b("#"+g.element);if("none"!=g.delColor){h="slideUp";if(f.css("display").match(/table/)){h="fadeOut"}f.animate({backgroundColor:g.delColor},"fast")[h]("fast").queue(function(){i.wpList.recolor();b(this).dequeue()})}else{i.wpList.recolor()}g.success=function(k){var e=wpAjax.parseAjaxResponse(k,g.response,g.element),l;if(!e||e.errors){f.stop().stop().css("backgroundColor","#FF3333").show().queue(function(){i.wpList.recolor();b(this).dequeue()});return false}if(b.isFunction(g.delAfter)){l=this.complete;this.complete=function(m,n){f.queue(function(){var o=b.extend({xml:m,status:n,parsed:e},g);g.delAfter(k,o);if(b.isFunction(l)){l(m,n)}}).dequeue()}}};b.ajax(g);return false},ajaxDim:function(k,h){if(b(k).parent().css("display")=="none"){return false}k=b(k);h=h||{};var j=this,d=c.parseClass(k,"dim"),g,l,f,i;h=c.pre.call(j,k,h,"dim");h.element=d[2]||h.element||null;h.dimClass=d[3]||h.dimClass||null;if(d[4]){h.dimAddColor="#"+d[4]}else{h.dimAddColor=h.dimAddColor||"#FFFF33"}if(d[5]){h.dimDelColor="#"+d[5]}else{h.dimDelColor=h.dimDelColor||"#FF3333"}if(!h||!h.element||!h.dimClass){return true}h.action="dim-"+h.what;h.nonce=c.nonce(k,h);h.data=b.extend({action:h.action,id:h.element.split("-").pop(),dimClass:h.dimClass,_ajax_nonce:h.nonce},wpAjax.unserialize(d[6]||""));if(b.isFunction(h.dimBefore)){h=h.dimBefore(h);if(!h){return true}}g=b("#"+h.element);l=g.toggleClass(h.dimClass).is("."+h.dimClass);f=c.getColor(g);g.toggleClass(h.dimClass);i=l?h.dimAddColor:h.dimDelColor;if("none"!=i){g.animate({backgroundColor:i},"fast").queue(function(){g.toggleClass(h.dimClass);b(this).dequeue()}).animate({backgroundColor:f},{complete:function(){b(this).css("backgroundColor","")}})}if(!h.data._ajax_nonce){return true}h.success=function(m){var e=wpAjax.parseAjaxResponse(m,h.response,h.element),n;if(!e||e.errors){g.stop().stop().css("backgroundColor","#FF3333")[l?"removeClass":"addClass"](h.dimClass).show().queue(function(){j.wpList.recolor();b(this).dequeue()});return false}if(b.isFunction(h.dimAfter)){n=this.complete;this.complete=function(o,p){g.queue(function(){var q=b.extend({xml:o,status:p,parsed:e},h);h.dimAfter(m,q);if(b.isFunction(n)){n(o,p)}}).dequeue()}}};b.ajax(h);return false},getColor:function(e){if(e.constructor==Object){e=e.get(0)}var f=e,d,g=new RegExp("rgba\\(\\s*0,\\s*0,\\s*0,\\s*0\\s*\\)","i");do{d=jQuery.curCSS(f,"backgroundColor");if(d!=""&&d!="transparent"&&!d.match(g)||jQuery.nodeName(f,"body")){break}}while(f=f.parentNode);return d||"#ffffff"},add:function(k,g){k=b(k);var i=b(this),d=false,j={pos:0,id:0,oldId:null},l,h,f;if("string"==typeof g){g={what:g}}g=b.extend(j,this.wpList.settings,g);if(!k.size()||!g.what){return false}if(g.oldId){d=b("#"+g.what+"-"+g.oldId)}if(g.id&&(g.id!=g.oldId||!d||!d.size())){b("#"+g.what+"-"+g.id).remove()}if(d&&d.size()){d.before(k);d.remove()}else{if(isNaN(g.pos)){l="after";if("-"==g.pos.substr(0,1)){g.pos=g.pos.substr(1);l="before"}h=i.find("#"+g.pos);if(1===h.size()){h[l](k)}else{i.append(k)}}else{if(g.pos<0){i.prepend(k)}else{i.append(k)}}}if(g.alt){if((i.children(":visible").index(k[0])+g.altOffset)%2){k.removeClass(g.alt)}else{k.addClass(g.alt)}}if("none"!=g.addColor){f=c.getColor(k);k.css("backgroundColor",g.addColor).animate({backgroundColor:f},{complete:function(){b(this).css("backgroundColor","")}})}i.each(function(){this.wpList.process(k)});return k},clear:function(h){var g=this,f,d;h=b(h);if(g.wpList&&h.parents("#"+g.id).size()){return}h.find(":input").each(function(){if(b(this).parents(".form-no-clear").size()){return}f=this.type.toLowerCase();d=this.tagName.toLowerCase();if("text"==f||"password"==f||"textarea"==d){this.value=""}else{if("checkbox"==f||"radio"==f){this.checked=false}else{if("select"==d){this.selectedIndex=null}}}})},process:function(d){var e=this;b("[class^=add:"+e.id+":]",d||null).filter("form").submit(function(){return e.wpList.add(this)}).end().not("form").click(function(){return e.wpList.add(this)});b("[class^=delete:"+e.id+":]",d||null).click(function(){return e.wpList.del(this)});b("[class^=dim:"+e.id+":]",d||null).click(function(){return e.wpList.dim(this)})},recolor:function(){var f=this,e,d;if(!f.wpList.settings.alt){return}e=b(".list-item:visible",f);if(!e.size()){e=b(f).children(":visible")}d=[":even",":odd"];if(f.wpList.settings.altOffset%2){d.reverse()}e.filter(d[0]).addClass(f.wpList.settings.alt).end().filter(d[1]).removeClass(f.wpList.settings.alt)},init:function(){var d=this;d.wpList.process=function(e){d.each(function(){this.wpList.process(e)})};d.wpList.recolor=function(){d.each(function(){this.wpList.recolor()})}}};b.fn.wpList=function(d){this.each(function(){var e=this;this.wpList={settings:b.extend({},c.settings,{what:c.parseClass(this,"list")[1]||""},d)};b.each(a,function(g,h){e.wpList[g]=function(i,f){return c[h].call(e,i,f)}})});c.init.call(this);this.wpList.process();return this}})(jQuery);
\ No newline at end of file
index ed03835b6626a0a1837ab79bebda822b42b067ff..335bc119c851f08738bb5151562702a9b8892352 100644 (file)
@@ -38,22 +38,15 @@ function get_locale() {
        if (empty($locale))
                $locale = 'en_US';
 
        if (empty($locale))
                $locale = 'en_US';
 
-       $locale = apply_filters('locale', $locale);
-
-       return $locale;
+       return apply_filters('locale', $locale);
 }
 
 /**
 }
 
 /**
- * Retrieve the translated text.
- *
- * If the domain is set in the $l10n global, then the text is run through the
- * domain's translate method. After it is passed to the 'gettext' filter hook,
- * along with the untranslated text as the second parameter.
- *
- * If the domain is not set, the $text is just returned.
+ * Retrieves the translation of $text. If there is no translation, or
+ * the domain isn't loaded the original text is returned.
  *
  *
+ * @see __() Don't use translate() directly, use __()
  * @since 2.2.0
  * @since 2.2.0
- * @uses $l10n Gets list of domain translated string (gettext_reader) objects.
  * @uses apply_filters() Calls 'gettext' on domain translated text
  *             with the untranslated text as second parameter.
  *
  * @uses apply_filters() Calls 'gettext' on domain translated text
  *             with the untranslated text as second parameter.
  *
@@ -61,13 +54,9 @@ function get_locale() {
  * @param string $domain Domain to retrieve the translated text.
  * @return string Translated text
  */
  * @param string $domain Domain to retrieve the translated text.
  * @return string Translated text
  */
-function translate($text, $domain = 'default') {
-       global $l10n;
-
-       if (isset($l10n[$domain]))
-               return apply_filters('gettext', $l10n[$domain]->translate($text), $text, $domain);
-       else
-               return apply_filters('gettext', $text, $text, $domain);
+function translate( $text, $domain = 'default' ) {
+       $translations = &get_translations_for_domain( $domain );
+       return apply_filters('gettext', $translations->translate($text), $text, $domain);
 }
 
 function before_last_bar( $string ) {
 }
 
 function before_last_bar( $string ) {
@@ -79,13 +68,8 @@ function before_last_bar( $string ) {
 }
 
 /**
 }
 
 /**
- * Retrieve the translated text and strip context.
- *
- * If the domain is set in the $l10n global, then the text is run through the
- * domain's translate method. After it is passed to the 'gettext' filter hook,
- * along with the untranslated text as the second parameter.
- *
- * If the domain is not set, the $text is just returned.
+ * Translates $text like translate(), but assumes that the text
+ * contains a context after its last vertical bar.
  *
  * @since 2.5
  * @uses translate()
  *
  * @since 2.5
  * @uses translate()
@@ -99,8 +83,14 @@ function translate_with_context( $text, $domain = 'default' ) {
 
 }
 
 
 }
 
+function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
+       $translations = &get_translations_for_domain( $domain );
+       return apply_filters( 'gettext_with_context', $translations->translate( $text, $context ), $text, $context, $domain);
+}
+
 /**
 /**
- * Retrieves the translated string from the translate().
+ * Retrieves the translation of $text. If there is no translation, or
+ * the domain isn't loaded the original text is returned.
  *
  * @see translate() An alias of translate()
  * @since 2.1.0
  *
  * @see translate() An alias of translate()
  * @since 2.1.0
@@ -109,25 +99,85 @@ function translate_with_context( $text, $domain = 'default' ) {
  * @param string $domain Optional. Domain to retrieve the translated text
  * @return string Translated text
  */
  * @param string $domain Optional. Domain to retrieve the translated text
  * @return string Translated text
  */
-function __($text, $domain = 'default') {
-       return translate($text, $domain);
+function __( $text, $domain = 'default' ) {
+       return translate( $text, $domain );
+}
+
+/**
+ * Retrieves the translation of $text and escapes it for safe use in an attribute.
+ * If there is no translation, or the domain isn't loaded the original text is returned.
+ *
+ * @see translate() An alias of translate()
+ * @see esc_attr()
+ * @since 2.8.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function esc_attr__( $text, $domain = 'default' ) {
+       return esc_attr( translate( $text, $domain ) );
+}
+
+/**
+ * Retrieves the translation of $text and escapes it for safe use in HTML output.
+ * If there is no translation, or the domain isn't loaded the original text is returned.
+ *
+ * @see translate() An alias of translate()
+ * @see esc_html()
+ * @since 2.8.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function esc_html__( $text, $domain = 'default' ) {
+       return esc_html( translate( $text, $domain ) );
 }
 
 /**
  * Displays the returned translated text from translate().
  *
 }
 
 /**
  * Displays the returned translated text from translate().
  *
- * @see translate() Echos returned translate() string
+ * @see translate() Echoes returned translate() string
  * @since 1.2.0
  *
  * @param string $text Text to translate
  * @param string $domain Optional. Domain to retrieve the translated text
  */
  * @since 1.2.0
  *
  * @param string $text Text to translate
  * @param string $domain Optional. Domain to retrieve the translated text
  */
-function _e($text, $domain = 'default') {
-       echo translate($text, $domain);
+function _e( $text, $domain = 'default' ) {
+       echo translate( $text, $domain );
+}
+
+/**
+ * Displays translated text that has been escaped for safe use in an attribute.
+ *
+ * @see translate() Echoes returned translate() string
+ * @see esc_attr()
+ * @since 2.8.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ */
+function esc_attr_e( $text, $domain = 'default' ) {
+       echo esc_attr( translate( $text, $domain ) );
+}
+
+/**
+ * Displays translated text that has been escaped for safe use in HTML output.
+ *
+ * @see translate() Echoes returned translate() string
+ * @see esc_html()
+ * @since 2.8.0
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ */
+function esc_html_e( $text, $domain = 'default' ) {
+       echo esc_html( translate( $text, $domain ) );
 }
 
 /**
 }
 
 /**
- * Retrieve context translated string.
+ * Retrieve translated string with vertical bar context
  *
  * Quite a few times, there will be collisions with similar translatable text
  * found in more than two places but with different translated context.
  *
  * Quite a few times, there will be collisions with similar translatable text
  * found in more than two places but with different translated context.
@@ -149,10 +199,24 @@ function _c($text, $domain = 'default') {
        return translate_with_context($text, $domain);
 }
 
        return translate_with_context($text, $domain);
 }
 
+function _x( $single, $context, $domain = 'default' ) {
+       return translate_with_gettext_context( $single, $context, $domain );
+}
+
+function esc_attr_x( $single, $context, $domain = 'default' ) {
+       return esc_attr( translate_with_gettext_context( $single, $context, $domain ) );
+}
+
+function __ngettext() {
+       _deprecated_function( __FUNCTION__, '2.8', '_n()' );
+       $args = func_get_args();
+       return call_user_func_array('_n', $args);
+}
+
 /**
  * Retrieve the plural or single form based on the amount.
  *
 /**
  * Retrieve the plural or single form based on the amount.
  *
- * If the domain is not set in the $l10n list, then a comparsion will be made
+ * If the domain is not set in the $l10n list, then a comparison will be made
  * and either $plural or $single parameters returned.
  *
  * If the domain does exist, then the parameters $single, $plural, and $number
  * and either $plural or $single parameters returned.
  *
  * If the domain does exist, then the parameters $single, $plural, and $number
@@ -171,35 +235,35 @@ function _c($text, $domain = 'default') {
  * @param string $domain Optional. The domain identifier the text should be retrieved in
  * @return string Either $single or $plural translated text
  */
  * @param string $domain Optional. The domain identifier the text should be retrieved in
  * @return string Either $single or $plural translated text
  */
-function __ngettext($single, $plural, $number, $domain = 'default') {
-       global $l10n;
-
-       if (isset($l10n[$domain])) {
-               return apply_filters('ngettext', $l10n[$domain]->ngettext($single, $plural, $number), $single, $plural, $number);
-       } else {
-               if ($number != 1)
-                       return $plural;
-               else
-                       return $single;
-       }
+function _n($single, $plural, $number, $domain = 'default') {
+       $translations = &get_translations_for_domain( $domain );
+       $translation = $translations->translate_plural( $single, $plural, $number );
+       return apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
 }
 
 /**
 }
 
 /**
- * @see __ngettext() An alias of __ngettext
+ * @see _n() A version of _n(), which supports contexts --
+ * strips everything from the translation after the last bar
  *
  */
  *
  */
-function _n() {
-       $args = func_get_args();
-       return call_user_func_array('__ngettext', $args);
+function _nc( $single, $plural, $number, $domain = 'default' ) {
+       return before_last_bar( _n( $single, $plural, $number, $domain ) );
+}
+
+function _nx($single, $plural, $number, $context, $domain = 'default') {
+       $translations = &get_translations_for_domain( $domain );
+       $translation = $translations->translate_plural( $single, $plural, $number, $context );
+       return apply_filters( 'ngettext_with_context ', $translation, $single, $plural, $number, $context, $domain );
 }
 
 /**
 }
 
 /**
- * @see _n() A version of _n(), which supports contexts --
- * strips everything from the translation after the last bar
- *
+ * @deprecated Use _n_noop()
  */
  */
-function _nc( $single, $plural, $number, $domain = 'default' ) {
-       return before_last_bar( __ngettext( $single, $plural, $number, $domain ) );
+function __ngettext_noop() {
+       _deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
+       $args = func_get_args();
+       return call_user_func_array('_n_noop', $args);
+
 }
 
 /**
 }
 
 /**
@@ -210,41 +274,40 @@ function _nc( $single, $plural, $number, $domain = 'default' ) {
  *
  * Example:
  *  $messages = array(
  *
  * Example:
  *  $messages = array(
- *     'post' => ngettext_noop('%s post', '%s posts'),
- *     'page' => ngettext_noop('%s pages', '%s pages')
+ *     'post' => _n_noop('%s post', '%s posts'),
+ *     'page' => _n_noop('%s pages', '%s pages')
  *  );
  *  ...
  *  $message = $messages[$type];
  *  );
  *  ...
  *  $message = $messages[$type];
- *  $usable_text = sprintf(__ngettext($message[0], $message[1], $count), $count);
+ *  $usable_text = sprintf(_n($message[0], $message[1], $count), $count);
  *
  * @since 2.5
  * @param $single Single form to be i18ned
  * @param $plural Plural form to be i18ned
  *
  * @since 2.5
  * @param $single Single form to be i18ned
  * @param $plural Plural form to be i18ned
- * @param $number Not used, here for compatibility with __ngettext, optional
- * @param $domain Not used, here for compatibility with __ngettext, optional
  * @return array array($single, $plural)
  */
  * @return array array($single, $plural)
  */
-function __ngettext_noop($single, $plural, $number=1, $domain = 'default') {
-       return array($single, $plural);
+function _n_noop( $single, $plural ) {
+       return array( $single, $plural );
 }
 
 /**
 }
 
 /**
- * @see __ngettext_noop() An alias of __ngettext_noop()
+ * Register plural strings with context in POT file, but don't translate them.
  *
  *
+ * @see _n_noop()
  */
  */
-function _n_noop() {
-       $args = func_get_args();
-       return call_user_func_array('__ngettext_noop', $args);
+function _nx_noop( $single, $plural, $context ) {
+       return array( $single, $plural, $context );
 }
 
 }
 
+
 /**
  * Loads MO file into the list of domains.
  *
  * If the domain already exists, the inclusion will fail. If the MO file is not
  * readable, the inclusion will fail.
  *
 /**
  * Loads MO file into the list of domains.
  *
  * If the domain already exists, the inclusion will fail. If the MO file is not
  * readable, the inclusion will fail.
  *
- * On success, the mofile will be placed in the $l10n global by $domain and will
- * be an gettext_reader object.
+ * On success, the .mo file will be placed in the $l10n global by $domain
+ * and will be an gettext_reader object.
  *
  * @since 1.5.0
  * @uses $l10n Gets list of domain translated string (gettext_reader) objects
  *
  * @since 1.5.0
  * @uses $l10n Gets list of domain translated string (gettext_reader) objects
@@ -258,21 +321,15 @@ function _n_noop() {
 function load_textdomain($domain, $mofile) {
        global $l10n;
 
 function load_textdomain($domain, $mofile) {
        global $l10n;
 
-       if ( is_readable($mofile))
-               $input = new CachedFileReader($mofile);
-       else
-               return;
+       if ( !is_readable($mofile)) return;
 
 
-       $gettext = new gettext_reader($input);
+       $mo = new MO();
+       $mo->import_from_file( $mofile );
 
 
-       if (isset($l10n[$domain])) {
-               $l10n[$domain]->load_tables();
-               $gettext->load_tables();
-               $l10n[$domain]->cache_translations = array_merge($gettext->cache_translations, $l10n[$domain]->cache_translations);
-       } else
-               $l10n[$domain] = $gettext;
+       if (isset($l10n[$domain]))
+               $mo->merge_with( $l10n[$domain] );
 
 
-       unset($input, $gettext);
+       $l10n[$domain] = &$mo;
 }
 
 /**
 }
 
 /**
@@ -295,8 +352,7 @@ function load_default_textdomain() {
  * Loads the plugin's translated strings.
  *
  * If the path is not given then it will be the root of the plugin directory.
  * Loads the plugin's translated strings.
  *
  * If the path is not given then it will be the root of the plugin directory.
- * The .mo file should be named based on the domain with a dash followed by a
- * dash, and then the locale exactly.
+ * The .mo file should be named based on the domain with a dash, and then the locale exactly.
  *
  * @since 1.5.0
  *
  *
  * @since 1.5.0
  *
@@ -340,4 +396,33 @@ function load_theme_textdomain($domain, $path = false) {
        load_textdomain($domain, $mofile);
 }
 
        load_textdomain($domain, $mofile);
 }
 
+/**
+ * Returns the Translations instance for a domain. If there isn't one,
+ * returns empty Translations instance.
+ *
+ * @param string $domain
+ * @return object A Translation instance
+ */
+function &get_translations_for_domain( $domain ) {
+       global $l10n;
+       $empty = &new Translations;
+       if ( isset($l10n[$domain]) )
+               return $l10n[$domain];
+       else
+               return $empty;
+}
+
+/**
+ * Translates role name. Since the role names are in the database and
+ * not in the source there are dummy gettext calls to get them into the POT
+ * file and this function properly translates them back.
+ *
+ * The before_last_bar() call is needed, because older installs keep the roles
+ * using the old context format: 'Role name|User role' and just skipping the
+ * content after the last bar is easier than fixing them in the DB. New installs
+ * won't suffer from that problem.
+ */
+function translate_user_role( $name ) {
+       return before_last_bar( translate_with_gettext_context( $name, 'User role' ) );
+}
 ?>
 ?>
index d716a9e3919142a7432dff1c30f484896124951a..fb111376169b57a0e8d79bb0d592350293349f11 100644 (file)
@@ -92,15 +92,18 @@ function get_permalink($id = 0, $leavename = false) {
                $leavename? '' : '%pagename%',
        );
 
                $leavename? '' : '%pagename%',
        );
 
-       if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter )
+       if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter ) {
                $post = $id;
                $post = $id;
-       else
+               $sample = true;
+       } else {
                $post = &get_post($id);
                $post = &get_post($id);
+               $sample = false;
+       }
 
        if ( empty($post->ID) ) return false;
 
        if ( $post->post_type == 'page' )
 
        if ( empty($post->ID) ) return false;
 
        if ( $post->post_type == 'page' )
-               return get_page_link($post->ID, $leavename);
+               return get_page_link($post->ID, $leavename, $sample);
        elseif ($post->post_type == 'attachment')
                return get_attachment_link($post->ID);
 
        elseif ($post->post_type == 'attachment')
                return get_attachment_link($post->ID);
 
@@ -151,7 +154,7 @@ function get_permalink($id = 0, $leavename = false) {
                $permalink = user_trailingslashit($permalink, 'single');
                return apply_filters('post_link', $permalink, $post, $leavename);
        } else { // if they're not using the fancy permalink option
                $permalink = user_trailingslashit($permalink, 'single');
                return apply_filters('post_link', $permalink, $post, $leavename);
        } else { // if they're not using the fancy permalink option
-               $permalink = get_option('home') . '/?p=' . $post->ID;
+               $permalink = trailingslashit(get_option('home')) . '?p=' . $post->ID;
                return apply_filters('post_link', $permalink, $post, $leavename);
        }
 }
                return apply_filters('post_link', $permalink, $post, $leavename);
        }
 }
@@ -177,10 +180,11 @@ function post_permalink($post_id = 0, $deprecated = '') {
  * @since 1.5.0
  *
  * @param int $id Optional. Post ID.
  * @since 1.5.0
  *
  * @param int $id Optional. Post ID.
- * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name.
+ * @param bool $leavename Optional, defaults to false. Whether to keep page name.
+ * @param bool $sample Optional, defaults to false. Is it a sample permalink.
  * @return string
  */
  * @return string
  */
-function get_page_link($id = false, $leavename = false) {
+function get_page_link( $id = false, $leavename = false, $sample = false ) {
        global $post;
 
        $id = (int) $id;
        global $post;
 
        $id = (int) $id;
@@ -190,7 +194,7 @@ function get_page_link($id = false, $leavename = false) {
        if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
                $link = get_option('home');
        else
        if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
                $link = get_option('home');
        else
-               $link = _get_page_link( $id , $leavename );
+               $link = _get_page_link( $id , $leavename, $sample );
 
        return apply_filters('page_link', $link, $id);
 }
 
        return apply_filters('page_link', $link, $id);
 }
@@ -205,9 +209,10 @@ function get_page_link($id = false, $leavename = false) {
  *
  * @param int $id Optional. Post ID.
  * @param bool $leavename Optional. Leave name.
  *
  * @param int $id Optional. Post ID.
  * @param bool $leavename Optional. Leave name.
+ * @param bool $sample Optional. Sample permalink.
  * @return string
  */
  * @return string
  */
-function _get_page_link( $id = false, $leavename = false ) {
+function _get_page_link( $id = false, $leavename = false, $sample = false ) {
        global $post, $wp_rewrite;
 
        if ( !$id )
        global $post, $wp_rewrite;
 
        if ( !$id )
@@ -217,13 +222,13 @@ function _get_page_link( $id = false, $leavename = false ) {
 
        $pagestruct = $wp_rewrite->get_page_permastruct();
 
 
        $pagestruct = $wp_rewrite->get_page_permastruct();
 
-       if ( '' != $pagestruct && isset($post->post_status) && 'draft' != $post->post_status ) {
+       if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status ) || $sample ) ) {
                $link = get_page_uri($id);
                $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct);
                $link = get_page_uri($id);
                $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct);
-               $link = get_option('home') . "/$link";
+               $link = trailingslashit(get_option('home')) . "$link";
                $link = user_trailingslashit($link, 'page');
        } else {
                $link = user_trailingslashit($link, 'page');
        } else {
-               $link = get_option('home') . "/?page_id=$id";
+               $link = trailingslashit(get_option('home')) . "?page_id=$id";
        }
 
        return apply_filters( '_get_page_link', $link, $id );
        }
 
        return apply_filters( '_get_page_link', $link, $id );
@@ -264,7 +269,7 @@ function get_attachment_link($id = false) {
        }
 
        if (! $link ) {
        }
 
        if (! $link ) {
-               $link = get_bloginfo('url') . "/?attachment_id=$id";
+               $link = trailingslashit(get_bloginfo('url')) . "?attachment_id=$id";
        }
 
        return apply_filters('attachment_link', $link, $id);
        }
 
        return apply_filters('attachment_link', $link, $id);
@@ -287,7 +292,7 @@ function get_year_link($year) {
                $yearlink = str_replace('%year%', $year, $yearlink);
                return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);
        } else {
                $yearlink = str_replace('%year%', $year, $yearlink);
                return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);
        } else {
-               return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year);
+               return apply_filters('year_link', trailingslashit(get_option('home')) . '?m=' . $year, $year);
        }
 }
 
        }
 }
 
@@ -312,7 +317,7 @@ function get_month_link($year, $month) {
                $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
                return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);
        } else {
                $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
                return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);
        } else {
-               return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month);
+               return apply_filters('month_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month);
        }
 }
 
        }
 }
 
@@ -342,7 +347,7 @@ function get_day_link($year, $month, $day) {
                $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
                return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);
        } else {
                $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
                return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);
        } else {
-               return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
+               return apply_filters('day_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
        }
 }
 
        }
 }
 
@@ -377,7 +382,7 @@ function get_feed_link($feed = '') {
                if ( false !== strpos($feed, 'comments_') )
                        $feed = str_replace('comments_', 'comments-', $feed);
 
                if ( false !== strpos($feed, 'comments_') )
                        $feed = str_replace('comments_', 'comments-', $feed);
 
-               $output = get_option('home') . "/?feed={$feed}";
+               $output = trailingslashit(get_option('home')) . "?feed={$feed}";
        }
 
        return apply_filters('feed_link', $output, $feed);
        }
 
        return apply_filters('feed_link', $output, $feed);
@@ -409,9 +414,9 @@ function get_post_comments_feed_link($post_id = '', $feed = '') {
        } else {
                $type = get_post_field('post_type', $post_id);
                if ( 'page' == $type )
        } else {
                $type = get_post_field('post_type', $post_id);
                if ( 'page' == $type )
-                       $url = get_option('home') . "/?feed=$feed&amp;page_id=$post_id";
+                       $url = trailingslashit(get_option('home')) . "?feed=$feed&amp;page_id=$post_id";
                else
                else
-                       $url = get_option('home') . "/?feed=$feed&amp;p=$post_id";
+                       $url = trailingslashit(get_option('home')) . "?feed=$feed&amp;p=$post_id";
        }
 
        return apply_filters('post_comments_feed_link', $url);
        }
 
        return apply_filters('post_comments_feed_link', $url);
@@ -438,7 +443,7 @@ function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
        if ( empty($link_text) )
                $link_text = __('Comments Feed');
 
        if ( empty($link_text) )
                $link_text = __('Comments Feed');
 
-       echo "<a href='$url'>$link_text</a>";
+       echo apply_filters( 'post_comments_feed_link_html', "<a href='$url'>$link_text</a>", $post_id, $feed );
 }
 
 /**
 }
 
 /**
@@ -463,7 +468,7 @@ function get_author_feed_link( $author_id, $feed = '' ) {
                $feed = get_default_feed();
 
        if ( '' == $permalink_structure ) {
                $feed = get_default_feed();
 
        if ( '' == $permalink_structure ) {
-               $link = get_option('home') . "?feed=$feed&amp;author=" . $author_id;
+               $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;author=" . $author_id;
        } else {
                $link = get_author_posts_url($author_id);
                if ( $feed == get_default_feed() )
        } else {
                $link = get_author_posts_url($author_id);
                if ( $feed == get_default_feed() )
@@ -507,7 +512,7 @@ function get_category_feed_link($cat_id, $feed = '') {
        $permalink_structure = get_option('permalink_structure');
 
        if ( '' == $permalink_structure ) {
        $permalink_structure = get_option('permalink_structure');
 
        if ( '' == $permalink_structure ) {
-               $link = get_option('home') . "?feed=$feed&amp;cat=" . $cat_id;
+               $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;cat=" . $cat_id;
        } else {
                $link = get_category_link($cat_id);
                if( $feed == get_default_feed() )
        } else {
                $link = get_category_link($cat_id);
                if( $feed == get_default_feed() )
@@ -546,7 +551,7 @@ function get_tag_feed_link($tag_id, $feed = '') {
                $feed = get_default_feed();
 
        if ( '' == $permalink_structure ) {
                $feed = get_default_feed();
 
        if ( '' == $permalink_structure ) {
-               $link = get_option('home') . "?feed=$feed&amp;tag=" . $tag->slug;
+               $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;tag=" . $tag->slug;
        } else {
                $link = get_tag_link($tag->term_id);
                if ( $feed == get_default_feed() )
        } else {
                $link = get_tag_link($tag->term_id);
                if ( $feed == get_default_feed() )
@@ -569,13 +574,13 @@ function get_tag_feed_link($tag_id, $feed = '') {
  * @param int $tag_id Tag ID
  * @return string
  */
  * @param int $tag_id Tag ID
  * @return string
  */
-function get_edit_tag_link( $tag_id = 0 ) {
-       $tag = get_term($tag_id, 'post_tag');
+function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) {
+       $tag = get_term($tag_id, $taxonomy);
 
        if ( !current_user_can('manage_categories') )
                return;
 
 
        if ( !current_user_can('manage_categories') )
                return;
 
-       $location = admin_url('edit-tags.php?action=edit&amp;tag_ID=') . $tag->term_id;
+       $location = admin_url('edit-tags.php?action=edit&amp;taxonomy=' . $taxonomy . '&amp;tag_ID=' . $tag->term_id);
        return apply_filters( 'get_edit_tag_link', $location );
 }
 
        return apply_filters( 'get_edit_tag_link', $location );
 }
 
@@ -614,14 +619,14 @@ function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
  */
 function get_search_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
  */
 function get_search_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
-               $search = attribute_escape(get_search_query());
+               $search = esc_attr(get_search_query());
        else
        else
-               $search = attribute_escape(stripslashes($search_query));
+               $search = esc_attr(stripslashes($search_query));
 
        if ( empty($feed) )
                $feed = get_default_feed();
 
 
        if ( empty($feed) )
                $feed = get_default_feed();
 
-       $link = get_option('home') . "?s=$search&amp;feed=$feed";
+       $link = trailingslashit(get_option('home')) . "?s=$search&amp;feed=$feed";
 
        $link = apply_filters('search_feed_link', $link);
 
 
        $link = apply_filters('search_feed_link', $link);
 
@@ -639,14 +644,14 @@ function get_search_feed_link($search_query = '', $feed = '') {
  */
 function get_search_comments_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
  */
 function get_search_comments_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
-               $search = attribute_escape(get_search_query());
+               $search = esc_attr(get_search_query());
        else
        else
-               $search = attribute_escape(stripslashes($search_query));
+               $search = esc_attr(stripslashes($search_query));
 
        if ( empty($feed) )
                $feed = get_default_feed();
 
 
        if ( empty($feed) )
                $feed = get_default_feed();
 
-       $link = get_option('home') . "?s=$search&amp;feed=comments-$feed";
+       $link = trailingslashit(get_option('home')) . "?s=$search&amp;feed=comments-$feed";
 
        $link = apply_filters('search_feed_link', $link);
 
 
        $link = apply_filters('search_feed_link', $link);
 
@@ -706,26 +711,23 @@ function get_edit_post_link( $id = 0, $context = 'display' ) {
 }
 
 /**
 }
 
 /**
- * Retrieve edit posts link for post.
+ * Display edit post link for post.
  *
  * @since 1.0.0
  *
  * @param string $link Optional. Anchor text.
  * @param string $before Optional. Display before edit link.
  * @param string $after Optional. Display after edit link.
  *
  * @since 1.0.0
  *
  * @param string $link Optional. Anchor text.
  * @param string $before Optional. Display before edit link.
  * @param string $after Optional. Display after edit link.
+ * @param int $id Optional. Post ID.
  */
  */
-function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
-       global $post;
+function edit_post_link( $link = 'Edit This', $before = '', $after = '', $id = 0 ) {
+       if ( !$post = &get_post( $id ) )
+               return;
 
 
-       if ( $post->post_type == 'page' ) {
-               if ( !current_user_can( 'edit_page', $post->ID ) )
-                       return;
-       } else {
-               if ( !current_user_can( 'edit_post', $post->ID ) )
-                       return;
-       }
+       if ( !$url = get_edit_post_link( $post->ID ) )
+               return;
 
 
-       $link = '<a class="post-edit-link" href="' . get_edit_post_link( $post->ID ) . '" title="' . attribute_escape( __( 'Edit post' ) ) . '">' . $link . '</a>';
+       $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( __( 'Edit post' ) ) . '">' . $link . '</a>';
        echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;
 }
 
        echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;
 }
 
@@ -863,7 +865,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
 function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $previous = true) {
        global $post, $wpdb;
 
 function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $previous = true) {
        global $post, $wpdb;
 
-       if( empty($post) || !is_single() || is_attachment() )
+       if ( empty($post) || !is_single() || is_attachment() )
                return null;
 
        $current_post_date = $post->post_date;
                return null;
 
        $current_post_date = $post->post_date;
@@ -900,7 +902,252 @@ function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $pre
        $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date), $in_same_cat, $excluded_categories );
        $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );
 
        $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date), $in_same_cat, $excluded_categories );
        $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );
 
-       return $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
+       $query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort";
+       $query_key = 'adjacent_post_' . md5($query);
+       $result = wp_cache_get($query_key, 'counts');
+       if ( false !== $result )
+               return $result;
+
+       $result = $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
+       if ( null === $result )
+               $result = '';
+
+       wp_cache_set($query_key, $result, 'counts');
+       return $result;
+}
+
+/**
+ * Get adjacent post relational link.
+ *
+ * Can either be next or previous post relational link.
+ *
+ * @since 2.8.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ * @param bool $previous Optional, default is true. Whether display link to previous post.
+ * @return string
+ */
+function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true) {
+       if ( $previous && is_attachment() )
+               $post = & get_post($GLOBALS['post']->post_parent);
+       else
+               $post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
+
+       if ( empty($post) )
+               return;
+
+       if ( empty($post->post_title) )
+               $post->post_title = $previous ? __('Previous Post') : __('Next Post');
+
+       $date = mysql2date(get_option('date_format'), $post->post_date);
+
+       $title = str_replace('%title', $post->post_title, $title);
+       $title = str_replace('%date', $date, $title);
+       $title = apply_filters('the_title', $title, $post);
+
+       $link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
+       $link .= esc_attr( $title );
+       $link .= "' href='" . get_permalink($post) . "' />\n";
+
+       $adjacent = $previous ? 'previous' : 'next';
+       return apply_filters( "{$adjacent}_post_rel_link", $link );
+}
+
+/**
+ * Display relational links for the posts adjacent to the current post.
+ *
+ * @since 2.8.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ */
+function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
+       echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);
+       echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);
+}
+
+/**
+ * Display relational link for the next post adjacent to the current post.
+ *
+ * @since 2.8.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ */
+function next_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
+       echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false);
+}
+
+/**
+ * Display relational link for the previous post adjacent to the current post.
+ *
+ * @since 2.8.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ */
+function prev_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
+       echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', true);
+}
+
+/**
+ * Retrieve boundary post.
+ *
+ * Boundary being either the first or last post by publish date within the contraitns specified
+ * by in same category or excluded categories.
+ *
+ * @since 2.8.0
+ *
+ * @param bool $in_same_cat Optional. Whether returned post should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ * @param bool $previous Optional. Whether to retrieve first post.
+ * @return object
+ */
+function get_boundary_post($in_same_cat = false, $excluded_categories = '', $start = true) {
+       global $post, $wpdb;
+
+       if ( empty($post) || !is_single() || is_attachment() )
+               return null;
+
+       $cat_array = array();
+       $excluded_categories = array();
+       if ( !empty($in_same_cat) || !empty($excluded_categories) ) {
+               if ( !empty($in_same_cat) ) {
+                       $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
+               }
+
+               if ( !empty($excluded_categories) ) {
+                       $excluded_categories = array_map('intval', explode(',', $excluded_categories));
+
+                       if ( !empty($cat_array) )
+                               $excluded_categories = array_diff($excluded_categories, $cat_array);
+
+                       $inverse_cats = array();
+                       foreach ( $excluded_categories as $excluded_category)
+                               $inverse_cats[] = $excluded_category * -1;
+                       $excluded_categories = $inverse_cats;
+               }
+       }
+
+       $categories = implode(',', array_merge($cat_array, $excluded_categories) );
+
+       $order = $start ? 'ASC' : 'DESC';
+
+       return get_posts( array('numberposts' => 1, 'order' => $order, 'orderby' => 'ID', 'category' => $categories) );
+}
+
+/**
+ * Get boundary post relational link.
+ *
+ * Can either be start or end post relational link.
+ *
+ * @since 2.8.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ * @param bool $start Optional, default is true. Whether display link to first post.
+ * @return string
+ */
+function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
+       $posts = get_boundary_post($in_same_cat,$excluded_categories,$start);
+       // Even though we limited get_posts to return only 1 item it still returns an array of objects.
+       $post = $posts[0];
+
+       if ( empty($post) )
+                        return;
+
+               if ( empty($post->post_title) )
+                               $post->post_title = $start ? __('First Post') : __('Last Post');
+
+       $date = mysql2date(get_option('date_format'), $post->post_date);
+
+       $title = str_replace('%title', $post->post_title, $title);
+       $title = str_replace('%date', $date, $title);
+       $title = apply_filters('the_title', $title, $post);
+
+       $link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
+       $link .= esc_attr($title);
+       $link .= "' href='" . get_permalink($post) . "' />\n";
+
+       $boundary = $start ? 'start' : 'end';
+       return apply_filters( "{$boundary}_post_rel_link", $link );
+}
+
+/**
+ * Display relational link for the first post.
+ *
+ * @since 2.8.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ */
+function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
+       echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
+}
+
+/**
+ * Get site index relational link.
+ *
+ * @since 2.8.0
+ *
+ * @return string
+ */
+function get_index_rel_link() {
+       $link = "<link rel='index' title='" . esc_attr(get_bloginfo('name')) . "' href='" . get_bloginfo('siteurl') . "' />\n";
+       return apply_filters( "index_rel_link", $link );
+}
+
+/**
+ * Display relational link for the site index.
+ *
+ * @since 2.8.0
+ */
+function index_rel_link() {
+       echo get_index_rel_link();
+}
+
+/**
+ * Get parent post relational link.
+ *
+ * @since 2.8.0
+ *
+ * @param string $title Optional. Link title format.
+ * @return string
+ */
+function get_parent_post_rel_link($title = '%title') {
+       if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
+               $post = & get_post($GLOBALS['post']->post_parent);
+
+       if ( empty($post) )
+               return;
+
+       $date = mysql2date(get_option('date_format'), $post->post_date);
+
+       $title = str_replace('%title', $post->post_title, $title);
+       $title = str_replace('%date', $date, $title);
+       $title = apply_filters('the_title', $title, $post);
+
+       $link = "<link rel='up' title='";
+       $link .= esc_attr( $title );
+       $link .= "' href='" . get_permalink($post) . "' />\n";
+
+       return apply_filters( "parent_post_rel_link", $link );
+}
+
+/**
+ * Display relational link for parent item
+ *
+ * @since 2.8.0
+ */
+function parent_post_rel_link($title = '%title') {
+       echo get_parent_post_rel_link($title);
 }
 
 /**
 }
 
 /**
@@ -1065,7 +1312,7 @@ function get_next_posts_page_link($max_page = 0) {
  * @param boolean $echo Optional. Echo or return;
  */
 function next_posts( $max_page = 0, $echo = true ) {
  * @param boolean $echo Optional. Echo or return;
  */
 function next_posts( $max_page = 0, $echo = true ) {
-       $output = clean_url( get_next_posts_page_link( $max_page ) );
+       $output = esc_url( get_next_posts_page_link( $max_page ) );
 
        if ( $echo )
                echo $output;
 
        if ( $echo )
                echo $output;
@@ -1143,7 +1390,7 @@ function get_previous_posts_page_link() {
  * @param boolean $echo Optional. Echo or return;
  */
 function previous_posts( $echo = true ) {
  * @param boolean $echo Optional. Echo or return;
  */
 function previous_posts( $echo = true ) {
-       $output = clean_url( get_previous_posts_page_link() );
+       $output = esc_url( get_previous_posts_page_link() );
 
        if ( $echo )
                echo $output;
 
        if ( $echo )
                echo $output;
@@ -1181,31 +1428,56 @@ function previous_posts_link( $label = '&laquo; Previous Page' ) {
 }
 
 /**
 }
 
 /**
- * Display post pages link navigation for previous and next pages.
+ * Return post pages link navigation for previous and next pages.
  *
  *
- * @since 0.71
+ * @since 2.8
  *
  *
- * @param string $sep Optional. Separator for posts navigation links.
- * @param string $prelabel Optional. Label for previous pages.
- * @param string $nxtlabel Optional Label for next pages.
+ * @param string|array $args Optional args.
+ * @return string The posts link navigation.
  */
  */
-function posts_nav_link( $sep = ' &#8212; ', $prelabel = '&laquo; Previous Page', $nxtlabel = 'Next Page &raquo;' ) {
+function get_posts_nav_link( $args = array() ) {
        global $wp_query;
        global $wp_query;
+
+       $return = '';
+
        if ( !is_singular() ) {
        if ( !is_singular() ) {
+               $defaults = array(
+                       'sep' => ' &#8212; ',
+                       'prelabel' => __('&laquo; Previous Page'),
+                       'nxtlabel' => __('Next Page &raquo;'),
+               );
+               $args = wp_parse_args( $args, $defaults );
+
                $max_num_pages = $wp_query->max_num_pages;
                $paged = get_query_var('paged');
 
                //only have sep if there's both prev and next results
                if ($paged < 2 || $paged >= $max_num_pages) {
                $max_num_pages = $wp_query->max_num_pages;
                $paged = get_query_var('paged');
 
                //only have sep if there's both prev and next results
                if ($paged < 2 || $paged >= $max_num_pages) {
-                       $sep = '';
+                       $args['sep'] = '';
                }
 
                if ( $max_num_pages > 1 ) {
                }
 
                if ( $max_num_pages > 1 ) {
-                       previous_posts_link($prelabel);
-                       echo preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $sep);
-                       next_posts_link($nxtlabel);
+                       $return = get_previous_posts_link($args['prelabel']);
+                       $return .= preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $args['sep']);
+                       $return .= get_next_posts_link($args['nxtlabel']);
                }
        }
                }
        }
+       return $return;
+
+}
+
+/**
+ * Display post pages link navigation for previous and next pages.
+ *
+ * @since 0.71
+ *
+ * @param string $sep Optional. Separator for posts navigation links.
+ * @param string $prelabel Optional. Label for previous pages.
+ * @param string $nxtlabel Optional Label for next pages.
+ */
+function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
+       $args = array_filter( compact('sep', 'prelabel', 'nxtlabel') );
+       echo get_posts_nav_link($args);
 }
 
 /**
 }
 
 /**
@@ -1256,7 +1528,7 @@ function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
 function get_next_comments_link( $label = '', $max_page = 0 ) {
        global $wp_query;
 
 function get_next_comments_link( $label = '', $max_page = 0 ) {
        global $wp_query;
 
-       if ( !is_singular() )
+       if ( !is_singular() || !get_option('page_comments') )
                return;
 
        $page = get_query_var('cpage');
                return;
 
        $page = get_query_var('cpage');
@@ -1275,7 +1547,7 @@ function get_next_comments_link( $label = '', $max_page = 0 ) {
        if ( empty($label) )
                $label = __('Newer Comments &raquo;');
 
        if ( empty($label) )
                $label = __('Newer Comments &raquo;');
 
-       return '<a href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+       return '<a href="' . esc_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
 }
 
 /**
 }
 
 /**
@@ -1299,7 +1571,7 @@ function next_comments_link( $label = '', $max_page = 0 ) {
  * @return string|null
  */
 function get_previous_comments_link( $label = '' ) {
  * @return string|null
  */
 function get_previous_comments_link( $label = '' ) {
-       if ( !is_singular() )
+       if ( !is_singular() || !get_option('page_comments') )
                return;
 
        $page = get_query_var('cpage');
                return;
 
        $page = get_query_var('cpage');
@@ -1312,7 +1584,7 @@ function get_previous_comments_link( $label = '' ) {
        if ( empty($label) )
                $label = __('&laquo; Older Comments');
 
        if ( empty($label) )
                $label = __('&laquo; Older Comments');
 
-       return '<a href="' . clean_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+       return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
 }
 
 /**
 }
 
 /**
@@ -1338,7 +1610,7 @@ function previous_comments_link( $label = '' ) {
 function paginate_comments_links($args = array()) {
        global $wp_query, $wp_rewrite;
 
 function paginate_comments_links($args = array()) {
        global $wp_query, $wp_rewrite;
 
-       if ( !is_singular() )
+       if ( !is_singular() || !get_option('page_comments') )
                return;
 
        $page = get_query_var('cpage');
                return;
 
        $page = get_query_var('cpage');
@@ -1454,7 +1726,7 @@ function admin_url($path = '') {
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= ltrim($path, '/');
 
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= ltrim($path, '/');
 
-       return $url;
+       return apply_filters('admin_url', $url, $path);
 }
 
 /**
 }
 
 /**
@@ -1472,7 +1744,7 @@ function includes_url($path = '') {
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= ltrim($path, '/');
 
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= ltrim($path, '/');
 
-       return $url;
+       return apply_filters('includes_url', $url, $path);
 }
 
 /**
 }
 
 /**
@@ -1495,30 +1767,44 @@ function content_url($path = '') {
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= '/' . ltrim($path, '/');
 
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= '/' . ltrim($path, '/');
 
-       return $url;
+       return apply_filters('content_url', $url, $path);
 }
 
 /**
 }
 
 /**
- * Retrieve the url to the plugins directory.
+ * Retrieve the url to the plugins directory or to a specific file within that directory.
+ * You can hardcode the plugin slug in $path or pass __FILE__ as a second argument to get the correct folder name.
  *
  * @package WordPress
  * @since 2.6.0
  *
  * @param string $path Optional. Path relative to the plugins url.
  *
  * @package WordPress
  * @since 2.6.0
  *
  * @param string $path Optional. Path relative to the plugins url.
+ * @param string $plugin Optional. The plugin file that you want to be relative to - i.e. pass in __FILE__
  * @return string Plugins url link with optional path appended.
 */
  * @return string Plugins url link with optional path appended.
 */
-function plugins_url($path = '') {
+function plugins_url($path = '', $plugin = '') {
        $scheme = ( is_ssl() ? 'https' : 'http' );
        $scheme = ( is_ssl() ? 'https' : 'http' );
-       $url = WP_PLUGIN_URL;
+
+       if ( $plugin !== '' && preg_match('#^' . preg_quote(WPMU_PLUGIN_DIR . DIRECTORY_SEPARATOR, '#') . '#', $plugin) ) {
+               $url = WPMU_PLUGIN_URL;
+       } else {
+               $url = WP_PLUGIN_URL;
+       }
+
        if ( 0 === strpos($url, 'http') ) {
                if ( is_ssl() )
                        $url = str_replace( 'http://', "{$scheme}://", $url );
        }
 
        if ( 0 === strpos($url, 'http') ) {
                if ( is_ssl() )
                        $url = str_replace( 'http://', "{$scheme}://", $url );
        }
 
+       if ( !empty($plugin) && is_string($plugin) ) {
+               $folder = dirname(plugin_basename($plugin));
+               if ('.' != $folder)
+                       $url .= '/' . ltrim($folder, '/');
+       }
+
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= '/' . ltrim($path, '/');
 
        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                $url .= '/' . ltrim($path, '/');
 
-       return $url;
+       return apply_filters('plugins_url', $url, $path, $plugin);
 }
 
 ?>
 }
 
 ?>
index 135c6bf7284777601f958d00abbcf04214847f95..7f5392c1bce5844e0223a022ca0ef5ad83110e4e 100644 (file)
@@ -178,13 +178,16 @@ class WP_Locale {
                // Numbers formatting
                // See http://php.net/number_format
 
                // Numbers formatting
                // See http://php.net/number_format
 
-               $trans = _c('number_format_decimals|$decimals argument for http://php.net/number_format, default is 0');
+               /* translators: $decimals argument for http://php.net/number_format, default is 0 */
+               $trans = __('number_format_decimals');
                $this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;
 
                $this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;
 
-               $trans = _c('number_format_decimal_point|$dec_point argument for http://php.net/number_format, default is .');
+               /* translators: $dec_point argument for http://php.net/number_format, default is . */
+               $trans = __('number_format_decimal_point');
                $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
 
                $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
 
-               $trans = _c('number_format_thousands_sep|$thousands_sep argument for http://php.net/number_format, default is ,');
+               /* translators: $thousands_sep argument for http://php.net/number_format, default is , */
+               $trans = __('number_format_thousands_sep');
                $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
 
                // Import global locale vars set during inclusion of $locale.php.
                $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
 
                // Import global locale vars set during inclusion of $locale.php.
index 58feaf3ab1ef2868f9f88e91a13a6d4410edb52e..7f34963842d7d62b93ba7de00bcf74945ac28188 100644 (file)
@@ -200,10 +200,10 @@ function get_image_tag($id, $alt, $title, $align, $size='medium') {
        list( $img_src, $width, $height ) = image_downsize($id, $size);
        $hwstring = image_hwstring($width, $height);
 
        list( $img_src, $width, $height ) = image_downsize($id, $size);
        $hwstring = image_hwstring($width, $height);
 
-       $class = 'align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id;
+       $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
        $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
 
        $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
 
-       $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="'.$class.'" />';
+       $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title).'" '.$hwstring.'class="'.$class.'" />';
 
        $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
 
 
        $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
 
@@ -231,10 +231,10 @@ function wp_constrain_dimensions( $current_width, $current_height, $max_width=0,
 
        $width_ratio = $height_ratio = 1.0;
 
 
        $width_ratio = $height_ratio = 1.0;
 
-       if ( $max_width > 0 && $current_width > $max_width )
+       if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width )
                $width_ratio = $max_width / $current_width;
 
                $width_ratio = $max_width / $current_width;
 
-       if ( $max_height > 0 && $current_height > $max_height )
+       if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height )
                $height_ratio = $max_height / $current_height;
 
        // the smaller ratio is the one we need to fit it to the constraining box
                $height_ratio = $max_height / $current_height;
 
        // the smaller ratio is the one we need to fit it to the constraining box
@@ -378,7 +378,7 @@ function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_p
        else {
                // all other formats are converted to jpg
                $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
        else {
                // all other formats are converted to jpg
                $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
-               if (!imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality ) ) )
+               if (!imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
        }
 
                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
        }
 
@@ -503,6 +503,8 @@ function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon =
        if ( $image = image_downsize($attachment_id, $size) )
                return $image;
 
        if ( $image = image_downsize($attachment_id, $size) )
                return $image;
 
+       $src = false;
+
        if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
                $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
                $src_file = $icon_dir . '/' . basename($src);
        if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
                $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
                $src_file = $icon_dir . '/' . basename($src);
@@ -514,9 +516,10 @@ function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon =
 }
 
 /**
 }
 
 /**
- * Retrieve img HTML content for an image to represent an attachment.
+ * Get an HTML img element representing an image attachment
  *
  *
- * @see wp_get_attachment_image_src() Returns img HTML element based on array.
+ * @uses apply_filters() Calls 'wp_get_attachment_image_attributes' hook on attributes array
+ * @uses wp_get_attachment_image_src() Gets attachment file URL and dimensions
  * @since 2.5.0
  *
  * @param int $attachment_id Image attachment ID.
  * @since 2.5.0
  *
  * @param int $attachment_id Image attachment ID.
@@ -533,7 +536,20 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa
                $hwstring = image_hwstring($width, $height);
                if ( is_array($size) )
                        $size = join('x', $size);
                $hwstring = image_hwstring($width, $height);
                if ( is_array($size) )
                        $size = join('x', $size);
-               $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="" />';
+               $attachment =& get_post($attachment_id);
+               $attr = array(
+                       'src'   => $src,
+                       'class' => "attachment-$size",
+                       'alt'   => trim(strip_tags( $attachment->post_excerpt )),
+                       'title' => trim(strip_tags( $attachment->post_title )),
+                       );
+               $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
+               $attr = array_map( 'esc_attr', $attr );
+               $html = rtrim("<img $hwstring");
+               foreach ( $attr as $name => $value ) {
+                       $html .= " $name=" . '"' . $value . '"';
+               }
+               $html .= ' />';
        }
 
        return $html;
        }
 
        return $html;
@@ -578,7 +594,7 @@ function img_caption_shortcode($attr, $content = null) {
        if ( $id ) $id = 'id="' . $id . '" ';
 
        return '<div ' . $id . 'class="wp-caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">'
        if ( $id ) $id = 'id="' . $id . '" ';
 
        return '<div ' . $id . 'class="wp-caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">'
-       . $content . '<p class="wp-caption-text">' . $caption . '</p></div>';
+       . do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
 }
 
 add_shortcode('gallery', 'gallery_shortcode');
 }
 
 add_shortcode('gallery', 'gallery_shortcode');
@@ -597,6 +613,9 @@ add_shortcode('gallery', 'gallery_shortcode');
 function gallery_shortcode($attr) {
        global $post;
 
 function gallery_shortcode($attr) {
        global $post;
 
+       static $instance = 0;
+       $instance++;
+
        // Allow plugins/themes to override the default gallery template.
        $output = apply_filters('post_gallery', '', $attr);
        if ( $output != '' )
        // Allow plugins/themes to override the default gallery template.
        $output = apply_filters('post_gallery', '', $attr);
        if ( $output != '' )
@@ -628,8 +647,8 @@ function gallery_shortcode($attr) {
 
        if ( is_feed() ) {
                $output = "\n";
 
        if ( is_feed() ) {
                $output = "\n";
-               foreach ( $attachments as $id => $attachment )
-                       $output .= wp_get_attachment_link($id, $size, true) . "\n";
+               foreach ( $attachments as $att_id => $attachment )
+                       $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
                return $output;
        }
 
                return $output;
        }
 
@@ -638,25 +657,27 @@ function gallery_shortcode($attr) {
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
 
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
 
+       $selector = "gallery-{$instance}";
+
        $output = apply_filters('gallery_style', "
                <style type='text/css'>
        $output = apply_filters('gallery_style', "
                <style type='text/css'>
-                       .gallery {
+                       #{$selector} {
                                margin: auto;
                        }
                                margin: auto;
                        }
-                       .gallery-item {
+                       #{$selector} .gallery-item {
                                float: left;
                                margin-top: 10px;
                                text-align: center;
                                width: {$itemwidth}%;                   }
                                float: left;
                                margin-top: 10px;
                                text-align: center;
                                width: {$itemwidth}%;                   }
-                       .gallery img {
+                       #{$selector} img {
                                border: 2px solid #cfcfcf;
                        }
                                border: 2px solid #cfcfcf;
                        }
-                       .gallery-caption {
+                       #{$selector} .gallery-caption {
                                margin-left: 0;
                        }
                </style>
                <!-- see gallery_shortcode() in wp-includes/media.php -->
                                margin-left: 0;
                        }
                </style>
                <!-- see gallery_shortcode() in wp-includes/media.php -->
-               <div class='gallery'>");
+               <div id='$selector' class='gallery galleryid-{$id}'>");
 
        $i = 0;
        foreach ( $attachments as $id => $attachment ) {
 
        $i = 0;
        foreach ( $attachments as $id => $attachment ) {
@@ -670,7 +691,7 @@ function gallery_shortcode($attr) {
                if ( $captiontag && trim($attachment->post_excerpt) ) {
                        $output .= "
                                <{$captiontag} class='gallery-caption'>
                if ( $captiontag && trim($attachment->post_excerpt) ) {
                        $output .= "
                                <{$captiontag} class='gallery-caption'>
-                               {$attachment->post_excerpt}
+                               " . wptexturize($attachment->post_excerpt) . "
                                </{$captiontag}>";
                }
                $output .= "</{$itemtag}>";
                                </{$captiontag}>";
                }
                $output .= "</{$itemtag}>";
@@ -689,18 +710,24 @@ function gallery_shortcode($attr) {
  * Display previous image link that has the same post parent.
  *
  * @since 2.5.0
  * Display previous image link that has the same post parent.
  *
  * @since 2.5.0
+ * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text;
+ * @param string $text Optional, default is false. If included, link will reflect $text variable.
+ * @return string HTML content.
  */
  */
-function previous_image_link() {
-       adjacent_image_link(true);
+function previous_image_link($size = 'thumbnail', $text = false) {
+       adjacent_image_link(true, $size, $text);
 }
 
 /**
  * Display next image link that has the same post parent.
  *
  * @since 2.5.0
 }
 
 /**
  * Display next image link that has the same post parent.
  *
  * @since 2.5.0
+ * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text;
+ * @param string $text Optional, default is false. If included, link will reflect $text variable.
+ * @return string HTML content.
  */
  */
-function next_image_link() {
-       adjacent_image_link(false);
+function next_image_link($size = 'thumbnail', $text = false) {
+       adjacent_image_link(false, $size, $text);
 }
 
 /**
 }
 
 /**
@@ -712,7 +739,7 @@ function next_image_link() {
  *
  * @param bool $prev Optional. Default is true to display previous link, true for next.
  */
  *
  * @param bool $prev Optional. Default is true to display previous link, true for next.
  */
-function adjacent_image_link($prev = true) {
+function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {
        global $post;
        $post = get_post($post);
        $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
        global $post;
        $post = get_post($post);
        $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
@@ -724,7 +751,7 @@ function adjacent_image_link($prev = true) {
        $k = $prev ? $k - 1 : $k + 1;
 
        if ( isset($attachments[$k]) )
        $k = $prev ? $k - 1 : $k + 1;
 
        if ( isset($attachments[$k]) )
-               echo wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true);
+               echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text);
 }
 
 /**
 }
 
 /**
index 7e3f4f13143ae19d2561d1c66c21b35b62bdd4d2..6074b00f323b1ecbadba86fff7d99256385e43a6 100644 (file)
@@ -34,7 +34,7 @@ if ( !function_exists('wp_set_current_user') ) :
  * the signed in user. Therefore, it opens the ability to edit and perform
  * actions on users who aren't signed in.
  *
  * the signed in user. Therefore, it opens the ability to edit and perform
  * actions on users who aren't signed in.
  *
- * @since 2.0.4
+ * @since 2.0.3
  * @global object $current_user The current user object which holds the user data.
  * @uses do_action() Calls 'set_current_user' hook after setting the current user.
  *
  * @global object $current_user The current user object which holds the user data.
  * @uses do_action() Calls 'set_current_user' hook after setting the current user.
  *
@@ -62,7 +62,7 @@ if ( !function_exists('wp_get_current_user') ) :
 /**
  * Retrieve the current user object.
  *
 /**
  * Retrieve the current user object.
  *
- * @since 2.0.4
+ * @since 2.0.3
  *
  * @return WP_User Current user WP_User object
  */
  *
  * @return WP_User Current user WP_User object
  */
@@ -139,18 +139,49 @@ function get_userdata( $user_id ) {
 }
 endif;
 
 }
 endif;
 
-if ( !function_exists('update_user_cache') ) :
+if ( !function_exists('get_user_by') ) :
 /**
 /**
- * Updates a users cache when overridden by a plugin.
+ * Retrieve user info by a given field
  *
  *
- * Core function does nothing.
+ * @since 2.8.0
  *
  *
- * @since 1.5
- *
- * @return bool Only returns true
+ * @param string $field The field to retrieve the user with.  id | slug | email | login
+ * @param int|string $value A value for $field.  A user ID, slug, email address, or login name.
+ * @return bool|object False on failure, User DB row object
  */
  */
-function update_user_cache() {
-       return true;
+function get_user_by($field, $value) {
+       global $wpdb;
+
+       switch ($field) {
+               case 'id':
+                       return get_userdata($value);
+                       break;
+               case 'slug':
+                       $user_id = wp_cache_get($value, 'userslugs');
+                       $field = 'user_nicename';
+                       break;
+               case 'email':
+                       $user_id = wp_cache_get($value, 'useremail');
+                       $field = 'user_email';
+                       break;
+               case 'login':
+                       $value = sanitize_user( $value );
+                       $user_id = wp_cache_get($value, 'userlogins');
+                       $field = 'user_login';
+                       break;
+               default:
+                       return false;
+       }
+
+        if ( false !== $user_id )
+               return get_userdata($user_id);
+
+       if ( !$user = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->users WHERE $field = %s", $value) ) )
+               return false;
+
+       _fill_user($user);
+
+       return $user;
 }
 endif;
 
 }
 endif;
 
@@ -164,27 +195,7 @@ if ( !function_exists('get_userdatabylogin') ) :
  * @return bool|object False on failure, User DB row object
  */
 function get_userdatabylogin($user_login) {
  * @return bool|object False on failure, User DB row object
  */
 function get_userdatabylogin($user_login) {
-       global $wpdb;
-       $user_login = sanitize_user( $user_login );
-
-       if ( empty( $user_login ) )
-               return false;
-
-       $user_id = wp_cache_get($user_login, 'userlogins');
-
-       $user = false;
-       if ( false !== $user_id )
-               $user = wp_cache_get($user_id, 'users');
-
-       if ( false !== $user )
-               return $user;
-
-       if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_login = %s", $user_login)) )
-               return false;
-
-       _fill_user($user);
-
-       return $user;
+       return get_user_by('login', $user_login);
 }
 endif;
 
 }
 endif;
 
@@ -198,23 +209,7 @@ if ( !function_exists('get_user_by_email') ) :
  * @return bool|object False on failure, User DB row object
  */
 function get_user_by_email($email) {
  * @return bool|object False on failure, User DB row object
  */
 function get_user_by_email($email) {
-       global $wpdb;
-
-       $user_id = wp_cache_get($email, 'useremail');
-
-       $user = false;
-       if ( false !== $user_id )
-               $user = wp_cache_get($user_id, 'users');
-
-       if ( false !== $user )
-               return $user;
-
-       if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_email = %s", $email)) )
-               return false;
-
-       _fill_user($user);
-
-       return $user;
+       return get_user_by('email', $email);
 }
 endif;
 
 }
 endif;
 
@@ -275,18 +270,27 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
        // Headers
        if ( empty( $headers ) ) {
                $headers = array();
        // Headers
        if ( empty( $headers ) ) {
                $headers = array();
-       } elseif ( !is_array( $headers ) ) {
-               // Explode the headers out, so this function can take both
-               // string headers and an array of headers.
-               $tempheaders = (array) explode( "\n", $headers );
+       } else {
+               if ( !is_array( $headers ) ) {
+                       // Explode the headers out, so this function can take both
+                       // string headers and an array of headers.
+                       $tempheaders = (array) explode( "\n", $headers );
+               } else {
+                       $tempheaders = $headers;
+               }
                $headers = array();
 
                // If it's actually got contents
                if ( !empty( $tempheaders ) ) {
                        // Iterate through the raw headers
                        foreach ( (array) $tempheaders as $header ) {
                $headers = array();
 
                // If it's actually got contents
                if ( !empty( $tempheaders ) ) {
                        // Iterate through the raw headers
                        foreach ( (array) $tempheaders as $header ) {
-                               if ( strpos($header, ':') === false )
+                               if ( strpos($header, ':') === false ) {
+                                       if ( false !== stripos( $header, 'boundary=' ) ) {
+                                               $parts = preg_split('/boundary=/i', trim( $header ) );
+                                               $boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) );
+                                       }
                                        continue;
                                        continue;
+                               }
                                // Explode them out
                                list( $name, $content ) = explode( ':', trim( $header ), 2 );
 
                                // Explode them out
                                list( $name, $content ) = explode( ':', trim( $header ), 2 );
 
@@ -306,13 +310,18 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
                                                $from_email = str_replace( '>', '', $from_email );
                                                $from_email = trim( $from_email );
                                        } else {
                                                $from_email = str_replace( '>', '', $from_email );
                                                $from_email = trim( $from_email );
                                        } else {
-                                               $from_name = trim( $content );
+                                               $from_email = trim( $content );
                                        }
                                } elseif ( 'content-type' == strtolower($name) ) {
                                        if ( strpos( $content,';' ) !== false ) {
                                                list( $type, $charset ) = explode( ';', $content );
                                                $content_type = trim( $type );
                                        }
                                } elseif ( 'content-type' == strtolower($name) ) {
                                        if ( strpos( $content,';' ) !== false ) {
                                                list( $type, $charset ) = explode( ';', $content );
                                                $content_type = trim( $type );
-                                               $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) );
+                                               if ( false !== stripos( $charset, 'charset=' ) ) {
+                                                       $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) );
+                                               } elseif ( false !== stripos( $charset, 'boundary=' ) ) {
+                                                       $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset ) );
+                                                       $charset = '';
+                                               }
                                        } else {
                                                $content_type = trim( $content );
                                        }
                                        } else {
                                                $content_type = trim( $content );
                                        }
@@ -343,7 +352,13 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
                $from_name = 'WordPress';
        }
 
                $from_name = 'WordPress';
        }
 
-       // If we don't have an email from the input headers
+       /* If we don't have an email from the input headers default to wordpress@$sitename
+        * Some hosts will block outgoing mail from this address if it doesn't exist but
+        * there's no easy alternative. Defaulting to admin_email might appear to be another
+        * option but some hosts may refuse to relay mail from an unknown domain. See
+        * http://trac.wordpress.org/ticket/5007.
+        */
+
        if ( !isset( $from_email ) ) {
                // Get the site domain and get rid of www.
                $sitename = strtolower( $_SERVER['SERVER_NAME'] );
        if ( !isset( $from_email ) ) {
                // Get the site domain and get rid of www.
                $sitename = strtolower( $_SERVER['SERVER_NAME'] );
@@ -354,7 +369,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
                $from_email = 'wordpress@' . $sitename;
        }
 
                $from_email = 'wordpress@' . $sitename;
        }
 
-       // Set the from name and email
+       // Plugin authors can override the potentially troublesome default
        $phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
        $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
 
        $phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
        $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
 
@@ -388,11 +403,11 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
 
        $content_type = apply_filters( 'wp_mail_content_type', $content_type );
 
 
        $content_type = apply_filters( 'wp_mail_content_type', $content_type );
 
+       $phpmailer->ContentType = $content_type;
+
        // Set whether it's plaintext or not, depending on $content_type
        if ( $content_type == 'text/html' ) {
                $phpmailer->IsHTML( true );
        // Set whether it's plaintext or not, depending on $content_type
        if ( $content_type == 'text/html' ) {
                $phpmailer->IsHTML( true );
-       } else {
-               $phpmailer->IsHTML( false );
        }
 
        // If we don't have a charset from the input headers
        }
 
        // If we don't have a charset from the input headers
@@ -408,6 +423,9 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
                foreach( (array) $headers as $name => $content ) {
                        $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
                }
                foreach( (array) $headers as $name => $content ) {
                        $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
                }
+               if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) {
+                       $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
+               }
        }
 
        if ( !empty( $attachments ) ) {
        }
 
        if ( !empty( $attachments ) ) {
@@ -437,32 +455,23 @@ if ( !function_exists('wp_authenticate') ) :
  */
 function wp_authenticate($username, $password) {
        $username = sanitize_user($username);
  */
 function wp_authenticate($username, $password) {
        $username = sanitize_user($username);
+       $password = trim($password);
 
 
-       if ( '' == $username )
-               return new WP_Error('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
-
-       if ( '' == $password )
-               return new WP_Error('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
+       $user = apply_filters('authenticate', null, $username, $password);
 
 
-       $user = get_userdatabylogin($username);
-
-       if ( !$user || ($user->user_login != $username) ) {
-               do_action( 'wp_login_failed', $username );
-               return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.'));
+       if ( $user == null ) {
+               // TODO what should the error message be? (Or would these even happen?)
+               // Only needed if all authentication handlers fail to return anything.
+               $user = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid username or incorrect password.'));
        }
 
        }
 
-       $user = apply_filters('wp_authenticate_user', $user, $password);
-       if ( is_wp_error($user) ) {
-               do_action( 'wp_login_failed', $username );
-               return $user;
-       }
+       $ignore_codes = array('empty_username', 'empty_password');
 
 
-       if ( !wp_check_password($password, $user->user_pass, $user->ID) ) {
-               do_action( 'wp_login_failed', $username );
-               return new WP_Error('incorrect_password', __('<strong>ERROR</strong>: Incorrect password.'));
+       if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {
+               do_action('wp_login_failed', $username);
        }
 
        }
 
-       return new WP_User($user->ID);
+       return $user;
 }
 endif;
 
 }
 endif;
 
@@ -514,7 +523,15 @@ function wp_validate_auth_cookie($cookie = '', $scheme = '') {
                return false;
        }
 
                return false;
        }
 
-       $key = wp_hash($username . '|' . $expiration, $scheme);
+       $user = get_userdatabylogin($username);
+       if ( ! $user ) {
+               do_action('auth_cookie_bad_username', $cookie_elements);
+               return false;
+       }
+
+       $pass_frag = substr($user->user_pass, 8, 4);
+
+       $key = wp_hash($username . $pass_frag . '|' . $expiration, $scheme);
        $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
 
        if ( $hmac != $hash ) {
        $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
 
        if ( $hmac != $hash ) {
@@ -522,12 +539,6 @@ function wp_validate_auth_cookie($cookie = '', $scheme = '') {
                return false;
        }
 
                return false;
        }
 
-       $user = get_userdatabylogin($username);
-       if ( ! $user ) {
-               do_action('auth_cookie_bad_username', $cookie_elements);
-               return false;
-       }
-
        do_action('auth_cookie_valid', $cookie_elements, $user);
 
        return $user->ID;
        do_action('auth_cookie_valid', $cookie_elements, $user);
 
        return $user->ID;
@@ -550,7 +561,9 @@ if ( !function_exists('wp_generate_auth_cookie') ) :
 function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {
        $user = get_userdata($user_id);
 
 function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {
        $user = get_userdata($user_id);
 
-       $key = wp_hash($user->user_login . '|' . $expiration, $scheme);
+       $pass_frag = substr($user->user_pass, 8, 4);
+
+       $key = wp_hash($user->user_login . $pass_frag . '|' . $expiration, $scheme);
        $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);
 
        $cookie = $user->user_login . '|' . $expiration . '|' . $hash;
        $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);
 
        $cookie = $user->user_login . '|' . $expiration . '|' . $hash;
@@ -621,9 +634,9 @@ if ( !function_exists('wp_set_auth_cookie') ) :
  */
 function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
        if ( $remember ) {
  */
 function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
        if ( $remember ) {
-               $expiration = $expire = time() + 1209600;
+               $expiration = $expire = time() + apply_filters('auth_cookie_expiration', 1209600, $user_id, $remember);
        } else {
        } else {
-               $expiration = time() + 172800;
+               $expiration = time() + apply_filters('auth_cookie_expiration', 172800, $user_id, $remember);
                $expire = 0;
        }
 
                $expire = 0;
        }
 
@@ -738,6 +751,8 @@ function auth_redirect() {
        }
 
        if ( $user_id = wp_validate_auth_cookie() ) {
        }
 
        if ( $user_id = wp_validate_auth_cookie() ) {
+               do_action('auth_redirect', $user_id);
+
                // If the user wants ssl but the session is not ssl, redirect.
                if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
                        if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
                // If the user wants ssl but the session is not ssl, redirect.
                if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
                        if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
@@ -762,7 +777,7 @@ function auth_redirect() {
 
        $redirect = ( strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ) ? wp_get_referer() : $proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
 
        $redirect = ( strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ) ? wp_get_referer() : $proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
-       $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( $redirect ), 'login' );
+       $login_url = wp_login_url($redirect);
 
        wp_redirect($login_url);
        exit();
 
        wp_redirect($login_url);
        exit();
@@ -797,7 +812,7 @@ if ( !function_exists('check_ajax_referer') ) :
 /**
  * Verifies the AJAX request to prevent processing requests external of the blog.
  *
 /**
  * Verifies the AJAX request to prevent processing requests external of the blog.
  *
- * @since 2.0.4
+ * @since 2.0.3
  *
  * @param string $action Action nonce
  * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5)
  *
  * @param string $action Action nonce
  * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5)
@@ -861,7 +876,7 @@ if ( !function_exists('wp_sanitize_redirect') ) :
  * @return string redirect-sanitized URL
  **/
 function wp_sanitize_redirect($location) {
  * @return string redirect-sanitized URL
  **/
 function wp_sanitize_redirect($location) {
-       $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
+       $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location);
        $location = wp_kses_no_null($location);
 
        // remove %0d and %0a from location
        $location = wp_kses_no_null($location);
 
        // remove %0d and %0a from location
@@ -936,6 +951,9 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
        $comment = get_comment($comment_id);
        $post    = get_post($comment->comment_post_ID);
        $user    = get_userdata( $post->post_author );
        $comment = get_comment($comment_id);
        $post    = get_post($comment->comment_post_ID);
        $user    = get_userdata( $post->post_author );
+       $current_user = wp_get_current_user();
+
+       if ( $comment->user_id == $post->post_author ) return false; // The author moderated a comment on his own post
 
        if ('' == $user->user_email) return false; // If there's no email to send the comment to
 
 
        if ('' == $user->user_email) return false; // If there's no email to send the comment to
 
@@ -946,27 +964,36 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
        if ( empty( $comment_type ) ) $comment_type = 'comment';
 
        if ('comment' == $comment_type) {
        if ( empty( $comment_type ) ) $comment_type = 'comment';
 
        if ('comment' == $comment_type) {
+               /* translators: 1: post id, 2: post title */
                $notify_message  = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
                $notify_message  = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
+               /* translators: 1: comment author, 2: author IP, 3: author domain */
                $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                $notify_message .= sprintf( __('Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
                $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
                $notify_message .= __('You can see all comments on this post here: ') . "\r\n";
                $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                $notify_message .= sprintf( __('Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";
                $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
                $notify_message .= __('You can see all comments on this post here: ') . "\r\n";
+               /* translators: 1: blog name, 2: post title */
                $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
        } elseif ('trackback' == $comment_type) {
                $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
        } elseif ('trackback' == $comment_type) {
+               /* translators: 1: post id, 2: post title */
                $notify_message  = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
                $notify_message  = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
+               /* translators: 1: website name, 2: author IP, 3: author domain */
                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
                $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
                $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
+               /* translators: 1: blog name, 2: post title */          
                $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
        } elseif ('pingback' == $comment_type) {
                $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
        } elseif ('pingback' == $comment_type) {
+               /* translators: 1: post id, 2: post title */
                $notify_message  = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
                $notify_message  = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
+               /* translators: 1: comment author, 2: author IP, 3: author domain */
                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n";
                $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";
                $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
                $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n";
                $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n";
+               /* translators: 1: blog name, 2: post title */
                $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
        }
        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
                $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
        }
        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
@@ -1054,17 +1081,19 @@ function wp_notify_moderator($comment_id) {
        $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
 
        $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
 
-       $notify_message .= sprintf( __ngettext('Currently %s comment is waiting for approval. Please visit the moderation panel:',
+       $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
                'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
        $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
 
        $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );
        $admin_email = get_option('admin_email');
                'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
        $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
 
        $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );
        $admin_email = get_option('admin_email');
+       $message_headers = '';
 
        $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id);
        $subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
 
        $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id);
        $subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
+       $message_headers = apply_filters('comment_moderation_headers', $message_headers);
 
 
-       @wp_mail($admin_email, $subject, $notify_message);
+       @wp_mail($admin_email, $subject, $notify_message, $message_headers);
 
        return true;
 }
 
        return true;
 }
@@ -1114,7 +1143,7 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') {
 
        $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
 
        $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
-       $message .= site_url("wp-login.php", 'login') . "\r\n";
+       $message .= wp_login_url() . "\r\n";
 
        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
 
 
        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
 
@@ -1146,7 +1175,7 @@ if ( !function_exists('wp_verify_nonce') ) :
  * The user is given an amount of time to use the token, so therefore, since the
  * UID and $action remain the same, the independent variable is the time.
  *
  * The user is given an amount of time to use the token, so therefore, since the
  * UID and $action remain the same, the independent variable is the time.
  *
- * @since 2.0.4
+ * @since 2.0.3
  *
  * @param string $nonce Nonce that was used in the form to verify
  * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
  *
  * @param string $nonce Nonce that was used in the form to verify
  * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
@@ -1173,7 +1202,7 @@ if ( !function_exists('wp_create_nonce') ) :
 /**
  * Creates a random, one time use token.
  *
 /**
  * Creates a random, one time use token.
  *
- * @since 2.0.4
+ * @since 2.0.3
  *
  * @param string|int $action Scalar value to add context to the nonce.
  * @return string The one use form token
  *
  * @param string|int $action Scalar value to add context to the nonce.
  * @return string The one use form token
@@ -1242,7 +1271,7 @@ function wp_salt($scheme = 'auth') {
                } else {
                        $salt = get_option('auth_salt');
                        if ( empty($salt) ) {
                } else {
                        $salt = get_option('auth_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password();
+                               $salt = wp_generate_password(64);
                                update_option('auth_salt', $salt);
                        }
                }
                                update_option('auth_salt', $salt);
                        }
                }
@@ -1251,11 +1280,11 @@ function wp_salt($scheme = 'auth') {
                        $secret_key = SECURE_AUTH_KEY;
 
                if ( defined('SECURE_AUTH_SALT') ) {
                        $secret_key = SECURE_AUTH_KEY;
 
                if ( defined('SECURE_AUTH_SALT') ) {
-                       $salt = SECRET_AUTH_SALT;
+                       $salt = SECURE_AUTH_SALT;
                } else {
                        $salt = get_option('secure_auth_salt');
                        if ( empty($salt) ) {
                } else {
                        $salt = get_option('secure_auth_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password();
+                               $salt = wp_generate_password(64);
                                update_option('secure_auth_salt', $salt);
                        }
                }
                                update_option('secure_auth_salt', $salt);
                        }
                }
@@ -1268,7 +1297,7 @@ function wp_salt($scheme = 'auth') {
                } else {
                        $salt = get_option('logged_in_salt');
                        if ( empty($salt) ) {
                } else {
                        $salt = get_option('logged_in_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password();
+                               $salt = wp_generate_password(64);
                                update_option('logged_in_salt', $salt);
                        }
                }
                                update_option('logged_in_salt', $salt);
                        }
                }
@@ -1281,7 +1310,7 @@ function wp_salt($scheme = 'auth') {
                } else {
                        $salt = get_option('nonce_salt');
                        if ( empty($salt) ) {
                } else {
                        $salt = get_option('nonce_salt');
                        if ( empty($salt) ) {
-                               $salt = wp_generate_password();
+                               $salt = wp_generate_password(64);
                                update_option('nonce_salt', $salt);
                        }
                }
                                update_option('nonce_salt', $salt);
                        }
                }
@@ -1298,7 +1327,7 @@ if ( !function_exists('wp_hash') ) :
 /**
  * Get hash of given string.
  *
 /**
  * Get hash of given string.
  *
- * @since 2.0.4
+ * @since 2.0.3
  * @uses wp_salt() Get WordPress salt
  *
  * @param string $data Plain text to hash
  * @uses wp_salt() Get WordPress salt
  *
  * @param string $data Plain text to hash
@@ -1395,7 +1424,7 @@ if ( !function_exists('wp_generate_password') ) :
  * @since 2.5
  *
  * @param int $length The length of password to generate
  * @since 2.5
  *
  * @param int $length The length of password to generate
- * @param bool $special_chars Whether to include standard special characters 
+ * @param bool $special_chars Whether to include standard special characters
  * @return string The random password
  **/
 function wp_generate_password($length = 12, $special_chars = true) {
  * @return string The random password
  **/
 function wp_generate_password($length = 12, $special_chars = true) {
@@ -1423,7 +1452,7 @@ if ( !function_exists('wp_rand') ) :
 function wp_rand( $min = 0, $max = 0 ) {
        global $rnd_value;
 
 function wp_rand( $min = 0, $max = 0 ) {
        global $rnd_value;
 
-       $seed = get_option('random_seed');
+       $seed = get_transient('random_seed');
 
        // Reset $rnd_value after 14 uses
        // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
 
        // Reset $rnd_value after 14 uses
        // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
@@ -1432,7 +1461,7 @@ function wp_rand( $min = 0, $max = 0 ) {
                $rnd_value .= sha1($rnd_value);
                $rnd_value .= sha1($rnd_value . $seed);
                $seed = md5($seed . $rnd_value);
                $rnd_value .= sha1($rnd_value);
                $rnd_value .= sha1($rnd_value . $seed);
                $seed = md5($seed . $rnd_value);
-               update_option('random_seed', $seed);
+               set_transient('random_seed', $seed);
        }
 
        // Take the first 8 digits for our value
        }
 
        // Take the first 8 digits for our value
@@ -1470,8 +1499,8 @@ function wp_set_password( $password, $user_id ) {
        global $wpdb;
 
        $hash = wp_hash_password($password);
        global $wpdb;
 
        $hash = wp_hash_password($password);
-       $query = $wpdb->prepare("UPDATE $wpdb->users SET user_pass = %s, user_activation_key = '' WHERE ID = %d", $hash, $user_id);
-       $wpdb->query($query);
+       $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id) );
+
        wp_cache_delete($user_id, 'users');
 }
 endif;
        wp_cache_delete($user_id, 'users');
 }
 endif;
@@ -1494,7 +1523,7 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
        if ( false === $alt)
                $safe_alt = '';
        else
        if ( false === $alt)
                $safe_alt = '';
        else
-               $safe_alt = attribute_escape( $alt );
+               $safe_alt = esc_attr( $alt );
 
        if ( !is_numeric($size) )
                $size = '96';
 
        if ( !is_numeric($size) )
                $size = '96';
@@ -1530,7 +1559,7 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
        }
 
        if ( is_ssl() )
        }
 
        if ( is_ssl() )
-               $host = 'https://secure.gravatar.com'; 
+               $host = 'https://secure.gravatar.com';
        else
                $host = 'http://www.gravatar.com';
 
        else
                $host = 'http://www.gravatar.com';
 
@@ -1609,7 +1638,7 @@ if ( !function_exists('wp_get_cookie_login') ):
  * This function is deprecated and should no longer be extended as it won't be
  * used anywhere in WordPress. Also, plugins shouldn't use it either.
  *
  * This function is deprecated and should no longer be extended as it won't be
  * used anywhere in WordPress. Also, plugins shouldn't use it either.
  *
- * @since 2.0.4
+ * @since 2.0.3
  * @deprecated No alternative
  *
  * @return bool Always returns false
  * @deprecated No alternative
  *
  * @return bool Always returns false
index b00ed08a1c321248a1ed525c8cc291807ef5c84d..0588bc9ac7a9f2ae62f02ff6986f3f5aa4a35aa4 100644 (file)
@@ -492,10 +492,38 @@ function plugin_basename($file) {
        $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
        $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
        $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
        $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
        $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
        $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
-       $file = preg_replace('|^' . preg_quote($plugin_dir, '|') . '/|','',$file); // get relative path from plugins dir
+       $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
+       $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
+       $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
        return $file;
 }
 
        return $file;
 }
 
+/**
+ * Gets the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.8
+ *
+ * @param string $file The filename of the plugin (__FILE__)
+ * @return string the filesystem path of the directory that contains the plugin
+ */
+function plugin_dir_path( $file ) {
+       return trailingslashit( dirname( $file ) );
+}
+
+/**
+ * Gets the URL directory path (with trailing slash) for the plugin __FILE__ passed in
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 2.8
+ *
+ * @param string $file The filename of the plugin (__FILE__)
+ * @return string the URL path of the directory that contains the plugin
+ */
+function plugin_dir_url( $file ) {
+       return trailingslashit( plugins_url( '', $file ) );
+}
+
 /**
  * Set the activation hook for a plugin.
  *
 /**
  * Set the activation hook for a plugin.
  *
@@ -512,8 +540,6 @@ function plugin_basename($file) {
  * @subpackage Plugin
  * @since 2.0
  *
  * @subpackage Plugin
  * @since 2.0
  *
- * @access private
- *
  * @param string $file The filename of the plugin including the path.
  * @param callback $function the function hooked to the 'activate_PLUGIN' action.
  */
  * @param string $file The filename of the plugin including the path.
  * @param callback $function the function hooked to the 'activate_PLUGIN' action.
  */
@@ -539,8 +565,6 @@ function register_activation_hook($file, $function) {
  * @subpackage Plugin
  * @since 2.0
  *
  * @subpackage Plugin
  * @since 2.0
  *
- * @access private
- *
  * @param string $file The filename of the plugin including the path.
  * @param callback $function the function hooked to the 'activate_PLUGIN' action.
  */
  * @param string $file The filename of the plugin including the path.
  * @param callback $function the function hooked to the 'activate_PLUGIN' action.
  */
@@ -641,13 +665,14 @@ function _wp_call_all_hook($args) {
  *
  * @global array $wp_filter Storage for all of the filters and actions
  * @param string $tag Used in counting how many hooks were applied
  *
  * @global array $wp_filter Storage for all of the filters and actions
  * @param string $tag Used in counting how many hooks were applied
- * @param string|array $function Used for creating unique id
+ * @param callback $function Used for creating unique id
  * @param int|bool $priority Used in counting how many hooks were applied.  If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
  * @param string $type filter or action
  * @param int|bool $priority Used in counting how many hooks were applied.  If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
  * @param string $type filter or action
- * @return string Unique ID for usage as array key
+ * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id.
  */
 function _wp_filter_build_unique_id($tag, $function, $priority) {
        global $wp_filter;
  */
 function _wp_filter_build_unique_id($tag, $function, $priority) {
        global $wp_filter;
+       static $filter_id_count = 0;
 
        // If function then just skip all of the tests and not overwrite the following.
        if ( is_string($function) )
 
        // If function then just skip all of the tests and not overwrite the following.
        if ( is_string($function) )
@@ -658,10 +683,8 @@ function _wp_filter_build_unique_id($tag, $function, $priority) {
                if ( !isset($function[0]->wp_filter_id) ) {
                        if ( false === $priority )
                                return false;
                if ( !isset($function[0]->wp_filter_id) ) {
                        if ( false === $priority )
                                return false;
-                       $count = isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
-                       $function[0]->wp_filter_id = $count;
-                       $obj_idx .= $count;
-                       unset($count);
+                       $obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
+                       $function[0]->wp_filter_id = $filter_id_count++;
                } else
                        $obj_idx .= $function[0]->wp_filter_id;
                return $obj_idx;
                } else
                        $obj_idx .= $function[0]->wp_filter_id;
                return $obj_idx;
diff --git a/wp-includes/pomo/entry.php b/wp-includes/pomo/entry.php
new file mode 100644 (file)
index 0000000..bb146a7
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Contains Translation_Entry class
+ *
+ * @version $Id: entry.php 13 2008-04-21 12:03:37Z nbachiyski $
+ * @package pomo
+ * @subpackage entry
+ */
+
+
+/**
+ * Translation_Entry class encapsulates a translatable string
+ */
+class Translation_Entry {
+
+       /**
+        * Whether the entry contains a string and its plural form, default is false
+        *
+        * @var boolean
+        */
+       var $is_plural = false;
+
+       var $context = null;
+       var $singular = null;
+       var $plural = null;
+       var $translations = array();
+       var $translator_comments = '';
+       var $extracted_comments = '';
+       var $references = array();
+       var $flags = array();
+
+       /**
+        * @param array $args associative array, support following keys:
+        *      - singular (string) -- the string to translate, if omitted and empty entry will be created
+        *      - plural (string) -- the plural form of the string, setting this will set {@link $is_plural} to true
+        *      - translations (array) -- translations of the string and possibly -- its plural forms
+        *      - context (string) -- a string differentiating two equal strings used in different contexts
+        *      - translator_comments (string) -- comments left by translators
+        *      - extracted_comments (string) -- comments left by developers
+        *      - references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form
+        *      - flags (array) -- flags like php-format
+        */
+       function Translation_Entry($args=array()) {
+               // if no singular -- empty object
+               if (!isset($args['singular'])) {
+                       return;
+               }
+               // get member variable values from args hash
+               $object_varnames = array_keys(get_object_vars($this));
+               foreach ($args as $varname => $value) {
+                       if (in_array($varname, $object_varnames)) {
+                               $this->$varname = $value;
+                       }
+               }
+               if (isset($args['plural'])) $this->is_plural = true;
+               if (!is_array($this->translations)) $this->translations = array();
+               if (!is_array($this->references)) $this->references = array();
+               if (!is_array($this->flags)) $this->flags = array();
+       }
+
+       /**
+        * Generates a unique key for this entry
+        *
+        * @return string|bool the key or false if the entry is empty
+        */
+       function key() {
+               if (is_null($this->singular)) return false;
+               // prepend context and EOT, like in MO files
+               return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
+       }
+}
+?>
diff --git a/wp-includes/pomo/mo.php b/wp-includes/pomo/mo.php
new file mode 100644 (file)
index 0000000..6055838
--- /dev/null
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Class for working with MO files
+ *
+ * @version $Id: mo.php 33 2009-02-16 09:33:39Z nbachiyski $
+ * @package pomo
+ * @subpackage mo
+ */
+
+require_once dirname(__FILE__) . '/translations.php';
+require_once dirname(__FILE__) . '/streams.php';
+
+class MO extends Translations {
+
+       var $_nplurals = 2;
+
+       function set_header($header, $value) {
+               parent::set_header($header, $value);
+               if ('Plural-Forms' == $header)
+                       $this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($value);
+       }
+
+       /**
+        * Fills up with the entries from MO file $filename
+        *
+        * @param string $filename MO file to load
+        */
+       function import_from_file($filename) {
+               $reader = new POMO_CachedIntFileReader($filename);
+               if (isset($reader->error)) {
+                       return false;
+               }
+               return $this->import_from_reader($reader);
+       }
+
+       function get_byteorder($magic) {
+
+               // The magic is 0x950412de
+
+               // bug in PHP 5.0.2, see https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
+               $magic_little = (int) - 1794895138;
+               $magic_little_64 = (int) 2500072158;
+               // 0xde120495
+               $magic_big = ((int) - 569244523) && 0xFFFFFFFF;
+
+               if ($magic_little == $magic || $magic_little_64 == $magic) {
+                       return 'little';
+               } else if ($magic_big == $magic) {
+                       return 'big';
+               } else {
+                       return false;
+               }
+       }
+
+       function import_from_reader($reader) {
+               $reader->setEndian('little');
+               $endian = MO::get_byteorder($reader->readint32());
+               if (false === $endian) {
+                       return false;
+               }
+               $reader->setEndian($endian);
+
+               $revision = $reader->readint32();
+               $total = $reader->readint32();
+               // get addresses of array of lenghts and offsets for original string and translations
+               $originals_lo_addr = $reader->readint32();
+               $translations_lo_addr = $reader->readint32();
+
+               $reader->seekto($originals_lo_addr);
+               $originals_lo = $reader->readint32array($total * 2); // each of
+               $reader->seekto($translations_lo_addr);
+               $translations_lo = $reader->readint32array($total * 2);
+
+               $length = create_function('$i', 'return $i * 2 + 1;');
+               $offset = create_function('$i', 'return $i * 2 + 2;');
+
+               for ($i = 0; $i < $total; ++$i) {
+                       $reader->seekto($originals_lo[$offset($i)]);
+                       $original = $reader->read($originals_lo[$length($i)]);
+                       $reader->seekto($translations_lo[$offset($i)]);
+                       $translation = $reader->read($translations_lo[$length($i)]);
+                       if ('' == $original) {
+                               $this->set_headers($this->make_headers($translation));
+                       } else {
+                               $this->add_entry($this->make_entry($original, $translation));
+                       }
+               }
+               return true;
+       }
+
+       function make_headers($translation) {
+               $headers = array();
+               $lines = explode("\n", $translation);
+               foreach($lines as $line) {
+                       $parts = explode(':', $line, 2);
+                       if (!isset($parts[1])) continue;
+                       $headers[trim($parts[0])] = trim($parts[1]);
+               }
+               return $headers;
+       }
+
+       /**
+        * @static
+        */
+       function &make_entry($original, $translation) {
+               $args = array();
+               // look for context
+               $parts = explode(chr(4), $original);
+               if (isset($parts[1])) {
+                       $original = $parts[1];
+                       $args['context'] = $parts[0];
+               }
+               // look for plural original
+               $parts = explode(chr(0), $original);
+               $args['singular'] = $parts[0];
+               if (isset($parts[1])) {
+                       $args['plural'] = $parts[1];
+               }
+               // plural translations are also separated by \0
+               $args['translations'] = explode(chr(0), $translation);
+               $entry = & new Translation_Entry($args);
+               return $entry;
+       }
+
+       function select_plural_form($count) {
+               return $this->gettext_select_plural_form($count);
+       }
+
+       function get_plural_forms_count() {
+               return $this->_nplurals;
+       }
+
+
+}
+?>
diff --git a/wp-includes/pomo/po.php b/wp-includes/pomo/po.php
new file mode 100644 (file)
index 0000000..5052067
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+/**
+ * Class for working with PO files
+ *
+ * @version $Id: po.php 33 2009-02-16 09:33:39Z nbachiyski $
+ * @package pomo
+ * @subpackage po
+ */
+
+require_once dirname(__FILE__) . '/translations.php';
+
+define('PO_MAX_LINE_LEN', 79);
+
+ini_set('auto_detect_line_endings', 1);
+
+/**
+ * Routines for working with PO files
+ */
+class PO extends Translations {
+
+
+       /**
+        * Exports headers to a PO entry
+        *
+        * @return string msgid/msgstr PO entry for this PO file headers, doesn't contain newline at the end
+        */
+       function export_headers() {
+               $header_string = '';
+               foreach($this->headers as $header => $value) {
+                       $header_string.= "$header: $value\n";
+               }
+               $poified = PO::poify($header_string);
+               return rtrim("msgid \"\"\nmsgstr $poified");
+       }
+
+       /**
+        * Exports all entries to PO format
+        *
+        * @return string sequence of mgsgid/msgstr PO strings, doesn't containt newline at the end
+        */
+       function export_entries() {
+               //TODO sorting
+               return implode("\n\n", array_map(array('PO', 'export_entry'), $this->entries));
+       }
+
+       /**
+        * Exports the whole PO file as a string
+        *
+        * @param bool $include_headers whether to include the headers in the export
+        * @return string ready for inclusion in PO file string for headers and all the enrtries
+        */
+       function export($include_headers = true) {
+               $res = '';
+               if ($include_headers) {
+                       $res .= $this->export_headers();
+                       $res .= "\n\n";
+               }
+               $res .= $this->export_entries();
+               return $res;
+       }
+
+       /**
+        * Same as {@link export}, but writes the result to a file
+        *
+        * @param string $filename where to write the PO string
+        * @param bool $include_headers whether to include tje headers in the export
+        * @return bool true on success, false on error
+        */
+       function export_to_file($filename, $include_headers = true) {
+               $fh = fopen($filename, 'w');
+               if (false === $fh) return false;
+               $export = $this->export($include_headers);
+               $res = fwrite($fh, $export);
+               if (false === $res) return false;
+               return fclose($fh);
+       }
+
+
+       /**
+        * Formats a string in PO-style
+        *
+        * @static
+        * @param string $string the string to format
+        * @return string the poified string
+        */
+       function poify($string) {
+               $quote = '"';
+               $slash = '\\';
+               $newline = "\n";
+               $tab = "\t";
+
+               $replaces = array(
+                       "$slash"        => "$slash$slash",
+                       "$tab"          => '\t',
+                       "$quote"        => "$slash$quote",
+               );
+               $string = str_replace(array_keys($replaces), array_values($replaces), $string);
+
+               $po = array();
+               foreach (explode($newline, $string) as $line) {
+                       $po[] = wordwrap($line, PO_MAX_LINE_LEN - 2, " $quote$newline$quote");
+               }
+               $po = $quote.implode("${slash}n$quote$newline$quote", $po).$quote;
+               // add empty string on first line for readbility
+               if (false !== strpos($po, $newline)) {
+                       $po = "$quote$quote$newline$po";
+               }
+               // remove empty strings
+               $po = str_replace("$newline$quote$quote", '', $po);
+               return $po;
+       }
+
+       /**
+        * Inserts $with in the beginning of every new line of $string and
+        * returns the modified string
+        *
+        * @static
+        * @param string $string prepend lines in this string
+        * @param string $with prepend lines with this string
+        */
+       function prepend_each_line($string, $with) {
+               $php_with = var_export($with, true);
+               $lines = explode("\n", $string);
+               // do not prepend the string on the last empty line, artefact by explode
+               if ("\n" == substr($string, -1)) unset($lines[count($lines) - 1]);
+               $res = implode("\n", array_map(create_function('$x', "return $php_with.\$x;"), $lines));
+               // give back the empty line, we ignored above
+               if ("\n" == substr($string, -1)) $res .= "\n";
+               return $res;
+       }
+
+       /**
+        * Prepare a text as a comment -- wraps the lines and prepends #
+        * and a special character to each line
+        *
+        * @access private
+        * @param string $text the comment text
+        * @param string $char character to denote a special PO comment,
+        *      like :, default is a space
+        */
+       function comment_block($text, $char=' ') {
+               $text = wordwrap($text, PO_MAX_LINE_LEN - 3);
+               return PO::prepend_each_line($text, "#$char ");
+       }
+
+       /**
+        * Builds a string from the entry for inclusion in PO file
+        *
+        * @static
+        * @param object &$entry the entry to convert to po string
+        * @return string|bool PO-style formatted string for the entry or
+        *      false if the entry is empty
+        */
+       function export_entry(&$entry) {
+               if (is_null($entry->singular)) return false;
+               $po = array();
+               if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
+               if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
+               if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
+               if (!empty($entry->flags)) $po[] = PO::comment_block(implode("\n", $entry->flags), ',');
+               if (!is_null($entry->context)) $po[] = 'msgctxt '.PO::poify($entry->context);
+               $po[] = 'msgid '.PO::poify($entry->singular);
+               if (!$entry->is_plural) {
+                       $translation = empty($entry->translations)? '' : $entry->translations[0];
+                       $po[] = 'msgstr '.PO::poify($translation);
+               } else {
+                       $po[] = 'msgid_plural '.PO::poify($entry->plural);
+                       $translations = empty($entry->translations)? array('', '') : $entry->translations;
+                       foreach($translations as $i => $translation) {
+                               $po[] = "msgstr[$i] ".PO::poify($translation);
+                       }
+               }
+               return implode("\n", $po);
+       }
+
+}
+?>
diff --git a/wp-includes/pomo/streams.php b/wp-includes/pomo/streams.php
new file mode 100644 (file)
index 0000000..3b0241a
--- /dev/null
@@ -0,0 +1,122 @@
+<?php
+/**
+ * Classes, which help reading streams of data from files.
+ * Based on the classes from Danilo Segan <danilo@kvota.net>
+ *
+ * @version $Id: streams.php 33 2009-02-16 09:33:39Z nbachiyski $
+ * @package pomo
+ * @subpackage streams
+ */
+
+
+/**
+ * Provides file-like methods for manipulating a string instead
+ * of a physical file.
+ */
+class POMO_StringReader {
+  var $_pos;
+  var $_str;
+
+  function POMO_StringReader($str = '') {
+    $this->_str = $str;
+    $this->_pos = 0;
+  }
+
+  function read($bytes) {
+    $data = substr($this->_str, $this->_pos, $bytes);
+    $this->_pos += $bytes;
+    if (strlen($this->_str)<$this->_pos)
+      $this->_pos = strlen($this->_str);
+
+    return $data;
+  }
+
+  function seekto($pos) {
+    $this->_pos = $pos;
+    if (strlen($this->_str)<$this->_pos)
+      $this->_pos = strlen($this->_str);
+    return $this->_pos;
+  }
+
+  function pos() {
+    return $this->_pos;
+  }
+
+  function length() {
+    return strlen($this->_str);
+  }
+
+}
+
+/**
+ * Reads the contents of the file in the beginning.
+ */
+class POMO_CachedFileReader extends POMO_StringReader {
+       function POMO_CachedFileReader($filename) {
+               $this->_str = file_get_contents($filename);
+               if (false === $this->_str)
+                       return false;
+               $this->pos = 0;
+       }
+}
+
+/**
+ * Allows reading integers from a file.
+ */
+class POMO_CachedIntFileReader extends POMO_CachedFileReader {
+
+       var $endian = 'little';
+
+       /**
+        * Opens a file and caches it.
+        *
+        * @param $filename string name of the file to be opened
+        * @param $endian string endianness of the words in the file, allowed
+        *      values are 'little' or 'big'. Default value is 'little'
+        */
+       function POMO_CachedIntFileReader($filename, $endian = 'little') {
+               $this->endian = $endian;
+               parent::POMO_CachedFileReader($filename);
+       }
+
+       /**
+        * Sets the endianness of the file.
+        *
+        * @param $endian string 'big' or 'little'
+        */
+       function setEndian($endian) {
+               $this->endian = $endian;
+       }
+
+       /**
+        * Reads a 32bit Integer from the Stream
+        *
+        * @return mixed The integer, corresponding to the next 32 bits from
+        *      the stream of false if there are not enough bytes or on error
+        */
+       function readint32() {
+               $bytes = $this->read(4);
+               if (4 != strlen($bytes))
+                       return false;
+               $endian_letter = ('big' == $this->endian)? 'N' : 'V';
+               $int = unpack($endian_letter, $bytes);
+               return array_shift($int);
+       }
+
+       /**
+        * Reads an array of 32-bit Integers from the Stream
+        *
+        * @param integer count How many elements should be read
+        * @return mixed Array of integers or false if there isn't
+        *      enough data or on error
+        */
+       function readint32array($count) {
+               $bytes = $this->read(4 * $count);
+               if (4*$count != strlen($bytes))
+                       return false;
+               $endian_letter = ('big' == $this->endian)? 'N' : 'V';
+               return unpack($endian_letter.$count, $bytes);
+       }
+}
+
+?>
diff --git a/wp-includes/pomo/translations.php b/wp-includes/pomo/translations.php
new file mode 100644 (file)
index 0000000..0d73ee9
--- /dev/null
@@ -0,0 +1,173 @@
+<?php
+/**
+ * Class for a set of entries for translation and their associated headers
+ *
+ * @version $Id: translations.php 35 2009-02-16 12:54:57Z nbachiyski $
+ * @package pomo
+ * @subpackage translations
+ */
+
+require_once dirname(__FILE__) . '/entry.php';
+
+class Translations {
+       var $entries = array();
+       var $headers = array();
+
+       /**
+        * Add entry to the PO structure
+        *
+        * @param object &$entry
+        * @return bool true on success, false if the entry doesn't have a key
+        */
+       function add_entry(&$entry) {
+               $key = $entry->key();
+               if (false === $key) return false;
+               $this->entries[$key] = &$entry;
+               return true;
+       }
+
+       /**
+        * Sets $header PO header to $value
+        *
+        * If the header already exists, it will be overwritten
+        *
+        * TODO: this should be out of this class, it is gettext specific
+        *
+        * @param string $header header name, without trailing :
+        * @param string $value header value, without trailing \n
+        */
+       function set_header($header, $value) {
+               $this->headers[$header] = $value;
+       }
+
+       function set_headers(&$headers) {
+               foreach($headers as $header => $value) {
+                       $this->set_header($header, $value);
+               }
+       }
+
+       function get_header($header) {
+               return isset($this->headers[$header])? $this->headers[$header] : false;
+       }
+
+       function translate_entry(&$entry) {
+               $key = $entry->key();
+               return isset($this->entries[$key])? $this->entries[$key] : false;
+       }
+
+       function translate($singular, $context=null) {
+               $entry = new Translation_Entry(array('singular' => $singular, 'context' => $context));
+               $translated = $this->translate_entry($entry);
+               return ($translated && !empty($translated->translations))? $translated->translations[0] : $singular;
+       }
+
+       /**
+        * Given the number of items, returns the 0-based index of the plural form to use
+        *
+        * Here, in the base Translations class, the commong logic for English is implmented:
+        *      0 if there is one element, 1 otherwise
+        *
+        * This function should be overrided by the sub-classes. For example MO/PO can derive the logic
+        * from their headers.
+        *
+        * @param integer $count number of items
+        */
+       function select_plural_form($count) {
+               return 1 == $count? 0 : 1;
+       }
+
+       function get_plural_forms_count() {
+               return 2;
+       }
+
+       function translate_plural($singular, $plural, $count, $context = null) {
+               $entry = new Translation_Entry(array('singular' => $singular, 'plural' => $plural, 'context' => $context));
+               $translated = $this->translate_entry($entry);
+               $index = $this->select_plural_form($count);
+               $total_plural_forms = $this->get_plural_forms_count();
+               if ($translated && 0 <= $index && $index < $total_plural_forms &&
+                               is_array($translated->translations) &&
+                               count($translated->translations) == $total_plural_forms)
+                       return $translated->translations[$index];
+               else
+                       return 1 == $count? $singular : $plural;
+       }
+
+       /**
+        * The gettext implmentation of select_plural_form.
+        *
+        * It lives in this class, because there are more than one descendand, which will use it and
+        * they can't share it effectively.
+        *
+        */
+       function gettext_select_plural_form($count) {
+               if (!isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) {
+                       $plural_header = $this->get_header('Plural-Forms');
+                       $this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($plural_header);
+               }
+               return call_user_func($this->_gettext_select_plural_form, $count);
+       }
+
+       /**
+        * Makes a function, which will return the right translation index, according to the
+        * plural forms header
+        */
+       function _make_gettext_select_plural_form($plural_header) {
+               $res = create_function('$count', 'return 1 == $count? 0 : 1;');
+               if ($plural_header && (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $plural_header, $matches))) {
+                       $nplurals = (int)$matches[1];
+                       $this->_nplurals = $nplurals;
+                       $plural_expr = trim($this->_parenthesize_plural_exression($matches[2]));
+                       $plural_expr = str_replace('n', '$n', $plural_expr);
+                       $func_body = "
+                               \$index = (int)($plural_expr);
+                               return (\$index < $nplurals)? \$index : $nplurals - 1;";
+                       $res = create_function('$n', $func_body);
+               }
+               return $res;
+       }
+
+       /**
+        * Adds parantheses to the inner parts of ternary operators in
+        * plural expressions, because PHP evaluates ternary oerators from left to right
+        *
+        * @param string $expression the expression without parentheses
+        * @return string the expression with parentheses added
+        */
+       function _parenthesize_plural_exression($expression) {
+               $expression .= ';';
+               $res = '';
+               $depth = 0;
+               for ($i = 0; $i < strlen($expression); ++$i) {
+                       $char = $expression[$i];
+                       switch ($char) {
+                               case '?':
+                                       $res .= ' ? (';
+                                       $depth++;
+                                       break;
+                               case ':':
+                                       $res .= ') : (';
+                                       break;
+                               case ';':
+                                       $res .= str_repeat(')', $depth) . ';';
+                                       $depth= 0;
+                                       break;
+                               default:
+                                       $res .= $char;
+                       }
+               }
+               return rtrim($res, ';');
+       }
+
+       /**
+        * Merge $other in the current object.
+        *
+        * @param Object &$other Another Translation object, whose translations will be merged in this one
+        * @return void
+        **/
+       function merge_with(&$other) {
+               $this->entries = array_merge($this->entries, $other->entries);
+       }
+}
+
+?>
index 2ff0e7db168fb2f22fcb4af60606483ea1bb8bdf..30856c58465027aef2fdbf9e4d7549a06a6b686f 100644 (file)
@@ -63,7 +63,7 @@ function the_title($before = '', $after = '', $echo = true) {
  * an array. See the function for what can be override in the $args parameter.
  *
  * The title before it is displayed will have the tags stripped and {@link
  * an array. See the function for what can be override in the $args parameter.
  *
  * The title before it is displayed will have the tags stripped and {@link
- * attribute_escape()} before it is passed to the user or displayed. The default
+ * esc_attr()} before it is passed to the user or displayed. The default
  * as with {@link the_title()}, is to display the title.
  *
  * @since 2.3.0
  * as with {@link the_title()}, is to display the title.
  *
  * @since 2.3.0
@@ -83,7 +83,7 @@ function the_title_attribute( $args = '' ) {
 
 
        $title = $before . $title . $after;
 
 
        $title = $before . $title . $after;
-       $title = attribute_escape(strip_tags($title));
+       $title = esc_attr(strip_tags($title));
 
        if ( $echo )
                echo $title;
 
        if ( $echo )
                echo $title;
@@ -109,12 +109,15 @@ function get_the_title( $id = 0 ) {
        $title = $post->post_title;
 
        if ( !is_admin() ) {
        $title = $post->post_title;
 
        if ( !is_admin() ) {
-               if ( !empty($post->post_password) )
-                       $title = sprintf(__('Protected: %s'), $title);
-               else if ( isset($post->post_status) && 'private' == $post->post_status )
-                       $title = sprintf(__('Private: %s'), $title);
+               if ( !empty($post->post_password) ) {
+                       $protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
+                       $title = sprintf($protected_title_format, $title);
+               } else if ( isset($post->post_status) && 'private' == $post->post_status ) {
+                       $private_title_format = apply_filters('private_title_format', __('Private: %s'));
+                       $title = sprintf($private_title_format, $title);
+               }
        }
        }
-       return apply_filters( 'the_title', $title );
+       return apply_filters( 'the_title', $title, $post->ID );
 }
 
 /**
 }
 
 /**
@@ -183,6 +186,7 @@ function get_the_content($more_link_text = null, $stripteaser = 0, $more_file =
                $more_link_text = __( '(more...)' );
 
        $output = '';
                $more_link_text = __( '(more...)' );
 
        $output = '';
+       $hasTeaser = false;
 
        // If post password required and it doesn't match the cookie.
        if ( post_password_required($post) ) {
 
        // If post password required and it doesn't match the cookie.
        if ( post_password_required($post) ) {
@@ -203,22 +207,24 @@ function get_the_content($more_link_text = null, $stripteaser = 0, $more_file =
                $content = explode($matches[0], $content, 2);
                if ( !empty($matches[1]) && !empty($more_link_text) )
                        $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
                $content = explode($matches[0], $content, 2);
                if ( !empty($matches[1]) && !empty($more_link_text) )
                        $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
+
+               $hasTeaser = true;
        } else {
                $content = array($content);
        }
        if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
                $stripteaser = 1;
        $teaser = $content[0];
        } else {
                $content = array($content);
        }
        if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
                $stripteaser = 1;
        $teaser = $content[0];
-       if ( ($more) && ($stripteaser) )
+       if ( ($more) && ($stripteaser) && ($hasTeaser) )
                $teaser = '';
        $output .= $teaser;
        if ( count($content) > 1 ) {
                if ( $more ) {
                $teaser = '';
        $output .= $teaser;
        if ( count($content) > 1 ) {
                if ( $more ) {
-                       $output .= '<span id="more-'.$id.'"></span>'.$content[1];
+                       $output .= '<span id="more-' . $id . '"></span>' . $content[1];
                } else {
                } else {
-                       $output = balanceTags($output);
                        if ( ! empty($more_link_text) )
                        if ( ! empty($more_link_text) )
-                               $output .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
+                               $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>", $more_link_text );
+                       $output = force_balance_tags($output);
                }
 
        }
                }
 
        }
@@ -306,6 +312,7 @@ function get_post_class( $class = '', $post_id = null ) {
 
        $classes = array();
 
 
        $classes = array();
 
+       $classes[] = 'post-' . $post->ID;
        $classes[] = $post->post_type;
 
        // sticky for Sticky Posts
        $classes[] = $post->post_type;
 
        // sticky for Sticky Posts
@@ -319,14 +326,14 @@ function get_post_class( $class = '', $post_id = null ) {
        foreach ( (array) get_the_category($post->ID) as $cat ) {
                if ( empty($cat->slug ) )
                        continue;
        foreach ( (array) get_the_category($post->ID) as $cat ) {
                if ( empty($cat->slug ) )
                        continue;
-               $classes[] = 'category-' . $cat->slug;
+               $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
        }
 
        // Tags
        foreach ( (array) get_the_tags($post->ID) as $tag ) {
                if ( empty($tag->slug ) )
                        continue;
        }
 
        // Tags
        foreach ( (array) get_the_tags($post->ID) as $tag ) {
                if ( empty($tag->slug ) )
                        continue;
-               $classes[] = 'tag-' . $tag->slug;
+               $classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id);
        }
 
        if ( !empty($class) ) {
        }
 
        if ( !empty($class) ) {
@@ -338,6 +345,141 @@ function get_post_class( $class = '', $post_id = null ) {
        return apply_filters('post_class', $classes, $class, $post_id);
 }
 
        return apply_filters('post_class', $classes, $class, $post_id);
 }
 
+/**
+ * Display the classes for the body element.
+ *
+ * @since 2.8.0
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ */
+function body_class( $class = '' ) {
+       // Separates classes with a single space, collates classes for body element
+       echo 'class="' . join( ' ', get_body_class( $class ) ) . '"';
+}
+
+/**
+ * Retrieve the classes for the body element as an array.
+ *
+ * @since 2.8.0
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @return array Array of classes.
+ */
+function get_body_class( $class = '' ) {
+       global $wp_query, $wpdb, $current_user;
+
+       $classes = array();
+
+       if ( 'rtl' == get_bloginfo('text_direction') )
+               $classes[] = 'rtl';
+
+       if ( is_front_page() )
+               $classes[] = 'home';
+       if ( is_home() )
+               $classes[] = 'blog';
+       if ( is_archive() )
+               $classes[] = 'archive';
+       if ( is_date() )
+               $classes[] = 'date';
+       if ( is_search() )
+               $classes[] = 'search';
+       if ( is_paged() )
+               $classes[] = 'paged';
+       if ( is_attachment() )
+               $classes[] = 'attachment';
+       if ( is_404() )
+               $classes[] = 'error404';
+
+       if ( is_single() ) {
+               $wp_query->post = $wp_query->posts[0];
+               setup_postdata($wp_query->post);
+
+               $postID = $wp_query->post->ID;
+               $classes[] = 'single postid-' . $postID;
+
+               if ( is_attachment() ) {
+                       $mime_type = get_post_mime_type();
+                       $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
+                       $classes[] = 'attachmentid-' . $postID;
+                       $classes[] = 'attachment-' . str_replace($mime_prefix, '', $mime_type);
+               }
+       } elseif ( is_archive() ) {
+               if ( is_author() ) {
+                       $author = $wp_query->get_queried_object();
+                       $classes[] = 'author';
+                       $classes[] = 'author-' . sanitize_html_class($author->user_nicename , $author->user_id);
+               } elseif ( is_category() ) {
+                       $cat = $wp_query->get_queried_object();
+                       $classes[] = 'category';
+                       $classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
+               } elseif ( is_tag() ) {
+                       $tags = $wp_query->get_queried_object();
+                       $classes[] = 'tag';
+                       $classes[] = 'tag-' . sanitize_html_class($tags->slug, $tags->term_id);
+               }
+       } elseif ( is_page() ) {
+               $classes[] = 'page';
+
+               $wp_query->post = $wp_query->posts[0];
+               setup_postdata($wp_query->post);
+
+               $pageID = $wp_query->post->ID;
+
+               $classes[] = 'page-id-' . $pageID;
+
+               if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) )
+                       $classes[] = 'page-parent';
+
+               if ( $wp_query->post->post_parent )
+                       $classes[] = 'page-child';
+                       $classes[] = 'parent-pageid-' . $wp_query->post->post_parent;
+
+               if ( is_page_template() )
+                       $classes[] = 'page-template';
+                       $classes[] = 'page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) );
+       } elseif ( is_search() ) {
+               if ( !empty($wp_query->posts) )
+                       $classes[] = 'search-results';
+               else
+                       $classes[] = 'search-no-results';
+       }
+
+       if ( is_user_logged_in() )
+               $classes[] = 'logged-in';
+
+       $page = $wp_query->get('page');
+
+       if ( !$page || $page < 2)
+               $page = $wp_query->get('paged');
+
+       if ( $page && $page > 1 ) {
+               $classes[] = 'paged-' . $page;
+
+               if ( is_single() )
+                       $classes[] = 'single-paged-' . $page;
+               elseif ( is_page() )
+                       $classes[] = 'page-paged-' . $page;
+               elseif ( is_category() )
+                       $classes[] = 'category-paged-' . $page;
+               elseif ( is_tag() )
+                       $classes[] = 'tag-paged-' . $page;
+               elseif ( is_date() )
+                       $classes[] = 'date-paged-' . $page;
+               elseif ( is_author() )
+                       $classes[] = 'author-paged-' . $page;
+               elseif ( is_search() )
+                       $classes[] = 'search-paged-' . $page;
+       }
+
+       if ( !empty($class) ) {
+               if ( !is_array( $class ) )
+                       $class = preg_split('#\s+#', $class);
+               $classes = array_merge($classes, $class);
+       }
+
+       return apply_filters('body_class', $classes, $class);
+}
+
 /**
  * Whether post requires password and correct password has been provided.
  *
 /**
  * Whether post requires password and correct password has been provided.
  *
@@ -569,7 +711,7 @@ function wp_dropdown_pages($args = '') {
                if ( $show_option_no_change )
                        $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
                if ( $show_option_none )
                if ( $show_option_no_change )
                        $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
                if ( $show_option_none )
-                       $output .= "\t<option value=\"$option_none_value\">$show_option_none</option>\n";
+                       $output .= "\t<option value=\"" . esc_attr($option_none_value) . "\">$show_option_none</option>\n";
                $output .= walk_page_dropdown_tree($pages, $depth, $r);
                $output .= "</select>\n";
        }
                $output .= walk_page_dropdown_tree($pages, $depth, $r);
                $output .= "</select>\n";
        }
@@ -621,7 +763,7 @@ function wp_list_pages($args = '') {
                        $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
 
                global $wp_query;
                        $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
 
                global $wp_query;
-               if ( is_page() || $wp_query->is_posts_page )
+               if ( is_page() || is_attachment() || $wp_query->is_posts_page )
                        $current_page = $wp_query->get_queried_object_id();
                $output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
 
                        $current_page = $wp_query->get_queried_object_id();
                $output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
 
@@ -719,7 +861,11 @@ function wp_page_menu( $args = array() ) {
  * @see Walker_Page::walk() for parameters and return description.
  */
 function walk_page_tree($pages, $depth, $current_page, $r) {
  * @see Walker_Page::walk() for parameters and return description.
  */
 function walk_page_tree($pages, $depth, $current_page, $r) {
-       $walker = new Walker_Page;
+       if ( empty($r['walker']) )
+               $walker = new Walker_Page;
+       else
+               $walker = $r['walker'];
+
        $args = array($pages, $depth, $r, $current_page);
        return call_user_func_array(array(&$walker, 'walk'), $args);
 }
        $args = array($pages, $depth, $r, $current_page);
        return call_user_func_array(array(&$walker, 'walk'), $args);
 }
@@ -732,8 +878,12 @@ function walk_page_tree($pages, $depth, $current_page, $r) {
  * @see Walker_PageDropdown::walk() for parameters and return description.
  */
 function walk_page_dropdown_tree() {
  * @see Walker_PageDropdown::walk() for parameters and return description.
  */
 function walk_page_dropdown_tree() {
-       $walker = new Walker_PageDropdown;
        $args = func_get_args();
        $args = func_get_args();
+       if ( empty($args[2]['walker']) ) // the user's options are the third parameter
+               $walker = new Walker_PageDropdown;
+       else
+               $walker = $args[2]['walker'];
+
        return call_user_func_array(array(&$walker, 'walk'), $args);
 }
 
        return call_user_func_array(array(&$walker, 'walk'), $args);
 }
 
@@ -765,12 +915,13 @@ function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $p
  * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function.
  *
  * @param int $id Optional. Post ID.
  * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function.
  *
  * @param int $id Optional. Post ID.
- * @param string $size Optional. Image size.
+ * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string.
  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
  * @param bool $icon Optional, default is false. Whether to include icon.
  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
  * @param bool $icon Optional, default is false. Whether to include icon.
+ * @param string $text Optional, default is false. If string, then will be link text.
  * @return string HTML content.
  */
  * @return string HTML content.
  */
-function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
+function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) {
        $id = intval($id);
        $_post = & get_post( $id );
 
        $id = intval($id);
        $_post = & get_post( $id );
 
@@ -780,13 +931,18 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false
        if ( $permalink )
                $url = get_attachment_link($_post->ID);
 
        if ( $permalink )
                $url = get_attachment_link($_post->ID);
 
-       $post_title = attribute_escape($_post->post_title);
+       $post_title = esc_attr($_post->post_title);
+
+       if ( $text ) {
+               $link_text = esc_attr($text);
+       } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
+               $link_text = wp_get_attachment_image($id, $size, $icon);
+       }
 
 
-       $link_text = wp_get_attachment_image($id, $size, $icon);
-       if ( !$link_text )
+       if( trim($link_text) == '' )
                $link_text = $_post->post_title;
 
                $link_text = $_post->post_title;
 
-       return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon );
+       return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
 }
 
 /**
 }
 
 /**
@@ -812,7 +968,7 @@ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false,
        if ( $permalink )
                $url = get_attachment_link($_post->ID);
 
        if ( $permalink )
                $url = get_attachment_link($_post->ID);
 
-       $post_title = attribute_escape($_post->post_title);
+       $post_title = esc_attr($_post->post_title);
 
        $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
        return "<a href='$url' title='$post_title'>$innerHTML</a>";
 
        $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
        return "<a href='$url' title='$post_title'>$innerHTML</a>";
@@ -908,7 +1064,7 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
                $constraint = '';
        }
 
                $constraint = '';
        }
 
-       $post_title = attribute_escape($post->post_title);
+       $post_title = esc_attr($post->post_title);
 
        $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
 
 
        $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
 
@@ -936,7 +1092,7 @@ function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false)
                return $innerHTML;
 
 
                return $innerHTML;
 
 
-       $innerHTML = attribute_escape($post->post_title);
+       $innerHTML = esc_attr($post->post_title);
 
        return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
 }
 
        return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
 }
@@ -982,7 +1138,7 @@ function get_the_password_form() {
        $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
        $output = '<form action="' . get_option('siteurl') . '/wp-pass.php" method="post">
        <p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
        $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
        $output = '<form action="' . get_option('siteurl') . '/wp-pass.php" method="post">
        <p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
-       <p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . __("Submit") . '" /></p>
+       <p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" /></p>
        </form>
        ';
        return apply_filters('the_password_form', $output);
        </form>
        ';
        return apply_filters('the_password_form', $output);
@@ -1044,11 +1200,14 @@ function wp_post_revision_title( $revision, $link = true ) {
        if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
                return false;
 
        if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
                return false;
 
-       $datef = _c( 'j F, Y @ G:i|revision date format');
-       $autosavef = __( '%s [Autosave]' );
-       $currentf  = __( '%s [Current Revision]' );
+       /* translators: revision date format, see http://php.net/date */
+       $datef = _x( 'j F, Y @ G:i', 'revision date format');
+       /* translators: 1: date */
+       $autosavef = __( '%1$s [Autosave]' );
+       /* translators: 1: date */
+       $currentf  = __( '%1$s [Current Revision]' );
 
 
-       $date = date_i18n( $datef, strtotime( $revision->post_modified ) );
+       $date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) );
        if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
                $date = "<a href='$link'>$date</a>";
 
        if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
                $date = "<a href='$link'>$date</a>";
 
@@ -1082,7 +1241,7 @@ function wp_post_revision_title( $revision, $link = true ) {
  * @uses wp_get_post_revisions()
  * @uses wp_post_revision_title()
  * @uses get_edit_post_link()
  * @uses wp_get_post_revisions()
  * @uses wp_post_revision_title()
  * @uses get_edit_post_link()
- * @uses get_author_name()
+ * @uses get_the_author_meta()
  *
  * @todo split into two functions (list, form-table) ?
  *
  *
  * @todo split into two functions (list, form-table) ?
  *
@@ -1111,7 +1270,8 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
                break;
        }
 
                break;
        }
 
-       $titlef = _c( '%1$s by %2$s|post revision 1:datetime, 2:name' );
+       /* translators: post revision: 1: when, 2: author name */
+       $titlef = _x( '%1$s by %2$s', 'post revision' );
 
        if ( $parent )
                array_unshift( $revisions, $post );
 
        if ( $parent )
                array_unshift( $revisions, $post );
@@ -1126,7 +1286,7 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
                        continue;
 
                $date = wp_post_revision_title( $revision );
                        continue;
 
                $date = wp_post_revision_title( $revision );
-               $name = get_author_name( $revision->post_author );
+               $name = get_the_author_meta( 'display_name', $revision->post_author );
 
                if ( 'form-table' == $format ) {
                        if ( $left )
 
                if ( 'form-table' == $format ) {
                        if ( $left )
@@ -1160,7 +1320,7 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) {
 
 <div class="tablenav">
        <div class="alignleft">
 
 <div class="tablenav">
        <div class="alignleft">
-               <input type="submit" class="button-secondary" value="<?php _e( 'Compare Revisions' ); ?>" />
+               <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" />
                <input type="hidden" name="action" value="diff" />
        </div>
 </div>
                <input type="hidden" name="action" value="diff" />
        </div>
 </div>
index 605c24511eb781c3442c77a62674124d9acd5cba..407b33c576970ed2d02a05beab297f236f42c585 100644 (file)
@@ -417,14 +417,15 @@ function get_post_type($post = false) {
  * @uses $wpdb
  *
  * @param int $post_id Post ID to change post type. Not actually optional.
  * @uses $wpdb
  *
  * @param int $post_id Post ID to change post type. Not actually optional.
- * @param string $post_type Optional, default is post. Supported values are 'post' or 'page' to name a few.
+ * @param string $post_type Optional, default is post. Supported values are 'post' or 'page' to
+ *  name a few.
  * @return int Amount of rows changed. Should be 1 for success and 0 for failure.
  */
 function set_post_type( $post_id = 0, $post_type = 'post' ) {
        global $wpdb;
 
        $post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db');
  * @return int Amount of rows changed. Should be 1 for success and 0 for failure.
  */
 function set_post_type( $post_id = 0, $post_type = 'post' ) {
        global $wpdb;
 
        $post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db');
-       $return = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_type = %s WHERE ID = %d", $post_type, $post_id) );
+       $return = $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) );
 
        if ( 'page' == $post_type )
                clean_page_cache($post_id);
 
        if ( 'page' == $post_type )
                clean_page_cache($post_id);
@@ -456,7 +457,7 @@ function set_post_type( $post_id = 0, $post_type = 'post' ) {
  * @uses WP_Query::query() See for more default arguments and information.
  * @link http://codex.wordpress.org/Template_Tags/get_posts
  *
  * @uses WP_Query::query() See for more default arguments and information.
  * @link http://codex.wordpress.org/Template_Tags/get_posts
  *
- * @param array $args Optional. Override defaults.
+ * @param array $args Optional. Overrides defaults.
  * @return array List of posts.
  */
 function get_posts($args = null) {
  * @return array List of posts.
  */
 function get_posts($args = null) {
@@ -510,6 +511,9 @@ function get_posts($args = null) {
  * @return bool False for failure. True for success.
  */
 function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
  * @return bool False for failure. True for success.
  */
 function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
+       if ( !$meta_key )
+               return false;
+
        global $wpdb;
 
        // make sure meta is added to the post, not a revision
        global $wpdb;
 
        // make sure meta is added to the post, not a revision
@@ -558,6 +562,9 @@ function delete_post_meta($post_id, $meta_key, $meta_value = '') {
        $meta_key = stripslashes( $meta_key );
        $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
 
        $meta_key = stripslashes( $meta_key );
        $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
 
+       if ( !$meta_key )
+               return false;
+
        if ( empty( $meta_value ) )
                $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta_key ) );
        else
        if ( empty( $meta_value ) )
                $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta_key ) );
        else
@@ -586,9 +593,13 @@ function delete_post_meta($post_id, $meta_key, $meta_value = '') {
  * @param int $post_id Post ID.
  * @param string $key The meta key to retrieve.
  * @param bool $single Whether to return a single value.
  * @param int $post_id Post ID.
  * @param string $key The meta key to retrieve.
  * @param bool $single Whether to return a single value.
- * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true.
+ * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
+ *  is true.
  */
 function get_post_meta($post_id, $key, $single = false) {
  */
 function get_post_meta($post_id, $key, $single = false) {
+       if ( !$key )
+               return '';
+
        $post_id = (int) $post_id;
 
        $meta_cache = wp_cache_get($post_id, 'post_meta');
        $post_id = (int) $post_id;
 
        $meta_cache = wp_cache_get($post_id, 'post_meta');
@@ -637,6 +648,9 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
        // expected_slashed ($meta_key)
        $meta_key = stripslashes($meta_key);
 
        // expected_slashed ($meta_key)
        $meta_key = stripslashes($meta_key);
 
+       if ( !$meta_key )
+               return false;
+
        if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) {
                return add_post_meta($post_id, $meta_key, $meta_value);
        }
        if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) {
                return add_post_meta($post_id, $meta_key, $meta_value);
        }
@@ -666,10 +680,15 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
  * @return bool Whether the post meta key was deleted from the database
  */
 function delete_post_meta_by_key($post_meta_key) {
  * @return bool Whether the post meta key was deleted from the database
  */
 function delete_post_meta_by_key($post_meta_key) {
+       if ( !$post_meta_key )
+               return false;
+
        global $wpdb;
        global $wpdb;
-       if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) {
-               /** @todo Get post_ids and delete cache */
-               // wp_cache_delete($post_id, 'post_meta');
+       $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key));
+       if ( $post_ids ) {
+               $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key));
+               foreach ( $post_ids as $post_id )
+                       wp_cache_delete($post_id, 'post_meta');
                return true;
        }
        return false;
                return true;
        }
        return false;
@@ -739,6 +758,9 @@ function get_post_custom_keys( $post_id = 0 ) {
  * @return array Meta field values.
  */
 function get_post_custom_values( $key = '', $post_id = 0 ) {
  * @return array Meta field values.
  */
 function get_post_custom_values( $key = '', $post_id = 0 ) {
+       if ( !$key )
+               return null;
+
        $custom = get_post_custom($post_id);
 
        return isset($custom[$key]) ? $custom[$key] : null;
        $custom = get_post_custom($post_id);
 
        return isset($custom[$key]) ? $custom[$key] : null;
@@ -777,7 +799,7 @@ function is_sticky($post_id = null) {
 /**
  * Sanitize every post field.
  *
 /**
  * Sanitize every post field.
  *
- * If the context is 'raw', then the post object or array will just be returned.
+ * If the context is 'raw', then the post object or array will get minimal santization of the int fields.
  *
  * @since 2.3.0
  * @uses sanitize_post_field() Used to sanitize the fields.
  *
  * @since 2.3.0
  * @uses sanitize_post_field() Used to sanitize the fields.
@@ -787,8 +809,6 @@ function is_sticky($post_id = null) {
  * @return object|array The now sanitized Post Object or Array (will be the same type as $post)
  */
 function sanitize_post($post, $context = 'display') {
  * @return object|array The now sanitized Post Object or Array (will be the same type as $post)
  */
 function sanitize_post($post, $context = 'display') {
-       if ( 'raw' == $context )
-               return $post;
        if ( is_object($post) ) {
                if ( !isset($post->ID) )
                        $post->ID = 0;
        if ( is_object($post) ) {
                if ( !isset($post->ID) )
                        $post->ID = 0;
@@ -809,15 +829,28 @@ function sanitize_post($post, $context = 'display') {
 /**
  * Sanitize post field based on context.
  *
 /**
  * Sanitize post field based on context.
  *
- * Possible context values are: raw, edit, db, attribute, js, and display. The
- * display context is used by default.
+ * Possible context values are:  'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The
+ * 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display'
+ * when calling filters.
  *
  * @since 2.3.0
  *
  * @since 2.3.0
+ * @uses apply_filters() Calls 'edit_$field' and '${field_no_prefix}_edit_pre' passing $value and
+ *  $post_id if $context == 'edit' and field name prefix == 'post_'.
+ *
+ * @uses apply_filters() Calls 'edit_post_$field' passing $value and $post_id if $context == 'db'.
+ * @uses apply_filters() Calls 'pre_$field' passing $value if $context == 'db' and field name prefix == 'post_'.
+ * @uses apply_filters() Calls '${field}_pre' passing $value if $context == 'db' and field name prefix != 'post_'.
+ *
+ * @uses apply_filters() Calls '$field' passing $value, $post_id and $context if $context == anything
+ *  other than 'raw', 'edit' and 'db' and field name prefix == 'post_'.
+ * @uses apply_filters() Calls 'post_$field' passing $value if $context == anything other than 'raw',
+ *  'edit' and 'db' and field name prefix != 'post_'.
  *
  * @param string $field The Post Object field name.
  * @param mixed $value The Post Object value.
  * @param int $post_id Post ID.
  *
  * @param string $field The Post Object field name.
  * @param mixed $value The Post Object value.
  * @param int $post_id Post ID.
- * @param string $context How to sanitize post fields.
+ * @param string $context How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display',
+ *               'attribute' and 'js'.
  * @return mixed Sanitized value.
  */
 function sanitize_post_field($field, $value, $post_id, $context) {
  * @return mixed Sanitized value.
  */
 function sanitize_post_field($field, $value, $post_id, $context) {
@@ -851,7 +884,7 @@ function sanitize_post_field($field, $value, $post_id, $context) {
                        else
                                $value = format_to_edit($value);
                } else {
                        else
                                $value = format_to_edit($value);
                } else {
-                       $value = attribute_escape($value);
+                       $value = esc_attr($value);
                }
        } else if ( 'db' == $context ) {
                if ( $prefixed ) {
                }
        } else if ( 'db' == $context ) {
                if ( $prefixed ) {
@@ -870,9 +903,9 @@ function sanitize_post_field($field, $value, $post_id, $context) {
        }
 
        if ( 'attribute' == $context )
        }
 
        if ( 'attribute' == $context )
-               $value = attribute_escape($value);
+               $value = esc_attr($value);
        else if ( 'js' == $context )
        else if ( 'js' == $context )
-               $value = js_escape($value);
+               $value = esc_js($value);
 
        return $value;
 }
 
        return $value;
 }
@@ -965,7 +998,7 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
 
        $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
 
 
        $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
 
-       $stats = array( );
+       $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0 );
        foreach( (array) $count as $row_num => $row ) {
                $stats[$row['post_status']] = $row['num_posts'];
        }
        foreach( (array) $count as $row_num => $row ) {
                $stats[$row['post_status']] = $row['num_posts'];
        }
@@ -1013,7 +1046,8 @@ function wp_count_attachments( $mime_type = '' ) {
  *
  * @since 2.5.0
  *
  *
  * @since 2.5.0
  *
- * @param string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or flash (same as *flash*)
+ * @param string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or
+ *  flash (same as *flash*).
  * @param string|array $real_mime_types post_mime_type values
  * @return array array(wildcard=>array(real types))
  */
  * @param string|array $real_mime_types post_mime_type values
  * @return array array(wildcard=>array(real types))
  */
@@ -1059,7 +1093,7 @@ function wp_post_mime_type_where($post_mime_types) {
                $slashpos = strpos($mime_type, '/');
                if ( false !== $slashpos ) {
                        $mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos));
                $slashpos = strpos($mime_type, '/');
                if ( false !== $slashpos ) {
                        $mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos));
-                       $mime_subgroup = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1));
+                       $mime_subgroup = preg_replace('/[^-*.+a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1));
                        if ( empty($mime_subgroup) )
                                $mime_subgroup = '*';
                        else
                        if ( empty($mime_subgroup) )
                                $mime_subgroup = '*';
                        else
@@ -1093,10 +1127,12 @@ function wp_post_mime_type_where($post_mime_types) {
  * This includes comments, post meta fields, and terms associated with the post.
  *
  * @since 1.0.0
  * This includes comments, post meta fields, and terms associated with the post.
  *
  * @since 1.0.0
- * @uses do_action() Calls 'deleted_post' hook on post ID.
+ * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'.
+ * @uses do_action() on 'deleted_post' after deletion unless post type is 'attachment'.
+ * @uses wp_delete_attachment() if post type is 'attachment'.
  *
  * @param int $postid Post ID.
  *
  * @param int $postid Post ID.
- * @return mixed
+ * @return mixed False on failure
  */
 function wp_delete_post($postid = 0) {
        global $wpdb, $wp_rewrite;
  */
 function wp_delete_post($postid = 0) {
        global $wpdb, $wp_rewrite;
@@ -1131,6 +1167,8 @@ function wp_delete_post($postid = 0) {
                $children = $wpdb->get_results($children_query);
 
                $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) );
                $children = $wpdb->get_results($children_query);
 
                $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) );
+       } else {
+               unstick_post($postid);
        }
 
        // Do raw query.  wp_get_post_revisions() is filtered
        }
 
        // Do raw query.  wp_get_post_revisions() is filtered
@@ -1142,12 +1180,12 @@ function wp_delete_post($postid = 0) {
        // Point all attachments to this post up one level
        $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
 
        // Point all attachments to this post up one level
        $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
 
-       $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
-
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d", $postid ));
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d", $postid ));
 
+       $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
+
        if ( 'page' == $post->post_type ) {
                clean_page_cache($postid);
 
        if ( 'page' == $post->post_type ) {
                clean_page_cache($postid);
 
@@ -1159,6 +1197,8 @@ function wp_delete_post($postid = 0) {
                clean_post_cache($postid);
        }
 
                clean_post_cache($postid);
        }
 
+       wp_clear_scheduled_hook('publish_future_post', $postid);
+
        do_action('deleted_post', $postid);
 
        return $post;
        do_action('deleted_post', $postid);
 
        return $post;
@@ -1192,7 +1232,7 @@ function wp_get_post_categories( $post_id = 0, $args = array() ) {
  * Retrieve the tags for a post.
  *
  * There is only one default for this function, called 'fields' and by default
  * Retrieve the tags for a post.
  *
  * There is only one default for this function, called 'fields' and by default
- * is set to 'all'. There are other defaults that can be override in
+ * is set to 'all'. There are other defaults that can be overridden in
  * {@link wp_get_object_terms()}.
  *
  * @package WordPress
  * {@link wp_get_object_terms()}.
  *
  * @package WordPress
@@ -1206,12 +1246,34 @@ function wp_get_post_categories( $post_id = 0, $args = array() ) {
  * @return array List of post tags.
  */
 function wp_get_post_tags( $post_id = 0, $args = array() ) {
  * @return array List of post tags.
  */
 function wp_get_post_tags( $post_id = 0, $args = array() ) {
+       return wp_get_post_terms( $post_id, 'post_tag', $args);
+}
+
+/**
+ * Retrieve the terms for a post.
+ *
+ * There is only one default for this function, called 'fields' and by default
+ * is set to 'all'. There are other defaults that can be overridden in
+ * {@link wp_get_object_terms()}.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.8.0
+ *
+ * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here
+ *
+ * @param int $post_id Optional. The Post ID
+ * @param string $taxonomy The taxonomy for which to retrieve terms. Defaults to post_tag.
+ * @param array $args Optional. Overwrite the defaults
+ * @return array List of post tags.
+ */
+function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) {
        $post_id = (int) $post_id;
 
        $defaults = array('fields' => 'all');
        $args = wp_parse_args( $args, $defaults );
 
        $post_id = (int) $post_id;
 
        $defaults = array('fields' => 'all');
        $args = wp_parse_args( $args, $defaults );
 
-       $tags = wp_get_object_terms($post_id, 'post_tag', $args);
+       $tags = wp_get_object_terms($post_id, $taxonomy, $args);
 
        return $tags;
 }
 
        return $tags;
 }
@@ -1280,29 +1342,36 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
  * setting the value for 'comment_status' key.
  *
  * The defaults for the parameter $postarr are:
  * setting the value for 'comment_status' key.
  *
  * The defaults for the parameter $postarr are:
- *     'post_status' - Default is 'draft'.
- *     'post_type' - Default is 'post'.
- *     'post_author' - Default is current user ID. The ID of the user, who added
- *         the post.
- *     'ping_status' - Default is the value in default ping status option.
- *         Whether the attachment can accept pings.
- *     'post_parent' - Default is 0. Set this for the post it belongs to, if
- *         any.
- *     'menu_order' - Default is 0. The order it is displayed.
- *     'to_ping' - Whether to ping.
- *     'pinged' - Default is empty string.
- *     'post_password' - Default is empty string. The password to access the
- *         attachment.
- *     'guid' - Global Unique ID for referencing the attachment.
+ *     'post_status'   - Default is 'draft'.
+ *     'post_type'     - Default is 'post'.
+ *     'post_author'   - Default is current user ID ($user_ID). The ID of the user who added the post.
+ *     'ping_status'   - Default is the value in 'default_ping_status' option.
+ *                       Whether the attachment can accept pings.
+ *     'post_parent'   - Default is 0. Set this for the post it belongs to, if any.
+ *     'menu_order'    - Default is 0. The order it is displayed.
+ *     'to_ping'       - Whether to ping.
+ *     'pinged'        - Default is empty string.
+ *     'post_password' - Default is empty string. The password to access the attachment.
+ *     'guid'          - Global Unique ID for referencing the attachment.
  *     'post_content_filtered' - Post content filtered.
  *     'post_content_filtered' - Post content filtered.
- *     'post_excerpt' - Post excerpt.
+ *     'post_excerpt'  - Post excerpt.
  *
  * @since 1.0.0
  *
  * @since 1.0.0
+ * @link http://core.trac.wordpress.org/ticket/9084 Bug report on 'wp_insert_post_data' filter.
  * @uses $wpdb
  * @uses $wp_rewrite
  * @uses $user_ID
  *
  * @uses $wpdb
  * @uses $wp_rewrite
  * @uses $user_ID
  *
- * @param array $postarr Optional. Override defaults.
+ * @uses do_action() Calls 'pre_post_update' on post ID if this is an update.
+ * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update.
+ * @uses do_action() Calls 'save_post' and 'wp_insert_post' on post id and post data just before
+ *                   returning.
+ *
+ * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database
+ *                       update or insert.
+ * @uses wp_transition_post_status()
+ *
+ * @param array $postarr Optional. Overrides defaults.
  * @param bool $wp_error Optional. Allow return of WP_Error on failure.
  * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
  */
  * @param bool $wp_error Optional. Allow return of WP_Error on failure.
  * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
  */
@@ -1368,9 +1437,11 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
 
        // Create a valid post name.  Drafts and pending posts are allowed to have an empty
        // post name.
 
        // Create a valid post name.  Drafts and pending posts are allowed to have an empty
        // post name.
-       if ( empty($post_name) ) {
+       if ( !isset($post_name) || empty($post_name) ) {
                if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
                        $post_name = sanitize_title($post_title);
                if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
                        $post_name = sanitize_title($post_title);
+               else
+                       $post_name = '';
        } else {
                $post_name = sanitize_title($post_name);
        }
        } else {
                $post_name = sanitize_title($post_name);
        }
@@ -1396,7 +1467,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
 
        if ( 'publish' == $post_status ) {
                $now = gmdate('Y-m-d H:i:59');
 
        if ( 'publish' == $post_status ) {
                $now = gmdate('Y-m-d H:i:59');
-               if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
+               if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) )
                        $post_status = 'future';
        }
 
                        $post_status = 'future';
        }
 
@@ -1442,19 +1513,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
        if ( !isset($post_password) || 'private' == $post_status )
                $post_password = '';
 
        if ( !isset($post_password) || 'private' == $post_status )
                $post_password = '';
 
-       if ( !in_array( $post_status, array( 'draft', 'pending' ) ) ) {
-               $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_parent = %d LIMIT 1", $post_name, $post_type, $post_ID, $post_parent));
-
-               if ($post_name_check || in_array($post_name, $wp_rewrite->feeds) ) {
-                       $suffix = 2;
-                       do {
-                               $alt_post_name = substr($post_name, 0, 200-(strlen($suffix)+1)). "-$suffix";
-                               $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_parent = %d LIMIT 1", $alt_post_name, $post_type, $post_ID, $post_parent));
-                               $suffix++;
-                       } while ($post_name_check);
-                       $post_name = $alt_post_name;
-               }
-       }
+       $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
 
        // expected_slashed (everything!)
        $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) );
 
        // expected_slashed (everything!)
        $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) );
@@ -1492,17 +1551,25 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                $where = array( 'ID' => $post_ID );
        }
 
                $where = array( 'ID' => $post_ID );
        }
 
-       if ( empty($post_name) && !in_array( $post_status, array( 'draft', 'pending' ) ) ) {
-               $post_name = sanitize_title($post_title, $post_ID);
-               $wpdb->update( $wpdb->posts, compact( 'post_name' ), $where );
+       if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending' ) ) ) {
+               $data['post_name'] = sanitize_title($data['post_title'], $post_ID);
+               $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
        }
 
        wp_set_post_categories( $post_ID, $post_category );
        }
 
        wp_set_post_categories( $post_ID, $post_category );
-       wp_set_post_tags( $post_ID, $tags_input );
+       // old-style tags_input
+       if ( !empty($tags_input) )
+               wp_set_post_tags( $post_ID, $tags_input );
+       // new-style support for all tag-like taxonomies
+       if ( !empty($tax_input) ) {
+               foreach ( $tax_input as $taxonomy => $tags ) {
+                       wp_set_post_terms( $post_ID, $tags, $taxonomy );
+               }
+       }
 
        $current_guid = get_post_field( 'guid', $post_ID );
 
 
        $current_guid = get_post_field( 'guid', $post_ID );
 
-       if ( 'page' == $post_type )
+       if ( 'page' == $data['post_type'] )
                clean_page_cache($post_ID);
        else
                clean_post_cache($post_ID);
                clean_page_cache($post_ID);
        else
                clean_post_cache($post_ID);
@@ -1513,7 +1580,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
 
        $post = get_post($post_ID);
 
 
        $post = get_post($post_ID);
 
-       if ( !empty($page_template) && 'page' == $post_type ) {
+       if ( !empty($page_template) && 'page' == $data['post_type'] ) {
                $post->page_template = $page_template;
                $page_templates = get_page_templates();
                if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) {
                $post->page_template = $page_template;
                $page_templates = get_page_templates();
                if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) {
@@ -1525,7 +1592,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                update_post_meta($post_ID, '_wp_page_template',  $page_template);
        }
 
                update_post_meta($post_ID, '_wp_page_template',  $page_template);
        }
 
-       wp_transition_post_status($post_status, $previous_status, $post);
+       wp_transition_post_status($data['post_status'], $previous_status, $post);
 
        if ( $update)
                do_action('edit_post', $post_ID, $post);
 
        if ( $update)
                do_action('edit_post', $post_ID, $post);
@@ -1544,12 +1611,15 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
- * @param array|object $postarr Post data.
+ * @param array|object $postarr Post data. Arrays are expected to be escaped, objects are not.
  * @return int 0 on failure, Post ID on success.
  */
 function wp_update_post($postarr = array()) {
  * @return int 0 on failure, Post ID on success.
  */
 function wp_update_post($postarr = array()) {
-       if ( is_object($postarr) )
+       if ( is_object($postarr) ) {
+               // non-escaped post was passed
                $postarr = get_object_vars($postarr);
                $postarr = get_object_vars($postarr);
+               $postarr = add_magic_quotes($postarr);
+       }
 
        // First, get all of the original fields
        $post = wp_get_single_post($postarr['ID'], ARRAY_A);
 
        // First, get all of the original fields
        $post = wp_get_single_post($postarr['ID'], ARRAY_A);
@@ -1655,6 +1725,71 @@ function check_and_publish_future_post($post_id) {
        return wp_publish_post($post_id);
 }
 
        return wp_publish_post($post_id);
 }
 
+
+/**
+ * Given the desired slug and some post details computes a unique slug for the post.
+ *
+ * @param string $slug the desired slug (post_name)
+ * @param integer $post_ID
+ * @param string $post_status no uniqueness checks are made if the post is still draft or pending
+ * @param string $post_type
+ * @param integer $post_parent
+ * @return string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
+ */
+function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
+       if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
+               return $slug;
+       
+       global $wpdb, $wp_rewrite;
+       $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page'));
+       if ( 'attachment' == $post_type ) {
+               // Attachment slugs must be unique across all types.
+               $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
+               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
+               
+               if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
+                       $suffix = 2;
+                       do {
+                               $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix";
+                               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID));
+                               $suffix++;
+                       } while ($post_name_check);
+                       $slug = $alt_post_name;
+               }
+       } elseif ( in_array($post_type, $hierarchical_post_types) ) {
+               // Page slugs must be unique within their own trees.  Pages are in a
+               // separate namespace than posts so page slugs are allowed to overlap post slugs.
+               $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", $wpdb->escape($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
+               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent));
+               
+               if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
+                       $suffix = 2;
+                       do {
+                               $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix";
+                               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID, $post_parent));
+                               $suffix++;
+                       } while ($post_name_check);
+                       $slug = $alt_post_name;
+               }
+       } else {
+               // Post slugs must be unique across all posts.
+               $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
+               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID));
+               
+               if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
+                       $suffix = 2;
+                       do {
+                               $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix";
+                               $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_type, $post_ID));
+                               $suffix++;
+                       } while ($post_name_check);
+                       $slug = $alt_post_name;
+               }
+       }
+
+       return $slug;
+}
+
 /**
  * Adds tags to a post.
  *
 /**
  * Adds tags to a post.
  *
@@ -1685,7 +1820,21 @@ function wp_add_post_tags($post_id = 0, $tags = '') {
  * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
  */
 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
  * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
  */
 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
+       return wp_set_post_terms( $post_id, $tags, 'post_tag', $append);
+}
 
 
+/**
+ * Set the terms for a post.
+ *
+ * @since 2.8.0
+ * @uses wp_set_object_terms() Sets the tags for the post.
+ *
+ * @param int $post_id Post ID.
+ * @param string $tags The tags to set for the post, separated by commas.
+ * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags.
+ * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
+ */
+function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) {
        $post_id = (int) $post_id;
 
        if ( !$post_id )
        $post_id = (int) $post_id;
 
        if ( !$post_id )
@@ -1693,8 +1842,9 @@ function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
 
        if ( empty($tags) )
                $tags = array();
 
        if ( empty($tags) )
                $tags = array();
-       $tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
-       wp_set_object_terms($post_id, $tags, 'post_tag', $append);
+
+       $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
+       wp_set_object_terms($post_id, $tags, $taxonomy, $append);
 }
 
 /**
 }
 
 /**
@@ -1726,28 +1876,32 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
 /**
  * Transition the post status of a post.
  *
 /**
  * Transition the post status of a post.
  *
- * Calls hooks to transition post status. If the new post status is not the same
- * as the previous post status, then two hooks will be ran, the first is
- * 'transition_post_status' with new status, old status, and post data. The
- * next action called is 'OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
- * $new_status parameter and the OLDSTATUS is $old_status parameter; it has the
+ * Calls hooks to transition post status.
+ *
+ * The first is 'transition_post_status' with new status, old status, and post data.
+ *
+ * The next action called is 'OLDSTATUS_to_NEWSTATUS' the 'NEWSTATUS' is the
+ * $new_status parameter and the 'OLDSTATUS' is $old_status parameter; it has the
  * post data.
  *
  * post data.
  *
- * The final action will run whether or not the post statuses are the same. The
- * action is named 'NEWSTATUS_POSTTYPE', NEWSTATUS is from the $new_status
+ * The final action is named 'NEWSTATUS_POSTTYPE', 'NEWSTATUS' is from the $new_status
  * parameter and POSTTYPE is post_type post data.
  *
  * @since 2.3.0
  * parameter and POSTTYPE is post_type post data.
  *
  * @since 2.3.0
+ * @link http://codex.wordpress.org/Post_Status_Transitions
+ *
+ * @uses do_action() Calls 'transition_post_status' on $new_status, $old_status and
+ *  $post if there is a status change.
+ * @uses do_action() Calls '${old_status}_to_$new_status' on $post if there is a status change.
+ * @uses do_action() Calls '${new_status}_$post->post_type' on post ID and $post.
  *
  * @param string $new_status Transition to this post status.
  * @param string $old_status Previous post status.
  * @param object $post Post data.
  */
 function wp_transition_post_status($new_status, $old_status, $post) {
  *
  * @param string $new_status Transition to this post status.
  * @param string $old_status Previous post status.
  * @param object $post Post data.
  */
 function wp_transition_post_status($new_status, $old_status, $post) {
-       if ( $new_status != $old_status ) {
-               do_action('transition_post_status', $new_status, $old_status, $post);
-               do_action("${old_status}_to_$new_status", $post);
-       }
+       do_action('transition_post_status', $new_status, $old_status, $post);
+       do_action("${old_status}_to_$new_status", $post);
        do_action("${new_status}_$post->post_type", $post->ID, $post);
 }
 
        do_action("${new_status}_$post->post_type", $post->ID, $post);
 }
 
@@ -2008,14 +2162,11 @@ function &get_page_children($page_id, $pages) {
 /**
  * Order the pages with children under parents in a flat list.
  *
 /**
  * Order the pages with children under parents in a flat list.
  *
- * Fetches the pages returned as a FLAT list, but arranged in order of their
- * hierarchy, i.e., child parents immediately follow their parents.
- *
  * @since 2.0.0
  *
  * @param array $posts Posts array.
  * @param int $parent Parent page ID.
  * @since 2.0.0
  *
  * @param array $posts Posts array.
  * @param int $parent Parent page ID.
- * @return array
+ * @return array A list arranged by hierarchy. Children immediately follow their parents.
  */
 function get_page_hierarchy($posts, $parent = 0) {
        $result = array ( );
  */
 function get_page_hierarchy($posts, $parent = 0) {
        $result = array ( );
@@ -2060,7 +2211,7 @@ function get_page_uri($page_id) {
  *
  * The defaults that can be overridden are the following: 'child_of',
  * 'sort_order', 'sort_column', 'post_title', 'hierarchical', 'exclude',
  *
  * The defaults that can be overridden are the following: 'child_of',
  * 'sort_order', 'sort_column', 'post_title', 'hierarchical', 'exclude',
- * 'include', 'meta_key', 'meta_value', and 'authors'.
+ * 'include', 'meta_key', 'meta_value','authors', 'number', and 'offset'.
  *
  * @since 1.5.0
  * @uses $wpdb
  *
  * @since 1.5.0
  * @uses $wpdb
@@ -2076,20 +2227,27 @@ function &get_pages($args = '') {
                'sort_column' => 'post_title', 'hierarchical' => 1,
                'exclude' => '', 'include' => '',
                'meta_key' => '', 'meta_value' => '',
                'sort_column' => 'post_title', 'hierarchical' => 1,
                'exclude' => '', 'include' => '',
                'meta_key' => '', 'meta_value' => '',
-               'authors' => '', 'parent' => -1, 'exclude_tree' => ''
+               'authors' => '', 'parent' => -1, 'exclude_tree' => '',
+               'number' => '', 'offset' => 0
        );
 
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );
        );
 
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );
+       $number = (int) $number;
+       $offset = (int) $offset;
 
 
+       $cache = array();
        $key = md5( serialize( compact(array_keys($defaults)) ) );
        if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) {
        $key = md5( serialize( compact(array_keys($defaults)) ) );
        if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) {
-               if ( isset( $cache[ $key ] ) ) {
+               if ( is_array($cache) && isset( $cache[ $key ] ) ) {
                        $pages = apply_filters('get_pages', $cache[ $key ], $r );
                        return $pages;
                }
        }
 
                        $pages = apply_filters('get_pages', $cache[ $key ], $r );
                        return $pages;
                }
        }
 
+       if ( !is_array($cache) )
+               $cache = array();
+
        $inclusions = '';
        if ( !empty($include) ) {
                $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
        $inclusions = '';
        if ( !empty($include) ) {
                $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
@@ -2174,6 +2332,9 @@ function &get_pages($args = '') {
        $query .= $author_query;
        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
 
        $query .= $author_query;
        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
 
+       if ( !empty($number) )
+               $query .= ' LIMIT ' . $offset . ',' . $number;
+
        $pages = $wpdb->get_results($query);
 
        if ( empty($pages) ) {
        $pages = $wpdb->get_results($query);
 
        if ( empty($pages) ) {
@@ -2251,28 +2412,26 @@ function is_local_attachment($url) {
  * setting the value for the 'comment_status' key.
  *
  * The $object parameter can have the following:
  * setting the value for the 'comment_status' key.
  *
  * The $object parameter can have the following:
- *     'post_status' - Default is 'draft'. Can not be override, set the same as
- *         parent post.
- *     'post_type' - Default is 'post', will be set to attachment. Can not
- *         override.
- *     'post_author' - Default is current user ID. The ID of the user, who added
- *         the attachment.
- *     'ping_status' - Default is the value in default ping status option.
- *         Whether the attachment can accept pings.
- *     'post_parent' - Default is 0. Can use $parent parameter or set this for
- *         the post it belongs to, if any.
- *     'menu_order' - Default is 0. The order it is displayed.
- *     'to_ping' - Whether to ping.
- *     'pinged' - Default is empty string.
- *     'post_password' - Default is empty string. The password to access the
- *         attachment.
- *     'guid' - Global Unique ID for referencing the attachment.
+ *     'post_status'   - Default is 'draft'. Can not be overridden, set the same as parent post.
+ *     'post_type'     - Default is 'post', will be set to attachment. Can not override.
+ *     'post_author'   - Default is current user ID. The ID of the user, who added the attachment.
+ *     'ping_status'   - Default is the value in default ping status option. Whether the attachment
+ *                       can accept pings.
+ *     'post_parent'   - Default is 0. Can use $parent parameter or set this for the post it belongs
+ *                       to, if any.
+ *     'menu_order'    - Default is 0. The order it is displayed.
+ *     'to_ping'       - Whether to ping.
+ *     'pinged'        - Default is empty string.
+ *     'post_password' - Default is empty string. The password to access the attachment.
+ *     'guid'          - Global Unique ID for referencing the attachment.
  *     'post_content_filtered' - Attachment post content filtered.
  *     'post_content_filtered' - Attachment post content filtered.
- *     'post_excerpt' - Attachment excerpt.
+ *     'post_excerpt'  - Attachment excerpt.
  *
  * @since 2.0.0
  * @uses $wpdb
  * @uses $user_ID
  *
  * @since 2.0.0
  * @uses $wpdb
  * @uses $user_ID
+ * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update.
+ * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update.
  *
  * @param string|array $object Arguments to override defaults.
  * @param string $file Optional filename.
  *
  * @param string|array $object Arguments to override defaults.
  * @param string $file Optional filename.
@@ -2323,18 +2482,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
                $post_name = sanitize_title($post_name);
 
        // expected_slashed ($post_name)
                $post_name = sanitize_title($post_name);
 
        // expected_slashed ($post_name)
-       $post_name_check = $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_status = 'inherit' AND ID != %d LIMIT 1", $post_name, $post_ID));
-
-       if ($post_name_check) {
-               $suffix = 2;
-               while ($post_name_check) {
-                       $alt_post_name = $post_name . "-$suffix";
-                       // expected_slashed ($alt_post_name, $post_name)
-                       $post_name_check = $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_status = 'inherit' AND ID != %d AND post_parent = %d LIMIT 1", $alt_post_name, $post_ID, $post_parent));
-                       $suffix++;
-               }
-               $post_name = $alt_post_name;
-       }
+       $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
 
        if ( empty($post_date) )
                $post_date = current_time('mysql');
 
        if ( empty($post_date) )
                $post_date = current_time('mysql');
@@ -2442,15 +2590,17 @@ function wp_delete_attachment($postid) {
        $meta = wp_get_attachment_metadata( $postid );
        $file = get_attached_file( $postid );
 
        $meta = wp_get_attachment_metadata( $postid );
        $file = get_attached_file( $postid );
 
+       do_action('delete_attachment', $postid);
+
        /** @todo Delete for pluggable post taxonomies too */
        wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
 
        /** @todo Delete for pluggable post taxonomies too */
        wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
 
-       $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
-
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
 
+       $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
+
        $uploadPath = wp_upload_dir();
 
        if ( ! empty($meta['thumb']) ) {
        $uploadPath = wp_upload_dir();
 
        if ( ! empty($meta['thumb']) ) {
@@ -2478,8 +2628,6 @@ function wp_delete_attachment($postid) {
 
        clean_post_cache($postid);
 
 
        clean_post_cache($postid);
 
-       do_action('delete_attachment', $postid);
-
        return $post;
 }
 
        return $post;
 }
 
@@ -2843,13 +2991,13 @@ function get_lastpostdate($timezone = 'server') {
        if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) {
                switch(strtolower($timezone)) {
                        case 'gmt':
        if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) {
                switch(strtolower($timezone)) {
                        case 'gmt':
-                               $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
+                               $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
                                break;
                        case 'blog':
                                break;
                        case 'blog':
-                               $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
+                               $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
                                break;
                        case 'server':
                                break;
                        case 'server':
-                               $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");
+                               $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1");
                                break;
                }
                $cache_lastpostdate[$blog_id][$timezone] = $lastpostdate;
                                break;
                }
                $cache_lastpostdate[$blog_id][$timezone] = $lastpostdate;
@@ -2882,13 +3030,13 @@ function get_lastpostmodified($timezone = 'server') {
        if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) {
                switch(strtolower($timezone)) {
                        case 'gmt':
        if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) {
                switch(strtolower($timezone)) {
                        case 'gmt':
-                               $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
+                               $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
                                break;
                        case 'blog':
                                break;
                        case 'blog':
-                               $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
+                               $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
                                break;
                        case 'server':
                                break;
                        case 'server':
-                               $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");
+                               $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
                                break;
                }
                $lastpostdate = get_lastpostdate($timezone);
                                break;
                }
                $lastpostdate = get_lastpostdate($timezone);
@@ -2927,11 +3075,16 @@ function update_post_cache(&$posts) {
  * Cleaning means delete from the cache of the post. Will call to clean the term
  * object cache associated with the post ID.
  *
  * Cleaning means delete from the cache of the post. Will call to clean the term
  * object cache associated with the post ID.
  *
+ * clean_post_cache() will call itself recursively for each child post.
+ *
+ * This function not run if $_wp_suspend_cache_invalidation is not empty. See
+ * wp_suspend_cache_invalidation().
+ *
  * @package WordPress
  * @subpackage Cache
  * @since 2.0.0
  *
  * @package WordPress
  * @subpackage Cache
  * @since 2.0.0
  *
- * @uses do_action() Will call the 'clean_post_cache' hook action.
+ * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
  *
  * @param int $id The Post ID in the cache to clean
  */
  *
  * @param int $id The Post ID in the cache to clean
  */
@@ -3106,6 +3259,8 @@ function update_postmeta_cache($post_ids) {
  * @since 2.3.0
  * @access private
  * @uses $wpdb
  * @since 2.3.0
  * @access private
  * @uses $wpdb
+ * @uses do_action() Calls 'private_to_published' on post ID if this is a 'private_to_published' call.
+ * @uses wp_clear_scheduled_hook() with 'publish_future_post' and post ID.
  *
  * @param string $new_status New post status
  * @param string $old_status Previous post status
  *
  * @param string $new_status New post status
  * @param string $old_status Previous post status
@@ -3119,6 +3274,9 @@ function _transition_post_status($new_status, $old_status, $post) {
                if ( '' == get_the_guid($post->ID) )
                        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
                do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
                if ( '' == get_the_guid($post->ID) )
                        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
                do_action('private_to_published', $post->ID);  // Deprecated, use private_to_publish
+               // do generic pings once per hour at most
+               if ( !wp_next_scheduled('do_generic_ping') )
+                       wp_schedule_single_event(time() + 3600, 'do_generic_ping');
        }
 
        // Always clears the hook in case the post status bounced from future to draft.
        }
 
        // Always clears the hook in case the post status bounced from future to draft.
@@ -3131,6 +3289,7 @@ function _transition_post_status($new_status, $old_status, $post) {
  * The $post properties used and must exist are 'ID' and 'post_date_gmt'.
  *
  * @since 2.3.0
  * The $post properties used and must exist are 'ID' and 'post_date_gmt'.
  *
  * @since 2.3.0
+ * @access private
  *
  * @param int $deprecated Not Used. Can be set to null.
  * @param object $post Object type containing the post information
  *
  * @param int $deprecated Not Used. Can be set to null.
  * @param object $post Object type containing the post information
@@ -3144,11 +3303,11 @@ function _future_post_hook($deprecated = '', $post) {
  * Hook to schedule pings and enclosures when a post is published.
  *
  * @since 2.3.0
  * Hook to schedule pings and enclosures when a post is published.
  *
  * @since 2.3.0
+ * @access private
  * @uses $wpdb
  * @uses $wpdb
- * @uses XMLRPC_REQUEST
- * @uses APP_REQUEST
- * @uses do_action Calls 'xmlprc_publish_post' action if XMLRPC_REQUEST is defined. Calls 'app_publish_post'
- *     action if APP_REQUEST is defined.
+ * @uses XMLRPC_REQUEST and APP_REQUEST constants.
+ * @uses do_action() Calls 'xmlprc_publish_post' on post ID if XMLRPC_REQUEST is defined.
+ * @uses do_action() Calls 'app_publish_post' on post ID if APP_REQUEST is defined.
  *
  * @param int $post_id The ID in the database table of the post being published
  */
  *
  * @param int $post_id The ID in the database table of the post being published
  */
@@ -3183,6 +3342,7 @@ function _publish_post_hook($post_id) {
  * property.
  *
  * @since 2.3.0
  * property.
  *
  * @since 2.3.0
+ * @access private
  * @uses $wp_rewrite Flushes Rewrite Rules.
  *
  * @param int $post_id The ID in the database table for the $post
  * @uses $wp_rewrite Flushes Rewrite Rules.
  *
  * @param int $post_id The ID in the database table for the $post
@@ -3213,8 +3373,8 @@ function _save_post_hook($post_id, $post) {
  * complete. The post parent will be an ancestor and the parent of the post
  * parent will be an ancestor. There will only be two ancestors at the most.
  *
  * complete. The post parent will be an ancestor and the parent of the post
  * parent will be an ancestor. There will only be two ancestors at the most.
  *
- * @access private
  * @since unknown
  * @since unknown
+ * @access private
  * @uses $wpdb
  *
  * @param object $_post Post data.
  * @uses $wpdb
  *
  * @param object $_post Post data.
@@ -3250,6 +3410,7 @@ function _get_post_ancestors(&$_post) {
  * @subpackage Post_Revisions
  * @since 2.6.0
  * @access private
  * @subpackage Post_Revisions
  * @since 2.6.0
  * @access private
+ * @uses apply_filters() Calls '_wp_post_revision_fields' on 'title', 'content' and 'excerpt' fields.
  *
  * @param array $post Optional a post array to be processed for insertion as a post revision.
  * @param bool $autosave optional Is the revision an autosave?
  *
  * @param array $post Optional a post array to be processed for insertion as a post revision.
  * @param bool $autosave optional Is the revision an autosave?
@@ -3456,6 +3617,7 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
                return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
 
        $post = _wp_post_revision_fields( $post, $autosave );
                return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
 
        $post = _wp_post_revision_fields( $post, $autosave );
+       $post = add_magic_quotes($post); //since data is from db
 
        $revision_id = wp_insert_post( $post );
        if ( is_wp_error($revision_id) )
 
        $revision_id = wp_insert_post( $post );
        if ( is_wp_error($revision_id) )
@@ -3503,8 +3665,7 @@ function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
 /**
  * Restores a post to the specified revision.
  *
 /**
  * Restores a post to the specified revision.
  *
- * Can restore a past using all fields of the post revision, or only selected
- * fields.
+ * Can restore a past revision using all fields of the post revision, or only selected fields.
  *
  * @package WordPress
  * @subpackage Post_Revisions
  *
  * @package WordPress
  * @subpackage Post_Revisions
@@ -3512,9 +3673,11 @@ function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
  *
  * @uses wp_get_post_revision()
  * @uses wp_update_post()
  *
  * @uses wp_get_post_revision()
  * @uses wp_update_post()
+ * @uses do_action() Calls 'wp_restore_post_revision' on post ID and revision ID if wp_update_post()
+ *  is successful.
  *
  * @param int|object $revision_id Revision ID or revision object.
  *
  * @param int|object $revision_id Revision ID or revision object.
- * @param array $fields Optional. What fields to restore from.  Defaults to all.
+ * @param array $fields Optional. What fields to restore from. Defaults to all.
  * @return mixed Null if error, false if no fields to restore, (int) post ID if success.
  */
 function wp_restore_post_revision( $revision_id, $fields = null ) {
  * @return mixed Null if error, false if no fields to restore, (int) post ID if success.
  */
 function wp_restore_post_revision( $revision_id, $fields = null ) {
@@ -3533,6 +3696,8 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
 
        $update['ID'] = $revision['post_parent'];
 
 
        $update['ID'] = $revision['post_parent'];
 
+       $update = add_magic_quotes( $update ); //since data is from db
+
        $post_id = wp_update_post( $update );
        if ( is_wp_error( $post_id ) )
                return $post_id;
        $post_id = wp_update_post( $update );
        if ( is_wp_error( $post_id ) )
                return $post_id;
index 96f795bbd96f13990af95c2e92bf7f99664476fa..663133ffb05bb134ac8ecb005945078224f9ce50 100644 (file)
@@ -1398,8 +1398,10 @@ class WP_Query {
 
                        if ( empty($qv['taxonomy']) || empty($qv['term']) ) {
                                $this->is_tax = false;
 
                        if ( empty($qv['taxonomy']) || empty($qv['term']) ) {
                                $this->is_tax = false;
-                               foreach ( $GLOBALS['wp_taxonomies'] as $t ) {
-                                       if ( isset($t->query_var) && isset($qv[$t->query_var]) && '' != $qv[$t->query_var] ) {
+                               foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
+                                       if ( $t->query_var && isset($qv[$t->query_var]) && '' != $qv[$t->query_var] ) {
+                                               $qv['taxonomy'] = $taxonomy;
+                                               $qv['term'] = $qv[$t->query_var];
                                                $this->is_tax = true;
                                                break;
                                        }
                                                $this->is_tax = true;
                                                break;
                                        }
@@ -1451,7 +1453,7 @@ class WP_Query {
                if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
                        $this->is_comment_feed = true;
 
                if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
                        $this->is_comment_feed = true;
 
-               if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup ) )
+               if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) )
                        $this->is_home = true;
 
                // Correct is_* for page_on_front and page_for_posts
                        $this->is_home = true;
 
                // Correct is_* for page_on_front and page_for_posts
@@ -1757,8 +1759,11 @@ class WP_Query {
                        if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] )
                                $search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')";
 
                        if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] )
                                $search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')";
 
-                       if ( !empty($search) )
+                       if ( !empty($search) ) {
                                $search = " AND ({$search}) ";
                                $search = " AND ({$search}) ";
+                               if ( !is_user_logged_in() )
+                                       $search .= " AND ($wpdb->posts.post_password = '') ";
+                       }
                }
 
                // Category stuff
                }
 
                // Category stuff
@@ -1789,10 +1794,6 @@ class WP_Query {
                        $q['cat'] = implode(',', $req_cats);
                }
 
                        $q['cat'] = implode(',', $req_cats);
                }
 
-               if ( !empty($q['category__in']) ) {
-                       $groupby = "{$wpdb->posts}.ID";
-               }
-
                if ( !empty($q['category__in']) ) {
                        $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
                if ( !empty($q['category__in']) ) {
                        $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
@@ -1806,17 +1807,14 @@ class WP_Query {
                                $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN ($cat_string) )";
                        } else {
                                $ids = get_objects_in_term($q['category__not_in'], 'category');
                                $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN ($cat_string) )";
                        } else {
                                $ids = get_objects_in_term($q['category__not_in'], 'category');
-                               if ( is_wp_error( $ids ) )
-                                       $ids = array();
-                               if ( is_array($ids) && count($ids > 0) ) {
-                                       $out_posts = "'" . implode("', '", $ids) . "'";
-                                       $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)";
-                               }
+                               if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 )
+                                       $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')";
                        }
                }
 
                // Category stuff for nice URLs
                if ( '' != $q['category_name'] && !$this->is_singular ) {
                        }
                }
 
                // Category stuff for nice URLs
                if ( '' != $q['category_name'] && !$this->is_singular ) {
+                       $q['category_name'] = implode('/', array_map('sanitize_title', explode('/', $q['category_name'])));
                        $reqcat = get_category_by_path($q['category_name']);
                        $q['category_name'] = str_replace('%2F', '/', urlencode(urldecode($q['category_name'])));
                        $cat_paths = '/' . trim($q['category_name'], '/');
                        $reqcat = get_category_by_path($q['category_name']);
                        $q['category_name'] = str_replace('%2F', '/', urlencode(urldecode($q['category_name'])));
                        $cat_paths = '/' . trim($q['category_name'], '/');
@@ -1857,7 +1855,7 @@ class WP_Query {
                                        $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
                                        $q['tag_slug__in'][] = $tag;
                                }
                                        $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
                                        $q['tag_slug__in'][] = $tag;
                                }
-                       } else if ( preg_match('/[+\s]+/', $q['tag']) ) {
+                       } else if ( preg_match('/[+\s]+/', $q['tag']) || !empty($q['cat']) ) {
                                $tags = preg_split('/[+\s]+/', $q['tag']);
                                foreach ( (array) $tags as $tag ) {
                                        $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
                                $tags = preg_split('/[+\s]+/', $q['tag']);
                                foreach ( (array) $tags as $tag ) {
                                        $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
@@ -1869,11 +1867,11 @@ class WP_Query {
                        }
                }
 
                        }
                }
 
-               if ( !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) {
+               if ( !empty($q['category__in']) || !empty($q['meta_key']) || !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) {
                        $groupby = "{$wpdb->posts}.ID";
                }
 
                        $groupby = "{$wpdb->posts}.ID";
                }
 
-               if ( !empty($q['tag__in']) ) {
+               if ( !empty($q['tag__in']) && empty($q['cat']) ) {
                        $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
                        $include_tags = "'" . implode("', '", $q['tag__in']) . "'";
                        $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
                        $include_tags = "'" . implode("', '", $q['tag__in']) . "'";
@@ -1883,7 +1881,7 @@ class WP_Query {
                                $q['tag_id'] = $reqtag['term_id'];
                }
 
                                $q['tag_id'] = $reqtag['term_id'];
                }
 
-               if ( !empty($q['tag_slug__in']) ) {
+               if ( !empty($q['tag_slug__in']) && empty($q['cat']) ) {
                        $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) INNER JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) ";
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
                        $include_tags = "'" . implode("', '", $q['tag_slug__in']) . "'";
                        $join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) INNER JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) ";
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
                        $include_tags = "'" . implode("', '", $q['tag_slug__in']) . "'";
@@ -1899,19 +1897,17 @@ class WP_Query {
                                $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'post_tag' AND tt.term_id IN ($tag_string) )";
                        } else {
                                $ids = get_objects_in_term($q['tag__not_in'], 'post_tag');
                                $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'post_tag' AND tt.term_id IN ($tag_string) )";
                        } else {
                                $ids = get_objects_in_term($q['tag__not_in'], 'post_tag');
-                               if ( is_wp_error( $ids ) )
-                                       $ids = array();
-                               if ( is_array($ids) && count($ids > 0) ) {
-                                       $out_posts = "'" . implode("', '", $ids) . "'";
-                                       $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)";
-                               }
+                               if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 )
+                                       $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')";
                        }
                }
 
                // Tag and slug intersections.
                        }
                }
 
                // Tag and slug intersections.
-               $intersections = array('category__and' => 'category', 'tag__and' => 'post_tag', 'tag_slug__and' => 'post_tag');
+               $intersections = array('category__and' => 'category', 'tag__and' => 'post_tag', 'tag_slug__and' => 'post_tag', 'tag__in' => 'post_tag', 'tag_slug__in' => 'post_tag');
+               $tagin = array('tag__in', 'tag_slug__in'); // These are used to make some exceptions below
                foreach ($intersections as $item => $taxonomy) {
                        if ( empty($q[$item]) ) continue;
                foreach ($intersections as $item => $taxonomy) {
                        if ( empty($q[$item]) ) continue;
+                       if ( in_array($item, $tagin) && empty($q['cat']) ) continue; // We should already have what we need if categories aren't being used
 
                        if ( $item != 'category__and' ) {
                                $reqtag = is_term( $q[$item][0], 'post_tag' );
 
                        if ( $item != 'category__and' ) {
                                $reqtag = is_term( $q[$item][0], 'post_tag' );
@@ -1919,13 +1915,17 @@ class WP_Query {
                                        $q['tag_id'] = $reqtag['term_id'];
                        }
 
                                        $q['tag_id'] = $reqtag['term_id'];
                        }
 
-                       $taxonomy_field = $item == 'tag_slug__and' ? 'slug' : 'term_id';
+                       if ( in_array( $item, array('tag_slug__and', 'tag_slug__in' ) ) )
+                               $taxonomy_field = 'slug';
+                       else
+                               $taxonomy_field = 'term_id';
 
                        $q[$item] = array_unique($q[$item]);
                        $tsql = "SELECT p.ID FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON (p.ID = tr.object_id) INNER JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) INNER JOIN $wpdb->terms t ON (tt.term_id = t.term_id)";
                        $tsql .= " WHERE tt.taxonomy = '$taxonomy' AND t.$taxonomy_field IN ('" . implode("', '", $q[$item]) . "')";
 
                        $q[$item] = array_unique($q[$item]);
                        $tsql = "SELECT p.ID FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON (p.ID = tr.object_id) INNER JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) INNER JOIN $wpdb->terms t ON (tt.term_id = t.term_id)";
                        $tsql .= " WHERE tt.taxonomy = '$taxonomy' AND t.$taxonomy_field IN ('" . implode("', '", $q[$item]) . "')";
-                       $tsql .= " GROUP BY p.ID HAVING count(p.ID) = " . count($q[$item]);
-
+                       if ( !in_array($item, $tagin) ) { // This next line is only helpful if we are doing an and relationship
+                               $tsql .= " GROUP BY p.ID HAVING count(p.ID) = " . count($q[$item]);
+                       }
                        $post_ids = $wpdb->get_col($tsql);
 
                        if ( count($post_ids) )
                        $post_ids = $wpdb->get_col($tsql);
 
                        if ( count($post_ids) )
@@ -1944,7 +1944,7 @@ class WP_Query {
                                $terms = get_terms($q['taxonomy'], array('slug'=>$q['term']));
                        } else {
                                foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
                                $terms = get_terms($q['taxonomy'], array('slug'=>$q['term']));
                        } else {
                                foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
-                                       if ( isset($t->query_var) && '' != $q[$t->query_var] ) {
+                                       if ( $t->query_var && '' != $q[$t->query_var] ) {
                                                $terms = get_terms($taxonomy, array('slug'=>$q[$t->query_var]));
                                                if ( !is_wp_error($terms) )
                                                        break;
                                                $terms = get_terms($taxonomy, array('slug'=>$q[$t->query_var]));
                                                if ( !is_wp_error($terms) )
                                                        break;
@@ -2005,6 +2005,9 @@ class WP_Query {
                        }
                        $q['author_name'] = sanitize_title($q['author_name']);
                        $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
                        }
                        $q['author_name'] = sanitize_title($q['author_name']);
                        $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
+                       $q['author'] = get_user_by('slug', $q['author_name']);
+                       if ( $q['author'] )
+                               $q['author'] = $q['author']->ID;
                        $whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
                }
 
                        $whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
                }
 
@@ -2021,9 +2024,11 @@ class WP_Query {
                // Order by
                if ( empty($q['orderby']) ) {
                        $q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
                // Order by
                if ( empty($q['orderby']) ) {
                        $q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
+               } elseif ( 'none' == $q['orderby'] ) {
+                       $q['orderby'] = '';
                } else {
                        // Used to filter values
                } else {
                        // Used to filter values
-                       $allowed_keys = array('author', 'date', 'category', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand');
+                       $allowed_keys = array('author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand');
                        if ( !empty($q['meta_key']) ) {
                                $allowed_keys[] = $q['meta_key'];
                                $allowed_keys[] = 'meta_value';
                        if ( !empty($q['meta_key']) ) {
                                $allowed_keys[] = $q['meta_key'];
                                $allowed_keys[] = 'meta_value';
@@ -2064,14 +2069,14 @@ class WP_Query {
                                $q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
                }
 
                                $q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
                }
 
-               if ( $this->is_attachment ) {
+               if ( 'any' == $post_type ) {
+                       $where .= " AND $wpdb->posts.post_type != 'revision'";
+               } elseif ( $this->is_attachment ) {
                        $where .= " AND $wpdb->posts.post_type = 'attachment'";
                } elseif ($this->is_page) {
                        $where .= " AND $wpdb->posts.post_type = 'page'";
                } elseif ($this->is_single) {
                        $where .= " AND $wpdb->posts.post_type = 'post'";
                        $where .= " AND $wpdb->posts.post_type = 'attachment'";
                } elseif ($this->is_page) {
                        $where .= " AND $wpdb->posts.post_type = 'page'";
                } elseif ($this->is_single) {
                        $where .= " AND $wpdb->posts.post_type = 'post'";
-               } elseif ( 'any' == $post_type ) {
-                       $where .= '';
                } else {
                        $where .= " AND $wpdb->posts.post_type = '$post_type'";
                }
                } else {
                        $where .= " AND $wpdb->posts.post_type = '$post_type'";
                }
@@ -2133,7 +2138,7 @@ class WP_Query {
 
                // postmeta queries
                if ( ! empty($q['meta_key']) || ! empty($q['meta_value']) )
 
                // postmeta queries
                if ( ! empty($q['meta_key']) || ! empty($q['meta_value']) )
-                       $join .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
+                       $join .= " JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
                if ( ! empty($q['meta_key']) )
                        $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
                if ( ! empty($q['meta_value']) ) {
                if ( ! empty($q['meta_key']) )
                        $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
                if ( ! empty($q['meta_value']) ) {
@@ -2171,11 +2176,11 @@ class WP_Query {
                // Comments feeds
                if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) {
                        if ( $this->is_archive || $this->is_search ) {
                // Comments feeds
                if ( $this->is_comment_feed && ( $this->is_archive || $this->is_search || !$this->is_singular ) ) {
                        if ( $this->is_archive || $this->is_search ) {
-                               $cjoin = "LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
+                               $cjoin = "JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
                                $cwhere = "WHERE comment_approved = '1' $where";
                                $cwhere = "WHERE comment_approved = '1' $where";
-                               $cgroupby = "GROUP BY $wpdb->comments.comment_id";
+                               $cgroupby = "$wpdb->comments.comment_id";
                        } else { // Other non singular e.g. front
                        } else { // Other non singular e.g. front
-                               $cjoin = "LEFT JOIN $wpdb->posts ON ( $wpdb->comments.comment_post_ID = $wpdb->posts.ID )";
+                               $cjoin = "JOIN $wpdb->posts ON ( $wpdb->comments.comment_post_ID = $wpdb->posts.ID )";
                                $cwhere = "WHERE post_status = 'publish' AND comment_approved = '1'";
                                $cgroupby = '';
                        }
                                $cwhere = "WHERE post_status = 'publish' AND comment_approved = '1'";
                                $cgroupby = '';
                        }
@@ -2184,9 +2189,13 @@ class WP_Query {
                                $cjoin = apply_filters('comment_feed_join', $cjoin);
                                $cwhere = apply_filters('comment_feed_where', $cwhere);
                                $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
                                $cjoin = apply_filters('comment_feed_join', $cjoin);
                                $cwhere = apply_filters('comment_feed_where', $cwhere);
                                $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+                               $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC');
+                               $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'));
                        }
                        }
+                       $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
+                       $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
 
 
-                       $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss'));
+                       $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits");
                        $this->comment_count = count($this->comments);
 
                        $post_ids = array();
                        $this->comment_count = count($this->comments);
 
                        $post_ids = array();
@@ -2214,9 +2223,6 @@ class WP_Query {
                        $distinct = apply_filters('posts_distinct', $distinct);
                        $limits = apply_filters( 'post_limits', $limits );
 
                        $distinct = apply_filters('posts_distinct', $distinct);
                        $limits = apply_filters( 'post_limits', $limits );
 
-                       if ( ! empty($q['meta_key']) )
-                               $fields = "$fields, $wpdb->postmeta.meta_value";
-
                        $fields = apply_filters('posts_fields', $fields);
                }
 
                        $fields = apply_filters('posts_fields', $fields);
                }
 
@@ -2254,7 +2260,12 @@ class WP_Query {
                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
                        $cjoin = apply_filters('comment_feed_join', '');
                        $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'");
                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
                        $cjoin = apply_filters('comment_feed_join', '');
                        $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'");
-                       $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss');
+                       $cgroupby = apply_filters('comment_feed_groupby', '');
+                       $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
+                       $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC');
+                       $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
+                       $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'));
+                       $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
                        $this->comments = $wpdb->get_results($comments_request);
                        $this->comment_count = count($this->comments);
                }
                        $this->comments = $wpdb->get_results($comments_request);
                        $this->comment_count = count($this->comments);
                }
@@ -2301,7 +2312,7 @@ class WP_Query {
 
                // Put sticky posts at the top of the posts array
                $sticky_posts = get_option('sticky_posts');
 
                // Put sticky posts at the top of the posts array
                $sticky_posts = get_option('sticky_posts');
-               if ( $this->is_home && $page <= 1 && !empty($sticky_posts) && !$q['caller_get_posts'] ) {
+               if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['caller_get_posts'] ) {
                        $num_posts = count($this->posts);
                        $sticky_offset = 0;
                        // Loop over posts and relocate stickies to the front.
                        $num_posts = count($this->posts);
                        $sticky_offset = 0;
                        // Loop over posts and relocate stickies to the front.
@@ -2372,16 +2383,17 @@ class WP_Query {
         * @since 1.5.0
         * @access public
         * @uses $post
         * @since 1.5.0
         * @access public
         * @uses $post
-        * @uses do_action() Calls 'loop_start' if loop has just started
+        * @uses do_action_ref_array() Calls 'loop_start' if loop has just started
         */
        function the_post() {
                global $post;
                $this->in_the_loop = true;
         */
        function the_post() {
                global $post;
                $this->in_the_loop = true;
+
+               if ( $this->current_post == -1 ) // loop has just started
+                       do_action_ref_array('loop_start', array(&$this));
+
                $post = $this->next_post();
                setup_postdata($post);
                $post = $this->next_post();
                setup_postdata($post);
-
-               if ( $this->current_post == 0 ) // loop has just started
-                       do_action('loop_start');
        }
 
        /**
        }
 
        /**
@@ -2391,7 +2403,7 @@ class WP_Query {
         *
         * @since 1.5.0
         * @access public
         *
         * @since 1.5.0
         * @access public
-        * @uses do_action() Calls 'loop_start' if loop has just started
+        * @uses do_action_ref_array() Calls 'loop_end' if loop is ended
         *
         * @return bool True if posts are available, false if end of loop.
         */
         *
         * @return bool True if posts are available, false if end of loop.
         */
@@ -2399,7 +2411,7 @@ class WP_Query {
                if ($this->current_post + 1 < $this->post_count) {
                        return true;
                } elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) {
                if ($this->current_post + 1 < $this->post_count) {
                        return true;
                } elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) {
-                       do_action('loop_end');
+                       do_action_ref_array('loop_end', array(&$this));
                        // Do some cleaning up after the loop
                        $this->rewind_posts();
                }
                        // Do some cleaning up after the loop
                        $this->rewind_posts();
                }
@@ -2647,6 +2659,7 @@ function wp_old_slug_redirect () {
  * @since 1.5.0
  *
  * @param object $post Post data.
  * @since 1.5.0
  *
  * @param object $post Post data.
+ * @uses do_action_ref_array() Calls 'the_post'
  * @return bool True when finished.
  */
 function setup_postdata($post) {
  * @return bool True when finished.
  */
 function setup_postdata($post) {
@@ -2656,8 +2669,8 @@ function setup_postdata($post) {
 
        $authordata = get_userdata($post->post_author);
 
 
        $authordata = get_userdata($post->post_author);
 
-       $day = mysql2date('d.m.y', $post->post_date);
-       $currentmonth = mysql2date('m', $post->post_date);
+       $day = mysql2date('d.m.y', $post->post_date, false);
+       $currentmonth = mysql2date('m', $post->post_date, false);
        $numpages = 1;
        $page = get_query_var('page');
        if ( !$page )
        $numpages = 1;
        $page = get_query_var('page');
        if ( !$page )
@@ -2678,7 +2691,10 @@ function setup_postdata($post) {
                $pages[0] = $post->post_content;
                $multipage = 0;
        }
                $pages[0] = $post->post_content;
                $multipage = 0;
        }
+
+       do_action_ref_array('the_post', array(&$post));
+       
        return true;
 }
 
        return true;
 }
 
-?>
\ No newline at end of file
+?>
index aee3ae149f4e0decb686f646c3e264c986fb65d5..3dfb672c1fe7f67e87ae605e8014d1a7763533e3 100644 (file)
@@ -176,6 +176,18 @@ function wp_insert_user($userdata) {
        if ( empty($user_registered) )
                $user_registered = gmdate('Y-m-d H:i:s');
 
        if ( empty($user_registered) )
                $user_registered = gmdate('Y-m-d H:i:s');
 
+       $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login));
+
+       if ($user_nicename_check) {
+               $suffix = 2;
+               while ($user_nicename_check) {
+                       $alt_user_nicename = $user_nicename . "-$suffix";
+                       $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login));
+                       $suffix++;
+               }
+               $user_nicename = $alt_user_nicename;
+       }
+
        $data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
        $data = stripslashes_deep( $data );
 
        $data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
        $data = stripslashes_deep( $data );
 
@@ -199,12 +211,10 @@ function wp_insert_user($userdata) {
        update_usermeta( $user_id, 'admin_color', $admin_color);
        update_usermeta( $user_id, 'use_ssl', $use_ssl);
 
        update_usermeta( $user_id, 'admin_color', $admin_color);
        update_usermeta( $user_id, 'use_ssl', $use_ssl);
 
-       if ( $update && isset($role) ) {
+       if ( isset($role) ) {
                $user = new WP_User($user_id);
                $user->set_role($role);
                $user = new WP_User($user_id);
                $user->set_role($role);
-       }
-
-       if ( !$update ) {
+       } elseif ( !$update ) {
                $user = new WP_User($user_id);
                $user->set_role(get_option('default_role'));
        }
                $user = new WP_User($user_id);
                $user->set_role(get_option('default_role'));
        }
index 116c7f933c2be6e3ec7271becedb7276436dbff0..c84b5205ed3cf7f76cf60ab93ad643e35e8f7844 100644 (file)
@@ -178,6 +178,9 @@ define('EP_ALL', 8191);
  * The endpoints are added to the end of the request. So a request matching
  * "/2008/10/14/my_post/myep/", the endpoint will be "/myep/".
  *
  * The endpoints are added to the end of the request. So a request matching
  * "/2008/10/14/my_post/myep/", the endpoint will be "/myep/".
  *
+ * Be sure to flush the rewrite rules (wp_rewrite->flush()) when your plugin gets
+ * activated (register_activation_hook()) and deactivated (register_deactivation_hook())
+ *
  * @since 2.1.0
  * @see WP_Rewrite::add_endpoint() Parameters and more description.
  * @uses $wp_rewrite
  * @since 2.1.0
  * @see WP_Rewrite::add_endpoint() Parameters and more description.
  * @uses $wp_rewrite
@@ -1344,6 +1347,12 @@ class WP_Rewrite {
                        $commentmatch = $match . $commentregex;
                        $commentquery = $index . '?' . $query . '&cpage=' . $this->preg_index($num_toks + 1);
 
                        $commentmatch = $match . $commentregex;
                        $commentquery = $index . '?' . $query . '&cpage=' . $this->preg_index($num_toks + 1);
 
+                       if ( get_option('page_on_front') ) {
+                               //create query for Root /comment-page-xx
+                               $rootcommentmatch = $match . $commentregex;
+                               $rootcommentquery = $index . '?' . $query . '&page_id=' . get_option('page_on_front') . '&cpage=' . $this->preg_index($num_toks + 1);
+                       }
+
                        //create query for /feed/(feed|atom|rss|rss2|rdf)
                        $feedmatch = $match . $feedregex;
                        $feedquery = $feedindex . '?' . $query . '&feed=' . $this->preg_index($num_toks + 1);
                        //create query for /feed/(feed|atom|rss|rss2|rdf)
                        $feedmatch = $match . $feedregex;
                        $feedquery = $feedindex . '?' . $query . '&feed=' . $this->preg_index($num_toks + 1);
@@ -1368,6 +1377,8 @@ class WP_Rewrite {
                        //only on pages with comments add ../comment-page-xx/
                        if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask || EP_NONE & $ep_mask )
                                $rewrite = array_merge($rewrite, array($commentmatch => $commentquery));
                        //only on pages with comments add ../comment-page-xx/
                        if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask || EP_NONE & $ep_mask )
                                $rewrite = array_merge($rewrite, array($commentmatch => $commentquery));
+                       else if ( EP_ROOT & $ep_mask && get_option('page_on_front') )
+                               $rewrite = array_merge($rewrite, array($rootcommentmatch => $rootcommentquery));
 
                        //do endpoints
                        if ($endpoints) {
 
                        //do endpoints
                        if ($endpoints) {
@@ -1596,11 +1607,11 @@ class WP_Rewrite {
         * @return array Rewrite rules.
         */
        function wp_rewrite_rules() {
         * @return array Rewrite rules.
         */
        function wp_rewrite_rules() {
-               $this->rules = get_option('rewrite_rules');
+               $this->rules = get_transient('rewrite_rules');
                if ( empty($this->rules) ) {
                        $this->matches = 'matches';
                        $this->rewrite_rules();
                if ( empty($this->rules) ) {
                        $this->matches = 'matches';
                        $this->rewrite_rules();
-                       update_option('rewrite_rules', $this->rules);
+                       set_transient('rewrite_rules', $this->rules);
                }
 
                return $this->rules;
                }
 
                return $this->rules;
@@ -1693,6 +1704,36 @@ class WP_Rewrite {
                return $rules;
        }
 
                return $rules;
        }
 
+       /**
+        * Retrieve IIS7 URL Rewrite formatted rewrite rules to write to web.config file.
+        *
+        * Does not actually write to the web.config file, but creates the rules for
+        * the process that will.
+        *
+        * @since 2.8.0
+        * @access public
+        *
+        * @return string
+        */
+       function iis7_url_rewrite_rules(){
+
+               if ( ! $this->using_permalinks()) {
+                       return '';
+               }
+               $rules  = "<rule name=\"wordpress\" patternSyntax=\"Wildcard\">\n";
+               $rules .= "     <match url=\"*\" />\n";
+               $rules .= "     <conditions>\n";
+               $rules .= "             <add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />\n";
+               $rules .= "             <add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />\n";
+               $rules .= "     </conditions>\n";
+               $rules .= "     <action type=\"Rewrite\" url=\"index.php\" />\n";
+               $rules .= "</rule>";
+
+               $rules = apply_filters('iis7_url_rewrite_rules', $rules);
+
+               return $rules;
+       }
+
        /**
         * Add a straight rewrite rule.
         *
        /**
         * Add a straight rewrite rule.
         *
@@ -1783,17 +1824,19 @@ class WP_Rewrite {
         * @access public
         */
        function flush_rules() {
         * @access public
         */
        function flush_rules() {
-               delete_option('rewrite_rules');
+               delete_transient('rewrite_rules');
                $this->wp_rewrite_rules();
                if ( function_exists('save_mod_rewrite_rules') )
                        save_mod_rewrite_rules();
                $this->wp_rewrite_rules();
                if ( function_exists('save_mod_rewrite_rules') )
                        save_mod_rewrite_rules();
+               if ( function_exists('iis7_save_url_rewrite_rules') )
+                       iis7_save_url_rewrite_rules();
        }
 
        /**
         * Sets up the object's properties.
         *
        }
 
        /**
         * Sets up the object's properties.
         *
-        * The 'use_verbose_page_rules' object property will be turned on, if the
-        * permalink structure includes the following: '%postname%', '%category%',
+        * The 'use_verbose_page_rules' object property will be set to true if the
+        * permalink structure begins with one of the following: '%postname%', '%category%',
         * '%tag%', or '%author%'.
         *
         * @since 1.5.0
         * '%tag%', or '%author%'.
         *
         * @since 1.5.0
@@ -1819,13 +1862,7 @@ class WP_Rewrite {
                $this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false;
 
                // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
                $this->use_trailing_slashes = ( substr($this->permalink_structure, -1, 1) == '/' ) ? true : false;
 
                // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
-               $structure = ltrim($this->permalink_structure, '/');
-               if ( $this->using_index_permalinks() )
-                       $structure = ltrim($this->permalink_structure, $this->index . '/');
-               if ( 0 === strpos($structure, '%postname%') ||
-                        0 === strpos($structure, '%category%') ||
-                        0 === strpos($structure, '%tag%') ||
-                        0 === strpos($structure, '%author%') )
+               if ( preg_match("/^[^%]*%(?:postname|category|tag|author)%/", $this->permalink_structure) )
                         $this->use_verbose_page_rules = true;
                else
                        $this->use_verbose_page_rules = false;
                         $this->use_verbose_page_rules = true;
                else
                        $this->use_verbose_page_rules = false;
@@ -1838,6 +1875,9 @@ class WP_Rewrite {
         * between the current permalink structure and the parameter value. Calls
         * {@link WP_Rewrite::init()} after the option is updated.
         *
         * between the current permalink structure and the parameter value. Calls
         * {@link WP_Rewrite::init()} after the option is updated.
         *
+        * Fires the 'permalink_structure_changed' action once the init call has
+        * processed passing the old and new values
+        *
         * @since 1.5.0
         * @access public
         *
         * @since 1.5.0
         * @access public
         *
@@ -1847,6 +1887,7 @@ class WP_Rewrite {
                if ($permalink_structure != $this->permalink_structure) {
                        update_option('permalink_structure', $permalink_structure);
                        $this->init();
                if ($permalink_structure != $this->permalink_structure) {
                        update_option('permalink_structure', $permalink_structure);
                        $this->init();
+                       do_action('permalink_structure_changed', $this->permalink_structure, $permalink_structure);
                }
        }
 
                }
        }
 
index 9962773486de233bbd9d54779e1f443326186978..d48230ac6f5477eab405de2d0113b6df06a11d7f 100644 (file)
@@ -170,7 +170,7 @@ class MagpieRSS {
                {
                        // if tags are inlined, then flatten
                        $attrs_str = join(' ',
                {
                        // if tags are inlined, then flatten
                        $attrs_str = join(' ',
-                                       array_map('map_attrs',
+                                       array_map(array('MagpieRSS', 'map_attrs'),
                                        array_keys($attrs),
                                        array_values($attrs) ) );
 
                                        array_keys($attrs),
                                        array_values($attrs) ) );
 
@@ -712,16 +712,8 @@ class RSSCache {
        function set ($url, $rss) {
                global $wpdb;
                $cache_option = 'rss_' . $this->file_name( $url );
        function set ($url, $rss) {
                global $wpdb;
                $cache_option = 'rss_' . $this->file_name( $url );
-               $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts';
 
 
-               // shouldn't these be using get_option() ?
-               if ( !$wpdb->get_var( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name = %s", $cache_option ) ) )
-                       add_option($cache_option, '', '', 'no');
-               if ( !$wpdb->get_var( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name = %s", $cache_timestamp ) ) )
-                       add_option($cache_timestamp, '', '', 'no');
-
-               update_option($cache_option, $rss);
-               update_option($cache_timestamp, time() );
+               set_transient($cache_option, $rss, $this->MAX_AGE);
 
                return $cache_option;
        }
 
                return $cache_option;
        }
@@ -736,15 +728,13 @@ class RSSCache {
                $this->ERROR = "";
                $cache_option = 'rss_' . $this->file_name( $url );
 
                $this->ERROR = "";
                $cache_option = 'rss_' . $this->file_name( $url );
 
-               if ( ! get_option( $cache_option ) ) {
+               if ( ! $rss = get_transient( $cache_option ) ) {
                        $this->debug(
                                "Cache doesn't contain: $url (cache option: $cache_option)"
                        );
                        return 0;
                }
 
                        $this->debug(
                                "Cache doesn't contain: $url (cache option: $cache_option)"
                        );
                        return 0;
                }
 
-               $rss = get_option( $cache_option );
-
                return $rss;
        }
 
                return $rss;
        }
 
@@ -757,23 +747,12 @@ class RSSCache {
 \*=======================================================================*/
        function check_cache ( $url ) {
                $this->ERROR = "";
 \*=======================================================================*/
        function check_cache ( $url ) {
                $this->ERROR = "";
-               $cache_option = $this->file_name( $url );
-               $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts';
-
-               if ( $mtime = get_option($cache_timestamp) ) {
-                       // find how long ago the file was added to the cache
-                       // and whether that is longer then MAX_AGE
-                       $age = time() - $mtime;
-                       if ( $this->MAX_AGE > $age ) {
-                               // object exists and is current
+               $cache_option = 'rss_' . $this->file_name( $url );
+
+               if ( get_transient($cache_option) ) {
+                       // object exists and is current
                                return 'HIT';
                                return 'HIT';
-                       }
-                       else {
-                               // object exists but is old
-                               return 'STALE';
-                       }
-               }
-               else {
+               } else {
                        // object does not exist
                        return 'MISS';
                }
                        // object does not exist
                        return 'MISS';
                }
@@ -893,8 +872,8 @@ function wp_rss( $url, $num_items = -1 ) {
                foreach ( (array) $rss->items as $item ) {
                        printf(
                                '<li><a href="%1$s" title="%2$s">%3$s</a></li>',
                foreach ( (array) $rss->items as $item ) {
                        printf(
                                '<li><a href="%1$s" title="%2$s">%3$s</a></li>',
-                               clean_url( $item['link'] ),
-                               attribute_escape( strip_tags( $item['description'] ) ),
+                               esc_url( $item['link'] ),
+                               esc_attr( strip_tags( $item['description'] ) ),
                                htmlentities( $item['title'] )
                        );
                }
                                htmlentities( $item['title'] )
                        );
                }
index 32b1bd29e25212a0da5aea04f4fda4017136f390..62256dfef7856de9eeede77798e37f042ea0a3a2 100644 (file)
@@ -7,6 +7,17 @@
  * plugins will only be concerned about the filters and actions set in this
  * file.
  *
  * plugins will only be concerned about the filters and actions set in this
  * file.
  *
+ * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
+ * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and disables compression and concatenation
+ * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation,
+ * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
+ * define('COMPRESS_CSS', false); disables compression of CSS,
+ * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
+ *
+ * The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins
+ * to temporarily override the above settings. Also a compression test is run once and the result is saved
+ * as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted.
+ *
  * @package WordPress
  */
 
  * @package WordPress
  */
 
@@ -29,57 +40,69 @@ require( ABSPATH . WPINC . '/functions.wp-styles.php' );
  * Setup WordPress scripts to load by default for Administration Panels.
  *
  * Localizes a few of the scripts.
  * Setup WordPress scripts to load by default for Administration Panels.
  *
  * Localizes a few of the scripts.
+ * $scripts->add_data( 'script-handle', 'group', 1 ); queues the script for the footer
  *
  * @since 2.6.0
  *
  * @param object $scripts WP_Scripts object.
  */
 function wp_default_scripts( &$scripts ) {
  *
  * @since 2.6.0
  *
  * @param object $scripts WP_Scripts object.
  */
 function wp_default_scripts( &$scripts ) {
-       if (!$guessurl = site_url())
+
+       if ( !$guessurl = site_url() )
                $guessurl = wp_guess_url();
 
        $scripts->base_url = $guessurl;
                $guessurl = wp_guess_url();
 
        $scripts->base_url = $guessurl;
+       $scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
        $scripts->default_version = get_bloginfo( 'version' );
        $scripts->default_version = get_bloginfo( 'version' );
+       $scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/');
+
+       $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
 
 
-       $scripts->add( 'common', '/wp-admin/js/common.js', array('jquery', 'hoverIntent'), '20081210' );
-       $scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
+       $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
 
 
-       $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20081210' );
+       $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090609' );
+       $scripts->add_data( 'common', 'group', 1 );
+       $scripts->localize( 'common', 'commonL10n', array(
+               'warnDelete' => __("You are about to delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
+               'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
+       ) );
+
+       $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' );
+       $scripts->add_data( 'sack', 'group', 1 );
+
+       $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20090307' );
        $scripts->localize( 'quicktags', 'quicktagsL10n', array(
                'quickLinks' => __('(Quick Links)'),
                'wordLookup' => __('Enter a word to look up:'),
        $scripts->localize( 'quicktags', 'quicktagsL10n', array(
                'quickLinks' => __('(Quick Links)'),
                'wordLookup' => __('Enter a word to look up:'),
-               'dictionaryLookup' => attribute_escape(__('Dictionary lookup')),
-               'lookup' => attribute_escape(__('lookup')),
-               'closeAllOpenTags' => attribute_escape(__('Close all open tags')),
-               'closeTags' => attribute_escape(__('close tags')),
+               'dictionaryLookup' => esc_attr(__('Dictionary lookup')),
+               'lookup' => esc_attr(__('lookup')),
+               'closeAllOpenTags' => esc_attr(__('Close all open tags')),
+               'closeTags' => esc_attr(__('close tags')),
                'enterURL' => __('Enter the URL'),
                'enterImageURL' => __('Enter the URL of the image'),
                'enterImageDescription' => __('Enter a description of the image'),
                'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};'
        ) );
 
                'enterURL' => __('Enter the URL'),
                'enterImageURL' => __('Enter the URL of the image'),
                'enterImageDescription' => __('Enter a description of the image'),
                'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};'
        ) );
 
-       $scripts->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );
-
-       // Modify this version when tinyMCE plugins are changed.
-       function mce_version() {
-               return '20081129';
-       }
-       add_filter( 'tiny_mce_version', 'mce_version' );
+       $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
 
 
-       $scripts->add( 'editor', '/wp-admin/js/editor.js', false, mce_version() );
+       $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, '20090503' );
 
        $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
 
 
        $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
 
-       $scripts->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20081210' );
+       $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20090128' );
+       $scripts->add_data( 'wp-ajax-response', 'group', 1 );
        $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
                'noPerm' => __('You do not have permission to do that.'),
                'broken' => __('An unidentified error has occurred.'),
                'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
        ) );
 
        $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
                'noPerm' => __('You do not have permission to do that.'),
                'broken' => __('An unidentified error has occurred.'),
                'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
        ) );
 
-       $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081210' );
+       $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090526' );
+       $scripts->add_data( 'autosave', 'group', 1 );
 
 
-       $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20081210' );
+       $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090504' );
+       $scripts->add_data( 'wp-lists', 'group', 1 );
        $scripts->localize( 'wp-lists', 'wpListL10n', array(
                'url' => admin_url('admin-ajax.php')
        ) );
        $scripts->localize( 'wp-lists', 'wpListL10n', array(
                'url' => admin_url('admin-ajax.php')
        ) );
@@ -95,23 +118,72 @@ function wp_default_scripts( &$scripts ) {
 
        $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
 
 
        $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
 
-       $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.6');
-       $scripts->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');
-       $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
+       $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2');
+
+       $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-core', 'group', 1 );
+
+       $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-tabs', 'group', 1 );
+
+       $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-sortable', 'group', 1 );
+
+       $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-draggable', 'group', 1 );
+
+       $scripts->add( 'jquery-ui-droppable', '/wp-includes/js/jquery/ui.droppable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-droppable', 'group', 1 );
+
+       $scripts->add( 'jquery-ui-selectable', '/wp-includes/js/jquery/ui.selectable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-selectable', 'group', 1 );
+
+       $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-resizable', 'group', 1 );
+
+       $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.7.1' );
+       $scripts->add_data( 'jquery-ui-dialog', 'group', 1 );
+
+       $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m');
+       $scripts->add_data( 'jquery-form', 'group', 1 );
+
+       $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m');
+       $scripts->add_data( 'jquery-color', 'group', 1 );
+
        $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
        $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
-       $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1b');
-       $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
-       $scripts->add( 'jquery-hotkeys', '/wp-includes/js/jquery/jquery.hotkeys.js', array('jquery'), '0.0.2' );
-       $scripts->add( 'jquery-table-hotkeys', '/wp-includes/js/jquery/jquery.table-hotkeys.js', array('jquery', 'jquery-hotkeys'), '20081128' );
-       $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20090123');
-       $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031');
-       $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.2.0-20081031');
-       $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031');
-       $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
-               'is_lighttpd_before_150' => is_lighttpd_before_150(),
-       ) );
-       $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.2.0-20081031');
-       $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.2.0-20081201');
+
+       $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20090125');
+       $scripts->add_data( 'suggest', 'group', 1 );
+
+       $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m');
+       $scripts->add_data( 'schedule', 'group', 1 );
+
+       $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m' );
+       $scripts->add_data( 'jquery-hotkeys', 'group', 1 );
+
+       $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' );
+       $scripts->add_data( 'jquery-table-hotkeys', 'group', 1 );
+
+       $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20090123');
+       $scripts->add_data( 'thickbox', 'group', 1 );
+
+       $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8');
+
+       $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.1');
+
+       $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2201');
+       $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201');
+       $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201');
+       $scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201');
+
+       if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
+               // queue all SWFUpload scripts that are used by default
+               $scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201');
+       } else {
+               $scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201');
+       }
+
+       $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20090515');
        // these error messages came from the sample swfupload js, they might need changing.
        $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
                        'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
        // these error messages came from the sample swfupload js, they might need changing.
        $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
                        'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
@@ -133,57 +205,71 @@ function wp_default_scripts( &$scripts ) {
                        'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
        ) );
 
                        'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
        ) );
 
-       $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' );
-       $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );
-       $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2c' );
-       $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );
-       $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );
-       $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );
-
-       $scripts->add( 'comment-reply', '/wp-includes/js/comment-reply.js', false, '20081210');
+       $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
 
        if ( is_admin() ) {
 
        if ( is_admin() ) {
-               $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20081210' );
+               $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
+               $scripts->add_data( 'ajaxcat', 'group', 1 );
                $scripts->localize( 'ajaxcat', 'catL10n', array(
                $scripts->localize( 'ajaxcat', 'catL10n', array(
-                       'add' => attribute_escape(__('Add')),
+                       'add' => esc_attr(__('Add')),
                        'how' => __('Separate multiple categories with commas.'),
                        'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
                ) );
                        'how' => __('Separate multiple categories with commas.'),
                        'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
                ) );
-               $scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20081210' );
-               $scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20081210' );
-               $scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20081210' );
-               $scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20081210' );
+
+               $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090207' );
+               $scripts->add_data( 'admin-categories', 'group', 1 );
+
+               $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090211' );
+               $scripts->add_data( 'admin-tags', 'group', 1 );
+
+               $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
+               $scripts->add_data( 'admin-custom-fields', 'group', 1 );
+
+               $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' );
+               $scripts->add_data( 'password-strength-meter', 'group', 1 );
                $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
                        'empty' => __('Strength indicator'),
                        'short' => __('Very weak'),
                        'bad' => __('Weak'),
                $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
                        'empty' => __('Strength indicator'),
                        'short' => __('Very weak'),
                        'bad' => __('Weak'),
-                       'good' => _c('Medium|password strength'),
+                       /* translators: password strength */
+                       'good' => _x('Medium', 'password strength'),
                        'strong' => __('Strong'),
                        'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
                ) );
                        'strong' => __('Strong'),
                        'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
                ) );
-               $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081210' );
+
+               $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
+               $scripts->add_data( 'user-profile', 'group', 1 );
+
+               $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090209' );
+               $scripts->add_data( 'admin-comments', 'group', 1 );
                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
                        'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
                        'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
                ) );
                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
                        'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
                        'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
                ) );
-               $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20081210' );
-               $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
-               $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081210' );
+
+               $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
+
+               $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090327' );
+               $scripts->add_data( 'postbox', 'group', 1 );
                $scripts->localize( 'postbox', 'postboxL10n', array(
                        'requestFile' => admin_url('admin-ajax.php')
                ) );
                $scripts->localize( 'postbox', 'postboxL10n', array(
                        'requestFile' => admin_url('admin-ajax.php')
                ) );
-               $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20081210' );
+
+               $scripts->add( 'slug', "/wp-admin/js/slug$suffix.js", array('jquery'), '20090207' );
+               $scripts->add_data( 'slug', 'group', 1 );
                $scripts->localize( 'slug', 'slugL10n', array(
                        'requestFile' => admin_url('admin-ajax.php'),
                        'save' => __('Save'),
                        'cancel' => __('Cancel'),
                        'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};'
                ) );
                $scripts->localize( 'slug', 'slugL10n', array(
                        'requestFile' => admin_url('admin-ajax.php'),
                        'save' => __('Save'),
                        'cancel' => __('Cancel'),
                        'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};'
                ) );
-               $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081210' );
+
+               $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090526' );
+               $scripts->add_data( 'post', 'group', 1 );
                $scripts->localize( 'post', 'postL10n', array(
                        'tagsUsed' =>  __('Tags used on this post:'),
                $scripts->localize( 'post', 'postL10n', array(
                        'tagsUsed' =>  __('Tags used on this post:'),
-                       'add' => attribute_escape(__('Add')),
-                       'addTag' => attribute_escape(__('Add new tag')),
+                       'add' => esc_attr(__('Add')),
+                       'addTag' => esc_attr(__('Add new tag')),
                        'separate' => __('Separate tags with commas'),
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
                        'separate' => __('Separate tags with commas'),
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
@@ -205,7 +291,9 @@ function wp_default_scripts( &$scripts ) {
                        'published' => __('Published'),
                        'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
                ) );
                        'published' => __('Published'),
                        'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
                ) );
-               $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081210' );
+
+               $scripts->add( 'page', "/wp-admin/js/page$suffix.js", array('jquery', 'slug', 'wp-lists', 'postbox'), '20090526' );
+               $scripts->add_data( 'page', 'group', 1 );
                $scripts->localize( 'page', 'postL10n', array(
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
                $scripts->localize( 'page', 'postL10n', array(
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
@@ -226,43 +314,46 @@ function wp_default_scripts( &$scripts ) {
                        'published' => __('Published'),
                        'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
                ) );
                        'published' => __('Published'),
                        'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
                ) );
-               $scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20081210' );
-               $scripts->add( 'comment', '/wp-admin/js/comment.js', array('jquery'), '20081210' );
+
+               $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20090506' );
+               $scripts->add_data( 'link', 'group', 1 );
+
+               $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20090102' );
+               $scripts->add_data( 'comment', 'group', 1 );
                $scripts->localize( 'comment', 'commentL10n', array(
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
                        'submittedOn' => __('Submitted on:'),
                        'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};'
                ) );
                $scripts->localize( 'comment', 'commentL10n', array(
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
                        'submittedOn' => __('Submitted on:'),
                        'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};'
                ) );
-               $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20081210' );
-               $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20081210' );
 
 
-               $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20081210' );
-               $scripts->localize( 'admin-widgets', 'widgetsL10n', array(
-                       'add' => __('Add'),
-                       'edit' => __('Edit'),
-                       'cancel' => __('Cancel'),
-                       'lameReminder' => __('Remember to click the "Save Changes" button at the bottom of the Current Widgets column after you\'re all done!'),
-                       'lamerReminder' => __("You're about to leave without having saved your changes!"),
-                       'l10n_print_after' => 'try{convertEntities(widgetsL10n);}catch(e){};'
-               ));
+               $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090516' );
+
+               $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090114' );
+               $scripts->add_data( 'media-upload', 'group', 1 );
 
 
-               $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20081210' );
+               $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20090601' );
+               $scripts->add_data( 'admin-widgets', 'group', 1 );
+
+               $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' );
+               $scripts->add_data( 'word-count', 'group', 1 );
                $scripts->localize( 'word-count', 'wordCountL10n', array(
                        'count' => __('Word count: %d'),
                        'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
                ));
 
                $scripts->localize( 'word-count', 'wordCountL10n', array(
                        'count' => __('Word count: %d'),
                        'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
                ));
 
-               $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20081210' );
+               $scripts->add( 'wp-gears', "/wp-admin/js/wp-gears$suffix.js", false, '20090102' );
                $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
                        'updateCompleted' => __('Update completed.'),
                        'error' => __('Error:'),
                        'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
                ));
 
                $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
                        'updateCompleted' => __('Update completed.'),
                        'error' => __('Error:'),
                        'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
                ));
 
-               $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20081210' );
+               $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090319' );
+               $scripts->add_data( 'theme-preview', 'group', 1 );
 
 
-               $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081210' );
+               $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090125' );
+               $scripts->add_data( 'inline-edit-post', 'group', 1 );
                $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
                        'error' => __('Error while saving the changes.'),
                        'ntdeltitle' => __('Remove From Bulk Edit'),
                $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
                        'error' => __('Error while saving the changes.'),
                        'ntdeltitle' => __('Remove From Bulk Edit'),
@@ -270,13 +361,15 @@ function wp_default_scripts( &$scripts ) {
                        'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
                ) );
 
                        'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
                ) );
 
-               $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081210' );
+               $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery-form' ), '20090211' );
+               $scripts->add_data( 'inline-edit-tax', 'group', 1 );
                $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
                        'error' => __('Error while saving the changes.'),
                        'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
                ) );
 
                $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
                        'error' => __('Error while saving the changes.'),
                        'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
                ) );
 
-               $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20081210' );
+               $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery' ), '20090520' );
+               $scripts->add_data( 'plugin-install', 'group', 1 );
                $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
                        'plugin_information' => __('Plugin Information:'),
                        'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};'
                $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
                        'plugin_information' => __('Plugin Information:'),
                        'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};'
@@ -284,10 +377,17 @@ function wp_default_scripts( &$scripts ) {
 
                $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
 
 
                $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
 
-               $scripts->add( 'dashboard', '/wp-admin/js/dashboard.js', array( 'jquery', 'admin-comments', 'postbox' ), '20081210' );
+               $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090201' );
+               $scripts->add_data( 'dashboard', 'group', 1 );
+
+               $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' );
+               $scripts->add_data( 'hoverIntent', 'group', 1 );
 
 
-               $scripts->add( 'hoverIntent', '/wp-includes/js/hoverIntent.js', array('jquery'), '20081210' );
+               $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20090415' );
+               $scripts->add_data( 'media', 'group', 1 );
 
 
+               $scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' );
+               $scripts->add_data( 'codepress', 'group', 1 );
        }
 }
 
        }
 }
 
@@ -311,35 +411,46 @@ function wp_default_styles( &$styles ) {
        // then it assigns $guess_url to wp_guess_url(). Strange format, but it works.
        if ( ! $guessurl = site_url() )
                $guessurl = wp_guess_url();
        // then it assigns $guess_url to wp_guess_url(). Strange format, but it works.
        if ( ! $guessurl = site_url() )
                $guessurl = wp_guess_url();
+
        $styles->base_url = $guessurl;
        $styles->base_url = $guessurl;
+       $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
        $styles->default_version = get_bloginfo( 'version' );
        $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
        $styles->default_version = get_bloginfo( 'version' );
        $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
+       $styles->default_dirs = array('/wp-admin/');
 
        $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
 
 
        $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
 
-       $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081210' );
+       // all colors stylesheets need to have the same query strings (cache manifest compat)
+       $colors_version = '20090610';
+
+       $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090610' );
        $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
 
        $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
 
-       $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20081210' );
-       $styles->add_data( 'ie', 'conditional', 'gte IE 6' );
+       $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090514' );
+       $styles->add_data( 'ie', 'conditional', 'lte IE 7' );
 
 
-       $styles->add( 'colors', true, array(), '20081210' ); // Register "meta" stylesheet for admin colors
-       $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), '20081210'); // for login.php.  Is there a better way?
+       // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
+       $styles->add( 'colors', true, array(), $colors_version );
+       
+       // do not refer to these directly, the right one is queued by the above "meta" colors handle
+       $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), $colors_version);
        $styles->add_data( 'colors-fresh', 'rtl', true );
        $styles->add_data( 'colors-fresh', 'rtl', true );
-       $styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), '20081210');
+       $styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), $colors_version);
        $styles->add_data( 'colors-classic', 'rtl', true );
 
        $styles->add_data( 'colors-classic', 'rtl', true );
 
-       $styles->add( 'global', '/wp-admin/css/global.css', array(), '20081210' );
-       $styles->add( 'media', '/wp-admin/css/media.css', array(), '20081210' );
-       $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20081210' );
-       $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20081210' );
-       $styles->add( 'install', '/wp-admin/css/install.css', array(), '20081210' );
-       $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20081210' );
-       $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20081210' );
-       $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20081210' );
-       $styles->add( 'login', '/wp-admin/css/login.css', array(), '20081210' );
-       $styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20081210' );
+       $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090514' );
+       $styles->add( 'media', '/wp-admin/css/media.css', array(), '20090516' );
+       $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090603' );
+       $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090514' );
+       $styles->add( 'install', '/wp-admin/css/install.css', array(), '20090514' );
+       $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090514' );
+       $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20090514' );
+       $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
+       $styles->add( 'login', '/wp-admin/css/login.css', array(), '20090514' );
+       $styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20090514' );
+       $styles->add( 'theme-install', '/wp-admin/css/theme-install.css', array(), '20090610' );
        $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
        $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
+       $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
 
        foreach ( $rtl_styles as $rtl_style )
                $styles->add_data( $rtl_style, 'rtl', true );
 
        foreach ( $rtl_styles as $rtl_style )
                $styles->add_data( $rtl_style, 'rtl', true );
@@ -354,10 +465,10 @@ function wp_default_styles( &$styles ) {
  * @return array Reordered array, if needed.
  */
 function wp_prototype_before_jquery( $js_array ) {
  * @return array Reordered array, if needed.
  */
 function wp_prototype_before_jquery( $js_array ) {
-       if ( false === $jquery = array_search( 'jquery', $js_array ) )
+       if ( false === $jquery = array_search( 'jquery', $js_array, true ) )
                return $js_array;
 
                return $js_array;
 
-       if ( false === $prototype = array_search( 'prototype', $js_array ) )
+       if ( false === $prototype = array_search( 'prototype', $js_array, true ) )
                return $js_array;
 
        if ( $prototype < $jquery )
                return $js_array;
 
        if ( $prototype < $jquery )
@@ -378,7 +489,6 @@ function wp_prototype_before_jquery( $js_array ) {
  * @since 2.5.0
  */
 function wp_just_in_time_script_localization() {
  * @since 2.5.0
  */
 function wp_just_in_time_script_localization() {
-       global $current_user;
 
        wp_localize_script( 'autosave', 'autosaveL10n', array(
                'autosaveInterval' => AUTOSAVE_INTERVAL,
 
        wp_localize_script( 'autosave', 'autosaveL10n', array(
                'autosaveInterval' => AUTOSAVE_INTERVAL,
@@ -386,15 +496,9 @@ function wp_just_in_time_script_localization() {
                'previewPostText' => __('Preview this Post'),
                'requestFile' => admin_url('admin-ajax.php'),
                'savingText' => __('Saving Draft&#8230;'),
                'previewPostText' => __('Preview this Post'),
                'requestFile' => admin_url('admin-ajax.php'),
                'savingText' => __('Saving Draft&#8230;'),
+               'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
                'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};'
        ) );
                'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};'
        ) );
-
-       $userid = isset($current_user) ? $current_user->ID : 0;
-       wp_localize_script( 'common', 'userSettings', array(
-               'url' => SITECOOKIEPATH,
-               'uid' => $userid,
-               'time' => time()
-       ) );
 }
 
 /**
 }
 
 /**
@@ -439,6 +543,182 @@ function wp_style_loader_src( $src, $handle ) {
        return $src;
 }
 
        return $src;
 }
 
+/**
+ * Prints the script queue in the HTML head on admin pages.
+ *
+ * Postpones the scripts that were queued for the footer.
+ * print_footer_scripts() is called in the footer to print these scripts.
+ *
+ * @since 2.8
+ * @see wp_print_scripts()
+ */
+function print_head_scripts() {
+       global $wp_scripts, $concatenate_scripts;
+
+       if ( ! did_action('wp_print_scripts') )
+               do_action('wp_print_scripts');
+
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               $wp_scripts = new WP_Scripts();
+
+       script_concat_settings();
+       $wp_scripts->do_concat = $concatenate_scripts;
+       $wp_scripts->do_head_items();
+
+       if ( apply_filters('print_head_scripts', true) )
+               _print_scripts();
+
+       $wp_scripts->reset();
+       return $wp_scripts->done;
+}
+
+/**
+ * Prints the scripts that were queued for the footer on admin pages.
+ *
+ * @since 2.8
+ */
+function print_footer_scripts() {
+       global $wp_scripts, $concatenate_scripts;
+
+       if ( ! did_action('wp_print_footer_scripts') )
+               do_action('wp_print_footer_scripts');
+
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               return array(); // No need to run if not instantiated.
+
+       script_concat_settings();
+       $wp_scripts->do_concat = $concatenate_scripts;
+       $wp_scripts->do_footer_items();
+
+       if ( apply_filters('print_footer_scripts', true) )
+               _print_scripts();
+
+       $wp_scripts->reset();
+       return $wp_scripts->done;
+}
+
+function _print_scripts() {
+       global $wp_scripts, $compress_scripts;
+
+       $zip = $compress_scripts ? 1 : 0;
+       if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
+               $zip = 'gzip';
+
+       if ( !empty($wp_scripts->concat) ) {
+
+               if ( !empty($wp_scripts->print_code) ) {
+                       echo "<script type='text/javascript'>\n";
+                       echo "/* <![CDATA[ */\n";
+                       echo $wp_scripts->print_code;
+                       echo "/* ]]> */\n";
+                       echo "</script>\n";
+               }
+
+               $ver = md5("$wp_scripts->concat_version");
+               $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . trim($wp_scripts->concat, ', ') . "&ver=$ver";
+               echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
+       }
+
+       if ( !empty($wp_scripts->print_html) )
+               echo $wp_scripts->print_html;
+}
+
+/**
+ * Prints the script queue in the HTML head on the front end.
+ *
+ * Postpones the scripts that were queued for the footer.
+ * wp_print_footer_scripts() is called in the footer to print these scripts.
+ *
+ * @since 2.8
+ */
+function wp_print_head_scripts() {
+       if ( ! did_action('wp_print_scripts') )
+               do_action('wp_print_scripts');
+
+       global $wp_scripts;
+
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               return array(); // no need to run if nothing is queued
+
+       return print_head_scripts();
+}
+
+/**
+ * Prints the scripts that were queued for the footer on the front end.
+ *
+ * @since 2.8
+ */
+function wp_print_footer_scripts() {
+       return print_footer_scripts();
+}
+
+/**
+ * Wrapper for do_action('wp_enqueue_scripts')
+ *
+ * Allows plugins to queue scripts for the front end using wp_enqueue_script().
+ * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available.
+ *
+ * @since 2.8
+ */
+function wp_enqueue_scripts() {
+       do_action('wp_enqueue_scripts');
+}
+
+function print_admin_styles() {
+       global $wp_styles, $concatenate_scripts, $compress_css;
+
+       if ( !is_a($wp_styles, 'WP_Styles') )
+               $wp_styles = new WP_Styles();
+
+       script_concat_settings();
+       $wp_styles->do_concat = $concatenate_scripts;
+       $zip = $compress_css ? 1 : 0;
+       if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
+               $zip = 'gzip';
+
+       $wp_styles->do_items(false);
+
+       if ( apply_filters('print_admin_styles', true) ) {
+               if ( !empty($wp_styles->concat) ) {
+                       $dir = $wp_styles->text_direction;
+                       $ver = md5("$wp_styles->concat_version{$dir}");
+                       $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . "&ver=$ver";
+                       echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
+               }
+
+               if ( !empty($wp_styles->print_html) )
+                       echo $wp_styles->print_html;
+       }
+
+       $wp_styles->do_concat = false;
+       $wp_styles->concat = $wp_styles->concat_version = $wp_styles->print_html = '';
+       return $wp_styles->done;
+}
+
+function script_concat_settings() {
+       global $concatenate_scripts, $compress_scripts, $compress_css;
+
+       $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') );
+
+       if ( ! isset($concatenate_scripts) ) {
+               $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
+               if ( ! is_admin() || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
+                       $concatenate_scripts = false;
+       }
+
+       if ( ! isset($compress_scripts) ) {
+               $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
+               if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
+                       $compress_scripts = false;
+       }
+
+       if ( ! isset($compress_css) ) {
+               $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true;
+               if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
+                       $compress_css = false;
+       }
+}
+
 add_action( 'wp_default_scripts', 'wp_default_scripts' );
 add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
 add_action( 'wp_default_scripts', 'wp_default_scripts' );
 add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
index c1c6862ba2b5b663ddf9f7912c4382c43ef76ce6..6ced181603cf703ff655cca1b6f656010dd2780a 100644 (file)
@@ -157,6 +157,14 @@ function do_shortcode($content) {
  * The regular expression combines the shortcode tags in the regular expression
  * in a regex class.
  *
  * The regular expression combines the shortcode tags in the regular expression
  * in a regex class.
  *
+ * The regular expresion contains 6 different sub matches to help with parsing.
+ *
+ * 1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]]
+ * 2 - The shortcode name
+ * 3 - The shortcode argument list
+ * 4 - The self closing /
+ * 5 - The content of a shortcode when it wraps some content.
+ *
  * @since 2.5
  * @uses $shortcode_tags
  *
  * @since 2.5
  * @uses $shortcode_tags
  *
@@ -167,11 +175,12 @@ function get_shortcode_regex() {
        $tagnames = array_keys($shortcode_tags);
        $tagregexp = join( '|', array_map('preg_quote', $tagnames) );
 
        $tagnames = array_keys($shortcode_tags);
        $tagregexp = join( '|', array_map('preg_quote', $tagnames) );
 
-       return '\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\1\])?';
+       return '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)';
 }
 
 /**
  * Regular Expression callable for do_shortcode() for calling shortcode hook.
 }
 
 /**
  * Regular Expression callable for do_shortcode() for calling shortcode hook.
+ * @see get_shortcode_regex for details of the match array contents.
  *
  * @since 2.5
  * @access private
  *
  * @since 2.5
  * @access private
@@ -183,15 +192,20 @@ function get_shortcode_regex() {
 function do_shortcode_tag($m) {
        global $shortcode_tags;
 
 function do_shortcode_tag($m) {
        global $shortcode_tags;
 
-       $tag = $m[1];
-       $attr = shortcode_parse_atts($m[2]);
+       // allow [[foo]] syntax for escaping a tag
+       if ($m[1] == '[' && $m[6] == ']') {
+               return substr($m[0], 1, -1);
+       }
+
+       $tag = $m[2];
+       $attr = shortcode_parse_atts($m[3]);
 
 
-       if ( isset($m[4]) ) {
+       if ( isset($m[5]) ) {
                // enclosing tag - extra parameter
                // enclosing tag - extra parameter
-               return call_user_func($shortcode_tags[$tag], $attr, $m[4], $tag);
+               return $m[1] . call_user_func($shortcode_tags[$tag], $attr, $m[5], $m[2]) . $m[6];
        } else {
                // self-closing tag
        } else {
                // self-closing tag
-               return call_user_func($shortcode_tags[$tag], $attr, NULL, $tag);
+               return $m[1] . call_user_func($shortcode_tags[$tag], $attr, NULL, $m[2]) . $m[6];
        }
 }
 
        }
 }
 
index 12fd8b7cb823ba45679e258f4b86615f76a3648b..12f86a37494fda6d0d4d1c23a7d95ca4934daa85 100644 (file)
 //
 
 /**
 //
 
 /**
- * Default Taxonomy Objects
- * @since 2.3.0
- * @global array $wp_taxonomies
+ * Creates the initial taxonomies when 'init' action is fired.
  */
  */
-$wp_taxonomies = array();
-$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count');
-$wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count');
-$wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);
+function create_initial_taxonomies() {
+       register_taxonomy( 'category', 'post', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
+       register_taxonomy( 'post_tag', 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags'), 'query_var' => false, 'rewrite' => false) ) ;
+       register_taxonomy( 'link_category', 'link', array('hierarchical' => false, 'label' => __('Categories'), 'query_var' => false, 'rewrite' => false) ) ;
+}
+add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
 
 /**
  * Return all of the taxonomy names that are of $object_type.
 
 /**
  * Return all of the taxonomy names that are of $object_type.
@@ -167,6 +167,9 @@ function is_taxonomy_hierarchical($taxonomy) {
 function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
        global $wp_taxonomies, $wp_rewrite, $wp;
 
 function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
        global $wp_taxonomies, $wp_rewrite, $wp;
 
+       if (!is_array($wp_taxonomies))
+               $wp_taxonomies = array();
+
        $defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
        $args = wp_parse_args($args, $defaults);
 
        $defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
        $args = wp_parse_args($args, $defaults);
 
@@ -406,10 +409,10 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
 }
 
 /**
 }
 
 /**
- * Merge all term children into a single array.
+ * Merge all term children into a single array of their IDs.
  *
  * This recursive function will merge all of the children of $term into the same
  *
  * This recursive function will merge all of the children of $term into the same
- * array. Only useful for taxonomies which are hierarchical.
+ * array of term IDs. Only useful for taxonomies which are hierarchical.
  *
  * Will return an empty array if $term does not exist in $taxonomy.
  *
  *
  * Will return an empty array if $term does not exist in $taxonomy.
  *
@@ -421,22 +424,24 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
  * @uses _get_term_hierarchy()
  * @uses get_term_children() Used to get the children of both $taxonomy and the parent $term
  *
  * @uses _get_term_hierarchy()
  * @uses get_term_children() Used to get the children of both $taxonomy and the parent $term
  *
- * @param string $term Name of Term to get children
+ * @param string $term ID of Term to get children
  * @param string $taxonomy Taxonomy Name
  * @return array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist
  */
  * @param string $taxonomy Taxonomy Name
  * @return array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist
  */
-function get_term_children( $term, $taxonomy ) {
+function get_term_children( $term_id, $taxonomy ) {
        if ( ! is_taxonomy($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
 
        if ( ! is_taxonomy($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
 
+       $term_id = intval( $term_id );
+
        $terms = _get_term_hierarchy($taxonomy);
 
        $terms = _get_term_hierarchy($taxonomy);
 
-       if ( ! isset($terms[$term]) )
+       if ( ! isset($terms[$term_id]) )
                return array();
 
                return array();
 
-       $children = $terms[$term];
+       $children = $terms[$term_id];
 
 
-       foreach ( (array) $terms[$term] as $child ) {
+       foreach ( (array) $terms[$term_id] as $child ) {
                if ( isset($terms[$child]) )
                        $children = array_merge($children, get_term_children($child, $taxonomy));
        }
                if ( isset($terms[$child]) )
                        $children = array_merge($children, get_term_children($child, $taxonomy));
        }
@@ -520,10 +525,17 @@ function get_term_to_edit( $id, $taxonomy ) {
  * The 'list_terms_exclusions' filter passes the compiled exclusions along with
  * the $args.
  *
  * The 'list_terms_exclusions' filter passes the compiled exclusions along with
  * the $args.
  *
+ * The 'get_terms_orderby' filter passes the ORDER BY clause for the query
+ * along with the $args array.
+
+ * The 'get_terms_fields' filter passes the fields for the SELECT query
+ * along with the $args array.
+ *
  * The list of arguments that $args can contain, which will overwrite the defaults:
  *
  * The list of arguments that $args can contain, which will overwrite the defaults:
  *
- * orderby - Default is 'name'. Can be name, count, or nothing (will use
- * term_id).
+ * orderby - Default is 'name'. Can be name, count, term_group, slug or nothing
+ * (will use term_id), Passing a custom value other than these will cause it to
+ * order based on the custom value.
  *
  * order - Default is ASC. Can use DESC.
  *
  *
  * order - Default is ASC. Can use DESC.
  *
@@ -535,7 +547,7 @@ function get_term_to_edit( $id, $taxonomy ) {
  * 'exclude' is ignored.
  *
  * exclude_tree - A comma- or space-delimited string of term ids to exclude
  * 'exclude' is ignored.
  *
  * exclude_tree - A comma- or space-delimited string of term ids to exclude
- * from the return array, along with all of their descendant terms according to 
+ * from the return array, along with all of their descendant terms according to
  * the primary taxonomy.  If 'include' is non-empty, 'exclude_tree' is ignored.
  *
  * include - Default is an empty string.  A comma- or space-delimited string
  * the primary taxonomy.  If 'include' is non-empty, 'exclude_tree' is ignored.
  *
  * include - Default is an empty string.  A comma- or space-delimited string
@@ -601,8 +613,10 @@ function &get_terms($taxonomies, $args = '') {
        }
 
        foreach ( (array) $taxonomies as $taxonomy ) {
        }
 
        foreach ( (array) $taxonomies as $taxonomy ) {
-               if ( ! is_taxonomy($taxonomy) )
-                       return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+               if ( ! is_taxonomy($taxonomy) ) {
+                       $error = & new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+                       return $error;
+               }
        }
 
        $in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
        }
 
        $in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
@@ -616,7 +630,7 @@ function &get_terms($taxonomies, $args = '') {
        $args['number'] = absint( $args['number'] );
        $args['offset'] = absint( $args['offset'] );
        if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) ||
        $args['number'] = absint( $args['number'] );
        $args['offset'] = absint( $args['offset'] );
        if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) ||
-               '' != $args['parent'] ) {
+               '' !== $args['parent'] ) {
                $args['child_of'] = 0;
                $args['hierarchical'] = false;
                $args['pad_counts'] = false;
                $args['child_of'] = 0;
                $args['hierarchical'] = false;
                $args['pad_counts'] = false;
@@ -651,23 +665,26 @@ function &get_terms($taxonomies, $args = '') {
                wp_cache_set('last_changed', $last_changed, 'terms');
        }
        $cache_key = "get_terms:$key:$last_changed";
                wp_cache_set('last_changed', $last_changed, 'terms');
        }
        $cache_key = "get_terms:$key:$last_changed";
-
-       if ( $cache = wp_cache_get( $cache_key, 'terms' ) ) {
-               $terms = apply_filters('get_terms', $cache, $taxonomies, $args);
-               return $terms;
+       $cache = wp_cache_get( $cache_key, 'terms' );
+       if ( false !== $cache ) {
+               $cache = apply_filters('get_terms', $cache, $taxonomies, $args);
+               return $cache;
        }
 
        }
 
-       if ( 'count' == $orderby )
+       $_orderby = strtolower($orderby);
+       if ( 'count' == $_orderby )
                $orderby = 'tt.count';
                $orderby = 'tt.count';
-       else if ( 'name' == $orderby )
+       else if ( 'name' == $_orderby )
                $orderby = 't.name';
                $orderby = 't.name';
-       else if ( 'slug' == $orderby )
+       else if ( 'slug' == $_orderby )
                $orderby = 't.slug';
                $orderby = 't.slug';
-       else if ( 'term_group' == $orderby )
+       else if ( 'term_group' == $_orderby )
                $orderby = 't.term_group';
                $orderby = 't.term_group';
-       else
+       elseif ( empty($_orderby) || 'id' == $_orderby )
                $orderby = 't.term_id';
 
                $orderby = 't.term_id';
 
+       $orderby = apply_filters( 'get_terms_orderby', $orderby, $args );
+
        $where = '';
        $inclusions = '';
        if ( !empty($include) ) {
        $where = '';
        $inclusions = '';
        if ( !empty($include) ) {
@@ -692,7 +709,7 @@ function &get_terms($taxonomies, $args = '') {
        if ( ! empty( $exclude_tree ) ) {
                $excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
                foreach( (array) $excluded_trunks as $extrunk ) {
        if ( ! empty( $exclude_tree ) ) {
                $excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
                foreach( (array) $excluded_trunks as $extrunk ) {
-                       $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids'));       
+                       $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids'));
                        $excluded_children[] = $extrunk;
                        foreach( (array) $excluded_children as $exterm ) {
                                if ( empty($exclusions) )
                        $excluded_children[] = $extrunk;
                        foreach( (array) $excluded_children as $exterm ) {
                                if ( empty($exclusions) )
@@ -728,7 +745,7 @@ function &get_terms($taxonomies, $args = '') {
        if ( !empty($name__like) )
                $where .= " AND t.name LIKE '{$name__like}%'";
 
        if ( !empty($name__like) )
                $where .= " AND t.name LIKE '{$name__like}%'";
 
-       if ( '' != $parent ) {
+       if ( '' !== $parent ) {
                $parent = (int) $parent;
                $where .= " AND tt.parent = '$parent'";
        }
                $parent = (int) $parent;
                $where .= " AND tt.parent = '$parent'";
        }
@@ -736,8 +753,8 @@ function &get_terms($taxonomies, $args = '') {
        if ( $hide_empty && !$hierarchical )
                $where .= ' AND tt.count > 0';
 
        if ( $hide_empty && !$hierarchical )
                $where .= ' AND tt.count > 0';
 
-       // don't limit the query results when we have to descend the family tree 
-       if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' == $parent ) {
+       // don't limit the query results when we have to descend the family tree
+       if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' === $parent ) {
                if( $offset )
                        $limit = 'LIMIT ' . $offset . ',' . $number;
                else
                if( $offset )
                        $limit = 'LIMIT ' . $offset . ',' . $number;
                else
@@ -751,13 +768,14 @@ function &get_terms($taxonomies, $args = '') {
                $where .= " AND (t.name LIKE '%$search%')";
        }
 
                $where .= " AND (t.name LIKE '%$search%')";
        }
 
-       $select_this = '';
+       $selects = array();
        if ( 'all' == $fields )
        if ( 'all' == $fields )
-               $select_this = 't.*, tt.*';
+               $selects = array('t.*', 'tt.*');
        else if ( 'ids' == $fields )
        else if ( 'ids' == $fields )
-               $select_this = 't.term_id, tt.parent, tt.count';
+               $selects = array('t.term_id', 'tt.parent', 'tt.count');
        else if ( 'names' == $fields )
        else if ( 'names' == $fields )
-               $select_this = 't.term_id, tt.parent, tt.count, t.name';
+               $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
+        $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
 
        $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit";
 
 
        $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit";
 
@@ -767,8 +785,7 @@ function &get_terms($taxonomies, $args = '') {
        }
 
        if ( empty($terms) ) {
        }
 
        if ( empty($terms) ) {
-               $cache[ $key ] = array();
-               wp_cache_set( 'get_terms', $cache, 'terms' );
+               wp_cache_add( $cache_key, array(), 'terms' );
                $terms = apply_filters('get_terms', array(), $taxonomies, $args);
                return $terms;
        }
                $terms = apply_filters('get_terms', array(), $taxonomies, $args);
                return $terms;
        }
@@ -834,9 +851,10 @@ function &get_terms($taxonomies, $args = '') {
  *
  * @param int|string $term The term to check
  * @param string $taxonomy The taxonomy name to use
  *
  * @param int|string $term The term to check
  * @param string $taxonomy The taxonomy name to use
+ * @param int $parent ID of parent term under which to confine the exists search.
  * @return mixed Get the term id or Term Object, if exists.
  */
  * @return mixed Get the term id or Term Object, if exists.
  */
-function is_term($term, $taxonomy = '') {
+function is_term($term, $taxonomy = '', $parent = 0) {
        global $wpdb;
 
        $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
        global $wpdb;
 
        $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
@@ -852,23 +870,37 @@ function is_term($term, $taxonomy = '') {
                        return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) );
        }
 
                        return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) );
        }
 
+       $term = trim( stripslashes( $term ) );
+
        if ( '' === $slug = sanitize_title($term) )
                return 0;
 
        $where = 't.slug = %s';
        $else_where = 't.name = %s';
        if ( '' === $slug = sanitize_title($term) )
                return 0;
 
        $where = 't.slug = %s';
        $else_where = 't.name = %s';
-
+       $where_fields = array($slug);
+       $else_where_fields = array($term);
        if ( !empty($taxonomy) ) {
        if ( !empty($taxonomy) ) {
-               if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $slug, $taxonomy), ARRAY_A) )
+               $parent = (int) $parent;
+               if ( $parent > 0 ) {
+                       $where_fields[] = $parent;
+                       $else_where_fields[] = $parent;
+                       $where .= ' AND tt.parent = %d';
+                       $else_where .= ' AND tt.parent = %d';
+               }
+
+               $where_fields[] = $taxonomy;
+               $else_where_fields[] = $taxonomy;
+
+               if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A) )
                        return $result;
 
                        return $result;
 
-               return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
+               return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $else_where_fields), ARRAY_A);
        }
 
        }
 
-       if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $slug) ) )
+       if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields) ) )
                return $result;
 
                return $result;
 
-       return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $term) );
+       return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $else_where_fields) );
 }
 
 /**
 }
 
 /**
@@ -964,7 +996,7 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
                if ( 'description' == $field )
                        $value = format_to_edit($value);
                else
                if ( 'description' == $field )
                        $value = format_to_edit($value);
                else
-                       $value = attribute_escape($value);
+                       $value = esc_attr($value);
        } else if ( 'db' == $context ) {
                $value = apply_filters("pre_term_$field", $value, $taxonomy);
                $value = apply_filters("pre_${taxonomy}_$field", $value);
        } else if ( 'db' == $context ) {
                $value = apply_filters("pre_term_$field", $value, $taxonomy);
                $value = apply_filters("pre_${taxonomy}_$field", $value);
@@ -982,9 +1014,9 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
        }
 
        if ( 'attribute' == $context )
        }
 
        if ( 'attribute' == $context )
-               $value = attribute_escape($value);
+               $value = esc_attr($value);
        else if ( 'js' == $context )
        else if ( 'js' == $context )
-               $value = js_escape($value);
+               $value = esc_js($value);
 
        return $value;
 }
 
        return $value;
 }
@@ -1060,6 +1092,8 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
  * The $args 'default' will only override the terms found, if there is only one
  * term found. Any other and the found terms are used.
  *
  * The $args 'default' will only override the terms found, if there is only one
  * term found. Any other and the found terms are used.
  *
+ * The $args 'force_default' will force the term supplied as default to be
+ * assigned even if the object was not going to be termless
  * @package WordPress
  * @subpackage Taxonomy
  * @since 2.3.0
  * @package WordPress
  * @subpackage Taxonomy
  * @since 2.3.0
@@ -1109,11 +1143,14 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
        $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
 
        foreach ( (array) $objects as $object ) {
        $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
 
        foreach ( (array) $objects as $object ) {
-               $terms = wp_get_object_terms($object, $taxonomy, 'fields=ids');
-               if ( 1 == count($terms) && isset($default) )
+               $terms = wp_get_object_terms($object, $taxonomy, array('fields' => 'ids', 'orderby' => 'none'));
+               if ( 1 == count($terms) && isset($default) ) {
                        $terms = array($default);
                        $terms = array($default);
-               else
+               } else {
                        $terms = array_diff($terms, array($term));
                        $terms = array_diff($terms, array($term));
+                       if (isset($default) && isset($force_default) && $force_default)
+                               $terms = array_merge($terms, array($default));
+               }
                $terms = array_map('intval', $terms);
                wp_set_object_terms($object, $terms, $taxonomy);
        }
                $terms = array_map('intval', $terms);
                wp_set_object_terms($object, $terms, $taxonomy);
        }
@@ -1209,8 +1246,19 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
                $orderby = 't.term_group';
        else if ( 'term_order' == $orderby )
                $orderby = 'tr.term_order';
                $orderby = 't.term_group';
        else if ( 'term_order' == $orderby )
                $orderby = 'tr.term_order';
-       else
+       else if ( 'none' == $orderby ) {
+               $orderby = '';
+               $order = '';
+       } else {
                $orderby = 't.term_id';
                $orderby = 't.term_id';
+       }
+
+       // tt_ids queries can only be none or tr.term_taxonomy_id
+       if ( ('tt_ids' == $fields) && !empty($orderby) )
+               $orderby = 'tr.term_taxonomy_id';
+
+       if ( !empty($orderby) )
+               $orderby = "ORDER BY $orderby";
 
        $taxonomies = "'" . implode("', '", $taxonomies) . "'";
        $object_ids = implode(', ', $object_ids);
 
        $taxonomies = "'" . implode("', '", $taxonomies) . "'";
        $object_ids = implode(', ', $object_ids);
@@ -1225,7 +1273,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
        else if ( 'all_with_object_id' == $fields )
                $select_this = 't.*, tt.*, tr.object_id';
 
        else if ( 'all_with_object_id' == $fields )
                $select_this = 't.*, tt.*, tr.object_id';
 
-       $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) ORDER BY $orderby $order";
+       $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order";
 
        if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
                $terms = array_merge($terms, $wpdb->get_results($query));
 
        if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
                $terms = array_merge($terms, $wpdb->get_results($query));
@@ -1233,13 +1281,13 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
        } else if ( 'ids' == $fields || 'names' == $fields ) {
                $terms = array_merge($terms, $wpdb->get_col($query));
        } else if ( 'tt_ids' == $fields ) {
        } else if ( 'ids' == $fields || 'names' == $fields ) {
                $terms = array_merge($terms, $wpdb->get_col($query));
        } else if ( 'tt_ids' == $fields ) {
-               $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) ORDER BY tr.term_taxonomy_id $order");
+               $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order");
        }
 
        if ( ! $terms )
        }
 
        if ( ! $terms )
-               return array();
+               $terms = array();
 
 
-       return $terms;
+       return apply_filters('wp_get_object_terms', $terms, $object_ids, $taxonomies, $args);
 }
 
 /**
 }
 
 /**
@@ -1329,7 +1377,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
                } else {
                        // The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
                        $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
                } else {
                        // The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
                        $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
-                       $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $alias->term_id ) );
+                       $wpdb->update($wpdb->terms, compact('term_group'), array('term_id' => $alias->term_id) );
                }
        }
 
                }
        }
 
@@ -1389,7 +1437,8 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
  * @uses $wpdb
  *
  * @param int $object_id The object to relate to.
  * @uses $wpdb
  *
  * @param int $object_id The object to relate to.
- * @param array|int|string $term The slug or id of the term.
+ * @param array|int|string $term The slug or id of the term, will replace all existing
+ * related terms in this taxonomy.
  * @param array|string $taxonomy The context in which to relate the term to the object.
  * @param bool $append If false will delete difference of terms.
  * @return array|WP_Error Affected Term IDs
  * @param array|string $taxonomy The context in which to relate the term to the object.
  * @param bool $append If false will delete difference of terms.
  * @return array|WP_Error Affected Term IDs
@@ -1406,7 +1455,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
                $terms = array($terms);
 
        if ( ! $append )
                $terms = array($terms);
 
        if ( ! $append )
-               $old_tt_ids =  wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
+               $old_tt_ids =  wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids', 'orderby' => 'none'));
 
        $tt_ids = array();
        $term_ids = array();
 
        $tt_ids = array();
        $term_ids = array();
@@ -1451,6 +1500,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
                        $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
        }
 
                        $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
        }
 
+       do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append);
        return $tt_ids;
 }
 
        return $tt_ids;
 }
 
@@ -1545,22 +1595,25 @@ function wp_unique_term_slug($slug, $term) {
  * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term
  *     id and taxonomy id.
  *
  * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term
  *     id and taxonomy id.
  *
- * @param int $term The ID of the term
+ * @param int $term_id The ID of the term
  * @param string $taxonomy The context in which to relate the term to the object.
  * @param array|string $args Overwrite term field values
  * @return array|WP_Error Returns Term ID and Taxonomy Term ID
  */
  * @param string $taxonomy The context in which to relate the term to the object.
  * @param array|string $args Overwrite term field values
  * @return array|WP_Error Returns Term ID and Taxonomy Term ID
  */
-function wp_update_term( $term, $taxonomy, $args = array() ) {
+function wp_update_term( $term_id, $taxonomy, $args = array() ) {
        global $wpdb;
 
        if ( ! is_taxonomy($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
 
        global $wpdb;
 
        if ( ! is_taxonomy($taxonomy) )
                return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
 
-       $term_id = (int) $term;
+       $term_id = (int) $term_id;
 
        // First, get all of the original args
        $term = get_term ($term_id, $taxonomy, ARRAY_A);
 
 
        // First, get all of the original args
        $term = get_term ($term_id, $taxonomy, ARRAY_A);
 
+       if ( is_wp_error( $term ) )
+               return $term;
+
        // Escape data pulled from DB.
        $term = add_magic_quotes($term);
 
        // Escape data pulled from DB.
        $term = add_magic_quotes($term);
 
@@ -1605,7 +1658,7 @@ function wp_update_term( $term, $taxonomy, $args = array() ) {
                if ( $empty_slug || ( $parent != $term->parent) )
                        $slug = wp_unique_term_slug($slug, (object) $args);
                else
                if ( $empty_slug || ( $parent != $term->parent) )
                        $slug = wp_unique_term_slug($slug, (object) $args);
                else
-                       return new WP_Error('duplicate_term_slug', sprintf(__('The slug "%s" is already in use by another term'), $slug));
+                       return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
        }
 
        $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) );
        }
 
        $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) );
@@ -1928,7 +1981,7 @@ function update_term_cache($terms, $taxonomy = '') {
 
 
 /**
 
 
 /**
- * Retrieves children of taxonomy.
+ * Retrieves children of taxonomy as Term IDs.
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1939,7 +1992,7 @@ function update_term_cache($terms, $taxonomy = '') {
  *      option. That is the name of the taxonomy, immediately followed by '_children'.
  *
  * @param string $taxonomy Taxonomy Name
  *      option. That is the name of the taxonomy, immediately followed by '_children'.
  *
  * @param string $taxonomy Taxonomy Name
- * @return array Empty if $taxonomy isn't hierarachical or returns children.
+ * @return array Empty if $taxonomy isn't hierarachical or returns children as Term IDs.
  */
 function _get_term_hierarchy($taxonomy) {
        if ( !is_taxonomy_hierarchical($taxonomy) )
  */
 function _get_term_hierarchy($taxonomy) {
        if ( !is_taxonomy_hierarchical($taxonomy) )
@@ -2036,8 +2089,8 @@ function &_get_term_children($term_id, $terms, $taxonomy) {
 function _pad_term_counts(&$terms, $taxonomy) {
        global $wpdb;
 
 function _pad_term_counts(&$terms, $taxonomy) {
        global $wpdb;
 
-       // This function only works for post categories.
-       if ( 'category' != $taxonomy )
+       // This function only works for hierarchical taxonomies like post categories.
+       if ( !is_taxonomy_hierarchical( $taxonomy ) )
                return;
 
        $term_hier = _get_term_hierarchy($taxonomy);
                return;
 
        $term_hier = _get_term_hierarchy($taxonomy);
@@ -2117,14 +2170,6 @@ function _update_post_term_count( $terms ) {
 function get_term_link( $term, $taxonomy ) {
        global $wp_rewrite;
 
 function get_term_link( $term, $taxonomy ) {
        global $wp_rewrite;
 
-       // use legacy functions for core taxonomies until they are fully plugged in
-       if ( $taxonomy == 'category' )
-               return get_category_link($term);
-       if ( $taxonomy == 'post_tag' )
-               return get_tag_link($term);
-
-       $termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
-
        if ( !is_object($term) ) {
                if ( is_int($term) ) {
                        $term = &get_term($term, $taxonomy);
        if ( !is_object($term) ) {
                if ( is_int($term) ) {
                        $term = &get_term($term, $taxonomy);
@@ -2135,6 +2180,14 @@ function get_term_link( $term, $taxonomy ) {
        if ( is_wp_error( $term ) )
                return $term;
 
        if ( is_wp_error( $term ) )
                return $term;
 
+       // use legacy functions for core taxonomies until they are fully plugged in
+       if ( $taxonomy == 'category' )
+               return get_category_link((int) $term->term_id);
+       if ( $taxonomy == 'post_tag' )
+               return get_tag_link((int) $term->term_id);
+
+       $termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
+
        $slug = $term->slug;
 
        if ( empty($termlink) ) {
        $slug = $term->slug;
 
        if ( empty($termlink) ) {
@@ -2223,7 +2276,7 @@ function get_the_taxonomies($post = 0) {
                $links = array();
 
                foreach ( $terms as $term )
                $links = array();
 
                foreach ( $terms as $term )
-                       $links[] = "<a href='" . attribute_escape(get_term_link($term, $taxonomy)) . "'>$term->name</a>";
+                       $links[] = "<a href='" . esc_attr(get_term_link($term, $taxonomy)) . "'>$term->name</a>";
 
                if ( $links )
                        $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
 
                if ( $links )
                        $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);
index 4634075a83d49ee0afe4e479ab0b4fd3d8e29074..9d56a6403d0f8a801276a49c8ef9360f3a509c94 100644 (file)
@@ -179,44 +179,51 @@ function get_theme_data( $theme_file ) {
 
        $theme_data = implode( '', file( $theme_file ) );
        $theme_data = str_replace ( '\r', '\n', $theme_data );
 
        $theme_data = implode( '', file( $theme_file ) );
        $theme_data = str_replace ( '\r', '\n', $theme_data );
-       preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name );
-       preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri );
-       preg_match( '|Description:(.*)$|mi', $theme_data, $description );
+       if ( preg_match( '|Theme Name:(.*)$|mi', $theme_data, $theme_name ) )
+               $name = $theme = wp_kses( _cleanup_header_comment($theme_name[1]), $themes_allowed_tags );
+       else
+               $name = $theme = '';
+
+       if ( preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ) )
+               $theme_uri = esc_url( _cleanup_header_comment($theme_uri[1]) );
+       else
+               $theme_uri = '';
+
+       if ( preg_match( '|Description:(.*)$|mi', $theme_data, $description ) )
+               $description = wptexturize( wp_kses( _cleanup_header_comment($description[1]), $themes_allowed_tags ) );
+       else
+               $description = '';
 
        if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
 
        if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
-               $author_uri = clean_url( trim( $author_uri[1]) );
+               $author_uri = esc_url( _cleanup_header_comment($author_uri[1]) );
        else
                $author_uri = '';
 
        if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
        else
                $author_uri = '';
 
        if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
-               $template = wp_kses( trim( $template[1] ), $themes_allowed_tags );
+               $template = wp_kses( _cleanup_header_comment($template[1]), $themes_allowed_tags );
        else
                $template = '';
 
        if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
        else
                $template = '';
 
        if ( preg_match( '|Version:(.*)|i', $theme_data, $version ) )
-               $version = wp_kses( trim( $version[1] ), $themes_allowed_tags );
+               $version = wp_kses( _cleanup_header_comment($version[1]), $themes_allowed_tags );
        else
                $version = '';
 
        if ( preg_match('|Status:(.*)|i', $theme_data, $status) )
        else
                $version = '';
 
        if ( preg_match('|Status:(.*)|i', $theme_data, $status) )
-               $status = wp_kses( trim( $status[1] ), $themes_allowed_tags );
+               $status = wp_kses( _cleanup_header_comment($status[1]), $themes_allowed_tags );
        else
                $status = 'publish';
 
        if ( preg_match('|Tags:(.*)|i', $theme_data, $tags) )
        else
                $status = 'publish';
 
        if ( preg_match('|Tags:(.*)|i', $theme_data, $tags) )
-               $tags = array_map( 'trim', explode( ',', wp_kses( trim( $tags[1] ), array() ) ) );
+               $tags = array_map( 'trim', explode( ',', wp_kses( _cleanup_header_comment($tags[1]), array() ) ) );
        else
                $tags = array();
 
        else
                $tags = array();
 
-       $name = $theme = wp_kses( trim( $theme_name[1] ), $themes_allowed_tags );
-       $theme_uri = clean_url( trim( $theme_uri[1] ) );
-       $description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
-
        if ( preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ) ) {
                if ( empty( $author_uri ) ) {
        if ( preg_match( '|Author:(.*)$|mi', $theme_data, $author_name ) ) {
                if ( empty( $author_uri ) ) {
-                       $author = wp_kses( trim( $author_name[1] ), $themes_allowed_tags );
+                       $author = wp_kses( _cleanup_header_comment($author_name[1]), $themes_allowed_tags );
                } else {
                } else {
-                       $author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( trim( $author_name[1] ), $themes_allowed_tags ) );
+                       $author = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $author_uri, __( 'Visit author homepage' ), wp_kses( _cleanup_header_comment($author_name[1]), $themes_allowed_tags ) );
                }
        } else {
                $author = __('Anonymous');
                }
        } else {
                $author = __('Anonymous');
@@ -365,14 +372,28 @@ function get_themes() {
                                                $template_files[] = "$theme_loc/$stylesheet/$file";
                                }
                        }
                                                $template_files[] = "$theme_loc/$stylesheet/$file";
                                }
                        }
+                       @ $stylesheet_dir->close();
                }
 
                $template_dir = @ dir("$theme_root/$template");
                if ( $template_dir ) {
                }
 
                $template_dir = @ dir("$theme_root/$template");
                if ( $template_dir ) {
-                       while(($file = $template_dir->read()) !== false) {
-                               if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) )
+                       while ( ($file = $template_dir->read()) !== false ) {
+                               if ( preg_match('|^\.+$|', $file) )
+                                       continue;
+                               if ( preg_match('|\.php$|', $file) ) {
                                        $template_files[] = "$theme_loc/$template/$file";
                                        $template_files[] = "$theme_loc/$template/$file";
+                               } elseif ( is_dir("$theme_root/$template/$file") ) {
+                                       $template_subdir = @ dir("$theme_root/$template/$file");
+                                       while ( ($subfile = $template_subdir->read()) !== false ) {
+                                               if ( preg_match('|^\.+$|', $subfile) )
+                                                       continue;
+                                               if ( preg_match('|\.php$|', $subfile) )
+                                                       $template_files[] = "$theme_loc/$template/$file/$subfile";
+                                       }
+                                       @ $template_subdir->close();
+                               }
                        }
                        }
+                       @ $template_dir->close();
                }
 
                $template_dir = dirname($template_files[0]);
                }
 
                $template_dir = dirname($template_files[0]);
@@ -849,20 +870,23 @@ function preview_theme() {
        if ( !current_user_can( 'switch_themes' ) )
                return;
 
        if ( !current_user_can( 'switch_themes' ) )
                return;
 
-       $_GET['template'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['template']);
+       $_GET['template'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['template']);
 
        if ( validate_file($_GET['template']) )
                return;
 
 
        if ( validate_file($_GET['template']) )
                return;
 
-       add_filter('template', create_function('', "return '{$_GET['template']}';") );
+       add_filter( 'template', create_function('', "return '{$_GET['template']}';") );
 
        if ( isset($_GET['stylesheet']) ) {
 
        if ( isset($_GET['stylesheet']) ) {
-               $_GET['stylesheet'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['stylesheet']);
+               $_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);
                if ( validate_file($_GET['stylesheet']) )
                        return;
                if ( validate_file($_GET['stylesheet']) )
                        return;
-               add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
+               add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
        }
 
        }
 
+       // Prevent theme mods to current theme being used on theme being previewed
+       add_filter( 'pre_option_mods_' . get_current_theme(), create_function( '', "return array();" ) );
+
        ob_start( 'preview_theme_ob_filter' );
 }
 add_action('setup_theme', 'preview_theme');
        ob_start( 'preview_theme_ob_filter' );
 }
 add_action('setup_theme', 'preview_theme');
@@ -908,7 +932,7 @@ function preview_theme_ob_filter_callback( $matches ) {
        $link = add_query_arg( array('preview' => 1, 'template' => $_GET['template'], 'stylesheet' => @$_GET['stylesheet'] ), $matches[3] );
        if ( 0 === strpos($link, 'preview=1') )
                $link = "?$link";
        $link = add_query_arg( array('preview' => 1, 'template' => $_GET['template'], 'stylesheet' => @$_GET['stylesheet'] ), $matches[3] );
        if ( 0 === strpos($link, 'preview=1') )
                $link = "?$link";
-       return $matches[1] . attribute_escape( $link ) . $matches[4];
+       return $matches[1] . esc_attr( $link ) . $matches[4];
 }
 
 /**
 }
 
 /**
index 483b1229188ce42676daf2f5fadffb687d3018d0..756565b1d3f71fec7575e70a50195c4eac7d98a1 100644 (file)
@@ -26,21 +26,18 @@ function wp_version_check() {
        global $wp_version, $wpdb, $wp_local_package;
        $php_version = phpversion();
 
        global $wp_version, $wpdb, $wp_local_package;
        $php_version = phpversion();
 
-       $current = get_option( 'update_core' );
-       if ( ! is_object($current) )
+       $current = get_transient( 'update_core' );
+       if ( ! is_object($current) ) {
                $current = new stdClass;
                $current = new stdClass;
+               $current->updates = array();
+               $current->version_checked = $wp_version;
+       }
 
 
-       $locale = get_locale();
-       if (
-               isset( $current->last_checked ) &&
-               43200 > ( time() - $current->last_checked ) &&
-               $current->version_checked == $wp_version
-       )
-               return false;
+       $locale = apply_filters( 'core_version_check_locale', get_locale() );
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current->last_checked = time();
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current->last_checked = time();
-       update_option( 'update_core', $current );
+       set_transient( 'update_core', $current );
 
        if ( method_exists( $wpdb, 'db_version' ) )
                $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users));
 
        if ( method_exists( $wpdb, 'db_version' ) )
                $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users));
@@ -49,13 +46,12 @@ function wp_version_check() {
        $local_package = isset( $wp_local_package )? $wp_local_package : '';
        $url = "http://api.wordpress.org/core/version-check/1.3/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package";
 
        $local_package = isset( $wp_local_package )? $wp_local_package : '';
        $url = "http://api.wordpress.org/core/version-check/1.3/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package";
 
-       $options = array('timeout' => 3);
-       $options['headers'] = array(
-               'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'),
-               'User-Agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url')
+       $options = array(
+               'timeout' => 3,
+               'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
        );
 
        );
 
-       $response = wp_remote_request($url, $options);
+       $response = wp_remote_get($url, $options);
 
        if ( is_wp_error( $response ) )
                return false;
 
        if ( is_wp_error( $response ) )
                return false;
@@ -69,15 +65,15 @@ function wp_version_check() {
        foreach( explode( "\n\n", $body ) as $entry) {
                $returns = explode("\n", $entry);
                $new_option = new stdClass();
        foreach( explode( "\n\n", $body ) as $entry) {
                $returns = explode("\n", $entry);
                $new_option = new stdClass();
-               $new_option->response = attribute_escape( $returns[0] );
+               $new_option->response = esc_attr( $returns[0] );
                if ( isset( $returns[1] ) )
                if ( isset( $returns[1] ) )
-                       $new_option->url = clean_url( $returns[1] );
+                       $new_option->url = esc_url( $returns[1] );
                if ( isset( $returns[2] ) )
                if ( isset( $returns[2] ) )
-                       $new_option->package = clean_url( $returns[2] );
+                       $new_option->package = esc_url( $returns[2] );
                if ( isset( $returns[3] ) )
                if ( isset( $returns[3] ) )
-                       $new_option->current = attribute_escape( $returns[3] );
+                       $new_option->current = esc_attr( $returns[3] );
                if ( isset( $returns[4] ) )
                if ( isset( $returns[4] ) )
-                       $new_option->locale = attribute_escape( $returns[4] );
+                       $new_option->locale = esc_attr( $returns[4] );
                $new_options[] = $new_option;
        }
 
                $new_options[] = $new_option;
        }
 
@@ -85,9 +81,8 @@ function wp_version_check() {
        $updates->updates = $new_options;
        $updates->last_checked = time();
        $updates->version_checked = $wp_version;
        $updates->updates = $new_options;
        $updates->last_checked = time();
        $updates->version_checked = $wp_version;
-       update_option( 'update_core',  $updates);
+       set_transient( 'update_core',  $updates);
 }
 }
-add_action( 'init', 'wp_version_check' );
 
 /**
  * Check plugin versions against the latest versions hosted on WordPress.org.
 
 /**
  * Check plugin versions against the latest versions hosted on WordPress.org.
@@ -114,24 +109,20 @@ function wp_update_plugins() {
 
        $plugins = get_plugins();
        $active  = get_option( 'active_plugins' );
 
        $plugins = get_plugins();
        $active  = get_option( 'active_plugins' );
-       $current = get_option( 'update_plugins' );
+       $current = get_transient( 'update_plugins' );
        if ( ! is_object($current) )
                $current = new stdClass;
 
        if ( ! is_object($current) )
                $current = new stdClass;
 
-       $new_option = '';
+       $new_option = new stdClass;
        $new_option->last_checked = time();
        $new_option->last_checked = time();
-       $time_not_changed = isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked );
+       $timeout = 'load-plugins.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
+       $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
 
        $plugin_changed = false;
        foreach ( $plugins as $file => $p ) {
                $new_option->checked[ $file ] = $p['Version'];
 
 
        $plugin_changed = false;
        foreach ( $plugins as $file => $p ) {
                $new_option->checked[ $file ] = $p['Version'];
 
-               if ( !isset( $current->checked[ $file ] ) ) {
-                       $plugin_changed = true;
-                       continue;
-               }
-
-               if ( strval($current->checked[ $file ]) !== strval($p['Version']) )
+               if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )
                        $plugin_changed = true;
        }
 
                        $plugin_changed = true;
        }
 
@@ -139,6 +130,7 @@ function wp_update_plugins() {
                foreach ( $current->response as $plugin_file => $update_details ) {
                        if ( ! isset($plugins[ $plugin_file ]) ) {
                                $plugin_changed = true;
                foreach ( $current->response as $plugin_file => $update_details ) {
                        if ( ! isset($plugins[ $plugin_file ]) ) {
                                $plugin_changed = true;
+                               break;
                        }
                }
        }
                        }
                }
        }
@@ -149,28 +141,23 @@ function wp_update_plugins() {
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current->last_checked = time();
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current->last_checked = time();
-       update_option( 'update_plugins', $current );
-
-       $to_send->plugins = $plugins;
-       $to_send->active = $active;
-       $send = serialize( $to_send );
-       $body = 'plugins=' . urlencode( $send );
-
-       $options = array('method' => 'POST', 'timeout' => 3, 'body' => $body);
-       $options['headers'] = array(
-               'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'),
-               'Content-Length' => strlen($body),
-               'User-Agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url')
+       set_transient( 'update_plugins', $current );
+
+       $to_send = (object)compact('plugins', 'active');
+
+       $options = array(
+               'timeout' => 3,
+               'body' => array( 'plugins' => serialize( $to_send ) ),
+               'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
        );
 
        );
 
-       $raw_response = wp_remote_request('http://api.wordpress.org/plugins/update-check/1.0/', $options);
+       $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options);
 
        if ( is_wp_error( $raw_response ) )
                return false;
 
 
        if ( is_wp_error( $raw_response ) )
                return false;
 
-       if( 200 != $raw_response['response']['code'] ) {
+       if( 200 != $raw_response['response']['code'] )
                return false;
                return false;
-       }
 
        $response = unserialize( $raw_response['body'] );
 
 
        $response = unserialize( $raw_response['body'] );
 
@@ -179,7 +166,7 @@ function wp_update_plugins() {
        else
                $new_option->response = array();
 
        else
                $new_option->response = array();
 
-       update_option( 'update_plugins', $new_option );
+       set_transient( 'update_plugins', $new_option );
 }
 
 /**
 }
 
 /**
@@ -205,43 +192,41 @@ function wp_update_themes( ) {
                require_once( ABSPATH . 'wp-includes/theme.php' );
 
        $installed_themes = get_themes( );
                require_once( ABSPATH . 'wp-includes/theme.php' );
 
        $installed_themes = get_themes( );
-       $current_theme = get_option( 'update_themes' );
+       $current_theme = get_transient( 'update_themes' );
        if ( ! is_object($current_theme) )
                $current_theme = new stdClass;
 
        if ( ! is_object($current_theme) )
                $current_theme = new stdClass;
 
-       $new_option = '';
+       $new_option = new stdClass;
        $new_option->last_checked = time( );
        $new_option->last_checked = time( );
-       $time_not_changed = isset( $current_theme->last_checked ) && 43200 > ( time( ) - $current_theme->last_checked );
+       $timeout = 'load-themes.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
+       $time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked );
 
        if( $time_not_changed )
                return false;
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current_theme->last_checked = time();
 
        if( $time_not_changed )
                return false;
 
        // Update last_checked for current to prevent multiple blocking requests if request hangs
        $current_theme->last_checked = time();
-       update_option( 'update_themes', $current_theme );
+       set_transient( 'update_themes', $current_theme );
+
+       $current_theme->template = get_option( 'template' );
 
        $themes = array( );
 
        $themes = array( );
-       $themes['current_theme'] = $current_theme;
+       $themes['current_theme'] = (array) $current_theme;
        foreach( (array) $installed_themes as $theme_title => $theme ) {
        foreach( (array) $installed_themes as $theme_title => $theme ) {
-               $themes[$theme['Template']] = array( );
+               $themes[$theme['Stylesheet']] = array( );
 
                foreach( (array) $theme as $key => $value ) {
 
                foreach( (array) $theme as $key => $value ) {
-                       $themes[$theme['Template']][$key] = $value;
+                       $themes[$theme['Stylesheet']][$key] = $value;
                }
        }
 
        $options = array(
                }
        }
 
        $options = array(
-               'method'                => 'POST',
                'timeout'               => 3,
                'timeout'               => 3,
-               'body'                  => 'themes=' . urlencode( serialize( $themes ) )
-       );
-       $options['headers'] = array(
-               'Content-Type'          => 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ),
-               'Content-Length'        => strlen( $options['body'] ),
-               'User-Agent'            => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
+               'body'                  => array( 'themes' => serialize( $themes ) ),
+               'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
        );
 
        );
 
-       $raw_response = wp_remote_request( 'http://api.wordpress.org/themes/update-check/1.0/', $options );
+       $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options );
 
        if( is_wp_error( $raw_response ) )
                return false;
 
        if( is_wp_error( $raw_response ) )
                return false;
@@ -253,9 +238,22 @@ function wp_update_themes( ) {
        if( $response )
                $new_option->response = $response;
 
        if( $response )
                $new_option->response = $response;
 
-       update_option( 'update_themes', $new_option );
+       set_transient( 'update_themes', $new_option );
 }
 
 }
 
+function _maybe_update_core() {
+       global $wp_version;
+
+       $current = get_transient( 'update_core' );
+
+       if ( isset( $current->last_checked ) &&
+               43200 > ( time() - $current->last_checked ) &&
+               isset( $current->version_checked ) &&
+               $current->version_checked == $wp_version )
+               return;
+
+       wp_version_check();
+}
 /**
  * Check the last time plugins were run before checking plugin versions.
  *
 /**
  * Check the last time plugins were run before checking plugin versions.
  *
@@ -267,7 +265,7 @@ function wp_update_themes( ) {
  * @access private
  */
 function _maybe_update_plugins() {
  * @access private
  */
 function _maybe_update_plugins() {
-       $current = get_option( 'update_plugins' );
+       $current = get_transient( 'update_plugins' );
        if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
                return;
        wp_update_plugins();
        if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
                return;
        wp_update_plugins();
@@ -283,25 +281,32 @@ function _maybe_update_plugins() {
  * @access private
  */
 function _maybe_update_themes( ) {
  * @access private
  */
 function _maybe_update_themes( ) {
-       $current = get_option( 'update_themes' );
+       $current = get_transient( 'update_themes' );
        if( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
                return;
 
        wp_update_themes( );
 }
 
        if( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
                return;
 
        wp_update_themes( );
 }
 
+add_action( 'admin_init', '_maybe_update_core' );
+add_action( 'wp_version_check', 'wp_version_check' );
+
 add_action( 'load-plugins.php', 'wp_update_plugins' );
 add_action( 'load-update.php', 'wp_update_plugins' );
 add_action( 'admin_init', '_maybe_update_plugins' );
 add_action( 'wp_update_plugins', 'wp_update_plugins' );
 
 add_action( 'load-plugins.php', 'wp_update_plugins' );
 add_action( 'load-update.php', 'wp_update_plugins' );
 add_action( 'admin_init', '_maybe_update_plugins' );
 add_action( 'wp_update_plugins', 'wp_update_plugins' );
 
+add_action( 'load-themes.php', 'wp_update_themes' );
+add_action( 'load-update.php', 'wp_update_themes' );
 add_action( 'admin_init', '_maybe_update_themes' );
 add_action( 'wp_update_themes', 'wp_update_themes' );
 
 add_action( 'admin_init', '_maybe_update_themes' );
 add_action( 'wp_update_themes', 'wp_update_themes' );
 
+if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
+       wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
+
 if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
        wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
 
 if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
        wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
 
-
 if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
        wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
 
 if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
        wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
 
index cea1a03d276b55bc0237b3a99fb9001893e2fc92..483b3bccfd2033313873a7a886fb23691f428fd8 100644 (file)
@@ -32,54 +32,100 @@ function wp_signon( $credentials = '', $secure_cookie = '' ) {
                        $credentials['remember'] = $_POST['rememberme'];
        }
 
                        $credentials['remember'] = $_POST['rememberme'];
        }
 
-       if ( !empty($credentials['user_login']) )
-               $credentials['user_login'] = sanitize_user($credentials['user_login']);
-       if ( !empty($credentials['user_password']) )
-               $credentials['user_password'] = trim($credentials['user_password']);
        if ( !empty($credentials['remember']) )
                $credentials['remember'] = true;
        else
                $credentials['remember'] = false;
 
        if ( !empty($credentials['remember']) )
                $credentials['remember'] = true;
        else
                $credentials['remember'] = false;
 
+       // TODO do we deprecate the wp_authentication action?
        do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
 
        if ( '' === $secure_cookie )
                $secure_cookie = is_ssl() ? true : false;
 
        do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
 
        if ( '' === $secure_cookie )
                $secure_cookie = is_ssl() ? true : false;
 
-       // If no credential info provided, check cookie.
-       if ( empty($credentials['user_login']) && empty($credentials['user_password']) ) {
-               $user = wp_validate_auth_cookie();
-               if ( $user )
-                       return new WP_User($user);
+       global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
+       $auth_secure_cookie = $secure_cookie;
 
 
-               if ( $secure_cookie )
-                       $auth_cookie = SECURE_AUTH_COOKIE;
-               else
-                       $auth_cookie = AUTH_COOKIE;
+       add_filter('authenticate', 'wp_authenticate_cookie', 30, 3);
 
 
-               if ( !empty($_COOKIE[$auth_cookie]) )
-                       return new WP_Error('expired_session', __('Please log in again.'));
+       $user = wp_authenticate($credentials['user_login'], $credentials['user_password']);
 
 
-               // If the cookie is not set, be silent.
-               return new WP_Error();
+       if ( is_wp_error($user) ) {
+               if ( $user->get_error_codes() == array('empty_username', 'empty_password') ) {
+                       $user = new WP_Error('', '');
+               }
+
+               return $user;
        }
 
        }
 
-       if ( empty($credentials['user_login']) || empty($credentials['user_password']) ) {
+       wp_set_auth_cookie($user->ID, $credentials['remember'], $secure_cookie);
+       do_action('wp_login', $credentials['user_login']);
+       return $user;
+}
+
+
+/**
+ * Authenticate the user using the username and password.
+ */
+add_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
+function wp_authenticate_username_password($user, $username, $password) {
+       if ( is_a($user, 'WP_User') ) { return $user; }
+
+       if ( empty($username) || empty($password) ) {
                $error = new WP_Error();
 
                $error = new WP_Error();
 
-               if ( empty($credentials['user_login']) )
+               if ( empty($username) )
                        $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
                        $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
-               if ( empty($credentials['user_password']) )
+
+               if ( empty($password) )
                        $error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
                        $error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
+
                return $error;
        }
 
                return $error;
        }
 
-       $user = wp_authenticate($credentials['user_login'], $credentials['user_password']);
-       if ( is_wp_error($user) )
-               return $user;
+       $userdata = get_userdatabylogin($username);
+
+       if ( !$userdata ) {
+               return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
+       }
+
+       $userdata = apply_filters('wp_authenticate_user', $userdata, $password);
+       if ( is_wp_error($userdata) ) {
+               return $userdata;
+       }
+
+       if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) ) {
+               return new WP_Error('incorrect_password', sprintf(__('<strong>ERROR</strong>: Incorrect password. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')));
+       }
+
+       $user =  new WP_User($userdata->ID);
+       return $user;
+}
+
+/**
+ * Authenticate the user using the WordPress auth cookie.
+ */
+function wp_authenticate_cookie($user, $username, $password) {
+       if ( is_a($user, 'WP_User') ) { return $user; }
+
+       if ( empty($username) && empty($password) ) {
+               $user_id = wp_validate_auth_cookie();
+               if ( $user_id )
+                       return new WP_User($user_id);
+
+               global $auth_secure_cookie;
+
+               if ( $auth_secure_cookie )
+                       $auth_cookie = SECURE_AUTH_COOKIE;
+               else
+                       $auth_cookie = AUTH_COOKIE;
+
+               if ( !empty($_COOKIE[$auth_cookie]) )
+                       return new WP_Error('expired_session', __('Please log in again.'));
+
+               // If the cookie is not set, be silent.
+       }
 
 
-       wp_set_auth_cookie($user->ID, $credentials['remember'], $secure_cookie);
-       do_action('wp_login', $credentials['user_login']);
        return $user;
 }
 
        return $user;
 }
 
@@ -196,7 +242,7 @@ function get_user_option( $option, $user = 0, $check_blog_options = true ) {
  * Update user option with global blog capability.
  *
  * User options are just like user metadata except that they have support for
  * Update user option with global blog capability.
  *
  * User options are just like user metadata except that they have support for
- * global blog options. If the 'global' parameter is false, which it is by false
+ * global blog options. If the 'global' parameter is false, which it is by default
  * it will prepend the WordPress table prefix to the option name.
  *
  * @since 2.0.0
  * it will prepend the WordPress table prefix to the option name.
  *
  * @since 2.0.0
@@ -232,7 +278,7 @@ function get_users_of_blog( $id = '' ) {
        global $wpdb, $blog_id;
        if ( empty($id) )
                $id = (int) $blog_id;
        global $wpdb, $blog_id;
        if ( empty($id) )
                $id = (int) $blog_id;
-       $users = $wpdb->get_results( "SELECT user_id, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND meta_key = '" . $wpdb->prefix . "capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
+       $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$wpdb->prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
        return $users;
 }
 
        return $users;
 }
 
@@ -353,15 +399,12 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
        }
 
        $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
        }
 
        $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
-       if ( !$cur ) {
-               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value )
-               VALUES
-               ( %d, %s, %s )", $user_id, $meta_key, $meta_value) );
-       } else if ( $cur->meta_value != $meta_value ) {
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->usermeta SET meta_value = %s WHERE user_id = %d AND meta_key = %s", $meta_value, $user_id, $meta_key) );
-       } else {
+       if ( !$cur )
+               $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
+       else if ( $cur->meta_value != $meta_value )
+               $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
+       else
                return false;
                return false;
-       }
 
        wp_cache_delete($user_id, 'users');
 
 
        wp_cache_delete($user_id, 'users');
 
@@ -497,7 +540,7 @@ function wp_dropdown_users( $args = '' ) {
                        $user->ID = (int) $user->ID;
                        $_selected = $user->ID == $selected ? " selected='selected'" : '';
                        $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
                        $user->ID = (int) $user->ID;
                        $_selected = $user->ID == $selected ? " selected='selected'" : '';
                        $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
-                       $output .= "\t<option value='$user->ID'$_selected>" . wp_specialchars($display) . "</option>\n";
+                       $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
                }
 
                $output .= "</select>";
                }
 
                $output .= "</select>";
@@ -554,6 +597,7 @@ function _fill_user( &$user ) {
        wp_cache_add($user->ID, $user, 'users');
        wp_cache_add($user->user_login, $user->ID, 'userlogins');
        wp_cache_add($user->user_email, $user->ID, 'useremail');
        wp_cache_add($user->ID, $user, 'users');
        wp_cache_add($user->user_login, $user->ID, 'userlogins');
        wp_cache_add($user->user_email, $user->ID, 'useremail');
+       wp_cache_add($user->user_nicename, $user->ID, 'userslugs');
 }
 
 ?>
 }
 
 ?>
index 6edc5440beb41506b99a19fc0219012abb7afc69..232385da6449d7bb98f1c8673572749f087adb93 100644 (file)
@@ -65,12 +65,19 @@ $is_IE = ( $is_macIE || $is_winIE );
  * Whether the server software is Apache or something else
  * @global bool $is_apache
  */
  * Whether the server software is Apache or something else
  * @global bool $is_apache
  */
-$is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? true : false;
+$is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
 
 /**
  * Whether the server software is IIS or something else
  * @global bool $is_IIS
  */
 
 /**
  * Whether the server software is IIS or something else
  * @global bool $is_IIS
  */
-$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;
+$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false);
+
+/**
+ * Whether the server software is IIS 7.X
+ * @global bool $is_iis7
+ */
+$is_iis7 = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false);
+
 
 ?>
\ No newline at end of file
 
 ?>
\ No newline at end of file
index 6b2150e8c90a5b998e13acee580f42841e427315..dde44fbdca5243713896f2846f2dfb4c891b0c0f 100644 (file)
@@ -8,13 +8,25 @@
  *
  * @global string $wp_version
  */
  *
  * @global string $wp_version
  */
-$wp_version = '2.7.1';
+$wp_version = '2.8';
 
 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
  *
  * @global int $wp_db_version
  */
 
 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
  *
  * @global int $wp_db_version
  */
-$wp_db_version = 9872;
+$wp_db_version = 11548;
 
 
-?>
+/**
+ * Holds the TinyMCE version
+ *
+ * @global string $tinymce_version
+ */
+$tinymce_version = '3241-1141';
+
+/**
+ * Holds the cache manifest version
+ *
+ * @global string $manifest_version
+ */
+$manifest_version = '20090610';
index 2d654018338ce60a7e7c2839d4da330458feb118..dadca24f52d4625a8f017436ceb32b853b8a83f9 100644 (file)
  * @subpackage Widgets
  */
 
  * @subpackage Widgets
  */
 
+/**
+ * This class must be extended for each widget and WP_Widget::widget(), WP_Widget::update()
+ * and WP_Widget::form() need to be over-ridden.
+ *
+ * @package WordPress
+ * @subpackage Widgets
+ * @since 2.8
+ */
+class WP_Widget {
+
+       var $id_base;                   // Root id for all widgets of this type.
+       var $name;                              // Name for this widget type.
+       var $widget_options;    // Option array passed to wp_register_sidebar_widget()
+       var $control_options;   // Option array passed to wp_register_widget_control()
+
+       var $number = false;    // Unique ID number of the current instance.
+       var $id = false;                // Unique ID string of the current instance (id_base-number)
+       var $updated = false;   // Set true when we update the data after a POST submit - makes sure we don't do it twice.
+
+       // Member functions that you must over-ride.
+
+       /** Echo the widget content.
+        *
+        * Subclasses should over-ride this function to generate their widget code.
+        *
+        * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
+        * @param array $instance The settings for the particular instance of the widget
+        */
+       function widget($args, $instance) {
+               die('function WP_Widget::widget() must be over-ridden in a sub-class.');
+       }
+
+       /** Update a particular instance.
+        *
+        * This function should check that $new_instance is set correctly.
+        * The newly calculated value of $instance should be returned.
+        * If "false" is returned, the instance won't be saved/updated.
+        *
+        * @param array $new_instance New settings for this instance as input by the user via form()
+        * @param array $old_instance Old settings for this instance
+        * @return array Settings to save or bool false to cancel saving
+        */
+       function update($new_instance, $old_instance) {
+               return $new_instance;
+       }
+
+       /** Echo the settings update form
+        *
+        * @param array $instance Current settings
+        */
+       function form($instance) {
+               echo '<p class="no-options-widget">' . __('There are no options for this widget.') . '</p>';
+               return 'noform';
+       }
+
+       // Functions you'll need to call.
+
+       /**
+        * PHP4 constructor
+        */
+       function WP_Widget( $id_base = false, $name, $widget_options = array(), $control_options = array() ) {
+               $this->__construct( $id_base, $name, $widget_options, $control_options );
+       }
+
+       /**
+        * PHP5 constructor
+        *
+        * @param string $id_base Optional Base ID for the widget, lower case,
+        * if left empty a portion of the widget's class name will be used. Has to be unique.
+        * @param string $name Name for the widget displayed on the configuration page.
+        * @param array $widget_options Optional Passed to wp_register_sidebar_widget()
+        *       - description: shown on the configuration page
+        *       - classname
+        * @param array $control_options Optional Passed to wp_register_widget_control()
+        *       - width: required if more than 250px
+        *       - height: currently not used but may be needed in the future
+        */
+       function __construct( $id_base = false, $name, $widget_options = array(), $control_options = array() ) {
+               $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', strtolower(get_class($this)) ) : strtolower($id_base);
+               $this->name = $name;
+               $this->option_name = 'widget_' . $this->id_base;
+               $this->widget_options = wp_parse_args( $widget_options, array('classname' => $this->option_name) );
+               $this->control_options = wp_parse_args( $control_options, array('id_base' => $this->id_base) );
+       }
+
+       /**
+        * Constructs name attributes for use in form() fields
+        *
+        * This function should be used in form() methods to create name attributes for fields to be saved by update()
+        *
+        * @param string $field_name Field name
+        * @return string Name attribute for $field_name
+        */
+       function get_field_name($field_name) {
+               return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']';
+       }
+
+       /**
+        * Constructs id attributes for use in form() fields
+        *
+        * This function should be used in form() methods to create id attributes for fields to be saved by update()
+        *
+        * @param string $field_name Field name
+        * @return string ID attribute for $field_name
+        */
+       function get_field_id($field_name) {
+               return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name;
+       }
+
+       // Private Functions. Don't worry about these.
+
+       function _register() {
+               $settings = $this->get_settings();
+
+               if ( empty($settings) ) {
+                       // If there are none, we register the widget's existance with a
+                       // generic template
+                       $this->_set(1);
+                       $this->_register_one();
+               } elseif ( is_array($settings) ) {
+                       foreach ( array_keys($settings) as $number ) {
+                               if ( is_numeric($number) ) {
+                                       $this->_set($number);
+                                       $this->_register_one($number);
+                               }
+                       }
+               }
+       }
+
+       function _set($number) {
+               $this->number = $number;
+               $this->id = $this->id_base . '-' . $number;
+       }
+
+       function _get_display_callback() {
+               return array(&$this, 'display_callback');
+       }
+
+       function _get_update_callback() {
+               return array(&$this, 'update_callback');
+       }
+
+       function _get_form_callback() {
+               return array(&$this, 'form_callback');
+       }
+
+       /** Generate the actual widget content.
+        *      Just finds the instance and calls widget().
+        *      Do NOT over-ride this function. */
+       function display_callback( $args, $widget_args = 1 ) {
+               if ( is_numeric($widget_args) )
+                       $widget_args = array( 'number' => $widget_args );
+
+               $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
+               $this->_set( $widget_args['number'] );
+               $instance = $this->get_settings();
+
+               if ( array_key_exists( $this->number, $instance ) ) {
+                       $instance = $instance[$this->number];
+                       // filters the widget's settings, return false to stop displaying the widget
+                       $instance = apply_filters('widget_display_callback', $instance, $this, $args);
+                       if ( false !== $instance )
+                               $this->widget($args, $instance);
+               }
+       }
+
+       /** Deal with changed settings.
+        *      Do NOT over-ride this function. */
+       function update_callback( $widget_args = 1 ) {
+               global $wp_registered_widgets;
+
+               if ( is_numeric($widget_args) )
+                       $widget_args = array( 'number' => $widget_args );
+
+               $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
+               $all_instances = $this->get_settings();
+
+               // We need to update the data
+               if ( $this->updated )
+                       return;
+
+               $sidebars_widgets = wp_get_sidebars_widgets();
+
+               if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
+                       // Delete the settings for this instance of the widget
+                       if ( isset($_POST['the-widget-id']) )
+                               $del_id = $_POST['the-widget-id'];
+                       else
+                               return;
+
+                       if ( isset($wp_registered_widgets[$del_id]['params'][0]['number']) ) {
+                               $number = $wp_registered_widgets[$del_id]['params'][0]['number'];
+
+                               if ( $this->id_base . '-' . $number == $del_id )
+                                       unset($all_instances[$number]);
+                       }
+               } else {
+                       if ( isset($_POST['widget-' . $this->id_base]) && is_array($_POST['widget-' . $this->id_base]) ) {
+                               $settings = $_POST['widget-' . $this->id_base];
+                       } elseif ( isset($_POST['id_base']) && $_POST['id_base'] == $this->id_base ) {
+                               $num = $_POST['multi_number'] ? (int) $_POST['multi_number'] : (int) $_POST['widget_number'];
+                               $settings = array( $num => array() );
+                       } else {
+                               return;
+                       }
+
+                       foreach ( $settings as $number => $new_instance ) {
+                               $new_instance = stripslashes_deep($new_instance);
+                               $this->_set($number);
+
+                               $old_instance = isset($all_instances[$number]) ? $all_instances[$number] : array();
+
+                               $instance = $this->update($new_instance, $old_instance);
+
+                               // filters the widget's settings before saving, return false to cancel saving (keep the old settings if updating)
+                               $instance = apply_filters('widget_update_callback', $instance, $new_instance, $old_instance, $this);
+                               if ( false !== $instance )
+                                       $all_instances[$number] = $instance;
+
+                               break; // run only once
+                       }
+               }
+
+               $this->save_settings($all_instances);
+               $this->updated = true;
+       }
+
+       /** Generate the control form.
+        *      Do NOT over-ride this function. */
+       function form_callback( $widget_args = 1 ) {
+               if ( is_numeric($widget_args) )
+                       $widget_args = array( 'number' => $widget_args );
+
+               $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
+               $all_instances = $this->get_settings();
+
+               if ( -1 == $widget_args['number'] ) {
+                       // We echo out a form where 'number' can be set later
+                       $this->_set('__i__');
+                       $instance = array();
+               } else {
+                       $this->_set($widget_args['number']);
+                       $instance = $all_instances[ $widget_args['number'] ];
+               }
+
+               // filters the widget admin form before displaying, return false to stop displaying it
+               $instance = apply_filters('widget_form_callback', $instance, $this);
+
+               $return = null;
+               if ( false !== $instance ) {
+                       $return = $this->form($instance);
+                       // add extra fields in the widget form - be sure to set $return to null if you add any
+                       // if the widget has no form the text echoed from the default form method can be hidden using css
+                       do_action_ref_array( 'in_widget_form', array(&$this, &$return, $instance) );
+               }
+               return $return;
+       }
+
+       /** Helper function: Registers a single instance. */
+       function _register_one($number = -1) {
+               wp_register_sidebar_widget(     $this->id, $this->name, $this->_get_display_callback(), $this->widget_options, array( 'number' => $number ) );
+               _register_widget_update_callback( $this->id_base, $this->_get_update_callback(), $this->control_options, array( 'number' => -1 ) );
+               _register_widget_form_callback( $this->id, $this->name, $this->_get_form_callback(), $this->control_options, array( 'number' => $number ) );
+       }
+
+       function save_settings($settings) {
+               $settings['_multiwidget'] = 1;
+               update_option( $this->option_name, $settings );
+       }
+
+       function get_settings() {
+               $settings = get_option($this->option_name);
+
+               if ( false === $settings && isset($this->alt_option_name) )
+                       $settings = get_option($this->alt_option_name);
+
+               if ( !is_array($settings) )
+                       $settings = array();
+
+               if ( !array_key_exists('_multiwidget', $settings) ) {
+                       // old format, conver if single widget
+                       $settings = wp_convert_widget_settings($this->id_base, $this->option_name, $settings);
+               }
+
+               unset($settings['_multiwidget'], $settings['__i__']);
+               return $settings;
+       }
+}
+
+/**
+ * Singleton that registers and instantiates WP_Widget classes.
+ *
+ * @package WordPress
+ * @subpackage Widgets
+ * @since 2.8
+ */
+class WP_Widget_Factory {
+       var $widgets = array();
+
+       function WP_Widget_Factory() {
+               add_action( 'widgets_init', array( &$this, '_register_widgets' ), 100 );
+       }
+
+       function register($widget_class) {
+               $this->widgets[$widget_class] = & new $widget_class();
+       }
+
+       function unregister($widget_class) {
+               if ( isset($this->widgets[$widget_class]) )
+                       unset($this->widgets[$widget_class]);
+       }
+
+       function _register_widgets() {
+               global $wp_registered_widgets;
+               $keys = array_keys($this->widgets);
+               $registered = array_keys($wp_registered_widgets);
+               $registered = array_map('_get_widget_id_base', $registered);
+
+               foreach ( $keys as $key ) {
+                       // don't register new widget if old widget with the same id is already registered
+                       if ( in_array($this->widgets[$key]->id_base, $registered, true) ) {
+                               unset($this->widgets[$key]);
+                               continue;
+                       }
+
+                       $this->widgets[$key]->_register();
+               }
+       }
+}
+
 /* Global Variables */
 
 /** @ignore */
 /* Global Variables */
 
 /** @ignore */
-global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls;
+global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
 
 /**
  * Stores the sidebars, since many themes can have more than one.
 
 /**
  * Stores the sidebars, since many themes can have more than one.
@@ -41,9 +371,82 @@ $wp_registered_widgets = array();
  * @since 2.2.0
  */
 $wp_registered_widget_controls = array();
  * @since 2.2.0
  */
 $wp_registered_widget_controls = array();
+$wp_registered_widget_updates = array();
+
+/**
+ * Private
+ */
+$_wp_sidebars_widgets = array();
+
+/**
+ * Private
+ */
+ $_wp_deprecated_widgets_callbacks = array(
+       'wp_widget_pages',
+       'wp_widget_pages_control',
+       'wp_widget_calendar',
+       'wp_widget_calendar_control',
+       'wp_widget_archives',
+       'wp_widget_archives_control',
+       'wp_widget_links',
+       'wp_widget_meta',
+       'wp_widget_meta_control',
+       'wp_widget_search',
+       'wp_widget_recent_entries',
+       'wp_widget_recent_entries_control',
+       'wp_widget_tag_cloud',
+       'wp_widget_tag_cloud_control',
+       'wp_widget_categories',
+       'wp_widget_categories_control',
+       'wp_widget_text',
+       'wp_widget_text_control',
+       'wp_widget_rss',
+       'wp_widget_rss_control',
+       'wp_widget_recent_comments',
+       'wp_widget_recent_comments_control'
+ );
 
 /* Template tags & API functions */
 
 
 /* Template tags & API functions */
 
+/**
+ * Register a widget
+ *
+ * Registers a WP_Widget widget
+ *
+ * @since 2.8.0
+ *
+ * @see WP_Widget
+ * @see WP_Widget_Factory
+ * @uses WP_Widget_Factory
+ *
+ * @param string $widget_class The name of a class that extends WP_Widget
+ */
+function register_widget($widget_class) {
+       global $wp_widget_factory;
+
+       $wp_widget_factory->register($widget_class);
+}
+
+/**
+ * Unregister a widget
+ *
+ * Unregisters a WP_Widget widget. Useful for unregistering default widgets.
+ * Run within a function hooked to the widgets_init action.
+ *
+ * @since 2.8.0
+ *
+ * @see WP_Widget
+ * @see WP_Widget_Factory
+ * @uses WP_Widget_Factory
+ *
+ * @param string $widget_class The name of a class that extends WP_Widget
+ */
+function unregister_widget($widget_class) {
+       global $wp_widget_factory;
+
+       $wp_widget_factory->unregister($widget_class);
+}
+
 /**
  * Creates multiple sidebars.
  *
 /**
  * Creates multiple sidebars.
  *
@@ -170,45 +573,6 @@ function unregister_sidebar( $name ) {
                unset( $wp_registered_sidebars[$name] );
 }
 
                unset( $wp_registered_sidebars[$name] );
 }
 
-/**
- * Register widget for sidebar with backwards compatibility.
- *
- * Allows $name to be an array that accepts either three elements to grab the
- * first element and the third for the name or just uses the first element of
- * the array for the name.
- *
- * Passes to {@link wp_register_sidebar_widget()} after argument list and
- * backwards compatibility is complete.
- *
- * @since 2.2.0
- * @uses wp_register_sidebar_widget() Passes the compiled arguments.
- *
- * @param string|int $name Widget ID.
- * @param callback $output_callback Run when widget is called.
- * @param string $classname Classname widget option.
- * @param mixed $params,... Widget parameters.
- */
-function register_sidebar_widget($name, $output_callback, $classname = '') {
-       // Compat
-       if ( is_array($name) ) {
-               if ( count($name) == 3 )
-                       $name = sprintf($name[0], $name[2]);
-               else
-                       $name = $name[0];
-       }
-
-       $id = sanitize_title($name);
-       $options = array();
-       if ( !empty($classname) && is_string($classname) )
-               $options['classname'] = $classname;
-       $params = array_slice(func_get_args(), 2);
-       $args = array($id, $name, $output_callback, $options);
-       if ( !empty($params) )
-               $args = array_merge($args, $params);
-
-       call_user_func_array('wp_register_sidebar_widget', $args);
-}
-
 /**
  * Register widget for use in sidebars.
  *
 /**
  * Register widget for use in sidebars.
  *
@@ -230,7 +594,7 @@ function register_sidebar_widget($name, $output_callback, $classname = '') {
  * @return null Will return if $output_callback is empty after removing widget.
  */
 function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) {
  * @return null Will return if $output_callback is empty after removing widget.
  */
 function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) {
-       global $wp_registered_widgets;
+       global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks;
 
        $id = strtolower($id);
 
 
        $id = strtolower($id);
 
@@ -239,6 +603,17 @@ function wp_register_sidebar_widget($id, $name, $output_callback, $options = arr
                return;
        }
 
                return;
        }
 
+       $id_base = _get_widget_id_base($id);
+       if ( in_array($output_callback, $_wp_deprecated_widgets_callbacks, true) && !is_callable($output_callback) ) {
+               if ( isset($wp_registered_widget_controls[$id]) )
+                       unset($wp_registered_widget_controls[$id]);
+
+               if ( isset($wp_registered_widget_updates[$id_base]) )
+                       unset($wp_registered_widget_updates[$id_base]);
+
+               return;
+       }
+
        $defaults = array('classname' => $output_callback);
        $options = wp_parse_args($options, $defaults);
        $widget = array(
        $defaults = array('classname' => $output_callback);
        $options = wp_parse_args($options, $defaults);
        $widget = array(
@@ -272,20 +647,7 @@ function wp_widget_description( $id ) {
        global $wp_registered_widgets;
 
        if ( isset($wp_registered_widgets[$id]['description']) )
        global $wp_registered_widgets;
 
        if ( isset($wp_registered_widgets[$id]['description']) )
-               return wp_specialchars( $wp_registered_widgets[$id]['description'] );
-}
-
-/**
- * Alias of {@link wp_unregister_sidebar_widget()}.
- *
- * @see wp_unregister_sidebar_widget()
- *
- * @since 2.2.0
- *
- * @param int|string $id Widget ID.
- */
-function unregister_sidebar_widget($id) {
-       return wp_unregister_sidebar_widget($id);
+               return esc_html( $wp_registered_widgets[$id]['description'] );
 }
 
 /**
 }
 
 /**
@@ -300,46 +662,6 @@ function wp_unregister_sidebar_widget($id) {
        wp_unregister_widget_control($id);
 }
 
        wp_unregister_widget_control($id);
 }
 
-/**
- * Registers widget control callback for customizing options.
- *
- * Allows $name to be an array that accepts either three elements to grab the
- * first element and the third for the name or just uses the first element of
- * the array for the name.
- *
- * Passes to {@link wp_register_widget_control()} after the argument list has
- * been compiled.
- *
- * @since 2.2.0
- *
- * @param int|string $name Sidebar ID.
- * @param callback $control_callback Widget control callback to display and process form.
- * @param int $width Widget width.
- * @param int $height Widget height.
- */
-function register_widget_control($name, $control_callback, $width = '', $height = '') {
-       // Compat
-       if ( is_array($name) ) {
-               if ( count($name) == 3 )
-                       $name = sprintf($name[0], $name[2]);
-               else
-                       $name = $name[0];
-       }
-
-       $id = sanitize_title($name);
-       $options = array();
-       if ( !empty($width) )
-               $options['width'] = $width;
-       if ( !empty($height) )
-               $options['height'] = $height;
-       $params = array_slice(func_get_args(), 4);
-       $args = array($id, $name, $control_callback, $options);
-       if ( !empty($params) )
-               $args = array_merge($args, $params);
-
-       call_user_func_array('wp_register_widget_control', $args);
-}
-
 /**
  * Registers widget control callback for customizing options.
  *
 /**
  * Registers widget control callback for customizing options.
  *
@@ -359,12 +681,21 @@ function register_widget_control($name, $control_callback, $width = '', $height
  * @param mixed $params,... Optional. Additional parameters to add to widget.
  */
 function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
  * @param mixed $params,... Optional. Additional parameters to add to widget.
  */
 function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
-       global $wp_registered_widget_controls;
+       global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;
 
        $id = strtolower($id);
 
        $id = strtolower($id);
+       $id_base = _get_widget_id_base($id);
 
        if ( empty($control_callback) ) {
                unset($wp_registered_widget_controls[$id]);
 
        if ( empty($control_callback) ) {
                unset($wp_registered_widget_controls[$id]);
+               unset($wp_registered_widget_updates[$id_base]);
+               return;
+       }
+
+       if ( in_array($control_callback, $_wp_deprecated_widgets_callbacks, true) && !is_callable($control_callback) ) {
+               if ( isset($wp_registered_widgets[$id]) )
+                       unset($wp_registered_widgets[$id]);
+
                return;
        }
 
                return;
        }
 
@@ -385,36 +716,80 @@ function wp_register_widget_control($id, $name, $control_callback, $options = ar
        $widget = array_merge($widget, $options);
 
        $wp_registered_widget_controls[$id] = $widget;
        $widget = array_merge($widget, $options);
 
        $wp_registered_widget_controls[$id] = $widget;
-}
 
 
-/**
- * Alias of {@link wp_unregister_widget_control()}.
- *
- * @since 2.2.0
- * @see wp_unregister_widget_control()
- *
- * @param int|string $id Widget ID.
- */
-function unregister_widget_control($id) {
-       return wp_unregister_widget_control($id);
-}
+       if ( isset($wp_registered_widget_updates[$id_base]) )
+               return;
 
 
-/**
- * Remove control callback for widget.
- *
- * @since 2.2.0
- * @uses wp_register_widget_control() Unregisters by using empty callback.
- *
- * @param int|string $id Widget ID.
- */
-function wp_unregister_widget_control($id) {
-       return wp_register_widget_control($id, '', '');
+       if ( isset($widget['params'][0]['number']) )
+               $widget['params'][0]['number'] = -1;
+
+       unset($widget['width'], $widget['height'], $widget['name'], $widget['id']);
+       $wp_registered_widget_updates[$id_base] = $widget;
 }
 
 }
 
-/**
- * Display dynamic sidebar.
- *
- * By default it displays the default sidebar or 'sidebar-1'. The 'sidebar-1' is
+function _register_widget_update_callback($id_base, $update_callback, $options = array()) {
+       global $wp_registered_widget_updates;
+
+       if ( isset($wp_registered_widget_updates[$id_base]) ) {
+               if ( empty($update_callback) )
+                       unset($wp_registered_widget_updates[$id_base]);
+               return;
+       }
+
+       $widget = array(
+               'callback' => $update_callback,
+               'params' => array_slice(func_get_args(), 3)
+       );
+
+       $widget = array_merge($widget, $options);
+       $wp_registered_widget_updates[$id_base] = $widget;
+}
+
+function _register_widget_form_callback($id, $name, $form_callback, $options = array()) {
+       global $wp_registered_widget_controls;
+
+       $id = strtolower($id);
+
+       if ( empty($form_callback) ) {
+               unset($wp_registered_widget_controls[$id]);
+               return;
+       }
+
+       if ( isset($wp_registered_widget_controls[$id]) && !did_action( 'widgets_init' ) )
+               return;
+
+       $defaults = array('width' => 250, 'height' => 200 );
+       $options = wp_parse_args($options, $defaults);
+       $options['width'] = (int) $options['width'];
+       $options['height'] = (int) $options['height'];
+
+       $widget = array(
+               'name' => $name,
+               'id' => $id,
+               'callback' => $form_callback,
+               'params' => array_slice(func_get_args(), 4)
+       );
+       $widget = array_merge($widget, $options);
+
+       $wp_registered_widget_controls[$id] = $widget;
+}
+
+/**
+ * Remove control callback for widget.
+ *
+ * @since 2.2.0
+ * @uses wp_register_widget_control() Unregisters by using empty callback.
+ *
+ * @param int|string $id Widget ID.
+ */
+function wp_unregister_widget_control($id) {
+       return wp_register_widget_control($id, '', '');
+}
+
+/**
+ * Display dynamic sidebar.
+ *
+ * By default it displays the default sidebar or 'sidebar-1'. The 'sidebar-1' is
  * not named by the theme, the actual name is '1', but 'sidebar-' is added to
  * the registered sidebars for the name. If you named your sidebar 'after-post',
  * then the parameter $index will still be 'after-post', but the lookup will be
  * not named by the theme, the actual name is '1', but 'sidebar-' is added to
  * the registered sidebars for the name. If you named your sidebar 'after-post',
  * then the parameter $index will still be 'after-post', but the lookup will be
@@ -454,6 +829,9 @@ function dynamic_sidebar($index = 1) {
 
        $did_one = false;
        foreach ( (array) $sidebars_widgets[$index] as $id ) {
 
        $did_one = false;
        foreach ( (array) $sidebars_widgets[$index] as $id ) {
+
+               if ( !isset($wp_registered_widgets[$id]) ) continue;
+
                $params = array_merge(
                        array( array_merge( $sidebar, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']) ) ),
                        (array) $wp_registered_widgets[$id]['params']
                $params = array_merge(
                        array( array_merge( $sidebar, array('widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name']) ) ),
                        (array) $wp_registered_widgets[$id]['params']
@@ -484,30 +862,46 @@ function dynamic_sidebar($index = 1) {
 }
 
 /**
 }
 
 /**
- * Whether widget is registered using callback with widget ID.
+ * Whether widget is displayied on the front-end.
+ *
+ * Either $callback or $id_base can be used
+ * $id_base is the first argument when extending WP_Widget class
+ * Without the optional $widget_id parameter, returns the ID of the first sidebar
+ * in which the first instance of the widget with the given callback or $id_base is found.
+ * With the $widget_id parameter, returns the ID of the sidebar where
+ * the widget with that callback/$id_base AND that ID is found.
  *
  *
- * Will only check if both parameters are used. Used to find which sidebar the
- * widget is located in, but requires that both the callback and the widget ID
- * be known.
+ * NOTE: $widget_id and $id_base are the same for single widgets. To be effective
+ * this function has to run after widgets have initialized, at action 'init' or later.
  *
  * @since 2.2.0
  *
  *
  * @since 2.2.0
  *
- * @param callback $callback Widget callback to check.
+ * @param callback Optional, Widget callback to check.
  * @param int $widget_id Optional, but needed for checking. Widget ID.
  * @param int $widget_id Optional, but needed for checking. Widget ID.
-/* @return mixed false if widget is not active or id of sidebar in which the widget is active.
+ * @param string $id_base Optional, the base ID of a widget created by extending WP_Widget.
+ * @param bool $skip_inactive Optional, whether to check in 'wp_inactive_widgets'.
+ * @return mixed false if widget is not active or id of sidebar in which the widget is active.
  */
  */
-function is_active_widget($callback, $widget_id = false) {
+function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) {
        global $wp_registered_widgets;
 
        $sidebars_widgets = wp_get_sidebars_widgets(false);
 
        global $wp_registered_widgets;
 
        $sidebars_widgets = wp_get_sidebars_widgets(false);
 
-       if ( is_array($sidebars_widgets) ) foreach ( $sidebars_widgets as $sidebar => $widgets )
-               if ( is_array($widgets) ) foreach ( $widgets as $widget )
-                       if ( isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback )
-                               if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )
-                                       return $sidebar;
-
+       if ( is_array($sidebars_widgets) ) {
+               foreach ( $sidebars_widgets as $sidebar => $widgets ) {
+                       if ( $skip_inactive && 'wp_inactive_widgets' == $sidebar )
+                               continue;
 
 
+                       if ( is_array($widgets) ) {
+                               foreach ( $widgets as $widget ) {
+                                       if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && _get_widget_id_base($widget) == $id_base ) ) {
+                                               if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )
+                                                       return $sidebar;
+                                       }
+                               }
+                       }
+               }
+       }
        return false;
 }
 
        return false;
 }
 
@@ -531,6 +925,23 @@ function is_dynamic_sidebar() {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether a sidebar is in use.
+ *
+ * @since 2.8
+ *
+ * @param mixed $index, sidebar name, id or number to check.
+ * @return bool true if the sidebar is in use, false otherwise.
+ */
+function is_active_sidebar( $index ) {
+       $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
+       $sidebars_widgets = get_option( 'sidebars_widgets', array() );
+       if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
+               return true;
+
+       return false;
+}
+
 /* Internal Functions */
 
 /**
 /* Internal Functions */
 
 /**
@@ -546,9 +957,18 @@ function is_dynamic_sidebar() {
  * @return array Upgraded list of widgets to version 2 array format.
  */
 function wp_get_sidebars_widgets($update = true) {
  * @return array Upgraded list of widgets to version 2 array format.
  */
 function wp_get_sidebars_widgets($update = true) {
-       global $wp_registered_widgets, $wp_registered_sidebars;
+       global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
 
 
-       $sidebars_widgets = get_option('sidebars_widgets', array());
+       // If loading from front page, consult $_wp_sidebars_widgets rather than options
+       // to see if wp_convert_widget_settings() has made manipulations in memory.
+       if ( is_admin() ) {
+               $sidebars_widgets = get_option('sidebars_widgets', array());
+       } else {
+               if ( empty($_wp_sidebars_widgets) )
+                       $sidebars_widgets = get_option('sidebars_widgets', array());
+               else
+                       $sidebars_widgets = &$_wp_sidebars_widgets;
+       }
        $_sidebars_widgets = array();
 
        if ( !isset($sidebars_widgets['array_version']) )
        $_sidebars_widgets = array();
 
        if ( !isset($sidebars_widgets['array_version']) )
@@ -614,7 +1034,7 @@ function wp_get_sidebars_widgets($update = true) {
                                unset($_sidebars_widgets);
                        }
 
                                unset($_sidebars_widgets);
                        }
 
-                       if ( $update )
+                       if ( $update && is_admin() )
                                update_option('sidebars_widgets', $sidebars_widgets);
        }
 
                                update_option('sidebars_widgets', $sidebars_widgets);
        }
 
@@ -658,1443 +1078,202 @@ function wp_get_widget_defaults() {
        return $defaults;
 }
 
        return $defaults;
 }
 
-/* Default Widgets */
-
 /**
 /**
- * Display pages widget.
+ * Convert the widget settings from single to multi-widget format.
  *
  *
- * @since 2.2.0
+ * @since 2.8.0
  *
  *
- * @param array $args Widget arguments.
+ * @return array
  */
  */
-function wp_widget_pages( $args ) {
-       extract( $args );
-       $options = get_option( 'widget_pages' );
-
-       $title = empty( $options['title'] ) ? __( 'Pages' ) : apply_filters('widget_title', $options['title']);
-       $sortby = empty( $options['sortby'] ) ? 'menu_order' : $options['sortby'];
-       $exclude = empty( $options['exclude'] ) ? '' : $options['exclude'];
-
-       if ( $sortby == 'menu_order' ) {
-               $sortby = 'menu_order, post_title';
-       }
-
-       $out = wp_list_pages( array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) );
-
-       if ( !empty( $out ) ) {
-?>
-       <?php echo $before_widget; ?>
-               <?php echo $before_title . $title . $after_title; ?>
-               <ul>
-                       <?php echo $out; ?>
-               </ul>
-       <?php echo $after_widget; ?>
-<?php
+function wp_convert_widget_settings($base_name, $option_name, $settings) {
+       global $_wp_sidebars_widgets;
+       // This test may need expanding.
+       $single = false;
+       if ( empty($settings) ) {
+               $single = true;
+       } else {
+               foreach ( array_keys($settings) as $number ) {
+                       if ( 'number' == $number )
+                               continue;
+                       if ( !is_numeric($number) ) {
+                               $single = true;
+                               break;
+                       }
+               }
        }
        }
-}
-
-/**
- * Display and process pages widget options form.
- *
- * @since 2.2.0
- */
-function wp_widget_pages_control() {
-       $options = $newoptions = get_option('widget_pages');
-       if ( isset($_POST['pages-submit']) ) {
-               $newoptions['title'] = strip_tags(stripslashes($_POST['pages-title']));
 
 
-               $sortby = stripslashes( $_POST['pages-sortby'] );
+       if ( $single ) {
+               $settings = array( 2 => $settings );
 
 
-               if ( in_array( $sortby, array( 'post_title', 'menu_order', 'ID' ) ) ) {
-                       $newoptions['sortby'] = $sortby;
+               // If loading from the front page, update sidebar in memory but don't save to options
+               if ( is_admin() ) {
+                       $sidebars_widgets = get_option('sidebars_widgets');
                } else {
                } else {
-                       $newoptions['sortby'] = 'menu_order';
+                       if ( empty($GLOBALS['_wp_sidebars_widgets']) )
+                               $GLOBALS['_wp_sidebars_widgets'] = get_option('sidebars_widgets');
+                       $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets'];
                }
 
                }
 
-               $newoptions['exclude'] = strip_tags( stripslashes( $_POST['pages-exclude'] ) );
-       }
-       if ( $options != $newoptions ) {
-               $options = $newoptions;
-               update_option('widget_pages', $options);
+               foreach ( (array) $sidebars_widgets as $index => $sidebar ) {
+                       if ( is_array($sidebar) ) {
+                               foreach ( $sidebar as $i => $name ) {
+                                       if ( $base_name == $name ) {
+                                               $sidebars_widgets[$index][$i] = "$name-2";
+                                               break 2;
+                                       }
+                               }
+                       }
+               }
+
+               if ( is_admin() )
+                       update_option('sidebars_widgets', $sidebars_widgets);
        }
        }
-       $title = attribute_escape($options['title']);
-       $exclude = attribute_escape( $options['exclude'] );
-?>
-               <p><label for="pages-title"><?php _e('Title:'); ?> <input class="widefat" id="pages-title" name="pages-title" type="text" value="<?php echo $title; ?>" /></label></p>
-               <p>
-                       <label for="pages-sortby"><?php _e( 'Sort by:' ); ?>
-                               <select name="pages-sortby" id="pages-sortby" class="widefat">
-                                       <option value="post_title"<?php selected( $options['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option>
-                                       <option value="menu_order"<?php selected( $options['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option>
-                                       <option value="ID"<?php selected( $options['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
-                               </select>
-                       </label>
-               </p>
-               <p>
-                       <label for="pages-exclude"><?php _e( 'Exclude:' ); ?> <input type="text" value="<?php echo $exclude; ?>" name="pages-exclude" id="pages-exclude" class="widefat" /></label>
-                       <br />
-                       <small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
-               </p>
-               <input type="hidden" id="pages-submit" name="pages-submit" value="1" />
-<?php
+
+       $settings['_multiwidget'] = 1;
+       if ( is_admin() )
+               update_option( $option_name, $settings );
+
+       return $settings;
 }
 
 /**
 }
 
 /**
- * Display links widget.
- *
- * @since 2.2.0
- *
- * @param array $args Widget arguments.
+ * Deprecated API
  */
  */
-function wp_widget_links($args) {
-       extract($args, EXTR_SKIP);
-
-       $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
-       wp_list_bookmarks(apply_filters('widget_links_args', array(
-               'title_before' => $before_title, 'title_after' => $after_title,
-               'category_before' => $before_widget, 'category_after' => $after_widget,
-               'show_images' => true, 'class' => 'linkcat widget'
-       )));
-}
 
 /**
 
 /**
- * Display search widget.
+ * Register widget for sidebar with backwards compatibility.
  *
  *
- * @since 2.2.0
+ * Allows $name to be an array that accepts either three elements to grab the
+ * first element and the third for the name or just uses the first element of
+ * the array for the name.
  *
  *
- * @param array $args Widget arguments.
- */
-function wp_widget_search($args) {
-       extract($args);
-       echo $before_widget;
-
-       // Use current theme search form if it exists
-       get_search_form();
-
-       echo $after_widget;
-}
-
-/**
- * Display archives widget.
+ * Passes to {@link wp_register_sidebar_widget()} after argument list and
+ * backwards compatibility is complete.
  *
  * @since 2.2.0
  *
  * @since 2.2.0
+ * @uses wp_register_sidebar_widget() Passes the compiled arguments.
  *
  *
- * @param array $args Widget arguments.
+ * @param string|int $name Widget ID.
+ * @param callback $output_callback Run when widget is called.
+ * @param string $classname Classname widget option.
+ * @param mixed $params,... Widget parameters.
  */
  */
-function wp_widget_archives($args) {
-       extract($args);
-       $options = get_option('widget_archives');
-       $c = $options['count'] ? '1' : '0';
-       $d = $options['dropdown'] ? '1' : '0';
-       $title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']);
-
-       echo $before_widget;
-       echo $before_title . $title . $after_title;
-
-       if($d) {
-?>
-               <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives("type=monthly&format=option&show_post_count=$c"); ?> </select>
-<?php
-       } else {
-?>
-               <ul>
-               <?php wp_get_archives("type=monthly&show_post_count=$c"); ?>
-               </ul>
-<?php
+function register_sidebar_widget($name, $output_callback, $classname = '') {
+       // Compat
+       if ( is_array($name) ) {
+               if ( count($name) == 3 )
+                       $name = sprintf($name[0], $name[2]);
+               else
+                       $name = $name[0];
        }
 
        }
 
-       echo $after_widget;
-}
+       $id = sanitize_title($name);
+       $options = array();
+       if ( !empty($classname) && is_string($classname) )
+               $options['classname'] = $classname;
+       $params = array_slice(func_get_args(), 2);
+       $args = array($id, $name, $output_callback, $options);
+       if ( !empty($params) )
+               $args = array_merge($args, $params);
 
 
-/**
- * Display and process archives widget options form.
- *
- * @since 2.2.0
- */
-function wp_widget_archives_control() {
-       $options = $newoptions = get_option('widget_archives');
-       if ( isset($_POST["archives-submit"]) ) {
-               $newoptions['count'] = isset($_POST['archives-count']);
-               $newoptions['dropdown'] = isset($_POST['archives-dropdown']);
-               $newoptions['title'] = strip_tags(stripslashes($_POST["archives-title"]));
-       }
-       if ( $options != $newoptions ) {
-               $options = $newoptions;
-               update_option('widget_archives', $options);
-       }
-       $count = $options['count'] ? 'checked="checked"' : '';
-       $dropdown = $options['dropdown'] ? 'checked="checked"' : '';
-       $title = attribute_escape($options['title']);
-?>
-                       <p><label for="archives-title"><?php _e('Title:'); ?> <input class="widefat" id="archives-title" name="archives-title" type="text" value="<?php echo $title; ?>" /></label></p>
-                       <p>
-                               <label for="archives-count"><input class="checkbox" type="checkbox" <?php echo $count; ?> id="archives-count" name="archives-count" /> <?php _e('Show post counts'); ?></label>
-                               <br />
-                               <label for="archives-dropdown"><input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="archives-dropdown" name="archives-dropdown" /> <?php _e('Display as a drop down'); ?></label>
-                       </p>
-                       <input type="hidden" id="archives-submit" name="archives-submit" value="1" />
-<?php
+       call_user_func_array('wp_register_sidebar_widget', $args);
 }
 
 /**
 }
 
 /**
- * Display meta widget.
+ * Alias of {@link wp_unregister_sidebar_widget()}.
  *
  *
- * Displays log in/out, RSS feed links, etc.
+ * @see wp_unregister_sidebar_widget()
  *
  * @since 2.2.0
  *
  *
  * @since 2.2.0
  *
- * @param array $args Widget arguments.
- */
-function wp_widget_meta($args) {
-       extract($args);
-       $options = get_option('widget_meta');
-       $title = empty($options['title']) ? __('Meta') : apply_filters('widget_title', $options['title']);
-?>
-               <?php echo $before_widget; ?>
-                       <?php echo $before_title . $title . $after_title; ?>
-                       <ul>
-                       <?php wp_register(); ?>
-                       <li><?php wp_loginout(); ?></li>
-                       <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo attribute_escape(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
-                       <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo attribute_escape(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
-                       <li><a href="http://wordpress.org/" title="<?php echo attribute_escape(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
-                       <?php wp_meta(); ?>
-                       </ul>
-               <?php echo $after_widget; ?>
-<?php
-}
-
-/**
- * Display and process meta widget options form.
- *
- * @since 2.2.0
+ * @param int|string $id Widget ID.
  */
  */
-function wp_widget_meta_control() {
-       $options = $newoptions = get_option('widget_meta');
-       if ( isset($_POST["meta-submit"]) ) {
-               $newoptions['title'] = strip_tags(stripslashes($_POST["meta-title"]));
-       }
-       if ( $options != $newoptions ) {
-               $options = $newoptions;
-               update_option('widget_meta', $options);
-       }
-       $title = attribute_escape($options['title']);
-?>
-                       <p><label for="meta-title"><?php _e('Title:'); ?> <input class="widefat" id="meta-title" name="meta-title" type="text" value="<?php echo $title; ?>" /></label></p>
-                       <input type="hidden" id="meta-submit" name="meta-submit" value="1" />
-<?php
+function unregister_sidebar_widget($id) {
+       return wp_unregister_sidebar_widget($id);
 }
 
 /**
 }
 
 /**
- * Display calendar widget.
+ * Registers widget control callback for customizing options.
  *
  *
- * @since 2.2.0
+ * Allows $name to be an array that accepts either three elements to grab the
+ * first element and the third for the name or just uses the first element of
+ * the array for the name.
  *
  *
- * @param array $args Widget arguments.
- */
-function wp_widget_calendar($args) {
-       extract($args);
-       $options = get_option('widget_calendar');
-       $title = apply_filters('widget_title', $options['title']);
-       if ( empty($title) )
-               $title = '&nbsp;';
-       echo $before_widget . $before_title . $title . $after_title;
-       echo '<div id="calendar_wrap">';
-       get_calendar();
-       echo '</div>';
-       echo $after_widget;
-}
-
-/**
- * Display and process calendar widget options form.
+ * Passes to {@link wp_register_widget_control()} after the argument list has
+ * been compiled.
  *
  * @since 2.2.0
  *
  * @since 2.2.0
+ *
+ * @param int|string $name Sidebar ID.
+ * @param callback $control_callback Widget control callback to display and process form.
+ * @param int $width Widget width.
+ * @param int $height Widget height.
  */
  */
-function wp_widget_calendar_control() {
-       $options = $newoptions = get_option('widget_calendar');
-       if ( isset($_POST["calendar-submit"]) ) {
-               $newoptions['title'] = strip_tags(stripslashes($_POST["calendar-title"]));
-       }
-       if ( $options != $newoptions ) {
-               $options = $newoptions;
-               update_option('widget_calendar', $options);
+function register_widget_control($name, $control_callback, $width = '', $height = '') {
+       // Compat
+       if ( is_array($name) ) {
+               if ( count($name) == 3 )
+                       $name = sprintf($name[0], $name[2]);
+               else
+                       $name = $name[0];
        }
        }
-       $title = attribute_escape($options['title']);
-?>
-                       <p><label for="calendar-title"><?php _e('Title:'); ?> <input class="widefat" id="calendar-title" name="calendar-title" type="text" value="<?php echo $title; ?>" /></label></p>
-                       <input type="hidden" id="calendar-submit" name="calendar-submit" value="1" />
-<?php
+
+       $id = sanitize_title($name);
+       $options = array();
+       if ( !empty($width) )
+               $options['width'] = $width;
+       if ( !empty($height) )
+               $options['height'] = $height;
+       $params = array_slice(func_get_args(), 4);
+       $args = array($id, $name, $control_callback, $options);
+       if ( !empty($params) )
+               $args = array_merge($args, $params);
+
+       call_user_func_array('wp_register_widget_control', $args);
 }
 
 /**
 }
 
 /**
- * Display the Text widget, depending on the widget number.
- *
- * Supports multiple text widgets and keeps track of the widget number by using
- * the $widget_args parameter. The option 'widget_text' is used to store the
- * content for the widgets. The content and title are passed through the
- * 'widget_text' and 'widget_title' filters respectively.
+ * Alias of {@link wp_unregister_widget_control()}.
  *
  * @since 2.2.0
  *
  * @since 2.2.0
+ * @see wp_unregister_widget_control()
  *
  *
- * @param array $args Widget arguments.
- * @param int $number Widget number.
+ * @param int|string $id Widget ID.
  */
  */
-function wp_widget_text($args, $widget_args = 1) {
-       extract( $args, EXTR_SKIP );
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract( $widget_args, EXTR_SKIP );
-
-       $options = get_option('widget_text');
-       if ( !isset($options[$number]) )
-               return;
-
-       $title = apply_filters('widget_title', $options[$number]['title']);
-       $text = apply_filters( 'widget_text', $options[$number]['text'] );
-?>
-               <?php echo $before_widget; ?>
-                       <?php if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
-                       <div class="textwidget"><?php echo $text; ?></div>
-               <?php echo $after_widget; ?>
-<?php
+function unregister_widget_control($id) {
+       return wp_unregister_widget_control($id);
 }
 
 /**
 }
 
 /**
- * Display and process text widget options form.
+ * Output an arbitrary widget as a template tag
  *
  *
- * @since 2.2.0
+ * @since 2.8
  *
  *
- * @param int $widget_args Widget number.
- */
-function wp_widget_text_control($widget_args) {
-       global $wp_registered_widgets;
-       static $updated = false;
-
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract( $widget_args, EXTR_SKIP );
-
-       $options = get_option('widget_text');
-       if ( !is_array($options) )
-               $options = array();
-
-       if ( !$updated && !empty($_POST['sidebar']) ) {
-               $sidebar = (string) $_POST['sidebar'];
+ * @param string $widget the widget's PHP class name (see default-widgets.php)
+ * @param array $instance the widget's instance settings
+ * @param array $args the widget's sidebar args
+ * @return void
+ **/
+function the_widget($widget, $instance = array(), $args = array()) {
+       global $wp_widget_factory;
 
 
-               $sidebars_widgets = wp_get_sidebars_widgets();
-               if ( isset($sidebars_widgets[$sidebar]) )
-                       $this_sidebar =& $sidebars_widgets[$sidebar];
-               else
-                       $this_sidebar = array();
-
-               foreach ( (array) $this_sidebar as $_widget_id ) {
-                       if ( 'wp_widget_text' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
-                               $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
-                               if ( !in_array( "text-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
-                                       unset($options[$widget_number]);
-                       }
-               }
+       $widget_obj = $wp_widget_factory->widgets[$widget];
+       if ( !is_a($widget_obj, 'WP_Widget') )
+               return;
 
 
-               foreach ( (array) $_POST['widget-text'] as $widget_number => $widget_text ) {
-                       if ( !isset($widget_text['text']) && isset($options[$widget_number]) ) // user clicked cancel
-                               continue;
-                       $title = strip_tags(stripslashes($widget_text['title']));
-                       if ( current_user_can('unfiltered_html') )
-                               $text = stripslashes( $widget_text['text'] );
-                       else
-                               $text = stripslashes(wp_filter_post_kses( $widget_text['text'] ));
-                       $options[$widget_number] = compact( 'title', 'text' );
-               }
+       $before_widget = sprintf('<div class="widget %s">', $widget_obj->widget_options['classname']);
+       $default_args = array('before_widget' => $before_widget, 'after_widget' => "</div>", 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>');
 
 
-               update_option('widget_text', $options);
-               $updated = true;
-       }
+       $args = wp_parse_args($args, $default_args);
+       $instance = wp_parse_args($instance);
 
 
-       if ( -1 == $number ) {
-               $title = '';
-               $text = '';
-               $number = '%i%';
-       } else {
-               $title = attribute_escape($options[$number]['title']);
-               $text = format_to_edit($options[$number]['text']);
-       }
-?>
-               <p>
-                       <input class="widefat" id="text-title-<?php echo $number; ?>" name="widget-text[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
-                       <textarea class="widefat" rows="16" cols="20" id="text-text-<?php echo $number; ?>" name="widget-text[<?php echo $number; ?>][text]"><?php echo $text; ?></textarea>
-                       <input type="hidden" name="widget-text[<?php echo $number; ?>][submit]" value="1" />
-               </p>
-<?php
+       $widget_obj->_set(-1);
+       $widget_obj->widget($args, $instance);
 }
 
 /**
 }
 
 /**
- * Register text widget on startup.
- *
- * @since 2.2.0
+ * Private
  */
  */
-function wp_widget_text_register() {
-       if ( !$options = get_option('widget_text') )
-               $options = array();
-       $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));
-       $control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'text');
-       $name = __('Text');
-
-       $id = false;
-       foreach ( (array) array_keys($options) as $o ) {
-               // Old widgets can have null values for some reason
-               if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) )
-                       continue;
-               $id = "text-$o"; // Never never never translate an id
-               wp_register_sidebar_widget($id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o ));
-               wp_register_widget_control($id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o ));
-       }
-
-       // If there are none, we register the widget's existance with a generic template
-       if ( !$id ) {
-               wp_register_sidebar_widget( 'text-1', $name, 'wp_widget_text', $widget_ops, array( 'number' => -1 ) );
-               wp_register_widget_control( 'text-1', $name, 'wp_widget_text_control', $control_ops, array( 'number' => -1 ) );
-       }
+function _get_widget_id_base($id) {
+       return preg_replace( '/-[0-9]+$/', '', $id );
 }
 }
-
-/**
- * Display categories widget.
- *
- * Allows multiple category widgets.
- *
- * @since 2.2.0
- *
- * @param array $args Widget arguments.
- * @param int $number Widget number.
- */
-function wp_widget_categories($args, $widget_args = 1) {
-       extract($args, EXTR_SKIP);
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract($widget_args, EXTR_SKIP);
-
-       $options = get_option('widget_categories');
-       if ( !isset($options[$number]) )
-               return;
-
-       $c = $options[$number]['count'] ? '1' : '0';
-       $h = $options[$number]['hierarchical'] ? '1' : '0';
-       $d = $options[$number]['dropdown'] ? '1' : '0';
-
-       $title = empty($options[$number]['title']) ? __('Categories') : apply_filters('widget_title', $options[$number]['title']);
-
-       echo $before_widget;
-       echo $before_title . $title . $after_title;
-
-       $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
-
-       if ( $d ) {
-               $cat_args['show_option_none'] = __('Select Category');
-               wp_dropdown_categories($cat_args);
-?>
-
-<script type='text/javascript'>
-/* <![CDATA[ */
-       var dropdown = document.getElementById("cat");
-       function onCatChange() {
-               if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
-                       location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
-               }
-       }
-       dropdown.onchange = onCatChange;
-/* ]]> */
-</script>
-
-<?php
-       } else {
-?>
-               <ul>
-               <?php
-                       $cat_args['title_li'] = '';
-                       wp_list_categories($cat_args);
-               ?>
-               </ul>
-<?php
-       }
-
-       echo $after_widget;
-}
-
-/**
- * Display and process categories widget options form.
- *
- * @since 2.2.0
- *
- * @param int $widget_args Widget number.
- */
-function wp_widget_categories_control( $widget_args ) {
-       global $wp_registered_widgets;
-       static $updated = false;
-
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract($widget_args, EXTR_SKIP);
-
-       $options = get_option('widget_categories');
-
-       if ( !is_array( $options ) )
-               $options = array();
-
-       if ( !$updated && !empty($_POST['sidebar']) ) {
-               $sidebar = (string) $_POST['sidebar'];
-
-               $sidebars_widgets = wp_get_sidebars_widgets();
-               if ( isset($sidebars_widgets[$sidebar]) )
-                       $this_sidebar =& $sidebars_widgets[$sidebar];
-               else
-                       $this_sidebar = array();
-
-               foreach ( (array) $this_sidebar as $_widget_id ) {
-                       if ( 'wp_widget_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
-                               $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
-                               if ( !in_array( "categories-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
-                                       unset($options[$widget_number]);
-                       }
-               }
-
-               foreach ( (array) $_POST['widget-categories'] as $widget_number => $widget_cat ) {
-                       if ( !isset($widget_cat['title']) && isset($options[$widget_number]) ) // user clicked cancel
-                               continue;
-                       $title = trim(strip_tags(stripslashes($widget_cat['title'])));
-                       $count = isset($widget_cat['count']);
-                       $hierarchical = isset($widget_cat['hierarchical']);
-                       $dropdown = isset($widget_cat['dropdown']);
-                       $options[$widget_number] = compact( 'title', 'count', 'hierarchical', 'dropdown' );
-               }
-
-               update_option('widget_categories', $options);
-               $updated = true;
-       }
-
-       if ( -1 == $number ) {
-               $title = '';
-               $count = false;
-               $hierarchical = false;
-               $dropdown = false;
-               $number = '%i%';
-       } else {
-               $title = attribute_escape( $options[$number]['title'] );
-               $count = (bool) $options[$number]['count'];
-               $hierarchical = (bool) $options[$number]['hierarchical'];
-               $dropdown = (bool) $options[$number]['dropdown'];
-       }
-?>
-                       <p>
-                               <label for="categories-title-<?php echo $number; ?>">
-                                       <?php _e( 'Title:' ); ?>
-                                       <input class="widefat" id="categories-title-<?php echo $number; ?>" name="widget-categories[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
-                               </label>
-                       </p>
-
-                       <p>
-                               <label for="categories-dropdown-<?php echo $number; ?>">
-                                       <input type="checkbox" class="checkbox" id="categories-dropdown-<?php echo $number; ?>" name="widget-categories[<?php echo $number; ?>][dropdown]"<?php checked( $dropdown, true ); ?> />
-                                       <?php _e( 'Show as dropdown' ); ?>
-                               </label>
-                               <br />
-                               <label for="categories-count-<?php echo $number; ?>">
-                                       <input type="checkbox" class="checkbox" id="categories-count-<?php echo $number; ?>" name="widget-categories[<?php echo $number; ?>][count]"<?php checked( $count, true ); ?> />
-                                       <?php _e( 'Show post counts' ); ?>
-                               </label>
-                               <br />
-                               <label for="categories-hierarchical-<?php echo $number; ?>">
-                                       <input type="checkbox" class="checkbox" id="categories-hierarchical-<?php echo $number; ?>" name="widget-categories[<?php echo $number; ?>][hierarchical]"<?php checked( $hierarchical, true ); ?> />
-                                       <?php _e( 'Show hierarchy' ); ?>
-                               </label>
-                       </p>
-
-                       <input type="hidden" name="widget-categories[<?php echo $number; ?>][submit]" value="1" />
-<?php
-}
-
-/**
- * Register categories widget on startup.
- *
- * @since 2.3.0
- */
-function wp_widget_categories_register() {
-       if ( !$options = get_option( 'widget_categories' ) )
-               $options = array();
-
-       if ( isset($options['title']) )
-               $options = wp_widget_categories_upgrade();
-
-       $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories" ) );
-
-       $name = __( 'Categories' );
-
-       $id = false;
-       foreach ( (array) array_keys($options) as $o ) {
-               // Old widgets can have null values for some reason
-               if ( !isset($options[$o]['title']) )
-                       continue;
-               $id = "categories-$o";
-               wp_register_sidebar_widget( $id, $name, 'wp_widget_categories', $widget_ops, array( 'number' => $o ) );
-               wp_register_widget_control( $id, $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => $o ) );
-       }
-
-       // If there are none, we register the widget's existance with a generic template
-       if ( !$id ) {
-               wp_register_sidebar_widget( 'categories-1', $name, 'wp_widget_categories', $widget_ops, array( 'number' => -1 ) );
-               wp_register_widget_control( 'categories-1', $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => -1 ) );
-       }
-}
-
-/**
- * Upgrade previous category widget to current version.
- *
- * @since 2.3.0
- *
- * @return array
- */
-function wp_widget_categories_upgrade() {
-       $options = get_option( 'widget_categories' );
-
-       if ( !isset( $options['title'] ) )
-               return $options;
-
-       $newoptions = array( 1 => $options );
-
-       update_option( 'widget_categories', $newoptions );
-
-       $sidebars_widgets = get_option( 'sidebars_widgets' );
-       if ( is_array( $sidebars_widgets ) ) {
-               foreach ( $sidebars_widgets as $sidebar => $widgets ) {
-                       if ( is_array( $widgets ) ) {
-                               foreach ( $widgets as $widget )
-                                       $new_widgets[$sidebar][] = ( $widget == 'categories' ) ? 'categories-1' : $widget;
-                       } else {
-                               $new_widgets[$sidebar] = $widgets;
-                       }
-               }
-               if ( $new_widgets != $sidebars_widgets )
-                       update_option( 'sidebars_widgets', $new_widgets );
-       }
-
-       return $newoptions;
-}
-
-/**
- * Display recent entries widget.
- *
- * @since 2.2.0
- *
- * @param array $args Widget arguments.
- * @return int Displayed cache.
- */
-function wp_widget_recent_entries($args) {
-       if ( '%BEG_OF_TITLE%' != $args['before_title'] ) {
-               if ( $output = wp_cache_get('widget_recent_entries', 'widget') )
-                       return print($output);
-               ob_start();
-       }
-
-       extract($args);
-       $options = get_option('widget_recent_entries');
-       $title = empty($options['title']) ? __('Recent Posts') : apply_filters('widget_title', $options['title']);
-       if ( !$number = (int) $options['number'] )
-               $number = 10;
-       else if ( $number < 1 )
-               $number = 1;
-       else if ( $number > 15 )
-               $number = 15;
-
-       $r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
-       if ($r->have_posts()) :
-?>
-               <?php echo $before_widget; ?>
-                       <?php echo $before_title . $title . $after_title; ?>
-                       <ul>
-                       <?php  while ($r->have_posts()) : $r->the_post(); ?>
-                       <li><a href="<?php the_permalink() ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a></li>
-                       <?php endwhile; ?>
-                       </ul>
-               <?php echo $after_widget; ?>
-<?php
-               wp_reset_query();  // Restore global post data stomped by the_post().
-       endif;
-
-       if ( '%BEG_OF_TITLE%' != $args['before_title'] )
-               wp_cache_add('widget_recent_entries', ob_get_flush(), 'widget');
-}
-
-/**
- * Remove recent entries widget items cache.
- *
- * @since 2.2.0
- */
-function wp_flush_widget_recent_entries() {
-       wp_cache_delete('widget_recent_entries', 'widget');
-}
-
-add_action('save_post', 'wp_flush_widget_recent_entries');
-add_action('deleted_post', 'wp_flush_widget_recent_entries');
-add_action('switch_theme', 'wp_flush_widget_recent_entries');
-
-/**
- * Display and process recent entries widget options form.
- *
- * @since 2.2.0
- */
-function wp_widget_recent_entries_control() {
-       $options = $newoptions = get_option('widget_recent_entries');
-       if ( isset($_POST["recent-entries-submit"]) ) {
-               $newoptions['title'] = strip_tags(stripslashes($_POST["recent-entries-title"]));
-               $newoptions['number'] = (int) $_POST["recent-entries-number"];
-       }
-       if ( $options != $newoptions ) {
-               $options = $newoptions;
-               update_option('widget_recent_entries', $options);
-               wp_flush_widget_recent_entries();
-       }
-       $title = attribute_escape($options['title']);
-       if ( !$number = (int) $options['number'] )
-               $number = 5;
-?>
-
-                       <p><label for="recent-entries-title"><?php _e('Title:'); ?> <input class="widefat" id="recent-entries-title" name="recent-entries-title" type="text" value="<?php echo $title; ?>" /></label></p>
-                       <p>
-                               <label for="recent-entries-number"><?php _e('Number of posts to show:'); ?> <input style="width: 25px; text-align: center;" id="recent-entries-number" name="recent-entries-number" type="text" value="<?php echo $number; ?>" /></label>
-                               <br />
-                               <small><?php _e('(at most 15)'); ?></small>
-                       </p>
-                       <input type="hidden" id="recent-entries-submit" name="recent-entries-submit" value="1" />
-<?php
-}
-
-/**
- * Display recent comments widget.
- *
- * @since 2.2.0
- *
- * @param array $args Widget arguments.
- */
-function wp_widget_recent_comments($args) {
-       global $wpdb, $comments, $comment;
-       extract($args, EXTR_SKIP);
-       $options = get_option('widget_recent_comments');
-       $title = empty($options['title']) ? __('Recent Comments') : apply_filters('widget_title', $options['title']);
-       if ( !$number = (int) $options['number'] )
-               $number = 5;
-       else if ( $number < 1 )
-               $number = 1;
-       else if ( $number > 15 )
-               $number = 15;
-
-       if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
-               $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
-               wp_cache_add( 'recent_comments', $comments, 'widget' );
-       }
-?>
-
-               <?php echo $before_widget; ?>
-                       <?php echo $before_title . $title . $after_title; ?>
-                       <ul id="recentcomments"><?php
-                       if ( $comments ) : foreach ( (array) $comments as $comment) :
-                       echo  '<li class="recentcomments">' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="' . clean_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
-                       endforeach; endif;?></ul>
-               <?php echo $after_widget; ?>
-<?php
-}
-
-/**
- * Remove the cache for recent comments widget.
- *
- * @since 2.2.0
- */
-function wp_delete_recent_comments_cache() {
-       wp_cache_delete( 'recent_comments', 'widget' );
-}
-add_action( 'comment_post', 'wp_delete_recent_comments_cache' );
-add_action( 'wp_set_comment_status', 'wp_delete_recent_comments_cache' );
-
-/**
- * Display and process recent comments widget options form.
- *
- * @since 2.2.0
- */
-function wp_widget_recent_comments_control() {
-       $options = $newoptions = get_option('widget_recent_comments');
-       if ( isset($_POST["recent-comments-submit"]) ) {
-               $newoptions['title'] = strip_tags(stripslashes($_POST["recent-comments-title"]));
-               $newoptions['number'] = (int) $_POST["recent-comments-number"];
-       }
-       if ( $options != $newoptions ) {
-               $options = $newoptions;
-               update_option('widget_recent_comments', $options);
-               wp_delete_recent_comments_cache();
-       }
-       $title = attribute_escape($options['title']);
-       if ( !$number = (int) $options['number'] )
-               $number = 5;
-?>
-                       <p><label for="recent-comments-title"><?php _e('Title:'); ?> <input class="widefat" id="recent-comments-title" name="recent-comments-title" type="text" value="<?php echo $title; ?>" /></label></p>
-                       <p>
-                               <label for="recent-comments-number"><?php _e('Number of comments to show:'); ?> <input style="width: 25px; text-align: center;" id="recent-comments-number" name="recent-comments-number" type="text" value="<?php echo $number; ?>" /></label>
-                               <br />
-                               <small><?php _e('(at most 15)'); ?></small>
-                       </p>
-                       <input type="hidden" id="recent-comments-submit" name="recent-comments-submit" value="1" />
-<?php
-}
-
-/**
- * Display the style for recent comments widget.
- *
- * @since 2.2.0
- */
-function wp_widget_recent_comments_style() {
-?>
-<style type="text/css">.recentcomments a{display:inline !important;padding: 0 !important;margin: 0 !important;}</style>
-<?php
-}
-
-/**
- * Register recent comments with control and hook for 'wp_head' action.
- *
- * @since 2.2.0
- */
-function wp_widget_recent_comments_register() {
-       $widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'The most recent comments' ) );
-       wp_register_sidebar_widget('recent-comments', __('Recent Comments'), 'wp_widget_recent_comments', $widget_ops);
-       wp_register_widget_control('recent-comments', __('Recent Comments'), 'wp_widget_recent_comments_control');
-
-       if ( is_active_widget('wp_widget_recent_comments') )
-               add_action('wp_head', 'wp_widget_recent_comments_style');
-}
-
-/**
- * Display RSS widget.
- *
- * Allows for multiple widgets to be displayed.
- *
- * @since 2.2.0
- *
- * @param array $args Widget arguments.
- * @param int $number Widget number.
- */
-function wp_widget_rss($args, $widget_args = 1) {
-       extract($args, EXTR_SKIP);
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract($widget_args, EXTR_SKIP);
-
-       $options = get_option('widget_rss');
-
-       if ( !isset($options[$number]) )
-               return;
-
-       if ( isset($options[$number]['error']) && $options[$number]['error'] )
-               return;
-
-       $url = $options[$number]['url'];
-       while ( strstr($url, 'http') != $url )
-               $url = substr($url, 1);
-       if ( empty($url) )
-               return;
-
-       require_once(ABSPATH . WPINC . '/rss.php');
-
-       $rss = fetch_rss($url);
-       $link = clean_url(strip_tags($rss->channel['link']));
-       while ( strstr($link, 'http') != $link )
-               $link = substr($link, 1);
-       $desc = attribute_escape(strip_tags(html_entity_decode($rss->channel['description'], ENT_QUOTES)));
-       $title = $options[$number]['title'];
-       if ( empty($title) )
-               $title = htmlentities(strip_tags($rss->channel['title']));
-       if ( empty($title) )
-               $title = $desc;
-       if ( empty($title) )
-               $title = __('Unknown Feed');
-       $title = apply_filters('widget_title', $title );
-       $url = clean_url(strip_tags($url));
-       if ( file_exists(dirname(__FILE__) . '/rss.png') )
-               $icon = str_replace(ABSPATH, site_url() . '/', dirname(__FILE__)) . '/rss.png';
-       else
-               $icon = includes_url('images/rss.png');
-       $title = "<a class='rsswidget' href='$url' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
-
-       echo $before_widget;
-       echo $before_title . $title . $after_title;
-
-       wp_widget_rss_output( $rss, $options[$number] );
-
-       echo $after_widget;
-}
-
-/**
- * Display the RSS entries in a list.
- *
- * @since 2.5.0
- *
- * @param string|array|object $rss RSS url.
- * @param array $args Widget arguments.
- */
-function wp_widget_rss_output( $rss, $args = array() ) {
-       if ( is_string( $rss ) ) {
-               require_once(ABSPATH . WPINC . '/rss.php');
-               if ( !$rss = fetch_rss($rss) )
-                       return;
-       } elseif ( is_array($rss) && isset($rss['url']) ) {
-               require_once(ABSPATH . WPINC . '/rss.php');
-               $args = $rss;
-               if ( !$rss = fetch_rss($rss['url']) )
-                       return;
-       } elseif ( !is_object($rss) ) {
-               return;
-       }
-
-       $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 );
-       $args = wp_parse_args( $args, $default_args );
-       extract( $args, EXTR_SKIP );
-
-       $items = (int) $items;
-       if ( $items < 1 || 20 < $items )
-               $items = 10;
-       $show_summary  = (int) $show_summary;
-       $show_author   = (int) $show_author;
-       $show_date     = (int) $show_date;
-
-       if ( is_array( $rss->items ) && !empty( $rss->items ) ) {
-               $rss->items = array_slice($rss->items, 0, $items);
-               echo '<ul>';
-               foreach ( (array) $rss->items as $item ) {
-                       while ( strstr($item['link'], 'http') != $item['link'] )
-                               $item['link'] = substr($item['link'], 1);
-                       $link = clean_url(strip_tags($item['link']));
-                       $title = attribute_escape(strip_tags($item['title']));
-                       if ( empty($title) )
-                               $title = __('Untitled');
-                       $desc = '';
-                       if ( isset( $item['description'] ) && is_string( $item['description'] ) )
-                               $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES))));
-                       elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) )
-                               $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES))));
-                       if ( 360 < strlen( $desc ) )
-                               $desc = wp_html_excerpt( $desc, 360 ) . ' [&hellip;]';
-                       $summary = $desc;
-
-                       if ( $show_summary ) {
-                               $desc = '';
-                               $summary = wp_specialchars( $summary );
-                               $summary = "<div class='rssSummary'>$summary</div>";
-                       } else {
-                               $summary = '';
-                       }
-
-                       $date = '';
-                       if ( $show_date ) {
-                               if ( isset($item['pubdate']) )
-                                       $date = $item['pubdate'];
-                               elseif ( isset($item['published']) )
-                                       $date = $item['published'];
-
-                               if ( $date ) {
-                                       if ( $date_stamp = strtotime( $date ) )
-                                               $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
-                                       else
-                                               $date = '';
-                               }
-                       }
-
-                       $author = '';
-                       if ( $show_author ) {
-                               if ( isset($item['dc']['creator']) )
-                                       $author = ' <cite>' . wp_specialchars( strip_tags( $item['dc']['creator'] ) ) . '</cite>';
-                               elseif ( isset($item['author_name']) )
-                                       $author = ' <cite>' . wp_specialchars( strip_tags( $item['author_name'] ) ) . '</cite>';
-                       }
-
-                       if ( $link == '' ) {
-                               echo "<li>$title{$date}{$summary}{$author}</li>";
-                       } else {
-                               echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
-                       }
-}
-               echo '</ul>';
-       } else {
-               echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
-       }
-}
-
-/**
- * Display and process RSS widget control form.
- *
- * @since 2.2.0
- *
- * @param int $widget_args Widget number.
- */
-function wp_widget_rss_control($widget_args) {
-       global $wp_registered_widgets;
-       static $updated = false;
-
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract($widget_args, EXTR_SKIP);
-
-       $options = get_option('widget_rss');
-       if ( !is_array($options) )
-               $options = array();
-
-       $urls = array();
-       foreach ( (array) $options as $option )
-               if ( isset($option['url']) )
-                       $urls[$option['url']] = true;
-
-       if ( !$updated && 'POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['sidebar']) ) {
-               $sidebar = (string) $_POST['sidebar'];
-
-               $sidebars_widgets = wp_get_sidebars_widgets();
-               if ( isset($sidebars_widgets[$sidebar]) )
-                       $this_sidebar =& $sidebars_widgets[$sidebar];
-               else
-                       $this_sidebar = array();
-
-               foreach ( (array) $this_sidebar as $_widget_id ) {
-                       if ( 'wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
-                               $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
-                               if ( !in_array( "rss-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
-                                       unset($options[$widget_number]);
-                       }
-               }
-
-               foreach( (array) $_POST['widget-rss'] as $widget_number => $widget_rss ) {
-                       if ( !isset($widget_rss['url']) && isset($options[$widget_number]) ) // user clicked cancel
-                               continue;
-                       $widget_rss = stripslashes_deep( $widget_rss );
-                       $url = sanitize_url(strip_tags($widget_rss['url']));
-                       $options[$widget_number] = wp_widget_rss_process( $widget_rss, !isset($urls[$url]) );
-               }
-
-               update_option('widget_rss', $options);
-               $updated = true;
-       }
-
-       if ( -1 == $number ) {
-               $title = '';
-               $url = '';
-               $items = 10;
-               $error = false;
-               $number = '%i%';
-               $show_summary = 0;
-               $show_author = 0;
-               $show_date = 0;
-       } else {
-               extract( (array) $options[$number] );
-       }
-
-       wp_widget_rss_form( compact( 'number', 'title', 'url', 'items', 'error', 'show_summary', 'show_author', 'show_date' ) );
-}
-
-/**
- * Display RSS widget options form.
- *
- * The options for what fields are displayed for the RSS form are all booleans
- * and are as follows: 'url', 'title', 'items', 'show_summary', 'show_author',
- * 'show_date'.
- *
- * @since 2.5.0
- *
- * @param array|string $args Values for input fields.
- * @param array $inputs Override default display options.
- */
-function wp_widget_rss_form( $args, $inputs = null ) {
-
-       $default_inputs = array( 'url' => true, 'title' => true, 'items' => true, 'show_summary' => true, 'show_author' => true, 'show_date' => true );
-       $inputs = wp_parse_args( $inputs, $default_inputs );
-       extract( $args );
-       extract( $inputs, EXTR_SKIP);
-
-       $number = attribute_escape( $number );
-       $title  = attribute_escape( $title );
-       $url    = attribute_escape( $url );
-       $items  = (int) $items;
-       if ( $items < 1 || 20 < $items )
-               $items  = 10;
-       $show_summary   = (int) $show_summary;
-       $show_author    = (int) $show_author;
-       $show_date      = (int) $show_date;
-
-       if ( $inputs['url'] ) :
-?>
-       <p>
-               <label for="rss-url-<?php echo $number; ?>"><?php _e('Enter the RSS feed URL here:'); ?>
-                       <input class="widefat" id="rss-url-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][url]" type="text" value="<?php echo $url; ?>" />
-               </label>
-       </p>
-<?php endif; if ( $inputs['title'] ) : ?>
-       <p>
-               <label for="rss-title-<?php echo $number; ?>"><?php _e('Give the feed a title (optional):'); ?>
-                       <input class="widefat" id="rss-title-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][title]" type="text" value="<?php echo $title; ?>" />
-               </label>
-       </p>
-<?php endif; if ( $inputs['items'] ) : ?>
-       <p>
-               <label for="rss-items-<?php echo $number; ?>"><?php _e('How many items would you like to display?'); ?>
-                       <select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]">
-                               <?php
-                                       for ( $i = 1; $i <= 20; ++$i )
-                                               echo "<option value='$i' " . ( $items == $i ? "selected='selected'" : '' ) . ">$i</option>";
-                               ?>
-                       </select>
-               </label>
-       </p>
-<?php endif; if ( $inputs['show_summary'] ) : ?>
-       <p>
-               <label for="rss-show-summary-<?php echo $number; ?>">
-                       <input id="rss-show-summary-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_summary]" type="checkbox" value="1" <?php if ( $show_summary ) echo 'checked="checked"'; ?>/>
-                       <?php _e('Display item content?'); ?>
-               </label>
-       </p>
-<?php endif; if ( $inputs['show_author'] ) : ?>
-       <p>
-               <label for="rss-show-author-<?php echo $number; ?>">
-                       <input id="rss-show-author-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_author]" type="checkbox" value="1" <?php if ( $show_author ) echo 'checked="checked"'; ?>/>
-                       <?php _e('Display item author if available?'); ?>
-               </label>
-       </p>
-<?php endif; if ( $inputs['show_date'] ) : ?>
-       <p>
-               <label for="rss-show-date-<?php echo $number; ?>">
-                       <input id="rss-show-date-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][show_date]" type="checkbox" value="1" <?php if ( $show_date ) echo 'checked="checked"'; ?>/>
-                       <?php _e('Display item date?'); ?>
-               </label>
-       </p>
-       <input type="hidden" name="widget-rss[<?php echo $number; ?>][submit]" value="1" />
-<?php
-       endif;
-       foreach ( array_keys($default_inputs) as $input ) :
-               if ( 'hidden' === $inputs[$input] ) :
-                       $id = str_replace( '_', '-', $input );
-?>
-       <input type="hidden" id="rss-<?php echo $id; ?>-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][<?php echo $input; ?>]" value="<?php echo $$input; ?>" />
-<?php
-               endif;
-       endforeach;
-}
-
-/**
- * Process RSS feed widget data and optionally retrieve feed items.
- *
- * The feed widget can not have more than 20 items or it will reset back to the
- * default, which is 10.
- *
- * The resulting array has the feed title, feed url, feed link (from channel),
- * feed items, error (if any), and whether to show summary, author, and date.
- * All respectively in the order of the array elements.
- *
- * @since 2.5.0
- *
- * @param array $widget_rss RSS widget feed data. Expects unescaped data.
- * @param bool $check_feed Optional, default is true. Whether to check feed for errors.
- * @return array
- */
-function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
-       $items = (int) $widget_rss['items'];
-       if ( $items < 1 || 20 < $items )
-               $items = 10;
-       $url           = sanitize_url(strip_tags( $widget_rss['url'] ));
-       $title         = trim(strip_tags( $widget_rss['title'] ));
-       $show_summary  = (int) $widget_rss['show_summary'];
-       $show_author   = (int) $widget_rss['show_author'];
-       $show_date     = (int) $widget_rss['show_date'];
-
-       if ( $check_feed ) {
-               require_once(ABSPATH . WPINC . '/rss.php');
-               $rss = fetch_rss($url);
-               $error = false;
-               $link = '';
-               if ( !is_object($rss) ) {
-                       $url = wp_specialchars(__('Error: could not find an RSS or ATOM feed at that URL.'), 1);
-                       $error = sprintf(__('Error in RSS %1$d'), $widget_number );
-               } else {
-                       $link = clean_url(strip_tags($rss->channel['link']));
-                       while ( strstr($link, 'http') != $link )
-                               $link = substr($link, 1);
-               }
-       }
-
-       return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' );
-}
-
-/**
- * Register RSS widget to allow multiple RSS widgets on startup.
- *
- * @since 2.2.0
- */
-function wp_widget_rss_register() {
-       if ( !$options = get_option('widget_rss') )
-               $options = array();
-       $widget_ops = array('classname' => 'widget_rss', 'description' => __( 'Entries from any RSS or Atom feed' ));
-       $control_ops = array('width' => 400, 'height' => 200, 'id_base' => 'rss');
-       $name = __('RSS');
-
-       $id = false;
-       foreach ( (array) array_keys($options) as $o ) {
-               // Old widgets can have null values for some reason
-               if ( !isset($options[$o]['url']) || !isset($options[$o]['title']) || !isset($options[$o]['items']) )
-                       continue;
-               $id = "rss-$o"; // Never never never translate an id
-               wp_register_sidebar_widget($id, $name, 'wp_widget_rss', $widget_ops, array( 'number' => $o ));
-               wp_register_widget_control($id, $name, 'wp_widget_rss_control', $control_ops, array( 'number' => $o ));
-       }
-
-       // If there are none, we register the widget's existance with a generic template
-       if ( !$id ) {
-               wp_register_sidebar_widget( 'rss-1', $name, 'wp_widget_rss', $widget_ops, array( 'number' => -1 ) );
-               wp_register_widget_control( 'rss-1', $name, 'wp_widget_rss_control', $control_ops, array( 'number' => -1 ) );
-       }
-}
-
-/**
- * Display tag cloud widget.
- *
- * @since 2.3.0
- *
- * @param array $args Widget arguments.
- */
-function wp_widget_tag_cloud($args) {
-       extract($args);
-       $options = get_option('widget_tag_cloud');
-       $title = empty($options['title']) ? __('Tags') : apply_filters('widget_title', $options['title']);
-
-       echo $before_widget;
-       echo $before_title . $title . $after_title;
-       wp_tag_cloud();
-       echo $after_widget;
-}
-
-/**
- * Manage WordPress Tag Cloud widget options.
- *
- * Displays management form for changing the tag cloud widget title.
- *
- * @since 2.3.0
- */
-function wp_widget_tag_cloud_control() {
-       $options = $newoptions = get_option('widget_tag_cloud');
-
-       if ( isset($_POST['tag-cloud-submit']) ) {
-               $newoptions['title'] = strip_tags(stripslashes($_POST['tag-cloud-title']));
-       }
-
-       if ( $options != $newoptions ) {
-               $options = $newoptions;
-               update_option('widget_tag_cloud', $options);
-       }
-
-       $title = attribute_escape( $options['title'] );
-?>
-       <p><label for="tag-cloud-title">
-       <?php _e('Title:') ?> <input type="text" class="widefat" id="tag-cloud-title" name="tag-cloud-title" value="<?php echo $title ?>" /></label>
-       </p>
-       <input type="hidden" name="tag-cloud-submit" id="tag-cloud-submit" value="1" />
-<?php
-}
-
-/**
- * Register all of the default WordPress widgets on startup.
- *
- * Calls 'widgets_init' action after all of the WordPress widgets have been
- * registered.
- *
- * @since 2.2.0
- */
-function wp_widgets_init() {
-       if ( !is_blog_installed() )
-               return;
-
-       $widget_ops = array('classname' => 'widget_pages', 'description' => __( "Your blog's WordPress Pages") );
-       wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $widget_ops);
-       wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control' );
-
-       $widget_ops = array('classname' => 'widget_calendar', 'description' => __( "A calendar of your blog's posts") );
-       wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $widget_ops);
-       wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control' );
-
-       $widget_ops = array('classname' => 'widget_archive', 'description' => __( "A monthly archive of your blog's posts") );
-       wp_register_sidebar_widget('archives', __('Archives'), 'wp_widget_archives', $widget_ops);
-       wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control' );
-
-       $widget_ops = array('classname' => 'widget_links', 'description' => __( "Your blogroll") );
-       wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $widget_ops);
-
-       $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
-       wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops);
-       wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control' );
-
-       $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") );
-       wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $widget_ops);
-
-       $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your blog") );
-       wp_register_sidebar_widget('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries', $widget_ops);
-       wp_register_widget_control('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries_control' );
-
-       $widget_ops = array('classname' => 'widget_tag_cloud', 'description' => __( "Your most used tags in cloud format") );
-       wp_register_sidebar_widget('tag_cloud', __('Tag Cloud'), 'wp_widget_tag_cloud', $widget_ops);
-       wp_register_widget_control('tag_cloud', __('Tag Cloud'), 'wp_widget_tag_cloud_control' );
-
-       wp_widget_categories_register();
-       wp_widget_text_register();
-       wp_widget_rss_register();
-       wp_widget_recent_comments_register();
-
-       do_action('widgets_init');
-}
-
-add_action('init', 'wp_widgets_init', 1);
-
-/*
- * Pattern for multi-widget (allows multiple instances such as the text widget).
- *
- * Make sure to close the comments after copying.
-
-/**
- * Displays widget.
- *
- * Supports multiple widgets.
- *
- * @param array $args Widget arguments.
- * @param array|int $widget_args Widget number. Which of the several widgets of this type do we mean.
- * /
-function widget_many( $args, $widget_args = 1 ) {
-       extract( $args, EXTR_SKIP );
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract( $widget_args, EXTR_SKIP );
-
-       // Data should be stored as array:  array( number => data for that instance of the widget, ... )
-       $options = get_option('widget_many');
-       if ( !isset($options[$number]) )
-               return;
-
-       echo $before_widget;
-
-       // Do stuff for this widget, drawing data from $options[$number]
-
-       echo $after_widget;
-}
-
-/**
- * Displays form for a particular instance of the widget.
- *
- * Also updates the data after a POST submit.
- *
- * @param array|int $widget_args Widget number. Which of the several widgets of this type do we mean.
- * /
-function widget_many_control( $widget_args = 1 ) {
-       global $wp_registered_widgets;
-       static $updated = false; // Whether or not we have already updated the data after a POST submit
-
-       if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widget_args );
-       $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
-       extract( $widget_args, EXTR_SKIP );
-
-       // Data should be stored as array:  array( number => data for that instance of the widget, ... )
-       $options = get_option('widget_many');
-       if ( !is_array($options) )
-               $options = array();
-
-       // We need to update the data
-       if ( !$updated && !empty($_POST['sidebar']) ) {
-               // Tells us what sidebar to put the data in
-               $sidebar = (string) $_POST['sidebar'];
-
-               $sidebars_widgets = wp_get_sidebars_widgets();
-               if ( isset($sidebars_widgets[$sidebar]) )
-                       $this_sidebar =& $sidebars_widgets[$sidebar];
-               else
-                       $this_sidebar = array();
-
-               foreach ( $this_sidebar as $_widget_id ) {
-                       // Remove all widgets of this type from the sidebar.  We'll add the new data in a second.  This makes sure we don't get any duplicate data
-                       // since widget ids aren't necessarily persistent across multiple updates
-                       if ( 'widget_many' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
-                               $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
-                               if ( !in_array( "many-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed. "many-$widget_number" is "{id_base}-{widget_number}
-                                       unset($options[$widget_number]);
-                       }
-               }
-
-               foreach ( (array) $_POST['widget-many'] as $widget_number => $widget_many_instance ) {
-                       // compile data from $widget_many_instance
-                       if ( !isset($widget_many_instance['something']) && isset($options[$widget_number]) ) // user clicked cancel
-                               continue;
-                       $something = wp_specialchars( $widget_many_instance['something'] );
-                       $options[$widget_number] = array( 'something' => $something );  // Even simple widgets should store stuff in array, rather than in scalar
-               }
-
-               update_option('widget_many', $options);
-
-               $updated = true; // So that we don't go through this more than once
-       }
-
-
-       // Here we echo out the form
-       if ( -1 == $number ) { // We echo out a template for a form which can be converted to a specific form later via JS
-               $something = '';
-               $number = '%i%';
-       } else {
-               $something = attribute_escape($options[$number]['something']);
-       }
-
-       // The form has inputs with names like widget-many[$number][something] so that all data for that instance of
-       // the widget are stored in one $_POST variable: $_POST['widget-many'][$number]
-?>
-               <p>
-                       <input class="widefat" id="widget-many-something-<?php echo $number; ?>" name="widget-many[<?php echo $number; ?>][something]" type="text" value="<?php echo $data; ?>" />
-                       <input type="hidden" id="widget-many-submit-<?php echo $number; ?>" name="widget-many[<?php echo $number; ?>][submit]" value="1" />
-               </p>
-<?php
-}
-
-/**
- * Registers each instance of our widget on startup.
- * /
-function widget_many_register() {
-       if ( !$options = get_option('widget_many') )
-               $options = array();
-
-       $widget_ops = array('classname' => 'widget_many', 'description' => __('Widget which allows multiple instances'));
-       $control_ops = array('width' => 400, 'height' => 350, 'id_base' => 'many');
-       $name = __('Many');
-
-       $registered = false;
-       foreach ( array_keys($options) as $o ) {
-               // Old widgets can have null values for some reason
-               if ( !isset($options[$o]['something']) ) // we used 'something' above in our exampple.  Replace with with whatever your real data are.
-                       continue;
-
-               // $id should look like {$id_base}-{$o}
-               $id = "many-$o"; // Never never never translate an id
-               $registered = true;
-               wp_register_sidebar_widget( $id, $name, 'widget_many', $widget_ops, array( 'number' => $o ) );
-               wp_register_widget_control( $id, $name, 'widget_many_control', $control_ops, array( 'number' => $o ) );
-       }
-
-       // If there are none, we register the widget's existance with a generic template
-       if ( !$registered ) {
-               wp_register_sidebar_widget( 'many-1', $name, 'widget_many', $widget_ops, array( 'number' => -1 ) );
-               wp_register_widget_control( 'many-1', $name, 'widget_many_control', $control_ops, array( 'number' => -1 ) );
-       }
-}
-
-// This is important
-add_action( 'widgets_init', 'widget_many_register' );
-
-*/
-
-?>
index ccd3a6ef041a4e458de06db32d8f242a96780468..a4ff757c8cf7d186fb26ee606fd4a33e17633f8f 100644 (file)
@@ -254,6 +254,20 @@ class wpdb {
        var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
                        'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
 
        var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
                        'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
 
+       /**
+        * Format specifiers for DB columns. Columns not listed here default to %s.  Initialized in wp-settings.php.
+        *
+        * Keys are colmn names, values are format types: 'ID' => '%d'
+        *
+        * @since 2.8.0
+        * @see wpdb:prepare()
+        * @see wpdb:insert()
+        * @see wpdb:update()
+        * @access public
+        * @war array
+        */
+       var $field_types = array();
+
        /**
         * Database table columns charset
         *
        /**
         * Database table columns charset
         *
@@ -272,6 +286,15 @@ class wpdb {
         */
        var $collate;
 
         */
        var $collate;
 
+       /**
+        * Whether to use mysql_real_escape_string
+        *
+        * @since 2.8.0
+        * @access public
+        * @var bool
+        */
+       var $real_escape = false;
+
        /**
         * Connects to the database server and selects a database
         *
        /**
         * Connects to the database server and selects a database
         *
@@ -333,16 +356,17 @@ class wpdb {
                $this->ready = true;
 
                if ( $this->has_cap( 'collation' ) ) {
                $this->ready = true;
 
                if ( $this->has_cap( 'collation' ) ) {
-                       $collation_query = '';
                        if ( !empty($this->charset) ) {
                        if ( !empty($this->charset) ) {
-                               $collation_query = "SET NAMES '{$this->charset}'";
-                               if (!empty($this->collate) )
-                                       $collation_query .= " COLLATE '{$this->collate}'";
+                               if ( function_exists('mysql_set_charset') ) {
+                                       mysql_set_charset($this->charset, $this->dbh);
+                                       $this->real_escape = true;
+                               } else {
+                                       $collation_query = "SET NAMES '{$this->charset}'";
+                                       if ( !empty($this->collate) )
+                                               $collation_query .= " COLLATE '{$this->collate}'";
+                                       $this->query($collation_query);
+                               }
                        }
                        }
-
-                       if ( !empty($collation_query) )
-                               $this->query($collation_query);
-
                }
 
                $this->select($dbname);
                }
 
                $this->select($dbname);
@@ -363,12 +387,12 @@ class wpdb {
         * Sets the table prefix for the WordPress tables.
         *
         * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to
         * Sets the table prefix for the WordPress tables.
         *
         * Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to
-        * override the WordPress users and usersmeta tables.
+        * override the WordPress users and usersmeta tables that would otherwise be determined by the $prefix.
         *
         * @since 2.5.0
         *
         * @param string $prefix Alphanumeric name for the new prefix.
         *
         * @since 2.5.0
         *
         * @param string $prefix Alphanumeric name for the new prefix.
-        * @return string Old prefix
+        * @return string|WP_Error Old prefix or WP_Error on error
         */
        function set_prefix($prefix) {
 
         */
        function set_prefix($prefix) {
 
@@ -417,23 +441,53 @@ class wpdb {
                }
        }
 
                }
        }
 
+       function _weak_escape($string) {
+               return addslashes($string);
+       }
+
+       function _real_escape($string) {
+               if ( $this->dbh && $this->real_escape )
+                       return mysql_real_escape_string( $string, $this->dbh );
+               else
+                       return addslashes( $string );
+       }
+
+       function _escape($data) {
+               if ( is_array($data) ) {
+                       foreach ( (array) $data as $k => $v ) {
+                               if ( is_array($v) )
+                                       $data[$k] = $this->_escape( $v );
+                               else
+                                       $data[$k] = $this->_real_escape( $v );
+                       }
+               } else {
+                       $data = $this->_real_escape( $data );
+               }
+
+               return $data;
+       }
+
        /**
        /**
-        * Escapes content for insertion into the database, for security
+        * Escapes content for insertion into the database using addslashes(), for security
         *
         * @since 0.71
         *
         *
         * @since 0.71
         *
-        * @param string $string
+        * @param string|array $data
         * @return string query safe string
         */
         * @return string query safe string
         */
-       function escape($string) {
-               return addslashes( $string );
-               // Disable rest for now, causing problems
-               /*
-               if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' )
-                       return mysql_escape_string( $string );
-               else
-                       return mysql_real_escape_string( $string, $this->dbh );
-               */
+       function escape($data) {
+               if ( is_array($data) ) {
+                       foreach ( (array) $data as $k => $v ) {
+                               if ( is_array($v) )
+                                       $data[$k] = $this->escape( $v );
+                               else
+                                       $data[$k] = $this->_weak_escape( $v );
+                       }
+               } else {
+                       $data = $this->_weak_escape( $data );
+               }
+
+               return $data;
        }
 
        /**
        }
 
        /**
@@ -443,25 +497,41 @@ class wpdb {
         *
         * @param string $s
         */
         *
         * @param string $s
         */
-       function escape_by_ref(&$s) {
-               $s = $this->escape($s);
+       function escape_by_ref(&$string) {
+               $string = $this->_real_escape( $string );
        }
 
        /**
        }
 
        /**
-        * Prepares a SQL query for safe use, using sprintf() syntax.
+        * Prepares a SQL query for safe execution.  Uses sprintf()-like syntax.
+        *
+        * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string).
+        * Does not support sign, padding, alignment, width or precision specifiers.
+        * Does not support argument numbering/swapping.
         *
         *
-        * @link http://php.net/sprintf See for syntax to use for query string.
+        * May be called like {@link http://php.net/sprintf sprintf()} or like {@link http://php.net/vsprintf vsprintf()}.
+        *
+        * Both %d and %s should be left unquoted in the query string.
+        *
+        * <code>
+        * wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", "foo", 1337 )
+        * </code>
+        *
+        * @link http://php.net/sprintf Description of syntax.
         * @since 2.3.0
         *
         * @since 2.3.0
         *
-        * @param null|string $args If string, first parameter must be query statement
-        * @param mixed $args,... If additional parameters, they will be set inserted into the query.
+        * @param string $query Query statement with sprintf()-like placeholders
+        * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
+        * @param mixed $args,... further variables to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
         * @return null|string Sanitized query string
         */
         * @return null|string Sanitized query string
         */
-       function prepare($args=null) {
-               if ( is_null( $args ) )
+       function prepare($query = null) { // ( $query, *$args )
+               if ( is_null( $query ) )
                        return;
                $args = func_get_args();
                        return;
                $args = func_get_args();
-               $query = array_shift($args);
+               array_shift($args);
+               // If args were passed as an array (as in vsprintf), move them up
+               if ( isset($args[0]) && is_array($args[0]) )
+                       $args = $args[0];
                $query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it
                $query = str_replace('"%s"', '%s', $query); // doublequote unquoting
                $query = str_replace('%s', "'%s'", $query); // quote the strings
                $query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it
                $query = str_replace('"%s"', '%s', $query); // doublequote unquoting
                $query = str_replace('%s', "'%s'", $query); // quote the strings
@@ -580,7 +650,7 @@ class wpdb {
         * @since 0.71
         *
         * @param string $query
         * @since 0.71
         *
         * @param string $query
-        * @return unknown
+        * @return int|false Number of rows affected/selected or false on error
         */
        function query($query) {
                if ( ! $this->ready )
         */
        function query($query) {
                if ( ! $this->ready )
@@ -650,61 +720,99 @@ class wpdb {
        }
 
        /**
        }
 
        /**
-        * Insert an array of data into a table.
+        * Insert a row into a table.
+        *
+        * <code>
+        * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
+        * </code>
         *
         * @since 2.5.0
         *
         * @since 2.5.0
+        * @see wpdb::prepare()
         *
         *
-        * @param string $table WARNING: not sanitized!
-        * @param array $data Should not already be SQL-escaped
-        * @return mixed Results of $this->query()
+        * @param string $table table name
+        * @param array $data Data to insert (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+        * @param array|string $format (optional) An array of formats to be mapped to each of the value in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
+        * @return int|false The number of rows inserted, or false on error.
         */
         */
-       function insert($table, $data) {
-               $data = add_magic_quotes($data);
+       function insert($table, $data, $format = null) {
+               $formats = $format = (array) $format;
                $fields = array_keys($data);
                $fields = array_keys($data);
-               return $this->query("INSERT INTO $table (`" . implode('`,`',$fields) . "`) VALUES ('".implode("','",$data)."')");
+               $formatted_fields = array();
+               foreach ( $fields as $field ) {
+                       if ( !empty($format) )
+                               $form = ( $form = array_shift($formats) ) ? $form : $format[0];
+                       elseif ( isset($this->field_types[$field]) )
+                               $form = $this->field_types[$field];
+                       else
+                               $form = '%s';
+                       $formatted_fields[] = $form;
+               }
+               $sql = "INSERT INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')";
+               return $this->query( $this->prepare( $sql, $data) );
        }
 
        }
 
+
        /**
        /**
-        * Update a row in the table with an array of data.
+        * Update a row in the table
         *
         *
-        * @since 2.5.0
+        * <code>
+        * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
+        * </code>
         *
         *
-        * @param string $table WARNING: not sanitized!
-        * @param array $data Should not already be SQL-escaped
-        * @param array $where A named array of WHERE column => value relationships.  Multiple member pairs will be joined with ANDs.  WARNING: the column names are not currently sanitized!
-        * @return mixed Results of $this->query()
+        * @since 2.5.0
+        * @see wpdb::prepare()
+        *
+        * @param string $table table name
+        * @param array $data Data to update (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+        * @param array $where A named array of WHERE clauses (in column => value pairs).  Multiple clauses will be joined with ANDs.  Both $where columns and $where values should be "raw".
+        * @param array|string $format (optional) An array of formats to be mapped to each of the values in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
+        * @param array|string $format_where (optional) An array of formats to be mapped to each of the values in $where.  If string, that format will be used for all of  the items in $where.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $where will be treated as strings.
+        * @return int|false The number of rows updated, or false on error.
         */
         */
-       function update($table, $data, $where){
-               $data = add_magic_quotes($data);
+       function update($table, $data, $where, $format = null, $where_format = null) {
+               if ( !is_array( $where ) )
+                       return false;
+
+               $formats = $format = (array) $format;
                $bits = $wheres = array();
                $bits = $wheres = array();
-               foreach ( (array) array_keys($data) as $k )
-                       $bits[] = "`$k` = '$data[$k]'";
+               foreach ( (array) array_keys($data) as $field ) {
+                       if ( !empty($format) )
+                               $form = ( $form = array_shift($formats) ) ? $form : $format[0];
+                       elseif ( isset($this->field_types[$field]) )
+                               $form = $this->field_types[$field];
+                       else
+                               $form = '%s';
+                       $bits[] = "`$field` = {$form}";
+               }
 
 
-               if ( is_array( $where ) )
-                       foreach ( $where as $c => $v )
-                               $wheres[] = "$c = '" . $this->escape( $v ) . "'";
-               else
-                       return false;
+               $where_formats = $where_format = (array) $where_format;
+               foreach ( (array) array_keys($where) as $field ) {
+                       if ( !empty($where_format) )
+                               $form = ( $form = array_shift($where_formats) ) ? $form : $where_format[0];
+                       elseif ( isset($this->field_types[$field]) )
+                               $form = $this->field_types[$field];
+                       else
+                               $form = '%s';
+                       $wheres[] = "`$field` = {$form}";
+               }
 
 
-               return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) );
+               $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
+               return $this->query( $this->prepare( $sql, array_merge(array_values($data), array_values($where))) );
        }
 
        /**
         * Retrieve one variable from the database.
         *
        }
 
        /**
         * Retrieve one variable from the database.
         *
-        * This combines the functionality of wpdb::get_row() and wpdb::get_col(),
-        * so both the column and row can be picked.
-        *
-        * It is possible to use this function without executing more queries. If
-        * you already made a query, you can set the $query to 'null' value and just
-        * retrieve either the column and row of the last query result.
+        * Executes a SQL query and returns the value from the SQL result.
+        * If the SQL result contains more than one column and/or more than one row, this function returns the value in the column and row specified.
+        * If $query is null, this function returns the value in the specified column and row from the previous SQL result.
         *
         * @since 0.71
         *
         *
         * @since 0.71
         *
-        * @param string $query Can be null as well, for caching
-        * @param int $x Column num to return
-        * @param int $y Row num to return
-        * @return mixed Database query results
+        * @param string|null $query SQL query.  If null, use the result from the previous query.
+        * @param int $x (optional) Column of value to return.  Indexed from 0.
+        * @param int $y (optional) Row of value to return.  Indexed from 0.
+        * @return string Database query result
         */
        function get_var($query=null, $x = 0, $y = 0) {
                $this->func_call = "\$db->get_var(\"$query\",$x,$y)";
         */
        function get_var($query=null, $x = 0, $y = 0) {
                $this->func_call = "\$db->get_var(\"$query\",$x,$y)";
@@ -723,12 +831,14 @@ class wpdb {
        /**
         * Retrieve one row from the database.
         *
        /**
         * Retrieve one row from the database.
         *
+        * Executes a SQL query and returns the row from the SQL result.
+        *
         * @since 0.71
         *
         * @since 0.71
         *
-        * @param string $query SQL query
-        * @param string $output ARRAY_A | ARRAY_N | OBJECT
-        * @param int $y Row num to return
-        * @return mixed Database query results
+        * @param string|null $query SQL query.
+        * @param string $output (optional) one of ARRAY_A | ARRAY_N | OBJECT constants.  Return an associative array (column => value, ...), a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively.
+        * @param int $y (optional) Row to return.  Indexed from 0.
+        * @return mixed Database query result in format specifed by $output
         */
        function get_row($query = null, $output = OBJECT, $y = 0) {
                $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
         */
        function get_row($query = null, $output = OBJECT, $y = 0) {
                $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
@@ -754,11 +864,15 @@ class wpdb {
        /**
         * Retrieve one column from the database.
         *
        /**
         * Retrieve one column from the database.
         *
+        * Executes a SQL query and returns the column from the SQL result.
+        * If the SQL result contains more than one column, this function returns the column specified.
+        * If $query is null, this function returns the specified column from the previous SQL result.
+        *
         * @since 0.71
         *
         * @since 0.71
         *
-        * @param string $query Can be null as well, for caching
-        * @param int $x Col num to return. Starts from 0.
-        * @return array Column results
+        * @param string|null $query SQL query.  If null, use the result from the previous query.
+        * @param int $x Column to return.  Indexed from 0.
+        * @return array Database query result.  Array indexed from 0 by SQL result row number.
         */
        function get_col($query = null , $x = 0) {
                if ( $query )
         */
        function get_col($query = null , $x = 0) {
                if ( $query )
@@ -773,12 +887,14 @@ class wpdb {
        }
 
        /**
        }
 
        /**
-        * Retrieve an entire result set from the database.
+        * Retrieve an entire SQL result set from the database (i.e., many rows)
+        *
+        * Executes a SQL query and returns the entire SQL result.
         *
         * @since 0.71
         *
         *
         * @since 0.71
         *
-        * @param string|null $query Can also be null to pull from the cache
-        * @param string $output ARRAY_A | ARRAY_N | OBJECT_K | OBJECT
+        * @param string $query SQL query.
+        * @param string $output (optional) ane of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants.  With one of the first three, return an array of rows indexed from 0 by SQL result row number.  Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively.  With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value.  Duplicate keys are discarded.
         * @return mixed Database query results
         */
        function get_results($query = null, $output = OBJECT) {
         * @return mixed Database query results
         */
        function get_results($query = null, $output = OBJECT) {
@@ -849,7 +965,7 @@ class wpdb {
         *
         * @since 1.5.0
         *
         *
         * @since 1.5.0
         *
-        * @return bool Always returns true
+        * @return true
         */
        function timer_start() {
                $mtime = microtime();
         */
        function timer_start() {
                $mtime = microtime();
@@ -874,12 +990,14 @@ class wpdb {
        }
 
        /**
        }
 
        /**
-        * Wraps fatal errors in a nice header and footer and dies.
+        * Wraps errors in a nice header and footer and dies.
+        *
+        * Will not die if wpdb::$show_errors is true
         *
         * @since 1.5.0
         *
         * @param string $message
         *
         * @since 1.5.0
         *
         * @param string $message
-        * @return unknown
+        * @return false|void
         */
        function bail($message) {
                if ( !$this->show_errors ) {
         */
        function bail($message) {
                if ( !$this->show_errors ) {
@@ -893,7 +1011,7 @@ class wpdb {
        }
 
        /**
        }
 
        /**
-        * Whether or not MySQL database is minimal required version.
+        * Whether or not MySQL database is at least the required minimum version.
         *
         * @since 2.5.0
         * @uses $wp_version
         *
         * @since 2.5.0
         * @uses $wp_version
@@ -909,7 +1027,7 @@ class wpdb {
        }
 
        /**
        }
 
        /**
-        * Whether of not the database version supports collation.
+        * Whether of not the database supports collation.
         *
         * Called when WordPress is generating the table scheme.
         *
         *
         * Called when WordPress is generating the table scheme.
         *
@@ -925,7 +1043,7 @@ class wpdb {
        /**
         * Generic function to determine if a database supports a particular feature
         * @param string $db_cap the feature
        /**
         * Generic function to determine if a database supports a particular feature
         * @param string $db_cap the feature
-        * @param false|string|resource $dbh_or_table the databaese (the current database, the database housing the specified table, or the database of the mysql resource)
+        * @param false|string|resource $dbh_or_table (not implemented) Which database to test.  False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
         * @return bool
         */
        function has_cap( $db_cap ) {
         * @return bool
         */
        function has_cap( $db_cap ) {
@@ -976,6 +1094,7 @@ class wpdb {
 
        /**
         * The database version number
 
        /**
         * The database version number
+        * @param false|string|resource $dbh_or_table (not implemented) Which database to test.  False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
         * @return false|string false on failure, version number on success
         */
        function db_version() {
         * @return false|string false on failure, version number on success
         */
        function db_version() {
index f536d61650e5a09362867dbd9a6f2ed2c31e4718..b9170528ce7bda2099e26f5f0eadccb96d4648a0 100644 (file)
@@ -29,7 +29,7 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
 <?php the_generator( 'comment' ); ?>
 <opml version="1.0">
        <head>
 <?php the_generator( 'comment' ); ?>
 <opml version="1.0">
        <head>
-               <title>Links for <?php echo attribute_escape(get_bloginfo('name', 'display').$cat_name); ?></title>
+               <title>Links for <?php echo esc_attr(get_bloginfo('name', 'display').$cat_name); ?></title>
                <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
        </head>
        <body>
                <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
        </head>
        <body>
@@ -44,14 +44,14 @@ foreach ((array) $cats as $cat) {
        $catname = apply_filters('link_category', $cat->name);
 
 ?>
        $catname = apply_filters('link_category', $cat->name);
 
 ?>
-<outline type="category" title="<?php echo attribute_escape($catname); ?>">
+<outline type="category" title="<?php echo esc_attr($catname); ?>">
 <?php
 
        $bookmarks = get_bookmarks("category={$cat->term_id}");
        foreach ((array) $bookmarks as $bookmark) {
 <?php
 
        $bookmarks = get_bookmarks("category={$cat->term_id}");
        foreach ((array) $bookmarks as $bookmark) {
-               $title = attribute_escape(apply_filters('link_title', $bookmark->link_name));
+               $title = esc_attr(apply_filters('link_title', $bookmark->link_name));
 ?>
 ?>
-       <outline text="<?php echo $title; ?>" type="link" xmlUrl="<?php echo attribute_escape($bookmark->link_rss); ?>" htmlUrl="<?php echo attribute_escape($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
+       <outline text="<?php echo $title; ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
 <?php
 
        }
 <?php
 
        }
index 8e9768f8c386a2bc324a97b7d6d98a0f0af2381c..aee3b39f59f16ba0ac47330234562b43307de61a 100644 (file)
 /** Define ABSPATH as this files directory */
 define( 'ABSPATH', dirname(__FILE__) . '/' );
 
 /** Define ABSPATH as this files directory */
 define( 'ABSPATH', dirname(__FILE__) . '/' );
 
-error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
+if ( defined('E_RECOVERABLE_ERROR') )
+       error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
+else
+       error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
 
 if ( file_exists( ABSPATH . 'wp-config.php') ) {
 
        /** The config file resides in ABSPATH */
        require_once( ABSPATH . 'wp-config.php' );
 
 
 if ( file_exists( ABSPATH . 'wp-config.php') ) {
 
        /** The config file resides in ABSPATH */
        require_once( ABSPATH . 'wp-config.php' );
 
-} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-load.php' ) ) {
+} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
 
 
-       /** The config file resides one level below ABSPATH */
+       /** The config file resides one level above ABSPATH but is not part of another install*/
        require_once( dirname(ABSPATH) . '/wp-config.php' );
 
 } else {
        require_once( dirname(ABSPATH) . '/wp-config.php' );
 
 } else {
@@ -43,7 +46,8 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) {
        require_once( ABSPATH . '/wp-includes/classes.php' );
        require_once( ABSPATH . '/wp-includes/functions.php' );
        require_once( ABSPATH . '/wp-includes/plugin.php' );
        require_once( ABSPATH . '/wp-includes/classes.php' );
        require_once( ABSPATH . '/wp-includes/functions.php' );
        require_once( ABSPATH . '/wp-includes/plugin.php' );
-       wp_die(sprintf(/*WP_I18N_NO_CONFIG*/"There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%ssetup-config.php' class='button'>Create a Configuration File</a>"/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/"WordPress &rsaquo; Error"/*/WP_I18N_ERROR_TITLE*/);
+       $text_direction = /*WP_I18N_TEXT_DIRECTION*/"ltr"/*/WP_I18N_TEXT_DIRECTION*/;
+       wp_die(sprintf(/*WP_I18N_NO_CONFIG*/"There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%ssetup-config.php' class='button'>Create a Configuration File</a>"/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/"WordPress &rsaquo; Error"/*/WP_I18N_ERROR_TITLE*/, array('text_direction' => $text_direction));
 
 }
 
 
 }
 
index dab6324f4bb891c9e968ca94b0b194001964fcad..62898123f2cb2f77ae85050225f1c329671c4565 100644 (file)
@@ -8,7 +8,7 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-/** Make sure that the WordPress bootstrap has ran before continuing. */
+/** Make sure that the WordPress bootstrap has run before continuing. */
 require( dirname(__FILE__) . '/wp-load.php' );
 
 // Redirect to https login if forced to use SSL
 require( dirname(__FILE__) . '/wp-load.php' );
 
 // Redirect to https login if forced to use SSL
@@ -39,7 +39,11 @@ if ( force_ssl_admin() && !is_ssl() ) {
  * @param WP_Error $wp_error Optional. WordPress Error Object
  */
 function login_header($title = 'Log In', $message = '', $wp_error = '') {
  * @param WP_Error $wp_error Optional. WordPress Error Object
  */
 function login_header($title = 'Log In', $message = '', $wp_error = '') {
-       global $error;
+       global $error, $is_iphone;
+
+       // Don't index any of these forms
+       add_filter( 'pre_option_blog_public', create_function( '$a', 'return 0;' ) );
+       add_action( 'login_head', 'noindex' );
 
        if ( empty($wp_error) )
                $wp_error = new WP_Error();
 
        if ( empty($wp_error) )
                $wp_error = new WP_Error();
@@ -52,13 +56,25 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
        <?php
        wp_admin_css( 'login', true );
        wp_admin_css( 'colors-fresh', true );
        <?php
        wp_admin_css( 'login', true );
        wp_admin_css( 'colors-fresh', true );
+
+       if ( $is_iphone ) {
+       ?>
+       <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" /> 
+       <style type="text/css" media="screen"> 
+       form { margin-left: 0px; }
+       #login { margin-top: 20px; }
+       </style>
+       <?php
+       }
+
        do_action('login_head'); ?>
 </head>
 <body class="login">
 
 <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
 <?php
        do_action('login_head'); ?>
 </head>
 <body class="login">
 
 <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
 <?php
-       if ( !empty( $message ) ) echo apply_filters('login_message', $message) . "\n";
+       $message = apply_filters('login_message', $message);
+       if ( !empty( $message ) ) echo $message . "\n";
 
        // Incase a plugin uses $error rather than the $errors object
        if ( !empty( $error ) ) {
 
        // Incase a plugin uses $error rather than the $errors object
        if ( !empty( $error ) ) {
@@ -139,7 +155,7 @@ function retrieve_password() {
                $key = wp_generate_password(20, false);
                do_action('retrieve_password_key', $user_login, $key);
                // Now insert the new md5 key into the db
                $key = wp_generate_password(20, false);
                do_action('retrieve_password_key', $user_login, $key);
                // Now insert the new md5 key into the db
-               $wpdb->query($wpdb->prepare("UPDATE $wpdb->users SET user_activation_key = %s WHERE user_login = %s", $key, $user_login));
+               $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
        }
        $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
        $message .= get_option('siteurl') . "\r\n\r\n";
        }
        $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
        $message .= get_option('siteurl') . "\r\n\r\n";
@@ -147,7 +163,12 @@ function retrieve_password() {
        $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
        $message .= site_url("wp-login.php?action=rp&key=$key", 'login') . "\r\n";
 
        $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
        $message .= site_url("wp-login.php?action=rp&key=$key", 'login') . "\r\n";
 
-       if ( !wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message) )
+       $title = sprintf(__('[%s] Password Reset'), get_option('blogname'));
+
+       $title = apply_filters('retrieve_password_title', $title);
+       $message = apply_filters('retrieve_password_message', $message, $key);
+
+       if ( $message && !wp_mail($user_email, $title, $message) )
                die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
 
        return true;
                die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
 
        return true;
@@ -173,17 +194,24 @@ function reset_password($key) {
        if ( empty( $user ) )
                return new WP_Error('invalid_key', __('Invalid key'));
 
        if ( empty( $user ) )
                return new WP_Error('invalid_key', __('Invalid key'));
 
-       do_action('password_reset', $user);
-
        // Generate something random for a password...
        $new_pass = wp_generate_password();
        // Generate something random for a password...
        $new_pass = wp_generate_password();
+
+       do_action('password_reset', $user, $new_pass);
+
        wp_set_password($new_pass, $user->ID);
        wp_set_password($new_pass, $user->ID);
+       update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
        $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
        $message .= site_url('wp-login.php', 'login') . "\r\n";
 
        $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
        $message .= site_url('wp-login.php', 'login') . "\r\n";
 
-       if (  !wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message) )
-               die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
+       $title = sprintf(__('[%s] Your new password'), get_option('blogname'));
+
+       $title = apply_filters('password_reset_title', $title);
+       $message = apply_filters('password_reset_message', $message, $new_pass);
+
+       if ( $message && !wp_mail($user->user_email, $title, $message) )
+               die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
 
        wp_password_change_notification($user);
 
 
        wp_password_change_notification($user);
 
@@ -244,12 +272,16 @@ function register_new_user($user_login, $user_email) {
 // Main
 //
 
 // Main
 //
 
-$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
+$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
 $errors = new WP_Error();
 
 if ( isset($_GET['key']) )
        $action = 'resetpass';
 
 $errors = new WP_Error();
 
 if ( isset($_GET['key']) )
        $action = 'resetpass';
 
+// validate action so as to default to the login screen
+if ( !in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action) )
+       $action = 'login';
+
 nocache_headers();
 
 header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
 nocache_headers();
 
 header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
@@ -268,6 +300,9 @@ setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
 if ( SITECOOKIEPATH != COOKIEPATH )
        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
 
 if ( SITECOOKIEPATH != COOKIEPATH )
        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
 
+// allow plugins to override the default actions, and to add extra actions if they want
+do_action('login_form_' . $action);
+
 $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
 switch ($action) {
 
 $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
 switch ($action) {
 
@@ -306,10 +341,10 @@ case 'retrievepassword' :
 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username or E-mail:') ?><br />
 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username or E-mail:') ?><br />
-               <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
+               <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
        </p>
 <?php do_action('lostpassword_form'); ?>
        </p>
 <?php do_action('lostpassword_form'); ?>
-       <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password'); ?>" tabindex="100" /></p>
+       <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php esc_attr_e('Get New Password'); ?>" tabindex="100" /></p>
 </form>
 
 <p id="nav">
 </form>
 
 <p id="nav">
@@ -373,15 +408,16 @@ case 'register' :
 <form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username') ?><br />
 <form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username') ?><br />
-               <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
+               <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
        </p>
        <p>
                <label><?php _e('E-mail') ?><br />
        </p>
        <p>
                <label><?php _e('E-mail') ?><br />
-               <input type="text" name="user_email" id="user_email" class="input" value="<?php echo attribute_escape(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
+               <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label>
        </p>
 <?php do_action('register_form'); ?>
        <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
        </p>
 <?php do_action('register_form'); ?>
        <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
-       <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Register'); ?>" tabindex="100" /></p>
+       <br class="clear" />
+       <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php esc_attr_e('Register'); ?>" tabindex="100" /></p>
 </form>
 
 <p id="nav">
 </form>
 
 <p id="nav">
@@ -434,7 +470,7 @@ default:
 
        if ( !is_wp_error($user) ) {
                // If the user can't edit posts, send them to their profile.
 
        if ( !is_wp_error($user) ) {
                // If the user can't edit posts, send them to their profile.
-               if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
+               if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
                        $redirect_to = admin_url('profile.php');
                wp_safe_redirect($redirect_to);
                exit();
                        $redirect_to = admin_url('profile.php');
                wp_safe_redirect($redirect_to);
                exit();
@@ -459,24 +495,24 @@ default:
        login_header(__('Log In'), '', $errors);
 
        if ( isset($_POST['log']) )
        login_header(__('Log In'), '', $errors);
 
        if ( isset($_POST['log']) )
-               $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? attribute_escape(stripslashes($_POST['log'])) : '';
+               $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(stripslashes($_POST['log'])) : '';
 ?>
 
 <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
 <form name="loginform" id="loginform" action="<?php echo site_url('wp-login.php', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username') ?><br />
 ?>
 
 <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
 <form name="loginform" id="loginform" action="<?php echo site_url('wp-login.php', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username') ?><br />
-               <input type="text" name="log" id="user_login" class="input" value="<?php echo $user_login; ?>" size="20" tabindex="10" /></label>
+               <input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
        </p>
        <p>
                <label><?php _e('Password') ?><br />
                <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
        </p>
 <?php do_action('login_form'); ?>
        </p>
        <p>
                <label><?php _e('Password') ?><br />
                <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
        </p>
 <?php do_action('login_form'); ?>
-       <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember Me'); ?></label></p>
+       <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php esc_attr_e('Remember Me'); ?></label></p>
        <p class="submit">
        <p class="submit">
-               <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
-               <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
+               <input type="submit" name="wp-submit" id="wp-submit" value="<?php esc_attr_e('Log In'); ?>" tabindex="100" />
+               <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
                <input type="hidden" name="testcookie" value="1" />
        </p>
 </form>
                <input type="hidden" name="testcookie" value="1" />
        </p>
 </form>
index 2966dc3642cfb0b0553e37ee6067905523b2e492..4dc4ed019e5bb04586d2cd1da99fb3c03a86952a 100644 (file)
@@ -13,7 +13,7 @@ require(dirname(__FILE__) . '/wp-load.php');
 /** Get the POP3 class with which to access the mailbox. */
 require_once( ABSPATH . WPINC . '/class-pop3.php' );
 
 /** Get the POP3 class with which to access the mailbox. */
 require_once( ABSPATH . WPINC . '/class-pop3.php' );
 
-$time_difference = absint(get_option('gmt_offset')) * 3600;
+$time_difference = get_option('gmt_offset') * 3600;
 
 $phone_delim = '::';
 
 
 $phone_delim = '::';
 
@@ -23,7 +23,7 @@ if ( ! $pop3->connect(get_option('mailserver_url'), get_option('mailserver_port'
        ! $pop3->user(get_option('mailserver_login')) ||
        ( ! $count = $pop3->pass(get_option('mailserver_pass')) ) ) {
                $pop3->quit();
        ! $pop3->user(get_option('mailserver_login')) ||
        ( ! $count = $pop3->pass(get_option('mailserver_pass')) ) ) {
                $pop3->quit();
-               wp_die( ( 0 === $count ) ? __("There doesn't seem to be any new mail.") : wp_specialchars($pop3->ERROR) );
+               wp_die( ( 0 === $count ) ? __('There doesn&#8217;t seem to be any new mail.') : esc_html($pop3->ERROR) );
 }
 
 for ( $i = 1; $i <= $count; $i++ ) {
 }
 
 for ( $i = 1; $i <= $count; $i++ ) {
@@ -156,6 +156,10 @@ for ( $i = 1; $i <= $count; $i++ ) {
        }
        $content = trim($content);
 
        }
        $content = trim($content);
 
+       //Give Post-By-Email extending plugins full access to the content
+       //Either the raw content or the content of the last quoted-printable section
+       $content = apply_filters('wp_mail_original_content', $content);
+
        if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) {
                $content = quoted_printable_decode($content);
        }
        if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) {
                $content = quoted_printable_decode($content);
        }
@@ -191,11 +195,11 @@ for ( $i = 1; $i <= $count; $i++ ) {
 
        do_action('publish_phone', $post_ID);
 
 
        do_action('publish_phone', $post_ID);
 
-       echo "\n<p>" . sprintf(__('<strong>Author:</strong> %s'), wp_specialchars($post_author)) . '</p>';
-       echo "\n<p>" . sprintf(__('<strong>Posted title:</strong> %s'), wp_specialchars($post_title)) . '</p>';
+       echo "\n<p>" . sprintf(__('<strong>Author:</strong> %s'), esc_html($post_author)) . '</p>';
+       echo "\n<p>" . sprintf(__('<strong>Posted title:</strong> %s'), esc_html($post_title)) . '</p>';
 
        if(!$pop3->delete($i)) {
 
        if(!$pop3->delete($i)) {
-               echo '<p>' . sprintf(__('Oops: %s'), wp_specialchars($pop3->ERROR)) . '</p>';
+               echo '<p>' . sprintf(__('Oops: %s'), esc_html($pop3->ERROR)) . '</p>';
                $pop3->reset();
                exit;
        } else {
                $pop3->reset();
                exit;
        } else {
index 1be8095cc01aa026a5098b381f4a1353fef14fad..0ad6e5ea4e72412176c8df1589fe37c04c246580 100644 (file)
@@ -6,7 +6,7 @@
  * @package WordPress
  */
 
  * @package WordPress
  */
 
-/** Make sure that the WordPress bootstrap has ran before continuing. */
+/** Make sure that the WordPress bootstrap has run before continuing. */
 require( dirname(__FILE__) . '/wp-load.php');
 
 if ( get_magic_quotes_gpc() )
 require( dirname(__FILE__) . '/wp-load.php');
 
 if ( get_magic_quotes_gpc() )
index 553c67d4b789e98606cc0ed90ff42401dcd12ccd..807703f52b672f621b95a8512da47e5e3ade47c6 100644 (file)
@@ -47,6 +47,9 @@ wp_unregister_GLOBALS();
 
 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
 
 
 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
 
+// Force REQUEST to be GET + POST.  If SERVER, COOKIE, or ENV are needed, use those superglobals directly.
+$_REQUEST = array_merge($_GET, $_POST);
+
 /**
  * The $blog_id global, which you can change in the config allows you to create a simple
  * multiple blog installation using just one WordPress and changing $blog_id around.
 /**
  * The $blog_id global, which you can change in the config allows you to create a simple
  * multiple blog installation using just one WordPress and changing $blog_id around.
@@ -201,13 +204,10 @@ timer_start();
 if (defined('WP_DEBUG') and WP_DEBUG == true) {
        error_reporting(E_ALL);
 } else {
 if (defined('WP_DEBUG') and WP_DEBUG == true) {
        error_reporting(E_ALL);
 } else {
-       // Unicode Extension is in PHP 6.0 only or do version check when this changes.
-       if ( function_exists('unicode_decode') ) 
-               error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE ^ E_STRICT );
-       else if ( defined( 'E_DEPRECATED' ) ) // Introduced in PHP 5.3
-               error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE );
+       if ( defined('E_RECOVERABLE_ERROR') )
+               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
        else
        else
-               error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
+               error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
 }
 
 // For an advanced caching plugin to use, static because you would only want one
 }
 
 // For an advanced caching plugin to use, static because you would only want one
@@ -252,15 +252,49 @@ require_wp_db();
 if ( !empty($wpdb->error) )
        dead_db();
 
 if ( !empty($wpdb->error) )
        dead_db();
 
+/**
+ * Format specifiers for DB columns. Columns not listed here default to %s.
+ * @since 2.8.0
+ * @see wpdb:$field_types
+ * @see wpdb:prepare()
+ * @see wpdb:insert()
+ * @see wpdb:update()
+ */
+$wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
+       'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
+       'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d',
+       'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d');
+
 $prefix = $wpdb->set_prefix($table_prefix);
 
 if ( is_wp_error($prefix) )
        wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
 
 $prefix = $wpdb->set_prefix($table_prefix);
 
 if ( is_wp_error($prefix) )
        wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
 
-if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') )
+/**
+ * Copy an object.
+ *
+ * Returns a cloned copy of an object.
+ *
+ * @since 2.7.0
+ *
+ * @param object $object The object to clone
+ * @return object The cloned object
+ */
+function wp_clone( $object ) {
+       static $can_clone;
+       if ( !isset( $can_clone ) ) {
+               $can_clone = version_compare( phpversion(), '5.0', '>=' );
+       }
+       return $can_clone ? clone( $object ) : $object;
+}
+
+if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) {
        require_once (WP_CONTENT_DIR . '/object-cache.php');
        require_once (WP_CONTENT_DIR . '/object-cache.php');
-else
+       $_wp_using_ext_object_cache = true;
+} else {
        require_once (ABSPATH . WPINC . '/cache.php');
        require_once (ABSPATH . WPINC . '/cache.php');
+       $_wp_using_ext_object_cache = false;
+}
 
 wp_cache_init();
 if ( function_exists('wp_cache_add_global_groups') ) {
 
 wp_cache_init();
 if ( function_exists('wp_cache_add_global_groups') ) {
@@ -270,8 +304,7 @@ if ( function_exists('wp_cache_add_global_groups') ) {
 
 require (ABSPATH . WPINC . '/plugin.php');
 require (ABSPATH . WPINC . '/default-filters.php');
 
 require (ABSPATH . WPINC . '/plugin.php');
 require (ABSPATH . WPINC . '/default-filters.php');
-include_once(ABSPATH . WPINC . '/streams.php');
-include_once(ABSPATH . WPINC . '/gettext.php');
+include_once(ABSPATH . WPINC . '/pomo/mo.php');
 require_once (ABSPATH . WPINC . '/l10n.php');
 
 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
 require_once (ABSPATH . WPINC . '/l10n.php');
 
 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
@@ -316,6 +349,7 @@ require (ABSPATH . WPINC . '/canonical.php');
 require (ABSPATH . WPINC . '/shortcodes.php');
 require (ABSPATH . WPINC . '/media.php');
 require (ABSPATH . WPINC . '/http.php');
 require (ABSPATH . WPINC . '/shortcodes.php');
 require (ABSPATH . WPINC . '/media.php');
 require (ABSPATH . WPINC . '/http.php');
+require (ABSPATH . WPINC . '/widgets.php');
 
 if ( !defined('WP_CONTENT_URL') )
        define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
 
 if ( !defined('WP_CONTENT_URL') )
        define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
@@ -344,6 +378,41 @@ if ( !defined('WP_PLUGIN_URL') )
 if ( !defined('PLUGINDIR') )
        define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
 
 if ( !defined('PLUGINDIR') )
        define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
 
+/**
+ * Allows for the mu-plugins directory to be moved from the default location.
+ *
+ * @since 2.8.0
+ */
+if ( !defined('WPMU_PLUGIN_DIR') )
+       define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
+
+/**
+ * Allows for the mu-plugins directory to be moved from the default location.
+ *
+ * @since 2.8.0
+ */
+if ( !defined('WPMU_PLUGIN_URL') )
+       define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash
+
+/**
+ * Allows for the mu-plugins directory to be moved from the default location.
+ *
+ * @since 2.8.0
+ */
+if ( !defined( 'MUPLUGINDIR' ) )
+       define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.
+
+if ( is_dir( WPMU_PLUGIN_DIR ) ) {
+       if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) {
+               while ( ( $plugin = readdir( $dh ) ) !== false ) {
+                       if ( substr( $plugin, -4 ) == '.php' ) {
+                               include_once( WPMU_PLUGIN_DIR . '/' . $plugin );
+                       }
+               }
+       }
+}
+do_action('muplugins_loaded');
+
 /**
  * Used to guarantee unique hash cookies
  * @since 1.5
 /**
  * Used to guarantee unique hash cookies
  * @since 1.5
@@ -460,20 +529,27 @@ if ( !defined( 'AUTOSAVE_INTERVAL' ) )
 require (ABSPATH . WPINC . '/vars.php');
 
 // Check for hacks file if the option is enabled
 require (ABSPATH . WPINC . '/vars.php');
 
 // Check for hacks file if the option is enabled
-if (get_option('hack_file')) {
-       if (file_exists(ABSPATH . 'my-hacks.php'))
+if ( get_option('hack_file') ) {
+       if ( file_exists(ABSPATH . 'my-hacks.php') )
                require(ABSPATH . 'my-hacks.php');
 }
 
                require(ABSPATH . 'my-hacks.php');
 }
 
-if ( get_option('active_plugins') && !defined('WP_INSTALLING') ) {
-       $current_plugins = get_option('active_plugins');
-       if ( is_array($current_plugins) ) {
-               foreach ($current_plugins as $plugin) {
-                       if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
-                               include_once(WP_PLUGIN_DIR . '/' . $plugin);
-               }
+$current_plugins = get_option('active_plugins');
+if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) {
+       foreach ( $current_plugins as $plugin ) {
+               // check the $plugin filename
+               // Validate plugin filename
+               if ( validate_file($plugin) // $plugin must validate as file
+                       || '.php' != substr($plugin, -4) // $plugin must end with '.php'
+                       || !file_exists(WP_PLUGIN_DIR . '/' . $plugin)  // $plugin must exist
+                       )
+                       continue;
+
+               include_once(WP_PLUGIN_DIR . '/' . $plugin);
        }
        }
+       unset($plugin);
 }
 }
+unset($current_plugins);
 
 require (ABSPATH . WPINC . '/pluggable.php');
 
 
 require (ABSPATH . WPINC . '/pluggable.php');
 
@@ -541,6 +617,13 @@ $wp_rewrite   =& new WP_Rewrite();
  */
 $wp           =& new WP();
 
  */
 $wp           =& new WP();
 
+/**
+ * WordPress Widget Factory Object
+ * @global object $wp_widget_factory
+ * @since 2.8.0
+ */
+$wp_widget_factory =& new WP_Widget_Factory();
+
 do_action('setup_theme');
 
 /**
 do_action('setup_theme');
 
 /**
index c45b14fac70aaf0e151ac3cd0ddae8d087d1fb9c..55279426cb1c76dca5d8cd583856541dc7020aea 100644 (file)
@@ -238,6 +238,8 @@ class wp_xmlrpc_server extends IXR_Server {
         * @param string $user_login User's username.
         * @param string $user_pass User's password.
         * @return bool Whether authentication passed.
         * @param string $user_login User's username.
         * @param string $user_pass User's password.
         * @return bool Whether authentication passed.
+        * @deprecated use wp_xmlrpc_server::login
+        * @see wp_xmlrpc_server::login
         */
        function login_pass_ok($user_login, $user_pass) {
                if ( !get_option( 'enable_xmlrpc' ) ) {
         */
        function login_pass_ok($user_login, $user_pass) {
                if ( !get_option( 'enable_xmlrpc' ) ) {
@@ -252,6 +254,32 @@ class wp_xmlrpc_server extends IXR_Server {
                return true;
        }
 
                return true;
        }
 
+       /**
+        * Log user in.
+        *
+        * @since 2.8
+        *
+        * @param string $username User's username.
+        * @param string $password User's password.
+        * @return mixed WP_User object if authentication passed, false otherwise
+        */
+       function login($username, $password) {
+               if ( !get_option( 'enable_xmlrpc' ) ) {
+                       $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this blog.  An admin user can enable them at %s'),  admin_url('options-writing.php') ) );
+                       return false;
+               }
+
+               $user = wp_authenticate($username, $password);
+
+               if (is_wp_error($user)) {
+                       $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
+                       return false;
+               }
+
+               set_current_user( $user->ID );
+               return $user;
+       }
+
        /**
         * Sanitize string or array of strings for database.
         *
        /**
         * Sanitize string or array of strings for database.
         *
@@ -417,13 +445,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $username = $args[0];
                $password = $args[1];
 
                $username = $args[0];
                $password = $args[1];
 
-               if( !$this->login_pass_ok( $username, $password ) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
+               }
 
                do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
 
 
                do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
 
-               $user = set_current_user( 0, $username );
-
                $blogs = (array) get_blogs_of_user( $user->ID );
                $struct = array( );
 
                $blogs = (array) get_blogs_of_user( $user->ID );
                $struct = array( );
 
@@ -441,7 +468,7 @@ class wp_xmlrpc_server extends IXR_Server {
                                'url'                   => get_option( 'home' ) . '/',
                                'blogid'                => $blog_id,
                                'blogName'              => get_option( 'blogname' ),
                                'url'                   => get_option( 'home' ) . '/',
                                'blogid'                => $blog_id,
                                'blogName'              => get_option( 'blogname' ),
-                               'xmlrpc'                => get_option( 'home' ) . '/xmlrpc.php'
+                               'xmlrpc'                => site_url( 'xmlrpc.php' )
                        );
 
                        restore_current_blog( );
                        );
 
                        restore_current_blog( );
@@ -466,13 +493,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[2];
                $password       = $args[3];
 
                $username       = $args[2];
                $password       = $args[3];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_page', $page_id ) )
                if( !current_user_can( 'edit_page', $page_id ) )
-                       return new IXR_Error( 401, __( 'Sorry, you can not edit this page.' ) );
+                       return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
 
                do_action('xmlrpc_call', 'wp.getPage');
 
 
                do_action('xmlrpc_call', 'wp.getPage');
 
@@ -493,12 +519,12 @@ class wp_xmlrpc_server extends IXR_Server {
                        }
 
                        // Determine comment and ping settings.
                        }
 
                        // Determine comment and ping settings.
-                       $allow_comments = ("open" == $page->comment_status) ? 1 : 0;
-                       $allow_pings = ("open" == $page->ping_status) ? 1 : 0;
+                       $allow_comments = comments_open($page->ID) ? 1 : 0;
+                       $allow_pings = pings_open($page->ID) ? 1 : 0;
 
                        // Format page date.
 
                        // Format page date.
-                       $page_date = mysql2date("Ymd\TH:i:s", $page->post_date);
-                       $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt);
+                       $page_date = mysql2date("Ymd\TH:i:s", $page->post_date, false);
+                       $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false);
 
                        // Pull the categories info together.
                        $categories = array();
 
                        // Pull the categories info together.
                        $categories = array();
@@ -564,13 +590,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $num_pages      = (int) $args[3];
 
                $password       = $args[2];
                $num_pages      = (int) $args[3];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_pages' ) )
                if( !current_user_can( 'edit_pages' ) )
-                       return new IXR_Error( 401, __( 'Sorry, you can not edit pages.' ) );
+                       return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
 
                do_action('xmlrpc_call', 'wp.getPages');
 
 
                do_action('xmlrpc_call', 'wp.getPages');
 
@@ -579,7 +604,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        $page_limit = $num_pages;
                }
 
                        $page_limit = $num_pages;
                }
 
-               $pages = get_posts( "post_type=page&post_status=all&numberposts={$page_limit}" );
+               $pages = get_posts( array('post_type' => 'page', 'post_status' => 'all', 'numberposts' => $page_limit) );
                $num_pages = count($pages);
 
                // If we have pages, put together their info.
                $num_pages = count($pages);
 
                // If we have pages, put together their info.
@@ -616,17 +641,15 @@ class wp_xmlrpc_server extends IXR_Server {
                $page           = $args[3];
                $publish        = $args[4];
 
                $page           = $args[3];
                $publish        = $args[4];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                do_action('xmlrpc_call', 'wp.newPage');
 
                }
 
                do_action('xmlrpc_call', 'wp.newPage');
 
-               // Set the user context and check if they are allowed
-               // to add new pages.
-               $user = set_current_user(0, $username);
+               // Make sure the user is allowed to add new pages.
                if(!current_user_can("publish_pages")) {
                if(!current_user_can("publish_pages")) {
-                       return(new IXR_Error(401, __("Sorry, you can not add new pages.")));
+                       return(new IXR_Error(401, __("Sorry, you cannot add new pages.")));
                }
 
                // Mark this as content for a page.
                }
 
                // Mark this as content for a page.
@@ -652,8 +675,8 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $page_id        = (int) $args[3];
 
                $password       = $args[2];
                $page_id        = (int) $args[3];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                do_action('xmlrpc_call', 'wp.deletePage');
                }
 
                do_action('xmlrpc_call', 'wp.deletePage');
@@ -668,8 +691,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return(new IXR_Error(404, __("Sorry, no such page.")));
                }
 
                        return(new IXR_Error(404, __("Sorry, no such page.")));
                }
 
-               // Set the user context and make sure they can delete pages.
-               set_current_user(0, $username);
+               // Make sure the user can delete pages.
                if(!current_user_can("delete_page", $page_id)) {
                        return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page.")));
                }
                if(!current_user_can("delete_page", $page_id)) {
                        return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page.")));
                }
@@ -700,8 +722,8 @@ class wp_xmlrpc_server extends IXR_Server {
                $content        = $args[4];
                $publish        = $args[5];
 
                $content        = $args[4];
                $publish        = $args[5];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                do_action('xmlrpc_call', 'wp.editPage');
                }
 
                do_action('xmlrpc_call', 'wp.editPage');
@@ -715,8 +737,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return(new IXR_Error(404, __("Sorry, no such page.")));
                }
 
                        return(new IXR_Error(404, __("Sorry, no such page.")));
                }
 
-               // Set the user context and make sure they are allowed to edit pages.
-               set_current_user(0, $username);
+               // Make sure the user is allowed to edit pages.
                if(!current_user_can("edit_page", $page_id)) {
                        return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page.")));
                }
                if(!current_user_can("edit_page", $page_id)) {
                        return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page.")));
                }
@@ -754,13 +775,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $username                               = $args[1];
                $password                               = $args[2];
 
                $username                               = $args[1];
                $password                               = $args[2];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_pages' ) )
                if( !current_user_can( 'edit_pages' ) )
-                       return new IXR_Error( 401, __( 'Sorry, you can not edit pages.' ) );
+                       return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
 
                do_action('xmlrpc_call', 'wp.getPageList');
 
 
                do_action('xmlrpc_call', 'wp.getPageList');
 
@@ -779,8 +799,8 @@ class wp_xmlrpc_server extends IXR_Server {
                // The date needs to be formated properly.
                $num_pages = count($page_list);
                for($i = 0; $i < $num_pages; $i++) {
                // The date needs to be formated properly.
                $num_pages = count($page_list);
                for($i = 0; $i < $num_pages; $i++) {
-                       $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date);
-                       $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt);
+                       $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date, false);
+                       $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt, false);
 
                        $page_list[$i]->dateCreated = new IXR_Date($post_date);
                        $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
 
                        $page_list[$i]->dateCreated = new IXR_Date($post_date);
                        $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
@@ -808,13 +828,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
                $username       = $args[1];
                $password       = $args[2];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                }
 
-               set_current_user(0, $username);
                if(!current_user_can("edit_posts")) {
                if(!current_user_can("edit_posts")) {
-                       return(new IXR_Error(401, __("Sorry, you can not edit posts on this blog.")));
+                       return(new IXR_Error(401, __("Sorry, you cannot edit posts on this blog.")));
                }
 
                do_action('xmlrpc_call', 'wp.getAuthors');
                }
 
                do_action('xmlrpc_call', 'wp.getAuthors');
@@ -846,11 +865,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username               = $args[1];
                $password               = $args[2];
 
                $username               = $args[1];
                $password               = $args[2];
 
-               if( !$this->login_pass_ok( $username, $password ) ) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view tags.' ) );
                }
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view tags.' ) );
                }
@@ -865,8 +883,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                $struct['name']                         = $tag->name;
                                $struct['count']                        = $tag->count;
                                $struct['slug']                         = $tag->slug;
                                $struct['name']                         = $tag->name;
                                $struct['count']                        = $tag->count;
                                $struct['slug']                         = $tag->slug;
-                               $struct['html_url']                     = wp_specialchars( get_tag_link( $tag->term_id ) );
-                               $struct['rss_url']                      = wp_specialchars( get_tag_feed_link( $tag->term_id ) );
+                               $struct['html_url']                     = esc_html( get_tag_link( $tag->term_id ) );
+                               $struct['rss_url']                      = esc_html( get_tag_feed_link( $tag->term_id ) );
 
                                $tags[] = $struct;
                        }
 
                                $tags[] = $struct;
                        }
@@ -891,15 +909,13 @@ class wp_xmlrpc_server extends IXR_Server {
                $password                               = $args[2];
                $category                               = $args[3];
 
                $password                               = $args[2];
                $category                               = $args[3];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                do_action('xmlrpc_call', 'wp.newCategory');
 
                }
 
                do_action('xmlrpc_call', 'wp.newCategory');
 
-               // Set the user context and make sure they are
-               // allowed to add a category.
-               set_current_user(0, $username);
+               // Make sure the user is allowed to add a category.
                if(!current_user_can("manage_categories")) {
                        return(new IXR_Error(401, __("Sorry, you do not have the right to add a category.")));
                }
                if(!current_user_can("manage_categories")) {
                        return(new IXR_Error(401, __("Sorry, you do not have the right to add a category.")));
                }
@@ -951,13 +967,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $password               = $args[2];
                $category_id    = (int) $args[3];
 
                $password               = $args[2];
                $category_id    = (int) $args[3];
 
-               if( !$this->login_pass_ok( $username, $password ) ) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'wp.deleteCategory');
 
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'wp.deleteCategory');
 
-               set_current_user(0, $username);
                if( !current_user_can("manage_categories") ) {
                        return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) );
                }
                if( !current_user_can("manage_categories") ) {
                        return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) );
                }
@@ -982,11 +997,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $category                               = $args[3];
                $max_results                    = (int) $args[4];
 
                $category                               = $args[3];
                $max_results                    = (int) $args[4];
 
-               if(!$this->login_pass_ok($username, $password)) {
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
                }
 
                }
 
-               set_current_user(0, $username);
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this blog in order to view categories.' ) );
 
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this blog in order to view categories.' ) );
 
@@ -1020,10 +1034,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $comment_id     = (int) $args[3];
 
                $password       = $args[2];
                $comment_id     = (int) $args[3];
 
-               if ( !$this->login_pass_ok( $username, $password ) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
+               }
 
 
-               set_current_user( 0, $username );
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
 
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
 
@@ -1033,8 +1047,8 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
 
                // Format page date.
                        return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
 
                // Format page date.
-               $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date);
-               $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt);
+               $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date, false);
+               $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt, false);
 
                if ( 0 == $comment->comment_approved )
                        $comment_status = 'hold';
 
                if ( 0 == $comment->comment_approved )
                        $comment_status = 'hold';
@@ -1083,12 +1097,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $struct         = $args[3];
 
                $password       = $args[2];
                $struct         = $args[3];
 
-               if ( !$this->login_pass_ok($username, $password) )
-                       return($this->error);
+               if ( !$user = $this->login($username, $password) ) {
+                       return $this->error;
+               }
 
 
-               set_current_user( 0, $username );
                if ( !current_user_can( 'moderate_comments' ) )
                if ( !current_user_can( 'moderate_comments' ) )
-                       return new IXR_Error( 401, __( 'Sorry, you can not edit comments.' ) );
+                       return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
 
                do_action('xmlrpc_call', 'wp.getComments');
 
 
                do_action('xmlrpc_call', 'wp.getComments');
 
@@ -1143,10 +1157,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $comment_ID     = (int) $args[3];
 
                $password       = $args[2];
                $comment_ID     = (int) $args[3];
 
-               if ( !$this->login_pass_ok( $username, $password ) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
+               }
 
 
-               set_current_user( 0, $username );
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
 
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
 
@@ -1175,10 +1189,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $comment_ID     = (int) $args[3];
                $content_struct = $args[4];
 
                $comment_ID     = (int) $args[3];
                $content_struct = $args[4];
 
-               if ( !$this->login_pass_ok( $username, $password ) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
+               }
 
 
-               set_current_user( 0, $username );
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
 
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
 
@@ -1249,7 +1263,9 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
 
 
                $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
 
-               if ( !$this->login_pass_ok( $username, $password ) ) {
+               $user = $this->login($username, $password);
+
+               if ( !$user ) {
                        $logged_in = false;
                        if ( $allow_anon && get_option('comment_registration') )
                                return new IXR_Error( 403, __( 'You must be registered to comment' ) );
                        $logged_in = false;
                        if ( $allow_anon && get_option('comment_registration') )
                                return new IXR_Error( 403, __( 'You must be registered to comment' ) );
@@ -1257,7 +1273,6 @@ class wp_xmlrpc_server extends IXR_Server {
                                return $this->error;
                } else {
                        $logged_in = true;
                                return $this->error;
                } else {
                        $logged_in = true;
-                       set_current_user( 0, $username );
                }
 
                if ( is_numeric($post) )
                }
 
                if ( is_numeric($post) )
@@ -1274,7 +1289,6 @@ class wp_xmlrpc_server extends IXR_Server {
                $comment['comment_post_ID'] = $post_id;
 
                if ( $logged_in ) {
                $comment['comment_post_ID'] = $post_id;
 
                if ( $logged_in ) {
-                       $user = wp_get_current_user();
                        $comment['comment_author'] = $wpdb->escape( $user->display_name );
                        $comment['comment_author_email'] = $wpdb->escape( $user->user_email );
                        $comment['comment_author_url'] = $wpdb->escape( $user->user_url );
                        $comment['comment_author'] = $wpdb->escape( $user->display_name );
                        $comment['comment_author_email'] = $wpdb->escape( $user->user_email );
                        $comment['comment_author_url'] = $wpdb->escape( $user->user_url );
@@ -1326,10 +1340,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
                $username       = $args[1];
                $password       = $args[2];
 
-               if ( !$this->login_pass_ok( $username, $password ) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
+               }
 
 
-               set_current_user( 0, $username );
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
 
                if ( !current_user_can( 'moderate_comments' ) )
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
 
@@ -1354,11 +1368,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $post_id        = (int) $args[3];
 
                $password       = $args[2];
                $post_id        = (int) $args[3];
 
-               if( !$this->login_pass_ok( $username, $password ) ) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
                }
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
                }
@@ -1389,11 +1402,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
                $username       = $args[1];
                $password       = $args[2];
 
-               if( !$this->login_pass_ok( $username, $password ) ) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
                }
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
                }
@@ -1418,11 +1430,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
                $username       = $args[1];
                $password       = $args[2];
 
-               if( !$this->login_pass_ok( $username, $password ) ) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
                }
                if( !current_user_can( 'edit_posts' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
                }
@@ -1447,11 +1458,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $username       = $args[1];
                $password       = $args[2];
 
                $username       = $args[1];
                $password       = $args[2];
 
-               if( !$this->login_pass_ok( $username, $password ) ) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $username );
                if( !current_user_can( 'edit_pages' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
                }
                if( !current_user_can( 'edit_pages' ) ) {
                        return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
                }
@@ -1478,10 +1488,9 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $options        = (array) $args[3];
 
                $password       = $args[2];
                $options        = (array) $args[3];
 
-               if( !$this->login_pass_ok( $username, $password ) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
-
-               $user = set_current_user( 0, $username );
+               }
 
                // If no specific options where asked for, return all of them
                if (count( $options ) == 0 ) {
 
                // If no specific options where asked for, return all of them
                if (count( $options ) == 0 ) {
@@ -1533,10 +1542,10 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
                $options        = (array) $args[3];
 
                $password       = $args[2];
                $options        = (array) $args[3];
 
-               if( !$this->login_pass_ok( $username, $password ) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
+               }
 
 
-               $user = set_current_user( 0, $username );
                if( !current_user_can( 'manage_options' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
 
                if( !current_user_can( 'manage_options' ) )
                        return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
 
@@ -1576,16 +1585,15 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $this->escape($args);
 
 
                $this->escape($args);
 
-               $user_login = $args[1];
-               $user_pass  = $args[2];
+               $username = $args[1];
+               $password  = $args[2];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.getUsersBlogs');
 
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.getUsersBlogs');
 
-               set_current_user(0, $user_login);
                $is_admin = current_user_can('manage_options');
 
                $struct = array(
                $is_admin = current_user_can('manage_options');
 
                $struct = array(
@@ -1593,7 +1601,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        'url'      => get_option('home') . '/',
                        'blogid'   => '1',
                        'blogName' => get_option('blogname'),
                        'url'      => get_option('home') . '/',
                        'blogid'   => '1',
                        'blogName' => get_option('blogname'),
-                       'xmlrpc'   => get_option('home') . '/xmlrpc.php',
+                       'xmlrpc'   => site_url( 'xmlrpc.php' )
                );
 
                return array($struct);
                );
 
                return array($struct);
@@ -1613,27 +1621,24 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $this->escape($args);
 
 
                $this->escape($args);
 
-               $user_login = $args[1];
-               $user_pass  = $args[2];
+               $username = $args[1];
+               $password  = $args[2];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $user_login );
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this blog.' ) );
 
                do_action('xmlrpc_call', 'blogger.getUserInfo');
 
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this blog.' ) );
 
                do_action('xmlrpc_call', 'blogger.getUserInfo');
 
-               $user_data = get_userdatabylogin($user_login);
-
                $struct = array(
                $struct = array(
-                       'nickname'  => $user_data->nickname,
-                       'userid'    => $user_data->ID,
-                       'url'       => $user_data->user_url,
-                       'lastname'  => $user_data->last_name,
-                       'firstname' => $user_data->first_name
+                       'nickname'  => $user->nickname,
+                       'userid'    => $user->ID,
+                       'url'       => $user->user_url,
+                       'lastname'  => $user->last_name,
+                       'firstname' => $user->first_name
                );
 
                return $struct;
                );
 
                return $struct;
@@ -1652,16 +1657,15 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID    = (int) $args[1];
                $this->escape($args);
 
                $post_ID    = (int) $args[1];
-               $user_login = $args[2];
-               $user_pass  = $args[3];
+               $username = $args[2];
+               $password  = $args[3];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $user_login );
                if( !current_user_can( 'edit_post', $post_ID ) )
                if( !current_user_can( 'edit_post', $post_ID ) )
-                       return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
+                       return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
 
                do_action('xmlrpc_call', 'blogger.getPost');
 
 
                do_action('xmlrpc_call', 'blogger.getPost');
 
@@ -1675,7 +1679,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $struct = array(
                        'userid'    => $post_data['post_author'],
 
                $struct = array(
                        'userid'    => $post_data['post_author'],
-                       'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
+                       'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'], false)),
                        'content'     => $content,
                        'postid'  => $post_data['ID']
                );
                        'content'     => $content,
                        'postid'  => $post_data['ID']
                );
@@ -1696,11 +1700,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID    = (int) $args[1]; /* though we don't use it yet */
                $this->escape($args);
 
                $blog_ID    = (int) $args[1]; /* though we don't use it yet */
-               $user_login = $args[2];
-               $user_pass  = $args[3];
+               $username = $args[2];
+               $password  = $args[3];
                $num_posts  = $args[4];
 
                $num_posts  = $args[4];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
@@ -1708,8 +1712,6 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $posts_list = wp_get_recent_posts($num_posts);
 
 
                $posts_list = wp_get_recent_posts($num_posts);
 
-               set_current_user( 0, $user_login );
-
                if (!$posts_list) {
                        $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
                        return $this->error;
                if (!$posts_list) {
                        $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
                        return $this->error;
@@ -1719,7 +1721,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
-                       $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
+                       $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
                        $categories = implode(',', wp_get_post_categories($entry['ID']));
 
                        $content  = '<title>'.stripslashes($entry['post_title']).'</title>';
                        $categories = implode(',', wp_get_post_categories($entry['ID']));
 
                        $content  = '<title>'.stripslashes($entry['post_title']).'</title>';
@@ -1756,17 +1758,16 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID    = (int) $args[1];
                $this->escape($args);
 
                $blog_ID    = (int) $args[1];
-               $user_login = $args[2];
-               $user_pass  = $args[3];
+               $username = $args[2];
+               $password  = $args[3];
                $template   = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
 
                $template   = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.getTemplate');
 
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.getTemplate');
 
-               set_current_user(0, $user_login);
                if ( !current_user_can('edit_themes') ) {
                        return new IXR_Error(401, __('Sorry, this user can not edit the template.'));
                }
                if ( !current_user_can('edit_themes') ) {
                        return new IXR_Error(401, __('Sorry, this user can not edit the template.'));
                }
@@ -1798,20 +1799,19 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID    = (int) $args[1];
                $this->escape($args);
 
                $blog_ID    = (int) $args[1];
-               $user_login = $args[2];
-               $user_pass  = $args[3];
+               $username = $args[2];
+               $password  = $args[3];
                $content    = $args[4];
                $template   = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */
 
                $content    = $args[4];
                $template   = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.setTemplate');
 
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.setTemplate');
 
-               set_current_user(0, $user_login);
                if ( !current_user_can('edit_themes') ) {
                if ( !current_user_can('edit_themes') ) {
-                       return new IXR_Error(401, __('Sorry, this user can not edit the template.'));
+                       return new IXR_Error(401, __('Sorry, this user cannot edit the template.'));
                }
 
                /* warning: here we make the assumption that the blog's URL is on the same server */
                }
 
                /* warning: here we make the assumption that the blog's URL is on the same server */
@@ -1841,19 +1841,18 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID    = (int) $args[1]; /* though we don't use it yet */
                $this->escape($args);
 
                $blog_ID    = (int) $args[1]; /* though we don't use it yet */
-               $user_login = $args[2];
-               $user_pass  = $args[3];
+               $username = $args[2];
+               $password  = $args[3];
                $content    = $args[4];
                $publish    = $args[5];
 
                $content    = $args[4];
                $publish    = $args[5];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.newPost');
 
                $cap = ($publish) ? 'publish_posts' : 'edit_posts';
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'blogger.newPost');
 
                $cap = ($publish) ? 'publish_posts' : 'edit_posts';
-               $user = set_current_user(0, $user_login);
                if ( !current_user_can($cap) )
                        return new IXR_Error(401, __('Sorry, you are not allowed to post on this blog.'));
 
                if ( !current_user_can($cap) )
                        return new IXR_Error(401, __('Sorry, you are not allowed to post on this blog.'));
 
@@ -1897,12 +1896,12 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID     = (int) $args[1];
                $this->escape($args);
 
                $post_ID     = (int) $args[1];
-               $user_login  = $args[2];
-               $user_pass   = $args[3];
+               $username  = $args[2];
+               $password   = $args[3];
                $content     = $args[4];
                $publish     = $args[5];
 
                $content     = $args[4];
                $publish     = $args[5];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
@@ -1916,7 +1915,6 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $this->escape($actual_post);
 
 
                $this->escape($actual_post);
 
-               set_current_user(0, $user_login);
                if ( !current_user_can('edit_post', $post_ID) )
                        return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
 
                if ( !current_user_can('edit_post', $post_ID) )
                        return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
 
@@ -1953,11 +1951,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID     = (int) $args[1];
                $this->escape($args);
 
                $post_ID     = (int) $args[1];
-               $user_login  = $args[2];
-               $user_pass   = $args[3];
+               $username  = $args[2];
+               $password   = $args[3];
                $publish     = $args[4];
 
                $publish     = $args[4];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
@@ -1969,7 +1967,6 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
 
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
 
-               set_current_user(0, $user_login);
                if ( !current_user_can('edit_post', $post_ID) )
                        return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
 
                if ( !current_user_can('edit_post', $post_ID) )
                        return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
 
@@ -1998,15 +1995,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID     = (int) $args[0]; // we will support this in the near future
                $this->escape($args);
 
                $blog_ID     = (int) $args[0]; // we will support this in the near future
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
                $content_struct = $args[3];
                $publish     = $args[4];
 
                $content_struct = $args[3];
                $publish     = $args[4];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
                        return $this->error;
                }
-               $user = set_current_user(0, $user_login);
 
                do_action('xmlrpc_call', 'metaWeblog.newPost');
 
 
                do_action('xmlrpc_call', 'metaWeblog.newPost');
 
@@ -2219,15 +2215,19 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
                }
 
                        return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
                }
 
+               // Only posts can be sticky
+               if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
+                       if ( $content_struct['sticky'] == true )
+                               stick_post( $post_ID );
+                       elseif ( $content_struct['sticky'] == false )
+                               unstick_post( $post_ID );
+
                if ( isset($content_struct['custom_fields']) ) {
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
                }
 
                // Handle enclosures
                if ( isset($content_struct['custom_fields']) ) {
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
                }
 
                // Handle enclosures
-               $enclosure = $content_struct['enclosure'];
-               if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
-                       add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] );
-               }
+               $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
 
                $this->attach_uploads( $post_ID, $post_content );
 
 
                $this->attach_uploads( $post_ID, $post_content );
 
@@ -2236,6 +2236,27 @@ class wp_xmlrpc_server extends IXR_Server {
                return strval($post_ID);
        }
 
                return strval($post_ID);
        }
 
+       function add_enclosure_if_new($post_ID, $enclosure) {
+               if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
+
+                       $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'];
+                       $found = false;
+                       foreach ( (array) get_post_custom($post_ID) as $key => $val) {
+                               if ($key == 'enclosure') {
+                                       foreach ( (array) $val as $enc ) {
+                                               if ($enc == $encstring) {
+                                                       $found = true;
+                                                       break 2;
+                                               }
+                                       }
+                               }
+                       }
+                       if (!$found) {
+                               add_post_meta( $post_ID, 'enclosure', $encstring );
+                       }
+               }
+       }
+
        /**
         * Attach upload to a post.
         *
        /**
         * Attach upload to a post.
         *
@@ -2252,7 +2273,7 @@ class wp_xmlrpc_server extends IXR_Server {
                if( is_array( $attachments ) ) {
                        foreach( $attachments as $file ) {
                                if( strpos( $post_content, $file->guid ) !== false ) {
                if( is_array( $attachments ) ) {
                        foreach( $attachments as $file ) {
                                if( strpos( $post_content, $file->guid ) !== false ) {
-                                       $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d", $post_ID, $file->ID) );
+                                       $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
                                }
                        }
                }
                                }
                        }
                }
@@ -2271,15 +2292,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
                $content_struct = $args[3];
                $publish     = $args[4];
 
                $content_struct = $args[3];
                $publish     = $args[4];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
                        return $this->error;
                }
-               $user = set_current_user(0, $user_login);
 
                do_action('xmlrpc_call', 'metaWeblog.editPost');
 
 
                do_action('xmlrpc_call', 'metaWeblog.editPost');
 
@@ -2314,7 +2334,7 @@ class wp_xmlrpc_server extends IXR_Server {
                // now and return an error.  Other wise a new post will be
                // created (which was the old behavior).
                if(empty($postdata["ID"])) {
                // now and return an error.  Other wise a new post will be
                // created (which was the old behavior).
                if(empty($postdata["ID"])) {
-                       return(new IXR_Error(404, __("Invalid post id.")));
+                       return(new IXR_Error(404, __("Invalid post ID.")));
                }
 
                $this->escape($postdata);
                }
 
                $this->escape($postdata);
@@ -2502,15 +2522,19 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
                }
 
                        return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
                }
 
+               // Only posts can be sticky
+               if ( $post_type == 'post' && isset( $content_struct['sticky'] ) )
+                       if ( $content_struct['sticky'] == true )
+                               stick_post( $post_ID );
+                       elseif ( $content_struct['sticky'] == false )
+                               unstick_post( $post_ID );
+
                if ( isset($content_struct['custom_fields']) ) {
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
                }
 
                // Handle enclosures
                if ( isset($content_struct['custom_fields']) ) {
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
                }
 
                // Handle enclosures
-               $enclosure = $content_struct['enclosure'];
-               if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
-                       add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] );
-               }
+               $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
 
                $this->attach_uploads( $ID, $post_content );
 
 
                $this->attach_uploads( $ID, $post_content );
 
@@ -2532,24 +2556,23 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $user_login );
                if( !current_user_can( 'edit_post', $post_ID ) )
                if( !current_user_can( 'edit_post', $post_ID ) )
-                       return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
+                       return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
 
                do_action('xmlrpc_call', 'metaWeblog.getPost');
 
                $postdata = wp_get_single_post($post_ID, ARRAY_A);
 
                if ($postdata['post_date'] != '') {
 
                do_action('xmlrpc_call', 'metaWeblog.getPost');
 
                $postdata = wp_get_single_post($post_ID, ARRAY_A);
 
                if ($postdata['post_date'] != '') {
-                       $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']);
-                       $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']);
+                       $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false);
+                       $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
 
                        $categories = array();
                        $catids = wp_get_post_categories($post_ID);
 
                        $categories = array();
                        $catids = wp_get_post_categories($post_ID);
@@ -2580,6 +2603,10 @@ class wp_xmlrpc_server extends IXR_Server {
                                $postdata['post_status'] = 'publish';
                        }
 
                                $postdata['post_status'] = 'publish';
                        }
 
+                       $sticky = false;
+                       if ( is_sticky( $post_ID ) )
+                               $sticky = true;
+
                        $enclosure = array();
                        foreach ( (array) get_post_custom($post_ID) as $key => $val) {
                                if ($key == 'enclosure') {
                        $enclosure = array();
                        foreach ( (array) get_post_custom($post_ID) as $key => $val) {
                                if ($key == 'enclosure') {
@@ -2615,7 +2642,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                'wp_author_display_name'        => $author->display_name,
                                'date_created_gmt' => new IXR_Date($post_date_gmt),
                                'post_status' => $postdata['post_status'],
                                'wp_author_display_name'        => $author->display_name,
                                'date_created_gmt' => new IXR_Date($post_date_gmt),
                                'post_status' => $postdata['post_status'],
-                               'custom_fields' => $this->get_custom_fields($post_ID)
+                               'custom_fields' => $this->get_custom_fields($post_ID),
+                               'sticky' => $sticky
                        );
 
                        if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
                        );
 
                        if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
@@ -2639,11 +2667,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
                $num_posts   = (int) $args[3];
 
                $num_posts   = (int) $args[3];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
@@ -2655,14 +2683,12 @@ class wp_xmlrpc_server extends IXR_Server {
                        return array( );
                }
 
                        return array( );
                }
 
-               set_current_user( 0, $user_login );
-
                foreach ($posts_list as $entry) {
                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
                foreach ($posts_list as $entry) {
                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
-                       $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
-                       $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']);
+                       $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
+                       $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
 
                        $categories = array();
                        $catids = wp_get_post_categories($entry['ID']);
 
                        $categories = array();
                        $catids = wp_get_post_categories($entry['ID']);
@@ -2743,14 +2769,13 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $user_login );
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
 
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
 
@@ -2765,8 +2790,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                $struct['description'] = $cat->name;
                                $struct['categoryDescription'] = $cat->description;
                                $struct['categoryName'] = $cat->name;
                                $struct['description'] = $cat->name;
                                $struct['categoryDescription'] = $cat->description;
                                $struct['categoryName'] = $cat->name;
-                               $struct['htmlUrl'] = wp_specialchars(get_category_link($cat->term_id));
-                               $struct['rssUrl'] = wp_specialchars(get_category_feed_link($cat->term_id, 'rss2'));
+                               $struct['htmlUrl'] = esc_html(get_category_link($cat->term_id));
+                               $struct['rssUrl'] = esc_html(get_category_feed_link($cat->term_id, 'rss2'));
 
                                $categories_struct[] = $struct;
                        }
 
                                $categories_struct[] = $struct;
                        }
@@ -2791,8 +2816,8 @@ class wp_xmlrpc_server extends IXR_Server {
                global $wpdb;
 
                $blog_ID     = (int) $args[0];
                global $wpdb;
 
                $blog_ID     = (int) $args[0];
-               $user_login  = $wpdb->escape($args[1]);
-               $user_pass   = $wpdb->escape($args[2]);
+               $username  = $wpdb->escape($args[1]);
+               $password   = $wpdb->escape($args[2]);
                $data        = $args[3];
 
                $name = sanitize_file_name( $data['name'] );
                $data        = $args[3];
 
                $name = sanitize_file_name( $data['name'] );
@@ -2801,12 +2826,12 @@ class wp_xmlrpc_server extends IXR_Server {
 
                logIO('O', '(MW) Received '.strlen($bits).' bytes');
 
 
                logIO('O', '(MW) Received '.strlen($bits).' bytes');
 
-               if ( !$this->login_pass_ok($user_login, $user_pass) )
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                        return $this->error;
+               }
 
                do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
 
 
                do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
 
-               set_current_user(0, $user_login);
                if ( !current_user_can('upload_files') ) {
                        logIO('O', '(MW) User does not have upload_files capability');
                        $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
                if ( !current_user_can('upload_files') ) {
                        logIO('O', '(MW) User does not have upload_files capability');
                        $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
@@ -2876,11 +2901,11 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
                $num_posts   = (int) $args[3];
 
                $num_posts   = (int) $args[3];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
@@ -2893,14 +2918,12 @@ class wp_xmlrpc_server extends IXR_Server {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $user_login );
-
                foreach ($posts_list as $entry) {
                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
                foreach ($posts_list as $entry) {
                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
                                continue;
 
-                       $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
-                       $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']);
+                       $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
+                       $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
 
                        $struct[] = array(
                                'dateCreated' => new IXR_Date($post_date),
 
                        $struct[] = array(
                                'dateCreated' => new IXR_Date($post_date),
@@ -2933,14 +2956,13 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
                $this->escape($args);
 
                $blog_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $user_login );
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
 
                if( !current_user_can( 'edit_posts' ) )
                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
 
@@ -2973,14 +2995,13 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                        return $this->error;
                }
 
-               set_current_user( 0, $user_login );
                if( !current_user_can( 'edit_post', $post_ID ) )
                        return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
 
                if( !current_user_can( 'edit_post', $post_ID ) )
                        return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
 
@@ -3015,19 +3036,18 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
                $categories  = $args[3];
 
                $categories  = $args[3];
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'mt.setPostCategories');
 
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'mt.setPostCategories');
 
-               set_current_user(0, $user_login);
                if ( !current_user_can('edit_post', $post_ID) )
                if ( !current_user_can('edit_post', $post_ID) )
-                       return new IXR_Error(401, __('Sorry, you can not edit this post.'));
+                       return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
 
                foreach($categories as $cat) {
                        $catids[] = $cat['categoryId'];
 
                foreach($categories as $cat) {
                        $catids[] = $cat['categoryId'];
@@ -3127,18 +3147,17 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
                $this->escape($args);
 
                $post_ID     = (int) $args[0];
-               $user_login  = $args[1];
-               $user_pass   = $args[2];
+               $username  = $args[1];
+               $password   = $args[2];
 
 
-               if (!$this->login_pass_ok($user_login, $user_pass)) {
+               if ( !$user = $this->login($username, $password) ) {
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'mt.publishPost');
 
                        return $this->error;
                }
 
                do_action('xmlrpc_call', 'mt.publishPost');
 
-               set_current_user(0, $user_login);
                if ( !current_user_can('edit_post', $post_ID) )
                if ( !current_user_can('edit_post', $post_ID) )
-                       return new IXR_Error(401, __('Sorry, you can not edit this post.'));
+                       return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
 
                $postdata = wp_get_single_post($post_ID,ARRAY_A);
 
 
                $postdata = wp_get_single_post($post_ID,ARRAY_A);
 
@@ -3225,7 +3244,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        }
                } else {
                        // TODO: Attempt to extract a post ID from the given URL
                        }
                } else {
                        // TODO: Attempt to extract a post ID from the given URL
-                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'));
+                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
                }
                $post_ID = (int) $post_ID;
 
                }
                $post_ID = (int) $post_ID;
 
@@ -3235,14 +3254,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $post = get_post($post_ID);
 
                if ( !$post ) // Post_ID not found
                $post = get_post($post_ID);
 
                if ( !$post ) // Post_ID not found
-                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'));
+                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
 
                if ( $post_ID == url_to_postid($pagelinkedfrom) )
                        return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.'));
 
                // Check if pings are on
                if ( !pings_open($post) )
 
                if ( $post_ID == url_to_postid($pagelinkedfrom) )
                        return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.'));
 
                // Check if pings are on
                if ( !pings_open($post) )
-                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'));
+                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
 
                // Let's check that the remote site didn't already pingback this entry
                $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) );
 
                // Let's check that the remote site didn't already pingback this entry
                $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) );
@@ -3308,7 +3327,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $pagelinkedfrom = str_replace('&', '&amp;', $pagelinkedfrom);
 
 
                $pagelinkedfrom = str_replace('&', '&amp;', $pagelinkedfrom);
 
-               $context = '[...] ' . wp_specialchars( $excerpt ) . ' [...]';
+               $context = '[...] ' . esc_html( $excerpt ) . ' [...]';
                $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom );
 
                $comment_post_ID = (int) $post_ID;
                $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom );
 
                $comment_post_ID = (int) $post_ID;
@@ -3341,7 +3360,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                global $wpdb;
 
 
                global $wpdb;
 
-               do_action('xmlrpc_call', 'pingback.extensions.getPingsbacks');
+               do_action('xmlrpc_call', 'pingback.extensions.getPingbacks');
 
                $this->escape($args);
 
 
                $this->escape($args);
 
@@ -3350,7 +3369,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $post_ID = url_to_postid($url);
                if (!$post_ID) {
                        // We aren't sure that the resource is available and/or pingback enabled
                $post_ID = url_to_postid($url);
                if (!$post_ID) {
                        // We aren't sure that the resource is available and/or pingback enabled
-                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'));
+                       return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
                }
 
                $actual_post = wp_get_single_post($post_ID, ARRAY_A);
                }
 
                $actual_post = wp_get_single_post($post_ID, ARRAY_A);